@feedmepos/mf-hrm-portal 2.1.1-dev.2 → 2.1.1-dev.4

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 (50) hide show
  1. package/dist/ApprovalCodeList-B0PLZwav.js +758 -0
  2. package/dist/{AuditLogList-DHiqs9G0.js → AuditLogList-CRXwPImZ.js} +5 -5
  3. package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-CWqNWNdD.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-zJwkM_Xb.js} +2 -2
  4. package/dist/{EmployeeList-CUd3VH5h.js → EmployeeList-DN2pnXcS.js} +7 -7
  5. package/dist/GrantUserList-DoyxknJZ.js +464 -0
  6. package/dist/{Main-DgemO-iy.js → Main-B5BKGpLg.js} +13 -11
  7. package/dist/Main-BGONIxo8.js +122 -0
  8. package/dist/{Main-B_L5flWT.js → Main-DQj4xtkB.js} +10 -8
  9. package/dist/{PermissionSetList-BaC4lKV5.js → PermissionSetList-4uIU9FvN.js} +13 -12
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-D0luaKDb.js +4122 -0
  11. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_79737e32_lang-DbPzVpnG.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DVVSBIx2.js} +1 -1
  12. package/dist/{RoleList-CThb6VEd.js → RoleList-Bj5Y5jd_.js} +12 -11
  13. package/dist/TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js +37 -0
  14. package/dist/TeamMemberList-Byjlca2Y.js +1216 -0
  15. package/dist/{TimesheetList-C_IMtsTH.js → TimesheetList-DwIcsOM-.js} +47 -46
  16. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-DGwteHIL.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-B9qlQ6KG.js} +14 -13
  17. package/dist/{app-BW91YDke.js → app-BZwE2coe.js} +2512 -2035
  18. package/dist/app.js +1 -1
  19. package/dist/approval-code-Q4666xp5.js +58 -0
  20. package/dist/{dayjs.min-DwQTpnVK.js → dayjs.min-BXBPls4m.js} +1 -1
  21. package/dist/{employee-yM0kdY70.js → employee-CJTbs1f7.js} +27 -26
  22. package/dist/grant-user-CQZaTzVt.js +67 -0
  23. package/dist/{TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js → index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js} +19 -50
  24. package/dist/iteration-BCbIbdHR.js +7682 -0
  25. package/dist/{lodash-DLReQyP0.js → lodash-CUIS1iIz.js} +1 -1
  26. package/dist/restaurant-YOVMuuFY.js +1876 -0
  27. package/dist/role-CzXchcSS.js +82 -0
  28. package/dist/{rule-BJ-o-PKi.js → rule-BO6xj2Xa.js} +37 -36
  29. package/dist/src/api/approval-code/index.d.ts +7 -0
  30. package/dist/src/router/shared.d.ts +3 -1
  31. package/dist/src/stores/approval-code.d.ts +140 -0
  32. package/dist/src/types/approval-code.d.ts +114 -0
  33. package/dist/src/views/approval-code/ApprovalCodeList.vue.d.ts +26 -0
  34. package/dist/src/views/approval-code/components/ApprovalCodeCreatedDialog.vue.d.ts +9 -0
  35. package/dist/src/views/approval-code/components/ApprovalCodeForm.vue.d.ts +22 -0
  36. package/dist/src/views/approval-code/locales/index.d.ts +360 -0
  37. package/dist/src/views/pos-access/locales/index.d.ts +48 -0
  38. package/dist/src/views/team/locales/index.d.ts +8 -0
  39. package/dist/style.css +1 -1
  40. package/dist/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/useAppStore-DNTlIeMv.js +93 -0
  42. package/dist/{useLoading-B89K5XKO.js → useLoading-BH02lYns.js} +1 -1
  43. package/dist/{useReportPermissions-Bjfhr6FD.js → useReportPermissions-Q-xLwz5N.js} +3 -3
  44. package/package.json +1 -1
  45. package/dist/Main-DUbLeLlK.js +0 -577
  46. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DddOxcG_.js +0 -4121
  47. package/dist/TeamMemberList-CAw4jr1b.js +0 -1186
  48. package/dist/iteration-Dj50K6I7.js +0 -9556
  49. package/dist/useAppStore-CHkGWiai.js +0 -169
  50. /package/dist/src/views/{grant → pos-access}/Main.vue.d.ts +0 -0
