law-common 10.61.2-beta.2 → 10.61.2-beta.3

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.
@@ -4,7 +4,7 @@ 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
- actionData?: IVendorInvoiceActionDataDto;
7
+ actionData: IVendorInvoiceActionDataDto;
8
8
  };
9
9
  export interface IVendorInvoiceActionDataDto {
10
10
  action: VendorInvoiceActionEnum;
@@ -4,6 +4,5 @@ export declare enum VendorActionEnum {
4
4
  DELETE = "delete",
5
5
  CREATE = "create",
6
6
  APPROVE = "approve",
7
- REJECT = "reject",
8
- RECALL = "recall"
7
+ REJECT = "reject"
9
8
  }
@@ -9,5 +9,5 @@ var VendorActionEnum;
9
9
  VendorActionEnum["CREATE"] = "create";
10
10
  VendorActionEnum["APPROVE"] = "approve";
11
11
  VendorActionEnum["REJECT"] = "reject";
12
- VendorActionEnum["RECALL"] = "recall";
12
+ // RECALL = "recall",
13
13
  })(VendorActionEnum || (exports.VendorActionEnum = VendorActionEnum = {}));
@@ -38,10 +38,10 @@ exports.vendorFlowConfig = {
38
38
  permissions: ["VENDOR_APPROVE_ORG"],
39
39
  next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
40
40
  },
41
- [vendor_action_enum_1.VendorActionEnum.RECALL]: {
42
- permissions: ["VENDOR_UPDATE"],
43
- next: () => vendor_status_enum_1.VendorStatusEnum.DELETED,
44
- },
41
+ // [VendorActionEnum.RECALL]: {
42
+ // permissions: ["VENDOR_UPDATE"],
43
+ // next: () => VendorStatusEnum.DELETED,
44
+ // },
45
45
  },
46
46
  },
47
47
  [vendor_status_enum_1.VendorStatusEnum.DELETE_APPROVAL]: {
@@ -54,10 +54,10 @@ exports.vendorFlowConfig = {
54
54
  permissions: ["VENDOR_APPROVE_ORG"],
55
55
  next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
56
56
  },
57
- [vendor_action_enum_1.VendorActionEnum.RECALL]: {
58
- permissions: ["VENDOR_UPDATE"],
59
- next: () => vendor_status_enum_1.VendorStatusEnum.DELETED,
60
- },
57
+ // [VendorActionEnum.RECALL]: {
58
+ // permissions: ["VENDOR_UPDATE"],
59
+ // next: () => VendorStatusEnum.DELETED,
60
+ // },
61
61
  },
62
62
  },
63
63
  [vendor_status_enum_1.VendorStatusEnum.APPROVED]: {
@@ -10,6 +10,9 @@ import { VendorPanTypeEnum } from "../enums/vendor_pan_type_enum";
10
10
  import { IUserEntity } from "../interface/user.entity.interface";
11
11
  import { IVendorEntity } from "../interface/vendor.entity.interface";
12
12
  import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
13
+ import { IRowActions } from "./interface/row-actions.interface";
14
+ import { UserEntityModel } from "./user.entity.model";
15
+ import { VendorActionEnum } from "../enums/vendor-action.enum";
13
16
  export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR> implements IVendorEntity {
14
17
  id: number;
15
18
  name: string;
@@ -47,4 +50,14 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
47
50
  getNextStatus(currentUser: IUserEntity, dto: IEntityUpdateDto<IVendorEntity> & {
48
51
  actionData: IVendorActionDataDto;
49
52
  }): VendorStatusEnum;
53
+ getAvailableActions(currentUser: UserEntityModel, config?: {
54
+ combinedActions?: Record<string, {
55
+ combineActions: VendorActionEnum[];
56
+ label: string;
57
+ }>;
58
+ customLabels?: Partial<Record<VendorActionEnum, string>>;
59
+ }): IRowActions<EntityEnum.VENDOR>[];
60
+ getUpdateActionVisibility(currentUser: UserEntityModel): {
61
+ [key: string]: () => boolean;
62
+ };
50
63
  }
@@ -11,6 +11,7 @@ const vendor_gst_type_enum_1 = require("../enums/vendor_gst_type_enum");
11
11
  const vendor_location_type_enum_1 = require("../enums/vendor_location_type_enum");
12
12
  const vendor_pan_type_enum_1 = require("../enums/vendor_pan_type_enum");
13
13
  const vendor_flow_config_1 = require("../flow-configs/vendor-flow.config");
14
+ const utils_1 = require("../../utils");
14
15
  class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
15
16
  constructor() {
16
17
  super(...arguments);
@@ -98,6 +99,21 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
98
99
  const nextStatus = matchingPermissionConfig.next();
99
100
  return nextStatus;
100
101
  }
102
+ getAvailableActions(currentUser, config) {
103
+ var _a;
104
+ const params = {
105
+ flowConfig: vendor_flow_config_1.vendorFlowConfig,
106
+ currentStatus: this.status,
107
+ userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
108
+ visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
109
+ combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
110
+ customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
111
+ };
112
+ return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
113
+ }
114
+ getUpdateActionVisibility(currentUser) {
115
+ return {};
116
+ }
101
117
  }
102
118
  exports.VendorEntityModel = VendorEntityModel;
103
119
  VendorEntityModel.relationConfigs = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.61.2-beta.2",
3
+ "version": "10.61.2-beta.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [