@feedmepos/mf-hrm-portal 2.0.19 → 2.0.20-dev.2

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 (66) hide show
  1. package/dist/AuditLogList-ChxAzO74.js +1037 -0
  2. package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +58 -0
  3. package/dist/EmployeeList-Cs-Mn6UA.js +843 -0
  4. package/dist/FormItem.vue_vue_type_script_setup_true_lang-D3MOFOUI.js +45 -0
  5. package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +49 -0
  6. package/dist/{Main-BPM7QyFL.js → Main-B9_TyRDo.js} +2009 -2005
  7. package/dist/Main-CdHW4UkN.js +90 -0
  8. package/dist/Main-DcvmP7s-.js +574 -0
  9. package/dist/PermissionSetList-VFVS0g0v.js +347 -0
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Dr3R9JjS.js +3444 -0
  11. package/dist/RoleList-BZ6RZvm2.js +556 -0
  12. package/dist/TeamMemberList-C-zhFauD.js +1115 -0
  13. package/dist/{TimesheetList-CdWXksIf.js → TimesheetList-CZex54an.js} +129 -115
  14. package/dist/{app-D6OxaCEx.js → app-CLL3p27X.js} +699 -653
  15. package/dist/app.js +1 -1
  16. package/dist/{dayjs.min-C0I-OiL6.js → dayjs.min-CDt1i9vl.js} +1 -1
  17. package/dist/employee-BpRvjWNh.js +200 -0
  18. package/dist/{iteration-CcZFMm5X.js → iteration-BVjUzYL5.js} +9314 -9272
  19. package/dist/{lodash-CW7MBjcM.js → lodash-CrwgACp2.js} +1 -1
  20. package/dist/{rule-6Lg9M_3I.js → rule-BlQ5YZ9Z.js} +274 -275
  21. package/dist/src/api/audit-log/index.d.ts +9 -0
  22. package/dist/src/api/index.d.ts +0 -1
  23. package/dist/src/api/restaurant/index.d.ts +5 -0
  24. package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
  25. package/dist/src/components/CollapsibleWrapper.vue.d.ts +2 -0
  26. package/dist/src/components/Skeleton.vue.d.ts +7 -0
  27. package/dist/src/composables/useBasePermission.d.ts +1 -0
  28. package/dist/src/composables/useRestaurantMap.d.ts +2 -329
  29. package/dist/src/stores/restaurant.d.ts +181 -0
  30. package/dist/src/stores/role.d.ts +7 -7
  31. package/dist/src/stores/team.d.ts +6 -6
  32. package/dist/src/types/restaurant.d.ts +11 -0
  33. package/dist/src/types/team.d.ts +2 -1
  34. package/dist/src/views/hr/locales/index.d.ts +16 -0
  35. package/dist/src/views/team/components/BasePermission.vue.d.ts +3 -7
  36. package/dist/src/views/team/components/PosRolePermission.vue.d.ts +2 -2
  37. package/dist/src/views/team/locales/index.d.ts +32 -0
  38. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +5 -3
  39. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +3 -3
  40. package/dist/style.css +1 -1
  41. package/dist/{timesheet-CaSIm-Rv.js → timesheet-jFs4GTAL.js} +2 -2
  42. package/dist/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/useAppStore-DMAL8VFY.js +169 -0
  44. package/dist/useDebounce-CWb5QR9G.js +28 -0
  45. package/dist/useDiscardConfirm-DPhEV6v0.js +157 -0
  46. package/dist/{useLoading-cnpr1-pP.js → useLoading-AFTjRLyO.js} +1 -1
  47. package/dist/{useReportPermissions-CNr0AdOf.js → useReportPermissions-hODG0Xx3.js} +3 -3
  48. package/package.json +1 -1
  49. package/dist/AuditLogList-Bw3sRBhW.js +0 -980
  50. package/dist/EmployeeList-C4tVWPJE.js +0 -736
  51. package/dist/FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js +0 -71
  52. package/dist/HorizontalSplitter-o860F4xM.js +0 -12
  53. package/dist/Main-BC20s7cs.js +0 -560
  54. package/dist/Main-eN8MDWpv.js +0 -85
  55. package/dist/PermissionSetList-CPSRrCsu.js +0 -341
  56. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CXt721Zo.js +0 -3480
  57. package/dist/RoleList-tRu19xyl.js +0 -530
  58. package/dist/TeamMemberList-CvitYIKw.js +0 -1114
  59. package/dist/TeamMemberList.vue_vue_type_style_index_0_scoped_473cbd86_lang-BDjrD45a.js +0 -34
  60. package/dist/employee-yT17VCCS.js +0 -204
  61. package/dist/src/api/account/index.d.ts +0 -4
  62. package/dist/src/composables/useSupportedCountries.d.ts +0 -5
  63. package/dist/useAppStore-CONZvtGc.js +0 -171
  64. package/dist/useDebounce-B8ZPVS5C.js +0 -15
  65. package/dist/useDiscardConfirm-BHni0LNu.js +0 -28
  66. package/dist/useSearch-B6WK1LBB.js +0 -15
@@ -1,9 +1,9 @@
1
- import { g as b, b as v, q as F, s as k, d as H, e as h } from "./iteration-CcZFMm5X.js";
2
- import { e as I, h as W, b as D, l as j, C as Y, d as J } from "./app-D6OxaCEx.js";
3
- import { s as Z } from "./utils-BZkjJbju.js";
4
- import { defineStore as V, storeToRefs as z } from "pinia";
1
+ import { g as b, b as v, q as L, u as H, s as x, d as Y, e as h } from "./iteration-BVjUzYL5.js";
2
+ import { e as R, h as k, b as F, l as j, C as Z, d as J } from "./app-CLL3p27X.js";
3
+ import { s as q } from "./utils-BZkjJbju.js";
4
+ import { defineStore as W, storeToRefs as V } from "pinia";
5
5
  import { ref as S, computed as T } from "vue";
6
- import { useCoreStore as M } from "@feedmepos/mf-common";
6
+ import { useCoreStore as z } from "@feedmepos/mf-common";
7
7
  const B = [
8
8
  {
9
9
  label: "",
@@ -351,83 +351,83 @@ const B = [
351
351
  async delete(e) {
352
352
  return b(await v().delete(`${A}/${e}`));
353
353
  }
354
- }, q = V("permissionSet", () => {
355
- const { currentBusiness: e } = M(), s = S([]), n = S(null);
354
+ }, ee = W("permissionSet", () => {
355
+ const { currentBusiness: e } = z(), s = S([]), t = S(null);
356
356
  async function o() {
357
357
  var l;
358
- const c = ((l = e.value) == null ? void 0 : l._id) ?? null;
359
- if (n.value === c) return;
358
+ const a = ((l = e.value) == null ? void 0 : l._id) ?? null;
359
+ if (t.value === a) return;
360
360
  const u = await O.read();
361
- s.value = r(u), n.value = c;
361
+ s.value = r(u), t.value = a;
362
362
  }
363
- async function i(c) {
364
- const u = await O.create(c);
363
+ async function i(a) {
364
+ const u = await O.create(a);
365
365
  s.value = r([...s.value, u]);
366
366
  }
367
- async function t(c, u) {
368
- const l = await O.update(c, u);
369
- s.value = r(s.value.map((d) => d.id === c ? l : d));
367
+ async function n(a, u) {
368
+ const l = await O.update(a, u);
369
+ s.value = r(s.value.map((d) => d.id === a ? l : d));
370
370
  }
371
- async function a(c) {
372
- await O.delete(c), s.value = r(s.value.filter((u) => u.id !== c));
371
+ async function c(a) {
372
+ await O.delete(a), s.value = r(s.value.filter((u) => u.id !== a));
373
373
  }
374
- function r(c) {
375
- return c.sort((u, l) => u.name.localeCompare(l.name));
374
+ function r(a) {
375
+ return a.sort((u, l) => u.name.localeCompare(l.name));
376
376
  }
377
377
  return {
378
378
  permissionSets: s,
379
379
  readPermissionSets: o,
380
380
  createPermissionSet: i,
381
- updatePermissionSet: t,
382
- deletePermissionSet: a
381
+ updatePermissionSet: n,
382
+ deletePermissionSet: c
383
383
  };
384
- }), ee = () => {
385
- const e = q();
384
+ }), se = () => {
385
+ const e = ee();
386
386
  return {
387
387
  ...e,
388
- ...z(e)
388
+ ...V(e)
389
389
  };
390
390
  };
391
391
  function K(e) {
392
- const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = (i, t, a) => {
393
- var r, c;
394
- const u = `${t.subject}::${JSON.stringify([...t.actions].sort())}`, l = i.get(u);
392
+ const s = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), o = (i, n, c) => {
393
+ var r, a;
394
+ const u = `${n.subject}::${JSON.stringify([...n.actions].sort())}`, l = i.get(u);
395
395
  if (!l) {
396
- i.set(u, { ...t, setNames: [a.name], setId: a._id });
396
+ i.set(u, { ...n, setNames: [c.name], setId: c._id });
397
397
  return;
398
398
  }
399
- if (l.setNames.push(a.name), l.conditions && t.conditions) {
400
- const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof t.conditions == "string" ? JSON.parse(t.conditions) : t.conditions;
399
+ if (l.setNames.push(c.name), l.conditions && n.conditions) {
400
+ const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
401
401
  for (const m in p)
402
- (r = d[m]) != null && r.$in && (c = p[m]) != null && c.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
402
+ (r = d[m]) != null && r.$in && (a = p[m]) != null && a.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
403
403
  l.conditions = JSON.stringify(d);
404
404
  }
405
405
  };
406
406
  for (const i of e)
407
- for (const t of i.permissions)
408
- o(t.inverted ? n : s, t, i);
409
- return [...Array.from(s.values()), ...Array.from(n.values())];
407
+ for (const n of i.permissions)
408
+ o(n.inverted ? t : s, n, i);
409
+ return [...Array.from(s.values()), ...Array.from(t.values())];
410
410
  }
411
411
  function U(e, s) {
412
412
  return `${e}::${[...s].sort().join(",")}`;
413
413
  }
414
414
  function X(e, s) {
415
- const n = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
415
+ const t = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
416
416
  for (const r of e) {
417
- const c = I(r.subject);
418
- o.add(U(c, r.actions)), r.inverted && r.actions.includes("manage") && i.add(`set_${c}`), !r.inverted && r.actions.includes("manage") && t.add(c);
417
+ const a = R(r.subject);
418
+ o.add(U(a, r.actions)), r.inverted && r.actions.includes("manage") && i.add(`set_${a}`), !r.inverted && r.actions.includes("manage") && n.add(a);
419
419
  }
420
- const a = [...e];
421
- for (; a.length > 0; ) {
422
- const r = a.shift(), c = `set_${I(r.subject)}`, u = s[c];
423
- if (!u || i.has(c) || !r.actions.includes("manage") || r.inverted) continue;
424
- i.add(c);
425
- const l = se(r);
420
+ const c = [...e];
421
+ for (; c.length > 0; ) {
422
+ const r = c.shift(), a = `set_${R(r.subject)}`, u = s[a];
423
+ if (!u || i.has(a) || !r.actions.includes("manage") || r.inverted) continue;
424
+ i.add(a);
425
+ const l = ne(r);
426
426
  r.source && !r.source.trace && (r.source = { ...r.source, trace: l });
427
427
  const d = [...l, `${u.name} (system)`];
428
428
  for (const p of u.permissions ?? []) {
429
- const m = I(p.subject), f = U(m, p.actions);
430
- o.has(f) || t.has(m) || (o.add(f), n.push({
429
+ const m = R(p.subject), f = U(m, p.actions);
430
+ o.has(f) || n.has(m) || (o.add(f), t.push({
431
431
  ...p,
432
432
  // FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
433
433
  fields: p.fields ?? void 0,
@@ -440,7 +440,7 @@ function X(e, s) {
440
440
  }));
441
441
  }
442
442
  for (const p of u.permissionSets ?? []) {
443
- const m = I(p), f = U(m, ["manage"]), g = {
443
+ const m = R(p), f = U(m, ["manage"]), g = {
444
444
  subject: m,
445
445
  actions: ["manage"],
446
446
  source: {
@@ -450,15 +450,15 @@ function X(e, s) {
450
450
  trace: d
451
451
  }
452
452
  };
453
- o.has(f) || (o.add(f), n.push(g)), a.push(g);
453
+ o.has(f) || (o.add(f), t.push(g)), c.push(g);
454
454
  }
455
455
  }
456
- return [...n.filter((r) => !r.inverted), ...n.filter((r) => r.inverted)];
456
+ return [...t.filter((r) => !r.inverted), ...t.filter((r) => r.inverted)];
457
457
  }
458
- function se(e) {
458
+ function ne(e) {
459
459
  if (!e.source) return [];
460
- const { type: s, trace: n, permissionSetName: o } = e.source;
461
- if (n && n.length > 0) return n;
460
+ const { type: s, trace: t, permissionSetName: o } = e.source;
461
+ if (t && t.length > 0) return t;
462
462
  switch (s) {
463
463
  case "permissionSet":
464
464
  return o ? [o] : [];
@@ -468,47 +468,47 @@ function se(e) {
468
468
  return [];
469
469
  }
470
470
  }
471
- function Q(e, s, n = /* @__PURE__ */ new Set()) {
471
+ function Q(e, s, t = /* @__PURE__ */ new Set()) {
472
472
  var i;
473
473
  const o = [];
474
- for (const t of e) {
475
- if (n.has(t)) continue;
476
- n.add(t);
477
- const a = s.find((r) => r.id === t);
478
- a && (o.push(a), (i = a.permissionSetIds) != null && i.length && o.push(...Q(a.permissionSetIds, s, n)));
474
+ for (const n of e) {
475
+ if (t.has(n)) continue;
476
+ t.add(n);
477
+ const c = s.find((r) => r.id === n);
478
+ c && (o.push(c), (i = c.permissionSetIds) != null && i.length && o.push(...Q(c.permissionSetIds, s, t)));
479
479
  }
480
480
  return o;
481
481
  }
482
- function ye(e) {
482
+ function Pe(e) {
483
483
  const s = K(e).map(
484
- ({ setNames: i, setId: t, ...a }) => a
485
- ), n = s.filter((i) => !i.inverted), o = s.filter((i) => i.inverted);
486
- return L(n, o);
484
+ ({ setNames: i, setId: n, ...c }) => c
485
+ ), t = s.filter((i) => !i.inverted), o = s.filter((i) => i.inverted);
486
+ return M(t, o);
487
487
  }
488
- function Pe(e, s, n) {
488
+ function we(e, s, t) {
489
489
  const o = /* @__PURE__ */ new Map();
490
490
  return e.forEach(
491
- ({ name: i, permissions: t }) => t.forEach(({ conditions: a, actions: r }) => {
491
+ ({ name: i, permissions: n }) => n.forEach(({ conditions: c, actions: r }) => {
492
492
  var u, l;
493
- const c = JSON.parse(a || "{}");
494
- (u = c[s]) != null && u.$in ? (l = c[s]) == null || l.$in.forEach(
493
+ const a = JSON.parse(c || "{}");
494
+ (u = a[s]) != null && u.$in ? (l = a[s]) == null || l.$in.forEach(
495
495
  (d) => (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i)
496
- ) : r[0] === "manage" && n.forEach((d) => {
496
+ ) : r[0] === "manage" && t.forEach((d) => {
497
497
  (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i);
498
498
  });
499
499
  })
500
- ), [...o].map(([i, t]) => ({
500
+ ), [...o].map(([i, n]) => ({
501
501
  id: i,
502
- setNames: [...t]
502
+ setNames: [...n]
503
503
  }));
504
504
  }
505
- function we(e, s) {
506
- const n = (r, c) => {
505
+ function $e(e, s) {
506
+ const t = (r, a) => {
507
507
  const u = { ...r }, l = JSON.parse(u.conditions || "{}");
508
- if (c)
509
- if (c.length > 0) {
508
+ if (a)
509
+ if (a.length > 0) {
510
510
  const d = Object.keys(l)[0];
511
- l[d].$in = c;
511
+ l[d].$in = a;
512
512
  } else
513
513
  delete u.conditions;
514
514
  return {
@@ -516,151 +516,151 @@ function we(e, s) {
516
516
  inverted: !0,
517
517
  ...u.conditions && { conditions: JSON.stringify(l) }
518
518
  };
519
- }, o = new Map(e.map((r) => [r.subject, r])), i = new Map(s.map((r) => [r.subject, r])), t = [], a = /* @__PURE__ */ new Set([...o.keys(), ...i.keys()]);
520
- for (const r of a) {
521
- const c = o.get(r), u = i.get(r);
522
- if (c && u) {
523
- if (c.conditions && u.conditions) {
524
- const l = JSON.parse(c.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
519
+ }, o = new Map(e.map((r) => [r.subject, r])), i = new Map(s.map((r) => [r.subject, r])), n = [], c = /* @__PURE__ */ new Set([...o.keys(), ...i.keys()]);
520
+ for (const r of c) {
521
+ const a = o.get(r), u = i.get(r);
522
+ if (a && u) {
523
+ if (a.conditions && u.conditions) {
524
+ const l = JSON.parse(a.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
525
525
  (g) => !d[p].$in.includes(g)
526
526
  );
527
- m.length > 0 && t.push(n(c, m)), d[p].$in.filter(
527
+ m.length > 0 && n.push(t(a, m)), d[p].$in.filter(
528
528
  (g) => !l[p].$in.includes(g)
529
- ).length > 0 && t.push(u);
530
- } else if (!c.conditions && u.conditions)
531
- t.push(u);
532
- else if (!c.conditions && !u.conditions) {
533
- const l = new Set(c.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = c.actions.filter((f) => !d.has(f));
529
+ ).length > 0 && n.push(u);
530
+ } else if (!a.conditions && u.conditions)
531
+ n.push(u);
532
+ else if (!a.conditions && !u.conditions) {
533
+ const l = new Set(a.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = a.actions.filter((f) => !d.has(f));
534
534
  if (p) {
535
535
  const f = u.actions.filter((g) => !l.has(g));
536
- t.push({
536
+ n.push({
537
537
  ...u,
538
538
  actions: f
539
539
  });
540
540
  }
541
- m.length > 0 && t.push({
542
- ...c,
541
+ m.length > 0 && n.push({
542
+ ...a,
543
543
  actions: m,
544
544
  inverted: !0
545
545
  });
546
546
  }
547
547
  continue;
548
548
  }
549
- if (c) {
550
- t.push(
551
- n(
552
- c,
549
+ if (a) {
550
+ n.push(
551
+ t(
552
+ a,
553
553
  // If base has conditions, set diffIds to empty array, disallow all access to collection
554
554
  // otherwise, invert directly
555
- c.conditions && []
555
+ a.conditions && []
556
556
  )
557
557
  );
558
558
  continue;
559
559
  }
560
- u && t.push(u);
560
+ u && n.push(u);
561
561
  }
562
- return t;
562
+ return n;
563
563
  }
564
- function $e(e) {
564
+ function Ie(e) {
565
565
  const s = X(
566
566
  e,
567
- W
568
- ), n = new Set(
567
+ k
568
+ ), t = new Set(
569
569
  s.filter((i) => {
570
- var t;
571
- return ((t = i.source) == null ? void 0 : t.type) === "systemPermissionSet" && !i.inverted;
570
+ var n;
571
+ return ((n = i.source) == null ? void 0 : n.type) === "systemPermissionSet" && !i.inverted;
572
572
  }).map((i) => i.subject)
573
573
  ), o = new Set(
574
574
  s.filter(
575
575
  (i) => {
576
- var t;
577
- return ((t = i.source) == null ? void 0 : t.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
576
+ var n;
577
+ return ((n = i.source) == null ? void 0 : n.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
578
578
  }
579
579
  ).map((i) => i.subject)
580
580
  );
581
- return e.filter((i) => i.inverted ? !(n.has(i.subject) && !o.has(i.subject)) : !n.has(i.subject));
581
+ return e.filter((i) => i.inverted ? !(t.has(i.subject) && !o.has(i.subject)) : !t.has(i.subject));
582
582
  }
583
- const ne = "business::report::";
583
+ const te = "business::report::";
584
584
  function Re(e, s) {
585
- const n = [], o = e.filter((i) => {
586
- const t = i.subject;
587
- return !t.startsWith(ne) || s.has(t) ? !0 : (n.push(t), !1);
585
+ const t = [], o = e.filter((i) => {
586
+ const n = i.subject;
587
+ return !n.startsWith(te) || s.has(n) ? !0 : (t.push(n), !1);
588
588
  });
589
- return n.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", n), o;
589
+ return t.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", t), o;
590
590
  }
591
- const te = "business::report::reports::", oe = "business::report::allDefaultReports", ie = "business::report::allCustomReports";
592
- function Ie(e, s) {
593
- const n = e.find(
594
- (a) => !a.inverted && a.subject === oe
591
+ const oe = "business::report::reports::", ie = "business::report::allDefaultReports", re = "business::report::allCustomReports";
592
+ function Ae(e, s) {
593
+ const t = e.find(
594
+ (c) => !c.inverted && c.subject === ie
595
595
  ), o = e.find(
596
- (a) => !a.inverted && a.subject === ie
596
+ (c) => !c.inverted && c.subject === re
597
597
  );
598
- if (!n && !o) return e;
599
- const i = n ? new Set(n.actions) : null, t = o ? new Set(o.actions) : null;
600
- return e.reduce((a, r) => {
598
+ if (!t && !o) return e;
599
+ const i = t ? new Set(t.actions) : null, n = o ? new Set(o.actions) : null;
600
+ return e.reduce((c, r) => {
601
601
  if (r.inverted)
602
- return a.push(r), a;
603
- const c = r.subject;
604
- if (!c.startsWith(te))
605
- return a.push(r), a;
606
- const l = s.has(c) ? i : t;
602
+ return c.push(r), c;
603
+ const a = r.subject;
604
+ if (!a.startsWith(oe))
605
+ return c.push(r), c;
606
+ const l = s.has(a) ? i : n;
607
607
  if (!l)
608
- return a.push(r), a;
609
- if (l.has("manage")) return a;
608
+ return c.push(r), c;
609
+ if (l.has("manage")) return c;
610
610
  const d = new Set(r.actions), p = d.has("manage");
611
611
  let m = !1;
612
612
  for (const f of l)
613
613
  f !== "manage" && d.delete(f) && (m = !0);
614
- return p && m && d.delete("manage"), d.size === 0 || a.push({ ...r, actions: Array.from(d) }), a;
614
+ return p && m && d.delete("manage"), d.size === 0 || c.push({ ...r, actions: Array.from(d) }), c;
615
615
  }, []);
616
616
  }
617
- function L(e, s) {
617
+ function M(e, s) {
618
618
  var o, i;
619
- const n = new Map(e.map((t) => [t.subject, t]));
620
- for (const t of s) {
621
- if (t.inverted) {
622
- const r = n.get(t.subject);
623
- if (t.conditions) {
619
+ const t = new Map(e.map((n) => [n.subject, n]));
620
+ for (const n of s) {
621
+ if (n.inverted) {
622
+ const r = t.get(n.subject);
623
+ if (n.conditions) {
624
624
  if (r != null && r.conditions) {
625
- const c = JSON.parse(r.conditions), u = JSON.parse(t.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((i = c[l]) == null ? void 0 : i.$in) ?? []).filter((f) => !d.includes(f));
626
- m.length > 0 ? n.set(t.subject, {
625
+ const a = JSON.parse(r.conditions), u = JSON.parse(n.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((i = a[l]) == null ? void 0 : i.$in) ?? []).filter((f) => !d.includes(f));
626
+ m.length > 0 ? t.set(n.subject, {
627
627
  ...r,
628
628
  conditions: JSON.stringify({ [l]: { $in: m } })
629
- }) : n.delete(t.subject);
629
+ }) : t.delete(n.subject);
630
630
  } else
631
- n.delete(t.subject);
631
+ t.delete(n.subject);
632
632
  continue;
633
633
  }
634
634
  if (r) {
635
- const c = new Set(t.actions), u = r.actions.filter((l) => !c.has(l));
636
- u.length > 0 ? n.set(t.subject, { ...r, actions: u }) : n.delete(t.subject);
635
+ const a = new Set(n.actions), u = r.actions.filter((l) => !a.has(l));
636
+ u.length > 0 ? t.set(n.subject, { ...r, actions: u }) : t.delete(n.subject);
637
637
  continue;
638
638
  }
639
639
  continue;
640
640
  }
641
- if (t.conditions) {
642
- n.set(t.subject, t);
641
+ if (n.conditions) {
642
+ t.set(n.subject, n);
643
643
  continue;
644
644
  }
645
- const a = n.get(t.subject);
646
- if (a) {
645
+ const c = t.get(n.subject);
646
+ if (c) {
647
647
  const r = [
648
648
  .../* @__PURE__ */ new Set([
649
- ...a.actions,
650
- ...t.actions
649
+ ...c.actions,
650
+ ...n.actions
651
651
  ])
652
652
  ];
653
- n.set(t.subject, { ...a, actions: r });
653
+ t.set(n.subject, { ...c, actions: r });
654
654
  } else
655
- n.set(t.subject, t);
655
+ t.set(n.subject, n);
656
656
  }
657
- return Array.from(n.values());
657
+ return Array.from(t.values());
658
658
  }
659
- function re(e, s) {
660
- const n = L(e, s), o = new Set(e.map((t) => t.subject)), i = s.filter(
661
- (t) => t.inverted && !o.has(t.subject)
659
+ function ae(e, s) {
660
+ const t = M(e, s), o = new Set(e.map((n) => n.subject)), i = s.filter(
661
+ (n) => n.inverted && !o.has(n.subject)
662
662
  );
663
- return [...n, ...i];
663
+ return [...t, ...i];
664
664
  }
665
665
  const y = "/permission-assignments", P = {
666
666
  async readAll() {
@@ -686,89 +686,89 @@ const y = "/permission-assignments", P = {
686
686
  await v().post("/my-permissions/report-manage", { permissionKey: e, label: s })
687
687
  );
688
688
  }
689
- }, ae = V("permissionAssignment", () => {
689
+ }, ce = W("permissionAssignment", () => {
690
690
  const e = S([]);
691
691
  async function s() {
692
692
  const r = await P.readAll();
693
693
  e.value = r;
694
694
  }
695
- async function n(r) {
695
+ async function t(r) {
696
696
  return await P.readByUserId(r);
697
697
  }
698
698
  async function o(r) {
699
- const c = await P.create(r);
700
- e.value = [...e.value, c];
699
+ const a = await P.create(r);
700
+ e.value = [...e.value, a];
701
701
  }
702
- async function i(r, c) {
703
- const u = await P.update(r, c);
702
+ async function i(r, a) {
703
+ const u = await P.update(r, a);
704
704
  e.value = e.value.map((l) => l.id === r ? u : l);
705
705
  }
706
- async function t(r) {
707
- await P.delete(r), e.value = e.value.filter((c) => c.id !== r);
706
+ async function n(r) {
707
+ await P.delete(r), e.value = e.value.filter((a) => a.id !== r);
708
708
  }
709
- function a(r) {
710
- return e.value.find((c) => c.userId === r);
709
+ function c(r) {
710
+ return e.value.find((a) => a.userId === r);
711
711
  }
712
712
  return {
713
713
  permissionAssignments: e,
714
714
  readPermissionAssignments: s,
715
- readPermissionAssignmentByUserId: n,
715
+ readPermissionAssignmentByUserId: t,
716
716
  createPermissionAssignment: o,
717
717
  updatePermissionAssignment: i,
718
- deletePermissionAssignment: t,
719
- getPermissionAssignmentByUserId: a
718
+ deletePermissionAssignment: n,
719
+ getPermissionAssignmentByUserId: c
720
720
  };
721
- }), ce = () => {
722
- const e = ae();
721
+ }), ue = () => {
722
+ const e = ce();
723
723
  return {
724
724
  ...e,
725
- ...z(e)
725
+ ...V(e)
726
726
  };
727
- }, ue = {
727
+ }, le = {
728
728
  async fetchReportPermissions(e, s) {
729
- const n = s ? { lang: s } : {};
729
+ const t = s ? { lang: s } : {};
730
730
  return b(
731
- await F().get(`/report-query/hrm/${e}/reports`, { params: n })
731
+ await L().get(`/report-query/hrm/${e}/reports`, { params: t })
732
732
  );
733
733
  },
734
734
  async fetchReportPermissionsForPortal(e, s) {
735
- const n = s ? { isSupportPos: !1, lang: s } : { isSupportPos: !1 };
735
+ const t = s ? { isSupportPos: !1, lang: s } : { isSupportPos: !1 };
736
736
  return b(
737
- await F().get(`/report-query/hrm/${e}/reports`, { params: n })
737
+ await L().get(`/report-query/hrm/${e}/reports`, { params: t })
738
738
  );
739
739
  }
740
- }, _ = S([]), E = S(!1), w = S(!1), $ = S(null), x = S(null), C = S(!1);
741
- function le() {
742
- const e = M();
740
+ }, _ = S([]), E = S(!1), w = S(!1), $ = S(null), D = S(null), C = S(!1);
741
+ function de() {
742
+ const e = z();
743
743
  async function s() {
744
- var t;
745
- const o = (t = e.currentBusiness.value) == null ? void 0 : t.id;
744
+ var n;
745
+ const o = (n = e.currentBusiness.value) == null ? void 0 : n.id;
746
746
  if (!o) return;
747
747
  const i = localStorage.getItem("locale");
748
- if ($.value !== o && (_.value = [], E.value = !1, w.value = !1, $.value = o, C.value = !1), !(E.value && x.value === i)) {
748
+ if ($.value !== o && (_.value = [], E.value = !1, w.value = !1, $.value = o, C.value = !1), !(E.value && D.value === i)) {
749
749
  if (w.value) {
750
750
  C.value = !0;
751
751
  return;
752
752
  }
753
753
  w.value = !0;
754
754
  try {
755
- const a = await ue.fetchReportPermissionsForPortal(o, i);
755
+ const c = await le.fetchReportPermissionsForPortal(o, i);
756
756
  if ($.value !== o) return;
757
- _.value = a, E.value = !0, x.value = i;
758
- } catch (a) {
757
+ _.value = c, E.value = !0, D.value = i;
758
+ } catch (c) {
759
759
  if ($.value !== o) return;
760
- console.warn("Failed to fetch custom report permissions:", a), _.value = [];
760
+ console.warn("Failed to fetch custom report permissions:", c), _.value = [];
761
761
  } finally {
762
762
  $.value === o && (w.value = !1, C.value && (C.value = !1, await s()));
763
763
  }
764
764
  }
765
765
  }
766
- const n = T(() => _.value.map(
766
+ const t = T(() => _.value.map(
767
767
  (o) => o.isDefault ? {
768
768
  label: o.name,
769
769
  subject: `business::report::reports::${o.permissionKey}`,
770
770
  actions: [j.manage, j.read, j.create],
771
- category: D.reports
771
+ category: F.reports
772
772
  } : {
773
773
  label: o.name,
774
774
  subject: `business::report::reports::${o.permissionKey}`,
@@ -779,86 +779,85 @@ function le() {
779
779
  j.update,
780
780
  j.delete
781
781
  ],
782
- category: D.customReports
782
+ category: F.customReports
783
783
  }
784
784
  ));
785
785
  return {
786
786
  fetchCustomReportPermissions: s,
787
- customReportPermissions: n,
787
+ customReportPermissions: t,
788
788
  isLoading: T(() => w.value),
789
789
  isLoaded: T(() => E.value)
790
790
  };
791
791
  }
792
- function R(e) {
793
- const s = M(), n = ee(), o = ce(), i = s.restaurants, { customReportPermissions: t } = le(), a = o.getPermissionAssignmentByUserId(e.id), r = Q(
794
- (a == null ? void 0 : a.permissionSetIds) ?? [],
795
- n.permissionSets.value
796
- ), c = K(r).map(
792
+ function I(e) {
793
+ const s = se(), t = ue(), o = H().restaurants, { customReportPermissions: i } = de(), n = t.getPermissionAssignmentByUserId(e.id), c = Q(
794
+ (n == null ? void 0 : n.permissionSetIds) ?? [],
795
+ s.permissionSets.value
796
+ ), r = K(c).map(
797
797
  ({ setNames: f, ...g }) => g
798
- ), u = a == null ? void 0 : a.customPermissions, l = u ?? e.permissions.map((f) => ({
798
+ ), a = n == null ? void 0 : n.customPermissions, u = a ?? e.permissions.map((f) => ({
799
799
  ...f,
800
- subject: I(f.subject)
801
- })), d = L(c, l), p = X(
802
- re(c, l),
803
- W
804
- ).filter((f) => !f.inverted), m = me(p) || i.value.map((f) => f._id);
800
+ subject: R(f.subject)
801
+ })), l = M(r, u), d = X(
802
+ ae(r, u),
803
+ k
804
+ ).filter((f) => !f.inverted), p = fe(d), m = p ?? o.value.map((f) => f._id);
805
805
  return {
806
806
  doc: e,
807
807
  id: e.id,
808
808
  name: e.name && e.name !== e.email && e.name !== e.phoneNumber ? e.name : "-",
809
809
  phoneNumber: e.phoneNumber,
810
810
  email: e.email,
811
- restaurants: k(
812
- m.map(
813
- (f) => {
814
- var g;
815
- return ((g = i.value.find((G) => G._id === f)) == null ? void 0 : g.profile.name) ?? "";
816
- }
817
- )
811
+ restaurants: x(
812
+ m.map((f) => {
813
+ var g;
814
+ return ((g = o.value.find((G) => G._id === f)) == null ? void 0 : g.profile.name) ?? "";
815
+ })
818
816
  ),
819
- managableRestaurantIds: m,
820
- permissionLabels: pe(p, t.value),
821
- permissions: d
817
+ managableRestaurantIds: p,
818
+ permissionLabels: be(d, i.value),
819
+ permissions: l
822
820
  };
823
821
  }
824
- const de = Object.freeze(
825
- Object.values(Y)
826
- ), Ae = {
822
+ const me = Object.freeze(
823
+ Object.values(Z)
824
+ ), Oe = {
827
825
  async readTeamMembers() {
828
826
  return b(
829
827
  await v().get("/portal-users")
830
- ).map(R);
828
+ ).map(I);
831
829
  },
832
830
  async readTeamMembersPage(e) {
833
- var n, o;
831
+ var t, o, i;
834
832
  const s = b(
835
833
  await v().get("/portal-users/paged", {
836
834
  params: {
837
835
  limit: e.limit,
838
836
  offset: e.offset,
839
837
  search: e.search,
840
- restaurantIds: (n = e.restaurantIds) != null && n.length ? e.restaurantIds : void 0,
841
- permissionSubjects: (o = e.permissionSubjects) != null && o.length ? e.permissionSubjects : void 0
838
+ restaurantIds: (t = e.restaurantIds) != null && t.length ? e.restaurantIds : void 0,
839
+ permissionSubjects: (o = e.permissionSubjects) != null && o.length ? e.permissionSubjects : void 0,
840
+ permissionSetIds: (i = e.permissionSetIds) != null && i.length ? e.permissionSetIds : void 0
842
841
  }
843
842
  })
844
843
  );
845
844
  return {
846
- items: s.items.map(R),
845
+ items: s.items.map(I),
847
846
  total: s.total
848
847
  };
849
848
  },
850
849
  async readTeamMember(e) {
851
- return R(
850
+ return I(
852
851
  b(await v().get(`/portal-users/${e}`))
853
852
  );
854
853
  },
855
854
  async createTeamMember(e) {
856
- return R(
855
+ return I(
857
856
  b(await v().post("/portal-users", e))
858
857
  );
859
858
  },
860
859
  async updateTeamMember(e, s) {
861
- return R(
860
+ return I(
862
861
  b(await v().put(`/portal-users/${e}`, s))
863
862
  );
864
863
  },
@@ -869,15 +868,15 @@ const de = Object.freeze(
869
868
  return b(await v().get("/portal-users")).map((s) => s.posUserId);
870
869
  }
871
870
  };
872
- function Oe(e, s, n) {
873
- if (e.some((a) => a.subject === "all")) return "All";
874
- const o = (n ?? B).filter(
875
- (a) => a.subject === s
876
- ), i = new Set(o.map((a) => N(a).value)), t = e.filter((a) => a.subject === s).filter((a) => i.has(N(a).value));
877
- return t.length === o.length ? "All" : t.length === 0 ? "-" : `${t.length} permission allow`;
871
+ function _e(e, s, t) {
872
+ if (e.some((c) => c.subject === "all")) return "All";
873
+ const o = (t ?? B).filter(
874
+ (c) => c.subject === s
875
+ ), i = new Set(o.map((c) => N(c).value)), n = e.filter((c) => c.subject === s).filter((c) => i.has(N(c).value));
876
+ return n.length === o.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
878
877
  }
879
878
  function N(e) {
880
- const s = H(e), n = s.subject;
879
+ const s = Y(e), t = s.subject;
881
880
  return {
882
881
  ...s,
883
882
  get conditions() {
@@ -885,46 +884,46 @@ function N(e) {
885
884
  },
886
885
  get isDiscountOperation() {
887
886
  var o;
888
- return n === h.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === h.F_RULE_ORDER_OPERATION.enum.discount;
887
+ return t === h.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === h.F_RULE_ORDER_OPERATION.enum.discount;
889
888
  },
890
889
  get isOrderOperation() {
891
- return n === h.F_RULE_SUBJECT.enum.order;
890
+ return t === h.F_RULE_SUBJECT.enum.order;
892
891
  },
893
892
  get isReportPermission() {
894
- return n === h.F_RULE_SUBJECT.enum.report;
893
+ return t === h.F_RULE_SUBJECT.enum.report;
895
894
  },
896
895
  get formatted() {
897
896
  const o = (i) => i.endsWith("_") ? i.slice(0, i.length - 1) : i;
898
- return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : n.toString();
897
+ return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : t.toString();
899
898
  },
900
899
  get label() {
901
- return s.label || Z(this.formatted);
900
+ return s.label || q(this.formatted);
902
901
  },
903
902
  get value() {
904
- return this.isOrderOperation ? `${n}:${this.conditions.operation}` : this.isReportPermission ? `${n}:${this.conditions.name}` : n.toString();
903
+ return this.isOrderOperation ? `${t}:${this.conditions.operation}` : this.isReportPermission ? `${t}:${this.conditions.name}` : t.toString();
905
904
  }
906
905
  };
907
906
  }
908
- function _e(e) {
909
- const s = e.map((n) => N(n)).find((n) => n.isDiscountOperation);
907
+ function Ee(e) {
908
+ const s = e.map((t) => N(t)).find((t) => t.isDiscountOperation);
910
909
  return s ? parseInt((s.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
911
910
  }
912
- function me(e) {
911
+ function fe(e) {
913
912
  const s = e.find(
914
- (n) => n.subject === J.Subject.Restaurant.restaurant
913
+ (t) => t.subject === J.Subject.Restaurant.restaurant
915
914
  );
916
915
  return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
917
916
  }
918
- function Ee(e) {
917
+ function Ce(e) {
919
918
  return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
920
919
  }
921
- function Ce(e) {
922
- const s = e.find((n) => n.subject === J.Subject.Business.role);
920
+ function Ne(e) {
921
+ const s = e.find((t) => t.subject === J.Subject.Business.role);
923
922
  return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
924
923
  }
925
- function Ne(e, s) {
926
- return e.map((n) => {
927
- const o = fe(n);
924
+ function Te(e, s) {
925
+ return e.map((t) => {
926
+ const o = pe(t);
928
927
  return {
929
928
  subject: o.subject,
930
929
  actions: o.actions,
@@ -935,62 +934,62 @@ function Ne(e, s) {
935
934
  };
936
935
  });
937
936
  }
938
- function fe(e) {
939
- const [s, n] = e.split(":");
937
+ function pe(e) {
938
+ const [s, t] = e.split(":");
940
939
  let o;
941
- return n ? (o = B.find(
940
+ return t ? (o = B.find(
942
941
  (i) => i.subject === s && [
943
942
  (typeof i.conditions == "object" ? i.conditions : JSON.parse(i.conditions)).operation,
944
943
  i.conditions.name
945
- ].includes(n)
944
+ ].includes(t)
946
945
  ), !o && s === h.F_RULE_SUBJECT.enum.report && (o = {
947
946
  label: "",
948
947
  subject: h.F_RULE_SUBJECT.enum.report,
949
948
  actions: ["read"],
950
- conditions: { name: n },
949
+ conditions: { name: t },
951
950
  inverted: !1,
952
951
  reason: ""
953
952
  })) : o = B.find((i) => i.subject === s), N(o || { subject: h.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
954
953
  }
955
- function pe(e, s = []) {
956
- return k(
957
- e.reduce((n, o) => {
958
- const i = de.find(
959
- (t) => t.subject === o.subject && o.actions.includes("manage")
960
- ) || s.find((t) => t.subject === o.subject);
954
+ function be(e, s = []) {
955
+ return x(
956
+ e.reduce((t, o) => {
957
+ const i = me.find(
958
+ (n) => n.subject === o.subject && o.actions.includes("manage")
959
+ ) || s.find((n) => n.subject === o.subject);
961
960
  if (i) {
962
- const t = i.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
963
- n.push(t);
961
+ const n = i.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
962
+ t.push(n);
964
963
  }
965
- return n;
964
+ return t;
966
965
  }, [])
967
966
  );
968
967
  }
969
968
  export {
970
969
  X as $,
971
- ue as R,
972
- Oe as a,
973
- re as b,
970
+ le as R,
971
+ _e as a,
972
+ ae as b,
974
973
  Q as c,
975
- le as d,
974
+ de as d,
976
975
  B as e,
977
- Ne as f,
978
- _e as g,
979
- Ee as h,
980
- ne as i,
981
- Ce as j,
982
- Re as k,
983
- Ie as l,
984
- ye as m,
985
- we as n,
986
- ce as o,
987
- de as p,
988
- pe as q,
976
+ Te as f,
977
+ Ee as g,
978
+ Ce as h,
979
+ te as i,
980
+ Ne as j,
981
+ fe as k,
982
+ Re as l,
983
+ Pe as m,
984
+ Ae as n,
985
+ $e as o,
986
+ me as p,
987
+ ue as q,
989
988
  N as r,
990
- $e as s,
991
- Ae as t,
992
- ee as u,
993
- K as v,
994
- Pe as w,
995
- me as x
989
+ Ie as s,
990
+ Oe as t,
991
+ se as u,
992
+ be as v,
993
+ K as w,
994
+ we as x
996
995
  };