law-common 12.6.1-beta.4 → 12.6.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1 @@
1
- # law-common
1
+ # law-common
@@ -61,4 +61,10 @@ export declare class ClientDebitNoteEntityModel extends BaseEntityModel<EntityEn
61
61
  getUpdateActionVisibility(currentUser: UserEntityModel): {
62
62
  [key: string]: () => boolean;
63
63
  };
64
+ deriveAmountInCurrency(): number;
65
+ static deriveAmountInCurrency(data: {
66
+ currency?: CurrencyEnum;
67
+ totalAmount?: number;
68
+ conversionRate?: number;
69
+ }): number;
64
70
  }
@@ -292,6 +292,15 @@ class ClientDebitNoteEntityModel extends base_entity_model_1.BaseEntityModel {
292
292
  getUpdateActionVisibility(currentUser) {
293
293
  return {};
294
294
  }
295
+ deriveAmountInCurrency() {
296
+ return ClientDebitNoteEntityModel.deriveAmountInCurrency({ currency: this.currency, totalAmount: this.totalAmount, conversionRate: this.conversionRate });
297
+ }
298
+ static deriveAmountInCurrency(data) {
299
+ var _a, _b, _c;
300
+ const currency = (_a = data.currency) !== null && _a !== void 0 ? _a : enums_1.CurrencyEnum.INR;
301
+ const totalAmount = (_b = data.totalAmount) !== null && _b !== void 0 ? _b : 0;
302
+ return currency === enums_1.CurrencyEnum.INR ? totalAmount : totalAmount / ((_c = data.conversionRate) !== null && _c !== void 0 ? _c : 1);
303
+ }
295
304
  }
296
305
  exports.ClientDebitNoteEntityModel = ClientDebitNoteEntityModel;
297
306
  // clientDebitNoteParticularss?: ClientDebitNoteParticularsEntityModel[];
package/dist/src/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
@@ -149,12 +149,12 @@ export declare function getEnumNames(enumType: object): string[];
149
149
  export declare function getFilterByPermission<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
150
150
  [key: string]: IEntityFilterData<T>;
151
151
  }, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): {
152
- [x: string]: any;
152
+ [propertyName]: any;
153
153
  };
154
154
  export declare function getFilterByPermissionFn<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
155
155
  [key: string]: () => Promise<IEntityFilterData<T>>;
156
156
  }, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): Promise<{
157
- [x: string]: any;
157
+ [propertyName]: any;
158
158
  }>;
159
159
  export declare function getPropertyFilterByPermissionFn<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
160
160
  [key: string]: () => Promise<IEntityFilterData<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "12.6.1-beta.4",
3
+ "version": "12.6.3-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [