law-common 10.63.1 → 10.63.2-beta.1

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.
@@ -1,13 +1,15 @@
1
1
  export type FlowConfig<S extends string, A extends string, T extends Record<any, any> = never> = {
2
2
  [key in S]?: {
3
3
  actions: {
4
- [key in A]?: {
5
- permissions: string[];
6
- next: (data?: T) => S;
7
- };
4
+ [key in A]?: IFlowConfigActionConfig<S, T>;
8
5
  };
9
6
  };
10
7
  };
8
+ export interface IFlowConfigActionConfig<S extends string, T> {
9
+ permissions: string[];
10
+ next: (data?: T) => S;
11
+ description?: string;
12
+ }
11
13
  export type ParentChildFlowConfig<S extends string, A extends string, CS extends string = never, CA extends string = never, T extends Record<any, any> = never> = {
12
14
  parent: FlowConfig<S, A, T>;
13
15
  child: FlowConfig<CS, CA, T>;
@@ -323,7 +323,7 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
323
323
  if (nextSeq > 999) {
324
324
  throw new Error("Monthly invoice sequence exhausted");
325
325
  }
326
- console.log("old Sequence", `${basePrefix}${String(nextSeq).padStart(3, "0")}`);
326
+ // console.log("old Sequence", `${basePrefix}${String(nextSeq).padStart(3, "0")}`);
327
327
  return `${basePrefix}${String(nextSeq).padStart(3, "0")}`;
328
328
  }
329
329
  static getNextInvoiceNumberForPastFY(params) {
@@ -71,4 +71,5 @@ export declare class LeaveEntityModel extends BaseEntityModel<EntityEnum.LEAVE>
71
71
  [key: string]: () => boolean;
72
72
  };
73
73
  getNextStatus(currentUser: UserEntityModel, dto: ILeaveUpdateDto): LeaveStatusEnum;
74
+ mapStatusLabel(status: LeaveStatusEnum): string;
74
75
  }
@@ -236,6 +236,19 @@ class LeaveEntityModel extends base_entity_model_1.BaseEntityModel {
236
236
  const nextStatus = matchingPermissionConfig.next();
237
237
  return nextStatus;
238
238
  }
239
+ mapStatusLabel(status) {
240
+ var _a;
241
+ const labelMap = {
242
+ [leave_status_enum_1.LeaveStatusEnum.PENDING_APPROVAL]: "Pending Approval",
243
+ [leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL]: "Edit Pending Approval",
244
+ [leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL]: "Delete Pending Approval",
245
+ [leave_status_enum_1.LeaveStatusEnum.RESOLVE_REJECTED]: "Resolved Rejected",
246
+ [leave_status_enum_1.LeaveStatusEnum.APPROVED]: "Approved",
247
+ [leave_status_enum_1.LeaveStatusEnum.REJECTED]: "Rejected",
248
+ [leave_status_enum_1.LeaveStatusEnum.DELETED]: "Deleted",
249
+ };
250
+ return (_a = labelMap[status]) !== null && _a !== void 0 ? _a : status;
251
+ }
239
252
  }
240
253
  exports.LeaveEntityModel = LeaveEntityModel;
241
254
  LeaveEntityModel.relationConfigs = [
@@ -7,11 +7,11 @@ import { VendorInvoiceActionStatusEnum } from "../enums/vendor_invoice_action_st
7
7
  import { VendorInvoiceStatusEnum } from "../enums/vendor_invoice_status_enum";
8
8
  import { IUserEntity } from "../interface/user.entity.interface";
9
9
  import { IVendorInvoiceEntity } from "../interface/vendor_invoice.entity.interface";
10
+ import { IRowActions } from "./interface/row-actions.interface";
10
11
  import { OfficeLocationEntityModel } from "./office_location.entity.model";
12
+ import { UserEntityModel } from "./user.entity.model";
11
13
  import { VendorEntityModel } from "./vendor.entity.model";
12
14
  import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
13
- import { UserEntityModel } from "./user.entity.model";
14
- import { IRowActions } from "./interface/row-actions.interface";
15
15
  export declare class VendorInvoiceEntityModel extends BaseEntityModel<EntityEnum.VENDOR_INVOICE> implements IVendorInvoiceEntity {
16
16
  id: number;
17
17
  vendorId: number;
@@ -46,4 +46,19 @@ export declare class VendorInvoiceEntityModel extends BaseEntityModel<EntityEnum
46
46
  getUpdateActionVisibility(currentUser: UserEntityModel): {
47
47
  [key: string]: () => boolean;
48
48
  };
49
+ static getTotalBasicAmount<T extends {
50
+ basicAmount: number;
51
+ }>(data: T[]): number;
52
+ static getTotalInvoiceAmount<T extends {
53
+ invoiceAmount: number;
54
+ }>(data: T[]): number;
55
+ static getTotalGstAmount<T extends {
56
+ gstAmount: number;
57
+ }>(data: T[]): number;
58
+ static getTotalTdsAmount<T extends {
59
+ tdsAmount: number;
60
+ }>(data: T[]): number;
61
+ static getTotalNetAmount<T extends {
62
+ netAmount: number;
63
+ }>(data: T[]): number;
49
64
  }
@@ -5,12 +5,12 @@ const entity_utils_interface_1 = require("../interface/entity.utils.interface");
5
5
  const base_entity_model_1 = require("./base.entity.model");
6
6
  const error_key_enum_1 = require("../../enums/error.key.enum");
7
7
  const exceptions_1 = require("../../exceptions");
8
+ const utils_1 = require("../../utils");
8
9
  const relation_type_enum_1 = require("../enums/relation-type.enum");
9
10
  const vendor_invoice_action_enum_1 = require("../enums/vendor_invoice_action.enum");
10
11
  const vendor_invoice_action_status_enum_1 = require("../enums/vendor_invoice_action_status_enum");
11
12
  const vendor_invoice_status_enum_1 = require("../enums/vendor_invoice_status_enum");
12
13
  const vendor_invoice_flow_config_1 = require("../flow-configs/vendor-invoice-flow.config");
13
- const utils_1 = require("../../utils");
14
14
  class VendorInvoiceEntityModel extends base_entity_model_1.BaseEntityModel {
15
15
  constructor() {
16
16
  super(...arguments);
@@ -99,6 +99,22 @@ class VendorInvoiceEntityModel extends base_entity_model_1.BaseEntityModel {
99
99
  getUpdateActionVisibility(currentUser) {
100
100
  return {};
101
101
  }
102
+ static getTotalBasicAmount(data) {
103
+ // console.log("data", data);
104
+ return data.reduce((acc, item) => acc + item.basicAmount, 0);
105
+ }
106
+ static getTotalInvoiceAmount(data) {
107
+ return data.reduce((acc, item) => acc + item.invoiceAmount, 0);
108
+ }
109
+ static getTotalGstAmount(data) {
110
+ return data.reduce((acc, item) => acc + item.gstAmount, 0);
111
+ }
112
+ static getTotalTdsAmount(data) {
113
+ return data.reduce((acc, item) => acc + item.tdsAmount, 0);
114
+ }
115
+ static getTotalNetAmount(data) {
116
+ return data.reduce((acc, item) => acc + item.netAmount, 0);
117
+ }
102
118
  }
103
119
  exports.VendorInvoiceEntityModel = VendorInvoiceEntityModel;
104
120
  VendorInvoiceEntityModel.relationConfigs = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.63.1",
3
+ "version": "10.63.2-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [