law-common 10.63.2-beta.0 → 10.63.2-beta.10

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.
Files changed (33) hide show
  1. package/dist/src/api/interface/vendor-invoice.entity.response.d.ts +5 -19
  2. package/dist/src/api/interface/vendor-invoice.entity.response.js +22 -0
  3. package/dist/src/api/interface/vendor_invoice.update.dto.interface.d.ts +2 -1
  4. package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.d.ts +1 -4
  5. package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.js +3 -0
  6. package/dist/src/entities/enums/vendor_invoice_action.enum.d.ts +3 -0
  7. package/dist/src/entities/enums/vendor_invoice_action.enum.js +7 -0
  8. package/dist/src/entities/enums/vendor_invoice_action_status_enum.d.ts +8 -6
  9. package/dist/src/entities/enums/vendor_invoice_action_status_enum.js +17 -10
  10. package/dist/src/entities/flow-configs/billing.flow.config.d.ts +4 -2
  11. package/dist/src/entities/flow-configs/billing.flow.config.js +12 -4
  12. package/dist/src/entities/flow-configs/flow-config.type.d.ts +53 -0
  13. package/dist/src/entities/flow-configs/flow-config.type.js +17 -0
  14. package/dist/src/entities/flow-configs/leave.flow.config.js +21 -0
  15. package/dist/src/entities/flow-configs/vendor-invoice-flow.config.d.ts +2 -11
  16. package/dist/src/entities/flow-configs/vendor-invoice-flow.config.js +192 -88
  17. package/dist/src/entities/interface/vendor_invoice.entity.interface.d.ts +5 -0
  18. package/dist/src/entities/interface/vendor_invoice_item.entity.interface.d.ts +5 -3
  19. package/dist/src/entities/model/leave.entity.model.d.ts +1 -0
  20. package/dist/src/entities/model/leave.entity.model.js +13 -0
  21. package/dist/src/entities/model/user.entity.model.d.ts +1 -0
  22. package/dist/src/entities/model/user.entity.model.js +4 -1
  23. package/dist/src/entities/model/vendor.entity.model.d.ts +3 -2
  24. package/dist/src/entities/model/vendor.entity.model.js +2 -1
  25. package/dist/src/entities/model/vendor_invoice.entity.model.d.ts +5 -0
  26. package/dist/src/entities/model/vendor_invoice.entity.model.js +15 -11
  27. package/dist/src/entities/model/vendor_invoice_item.entity.model.d.ts +20 -18
  28. package/dist/src/entities/model/vendor_invoice_item.entity.model.js +93 -66
  29. package/dist/src/utils/code.util.d.ts +2 -0
  30. package/dist/src/utils/code.util.js +4 -0
  31. package/dist/src/utils/string.util.d.ts +11 -0
  32. package/dist/src/utils/string.util.js +11 -0
  33. package/package.json +3 -2
@@ -1,29 +1,15 @@
1
1
  import { IVendorInvoiceEntity, VendorInvoiceActionStatusEnum, VendorInvoiceItemEntityModel } from "../../entities";
2
2
  import { VendorInvoiceActionEnum } from "../../entities/enums/vendor_invoice_action.enum";
3
- import { VendorInvoiceItemActionEnum } from "../../entities/enums/vendor_invoice_item_action.enum";
4
- import { VendorInvoiceItemStatus } from "../../entities/enums/vendor_invoice_item_status.enum";
5
3
  export interface IVendorInvoiceFlowContextData {
6
4
  invoice: IVendorInvoiceEntity;
7
5
  items: VendorInvoiceItemEntityModel[];
8
6
  }
9
7
  export type IVendorInvoiceFlowConfig = {
10
- parent: {
11
- [key in VendorInvoiceActionStatusEnum]?: {
12
- actions: {
13
- [key in VendorInvoiceActionEnum]?: {
14
- permissions: string[];
15
- next?: (data: IVendorInvoiceFlowContextData) => VendorInvoiceActionStatusEnum;
16
- };
17
- };
18
- };
19
- };
20
- child: {
21
- [key in VendorInvoiceItemStatus]?: {
22
- actions: {
23
- [key in VendorInvoiceItemActionEnum]?: {
24
- permissions: string[];
25
- next?: () => VendorInvoiceItemStatus;
26
- };
8
+ [key in VendorInvoiceActionStatusEnum]?: {
9
+ actions: {
10
+ [key in VendorInvoiceActionEnum]?: {
11
+ permissions: string[];
12
+ next: () => VendorInvoiceActionStatusEnum;
27
13
  };
28
14
  };
29
15
  };
@@ -1,2 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // export type IVendorInvoiceFlowConfig = {
4
+ // parent: {
5
+ // [key in VendorInvoiceActionStatusEnum]?: {
6
+ // actions: {
7
+ // [key in VendorInvoiceActionEnum]?: {
8
+ // permissions: string[];
9
+ // next?: (data: IVendorInvoiceFlowContextData) => VendorInvoiceActionStatusEnum;
10
+ // };
11
+ // };
12
+ // };
13
+ // };
14
+ // child: {
15
+ // [key in VendorInvoiceItemStatus]?: {
16
+ // actions: {
17
+ // [key in VendorInvoiceItemActionEnum]?: {
18
+ // permissions: string[];
19
+ // next?: () => VendorInvoiceItemStatus;
20
+ // };
21
+ // };
22
+ // };
23
+ // };
24
+ // };
@@ -1,10 +1,11 @@
1
- import { EntityEnum, EnumEntityType, VendorInvoiceActionEnum } from "../../entities";
1
+ import { EntityEnum, EnumEntityType, VendorInvoiceActionEnum, VendorInvoiceActionStatusEnum } from "../../entities";
2
2
  import { IDeleteDocumentDetails } from "../../misc";
3
3
  import { DeepPartialButRequired } from "./api.utils.interface";
4
4
  import { IVendorInvoiceCreateDto } from "./vendor_invoice.create.dto.interface";
5
5
  export type IVendorInvoiceUpdateDto = DeepPartialButRequired<IVendorInvoiceCreateDto, never> & {
6
6
  deleteDocumentDetails?: IDeleteDocumentDetails<EnumEntityType<EntityEnum.VENDOR_INVOICE>>;
7
7
  actionData: IVendorInvoiceActionDataDto;
8
+ actionStatus?: VendorInvoiceActionStatusEnum;
8
9
  };
9
10
  export interface IVendorInvoiceActionDataDto {
10
11
  action: VendorInvoiceActionEnum;
@@ -1,6 +1,3 @@
1
- import { VendorInvoiceItemActionEnum } from "../../entities";
2
1
  import { DeepPartialButRequired } from "./api.utils.interface";
3
2
  import { IVendorInvoiceItemCreateDto } from "./vendor_invoice_item.create.dto.interface";
4
- export type IVendorInvoiceItemUpdateDto = DeepPartialButRequired<IVendorInvoiceItemCreateDto, never> & {
5
- action?: VendorInvoiceItemActionEnum;
6
- };
3
+ export type IVendorInvoiceItemUpdateDto = DeepPartialButRequired<IVendorInvoiceItemCreateDto, never>;
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // & {
4
+ // action?: VendorInvoiceItemActionEnum;
5
+ // };
@@ -2,5 +2,8 @@ export declare enum VendorInvoiceActionEnum {
2
2
  VIEW = "view",
3
3
  EDIT = "edit",
4
4
  DELETE = "delete",
5
+ CREATE = "create",
6
+ APPROVE = "approve",
7
+ REJECT = "reject",
5
8
  UPDATE_PAYMENT = "update_payment"
6
9
  }
@@ -6,5 +6,12 @@ var VendorInvoiceActionEnum;
6
6
  VendorInvoiceActionEnum["VIEW"] = "view";
7
7
  VendorInvoiceActionEnum["EDIT"] = "edit";
8
8
  VendorInvoiceActionEnum["DELETE"] = "delete";
9
+ VendorInvoiceActionEnum["CREATE"] = "create";
10
+ VendorInvoiceActionEnum["APPROVE"] = "approve";
11
+ VendorInvoiceActionEnum["REJECT"] = "reject";
9
12
  VendorInvoiceActionEnum["UPDATE_PAYMENT"] = "update_payment";
13
+ // RECALL = "recall",
14
+ // VIEW = "view",
15
+ // EDIT = "edit",
16
+ // DELETE = "delete",
10
17
  })(VendorInvoiceActionEnum || (exports.VendorInvoiceActionEnum = VendorInvoiceActionEnum = {}));
@@ -1,8 +1,10 @@
1
1
  export declare enum VendorInvoiceActionStatusEnum {
2
- PENDING_APPROVAL = "PENDING_APPROVAL",
3
- APPROVED = "APPROVED",
4
- REJECTED = "REJECTED",
5
- PARTIALLY_APPROVED = "PARTIALLY_APPROVED",
6
- PAYMENT_DISBURSE = "PAYMENT_DISBURSE",
7
- DELETED = "DELETED"
2
+ CREATE_APPROVAL = "create_approval",
3
+ EDIT_APPROVAL = "edit_approval",
4
+ DELETE_APPROVAL = "delete_approval",
5
+ REJECTED = "rejected",
6
+ APPROVED = "approved",
7
+ DELETED = "deleted",
8
+ RESOLVED_REJECTED = "resolved_rejected",
9
+ PAYMENT_DISBURSE = "payment_disburse"
8
10
  }
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
- // export enum VendorInvoiceActionStatusEnum {
3
- // PENDING_APPROVAL = "PENDING_APPROVAL",
4
- // APPROVED = "APPROVED",
5
- // }
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.VendorInvoiceActionStatusEnum = void 0;
8
4
  var VendorInvoiceActionStatusEnum;
9
5
  (function (VendorInvoiceActionStatusEnum) {
10
- VendorInvoiceActionStatusEnum["PENDING_APPROVAL"] = "PENDING_APPROVAL";
11
- VendorInvoiceActionStatusEnum["APPROVED"] = "APPROVED";
12
- VendorInvoiceActionStatusEnum["REJECTED"] = "REJECTED";
13
- VendorInvoiceActionStatusEnum["PARTIALLY_APPROVED"] = "PARTIALLY_APPROVED";
14
- VendorInvoiceActionStatusEnum["PAYMENT_DISBURSE"] = "PAYMENT_DISBURSE";
15
- VendorInvoiceActionStatusEnum["DELETED"] = "DELETED";
6
+ VendorInvoiceActionStatusEnum["CREATE_APPROVAL"] = "create_approval";
7
+ VendorInvoiceActionStatusEnum["EDIT_APPROVAL"] = "edit_approval";
8
+ VendorInvoiceActionStatusEnum["DELETE_APPROVAL"] = "delete_approval";
9
+ VendorInvoiceActionStatusEnum["REJECTED"] = "rejected";
10
+ VendorInvoiceActionStatusEnum["APPROVED"] = "approved";
11
+ VendorInvoiceActionStatusEnum["DELETED"] = "deleted";
12
+ VendorInvoiceActionStatusEnum["RESOLVED_REJECTED"] = "resolved_rejected";
13
+ VendorInvoiceActionStatusEnum["PAYMENT_DISBURSE"] = "payment_disburse";
14
+ // PENDING_APPROVAL = "PENDING_APPROVAL",
15
+ // APPROVED = "APPROVED",
16
+ // REJECTED = "REJECTED",
17
+ // PARTIALLY_APPROVED = "PARTIALLY_APPROVED",
18
+ // DELETED = "DELETED",
16
19
  })(VendorInvoiceActionStatusEnum || (exports.VendorInvoiceActionStatusEnum = VendorInvoiceActionStatusEnum = {}));
20
+ // export enum VendorInvoiceActionStatusEnum {
21
+ // PENDING_APPROVAL = "PENDING_APPROVAL",
22
+ // APPROVED = "APPROVED",
23
+ // }
@@ -1,4 +1,6 @@
1
- import { IBillingFlowConfig, IBillingFlowContextData } from "../../api";
1
+ import { IBillingFlowContextData } from "../../api";
2
+ import { BillingActionsEnum } from "../enums/billing.action.enum";
2
3
  import { BillingStatusEnum } from "../enums/billing.status.enum";
3
- export declare let billingFlowConfig: IBillingFlowConfig;
4
+ import { FlowConfig } from "./flow-config.type";
5
+ export declare let billingFlowConfig: FlowConfig<BillingStatusEnum, BillingActionsEnum, IBillingFlowContextData>;
4
6
  export declare function getNextStatusTotalAmount(data: IBillingFlowContextData): BillingStatusEnum;
@@ -8,6 +8,7 @@ const billing_action_enum_1 = require("../enums/billing.action.enum");
8
8
  const billing_status_enum_1 = require("../enums/billing.status.enum");
9
9
  exports.billingFlowConfig = {
10
10
  [billing_status_enum_1.BillingStatusEnum.PENDING_APPROVAL]: {
11
+ description: "The Proforma Invoice has been created and is awaiting review and approval by internal stakeholders (org or project approvers).",
11
12
  actions: {
12
13
  [billing_action_enum_1.BillingActionsEnum.APPROVE]: {
13
14
  permissions: ["BILLING_APPROVER_ORG", "BILLING_APPROVER_PROJECT"],
@@ -32,6 +33,7 @@ exports.billingFlowConfig = {
32
33
  },
33
34
  },
34
35
  [billing_status_enum_1.BillingStatusEnum.REQUEST_CHANGES]: {
36
+ description: "Stakeholders have reviewed the Proforma Invoice and requested modifications before it can be approved. The invoice is pending amendments by the billing team.",
35
37
  actions: {
36
38
  [billing_action_enum_1.BillingActionsEnum.EDIT]: {
37
39
  permissions: ["BILLING_AMENDMENT_ORG"],
@@ -46,6 +48,7 @@ exports.billingFlowConfig = {
46
48
  },
47
49
  },
48
50
  [billing_status_enum_1.BillingStatusEnum.INTERNAL_APPROVED]: {
51
+ description: "The Proforma Invoice has been reviewed and approved by internal stakeholders. It is now ready to be forwarded to the client for review.",
49
52
  actions: {
50
53
  [billing_action_enum_1.BillingActionsEnum.SEND_FOR_CLIENT_REVIEW]: {
51
54
  permissions: ["BILLING_AMENDMENT_ORG"],
@@ -55,6 +58,7 @@ exports.billingFlowConfig = {
55
58
  },
56
59
  },
57
60
  [billing_status_enum_1.BillingStatusEnum.PENDING_CLIENT_REVIEW]: {
61
+ description: "The Proforma Invoice has been shared with the client and is awaiting their response. The client may either accept the invoice or request revisions.",
58
62
  actions: {
59
63
  [billing_action_enum_1.BillingActionsEnum.CLIENT_REVISION]: {
60
64
  permissions: ["BILLING_AMENDMENT_ORG"],
@@ -69,6 +73,7 @@ exports.billingFlowConfig = {
69
73
  },
70
74
  },
71
75
  [billing_status_enum_1.BillingStatusEnum.CLIENT_REVISION_APPROVAL]: {
76
+ description: "The client has requested revisions to the invoice. Internal stakeholders are reviewing whether to approve the revision request, reject it, or ask for further changes.",
72
77
  actions: {
73
78
  [billing_action_enum_1.BillingActionsEnum.APPROVAL]: {
74
79
  permissions: ["BILLING_APPROVER_ORG", "BILLING_APPROVER_PROJECT"],
@@ -93,6 +98,7 @@ exports.billingFlowConfig = {
93
98
  },
94
99
  },
95
100
  [billing_status_enum_1.BillingStatusEnum.REJECT_CLIENT_REVISION]: {
101
+ description: "The client's revision request has been rejected by internal stakeholders. The billing team can proceed to send the original invoice to the client.",
96
102
  actions: {
97
103
  [billing_action_enum_1.BillingActionsEnum.SEND_INVOICE]: {
98
104
  permissions: ["BILLING_AMENDMENT_ORG"],
@@ -102,22 +108,24 @@ exports.billingFlowConfig = {
102
108
  },
103
109
  },
104
110
  [billing_status_enum_1.BillingStatusEnum.INVOICE_SENT]: {
111
+ description: "The final invoice has been issued to the client following a rejected revision request. Payment is being tracked; partial payments may be recorded until the invoice is fully settled.",
105
112
  actions: {
106
113
  [billing_action_enum_1.BillingActionsEnum.UPDATE_PAYMENT]: {
107
114
  permissions: ["BILLING_AMENDMENT_ORG"],
108
115
  next: (data) => {
109
- return getNextStatusTotalAmount(data);
116
+ return data ? getNextStatusTotalAmount(data) : billing_status_enum_1.BillingStatusEnum.INVOICE_SENT;
110
117
  },
111
118
  description: "Updates received payment details and recalculates outstanding amount.",
112
119
  },
113
120
  },
114
121
  },
115
122
  [billing_status_enum_1.BillingStatusEnum.PENDING_PAYMENT]: {
123
+ description: "The final invoice has been sent to the client and payment is awaited. Partial or full payments can be recorded; the invoice remains in this state until the total amount is fully settled.",
116
124
  actions: {
117
125
  [billing_action_enum_1.BillingActionsEnum.UPDATE_PAYMENT]: {
118
126
  permissions: ["BILLING_AMENDMENT_ORG"],
119
127
  next: (data) => {
120
- return getNextStatusTotalAmount(data);
128
+ return data ? getNextStatusTotalAmount(data) : billing_status_enum_1.BillingStatusEnum.PENDING_PAYMENT;
121
129
  },
122
130
  description: "Tracks partial or full payments until the invoice is completely settled.",
123
131
  },
@@ -130,6 +138,7 @@ exports.billingFlowConfig = {
130
138
  },
131
139
  },
132
140
  [billing_status_enum_1.BillingStatusEnum.SETTLED]: {
141
+ description: "The invoice has been fully settled. The total amount due has been accounted for through a combination of payments, credit notes, write-offs, TDS, and refunds. No further actions are required.",
133
142
  actions: {},
134
143
  },
135
144
  };
@@ -165,12 +174,11 @@ function addPdfViewToAllStatuses(config) {
165
174
  const PDF_VIEW_ACTION = billing_action_enum_1.BillingActionsEnum.PDF_VIEW;
166
175
  const pdfViewActionConfig = {
167
176
  permissions: ["BILLING_VIEW_PDF"],
168
- next: (status) => status,
169
177
  };
170
178
  for (const [status, configEntry] of Object.entries(config)) {
171
179
  const actions = configEntry.actions;
172
180
  if (!actions[PDF_VIEW_ACTION]) {
173
- actions[PDF_VIEW_ACTION] = Object.assign(Object.assign({}, pdfViewActionConfig), { next: () => status, description: "" });
181
+ actions[PDF_VIEW_ACTION] = Object.assign(Object.assign({}, pdfViewActionConfig), { next: (data) => status, description: "" });
174
182
  }
175
183
  }
176
184
  return config;
@@ -1,10 +1,63 @@
1
+ /**
2
+ * Defines the complete state machine configuration for a domain entity.
3
+ * Maps each status to its available actions and their metadata.
4
+ *
5
+ * Used as the single source of truth for what actions are valid
6
+ * at each status, and what permissions are required to execute them.
7
+ *
8
+ * @template S - String enum of all possible statuses
9
+ * @template A - String enum of all possible actions
10
+ * @template T - Optional context data shape passed to the `next()` resolver.
11
+ * Defaults to `never` for flows where `next()` needs no runtime data.
12
+ *
13
+ * @example
14
+ * // Simple flat flow (billing, leave, vendor)
15
+ * const billingFlowConfig: FlowConfig<BillingStatusEnum, BillingActionsEnum> = {
16
+ * [BillingStatusEnum.PENDING]: {
17
+ * actions: {
18
+ * [BillingActionsEnum.APPROVE]: {
19
+ * permissions: ["BILLING_APPROVE_ORG"],
20
+ * next: () => BillingStatusEnum.APPROVED,
21
+ * },
22
+ * },
23
+ * },
24
+ * };
25
+ *
26
+ * @example
27
+ * // Flow with context data (reimbursement parent)
28
+ * const config: FlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, IReimbursementFlowContextData> = { ... }
29
+ */
1
30
  export type FlowConfig<S extends string, A extends string, T extends Record<any, any> = never> = {
2
31
  [key in S]?: {
3
32
  actions: {
4
33
  [key in A]?: IFlowConfigActionConfig<S, T>;
5
34
  };
35
+ description?: string;
6
36
  };
7
37
  };
38
+ /**
39
+ * Configuration for a single action within a {@link FlowConfig}.
40
+ * Defines who can execute the action and what status it transitions to.
41
+ *
42
+ * @template S - String enum of statuses, used as the return type of `next()`
43
+ * @template T - Optional context data passed to `next()` for dynamic status resolution.
44
+ * Pass `never` for actions where the next status is always static.
45
+ *
46
+ * @example
47
+ * // Static next status
48
+ * const approveAction: IFlowConfigActionConfig<BillingStatusEnum, never> = {
49
+ * permissions: ["BILLING_APPROVE_ORG"],
50
+ * next: () => BillingStatusEnum.APPROVED,
51
+ * description: "Approve this billing entry",
52
+ * };
53
+ *
54
+ * @example
55
+ * // Dynamic next status based on context
56
+ * const editAction: IFlowConfigActionConfig<ReimbursementStatusEnum, IReimbursementFlowContextData> = {
57
+ * permissions: ["REIMBURSEMENT_UPDATE_SELF"],
58
+ * next: (data) => areAllRowsApproved(data) ? ReimbursementStatusEnum.APPROVED : ReimbursementStatusEnum.APPROVAL_PENDING,
59
+ * };
60
+ */
8
61
  export interface IFlowConfigActionConfig<S extends string, T> {
9
62
  permissions: string[];
10
63
  next: (data?: T) => S;
@@ -1,2 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // export type FlowConfig<S extends string, A extends string, T extends Record<any, any> = never> = {
4
+ // [key in S]?: {
5
+ // actions: {
6
+ // [key in A]?: {
7
+ // permissions: string[];
8
+ // next: (data?: T) => S;
9
+ // description?: string;
10
+ // };
11
+ // };
12
+ // description?: string;
13
+ // };
14
+ // };
15
+ // export interface IFlowConfigActionConfig<S extends string, T> {
16
+ // permissions: string[];
17
+ // next: (data?: T) => S;
18
+ // description?: string;
19
+ // }
@@ -5,6 +5,7 @@ const leave_action_enum_1 = require("../enums/leave.action.enum");
5
5
  const leave_status_enum_1 = require("../enums/leave.status.enum");
6
6
  exports.leaveFlowConfig = {
7
7
  [leave_status_enum_1.LeaveStatusEnum.PENDING_APPROVAL]: {
8
+ description: "The leave request has been submitted and is awaiting approval from the approver.",
8
9
  actions: {
9
10
  // [LeaveActionEnum.READ]: {
10
11
  // permissions: ["LEAVE_READ_ORG"],
@@ -13,22 +14,27 @@ exports.leaveFlowConfig = {
13
14
  [leave_action_enum_1.LeaveActionEnum.EDIT]: {
14
15
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
15
16
  next: () => leave_status_enum_1.LeaveStatusEnum.PENDING_APPROVAL,
17
+ description: "Allows the employee to edit the leave request while it is still awaiting approval.",
16
18
  },
17
19
  [leave_action_enum_1.LeaveActionEnum.APPROVE]: {
18
20
  permissions: ["LEAVE_APPROVER_ORG"],
19
21
  next: () => leave_status_enum_1.LeaveStatusEnum.APPROVED,
22
+ description: "Approves the leave request. The employee's leave will be marked as approved.",
20
23
  },
21
24
  [leave_action_enum_1.LeaveActionEnum.REJECT]: {
22
25
  permissions: ["LEAVE_APPROVER_ORG"],
23
26
  next: () => leave_status_enum_1.LeaveStatusEnum.REJECTED,
27
+ description: "Rejects the leave request. The employee will be notified of the rejection.",
24
28
  },
25
29
  [leave_action_enum_1.LeaveActionEnum.DELETE]: {
26
30
  permissions: ["LEAVE_DELETE_SELF"],
27
31
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETED,
32
+ description: "Deletes the leave request entirely before it has been approved.",
28
33
  },
29
34
  },
30
35
  },
31
36
  [leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL]: {
37
+ description: "An edit to an existing leave request has been submitted and is awaiting re-approval.",
32
38
  actions: {
33
39
  // [LeaveActionEnum.READ]: {
34
40
  // permissions: ["LEAVE_CREATOR", "LEAVE_APPROVER_ORG"],
@@ -37,22 +43,27 @@ exports.leaveFlowConfig = {
37
43
  [leave_action_enum_1.LeaveActionEnum.EDIT]: {
38
44
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
39
45
  next: () => leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL,
46
+ description: "Allows further edits to the leave request while the edit is pending approval.",
40
47
  },
41
48
  [leave_action_enum_1.LeaveActionEnum.RECALL]: {
42
49
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
43
50
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL, // Rolls back to previous state
51
+ description: "Recalls the edit request, rolling back the leave to its previous approved state.",
44
52
  },
45
53
  [leave_action_enum_1.LeaveActionEnum.REJECT]: {
46
54
  permissions: ["LEAVE_APPROVER_ORG"],
47
55
  next: () => leave_status_enum_1.LeaveStatusEnum.RESOLVE_REJECTED,
56
+ description: "Rejects the requested edit. The leave is moved to a resolve-rejected state for further action.",
48
57
  },
49
58
  [leave_action_enum_1.LeaveActionEnum.APPROVE]: {
50
59
  permissions: ["LEAVE_APPROVER_ORG"],
51
60
  next: () => leave_status_enum_1.LeaveStatusEnum.APPROVED,
61
+ description: "Approves the edited leave request. The updated leave details will be applied.",
52
62
  },
53
63
  },
54
64
  },
55
65
  [leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL]: {
66
+ description: "A deletion request for this leave has been submitted and is awaiting approver confirmation.",
56
67
  actions: {
57
68
  // [LeaveActionEnum.READ]: {
58
69
  // permissions: ["LEAVE_CREATOR"],
@@ -61,22 +72,27 @@ exports.leaveFlowConfig = {
61
72
  [leave_action_enum_1.LeaveActionEnum.EDIT]: {
62
73
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
63
74
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL,
75
+ description: "Allows editing the leave request while the deletion is pending approval.",
64
76
  },
65
77
  [leave_action_enum_1.LeaveActionEnum.RECALL]: {
66
78
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
67
79
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETED, // Rolls back to previous state
80
+ description: "Recalls the deletion request, cancelling the leave entirely.",
68
81
  },
69
82
  [leave_action_enum_1.LeaveActionEnum.REJECT]: {
70
83
  permissions: ["LEAVE_APPROVER_ORG"],
71
84
  next: () => leave_status_enum_1.LeaveStatusEnum.RESOLVE_REJECTED,
85
+ description: "Rejects the deletion request. The leave is moved to a resolve-rejected state.",
72
86
  },
73
87
  [leave_action_enum_1.LeaveActionEnum.APPROVE]: {
74
88
  permissions: ["LEAVE_APPROVER_ORG"],
75
89
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETED,
90
+ description: "Approves the deletion request. The leave record will be permanently deleted.",
76
91
  },
77
92
  },
78
93
  },
79
94
  [leave_status_enum_1.LeaveStatusEnum.APPROVED]: {
95
+ description: "The leave request has been approved. Further edits or deletion require re-approval.",
80
96
  actions: {
81
97
  // [LeaveActionEnum.READ]: {
82
98
  // permissions: ["LEAVE_CREATOR", "LEAVE_APPROVER_ORG"],
@@ -85,10 +101,12 @@ exports.leaveFlowConfig = {
85
101
  [leave_action_enum_1.LeaveActionEnum.EDIT]: {
86
102
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
87
103
  next: () => leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL,
104
+ description: "Requests an edit to an already approved leave. The change will require re-approval.",
88
105
  },
89
106
  [leave_action_enum_1.LeaveActionEnum.DELETE]: {
90
107
  permissions: ["LEAVE_DELETE_SELF"],
91
108
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL,
109
+ description: "Requests deletion of an approved leave. The deletion will require approver confirmation.",
92
110
  },
93
111
  },
94
112
  },
@@ -101,6 +119,7 @@ exports.leaveFlowConfig = {
101
119
  // },
102
120
  // },
103
121
  [leave_status_enum_1.LeaveStatusEnum.RESOLVE_REJECTED]: {
122
+ description: "A previous action was rejected and requires the employee to take corrective action.",
104
123
  actions: {
105
124
  // [LeaveActionEnum.READ]: {
106
125
  // permissions: ["LEAVE_CREATOR", "LEAVE_APPROVER_ORG"],
@@ -109,10 +128,12 @@ exports.leaveFlowConfig = {
109
128
  [leave_action_enum_1.LeaveActionEnum.EDIT]: {
110
129
  permissions: ["LEAVE_UPDATE_SELF", "LEAVE_UPDATE_ORG"],
111
130
  next: () => leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL,
131
+ description: "Allows the employee to edit and resubmit the leave request after it was rejected.",
112
132
  },
113
133
  [leave_action_enum_1.LeaveActionEnum.DELETE]: {
114
134
  permissions: ["LEAVE_DELETE_SELF"],
115
135
  next: () => leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL,
136
+ description: "Requests deletion of the rejected leave record.",
116
137
  },
117
138
  },
118
139
  },
@@ -1,11 +1,2 @@
1
- import { IVendorInvoiceFlowContextData } from "../../api";
2
- import { VendorInvoiceActionEnum } from "../enums/vendor_invoice_action.enum";
3
- import { VendorInvoiceActionStatusEnum } from "../enums/vendor_invoice_action_status_enum";
4
- import { VendorInvoiceItemActionEnum } from "../enums/vendor_invoice_item_action.enum";
5
- import { VendorInvoiceItemStatus } from "../enums/vendor_invoice_item_status.enum";
6
- import { FlowConfig, ParentChildFlowConfig } from "./flow-config.type";
7
- export type VendorInvoiceFlowConfig<S extends string, A extends string, CS extends string = never, CA extends string = never> = {
8
- parent?: FlowConfig<S, A>;
9
- child?: FlowConfig<CS, CA>;
10
- };
11
- export declare const vendorInvoiceConfigFlow: ParentChildFlowConfig<VendorInvoiceActionStatusEnum, VendorInvoiceActionEnum, VendorInvoiceItemStatus, VendorInvoiceItemActionEnum, IVendorInvoiceFlowContextData>;
1
+ import { IVendorInvoiceFlowConfig } from "../../api";
2
+ export declare const vendorInvoiceFlowConfig: IVendorInvoiceFlowConfig;