@@ -0,0 +1,82 @@
1
+ import { defineStore as S, storeToRefs as _ } from "pinia";
2
+ import { ref as w } from "vue";
3
+ import { useCoreStore as g } from "@feedmepos/mf-common";
4
+ import { s as y } from "./iteration-BCbIbdHR.js";
5
+ import { g as d, b as f, u as I } from "./restaurant-YOVMuuFY.js";
6
+ const R = {
7
+ async readRoles() {
8
+ return d(await f().get("/pos-roles"));
9
+ },
10
+ async createRole(e) {
11
+ return d(await f().post("/pos-roles", e));
12
+ },
13
+ async updateRole(e, i) {
14
+ return d(await f().put(`/pos-roles/${e}`, i));
15
+ },
16
+ async deleteRole(e) {
17
+ return d(
18
+ await f().put(`/pos-roles/${e._id}`, {
19
+ restaurantIds: [],
20
+ role: e
21
+ })
22
+ );
23
+ }
24
+ };
25
+ async function p(e) {
26
+ const { restaurants: i } = I(), n = e.reduce((t, s) => {
27
+ var c;
28
+ const u = t.findIndex((o) => o._id === s._id), l = {
29
+ id: s.restaurantId,
30
+ name: ((c = i.value.find((o) => o._id === s.restaurantId)) == null ? void 0 : c.profile.name) || ""
31
+ };
32
+ return u < 0 ? t.push({
33
+ ...s,
34
+ restaurants: [l]
35
+ }) : t[u].restaurants.some((o) => o.id === s.restaurantId) || (t[u].restaurants = y([...t[u].restaurants, l], { selector: "name" })), t;
36
+ }, []);
37
+ return y(n, { selector: "name" });
38
+ }
39
+ const v = S("role", () => {
40
+ const { currentBusiness: e } = g(), i = I(), n = w([]), t = w(!1), s = w(null);
41
+ async function u() {
42
+ var r;
43
+ const a = ((r = e.value) == null ? void 0 : r._id) ?? null;
44
+ if (s.value !== a)
45
+ try {
46
+ t.value = !0, await i.readRestaurants();
47
+ const m = await R.readRoles();
48
+ n.value = await p(m), s.value = a;
49
+ } finally {
50
+ t.value = !1;
51
+ }
52
+ }
53
+ async function l(a) {
54
+ const r = await R.createRole(a);
55
+ n.value = await p(r);
56
+ }
57
+ async function c(a, r) {
58
+ const m = await R.updateRole(a, r);
59
+ n.value = await p(m);
60
+ }
61
+ async function o(a) {
62
+ const r = await R.deleteRole(a);
63
+ n.value = await p(r);
64
+ }
65
+ return {
66
+ roles: n,
67
+ isLoading: t,
68
+ readRoles: u,
69
+ createRole: l,
70
+ updateRole: c,
71
+ deleteRole: o
72
+ };
73
+ }), $ = () => {
74
+ const e = v();
75
+ return {
76
+ ...e,
77
+ ..._(e)
78
+ };
79
+ };
80
+ export {
81
+ $ as u
82
+ };
@@ -1,6 +1,7 @@
1
- import { g as b, b as v, q as F, u as Z, s as W, d as q, e as y } from "./iteration-Dj50K6I7.js";
2
- import { h as A, P as V, d as _, v as k, n as j, b as ee } from "./app-BW91YDke.js";
3
- import { s as ne } from "./utils-BZkjJbju.js";
1
+ import { s as W, c as Z, e as y } from "./iteration-BCbIbdHR.js";
2
+ import { h as A, P as V, d as _, v as F, n as j, b as q } from "./app-BZwE2coe.js";
3
+ import { s as ee } from "./utils-BZkjJbju.js";
4
+ import { g as b, b as v, q as k, u as ne } from "./restaurant-YOVMuuFY.js";
4
5
  import { defineStore as z, storeToRefs as K } from "pinia";
