@feedmepos/mf-hrm-portal 2.2.4 → 2.2.5-dev.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.
Files changed (51) hide show
  1. package/dist/{ApprovalCodeList-ChGQwko6.js → ApprovalCodeList-BuIPVwsl.js} +5 -5
  2. package/dist/{AuditLogList-Cpj8O5qS.js → AuditLogList-l3fv_3jD.js} +235 -233
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-CNmbZlVZ.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BYY9dMSQ.js} +2 -2
  4. package/dist/EmployeeList-HjNxPBcN.js +786 -0
  5. package/dist/{GrantUserList-CAXJmQ4i.js → GrantUserList-B91EBl82.js} +6 -6
  6. package/dist/{Main-7yT_w5vt.js → Main-C_tQuQsU.js} +11 -11
  7. package/dist/{Main-T9-30vq8.js → Main-DeqJPnm7.js} +5 -5
  8. package/dist/{Main-Ada9K_jO.js → Main-TuG-h_qY.js} +8 -8
  9. package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-CqG0v0Sz.js +243 -0
  10. package/dist/{PermissionSetList-CkWYPmT2.js → PermissionSetList-qVaYkiQ4.js} +20 -20
  11. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CCLLrSyq.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DcpNr0M4.js} +1237 -1244
  12. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-Z-DH7ouY.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-XHuHin8t.js} +1 -1
  13. package/dist/{RoleList-Do36AmlU.js → RoleList-CM0m4nya.js} +9 -9
  14. package/dist/TeamMemberList-GkMQuyoE.js +1153 -0
  15. package/dist/{TimesheetList-DboJ2_89.js → TimesheetList-Ci2r3AOF.js} +92 -90
  16. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-C4g8wRjv.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-QbQ7tbJP.js} +3 -3
  17. package/dist/{app-CcCcPbyB.js → app-MXDLzWd6.js} +1262 -1230
  18. package/dist/app.js +1 -1
  19. package/dist/{approval-code-BRClD2HN.js → approval-code-jIjkeVEb.js} +1 -1
  20. package/dist/{dayjs.min-lvkj1Rwa.js → dayjs.min-DRqYbe11.js} +1 -1
  21. package/dist/employee-zsQMMIVM.js +204 -0
  22. package/dist/{grant-user-Dhi3ilC_.js → grant-user-SNiDV22U.js} +1 -1
  23. package/dist/{iteration-LZbo-knt.js → iteration-CtN8sidV.js} +1 -1
  24. package/dist/{lodash-CKzaMa7f.js → lodash-BwY7earz.js} +1 -1
  25. package/dist/{restaurant-DiYb0pCm.js → restaurant-BTpBmfBV.js} +2 -2
  26. package/dist/{role-BZr8zzeq.js → role-Ds1yN3BN.js} +2 -2
  27. package/dist/{rule-DNaqlUUB.js → rule-DkG2eGGH.js} +274 -262
  28. package/dist/src/api/employee/index.d.ts +5 -1
  29. package/dist/src/api/team/index.d.ts +3 -0
  30. package/dist/src/components/form/OutletRoleAssignment.vue.d.ts +16 -0
  31. package/dist/src/components/form/PasscodeGenerateButton.vue.d.ts +15 -0
  32. package/dist/src/components/form/PasscodePinField.vue.d.ts +18 -0
  33. package/dist/src/helpers/outlet-role-assignment.d.ts +40 -0
  34. package/dist/src/helpers/rule.d.ts +15 -0
  35. package/dist/src/helpers/string.d.ts +2 -1
  36. package/dist/src/views/audit-log/locales/index.d.ts +4 -0
  37. package/dist/src/views/hr/locales/index.d.ts +8 -0
  38. package/dist/src/views/team/locales/index.d.ts +12 -0
  39. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +1 -0
  40. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +21 -3
  41. package/dist/string-VNuQNweN.js +15 -0
  42. package/dist/style.css +1 -1
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/{useAppStore-BGhlB1_1.js → useAppStore-DCwd8GWN.js} +1 -1
  45. package/dist/{useLoading-CvgqVDbF.js → useLoading-CXzTpIVv.js} +1 -1
  46. package/dist/{useReportPermissions-Buzv6pkY.js → useReportPermissions-B_YakoB-.js} +3 -3
  47. package/package.json +1 -1
  48. package/dist/EmployeeList-PdGzSCP-.js +0 -887
  49. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
  50. package/dist/TeamMemberList-CVVNnz0R.js +0 -1216
  51. package/dist/employee-CLgrXpmZ.js +0 -201
@@ -1,7 +1,7 @@
1
- import { s as W, c as Z, e as y } from "./iteration-LZbo-knt.js";
2
- import { h as O, d as V, e as _, b as F, n as h, O as q, D as L } from "./app-CcCcPbyB.js";
3
- import { s as ee } from "./utils-BZkjJbju.js";
4
- import { g, b, q as D, u as te } from "./restaurant-DiYb0pCm.js";
1
+ import { s as W, c as q, e as y } from "./iteration-CtN8sidV.js";
2
+ import { h as O, d as V, e as _, b as F, n as h, O as ee, D as M } from "./app-MXDLzWd6.js";
3
+ import { s as se } from "./utils-BZkjJbju.js";
4
+ import { g, b, q as x, u as te } from "./restaurant-BTpBmfBV.js";
5
5
  import { defineStore as z, storeToRefs as K } from "pinia";
6
6
  import { ref as S, computed as T } from "vue";
7
7
  import { useCoreStore as X } from "@feedmepos/mf-common";
@@ -12,14 +12,14 @@ const E = "/permission-sets", N = {
12
12
  async create(e) {
13
13
  return g(await b().post(E, e));
14
14
  },
15
- async update(e, t) {
16
- return g(await b().put(`${E}/${e}`, t));
15
+ async update(e, s) {
16
+ return g(await b().put(`${E}/${e}`, s));
17
17
  },
18
18
  async delete(e) {
19
19
  return g(await b().delete(`${E}/${e}`));
20
20
  }
21
- }, se = z("permissionSet", () => {
22
- const { currentBusiness: e } = X(), t = S([]), r = S(!1), n = S(null);
21
+ }, ne = z("permissionSet", () => {
22
+ const { currentBusiness: e } = X(), s = S([]), r = S(!1), n = S(null);
23
23
  async function i() {
24
24
  var l;
25
25
  const c = ((l = e.value) == null ? void 0 : l._id) ?? null;
@@ -27,41 +27,41 @@ const E = "/permission-sets", N = {
27
27
  try {
28
28
  r.value = !0;
29
29
  const d = await N.read();
30
- t.value = u(d), n.value = c;
30
+ s.value = u(d), n.value = c;
31
31
  } finally {
32
32
  r.value = !1;
33
33
  }
34
34
  }
35
- async function s(c) {
35
+ async function t(c) {
36
36
  const l = await N.create(c);
37
- t.value = u([...t.value, l]);
37
+ s.value = u([...s.value, l]);
38
38
  }
39
39
  async function a(c, l) {
40
40
  const d = await N.update(c, l);
41
- t.value = u(t.value.map((m) => m.id === c ? d : m));
41
+ s.value = u(s.value.map((f) => f.id === c ? d : f));
42
42
  }
43
43
  async function o(c) {
44
- await N.delete(c), t.value = u(t.value.filter((l) => l.id !== c));
44
+ await N.delete(c), s.value = u(s.value.filter((l) => l.id !== c));
45
45
  }
46
46
  function u(c) {
47
47
  return c.sort((l, d) => l.name.localeCompare(d.name));
48
48
  }
49
49
  return {
50
- permissionSets: t,
50
+ permissionSets: s,
51
51
  isLoading: r,
52
52
  readPermissionSets: i,
53
- createPermissionSet: s,
53
+ createPermissionSet: t,
54
54
  updatePermissionSet: a,
55
55
  deletePermissionSet: o
56
56
  };
57
- }), ne = () => {
58
- const e = se();
57
+ }), re = () => {
58
+ const e = ne();
59
59
  return {
60
60
  ...e,
61
61
  ...K(e)
62
62
  };
63
63
  };
64
- function k(e) {
64
+ function D(e) {
65
65
  if (e) {
66
66
  if (typeof e == "string") {
67
67
  if (e === "{}") return;
@@ -77,60 +77,60 @@ function k(e) {
77
77
  }
78
78
  function j(e) {
79
79
  return e ? Object.values(e).every(
80
- (t) => t !== null && typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 1 && Array.isArray(t.$in)
80
+ (s) => s !== null && typeof s == "object" && !Array.isArray(s) && Object.keys(s).length === 1 && Array.isArray(s.$in)
81
81
  ) : !0;
82
82
  }
83
83
  function Q(e) {
84
- const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = (i, s, a) => {
84
+ const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = (i, t, a) => {
85
85
  var o, u;
86
- const c = k(s.conditions);
87
- let l = `${s.subject}::${JSON.stringify([...s.actions].sort())}`;
86
+ const c = D(t.conditions);
87
+ let l = `${t.subject}::${JSON.stringify([...t.actions].sort())}`;
88
88
  j(c) || (l += `::${JSON.stringify(c)}`);
89
89
  const d = i.get(l);
90
90
  if (!d) {
91
- i.set(l, { ...s, setNames: [a.name], setId: a._id });
91
+ i.set(l, { ...t, setNames: [a.name], setId: a._id });
92
92
  return;
93
93
  }
94
94
  d.setNames.push(a.name);
95
- const m = k(d.conditions);
96
- if (!m || !c) {
95
+ const f = D(d.conditions);
96
+ if (!f || !c) {
97
97
  d.conditions = void 0;
98
98
  return;
99
99
  }
100
- for (const f in c)
101
- (o = m[f]) != null && o.$in && (u = c[f]) != null && u.$in ? m[f].$in = Array.from(
102
- /* @__PURE__ */ new Set([...m[f].$in, ...c[f].$in])
103
- ) : m[f] || (m[f] = c[f]);
104
- d.conditions = JSON.stringify(m);
100
+ for (const m in c)
101
+ (o = f[m]) != null && o.$in && (u = c[m]) != null && u.$in ? f[m].$in = Array.from(
102
+ /* @__PURE__ */ new Set([...f[m].$in, ...c[m].$in])
103
+ ) : f[m] || (f[m] = c[m]);
104
+ d.conditions = JSON.stringify(f);
105
105
  };
106
106
  for (const i of e)
107
- for (const s of i.permissions)
108
- n(s.inverted ? r : t, s, i);
109
- return [...Array.from(t.values()), ...Array.from(r.values())];
107
+ for (const t of i.permissions)
108
+ n(t.inverted ? r : s, t, i);
109
+ return [...Array.from(s.values()), ...Array.from(r.values())];
110
110
  }
111
- function B(e, t) {
112
- return `${e}::${[...t].sort().join(",")}`;
111
+ function B(e, s) {
112
+ return `${e}::${[...s].sort().join(",")}`;
113
113
  }
114
- function G(e, t) {
115
- const r = [...e], n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
114
+ function G(e, s) {
115
+ const r = [...e], n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
116
116
  for (const o of e) {
117
117
  const u = O(o.subject);
118
- n.add(B(u, o.actions)), o.inverted && o.actions.includes("manage") && i.add(`set_${u}`), !o.inverted && o.actions.includes("manage") && s.add(u);
118
+ n.add(B(u, o.actions)), o.inverted && o.actions.includes("manage") && i.add(`set_${u}`), !o.inverted && o.actions.includes("manage") && t.add(u);
119
119
  }
120
120
  const a = [...e];
121
121
  for (; a.length > 0; ) {
122
- const o = a.shift(), u = `set_${O(o.subject)}`, c = t[u];
122
+ const o = a.shift(), u = `set_${O(o.subject)}`, c = s[u];
123
123
  if (!c || i.has(u) || !o.actions.includes("manage") || o.inverted) continue;
124
124
  i.add(u);
125
- const l = re(o);
125
+ const l = ie(o);
126
126
  o.source && !o.source.trace && (o.source = { ...o.source, trace: l });
127
127
  const d = [...l, `${c.name} (system)`];
128
- for (const m of c.permissions ?? []) {
129
- const f = O(m.subject), p = B(f, m.actions);
130
- n.has(p) || s.has(f) || (n.add(p), r.push({
131
- ...m,
128
+ for (const f of c.permissions ?? []) {
129
+ const m = O(f.subject), p = B(m, f.actions);
130
+ n.has(p) || t.has(m) || (n.add(p), r.push({
131
+ ...f,
132
132
  // FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
133
- fields: m.fields ?? void 0,
133
+ fields: f.fields ?? void 0,
134
134
  source: {
135
135
  type: "systemPermissionSet",
136
136
  permissionSetId: c.key,
@@ -139,9 +139,9 @@ function G(e, t) {
139
139
  }
140
140
  }));
141
141
  }
142
- for (const m of c.permissionSets ?? []) {
143
- const f = O(m), p = B(f, ["manage"]), v = {
144
- subject: f,
142
+ for (const f of c.permissionSets ?? []) {
143
+ const m = O(f), p = B(m, ["manage"]), v = {
144
+ subject: m,
145
145
  actions: ["manage"],
146
146
  source: {
147
147
  type: "systemPermissionSet",
@@ -155,11 +155,11 @@ function G(e, t) {
155
155
  }
156
156
  return [...r.filter((o) => !o.inverted), ...r.filter((o) => o.inverted)];
157
157
  }
158
- function re(e) {
158
+ function ie(e) {
159
159
  if (!e.source) return [];
160
- const { type: t, trace: r, permissionSetName: n } = e.source;
160
+ const { type: s, trace: r, permissionSetName: n } = e.source;
161
161
  if (r && r.length > 0) return r;
162
- switch (t) {
162
+ switch (s) {
163
163
  case "permissionSet":
164
164
  return n ? [n] : [];
165
165
  case "custom":
@@ -168,41 +168,41 @@ function re(e) {
168
168
  return [];
169
169
  }
170
170
  }
171
- function H(e, t, r = /* @__PURE__ */ new Set()) {
171
+ function H(e, s, r = /* @__PURE__ */ new Set()) {
172
172
  var i;
173
173
  const n = [];
174
- for (const s of e) {
175
- if (r.has(s)) continue;
176
- r.add(s);
177
- const a = t.find((o) => o.id === s);
178
- a && (n.push(a), (i = a.permissionSetIds) != null && i.length && n.push(...H(a.permissionSetIds, t, r)));
174
+ for (const t of e) {
175
+ if (r.has(t)) continue;
176
+ r.add(t);
177
+ const a = s.find((o) => o.id === t);
178
+ a && (n.push(a), (i = a.permissionSetIds) != null && i.length && n.push(...H(a.permissionSetIds, s, r)));
179
179
  }
180
180
  return n;
181
181
  }
182
- function Ie(e) {
183
- const t = Q(e).map(
184
- ({ setNames: i, setId: s, ...a }) => a
185
- ), r = t.filter((i) => !i.inverted), n = t.filter((i) => i.inverted);
186
- return M(r, n);
182
+ function Ae(e) {
183
+ const s = Q(e).map(
184
+ ({ setNames: i, setId: t, ...a }) => a
185
+ ), r = s.filter((i) => !i.inverted), n = s.filter((i) => i.inverted);
186
+ return L(r, n);
187
187
  }
188
- function Ae(e, t, r) {
188
+ function Oe(e, s, r) {
189
189
  const n = /* @__PURE__ */ new Map();
190
190
  return e.forEach(
191
- ({ name: i, permissions: s }) => s.forEach(({ conditions: a, actions: o }) => {
191
+ ({ name: i, permissions: t }) => t.forEach(({ conditions: a, actions: o }) => {
192
192
  var c, l;
193
193
  const u = JSON.parse(a || "{}");
194
- (c = u[t]) != null && c.$in ? (l = u[t]) == null || l.$in.forEach(
194
+ (c = u[s]) != null && c.$in ? (l = u[s]) == null || l.$in.forEach(
195
195
  (d) => (n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(i)
196
196
  ) : o[0] === "manage" && r.forEach((d) => {
197
197
  (n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(i);
198
198
  });
199
199
  })
200
- ), [...n].map(([i, s]) => ({
200
+ ), [...n].map(([i, t]) => ({
201
201
  id: i,
202
- setNames: [...s]
202
+ setNames: [...t]
203
203
  }));
204
204
  }
205
- function Oe(e, t) {
205
+ function _e(e, s) {
206
206
  const r = (o, u) => {
207
207
  const c = { ...o }, l = JSON.parse(c.conditions || "{}");
208
208
  if (u)
@@ -216,45 +216,45 @@ function Oe(e, t) {
216
216
  inverted: !0,
217
217
  ...c.conditions && { conditions: JSON.stringify(l) }
218
218
  };
219
- }, n = new Map(e.map((o) => [o.subject, o])), i = new Map(t.map((o) => [o.subject, o])), s = [], a = /* @__PURE__ */ new Set([...n.keys(), ...i.keys()]);
219
+ }, n = new Map(e.map((o) => [o.subject, o])), i = new Map(s.map((o) => [o.subject, o])), t = [], a = /* @__PURE__ */ new Set([...n.keys(), ...i.keys()]);
220
220
  for (const o of a) {
221
221
  const u = n.get(o), c = i.get(o);
222
222
  if (u && c) {
223
223
  if (u.conditions && c.conditions) {
224
224
  const l = JSON.parse(u.conditions), d = JSON.parse(c.conditions);
225
225
  if (!j(l) || !j(d)) {
226
- JSON.stringify(l) !== JSON.stringify(d) && s.push(c);
226
+ JSON.stringify(l) !== JSON.stringify(d) && t.push(c);
227
227
  continue;
228
228
  }
229
- const m = Object.keys(l)[0], f = l[m].$in.filter(
230
- (v) => !d[m].$in.includes(v)
229
+ const f = Object.keys(l)[0], m = l[f].$in.filter(
230
+ (v) => !d[f].$in.includes(v)
231
231
  );
232
- f.length > 0 && s.push(r(u, f)), d[m].$in.filter(
233
- (v) => !l[m].$in.includes(v)
234
- ).length > 0 && s.push(c);
232
+ m.length > 0 && t.push(r(u, m)), d[f].$in.filter(
233
+ (v) => !l[f].$in.includes(v)
234
+ ).length > 0 && t.push(c);
235
235
  } else if (!u.conditions && c.conditions)
236
- s.push(c);
236
+ t.push(c);
237
237
  else if (u.conditions && !c.conditions)
238
- j(JSON.parse(u.conditions)) || s.push(c);
238
+ j(JSON.parse(u.conditions)) || t.push(c);
239
239
  else if (!u.conditions && !c.conditions) {
240
- const l = new Set(u.actions), d = new Set(c.actions), m = c.actions.some((p) => !l.has(p)), f = u.actions.filter((p) => !d.has(p));
241
- if (m) {
240
+ const l = new Set(u.actions), d = new Set(c.actions), f = c.actions.some((p) => !l.has(p)), m = u.actions.filter((p) => !d.has(p));
241
+ if (f) {
242
242
  const p = c.actions.filter((v) => !l.has(v));
243
- s.push({
243
+ t.push({
244
244
  ...c,
245
245
  actions: p
246
246
  });
247
247
  }
248
- f.length > 0 && s.push({
248
+ m.length > 0 && t.push({
249
249
  ...u,
250
- actions: f,
250
+ actions: m,
251
251
  inverted: !0
252
252
  });
253
253
  }
254
254
  continue;
255
255
  }
256
256
  if (u) {
257
- s.push(
257
+ t.push(
258
258
  r(
259
259
  u,
260
260
  // If base has conditions, set diffIds to empty array, disallow all access to collection
@@ -264,126 +264,126 @@ function Oe(e, t) {
264
264
  );
265
265
  continue;
266
266
  }
267
- c && s.push(c);
267
+ c && t.push(c);
268
268
  }
269
- return s;
269
+ return t;
270
270
  }
271
- function _e(e) {
272
- const t = G(
271
+ function Ee(e) {
272
+ const s = G(
273
273
  e,
274
274
  V
275
275
  ), r = new Set(
276
- t.filter((i) => {
277
- var s;
278
- return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted;
276
+ s.filter((i) => {
277
+ var t;
278
+ return ((t = i.source) == null ? void 0 : t.type) === "systemPermissionSet" && !i.inverted;
279
279
  }).map((i) => i.subject)
280
280
  ), n = new Set(
281
- t.filter(
281
+ s.filter(
282
282
  (i) => {
283
- var s;
284
- return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
283
+ var t;
284
+ return ((t = i.source) == null ? void 0 : t.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
285
285
  }
286
286
  ).map((i) => i.subject)
287
287
  );
288
288
  return e.filter((i) => i.inverted ? !(r.has(i.subject) && !n.has(i.subject)) : !r.has(i.subject));
289
289
  }
290
- const ie = "business::report::";
291
- function Ee(e, t) {
290
+ const oe = "business::report::";
291
+ function Ne(e, s) {
292
292
  const r = [], n = e.filter((i) => {
293
- const s = i.subject;
294
- return !s.startsWith(ie) || t.has(s) ? !0 : (r.push(s), !1);
293
+ const t = i.subject;
294
+ return !t.startsWith(oe) || s.has(t) ? !0 : (r.push(t), !1);
295
295
  });
296
296
  return r.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", r), n;
297
297
  }
298
- const oe = "business::report::reports::", ae = _.Subject.Business.report_reports_allDefaultReports, ce = _.Subject.Business.report_reports_allCustomReports;
299
- function ue(e, t) {
300
- return e.conditions ? !!t.conditions && e.conditions === t.conditions : !t.conditions;
298
+ const ae = "business::report::reports::", ce = _.Subject.Business.report_reports_allDefaultReports, ue = _.Subject.Business.report_reports_allCustomReports;
299
+ function le(e, s) {
300
+ return e.conditions ? !!s.conditions && e.conditions === s.conditions : !s.conditions;
301
301
  }
302
- function Ne(e, t) {
302
+ function Ue(e, s) {
303
303
  const r = e.find(
304
- (a) => !a.inverted && a.subject === ae
305
- ), n = e.find(
306
304
  (a) => !a.inverted && a.subject === ce
305
+ ), n = e.find(
306
+ (a) => !a.inverted && a.subject === ue
307
307
  );
308
308
  if (!r && !n) return e;
309
- const i = r ? new Set(r.actions) : null, s = n ? new Set(n.actions) : null;
309
+ const i = r ? new Set(r.actions) : null, t = n ? new Set(n.actions) : null;
310
310
  return e.reduce((a, o) => {
311
311
  if (o.inverted)
312
312
  return a.push(o), a;
313
313
  const u = o.subject;
314
- if (!u.startsWith(oe))
314
+ if (!u.startsWith(ae))
315
315
  return a.push(o), a;
316
- const c = t.has(u), l = c ? i : s, d = c ? r : n;
317
- if (!l || !d || !ue(d, o))
316
+ const c = s.has(u), l = c ? i : t, d = c ? r : n;
317
+ if (!l || !d || !le(d, o))
318
318
  return a.push(o), a;
319
319
  if (l.has("manage")) return a;
320
- const m = o.actions;
321
- if (m.includes("manage"))
320
+ const f = o.actions;
321
+ if (f.includes("manage"))
322
322
  return a.push(o), a;
323
- const f = new Set(m);
323
+ const m = new Set(f);
324
324
  for (const p of l)
325
- f.delete(p);
326
- return f.size === 0 || a.push({ ...o, actions: Array.from(f) }), a;
325
+ m.delete(p);
326
+ return m.size === 0 || a.push({ ...o, actions: Array.from(m) }), a;
327
327
  }, []);
328
328
  }
329
- function M(e, t) {
329
+ function L(e, s) {
330
330
  var n, i;
331
- const r = new Map(e.map((s) => [s.subject, s]));
332
- for (const s of t) {
333
- if (s.inverted) {
334
- const o = r.get(s.subject);
335
- if (s.conditions) {
331
+ const r = new Map(e.map((t) => [t.subject, t]));
332
+ for (const t of s) {
333
+ if (t.inverted) {
334
+ const o = r.get(t.subject);
335
+ if (t.conditions) {
336
336
  if (o != null && o.conditions) {
337
- const u = JSON.parse(o.conditions), c = JSON.parse(s.conditions);
337
+ const u = JSON.parse(o.conditions), c = JSON.parse(t.conditions);
338
338
  if (!j(u) || !j(c)) {
339
- r.delete(s.subject);
339
+ r.delete(t.subject);
340
340
  continue;
341
341
  }
342
- const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], f = (((i = u[l]) == null ? void 0 : i.$in) ?? []).filter((p) => !d.includes(p));
343
- f.length > 0 ? r.set(s.subject, {
342
+ const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], m = (((i = u[l]) == null ? void 0 : i.$in) ?? []).filter((p) => !d.includes(p));
343
+ m.length > 0 ? r.set(t.subject, {
344
344
  ...o,
345
- conditions: JSON.stringify({ [l]: { $in: f } })
346
- }) : r.delete(s.subject);
345
+ conditions: JSON.stringify({ [l]: { $in: m } })
346
+ }) : r.delete(t.subject);
347
347
  } else
348
- r.delete(s.subject);
348
+ r.delete(t.subject);
349
349
  continue;
350
350
  }
351
351
  if (o) {
352
- const u = new Set(s.actions), c = o.actions.filter((l) => !u.has(l));
353
- c.length > 0 ? r.set(s.subject, { ...o, actions: c }) : r.delete(s.subject);
352
+ const u = new Set(t.actions), c = o.actions.filter((l) => !u.has(l));
353
+ c.length > 0 ? r.set(t.subject, { ...o, actions: c }) : r.delete(t.subject);
354
354
  continue;
355
355
  }
356
356
  continue;
357
357
  }
358
- if (s.conditions) {
359
- r.set(s.subject, s);
358
+ if (t.conditions) {
359
+ r.set(t.subject, t);
360
360
  continue;
361
361
  }
362
- const a = r.get(s.subject);
362
+ const a = r.get(t.subject);
363
363
  if (a != null && a.conditions && !j(JSON.parse(a.conditions))) {
364
- r.set(s.subject, s);
364
+ r.set(t.subject, t);
365
365
  continue;
366
366
  }
367
367
  if (a) {
368
368
  const o = [
369
369
  .../* @__PURE__ */ new Set([
370
370
  ...a.actions,
371
- ...s.actions
371
+ ...t.actions
372
372
  ])
373
373
  ];
374
- r.set(s.subject, { ...a, actions: o });
374
+ r.set(t.subject, { ...a, actions: o });
375
375
  } else
376
- r.set(s.subject, s);
376
+ r.set(t.subject, t);
377
377
  }
378
378
  return Array.from(r.values());
379
379
  }
380
- function le(e, t) {
381
- const r = M(e, t), n = new Set(e.map((s) => s.subject)), i = t.filter(
382
- (s) => s.inverted && !n.has(s.subject)
380
+ function de(e, s) {
381
+ const r = L(e, s), n = new Set(e.map((t) => t.subject)), i = s.filter(
382
+ (t) => t.inverted && !n.has(t.subject)
383
383
  );
384
384
  return [...r, ...i];
385
385
  }
386
- const P = "/permission-assignments", R = {
386
+ const P = "/permission-assignments", I = {
387
387
  async readAll() {
388
388
  return g(await b().get(P));
389
389
  },
@@ -396,95 +396,95 @@ const P = "/permission-assignments", R = {
396
396
  async create(e) {
397
397
  return g(await b().post(P, e));
398
398
  },
399
- async update(e, t) {
400
- return g(await b().put(`${P}/${e}`, t));
399
+ async update(e, s) {
400
+ return g(await b().put(`${P}/${e}`, s));
401
401
  },
402
402
  async delete(e) {
403
403
  return g(await b().delete(`${P}/${e}`));
404
404
  },
405
- async addReportManagePermission(e, t) {
405
+ async addReportManagePermission(e, s) {
406
406
  return g(
407
- await b().post("/my-permissions/report-manage", { permissionKey: e, label: t })
407
+ await b().post("/my-permissions/report-manage", { permissionKey: e, label: s })
408
408
  );
409
409
  }
410
- }, de = z("permissionAssignment", () => {
410
+ }, fe = z("permissionAssignment", () => {
411
411
  const e = S([]);
412
- async function t() {
413
- const o = await R.readAll();
412
+ async function s() {
413
+ const o = await I.readAll();
414
414
  e.value = o;
415
415
  }
416
416
  async function r(o) {
417
- return await R.readByUserId(o);
417
+ return await I.readByUserId(o);
418
418
  }
419
419
  async function n(o) {
420
- const u = await R.create(o);
420
+ const u = await I.create(o);
421
421
  e.value = [...e.value, u];
422
422
  }
423
423
  async function i(o, u) {
424
- const c = await R.update(o, u);
424
+ const c = await I.update(o, u);
425
425
  e.value = e.value.map((l) => l.id === o ? c : l);
426
426
  }
427
- async function s(o) {
428
- await R.delete(o), e.value = e.value.filter((u) => u.id !== o);
427
+ async function t(o) {
428
+ await I.delete(o), e.value = e.value.filter((u) => u.id !== o);
429
429
  }
430
430
  function a(o) {
431
431
  return e.value.find((u) => u.userId === o);
432
432
  }
433
433
  return {
434
434
  permissionAssignments: e,
435
- readPermissionAssignments: t,
435
+ readPermissionAssignments: s,
436
436
  readPermissionAssignmentByUserId: r,
437
437
  createPermissionAssignment: n,
438
438
  updatePermissionAssignment: i,
439
- deletePermissionAssignment: s,
439
+ deletePermissionAssignment: t,
440
440
  getPermissionAssignmentByUserId: a
441
441
  };
442
442
  }), me = () => {
443
- const e = de();
443
+ const e = fe();
444
444
  return {
445
445
  ...e,
446
446
  ...K(e)
447
447
  };
448
- }, fe = {
449
- async fetchReportPermissions(e, t) {
450
- const r = t ? { lang: t } : {};
448
+ }, pe = {
449
+ async fetchReportPermissions(e, s) {
450
+ const r = s ? { lang: s } : {};
451
451
  return g(
452
- await D().get(`/report-query/hrm/${e}/reports`, { params: r })
452
+ await x().get(`/report-query/hrm/${e}/reports`, { params: r })
453
453
  );
454
454
  },
455
- async fetchReportPermissionsForPortal(e, t) {
456
- const r = t ? { isSupportPos: !1, lang: t } : { isSupportPos: !1 };
455
+ async fetchReportPermissionsForPortal(e, s) {
456
+ const r = s ? { isSupportPos: !1, lang: s } : { isSupportPos: !1 };
457
457
  return g(
458
- await D().get(`/report-query/hrm/${e}/reports`, { params: r })
458
+ await x().get(`/report-query/hrm/${e}/reports`, { params: r })
459
459
  );
460
460
  }
461
- }, C = S([]), J = S(!1), $ = S(!1), I = S(null), x = S(null), U = S(!1);
462
- function pe() {
461
+ }, U = S([]), C = S(!1), R = S(!1), $ = S(null), k = S(null), J = S(!1);
462
+ function ge() {
463
463
  const e = X();
464
- async function t() {
465
- var s;
466
- const n = (s = e.currentBusiness.value) == null ? void 0 : s.id;
464
+ async function s() {
465
+ var t;
466
+ const n = (t = e.currentBusiness.value) == null ? void 0 : t.id;
467
467
  if (!n) return;
468
468
  const i = localStorage.getItem("locale");
469
- if (I.value !== n && (C.value = [], J.value = !1, $.value = !1, I.value = n, U.value = !1), !(J.value && x.value === i)) {
470
- if ($.value) {
471
- U.value = !0;
469
+ if ($.value !== n && (U.value = [], C.value = !1, R.value = !1, $.value = n, J.value = !1), !(C.value && k.value === i)) {
470
+ if (R.value) {
471
+ J.value = !0;
472
472
  return;
473
473
  }
474
- $.value = !0;
474
+ R.value = !0;
475
475
  try {
476
- const a = await fe.fetchReportPermissionsForPortal(n, i);
477
- if (I.value !== n) return;
478
- C.value = a, J.value = !0, x.value = i;
476
+ const a = await pe.fetchReportPermissionsForPortal(n, i);
477
+ if ($.value !== n) return;
478
+ U.value = a, C.value = !0, k.value = i;
479
479
  } catch (a) {
480
- if (I.value !== n) return;
481
- console.warn("Failed to fetch custom report permissions:", a), C.value = [];
480
+ if ($.value !== n) return;
481
+ console.warn("Failed to fetch custom report permissions:", a), U.value = [];
482
482
  } finally {
483
- I.value === n && ($.value = !1, U.value && (U.value = !1, await t()));
483
+ $.value === n && (R.value = !1, J.value && (J.value = !1, await s()));
484
484
  }
485
485
  }
486
486
  }
487
- const r = T(() => C.value.map(
487
+ const r = T(() => U.value.map(
488
488
  (n) => n.isDefault ? {
489
489
  label: n.name,
490
490
  subject: `business::report::reports::${n.permissionKey}`,
@@ -504,25 +504,25 @@ function pe() {
504
504
  }
505
505
  ));
506
506
  return {
507
- fetchCustomReportPermissions: t,
507
+ fetchCustomReportPermissions: s,
508
508
  customReportPermissions: r,
509
- isLoading: T(() => $.value),
510
- isLoaded: T(() => J.value)
509
+ isLoading: T(() => R.value),
510
+ isLoaded: T(() => C.value)
511
511
  };
512
512
  }
513
513
  function A(e) {
514
- const t = ne(), r = me(), n = te().restaurants, { customReportPermissions: i } = pe(), s = r.getPermissionAssignmentByUserId(e.id), a = H(
515
- (s == null ? void 0 : s.permissionSetIds) ?? [],
516
- t.permissionSets.value
514
+ const s = re(), r = me(), n = te().restaurants, { customReportPermissions: i } = ge(), t = r.getPermissionAssignmentByUserId(e.id), a = H(
515
+ (t == null ? void 0 : t.permissionSetIds) ?? [],
516
+ s.permissionSets.value
517
517
  ), o = Q(a).map(
518
518
  ({ setNames: p, ...v }) => v
519
- ), u = s == null ? void 0 : s.customPermissions, c = u ?? e.permissions.map((p) => ({
519
+ ), u = t == null ? void 0 : t.customPermissions, c = u ?? e.permissions.map((p) => ({
520
520
  ...p,
521
521
  subject: O(p.subject)
522
- })), l = M(o, c), d = G(
523
- le(o, c),
522
+ })), l = L(o, c), d = G(
523
+ de(o, c),
524
524
  V
525
- ).filter((p) => !p.inverted), m = be(d), f = m ?? n.value.map((p) => p._id);
525
+ ).filter((p) => !p.inverted), f = Y(d), m = f ?? n.value.map((p) => p._id);
526
526
  return {
527
527
  doc: e,
528
528
  id: e.id,
@@ -530,18 +530,18 @@ function A(e) {
530
530
  phoneNumber: e.phoneNumber,
531
531
  email: e.email,
532
532
  restaurants: W(
533
- f.map((p) => {
533
+ m.map((p) => {
534
534
  var v;
535
- return ((v = n.value.find((Y) => Y._id === p)) == null ? void 0 : v.profile.name) ?? "";
535
+ return ((v = n.value.find((Z) => Z._id === p)) == null ? void 0 : v.profile.name) ?? "";
536
536
  })
537
537
  ),
538
- managableRestaurantIds: m,
539
- permissionLabels: Se(d, i.value),
538
+ managableRestaurantIds: f,
539
+ permissionLabels: he(d, i.value),
540
540
  permissions: l
541
541
  };
542
542
  }
543
- const ge = Object.freeze(
544
- Object.values(q)
543
+ const be = Object.freeze(
544
+ Object.values(ee)
545
545
  ), Ce = {
546
546
  async readTeamMembers() {
547
547
  return g(
@@ -550,7 +550,7 @@ const ge = Object.freeze(
550
550
  },
551
551
  async readTeamMembersPage(e) {
552
552
  var r, n, i;
553
- const t = g(
553
+ const s = g(
554
554
  await b().get("/portal-users/paged", {
555
555
  params: {
556
556
  limit: e.limit,
@@ -563,8 +563,8 @@ const ge = Object.freeze(
563
563
  })
564
564
  );
565
565
  return {
566
- items: t.items.map(A),
567
- total: t.total
566
+ items: s.items.map(A),
567
+ total: s.total
568
568
  };
569
569
  },
570
570
  async readTeamMember(e) {
@@ -577,33 +577,41 @@ const ge = Object.freeze(
577
577
  g(await b().post("/portal-users", e))
578
578
  );
579
579
  },
580
- async updateTeamMember(e, t) {
580
+ async updateTeamMember(e, s) {
581
581
  return A(
582
- g(await b().put(`/portal-users/${e}`, t))
582
+ g(await b().put(`/portal-users/${e}`, s))
583
583
  );
584
584
  },
585
585
  async deleteTeamMember(e) {
586
586
  return g(await b().delete(`/portal-users/${e}`));
587
587
  },
588
588
  async readTeamMemberPosUserIds() {
589
- return g(await b().get("/portal-users")).map((t) => t.posUserId);
589
+ return g(await b().get("/portal-users")).map((s) => s.posUserId);
590
+ },
591
+ async generateMasterUserPasscode(e) {
592
+ return `${g(
593
+ await b().post("/portal-users/generate-passcode", {
594
+ restaurantIds: e.restaurantIds,
595
+ excludePosUserId: e.excludePosUserId
596
+ })
597
+ )}`;
590
598
  }
591
599
  };
592
- function Je(e, t, r) {
600
+ function Je(e, s, r) {
593
601
  if (e.some((a) => a.subject === "all")) return "All";
594
- const n = (r ?? L).filter(
595
- (a) => a.subject === t
596
- ), i = new Set(n.map((a) => w(a).value)), s = e.filter((a) => a.subject === t).filter((a) => i.has(w(a).value));
597
- return s.length === n.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
602
+ const n = (r ?? M).filter(
603
+ (a) => a.subject === s
604
+ ), i = new Set(n.map((a) => w(a).value)), t = e.filter((a) => a.subject === s).filter((a) => i.has(w(a).value));
605
+ return t.length === n.length ? "All" : t.length === 0 ? "-" : `${t.length} permission allow`;
598
606
  }
599
607
  function w(e) {
600
- const t = Z(e), r = t.subject;
608
+ const s = q(e), r = s.subject;
601
609
  return {
602
- ...t,
610
+ ...s,
603
611
  get conditions() {
604
- if (typeof t.conditions != "string") return t.conditions;
612
+ if (typeof s.conditions != "string") return s.conditions;
605
613
  try {
606
- return JSON.parse(t.conditions);
614
+ return JSON.parse(s.conditions);
607
615
  } catch {
608
616
  return;
609
617
  }
@@ -644,7 +652,7 @@ function w(e) {
644
652
  return n === void 0 ? r.toString() : n.endsWith("_") ? n.slice(0, n.length - 1) : n;
645
653
  },
646
654
  get label() {
647
- return t.label || ee(this.formatted);
655
+ return s.label || se(this.formatted);
648
656
  },
649
657
  get value() {
650
658
  const n = this.discriminator;
@@ -652,57 +660,60 @@ function w(e) {
652
660
  }
653
661
  };
654
662
  }
655
- function Ue(e) {
663
+ function Te(e) {
656
664
  var n, i;
657
- const t = e.map((s) => w(s)).find((s) => s.isDiscountOperation);
658
- if (!t) return 100;
659
- const r = Number((i = (n = t.conditions) == null ? void 0 : n.adjustment) == null ? void 0 : i.$lte);
665
+ const s = e.map((t) => w(t)).find((t) => t.isDiscountOperation);
666
+ if (!s) return 100;
667
+ const r = Number((i = (n = s.conditions) == null ? void 0 : n.adjustment) == null ? void 0 : i.$lte);
660
668
  return Number.isFinite(r) ? parseInt((r * 100).toFixed(0)) : 0;
661
669
  }
662
- function be(e) {
663
- const t = e.find(
670
+ function Y(e) {
671
+ const s = e.find(
664
672
  (r) => r.subject === _.Subject.Restaurant.restaurant
665
673
  );
666
- return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
674
+ return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
667
675
  }
668
- function Te(e) {
669
- return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
676
+ function Be(e, s) {
677
+ return s.isOwner ? { restaurantIds: null, roleIds: null } : { restaurantIds: Y(e), roleIds: ve(e) };
678
+ }
679
+ function Me(e) {
680
+ return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
670
681
  }
671
- function Be(e) {
672
- const t = e.find((r) => r.subject === _.Subject.Business.role);
673
- return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
682
+ function ve(e) {
683
+ const s = e.find((r) => r.subject === _.Subject.Business.role);
684
+ return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
674
685
  }
675
686
  function Le(e) {
676
- const t = w(e);
677
- if (!t.isReportPermission) return;
678
- const { name: r, ...n } = t.conditions ?? {};
687
+ const s = w(e);
688
+ if (!s.isReportPermission) return;
689
+ const { name: r, ...n } = s.conditions ?? {};
679
690
  return Object.keys(n).length > 0 ? n : void 0;
680
691
  }
681
- function Me(e, t, r) {
692
+ function Fe(e, s, r) {
682
693
  return e.flatMap((n) => {
683
- const i = ve(n);
694
+ const i = Se(n);
684
695
  if (!i) return [];
685
- const s = i.isReportPermission ? r == null ? void 0 : r.get(n) : void 0;
696
+ const t = i.isReportPermission ? r == null ? void 0 : r.get(n) : void 0;
686
697
  return [
687
698
  {
688
699
  subject: i.subject,
689
700
  actions: i.actions,
690
701
  conditions: {
691
702
  ...i.conditions,
692
- ...s ?? {},
693
- adjustment: i.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
703
+ ...t ?? {},
704
+ adjustment: i.isDiscountOperation ? { $lte: parseFloat((s / 100).toFixed(2)) } : void 0
694
705
  }
695
706
  }
696
707
  ];
697
708
  });
698
709
  }
699
- function ve(e) {
700
- const t = e.indexOf(":"), r = t === -1 ? e : e.slice(0, t), n = t === -1 ? void 0 : e.slice(t + 1);
701
- if (t !== -1 && !n) return;
710
+ function Se(e) {
711
+ const s = e.indexOf(":"), r = s === -1 ? e : e.slice(0, s), n = s === -1 ? void 0 : e.slice(s + 1);
712
+ if (s !== -1 && !n) return;
702
713
  let i;
703
- return n ? (i = L.find((s) => {
704
- if (s.subject !== r) return !1;
705
- const a = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
714
+ return n ? (i = M.find((t) => {
715
+ if (t.subject !== r) return !1;
716
+ const a = typeof t.conditions == "string" ? JSON.parse(t.conditions) : t.conditions;
706
717
  return [a == null ? void 0 : a.operation, a == null ? void 0 : a.name].includes(n);
707
718
  }), !i && r === y.F_RULE_SUBJECT.enum.report && (i = {
708
719
  label: "",
@@ -711,9 +722,9 @@ function ve(e) {
711
722
  conditions: { name: n },
712
723
  inverted: !1,
713
724
  reason: ""
714
- })) : i = L.find((s) => s.subject === r), i ? w(i) : void 0;
725
+ })) : i = M.find((t) => t.subject === r), i ? w(i) : void 0;
715
726
  }
716
- function Fe(e, t) {
727
+ function xe(e, s) {
717
728
  const r = { values: [], passthrough: [], dropped: [] };
718
729
  for (const n of e) {
719
730
  const i = n == null ? void 0 : n.actions;
@@ -721,20 +732,20 @@ function Fe(e, t) {
721
732
  r.dropped.push(n);
722
733
  continue;
723
734
  }
724
- const s = w(n).value, a = `${y.F_RULE_SUBJECT.enum.report}:`, o = s.startsWith(a) ? s.slice(a.length) : "";
725
- t.has(s) || o && o !== "undefined" ? r.values.push(s) : r.passthrough.push(n);
735
+ const t = w(n).value, a = `${y.F_RULE_SUBJECT.enum.report}:`, o = t.startsWith(a) ? t.slice(a.length) : "";
736
+ s.has(t) || o && o !== "undefined" ? r.values.push(t) : r.passthrough.push(n);
726
737
  }
727
738
  return r;
728
739
  }
729
- function Se(e, t = []) {
740
+ function he(e, s = []) {
730
741
  return W(
731
742
  e.reduce((r, n) => {
732
- const i = ge.find(
733
- (s) => s.subject === n.subject && n.actions.includes("manage")
734
- ) || t.find((s) => s.subject === n.subject);
743
+ const i = be.find(
744
+ (t) => t.subject === n.subject && n.actions.includes("manage")
745
+ ) || s.find((t) => t.subject === n.subject);
735
746
  if (i) {
736
- const s = i.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
737
- r.push(s);
747
+ const t = i.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
748
+ r.push(t);
738
749
  }
739
750
  return r;
740
751
  }, [])
@@ -743,29 +754,30 @@ function Se(e, t = []) {
743
754
  export {
744
755
  G as N,
745
756
  Q as P,
746
- fe as R,
757
+ pe as R,
747
758
  Je as a,
748
- le as b,
759
+ de as b,
749
760
  H as c,
750
- pe as d,
761
+ ge as d,
751
762
  Le as e,
752
- Me as f,
753
- Ue as g,
754
- Te as h,
755
- ie as i,
763
+ Fe as f,
764
+ Te as g,
765
+ Me as h,
766
+ oe as i,
756
767
  Be as j,
757
- be as k,
768
+ Ee as k,
758
769
  _e as l,
759
- Ie as m,
760
- Oe as n,
761
- Ee as o,
762
- ge as p,
763
- Ne as q,
770
+ Ae as m,
771
+ Ne as n,
772
+ Ue as o,
773
+ be as p,
774
+ me as q,
764
775
  w as r,
765
- Fe as s,
776
+ xe as s,
766
777
  Ce as t,
767
- ne as u,
768
- me as v,
769
- Se as w,
770
- Ae as x
778
+ re as u,
779
+ he as v,
780
+ Oe as w,
781
+ Y as x,
782
+ ve as y
771
783
  };