@feedmepos/mf-hrm-portal 2.0.17-dev.5 → 2.0.18-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.
- package/dist/{AuditLogList-Dl3Nmf00.js → AuditLogList-CaoW9uYd.js} +5 -5
- package/dist/EmployeeList-DcMvF9U5.js +839 -0
- package/dist/Main-CleutFvF.js +567 -0
- package/dist/{Main-CQ3KwxDY.js → Main-CvW6Vu8N.js} +2055 -2055
- package/dist/{Main-w0XUUaBp.js → Main-D7k57uq5.js} +32 -32
- package/dist/{PermissionSetList-B8qNOWH6.js → PermissionSetList-CM7kbWkO.js} +6 -6
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C9VUjAu_.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Ces9YwYB.js} +525 -525
- package/dist/{RoleList-DMFJsUZv.js → RoleList-DR3eVJ9f.js} +102 -102
- package/dist/TeamMemberList-CZZv4Pu5.js +1038 -0
- package/dist/{TimesheetList-Bwp9_xHe.js → TimesheetList-WqqoKPbg.js} +132 -126
- package/dist/{app-COJbSNM4.js → app-R5EioPr4.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-CcBi6N-K.js → dayjs.min-CN15Ft3o.js} +1 -1
- package/dist/employee-DwQlWLkL.js +204 -0
- package/dist/{iteration-JOKbtlLf.js → iteration-UBGGRoxQ.js} +9258 -9213
- package/dist/{lodash-D5xlVzib.js → lodash-CC6qHVUo.js} +1 -1
- package/dist/{rule-3sXHiW0y.js → rule-B519XbW6.js} +273 -273
- package/dist/src/api/restaurant/index.d.ts +5 -0
- package/dist/src/composables/useRestaurantMap.d.ts +2 -329
- package/dist/src/stores/restaurant.d.ts +181 -0
- package/dist/src/stores/role.d.ts +7 -7
- package/dist/src/types/restaurant.d.ts +11 -0
- package/dist/style.css +1 -1
- package/dist/{team-CyNektSD.js → team-BGLhgx5P.js} +1 -1
- package/dist/{timesheet-DkD3AysG.js → timesheet-BylrXRfd.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/useAppStore-Akl8AoVN.js +171 -0
- package/dist/{useLoading-4TNmhm5N.js → useLoading-rbrVwWuj.js} +1 -1
- package/dist/{useReportPermissions-CWMFFb8E.js → useReportPermissions-BOEZU86S.js} +3 -3
- package/package.json +1 -1
- package/dist/EmployeeList-DBd_rVW2.js +0 -831
- package/dist/Main-pTgqNncY.js +0 -560
- package/dist/TeamMemberList-BLRTfKLz.js +0 -1031
- package/dist/employee-xiV0LfnL.js +0 -204
- package/dist/useAppStore-CvmsaYSG.js +0 -171
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
import { e as I, P as
|
|
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-UBGGRoxQ.js";
|
|
2
|
+
import { e as I, P as k, d as F, y as j, C as Z, i as J } from "./app-R5EioPr4.js";
|
|
3
3
|
import { s as q } from "./utils-BZkjJbju.js";
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { ref as S, computed as
|
|
6
|
-
import { useCoreStore as
|
|
7
|
-
const
|
|
4
|
+
import { defineStore as W, storeToRefs as V } from "pinia";
|
|
5
|
+
import { ref as S, computed as T } from "vue";
|
|
6
|
+
import { useCoreStore as z } from "@feedmepos/mf-common";
|
|
7
|
+
const B = [
|
|
8
8
|
{
|
|
9
9
|
label: "",
|
|
10
10
|
subject: "order",
|
|
@@ -338,99 +338,99 @@ const J = [
|
|
|
338
338
|
inverted: !1,
|
|
339
339
|
reason: ""
|
|
340
340
|
}
|
|
341
|
-
],
|
|
341
|
+
], A = "/permission-sets", O = {
|
|
342
342
|
async read() {
|
|
343
|
-
return
|
|
343
|
+
return b(await v().get(A));
|
|
344
344
|
},
|
|
345
345
|
async create(e) {
|
|
346
|
-
return
|
|
346
|
+
return b(await v().post(A, e));
|
|
347
347
|
},
|
|
348
348
|
async update(e, s) {
|
|
349
|
-
return
|
|
349
|
+
return b(await v().put(`${A}/${e}`, s));
|
|
350
350
|
},
|
|
351
351
|
async delete(e) {
|
|
352
|
-
return
|
|
352
|
+
return b(await v().delete(`${A}/${e}`));
|
|
353
353
|
}
|
|
354
|
-
}, ee =
|
|
355
|
-
const { currentBusiness: e } =
|
|
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
|
|
359
|
-
if (
|
|
360
|
-
const u = await
|
|
361
|
-
s.value = r(u),
|
|
358
|
+
const a = ((l = e.value) == null ? void 0 : l._id) ?? null;
|
|
359
|
+
if (t.value === a) return;
|
|
360
|
+
const u = await O.read();
|
|
361
|
+
s.value = r(u), t.value = a;
|
|
362
362
|
}
|
|
363
|
-
async function i(
|
|
364
|
-
const u = await
|
|
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
|
|
368
|
-
const l = await
|
|
369
|
-
s.value = r(s.value.map((d) => d.id ===
|
|
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
|
|
372
|
-
await
|
|
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(
|
|
375
|
-
return
|
|
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:
|
|
382
|
-
deletePermissionSet:
|
|
381
|
+
updatePermissionSet: n,
|
|
382
|
+
deletePermissionSet: c
|
|
383
383
|
};
|
|
384
384
|
}), se = () => {
|
|
385
385
|
const e = ee();
|
|
386
386
|
return {
|
|
387
387
|
...e,
|
|
388
|
-
...
|
|
388
|
+
...V(e)
|
|
389
389
|
};
|
|
390
390
|
};
|
|
391
|
-
function
|
|
392
|
-
const s = /* @__PURE__ */ new Map(),
|
|
393
|
-
var r,
|
|
394
|
-
const u = `${
|
|
391
|
+
function K(e) {
|
|
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, { ...
|
|
396
|
+
i.set(u, { ...n, setNames: [c.name], setId: c._id });
|
|
397
397
|
return;
|
|
398
398
|
}
|
|
399
|
-
if (l.setNames.push(
|
|
400
|
-
const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions,
|
|
401
|
-
for (const m in
|
|
402
|
-
(r = d[m]) != null && r.$in && (
|
|
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
|
+
for (const m in p)
|
|
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
|
|
408
|
-
o(
|
|
409
|
-
return [...Array.from(s.values()), ...Array.from(
|
|
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
|
-
function
|
|
411
|
+
function U(e, s) {
|
|
412
412
|
return `${e}::${[...s].sort().join(",")}`;
|
|
413
413
|
}
|
|
414
|
-
function
|
|
415
|
-
const
|
|
414
|
+
function X(e, s) {
|
|
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
|
|
418
|
-
o.add(
|
|
417
|
+
const a = I(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
|
|
421
|
-
for (;
|
|
422
|
-
const r =
|
|
423
|
-
if (!u || i.has(
|
|
424
|
-
i.add(
|
|
420
|
+
const c = [...e];
|
|
421
|
+
for (; c.length > 0; ) {
|
|
422
|
+
const r = c.shift(), a = `set_${I(r.subject)}`, u = s[a];
|
|
423
|
+
if (!u || i.has(a) || !r.actions.includes("manage") || r.inverted) continue;
|
|
424
|
+
i.add(a);
|
|
425
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
|
-
for (const
|
|
429
|
-
const m = I(
|
|
430
|
-
o.has(
|
|
431
|
-
...
|
|
428
|
+
for (const p of u.permissions ?? []) {
|
|
429
|
+
const m = I(p.subject), f = U(m, p.actions);
|
|
430
|
+
o.has(f) || n.has(m) || (o.add(f), t.push({
|
|
431
|
+
...p,
|
|
432
432
|
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
433
|
-
fields:
|
|
433
|
+
fields: p.fields ?? void 0,
|
|
434
434
|
source: {
|
|
435
435
|
type: "systemPermissionSet",
|
|
436
436
|
permissionSetId: u.key,
|
|
@@ -439,8 +439,8 @@ function Q(e, s) {
|
|
|
439
439
|
}
|
|
440
440
|
}));
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
const m = I(
|
|
442
|
+
for (const p of u.permissionSets ?? []) {
|
|
443
|
+
const m = I(p), f = U(m, ["manage"]), g = {
|
|
444
444
|
subject: m,
|
|
445
445
|
actions: ["manage"],
|
|
446
446
|
source: {
|
|
@@ -450,15 +450,15 @@ function Q(e, s) {
|
|
|
450
450
|
trace: d
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
|
-
o.has(
|
|
453
|
+
o.has(f) || (o.add(f), t.push(g)), c.push(g);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
return [...
|
|
456
|
+
return [...t.filter((r) => !r.inverted), ...t.filter((r) => r.inverted)];
|
|
457
457
|
}
|
|
458
458
|
function ne(e) {
|
|
459
459
|
if (!e.source) return [];
|
|
460
|
-
const { type: s, trace:
|
|
461
|
-
if (
|
|
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 ne(e) {
|
|
|
468
468
|
return [];
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function Q(e, s, t = /* @__PURE__ */ new Set()) {
|
|
472
472
|
var i;
|
|
473
473
|
const o = [];
|
|
474
|
-
for (const
|
|
475
|
-
if (
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
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
482
|
function Pe(e) {
|
|
483
|
-
const s =
|
|
484
|
-
({ setNames: i, setId:
|
|
485
|
-
),
|
|
486
|
-
return
|
|
483
|
+
const s = K(e).map(
|
|
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 we(e, s,
|
|
488
|
+
function we(e, s, t) {
|
|
489
489
|
const o = /* @__PURE__ */ new Map();
|
|
490
490
|
return e.forEach(
|
|
491
|
-
({ name: i, permissions:
|
|
491
|
+
({ name: i, permissions: n }) => n.forEach(({ conditions: c, actions: r }) => {
|
|
492
492
|
var u, l;
|
|
493
|
-
const
|
|
494
|
-
(u =
|
|
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" &&
|
|
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,
|
|
500
|
+
), [...o].map(([i, n]) => ({
|
|
501
501
|
id: i,
|
|
502
|
-
setNames: [...
|
|
502
|
+
setNames: [...n]
|
|
503
503
|
}));
|
|
504
504
|
}
|
|
505
505
|
function $e(e, s) {
|
|
506
|
-
const
|
|
506
|
+
const t = (r, a) => {
|
|
507
507
|
const u = { ...r }, l = JSON.parse(u.conditions || "{}");
|
|
508
|
-
if (
|
|
509
|
-
if (
|
|
508
|
+
if (a)
|
|
509
|
+
if (a.length > 0) {
|
|
510
510
|
const d = Object.keys(l)[0];
|
|
511
|
-
l[d].$in =
|
|
511
|
+
l[d].$in = a;
|
|
512
512
|
} else
|
|
513
513
|
delete u.conditions;
|
|
514
514
|
return {
|
|
@@ -516,259 +516,259 @@ function $e(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])),
|
|
520
|
-
for (const r of
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
if (
|
|
524
|
-
const l = JSON.parse(
|
|
525
|
-
(
|
|
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
|
+
(g) => !d[p].$in.includes(g)
|
|
526
526
|
);
|
|
527
|
-
m.length > 0 &&
|
|
528
|
-
(
|
|
529
|
-
).length > 0 &&
|
|
530
|
-
} else if (!
|
|
531
|
-
|
|
532
|
-
else if (!
|
|
533
|
-
const l = new Set(
|
|
534
|
-
if (
|
|
535
|
-
const
|
|
536
|
-
|
|
527
|
+
m.length > 0 && n.push(t(a, m)), d[p].$in.filter(
|
|
528
|
+
(g) => !l[p].$in.includes(g)
|
|
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
|
+
if (p) {
|
|
535
|
+
const f = u.actions.filter((g) => !l.has(g));
|
|
536
|
+
n.push({
|
|
537
537
|
...u,
|
|
538
|
-
actions:
|
|
538
|
+
actions: f
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
|
-
m.length > 0 &&
|
|
542
|
-
...
|
|
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 (
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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
|
-
|
|
555
|
+
a.conditions && []
|
|
556
556
|
)
|
|
557
557
|
);
|
|
558
558
|
continue;
|
|
559
559
|
}
|
|
560
|
-
u &&
|
|
560
|
+
u && n.push(u);
|
|
561
561
|
}
|
|
562
|
-
return
|
|
562
|
+
return n;
|
|
563
563
|
}
|
|
564
564
|
function Re(e) {
|
|
565
|
-
const s =
|
|
565
|
+
const s = X(
|
|
566
566
|
e,
|
|
567
|
-
|
|
568
|
-
),
|
|
567
|
+
k
|
|
568
|
+
), t = new Set(
|
|
569
569
|
s.filter((i) => {
|
|
570
|
-
var
|
|
571
|
-
return ((
|
|
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
|
|
577
|
-
return ((
|
|
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 ? !(
|
|
581
|
+
return e.filter((i) => i.inverted ? !(t.has(i.subject) && !o.has(i.subject)) : !t.has(i.subject));
|
|
582
582
|
}
|
|
583
583
|
const te = "business::report::";
|
|
584
584
|
function Ie(e, s) {
|
|
585
|
-
const
|
|
586
|
-
const
|
|
587
|
-
return !
|
|
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
|
|
589
|
+
return t.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", t), o;
|
|
590
590
|
}
|
|
591
591
|
const oe = "business::report::reports::", ie = "business::report::allDefaultReports", re = "business::report::allCustomReports";
|
|
592
592
|
function Ae(e, s) {
|
|
593
|
-
const
|
|
594
|
-
(
|
|
593
|
+
const t = e.find(
|
|
594
|
+
(c) => !c.inverted && c.subject === ie
|
|
595
595
|
), o = e.find(
|
|
596
|
-
(
|
|
596
|
+
(c) => !c.inverted && c.subject === re
|
|
597
597
|
);
|
|
598
|
-
if (!
|
|
599
|
-
const i =
|
|
600
|
-
return e.reduce((
|
|
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
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
605
|
-
return
|
|
606
|
-
const l = s.has(
|
|
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
|
|
609
|
-
if (l.has("manage")) return
|
|
610
|
-
const d = new Set(r.actions),
|
|
608
|
+
return c.push(r), c;
|
|
609
|
+
if (l.has("manage")) return c;
|
|
610
|
+
const d = new Set(r.actions), p = d.has("manage");
|
|
611
611
|
let m = !1;
|
|
612
|
-
for (const
|
|
613
|
-
|
|
614
|
-
return
|
|
612
|
+
for (const f of l)
|
|
613
|
+
f !== "manage" && d.delete(f) && (m = !0);
|
|
614
|
+
return p && m && d.delete("manage"), d.size === 0 || c.push({ ...r, actions: Array.from(d) }), c;
|
|
615
615
|
}, []);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function M(e, s) {
|
|
618
618
|
var o, i;
|
|
619
|
-
const
|
|
620
|
-
for (const
|
|
621
|
-
if (
|
|
622
|
-
const r =
|
|
623
|
-
if (
|
|
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
|
|
626
|
-
m.length > 0 ?
|
|
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
|
-
}) :
|
|
629
|
+
}) : t.delete(n.subject);
|
|
630
630
|
} else
|
|
631
|
-
|
|
631
|
+
t.delete(n.subject);
|
|
632
632
|
continue;
|
|
633
633
|
}
|
|
634
634
|
if (r) {
|
|
635
|
-
const
|
|
636
|
-
u.length > 0 ?
|
|
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 (
|
|
642
|
-
|
|
641
|
+
if (n.conditions) {
|
|
642
|
+
t.set(n.subject, n);
|
|
643
643
|
continue;
|
|
644
644
|
}
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
645
|
+
const c = t.get(n.subject);
|
|
646
|
+
if (c) {
|
|
647
647
|
const r = [
|
|
648
648
|
.../* @__PURE__ */ new Set([
|
|
649
|
-
...
|
|
650
|
-
...
|
|
649
|
+
...c.actions,
|
|
650
|
+
...n.actions
|
|
651
651
|
])
|
|
652
652
|
];
|
|
653
|
-
|
|
653
|
+
t.set(n.subject, { ...c, actions: r });
|
|
654
654
|
} else
|
|
655
|
-
|
|
655
|
+
t.set(n.subject, n);
|
|
656
656
|
}
|
|
657
|
-
return Array.from(
|
|
657
|
+
return Array.from(t.values());
|
|
658
658
|
}
|
|
659
659
|
function ae(e, s) {
|
|
660
|
-
const
|
|
661
|
-
(
|
|
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 [...
|
|
663
|
+
return [...t, ...i];
|
|
664
664
|
}
|
|
665
665
|
const y = "/permission-assignments", P = {
|
|
666
666
|
async readAll() {
|
|
667
|
-
return
|
|
667
|
+
return b(await v().get(y));
|
|
668
668
|
},
|
|
669
669
|
async readByUserId(e) {
|
|
670
|
-
return
|
|
670
|
+
return b(await v().get(`${y}/user/${e}`));
|
|
671
671
|
},
|
|
672
672
|
async readById(e) {
|
|
673
|
-
return
|
|
673
|
+
return b(await v().get(`${y}/${e}`));
|
|
674
674
|
},
|
|
675
675
|
async create(e) {
|
|
676
|
-
return
|
|
676
|
+
return b(await v().post(y, e));
|
|
677
677
|
},
|
|
678
678
|
async update(e, s) {
|
|
679
|
-
return
|
|
679
|
+
return b(await v().put(`${y}/${e}`, s));
|
|
680
680
|
},
|
|
681
681
|
async delete(e) {
|
|
682
|
-
return
|
|
682
|
+
return b(await v().delete(`${y}/${e}`));
|
|
683
683
|
},
|
|
684
684
|
async addReportManagePermission(e, s) {
|
|
685
|
-
return
|
|
686
|
-
await
|
|
685
|
+
return b(
|
|
686
|
+
await v().post("/my-permissions/report-manage", { permissionKey: e, label: s })
|
|
687
687
|
);
|
|
688
688
|
}
|
|
689
|
-
}, ce =
|
|
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
|
|
695
|
+
async function t(r) {
|
|
696
696
|
return await P.readByUserId(r);
|
|
697
697
|
}
|
|
698
698
|
async function o(r) {
|
|
699
|
-
const
|
|
700
|
-
e.value = [...e.value,
|
|
699
|
+
const a = await P.create(r);
|
|
700
|
+
e.value = [...e.value, a];
|
|
701
701
|
}
|
|
702
|
-
async function i(r,
|
|
703
|
-
const u = await P.update(r,
|
|
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
|
|
707
|
-
await P.delete(r), e.value = e.value.filter((
|
|
706
|
+
async function n(r) {
|
|
707
|
+
await P.delete(r), e.value = e.value.filter((a) => a.id !== r);
|
|
708
708
|
}
|
|
709
|
-
function
|
|
710
|
-
return e.value.find((
|
|
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:
|
|
715
|
+
readPermissionAssignmentByUserId: t,
|
|
716
716
|
createPermissionAssignment: o,
|
|
717
717
|
updatePermissionAssignment: i,
|
|
718
|
-
deletePermissionAssignment:
|
|
719
|
-
getPermissionAssignmentByUserId:
|
|
718
|
+
deletePermissionAssignment: n,
|
|
719
|
+
getPermissionAssignmentByUserId: c
|
|
720
720
|
};
|
|
721
721
|
}), ue = () => {
|
|
722
722
|
const e = ce();
|
|
723
723
|
return {
|
|
724
724
|
...e,
|
|
725
|
-
...
|
|
725
|
+
...V(e)
|
|
726
726
|
};
|
|
727
727
|
}, le = {
|
|
728
728
|
async fetchReportPermissions(e, s) {
|
|
729
|
-
const
|
|
730
|
-
return
|
|
731
|
-
await
|
|
729
|
+
const t = s ? { lang: s } : {};
|
|
730
|
+
return b(
|
|
731
|
+
await L().get(`/report-query/hrm/${e}/reports`, { params: t })
|
|
732
732
|
);
|
|
733
733
|
},
|
|
734
734
|
async fetchReportPermissionsForPortal(e, s) {
|
|
735
|
-
const
|
|
736
|
-
return
|
|
737
|
-
await
|
|
735
|
+
const t = s ? { isSupportPos: !1, lang: s } : { isSupportPos: !1 };
|
|
736
|
+
return b(
|
|
737
|
+
await L().get(`/report-query/hrm/${e}/reports`, { params: t })
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
|
-
},
|
|
740
|
+
}, _ = S([]), E = S(!1), w = S(!1), $ = S(null), D = S(null), C = S(!1);
|
|
741
741
|
function de() {
|
|
742
|
-
const e =
|
|
742
|
+
const e = z();
|
|
743
743
|
async function s() {
|
|
744
|
-
var
|
|
745
|
-
const o = (
|
|
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 && (
|
|
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
|
|
755
|
+
const c = await le.fetchReportPermissionsForPortal(o, i);
|
|
756
756
|
if ($.value !== o) return;
|
|
757
|
-
|
|
758
|
-
} catch (
|
|
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:",
|
|
760
|
+
console.warn("Failed to fetch custom report permissions:", c), _.value = [];
|
|
761
761
|
} finally {
|
|
762
|
-
$.value === o && (w.value = !1,
|
|
762
|
+
$.value === o && (w.value = !1, C.value && (C.value = !1, await s()));
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
const
|
|
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:
|
|
771
|
+
category: F.reports
|
|
772
772
|
} : {
|
|
773
773
|
label: o.name,
|
|
774
774
|
subject: `business::report::reports::${o.permissionKey}`,
|
|
@@ -779,63 +779,63 @@ function de() {
|
|
|
779
779
|
j.update,
|
|
780
780
|
j.delete
|
|
781
781
|
],
|
|
782
|
-
category:
|
|
782
|
+
category: F.customReports
|
|
783
783
|
}
|
|
784
784
|
));
|
|
785
785
|
return {
|
|
786
786
|
fetchCustomReportPermissions: s,
|
|
787
|
-
customReportPermissions:
|
|
788
|
-
isLoading:
|
|
789
|
-
isLoaded:
|
|
787
|
+
customReportPermissions: t,
|
|
788
|
+
isLoading: T(() => w.value),
|
|
789
|
+
isLoaded: T(() => E.value)
|
|
790
790
|
};
|
|
791
791
|
}
|
|
792
792
|
function R(e) {
|
|
793
|
-
const s =
|
|
794
|
-
(
|
|
795
|
-
|
|
796
|
-
),
|
|
797
|
-
({ setNames:
|
|
798
|
-
),
|
|
799
|
-
...
|
|
800
|
-
subject: I(
|
|
801
|
-
})),
|
|
802
|
-
ae(
|
|
803
|
-
|
|
804
|
-
).filter((
|
|
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
|
+
({ setNames: f, ...g }) => g
|
|
798
|
+
), a = n == null ? void 0 : n.customPermissions, u = a ?? e.permissions.map((f) => ({
|
|
799
|
+
...f,
|
|
800
|
+
subject: I(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:
|
|
812
|
-
|
|
813
|
-
var
|
|
814
|
-
return ((
|
|
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
815
|
})
|
|
816
816
|
),
|
|
817
|
-
managableRestaurantIds:
|
|
818
|
-
permissionLabels: be(
|
|
819
|
-
permissions:
|
|
817
|
+
managableRestaurantIds: p,
|
|
818
|
+
permissionLabels: be(d, i.value),
|
|
819
|
+
permissions: l
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
const me = Object.freeze(
|
|
823
823
|
Object.values(Z)
|
|
824
824
|
), Oe = {
|
|
825
825
|
async readTeamMembers() {
|
|
826
|
-
return
|
|
827
|
-
await
|
|
826
|
+
return b(
|
|
827
|
+
await v().get("/portal-users")
|
|
828
828
|
).map(R);
|
|
829
829
|
},
|
|
830
830
|
async readTeamMembersPage(e) {
|
|
831
|
-
var
|
|
832
|
-
const s =
|
|
833
|
-
await
|
|
831
|
+
var t, o;
|
|
832
|
+
const s = b(
|
|
833
|
+
await v().get("/portal-users/paged", {
|
|
834
834
|
params: {
|
|
835
835
|
limit: e.limit,
|
|
836
836
|
offset: e.offset,
|
|
837
837
|
search: e.search,
|
|
838
|
-
restaurantIds: (
|
|
838
|
+
restaurantIds: (t = e.restaurantIds) != null && t.length ? e.restaurantIds : void 0,
|
|
839
839
|
permissionSubjects: (o = e.permissionSubjects) != null && o.length ? e.permissionSubjects : void 0
|
|
840
840
|
}
|
|
841
841
|
})
|
|
@@ -847,35 +847,35 @@ const me = Object.freeze(
|
|
|
847
847
|
},
|
|
848
848
|
async readTeamMember(e) {
|
|
849
849
|
return R(
|
|
850
|
-
|
|
850
|
+
b(await v().get(`/portal-users/${e}`))
|
|
851
851
|
);
|
|
852
852
|
},
|
|
853
853
|
async createTeamMember(e) {
|
|
854
854
|
return R(
|
|
855
|
-
|
|
855
|
+
b(await v().post("/portal-users", e))
|
|
856
856
|
);
|
|
857
857
|
},
|
|
858
858
|
async updateTeamMember(e, s) {
|
|
859
859
|
return R(
|
|
860
|
-
|
|
860
|
+
b(await v().put(`/portal-users/${e}`, s))
|
|
861
861
|
);
|
|
862
862
|
},
|
|
863
863
|
async deleteTeamMember(e) {
|
|
864
|
-
return
|
|
864
|
+
return b(await v().delete(`/portal-users/${e}`));
|
|
865
865
|
},
|
|
866
866
|
async readTeamMemberPosUserIds() {
|
|
867
|
-
return
|
|
867
|
+
return b(await v().get("/portal-users")).map((s) => s.posUserId);
|
|
868
868
|
}
|
|
869
869
|
};
|
|
870
|
-
function _e(e, s,
|
|
871
|
-
if (e.some((
|
|
872
|
-
const o = (
|
|
873
|
-
(
|
|
874
|
-
), i = new Set(o.map((
|
|
875
|
-
return
|
|
870
|
+
function _e(e, s, t) {
|
|
871
|
+
if (e.some((c) => c.subject === "all")) return "All";
|
|
872
|
+
const o = (t ?? B).filter(
|
|
873
|
+
(c) => c.subject === s
|
|
874
|
+
), i = new Set(o.map((c) => N(c).value)), n = e.filter((c) => c.subject === s).filter((c) => i.has(N(c).value));
|
|
875
|
+
return n.length === o.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
|
|
876
876
|
}
|
|
877
|
-
function
|
|
878
|
-
const s = Y(e),
|
|
877
|
+
function N(e) {
|
|
878
|
+
const s = Y(e), t = s.subject;
|
|
879
879
|
return {
|
|
880
880
|
...s,
|
|
881
881
|
get conditions() {
|
|
@@ -883,33 +883,33 @@ function T(e) {
|
|
|
883
883
|
},
|
|
884
884
|
get isDiscountOperation() {
|
|
885
885
|
var o;
|
|
886
|
-
return
|
|
886
|
+
return t === h.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === h.F_RULE_ORDER_OPERATION.enum.discount;
|
|
887
887
|
},
|
|
888
888
|
get isOrderOperation() {
|
|
889
|
-
return
|
|
889
|
+
return t === h.F_RULE_SUBJECT.enum.order;
|
|
890
890
|
},
|
|
891
891
|
get isReportPermission() {
|
|
892
|
-
return
|
|
892
|
+
return t === h.F_RULE_SUBJECT.enum.report;
|
|
893
893
|
},
|
|
894
894
|
get formatted() {
|
|
895
895
|
const o = (i) => i.endsWith("_") ? i.slice(0, i.length - 1) : i;
|
|
896
|
-
return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) :
|
|
896
|
+
return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : t.toString();
|
|
897
897
|
},
|
|
898
898
|
get label() {
|
|
899
899
|
return s.label || q(this.formatted);
|
|
900
900
|
},
|
|
901
901
|
get value() {
|
|
902
|
-
return this.isOrderOperation ? `${
|
|
902
|
+
return this.isOrderOperation ? `${t}:${this.conditions.operation}` : this.isReportPermission ? `${t}:${this.conditions.name}` : t.toString();
|
|
903
903
|
}
|
|
904
904
|
};
|
|
905
905
|
}
|
|
906
906
|
function Ee(e) {
|
|
907
|
-
const s = e.map((
|
|
907
|
+
const s = e.map((t) => N(t)).find((t) => t.isDiscountOperation);
|
|
908
908
|
return s ? parseInt((s.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
|
|
909
909
|
}
|
|
910
910
|
function fe(e) {
|
|
911
911
|
const s = e.find(
|
|
912
|
-
(
|
|
912
|
+
(t) => t.subject === J.Subject.Restaurant.restaurant
|
|
913
913
|
);
|
|
914
914
|
return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
|
|
915
915
|
}
|
|
@@ -917,12 +917,12 @@ function Ce(e) {
|
|
|
917
917
|
return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
|
|
918
918
|
}
|
|
919
919
|
function Ne(e) {
|
|
920
|
-
const s = e.find((
|
|
920
|
+
const s = e.find((t) => t.subject === J.Subject.Business.role);
|
|
921
921
|
return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
|
|
922
922
|
}
|
|
923
923
|
function Te(e, s) {
|
|
924
|
-
return e.map((
|
|
925
|
-
const o = pe(
|
|
924
|
+
return e.map((t) => {
|
|
925
|
+
const o = pe(t);
|
|
926
926
|
return {
|
|
927
927
|
subject: o.subject,
|
|
928
928
|
actions: o.actions,
|
|
@@ -934,44 +934,44 @@ function Te(e, s) {
|
|
|
934
934
|
});
|
|
935
935
|
}
|
|
936
936
|
function pe(e) {
|
|
937
|
-
const [s,
|
|
937
|
+
const [s, t] = e.split(":");
|
|
938
938
|
let o;
|
|
939
|
-
return
|
|
939
|
+
return t ? (o = B.find(
|
|
940
940
|
(i) => i.subject === s && [
|
|
941
941
|
(typeof i.conditions == "object" ? i.conditions : JSON.parse(i.conditions)).operation,
|
|
942
942
|
i.conditions.name
|
|
943
|
-
].includes(
|
|
943
|
+
].includes(t)
|
|
944
944
|
), !o && s === h.F_RULE_SUBJECT.enum.report && (o = {
|
|
945
945
|
label: "",
|
|
946
946
|
subject: h.F_RULE_SUBJECT.enum.report,
|
|
947
947
|
actions: ["read"],
|
|
948
|
-
conditions: { name:
|
|
948
|
+
conditions: { name: t },
|
|
949
949
|
inverted: !1,
|
|
950
950
|
reason: ""
|
|
951
|
-
})) : o =
|
|
951
|
+
})) : o = B.find((i) => i.subject === s), N(o || { subject: h.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
|
|
952
952
|
}
|
|
953
953
|
function be(e, s = []) {
|
|
954
|
-
return
|
|
955
|
-
e.reduce((
|
|
954
|
+
return x(
|
|
955
|
+
e.reduce((t, o) => {
|
|
956
956
|
const i = me.find(
|
|
957
|
-
(
|
|
958
|
-
) || s.find((
|
|
957
|
+
(n) => n.subject === o.subject && o.actions.includes("manage")
|
|
958
|
+
) || s.find((n) => n.subject === o.subject);
|
|
959
959
|
if (i) {
|
|
960
|
-
const
|
|
961
|
-
|
|
960
|
+
const n = i.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
|
|
961
|
+
t.push(n);
|
|
962
962
|
}
|
|
963
|
-
return
|
|
963
|
+
return t;
|
|
964
964
|
}, [])
|
|
965
965
|
);
|
|
966
966
|
}
|
|
967
967
|
export {
|
|
968
|
-
|
|
968
|
+
X as $,
|
|
969
969
|
le as R,
|
|
970
970
|
_e as a,
|
|
971
971
|
ae as b,
|
|
972
|
-
|
|
972
|
+
Q as c,
|
|
973
973
|
de as d,
|
|
974
|
-
|
|
974
|
+
B as e,
|
|
975
975
|
Te as f,
|
|
976
976
|
Ee as g,
|
|
977
977
|
Ce as h,
|
|
@@ -984,11 +984,11 @@ export {
|
|
|
984
984
|
ue as o,
|
|
985
985
|
me as p,
|
|
986
986
|
be as q,
|
|
987
|
-
|
|
987
|
+
N as r,
|
|
988
988
|
Re as s,
|
|
989
989
|
Oe as t,
|
|
990
990
|
se as u,
|
|
991
|
-
|
|
991
|
+
K as v,
|
|
992
992
|
we as w,
|
|
993
993
|
fe as x
|
|
994
994
|
};
|