5
6
  import { ref as S, computed as U } from "vue";
6
7
  import { useCoreStore as X } from "@feedmepos/mf-common";
@@ -512,13 +513,13 @@ function H(e, n, t = /* @__PURE__ */ new Set()) {
512
513
  }
513
514
  return o;
514
515
  }
515
- function $e(e) {
516
+ function Ie(e) {
516
517
  const n = Q(e).map(
517
518
  ({ setNames: i, setId: s, ...c }) => c
518
519
  ), t = n.filter((i) => !i.inverted), o = n.filter((i) => i.inverted);
519
520
  return M(t, o);
520
521
  }
521
- function Ie(e, n, t) {
522
+ function Ae(e, n, t) {
522
523
  const o = /* @__PURE__ */ new Map();
523
524
  return e.forEach(
524
525
  ({ name: i, permissions: s }) => s.forEach(({ conditions: c, actions: r }) => {
@@ -535,7 +536,7 @@ function Ie(e, n, t) {
535
536
  setNames: [...s]
536
537
  }));
537
538
  }
538
- function Ae(e, n) {
539
+ function Oe(e, n) {
539
540
  const t = (r, u) => {
540
541
  const a = { ...r }, l = JSON.parse(a.conditions || "{}");
541
542
  if (u)
@@ -601,7 +602,7 @@ function Ae(e, n) {
601
602
  }
602
603
  return s;
603
604
  }
604
- function Oe(e) {
605
+ function _e(e) {
605
606
  const n = G(
606
607
  e,
607
608
  V
@@ -621,7 +622,7 @@ function Oe(e) {
621
622
  return e.filter((i) => i.inverted ? !(t.has(i.subject) && !o.has(i.subject)) : !t.has(i.subject));
622
623
  }
623
624
  const ie = "business::report::";
624
- function _e(e, n) {
625
+ function Ee(e, n) {
625
626
  const t = [], o = e.filter((i) => {
626
627
  const s = i.subject;
627
628
  return !s.startsWith(ie) || n.has(s) ? !0 : (t.push(s), !1);
@@ -632,7 +633,7 @@ const re = "business::report::reports::", ae = _.Subject.Business.report_reports
632
633
  function ue(e, n) {
633
634
  return e.conditions ? !!n.conditions && e.conditions === n.conditions : !n.conditions;
634
635
  }
635
- function Ee(e, n) {
636
+ function Ne(e, n) {
636
637
  const t = e.find(
637
638
  (c) => !c.inverted && c.subject === ae
638
639
  ), o = e.find(
@@ -782,13 +783,13 @@ const P = "/permission-assignments", w = {
782
783
  async fetchReportPermissions(e, n) {
783
784
  const t = n ? { lang: n } : {};
784
785
  return b(
785
- await F().get(`/report-query/hrm/${e}/reports`, { params: t })
786
+ await k().get(`/report-query/hrm/${e}/reports`, { params: t })
786
787
  );
787
788
  },
788
789
  async fetchReportPermissionsForPortal(e, n) {
789
790
  const t = n ? { isSupportPos: !1, lang: n } : { isSupportPos: !1 };
790
791
  return b(
791
- await F().get(`/report-query/hrm/${e}/reports`, { params: t })
792
+ await k().get(`/report-query/hrm/${e}/reports`, { params: t })
792
793
  );
793
794
  }
794
795
  }, T = S([]), C = S(!1), R = S(!1), $ = S(null), x = S(null), J = S(!1);
@@ -822,7 +823,7 @@ function pe() {
822
823
  label: o.name,
823
824
  subject: `business::report::reports::${o.permissionKey}`,
824
825
  actions: [j.manage, j.read, j.create],
825
- category: k.reports
826
+ category: F.reports
826
827
  } : {
827
828
  label: o.name,
828
829
  subject: `business::report::reports::${o.permissionKey}`,
@@ -833,7 +834,7 @@ function pe() {
833
834
  j.update,
834
835
  j.delete
835
836
  ],
836
- category: k.customReports
837
+ category: F.customReports
837
838
  }
838
839
  ));
839
840
  return {
@@ -844,7 +845,7 @@ function pe() {
844
845
  };
845
846
  }
846
847
  function I(e) {
847
- const n = te(), t = me(), o = Z().restaurants, { customReportPermissions: i } = pe(), s = t.getPermissionAssignmentByUserId(e.id), c = H(
848
+ const n = te(), t = me(), o = ne().restaurants, { customReportPermissions: i } = pe(), s = t.getPermissionAssignmentByUserId(e.id), c = H(
848
849
  (s == null ? void 0 : s.permissionSetIds) ?? [],
849
850
  n.permissionSets.value
850
851
  ), r = Q(c).map(
@@ -874,8 +875,8 @@ function I(e) {
874
875
  };
875
876
  }
876
877
  const be = Object.freeze(
877
- Object.values(ee)
878
- ), Ne = {
878
+ Object.values(q)
879
+ ), Te = {
879
880
  async readTeamMembers() {
880
881
  return b(
881
882
  await v().get("/portal-users")
@@ -922,7 +923,7 @@ const be = Object.freeze(
922
923
  return b(await v().get("/portal-users")).map((n) => n.posUserId);
923
924
  }
924
925
  };
925
- function Te(e, n, t) {
926
+ function Ce(e, n, t) {
926
927
  if (e.some((c) => c.subject === "all")) return "All";
927
928
  const o = (t ?? L).filter(
928
929
  (c) => c.subject === n
@@ -930,7 +931,7 @@ function Te(e, n, t) {
930
931
  return s.length === o.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
931
932
  }
932
933
  function O(e) {
933
- const n = q(e), t = n.subject;
934
+ const n = Z(e), t = n.subject;
934
935
  return {
935
936
  ...n,
936
937
  get conditions() {
@@ -951,14 +952,14 @@ function O(e) {
951
952
  return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : t.toString();
952
953
  },
953
954
  get label() {
954
- return n.label || ne(this.formatted);
955
+ return n.label || ee(this.formatted);
955
956
  },
956
957
  get value() {
957
958
  return this.isOrderOperation ? `${t}:${this.conditions.operation}` : this.isReportPermission ? `${t}:${this.conditions.name}` : t.toString();
958
959
  }
959
960
  };
960
961
  }
961
- function Ce(e) {
962
+ function Je(e) {
962
963
  const n = e.map((t) => O(t)).find((t) => t.isDiscountOperation);
963
964
  return n ? parseInt((n.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
964
965
  }
@@ -968,20 +969,20 @@ function ve(e) {
968
969
  );
969
970
  return n ? n.conditions ? JSON.parse(n.conditions).restaurantId.$in : null : [];
970
971
  }
971
- function Je(e) {
972
+ function Ue(e) {
972
973
  return (e == null ? void 0 : e.some((n) => n.subject === "all")) ?? !1;
973
974
  }
974
- function Ue(e) {
975
+ function Be(e) {
975
976
  const n = e.find((t) => t.subject === _.Subject.Business.role);
976
977
  return n ? n.conditions ? JSON.parse(n.conditions).roleId.$in : null : [];
977
978
  }
978
- function Be(e) {
979
+ function Le(e) {
979
980
  const n = O(e);
980
981
  if (!n.isReportPermission) return;
981
982
  const { name: t, ...o } = n.conditions ?? {};
982
983
  return Object.keys(o).length > 0 ? o : void 0;
983
984
  }
984
- function Le(e, n, t) {
985
+ function Me(e, n, t) {
985
986
  return e.map((o) => {
986
987
  const i = ge(o), s = i.isReportPermission ? t == null ? void 0 : t.get(o) : void 0;
987
988
  return {
@@ -1030,28 +1031,28 @@ export {
1030
1031
  G as N,
1031
1032
  Q as P,
1032
1033
  fe as R,
1033
- Be as a,
1034
- Te as b,
1034
+ Le as a,
1035
+ Ce as b,
1035
1036
  H as c,
1036
1037
  le as d,
1037
1038
  L as e,
1038
- Le as f,
1039
- Ce as g,
1040
- Je as h,
1039
+ Me as f,
1040
+ Je as g,
1041
+ Ue as h,
1041
1042
  pe as i,
1042
1043
  ie as j,
1043
- Ue as k,
1044
+ Be as k,
1044
1045
  ve as l,
1045
- $e as m,
1046
- _e as n,
1046
+ Ie as m,
1047
+ Oe as n,
1047
1048
  Ee as o,
1048
1049
  be as p,
1049
- Ae as q,
1050
+ Ne as q,
1050
1051
  O as r,
1051
- Oe as s,
1052
- Ne as t,
1052
+ _e as s,
1053
+ Te as t,
1053
1054
  te as u,
1054
1055
  me as v,
1055
1056
  Se as w,
1056
- Ie as x
1057
+ Ae as x
1057
1058
  };
@@ -0,0 +1,7 @@
1
+ import type { IFdtoApprovalCode, IFdtoCreateApprovalCodeReq } from '@/types/approval-code';
2
+ declare const ApprovalCodeAPI: {
3
+ getApprovalCodes(): Promise<IFdtoApprovalCode[]>;
4
+ createApprovalCodes(dto: IFdtoCreateApprovalCodeReq): Promise<IFdtoApprovalCode[]>;
5
+ revokeApprovalCode(id: string, restaurantId: string): Promise<IFdtoApprovalCode>;
6
+ };
7
+ export default ApprovalCodeAPI;
@@ -8,7 +8,9 @@ export declare enum RouteName {
8
8
  TEAM = "team",
9
9
  TEAM_MEMBER = "team-member",
10
10
  TEAM_ROLE = "team-role",
11
- POS_GRANT = "pos-grant"
11
+ POS_ACCESS = "pos-access",
12
+ POS_GRANT = "pos-grant",
13
+ APPROVAL_CODE = "approval-code"
12
14
  }
13
15
  declare const routes: RouteRecordRaw[];
14
16
  export { routes };
@@ -0,0 +1,140 @@
1
+ import type { IFdtoApprovalCode, IFdtoCreateApprovalCodeReq } from '@/types/approval-code';
2
+ export declare const useApprovalCodeStore: import("pinia").StoreDefinition<"approvalCode", Pick<{
3
+ approvalCodes: import("vue").Ref<{
4
+ _id: string;
5
+ businessId: string;
6
+ restaurantId: string;
7
+ passcode: string;
8
+ name: string;
9
+ type: "approval";
10
+ permissions: {
11
+ key: import("@/types/approval-code").ApprovalCodePermission;
12
+ subject: string;
13
+ actions: string[];
14
+ conditions?: Record<string, unknown> | undefined;
15
+ }[];
16
+ status: "active" | "used" | "revoked";
17
+ usedAt?: string | undefined;
18
+ revokedAt?: string | undefined;
19
+ grantById: string;
20
+ grantByName: string;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ }[], IFdtoApprovalCode[] | {
24
+ _id: string;
25
+ businessId: string;
26
+ restaurantId: string;
27
+ passcode: string;
28
+ name: string;
29
+ type: "approval";
30
+ permissions: {
31
+ key: import("@/types/approval-code").ApprovalCodePermission;
32
+ subject: string;
33
+ actions: string[];
34
+ conditions?: Record<string, unknown> | undefined;
35
+ }[];
36
+ status: "active" | "used" | "revoked";
37
+ usedAt?: string | undefined;
38
+ revokedAt?: string | undefined;
39
+ grantById: string;
40
+ grantByName: string;
41
+ createdAt: string;
42
+ updatedAt: string;
43
+ }[]>;
44
+ isLoading: import("vue").Ref<boolean, boolean>;
45
+ readApprovalCodes: () => Promise<void>;
46
+ createApprovalCodes: (dto: IFdtoCreateApprovalCodeReq) => Promise<IFdtoApprovalCode[]>;
47
+ revokeApprovalCode: (id: string, restaurantId: string) => Promise<void>;
48
+ }, "isLoading" | "approvalCodes">, Pick<{
49
+ approvalCodes: import("vue").Ref<{
50
+ _id: string;
51
+ businessId: string;
52
+ restaurantId: string;
53
+ passcode: string;
54
+ name: string;
55
+ type: "approval";
56
+ permissions: {
57
+ key: import("@/types/approval-code").ApprovalCodePermission;
58
+ subject: string;
59
+ actions: string[];
60
+ conditions?: Record<string, unknown> | undefined;
61
+ }[];
62
+ status: "active" | "used" | "revoked";
63
+ usedAt?: string | undefined;
64
+ revokedAt?: string | undefined;
65
+ grantById: string;
66
+ grantByName: string;
67
+ createdAt: string;
68
+ updatedAt: string;
69
+ }[], IFdtoApprovalCode[] | {
70
+ _id: string;
71
+ businessId: string;
72
+ restaurantId: string;
73
+ passcode: string;
74
+ name: string;
75
+ type: "approval";
76
+ permissions: {
77
+ key: import("@/types/approval-code").ApprovalCodePermission;
78
+ subject: string;
79
+ actions: string[];
80
+ conditions?: Record<string, unknown> | undefined;
81
+ }[];
82
+ status: "active" | "used" | "revoked";
83
+ usedAt?: string | undefined;
84
+ revokedAt?: string | undefined;
85
+ grantById: string;
86
+ grantByName: string;
87
+ createdAt: string;
88
+ updatedAt: string;
89
+ }[]>;
90
+ isLoading: import("vue").Ref<boolean, boolean>;
91
+ readApprovalCodes: () => Promise<void>;
92
+ createApprovalCodes: (dto: IFdtoCreateApprovalCodeReq) => Promise<IFdtoApprovalCode[]>;
93
+ revokeApprovalCode: (id: string, restaurantId: string) => Promise<void>;
94
+ }, never>, Pick<{
95
+ approvalCodes: import("vue").Ref<{
96
+ _id: string;
97
+ businessId: string;
98
+ restaurantId: string;
99
+ passcode: string;
100
+ name: string;
101
+ type: "approval";
102
+ permissions: {
103
+ key: import("@/types/approval-code").ApprovalCodePermission;
104
+ subject: string;
105
+ actions: string[];
106
+ conditions?: Record<string, unknown> | undefined;
107
+ }[];
108
+ status: "active" | "used" | "revoked";
109
+ usedAt?: string | undefined;
110
+ revokedAt?: string | undefined;
111
+ grantById: string;
112
+ grantByName: string;
113
+ createdAt: string;
114
+ updatedAt: string;
115
+ }[], IFdtoApprovalCode[] | {
116
+ _id: string;
117
+ businessId: string;
118
+ restaurantId: string;
119
+ passcode: string;
120
+ name: string;
121
+ type: "approval";
122
+ permissions: {
123
+ key: import("@/types/approval-code").ApprovalCodePermission;
124
+ subject: string;
125
+ actions: string[];
126
+ conditions?: Record<string, unknown> | undefined;
127
+ }[];
128
+ status: "active" | "used" | "revoked";
129
+ usedAt?: string | undefined;
130
+ revokedAt?: string | undefined;
131
+ grantById: string;
132
+ grantByName: string;
133
+ createdAt: string;
134
+ updatedAt: string;
135
+ }[]>;
136
+ isLoading: import("vue").Ref<boolean, boolean>;
137
+ readApprovalCodes: () => Promise<void>;
138
+ createApprovalCodes: (dto: IFdtoCreateApprovalCodeReq) => Promise<IFdtoApprovalCode[]>;
139
+ revokeApprovalCode: (id: string, restaurantId: string) => Promise<void>;
140
+ }, "readApprovalCodes" | "createApprovalCodes" | "revokeApprovalCode">>;
@@ -0,0 +1,114 @@
1
+ export declare const APPROVAL_CODE_PERMISSIONS: readonly ["void", "refund", "discount", "changePrice", "claimDeposit", "payment", "resend", "changePaymentType", "openDrawer", "openCounter", "closeCounter", "printReceipt"];
2
+ export type ApprovalCodePermission = (typeof APPROVAL_CODE_PERMISSIONS)[number];
3
+ /**
4
+ * A single CASL-shaped rule keyed by the approval-code action it grants, as
5
+ * stored/returned by the backend. Mirrors `FdoApprovalCodeRule` from
6
+ * `apps/hrm-backend/src/grant-user/grant-user.entity.ts`.
7
+ */
8
+ export interface IFdtoApprovalCodeRule {
9
+ key: ApprovalCodePermission;
10
+ subject: string;
11
+ actions: string[];
12
+ conditions?: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * The rule template (subject/actions/conditions, minus `key`) for every
16
+ * approval-code permission the portal can grant. The portal is now the
17
+ * owner of these shapes (KDI-4982 Task A2) — the backend only validates the
18
+ * shape of whatever rule it receives, it no longer composes rules itself.
19
+ * These values were copied verbatim from the backend's server-side
20
+ * key-to-rule manifest before it was deleted; they must keep matching
21
+ * `FdoApprovalCodeRule`'s shape validation in
22
+ * `apps/hrm-backend/src/grant-user/grant-user.entity.ts`.
23
+ */
24
+ export declare const APPROVAL_CODE_RULE_TEMPLATES: Record<ApprovalCodePermission, {
25
+ subject: string;
26
+ actions: string[];
27
+ conditions: Record<string, unknown>;
28
+ }>;
29
+ /**
30
+ * Compose the full CASL-shaped rule for `key`, ready to send to the backend
31
+ * as-is. Only `discount` honors `params.maxPercentage`, appending it as an
32
+ * `adjustment: { $lte: maxPercentage / 100 } }` condition — every other key
33
+ * ignores `params` if passed, matching the deleted backend manifest's
34
+ * `buildRule` behavior.
35
+ */
36
+ export declare function buildApprovalCodeRule(key: ApprovalCodePermission, params?: {
37
+ maxPercentage?: number;
38
+ }): IFdtoApprovalCodeRule;
39
+ export interface IFdtoApprovalCode {
40
+ _id: string;
41
+ businessId: string;
42
+ restaurantId: string;
43
+ passcode: string;
44
+ name: string;
45
+ type: 'approval';
46
+ permissions: IFdtoApprovalCodeRule[];
47
+ status: 'active' | 'used' | 'revoked';
48
+ usedAt?: string;
49
+ revokedAt?: string;
50
+ grantById: string;
51
+ grantByName: string;
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ }
55
+ export interface IFdtoCreateApprovalCodeReq {
56
+ name: string;
57
+ restaurantId: string;
58
+ permissions: IFdtoApprovalCodeRule[];
59
+ count: number;
60
+ }
61
+ /**
62
+ * Read the discount ceiling back out of a rule's `conditions.adjustment.$lte`
63
+ * fraction (0-1) as a whole percentage (1-100). Returns `undefined` when the
64
+ * rule has no adjustment ceiling.
65
+ */
66
+ export declare function getRuleAdjustmentCeilingPercentage(rule: IFdtoApprovalCodeRule): number | undefined;
67
+ /**
68
+ * Human-readable labels for a code's permission rules, e.g. `["Refund",
69
+ * "Apply discount ≤20%"]`. `translate` is the caller's i18n `t` — labels
70
+ * live under `approvalCode.permissions.<key>`.
71
+ */
72
+ export declare function formatPermissionLabels(permissions: IFdtoApprovalCodeRule[], translate: (key: string) => string): string[];
73
+ /**
74
+ * Clipboard text for sharing a code — passcode plus its actions and
75
+ * restaurant (e.g. "Code 3843 · Refund · Gulu-gulu Main") so the recipient
76
+ * can tell what the code unlocks and where without opening the portal.
77
+ * Missing parts are skipped rather than leaving dangling separators.
78
+ */
79
+ export declare function buildCodeClipboardText(code: Pick<IFdtoApprovalCode, 'passcode' | 'permissions'>, restaurantName: string | undefined, translate: (key: string) => string): string;
80
+ /**
81
+ * Validate the optional discount max-percentage input. Undefined, empty, or
82
+ * whitespace-only means "no ceiling" and is valid; otherwise the value must
83
+ * be an integer in `[1, 100]`.
84
+ */
85
+ export declare function validateMaxPercentage(value: number | string | undefined): boolean;
86
+ /**
87
+ * Resolve the discount max-percentage input into a definite number for the
88
+ * create-request payload, or `undefined` when it represents "no ceiling".
89
+ * Assumes the value has already passed `validateMaxPercentage`.
90
+ */
91
+ export declare function resolveMaxPercentage(value: number | string | undefined): number | undefined;
92
+ /**
93
+ * A selectable action option in the create form / list filter (KDI-4982 UI
94
+ * redesign). The 9 options mirror the POS v7 passcode prompts exactly:
95
+ * `claimDeposit` and `payment` are not offered (neither has a passcode prompt
96
+ * on POS v7), and open/close counter share one option because POS guards both
97
+ * with the same `counterRecord` permission. `changePrice` is offered as
98
+ * "Input Custom Price" — POS prompts for a passcode when a custom price is
99
+ * keyed in. The 12-key `APPROVAL_CODE_PERMISSIONS` enum is untouched — stored
100
+ * rules and the wire format still use the full key set, so legacy codes keep
101
+ * rendering.
102
+ */
103
+ export interface AccessCodeActionOption {
104
+ key: 'printReceipt' | 'resend' | 'openDrawer' | 'counter' | 'discount' | 'changePrice' | 'void' | 'changePaymentType' | 'refund';
105
+ ruleKeys: ApprovalCodePermission[];
106
+ }
107
+ export type AccessCodeActionOptionKey = AccessCodeActionOption['key'];
108
+ export declare const ACCESS_CODE_ACTION_OPTIONS: AccessCodeActionOption[];
109
+ /** When a code stopped being usable: used wins over revoked (a code can only
110
+ * be one or the other, but usedAt is the historically-populated field). */
111
+ export declare function getResolvedAt(code: Pick<IFdtoApprovalCode, 'usedAt' | 'revokedAt'>): string | undefined;
112
+ /** List-filter predicate: does this code grant any of the selected options?
113
+ * Empty/undefined selection means "no filter". */
114
+ export declare function codeMatchesActionFilter(code: Pick<IFdtoApprovalCode, 'permissions'>, selected: AccessCodeActionOptionKey[] | undefined): boolean;
@@ -0,0 +1,26 @@
1
+ declare function create(): void;
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ create: typeof create;
4
+ filteredApprovalCodes: import("vue").ComputedRef<{
5
+ _id: string;
6
+ businessId: string;
7
+ restaurantId: string;
8
+ passcode: string;
9
+ name: string;
10
+ type: "approval";
11
+ permissions: {
12
+ key: import("@/types/approval-code").ApprovalCodePermission;
13
+ subject: string;
14
+ actions: string[];
15
+ conditions?: Record<string, unknown> | undefined;
16
+ }[];
17
+ status: "active" | "used" | "revoked";
18
+ usedAt?: string | undefined;
19
+ revokedAt?: string | undefined;
20
+ grantById: string;
21
+ grantByName: string;
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ }[]>;
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { type IFdtoApprovalCode } from '@/types/approval-code';
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ open: (created: IFdtoApprovalCode[]) => void;
4
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ createAnother: () => any;
6
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
7
+ onCreateAnother?: (() => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { type IFdtoApprovalCode } from '@/types/approval-code';
2
+ declare var __VLS_1: {
3
+ trigger: () => void;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_component: import("vue").DefineComponent<{}, {
9
+ show: import("vue").Ref<boolean, boolean>;
10
+ trigger: () => void;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ created: (codes: IFdtoApprovalCode[]) => any;
13
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
14
+ onCreated?: ((codes: IFdtoApprovalCode[]) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };