@feedmepos/mf-hrm-portal 2.1.1-dev.6 → 2.2.0-dev

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 (29) hide show
  1. package/dist/ApprovalCodeList-Cwy-Rn90.js +728 -0
  2. package/dist/{AuditLogList-DrrL4vf4.js → AuditLogList-CfDEZ6Z-.js} +3 -3
  3. package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-CBjO1MZo.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-BTDBRB1-.js} +2 -2
  4. package/dist/{EmployeeList-BMol4ah4.js → EmployeeList-DJrCBYvi.js} +6 -4
  5. package/dist/{GrantUserList-CLBl7FZ-.js → GrantUserList-UgQBjh54.js} +3 -3
  6. package/dist/{Main-D_LwrBdZ.js → Main-B5YknOhi.js} +9 -9
  7. package/dist/{Main-DNOHZd3j.js → Main-BnWK_GkW.js} +5 -5
  8. package/dist/Main-DQXiP6Io.js +121 -0
  9. package/dist/{PermissionSetList-DLYrXFbz.js → PermissionSetList-CfPZPmfV.js} +5 -5
  10. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Drcx0tL_.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CPk4KJUW.js} +803 -803
  11. package/dist/{RoleList-g8PjH_k2.js → RoleList-CHnu2j25.js} +7 -7
  12. package/dist/{TeamMemberList-B9aCagSc.js → TeamMemberList-DprMQ_8g.js} +6 -6
  13. package/dist/{TimesheetList-C1IJhOYE.js → TimesheetList-D5G1dJfp.js} +5 -5
  14. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CqtiVm1j.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-DFfYiBBf.js} +2 -2
  15. package/dist/{app-DnOYVjuj.js → app-BhF0Kk5X.js} +154 -135
  16. package/dist/app.js +1 -1
  17. package/dist/{dayjs.min-Dxul0qTK.js → dayjs.min-Do1gXFxN.js} +1 -1
  18. package/dist/{employee-sr65CZR7.js → employee-BRCSs9t_.js} +3 -3
  19. package/dist/{iteration-DIqDMvFa.js → iteration-C2XLVxL1.js} +1 -1
  20. package/dist/{lodash-CXlqXFmD.js → lodash-eudyY8-f.js} +1 -1
  21. package/dist/{role-CE3NY-63.js → role-CSL6Qv8l.js} +1 -1
  22. package/dist/{rule-CEjrit6c.js → rule-D3DPWTm1.js} +20 -12
  23. package/dist/src/types/approval-code.d.ts +29 -48
  24. package/dist/src/views/hr/locales/index.d.ts +4 -0
  25. package/dist/tsconfig.app.tsbuildinfo +1 -1
  26. package/dist/{useReportPermissions-FVW_HwcL.js → useReportPermissions-CSdIiY_7.js} +3 -3
  27. package/package.json +2 -2
  28. package/dist/ApprovalCodeList-B1XHbhum.js +0 -757
  29. package/dist/Main-auigiuVZ.js +0 -122
package/dist/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { j as e, i as r, r as o } from "./app-DnOYVjuj.js";
1
+ import { j as e, i as r, r as o } from "./app-BhF0Kk5X.js";
2
2
  export {
3
3
  e as FmApp,
4
4
  r as i18nMessages,
@@ -1,4 +1,4 @@
1
- import { g as Q, c as K } from "./app-DnOYVjuj.js";
1
+ import { g as Q, c as K } from "./app-BhF0Kk5X.js";
2
2
  var E = { exports: {} };
3
3
  (function(V, X) {
4
4
  (function(W, k) {
@@ -1,10 +1,10 @@
1
- import { d as g } from "./dayjs.min-Dxul0qTK.js";
1
+ import { d as g } from "./dayjs.min-Do1gXFxN.js";
2
2
  import { defineStore as $, storeToRefs as T } from "pinia";
3
3
  import { ref as m } from "vue";
4
- import { s as E } from "./iteration-DIqDMvFa.js";
4
+ import { s as E } from "./iteration-C2XLVxL1.js";
5
5
  import { b as i, g as f, u as w } from "./restaurant-YOVMuuFY.js";
6
6
  import { i as v } from "./utils-BZkjJbju.js";
7
- import { u as _ } from "./role-CE3NY-63.js";
7
+ import { u as _ } from "./role-CSL6Qv8l.js";
8
8
  const o = {
9
9
  async readEmployees() {
10
10
  return f(await i().get("/pos-users"));
@@ -1,4 +1,4 @@
1
- import { c as B } from "./app-DnOYVjuj.js";
1
+ import { c as B } from "./app-BhF0Kk5X.js";
2
2
  var ma = {}, Zt = {}, l = {}, ji = {}, Ei = {}, Ii = {}, Dn = {};
3
3
  (function(e) {
4
4
  Object.defineProperty(e, "__esModule", { value: !0 }), e.getParsedType = e.ZodParsedType = e.util = void 0;
@@ -1,4 +1,4 @@
1
- import { c as jt } from "./app-DnOYVjuj.js";
1
+ import { c as jt } from "./app-BhF0Kk5X.js";
2
2
  var Jr = { exports: {} };
3
3
  /**
4
4
  * @license
@@ -1,7 +1,7 @@
1
1
  import { defineStore as S, storeToRefs as _ } from "pinia";
2
2
  import { ref as w } from "vue";
3
3
  import { useCoreStore as g } from "@feedmepos/mf-common";
4
- import { s as y } from "./iteration-DIqDMvFa.js";
4
+ import { s as y } from "./iteration-C2XLVxL1.js";
5
5
  import { g as d, b as f, u as I } from "./restaurant-YOVMuuFY.js";
6
6
  const R = {
7
7
  async readRoles() {
@@ -1,5 +1,5 @@
1
- import { s as W, c as Z, e as y } from "./iteration-DIqDMvFa.js";
2
- import { h as A, P as V, d as _, v as F, n as j, b as q } from "./app-DnOYVjuj.js";
1
+ import { s as W, c as Z, e as y } from "./iteration-C2XLVxL1.js";
2
+ import { h as A, P as V, d as _, v as F, n as j, b as q } from "./app-BhF0Kk5X.js";
3
3
  import { s as ee } from "./utils-BZkjJbju.js";
4
4
  import { g as b, b as v, q as k, u as ne } from "./restaurant-YOVMuuFY.js";
5
5
  import { defineStore as z, storeToRefs as K } from "pinia";
@@ -35,6 +35,14 @@ const L = [
35
35
  inverted: !1,
36
36
  reason: null
37
37
  },
38
+ {
39
+ label: "",
40
+ subject: "order",
41
+ actions: ["update"],
42
+ conditions: { operation: "waiveServiceCharge" },
43
+ inverted: !1,
44
+ reason: null
45
+ },
38
46
  {
39
47
  label: "",
40
48
  subject: "order",
@@ -792,7 +800,7 @@ const P = "/permission-assignments", w = {
792
800
  await k().get(`/report-query/hrm/${e}/reports`, { params: t })
793
801
  );
794
802
  }
795
- }, T = S([]), C = S(!1), R = S(!1), $ = S(null), x = S(null), J = S(!1);
803
+ }, C = S([]), T = S(!1), R = S(!1), $ = S(null), x = S(null), J = S(!1);
796
804
  function pe() {
797
805
  const e = X();
798
806
  async function n() {
@@ -800,7 +808,7 @@ function pe() {
800
808
  const o = (s = e.currentBusiness.value) == null ? void 0 : s.id;
801
809
  if (!o) return;
802
810
  const i = localStorage.getItem("locale");
803
- if ($.value !== o && (T.value = [], C.value = !1, R.value = !1, $.value = o, J.value = !1), !(C.value && x.value === i)) {
811
+ if ($.value !== o && (C.value = [], T.value = !1, R.value = !1, $.value = o, J.value = !1), !(T.value && x.value === i)) {
804
812
  if (R.value) {
805
813
  J.value = !0;
806
814
  return;
@@ -809,16 +817,16 @@ function pe() {
809
817
  try {
810
818
  const c = await fe.fetchReportPermissionsForPortal(o, i);
811
819
  if ($.value !== o) return;
812
- T.value = c, C.value = !0, x.value = i;
820
+ C.value = c, T.value = !0, x.value = i;
813
821
  } catch (c) {
814
822
  if ($.value !== o) return;
815
- console.warn("Failed to fetch custom report permissions:", c), T.value = [];
823
+ console.warn("Failed to fetch custom report permissions:", c), C.value = [];
816
824
  } finally {
817
825
  $.value === o && (R.value = !1, J.value && (J.value = !1, await n()));
818
826
  }
819
827
  }
820
828
  }
821
- const t = U(() => T.value.map(
829
+ const t = U(() => C.value.map(
822
830
  (o) => o.isDefault ? {
823
831
  label: o.name,
824
832
  subject: `business::report::reports::${o.permissionKey}`,
@@ -841,7 +849,7 @@ function pe() {
841
849
  fetchCustomReportPermissions: n,
842
850
  customReportPermissions: t,
843
851
  isLoading: U(() => R.value),
844
- isLoaded: U(() => C.value)
852
+ isLoaded: U(() => T.value)
845
853
  };
846
854
  }
847
855
  function I(e) {
@@ -876,7 +884,7 @@ function I(e) {
876
884
  }
877
885
  const be = Object.freeze(
878
886
  Object.values(q)
879
- ), Te = {
887
+ ), Ce = {
880
888
  async readTeamMembers() {
881
889
  return b(
882
890
  await v().get("/portal-users")
@@ -923,7 +931,7 @@ const be = Object.freeze(
923
931
  return b(await v().get("/portal-users")).map((n) => n.posUserId);
924
932
  }
925
933
  };
926
- function Ce(e, n, t) {
934
+ function Te(e, n, t) {
927
935
  if (e.some((c) => c.subject === "all")) return "All";
928
936
  const o = (t ?? L).filter(
929
937
  (c) => c.subject === n
@@ -1032,7 +1040,7 @@ export {
1032
1040
  Q as P,
1033
1041
  fe as R,
1034
1042
  Le as a,
1035
- Ce as b,
1043
+ Te as b,
1036
1044
  H as c,
1037
1045
  le as d,
1038
1046
  L as e,
@@ -1050,7 +1058,7 @@ export {
1050
1058
  Ne as q,
1051
1059
  O as r,
1052
1060
  _e as s,
1053
- Te as t,
1061
+ Ce as t,
1054
1062
  te as u,
1055
1063
  me as v,
1056
1064
  Se as w,
@@ -5,7 +5,8 @@ export type ApprovalCodePermission = (typeof APPROVAL_CODE_PERMISSIONS)[number];
5
5
  * stored/returned by the backend. Mirrors `FdoApprovalCodeRule` from
6
6
  * `apps/hrm-backend/src/grant-user/grant-user.entity.ts`. `conditions` is
7
7
  * `null` (not just absent) for keys whose full-POS counterpart carries no
8
- * conditions at all (see `APPROVAL_CODE_RULE_TEMPLATES`).
8
+ * conditions at all (see `APPROVAL_CODE_RULE_TEMPLATES` at
9
+ * `apps/hrm-backend/src/grant-user/approval-code-rules.ts`).
9
10
  */
10
11
  export interface IFdtoApprovalCodeRule {
11
12
  key: ApprovalCodePermission;
@@ -13,41 +14,6 @@ export interface IFdtoApprovalCodeRule {
13
14
  actions: string[];
14
15
  conditions?: Record<string, unknown> | null;
15
16
  }
16
- /**
17
- * The rule template (subject/actions/conditions, minus `key`) for every
18
- * approval-code permission the portal can grant. The portal is now the
19
- * owner of these shapes (KDI-4982 Task A2) — the backend only validates the
20
- * shape of whatever rule it receives, it no longer composes rules itself.
21
- * These shapes are not arbitrary: they mirror `FullPosPermissions`
22
- * (`packages/permission/src/common/full-pos-permissions.ts`) exactly, entry
23
- * for entry, so a code granting one of these keys evaluates identically to
24
- * the corresponding rule a full-POS-permission staff member already has.
25
- * That's why `refund`/`openDrawer`/`counter` carry `conditions: null` — full
26
- * POS has no `operation` condition on those subjects — and why `discount`
27
- * always carries an `adjustment` condition (full POS's unbounded discount
28
- * rule is `adjustment: { $lte: 1 }`, i.e. "up to 100%", not "no adjustment
29
- * condition at all"). `counter` is a single key (not separate open/close
30
- * keys) because POS guards both opening and closing a counter with the same
31
- * `counterRecord`/`manage` permission — two identical rules would just be
32
- * redundant.
33
- */
34
- export declare const APPROVAL_CODE_RULE_TEMPLATES: Record<ApprovalCodePermission, {
35
- subject: string;
36
- actions: string[];
37
- conditions: Record<string, unknown> | null;
38
- }>;
39
- /**
40
- * Compose the full CASL-shaped rule for `key`, ready to send to the backend
41
- * as-is, saved shape-identical to the corresponding `FullPosPermissions`
42
- * entry. Keys whose template has `conditions: null` always return `null` —
43
- * there's nothing to clone. Only `discount` honors `params.maxPercentage`,
44
- * setting the `adjustment.$lte` fraction (defaulting to `1`, i.e. no
45
- * effective ceiling, matching full POS's unbounded discount rule) — every
46
- * other object-conditions key ignores `params` if passed.
47
- */
48
- export declare function buildApprovalCodeRule(key: ApprovalCodePermission, params?: {
49
- maxPercentage?: number;
50
- }): IFdtoApprovalCodeRule;
51
17
  export interface IFdtoApprovalCode {
52
18
  _id: string;
53
19
  businessId: string;
@@ -64,20 +30,15 @@ export interface IFdtoApprovalCode {
64
30
  createdAt: string;
65
31
  updatedAt: string;
66
32
  }
67
- export interface IFdtoCreateApprovalCodeReq {
68
- name: string;
69
- restaurantId: string;
70
- permissions: IFdtoApprovalCodeRule[];
71
- count: number;
72
- }
73
33
  /**
74
34
  * Read the discount ceiling back out of a rule's `conditions.adjustment.$lte`
75
35
  * fraction (0-1) as a whole percentage (1-100). Returns `undefined` when the
76
36
  * rule has no adjustment ceiling, when `conditions` is `null` (full-POS-style
77
37
  * null-condition rules never carry an adjustment), or when the ceiling is
78
38
  * 100% — `$lte: 1` is the unbounded/default form (see
79
- * `APPROVAL_CODE_RULE_TEMPLATES.discount`), so showing "≤100%" would be
80
- * meaningless noise on every plain discount grant.
39
+ * `APPROVAL_CODE_RULE_TEMPLATES.discount` at
40
+ * `apps/hrm-backend/src/grant-user/approval-code-rules.ts`), so showing
41
+ * "≤100%" would be meaningless noise on every plain discount grant.
81
42
  */
82
43
  export declare function getRuleAdjustmentCeilingPercentage(rule: IFdtoApprovalCodeRule): number | undefined;
83
44
  /**
@@ -110,15 +71,29 @@ export declare function validateMaxPercentage(value: number | string | undefined
110
71
  * Assumes the value has already passed `validateMaxPercentage`.
111
72
  */
112
73
  export declare function resolveMaxPercentage(value: number | string | undefined): number | undefined;
74
+ /** One requested permission on a new access code, matching the backend's
75
+ * `FdtoApprovalCodePermissionReq`: a rule key plus, for `discount` only, a
76
+ * whole-percentage ceiling (1-100). The backend composes the stored CASL rule
77
+ * from the key — the portal no longer sends rule shapes. */
78
+ export interface IFdtoApprovalCodePermissionReq {
79
+ key: ApprovalCodePermission;
80
+ maxPercentage?: number;
81
+ }
82
+ export interface IFdtoCreateApprovalCodeReq {
83
+ name: string;
84
+ restaurantId: string;
85
+ permissions: IFdtoApprovalCodePermissionReq[];
86
+ count: number;
87
+ }
113
88
  /**
114
89
  * A selectable action option in the create form / list filter (KDI-4982 UI
115
90
  * redesign). The 8 options mirror the POS v7 passcode prompts exactly:
116
91
  * `claimDeposit` and `payment` are not offered (neither has a passcode prompt
117
- * on POS v7) even though both have `APPROVAL_CODE_RULE_TEMPLATES` entries
118
- * matching full POS. `changePrice` is offered as "Input Custom Price" — POS
92
+ * on POS v7) even though both are valid `ApprovalCodePermission` keys the
93
+ * backend accepts. `changePrice` is offered as "Input Custom Price" — POS
119
94
  * prompts for a passcode when a custom price is keyed in. `counter` covers
120
- * both opening and closing a counter (one `counterRecord`/`manage` rule, see
121
- * `APPROVAL_CODE_RULE_TEMPLATES.counter`). `printReceipt` was dropped
95
+ * both opening and closing a counter (one `counterRecord`/`manage` rule on
96
+ * the backend). `printReceipt` was dropped
122
97
  * entirely (no full-POS counterpart, and this feature has no pre-existing
123
98
  * stored data to keep rendering) — there is a 1:1 mapping between every
124
99
  * option and its single `ApprovalCodePermission` rule key, so each option
@@ -131,6 +106,12 @@ export interface AccessCodeActionOption {
131
106
  }
132
107
  export type AccessCodeActionOptionKey = AccessCodeActionOption['key'];
133
108
  export declare const ACCESS_CODE_ACTION_OPTIONS: AccessCodeActionOption[];
109
+ /**
110
+ * Map the form's selected action options to permission-key requests.
111
+ * `maxPercentage` is the raw form input (see `resolveMaxPercentage`) and is
112
+ * attached to the `discount` key only — the backend rejects it elsewhere.
113
+ */
114
+ export declare function buildPermissionRequests(selected: AccessCodeActionOptionKey[], maxPercentage: number | string | undefined): IFdtoApprovalCodePermissionReq[];
134
115
  /** When a code stopped being usable: used wins over revoked (a code can only
135
116
  * be one or the other, but usedAt is the historically-populated field). */
136
117
  export declare function getResolvedAt(code: Pick<IFdtoApprovalCode, 'usedAt' | 'revokedAt'>): string | undefined;
@@ -117,6 +117,7 @@ export declare const i18nMessages: {
117
117
  "order:discount": string;
118
118
  "order:changePrice": string;
119
119
  "order:void": string;
120
+ "order:waiveServiceCharge": string;
120
121
  "order:payment": string;
121
122
  "order:claimDeposit": string;
122
123
  "order:resend": string;
@@ -321,6 +322,7 @@ export declare const i18nMessages: {
321
322
  "order:discount": string;
322
323
  "order:changePrice": string;
323
324
  "order:void": string;
325
+ "order:waiveServiceCharge": string;
324
326
  "order:payment": string;
325
327
  "order:claimDeposit": string;
326
328
  "order:resend": string;
@@ -525,6 +527,7 @@ export declare const i18nMessages: {
525
527
  "order:discount": string;
526
528
  "order:changePrice": string;
527
529
  "order:void": string;
530
+ "order:waiveServiceCharge": string;
528
531
  "order:payment": string;
529
532
  "order:claimDeposit": string;
530
533
  "order:resend": string;
@@ -728,6 +731,7 @@ export declare const i18nMessages: {
728
731
  "order:discount": string;
729
732
  "order:changePrice": string;
730
733
  "order:void": string;
734
+ "order:waiveServiceCharge": string;
731
735
  "order:payment": string;
732
736
  "order:claimDeposit": string;
733
737
  "order:resend": string;