@feedmepos/mf-hrm-portal 2.2.1 → 2.2.2-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/{ApprovalCodeList-BWQBJGCZ.js → ApprovalCodeList-B9O8QzzI.js} +5 -5
- package/dist/AuditLogList-CtFEXKWZ.js +1722 -0
- package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BDOdtKwI.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C9MYbxum.js} +2 -2
- package/dist/{EmployeeList-BZ6fxRCN.js → EmployeeList-BFxMwFJq.js} +71 -71
- package/dist/{GrantUserList-CaVpRVzA.js → GrantUserList-CZtmMRoS.js} +6 -6
- package/dist/{Main-CEKiyT80.js → Main-B622Z4q4.js} +11 -11
- package/dist/{Main-CQpEciKH.js → Main-DD6IthCS.js} +5 -5
- package/dist/{Main-DrfRLxA5.js → Main-on0TXkQt.js} +8 -8
- package/dist/{PermissionSetList-BgOSJy4y.js → PermissionSetList-FCX3TBoi.js} +77 -78
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B2SX3ZoV.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Cl_YNh0k.js} +832 -837
- 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
- package/dist/RoleList-p_9KHzqF.js +725 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
- package/dist/{TeamMemberList-BXk_pXjc.js → TeamMemberList-BAU7Y3jh.js} +313 -312
- package/dist/{TimesheetList-DgaZmgug.js → TimesheetList-DtFBWhma.js} +7 -7
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-B_Lc8Xmy.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-Tatn3jUv.js} +3 -3
- package/dist/{app-DzagkC6l.js → app-Bbf6hEPt.js} +1086 -781
- package/dist/app.js +1 -1
- package/dist/{approval-code-BRClD2HN.js → approval-code-jIjkeVEb.js} +1 -1
- package/dist/{dayjs.min-CqJsImsm.js → dayjs.min-BAnGg8q2.js} +1 -1
- package/dist/{employee-CXBuv0Bx.js → employee-DVSD3L51.js} +4 -4
- package/dist/{grant-user-Dhi3ilC_.js → grant-user-SNiDV22U.js} +1 -1
- package/dist/{iteration-BCfwR_XH.js → iteration-BTZViJtd.js} +1 -1
- package/dist/{lodash-BJl3phr9.js → lodash-Cgdk4_YL.js} +1 -1
- package/dist/{restaurant-DiYb0pCm.js → restaurant-BTpBmfBV.js} +2 -2
- package/dist/{role-BfCNRnuy.js → role-CXVpO6fB.js} +2 -2
- package/dist/{rule-B3Eg-J8O.js → rule-TR3MVo-b.js} +259 -279
- package/dist/src/api/audit-log/index.d.ts +6 -0
- package/dist/src/api/user/index.d.ts +2 -2
- package/dist/src/composables/useReportPermissions.d.ts +0 -1
- package/dist/src/helpers/rule.d.ts +0 -2
- package/dist/src/types/audit-log.d.ts +1 -1
- package/dist/src/types/role.d.ts +0 -1
- package/dist/src/views/audit-log/change-nodes.d.ts +14 -0
- package/dist/src/views/audit-log/event-line.d.ts +13 -0
- package/dist/src/views/audit-log/locales/index.d.ts +300 -0
- package/dist/src/views/audit-log/operation-status.d.ts +2 -0
- package/dist/src/views/audit-log/snapshot-diff.d.ts +11 -0
- package/dist/src/views/hr/locales/index.d.ts +0 -4
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BGhlB1_1.js → useAppStore-DCwd8GWN.js} +1 -1
- package/dist/useDebounce-B8ZPVS5C.js +15 -0
- package/dist/{useLoading-CvgqVDbF.js → useLoading-CXzTpIVv.js} +1 -1
- package/dist/useReportPermissions-BpAFyO17.js +71 -0
- package/package.json +1 -1
- package/dist/AuditLogList-CymSyHag.js +0 -1149
- package/dist/RoleList-C2PrTc1f.js +0 -739
- package/dist/useDebounce-CWb5QR9G.js +0 -28
- package/dist/useReportPermissions-CXXq725N.js +0 -82
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as W, c as Z, e as h } from "./iteration-
|
|
2
|
-
import { h as O, P as V, e as _, b as F, n as j, d as q } from "./app-
|
|
1
|
+
import { s as W, c as Z, e as h } from "./iteration-BTZViJtd.js";
|
|
2
|
+
import { h as O, P as V, e as _, b as F, n as j, d as q } from "./app-Bbf6hEPt.js";
|
|
3
3
|
import { s as ee } from "./utils-BZkjJbju.js";
|
|
4
|
-
import { g as b, b as v, q as x, u as te } from "./restaurant-
|
|
4
|
+
import { g as b, b as v, 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 U } from "vue";
|
|
7
7
|
import { useCoreStore as X } from "@feedmepos/mf-common";
|
|
@@ -354,14 +354,14 @@ const L = [
|
|
|
354
354
|
async create(e) {
|
|
355
355
|
return b(await v().post(E, e));
|
|
356
356
|
},
|
|
357
|
-
async update(e,
|
|
358
|
-
return b(await v().put(`${E}/${e}`,
|
|
357
|
+
async update(e, s) {
|
|
358
|
+
return b(await v().put(`${E}/${e}`, s));
|
|
359
359
|
},
|
|
360
360
|
async delete(e) {
|
|
361
361
|
return b(await v().delete(`${E}/${e}`));
|
|
362
362
|
}
|
|
363
363
|
}, se = z("permissionSet", () => {
|
|
364
|
-
const { currentBusiness: e } = X(),
|
|
364
|
+
const { currentBusiness: e } = X(), s = S([]), o = S(!1), n = S(null);
|
|
365
365
|
async function r() {
|
|
366
366
|
var l;
|
|
367
367
|
const c = ((l = e.value) == null ? void 0 : l._id) ?? null;
|
|
@@ -369,32 +369,32 @@ const L = [
|
|
|
369
369
|
try {
|
|
370
370
|
o.value = !0;
|
|
371
371
|
const d = await N.read();
|
|
372
|
-
|
|
372
|
+
s.value = u(d), n.value = c;
|
|
373
373
|
} finally {
|
|
374
374
|
o.value = !1;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
async function
|
|
377
|
+
async function t(c) {
|
|
378
378
|
const l = await N.create(c);
|
|
379
|
-
|
|
379
|
+
s.value = u([...s.value, l]);
|
|
380
380
|
}
|
|
381
|
-
async function
|
|
381
|
+
async function i(c, l) {
|
|
382
382
|
const d = await N.update(c, l);
|
|
383
|
-
|
|
383
|
+
s.value = u(s.value.map((f) => f.id === c ? d : f));
|
|
384
384
|
}
|
|
385
|
-
async function
|
|
386
|
-
await N.delete(c),
|
|
385
|
+
async function a(c) {
|
|
386
|
+
await N.delete(c), s.value = u(s.value.filter((l) => l.id !== c));
|
|
387
387
|
}
|
|
388
388
|
function u(c) {
|
|
389
389
|
return c.sort((l, d) => l.name.localeCompare(d.name));
|
|
390
390
|
}
|
|
391
391
|
return {
|
|
392
|
-
permissionSets:
|
|
392
|
+
permissionSets: s,
|
|
393
393
|
isLoading: o,
|
|
394
394
|
readPermissionSets: r,
|
|
395
|
-
createPermissionSet:
|
|
396
|
-
updatePermissionSet:
|
|
397
|
-
deletePermissionSet:
|
|
395
|
+
createPermissionSet: t,
|
|
396
|
+
updatePermissionSet: i,
|
|
397
|
+
deletePermissionSet: a
|
|
398
398
|
};
|
|
399
399
|
}), ne = () => {
|
|
400
400
|
const e = se();
|
|
@@ -419,60 +419,60 @@ function k(e) {
|
|
|
419
419
|
}
|
|
420
420
|
function y(e) {
|
|
421
421
|
return e ? Object.values(e).every(
|
|
422
|
-
(
|
|
422
|
+
(s) => s !== null && typeof s == "object" && !Array.isArray(s) && Object.keys(s).length === 1 && Array.isArray(s.$in)
|
|
423
423
|
) : !0;
|
|
424
424
|
}
|
|
425
425
|
function Q(e) {
|
|
426
|
-
const
|
|
427
|
-
var
|
|
428
|
-
const c = k(
|
|
429
|
-
let l = `${
|
|
426
|
+
const s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = (r, t, i) => {
|
|
427
|
+
var a, u;
|
|
428
|
+
const c = k(t.conditions);
|
|
429
|
+
let l = `${t.subject}::${JSON.stringify([...t.actions].sort())}`;
|
|
430
430
|
y(c) || (l += `::${JSON.stringify(c)}`);
|
|
431
431
|
const d = r.get(l);
|
|
432
432
|
if (!d) {
|
|
433
|
-
r.set(l, { ...
|
|
433
|
+
r.set(l, { ...t, setNames: [i.name], setId: i._id });
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
|
-
d.setNames.push(
|
|
437
|
-
const
|
|
438
|
-
if (!
|
|
436
|
+
d.setNames.push(i.name);
|
|
437
|
+
const f = k(d.conditions);
|
|
438
|
+
if (!f || !c) {
|
|
439
439
|
d.conditions = void 0;
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
(
|
|
444
|
-
/* @__PURE__ */ new Set([...m
|
|
445
|
-
) : m
|
|
446
|
-
d.conditions = JSON.stringify(
|
|
442
|
+
for (const m in c)
|
|
443
|
+
(a = f[m]) != null && a.$in && (u = c[m]) != null && u.$in ? f[m].$in = Array.from(
|
|
444
|
+
/* @__PURE__ */ new Set([...f[m].$in, ...c[m].$in])
|
|
445
|
+
) : f[m] || (f[m] = c[m]);
|
|
446
|
+
d.conditions = JSON.stringify(f);
|
|
447
447
|
};
|
|
448
448
|
for (const r of e)
|
|
449
|
-
for (const
|
|
450
|
-
n(
|
|
451
|
-
return [...Array.from(
|
|
449
|
+
for (const t of r.permissions)
|
|
450
|
+
n(t.inverted ? o : s, t, r);
|
|
451
|
+
return [...Array.from(s.values()), ...Array.from(o.values())];
|
|
452
452
|
}
|
|
453
|
-
function B(e,
|
|
454
|
-
return `${e}::${[...
|
|
453
|
+
function B(e, s) {
|
|
454
|
+
return `${e}::${[...s].sort().join(",")}`;
|
|
455
455
|
}
|
|
456
|
-
function G(e,
|
|
457
|
-
const o = [...e], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(),
|
|
458
|
-
for (const
|
|
459
|
-
const u = O(
|
|
460
|
-
n.add(B(u,
|
|
456
|
+
function G(e, s) {
|
|
457
|
+
const o = [...e], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
458
|
+
for (const a of e) {
|
|
459
|
+
const u = O(a.subject);
|
|
460
|
+
n.add(B(u, a.actions)), a.inverted && a.actions.includes("manage") && r.add(`set_${u}`), !a.inverted && a.actions.includes("manage") && t.add(u);
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
for (;
|
|
464
|
-
const
|
|
465
|
-
if (!c || r.has(u) || !
|
|
462
|
+
const i = [...e];
|
|
463
|
+
for (; i.length > 0; ) {
|
|
464
|
+
const a = i.shift(), u = `set_${O(a.subject)}`, c = s[u];
|
|
465
|
+
if (!c || r.has(u) || !a.actions.includes("manage") || a.inverted) continue;
|
|
466
466
|
r.add(u);
|
|
467
|
-
const l = oe(
|
|
468
|
-
|
|
467
|
+
const l = oe(a);
|
|
468
|
+
a.source && !a.source.trace && (a.source = { ...a.source, trace: l });
|
|
469
469
|
const d = [...l, `${c.name} (system)`];
|
|
470
|
-
for (const
|
|
471
|
-
const
|
|
472
|
-
n.has(p) ||
|
|
473
|
-
...
|
|
470
|
+
for (const f of c.permissions ?? []) {
|
|
471
|
+
const m = O(f.subject), p = B(m, f.actions);
|
|
472
|
+
n.has(p) || t.has(m) || (n.add(p), o.push({
|
|
473
|
+
...f,
|
|
474
474
|
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
475
|
-
fields:
|
|
475
|
+
fields: f.fields ?? void 0,
|
|
476
476
|
source: {
|
|
477
477
|
type: "systemPermissionSet",
|
|
478
478
|
permissionSetId: c.key,
|
|
@@ -481,9 +481,9 @@ function G(e, t) {
|
|
|
481
481
|
}
|
|
482
482
|
}));
|
|
483
483
|
}
|
|
484
|
-
for (const
|
|
485
|
-
const
|
|
486
|
-
subject:
|
|
484
|
+
for (const f of c.permissionSets ?? []) {
|
|
485
|
+
const m = O(f), p = B(m, ["manage"]), g = {
|
|
486
|
+
subject: m,
|
|
487
487
|
actions: ["manage"],
|
|
488
488
|
source: {
|
|
489
489
|
type: "systemPermissionSet",
|
|
@@ -492,16 +492,16 @@ function G(e, t) {
|
|
|
492
492
|
trace: d
|
|
493
493
|
}
|
|
494
494
|
};
|
|
495
|
-
n.has(p) || (n.add(p), o.push(g)),
|
|
495
|
+
n.has(p) || (n.add(p), o.push(g)), i.push(g);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
return [...o.filter((
|
|
498
|
+
return [...o.filter((a) => !a.inverted), ...o.filter((a) => a.inverted)];
|
|
499
499
|
}
|
|
500
500
|
function oe(e) {
|
|
501
501
|
if (!e.source) return [];
|
|
502
|
-
const { type:
|
|
502
|
+
const { type: s, trace: o, permissionSetName: n } = e.source;
|
|
503
503
|
if (o && o.length > 0) return o;
|
|
504
|
-
switch (
|
|
504
|
+
switch (s) {
|
|
505
505
|
case "permissionSet":
|
|
506
506
|
return n ? [n] : [];
|
|
507
507
|
case "custom":
|
|
@@ -510,43 +510,43 @@ function oe(e) {
|
|
|
510
510
|
return [];
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
function H(e,
|
|
513
|
+
function H(e, s, o = /* @__PURE__ */ new Set()) {
|
|
514
514
|
var r;
|
|
515
515
|
const n = [];
|
|
516
|
-
for (const
|
|
517
|
-
if (o.has(
|
|
518
|
-
o.add(
|
|
519
|
-
const
|
|
520
|
-
|
|
516
|
+
for (const t of e) {
|
|
517
|
+
if (o.has(t)) continue;
|
|
518
|
+
o.add(t);
|
|
519
|
+
const i = s.find((a) => a.id === t);
|
|
520
|
+
i && (n.push(i), (r = i.permissionSetIds) != null && r.length && n.push(...H(i.permissionSetIds, s, o)));
|
|
521
521
|
}
|
|
522
522
|
return n;
|
|
523
523
|
}
|
|
524
524
|
function Ie(e) {
|
|
525
|
-
const
|
|
526
|
-
({ setNames: r, setId:
|
|
527
|
-
), o =
|
|
525
|
+
const s = Q(e).map(
|
|
526
|
+
({ setNames: r, setId: t, ...i }) => i
|
|
527
|
+
), o = s.filter((r) => !r.inverted), n = s.filter((r) => r.inverted);
|
|
528
528
|
return M(o, n);
|
|
529
529
|
}
|
|
530
|
-
function Ae(e,
|
|
530
|
+
function Ae(e, s, o) {
|
|
531
531
|
const n = /* @__PURE__ */ new Map();
|
|
532
532
|
return e.forEach(
|
|
533
|
-
({ name: r, permissions:
|
|
533
|
+
({ name: r, permissions: t }) => t.forEach(({ conditions: i, actions: a }) => {
|
|
534
534
|
var c, l;
|
|
535
|
-
const u = JSON.parse(
|
|
536
|
-
(c = u[
|
|
535
|
+
const u = JSON.parse(i || "{}");
|
|
536
|
+
(c = u[s]) != null && c.$in ? (l = u[s]) == null || l.$in.forEach(
|
|
537
537
|
(d) => (n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(r)
|
|
538
|
-
) :
|
|
538
|
+
) : a[0] === "manage" && o.forEach((d) => {
|
|
539
539
|
(n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(r);
|
|
540
540
|
});
|
|
541
541
|
})
|
|
542
|
-
), [...n].map(([r,
|
|
542
|
+
), [...n].map(([r, t]) => ({
|
|
543
543
|
id: r,
|
|
544
|
-
setNames: [...
|
|
544
|
+
setNames: [...t]
|
|
545
545
|
}));
|
|
546
546
|
}
|
|
547
|
-
function Oe(e,
|
|
548
|
-
const o = (
|
|
549
|
-
const c = { ...
|
|
547
|
+
function Oe(e, s) {
|
|
548
|
+
const o = (a, u) => {
|
|
549
|
+
const c = { ...a }, l = JSON.parse(c.conditions || "{}");
|
|
550
550
|
if (u)
|
|
551
551
|
if (u.length > 0) {
|
|
552
552
|
const d = Object.keys(l)[0];
|
|
@@ -558,45 +558,45 @@ function Oe(e, t) {
|
|
|
558
558
|
inverted: !0,
|
|
559
559
|
...c.conditions && { conditions: JSON.stringify(l) }
|
|
560
560
|
};
|
|
561
|
-
}, n = new Map(e.map((
|
|
562
|
-
for (const
|
|
563
|
-
const u = n.get(
|
|
561
|
+
}, n = new Map(e.map((a) => [a.subject, a])), r = new Map(s.map((a) => [a.subject, a])), t = [], i = /* @__PURE__ */ new Set([...n.keys(), ...r.keys()]);
|
|
562
|
+
for (const a of i) {
|
|
563
|
+
const u = n.get(a), c = r.get(a);
|
|
564
564
|
if (u && c) {
|
|
565
565
|
if (u.conditions && c.conditions) {
|
|
566
566
|
const l = JSON.parse(u.conditions), d = JSON.parse(c.conditions);
|
|
567
567
|
if (!y(l) || !y(d)) {
|
|
568
|
-
JSON.stringify(l) !== JSON.stringify(d) &&
|
|
568
|
+
JSON.stringify(l) !== JSON.stringify(d) && t.push(c);
|
|
569
569
|
continue;
|
|
570
570
|
}
|
|
571
|
-
const
|
|
572
|
-
(g) => !d[
|
|
571
|
+
const f = Object.keys(l)[0], m = l[f].$in.filter(
|
|
572
|
+
(g) => !d[f].$in.includes(g)
|
|
573
573
|
);
|
|
574
|
-
|
|
575
|
-
(g) => !l[
|
|
576
|
-
).length > 0 &&
|
|
574
|
+
m.length > 0 && t.push(o(u, m)), d[f].$in.filter(
|
|
575
|
+
(g) => !l[f].$in.includes(g)
|
|
576
|
+
).length > 0 && t.push(c);
|
|
577
577
|
} else if (!u.conditions && c.conditions)
|
|
578
|
-
|
|
578
|
+
t.push(c);
|
|
579
579
|
else if (u.conditions && !c.conditions)
|
|
580
|
-
y(JSON.parse(u.conditions)) ||
|
|
580
|
+
y(JSON.parse(u.conditions)) || t.push(c);
|
|
581
581
|
else if (!u.conditions && !c.conditions) {
|
|
582
|
-
const l = new Set(u.actions), d = new Set(c.actions),
|
|
583
|
-
if (
|
|
582
|
+
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));
|
|
583
|
+
if (f) {
|
|
584
584
|
const p = c.actions.filter((g) => !l.has(g));
|
|
585
|
-
|
|
585
|
+
t.push({
|
|
586
586
|
...c,
|
|
587
587
|
actions: p
|
|
588
588
|
});
|
|
589
589
|
}
|
|
590
|
-
|
|
590
|
+
m.length > 0 && t.push({
|
|
591
591
|
...u,
|
|
592
|
-
actions:
|
|
592
|
+
actions: m,
|
|
593
593
|
inverted: !0
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
596
|
continue;
|
|
597
597
|
}
|
|
598
598
|
if (u) {
|
|
599
|
-
|
|
599
|
+
t.push(
|
|
600
600
|
o(
|
|
601
601
|
u,
|
|
602
602
|
// If base has conditions, set diffIds to empty array, disallow all access to collection
|
|
@@ -606,122 +606,122 @@ function Oe(e, t) {
|
|
|
606
606
|
);
|
|
607
607
|
continue;
|
|
608
608
|
}
|
|
609
|
-
c &&
|
|
609
|
+
c && t.push(c);
|
|
610
610
|
}
|
|
611
|
-
return
|
|
611
|
+
return t;
|
|
612
612
|
}
|
|
613
613
|
function _e(e) {
|
|
614
|
-
const
|
|
614
|
+
const s = G(
|
|
615
615
|
e,
|
|
616
616
|
V
|
|
617
617
|
), o = new Set(
|
|
618
|
-
|
|
619
|
-
var
|
|
620
|
-
return ((
|
|
618
|
+
s.filter((r) => {
|
|
619
|
+
var t;
|
|
620
|
+
return ((t = r.source) == null ? void 0 : t.type) === "systemPermissionSet" && !r.inverted;
|
|
621
621
|
}).map((r) => r.subject)
|
|
622
622
|
), n = new Set(
|
|
623
|
-
|
|
623
|
+
s.filter(
|
|
624
624
|
(r) => {
|
|
625
|
-
var
|
|
626
|
-
return ((
|
|
625
|
+
var t;
|
|
626
|
+
return ((t = r.source) == null ? void 0 : t.type) === "systemPermissionSet" && !r.inverted && r.actions.includes("manage");
|
|
627
627
|
}
|
|
628
628
|
).map((r) => r.subject)
|
|
629
629
|
);
|
|
630
630
|
return e.filter((r) => r.inverted ? !(o.has(r.subject) && !n.has(r.subject)) : !o.has(r.subject));
|
|
631
631
|
}
|
|
632
632
|
const re = "business::report::";
|
|
633
|
-
function Ee(e,
|
|
633
|
+
function Ee(e, s) {
|
|
634
634
|
const o = [], n = e.filter((r) => {
|
|
635
|
-
const
|
|
636
|
-
return !
|
|
635
|
+
const t = r.subject;
|
|
636
|
+
return !t.startsWith(re) || s.has(t) ? !0 : (o.push(t), !1);
|
|
637
637
|
});
|
|
638
638
|
return o.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", o), n;
|
|
639
639
|
}
|
|
640
640
|
const ie = "business::report::reports::", ae = _.Subject.Business.report_reports_allDefaultReports, ce = _.Subject.Business.report_reports_allCustomReports;
|
|
641
|
-
function ue(e,
|
|
642
|
-
return e.conditions ? !!
|
|
641
|
+
function ue(e, s) {
|
|
642
|
+
return e.conditions ? !!s.conditions && e.conditions === s.conditions : !s.conditions;
|
|
643
643
|
}
|
|
644
|
-
function Ne(e,
|
|
644
|
+
function Ne(e, s) {
|
|
645
645
|
const o = e.find(
|
|
646
|
-
(
|
|
646
|
+
(i) => !i.inverted && i.subject === ae
|
|
647
647
|
), n = e.find(
|
|
648
|
-
(
|
|
648
|
+
(i) => !i.inverted && i.subject === ce
|
|
649
649
|
);
|
|
650
650
|
if (!o && !n) return e;
|
|
651
|
-
const r = o ? new Set(o.actions) : null,
|
|
652
|
-
return e.reduce((
|
|
653
|
-
if (
|
|
654
|
-
return
|
|
655
|
-
const u =
|
|
651
|
+
const r = o ? new Set(o.actions) : null, t = n ? new Set(n.actions) : null;
|
|
652
|
+
return e.reduce((i, a) => {
|
|
653
|
+
if (a.inverted)
|
|
654
|
+
return i.push(a), i;
|
|
655
|
+
const u = a.subject;
|
|
656
656
|
if (!u.startsWith(ie))
|
|
657
|
-
return
|
|
658
|
-
const c =
|
|
659
|
-
if (!l || !d || !ue(d,
|
|
660
|
-
return
|
|
661
|
-
if (l.has("manage")) return
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
664
|
-
return
|
|
665
|
-
const
|
|
657
|
+
return i.push(a), i;
|
|
658
|
+
const c = s.has(u), l = c ? r : t, d = c ? o : n;
|
|
659
|
+
if (!l || !d || !ue(d, a))
|
|
660
|
+
return i.push(a), i;
|
|
661
|
+
if (l.has("manage")) return i;
|
|
662
|
+
const f = a.actions;
|
|
663
|
+
if (f.includes("manage"))
|
|
664
|
+
return i.push(a), i;
|
|
665
|
+
const m = new Set(f);
|
|
666
666
|
for (const p of l)
|
|
667
|
-
|
|
668
|
-
return
|
|
667
|
+
m.delete(p);
|
|
668
|
+
return m.size === 0 || i.push({ ...a, actions: Array.from(m) }), i;
|
|
669
669
|
}, []);
|
|
670
670
|
}
|
|
671
|
-
function M(e,
|
|
671
|
+
function M(e, s) {
|
|
672
672
|
var n, r;
|
|
673
|
-
const o = new Map(e.map((
|
|
674
|
-
for (const
|
|
675
|
-
if (
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
if (
|
|
679
|
-
const u = JSON.parse(
|
|
673
|
+
const o = new Map(e.map((t) => [t.subject, t]));
|
|
674
|
+
for (const t of s) {
|
|
675
|
+
if (t.inverted) {
|
|
676
|
+
const a = o.get(t.subject);
|
|
677
|
+
if (t.conditions) {
|
|
678
|
+
if (a != null && a.conditions) {
|
|
679
|
+
const u = JSON.parse(a.conditions), c = JSON.parse(t.conditions);
|
|
680
680
|
if (!y(u) || !y(c)) {
|
|
681
|
-
o.delete(
|
|
681
|
+
o.delete(t.subject);
|
|
682
682
|
continue;
|
|
683
683
|
}
|
|
684
|
-
const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [],
|
|
685
|
-
|
|
686
|
-
...
|
|
687
|
-
conditions: JSON.stringify({ [l]: { $in:
|
|
688
|
-
}) : o.delete(
|
|
684
|
+
const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], m = (((r = u[l]) == null ? void 0 : r.$in) ?? []).filter((p) => !d.includes(p));
|
|
685
|
+
m.length > 0 ? o.set(t.subject, {
|
|
686
|
+
...a,
|
|
687
|
+
conditions: JSON.stringify({ [l]: { $in: m } })
|
|
688
|
+
}) : o.delete(t.subject);
|
|
689
689
|
} else
|
|
690
|
-
o.delete(
|
|
690
|
+
o.delete(t.subject);
|
|
691
691
|
continue;
|
|
692
692
|
}
|
|
693
|
-
if (
|
|
694
|
-
const u = new Set(
|
|
695
|
-
c.length > 0 ? o.set(
|
|
693
|
+
if (a) {
|
|
694
|
+
const u = new Set(t.actions), c = a.actions.filter((l) => !u.has(l));
|
|
695
|
+
c.length > 0 ? o.set(t.subject, { ...a, actions: c }) : o.delete(t.subject);
|
|
696
696
|
continue;
|
|
697
697
|
}
|
|
698
698
|
continue;
|
|
699
699
|
}
|
|
700
|
-
if (
|
|
701
|
-
o.set(
|
|
700
|
+
if (t.conditions) {
|
|
701
|
+
o.set(t.subject, t);
|
|
702
702
|
continue;
|
|
703
703
|
}
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
706
|
-
o.set(
|
|
704
|
+
const i = o.get(t.subject);
|
|
705
|
+
if (i != null && i.conditions && !y(JSON.parse(i.conditions))) {
|
|
706
|
+
o.set(t.subject, t);
|
|
707
707
|
continue;
|
|
708
708
|
}
|
|
709
|
-
if (
|
|
710
|
-
const
|
|
709
|
+
if (i) {
|
|
710
|
+
const a = [
|
|
711
711
|
.../* @__PURE__ */ new Set([
|
|
712
|
-
...
|
|
713
|
-
...
|
|
712
|
+
...i.actions,
|
|
713
|
+
...t.actions
|
|
714
714
|
])
|
|
715
715
|
];
|
|
716
|
-
o.set(
|
|
716
|
+
o.set(t.subject, { ...i, actions: a });
|
|
717
717
|
} else
|
|
718
|
-
o.set(
|
|
718
|
+
o.set(t.subject, t);
|
|
719
719
|
}
|
|
720
720
|
return Array.from(o.values());
|
|
721
721
|
}
|
|
722
|
-
function le(e,
|
|
723
|
-
const o = M(e,
|
|
724
|
-
(
|
|
722
|
+
function le(e, s) {
|
|
723
|
+
const o = M(e, s), n = new Set(e.map((t) => t.subject)), r = s.filter(
|
|
724
|
+
(t) => t.inverted && !n.has(t.subject)
|
|
725
725
|
);
|
|
726
726
|
return [...o, ...r];
|
|
727
727
|
}
|
|
@@ -738,64 +738,64 @@ const P = "/permission-assignments", R = {
|
|
|
738
738
|
async create(e) {
|
|
739
739
|
return b(await v().post(P, e));
|
|
740
740
|
},
|
|
741
|
-
async update(e,
|
|
742
|
-
return b(await v().put(`${P}/${e}`,
|
|
741
|
+
async update(e, s) {
|
|
742
|
+
return b(await v().put(`${P}/${e}`, s));
|
|
743
743
|
},
|
|
744
744
|
async delete(e) {
|
|
745
745
|
return b(await v().delete(`${P}/${e}`));
|
|
746
746
|
},
|
|
747
|
-
async addReportManagePermission(e,
|
|
747
|
+
async addReportManagePermission(e, s) {
|
|
748
748
|
return b(
|
|
749
|
-
await v().post("/my-permissions/report-manage", { permissionKey: e, label:
|
|
749
|
+
await v().post("/my-permissions/report-manage", { permissionKey: e, label: s })
|
|
750
750
|
);
|
|
751
751
|
}
|
|
752
752
|
}, de = z("permissionAssignment", () => {
|
|
753
753
|
const e = S([]);
|
|
754
|
-
async function
|
|
755
|
-
const
|
|
756
|
-
e.value =
|
|
754
|
+
async function s() {
|
|
755
|
+
const a = await R.readAll();
|
|
756
|
+
e.value = a;
|
|
757
757
|
}
|
|
758
|
-
async function o(
|
|
759
|
-
return await R.readByUserId(
|
|
758
|
+
async function o(a) {
|
|
759
|
+
return await R.readByUserId(a);
|
|
760
760
|
}
|
|
761
|
-
async function n(
|
|
762
|
-
const u = await R.create(
|
|
761
|
+
async function n(a) {
|
|
762
|
+
const u = await R.create(a);
|
|
763
763
|
e.value = [...e.value, u];
|
|
764
764
|
}
|
|
765
|
-
async function r(
|
|
766
|
-
const c = await R.update(
|
|
767
|
-
e.value = e.value.map((l) => l.id ===
|
|
765
|
+
async function r(a, u) {
|
|
766
|
+
const c = await R.update(a, u);
|
|
767
|
+
e.value = e.value.map((l) => l.id === a ? c : l);
|
|
768
768
|
}
|
|
769
|
-
async function
|
|
770
|
-
await R.delete(
|
|
769
|
+
async function t(a) {
|
|
770
|
+
await R.delete(a), e.value = e.value.filter((u) => u.id !== a);
|
|
771
771
|
}
|
|
772
|
-
function a
|
|
773
|
-
return e.value.find((u) => u.userId ===
|
|
772
|
+
function i(a) {
|
|
773
|
+
return e.value.find((u) => u.userId === a);
|
|
774
774
|
}
|
|
775
775
|
return {
|
|
776
776
|
permissionAssignments: e,
|
|
777
|
-
readPermissionAssignments:
|
|
777
|
+
readPermissionAssignments: s,
|
|
778
778
|
readPermissionAssignmentByUserId: o,
|
|
779
779
|
createPermissionAssignment: n,
|
|
780
780
|
updatePermissionAssignment: r,
|
|
781
|
-
deletePermissionAssignment:
|
|
782
|
-
getPermissionAssignmentByUserId:
|
|
781
|
+
deletePermissionAssignment: t,
|
|
782
|
+
getPermissionAssignmentByUserId: i
|
|
783
783
|
};
|
|
784
|
-
}),
|
|
784
|
+
}), fe = () => {
|
|
785
785
|
const e = de();
|
|
786
786
|
return {
|
|
787
787
|
...e,
|
|
788
788
|
...K(e)
|
|
789
789
|
};
|
|
790
|
-
},
|
|
791
|
-
async fetchReportPermissions(e,
|
|
792
|
-
const o =
|
|
790
|
+
}, me = {
|
|
791
|
+
async fetchReportPermissions(e, s) {
|
|
792
|
+
const o = s ? { lang: s } : {};
|
|
793
793
|
return b(
|
|
794
794
|
await x().get(`/report-query/hrm/${e}/reports`, { params: o })
|
|
795
795
|
);
|
|
796
796
|
},
|
|
797
|
-
async fetchReportPermissionsForPortal(e,
|
|
798
|
-
const o =
|
|
797
|
+
async fetchReportPermissionsForPortal(e, s) {
|
|
798
|
+
const o = s ? { isSupportPos: !1, lang: s } : { isSupportPos: !1 };
|
|
799
799
|
return b(
|
|
800
800
|
await x().get(`/report-query/hrm/${e}/reports`, { params: o })
|
|
801
801
|
);
|
|
@@ -803,9 +803,9 @@ const P = "/permission-assignments", R = {
|
|
|
803
803
|
}, C = S([]), T = S(!1), $ = S(!1), I = S(null), D = S(null), J = S(!1);
|
|
804
804
|
function pe() {
|
|
805
805
|
const e = X();
|
|
806
|
-
async function
|
|
807
|
-
var
|
|
808
|
-
const n = (
|
|
806
|
+
async function s() {
|
|
807
|
+
var t;
|
|
808
|
+
const n = (t = e.currentBusiness.value) == null ? void 0 : t.id;
|
|
809
809
|
if (!n) return;
|
|
810
810
|
const r = localStorage.getItem("locale");
|
|
811
811
|
if (I.value !== n && (C.value = [], T.value = !1, $.value = !1, I.value = n, J.value = !1), !(T.value && D.value === r)) {
|
|
@@ -815,14 +815,14 @@ function pe() {
|
|
|
815
815
|
}
|
|
816
816
|
$.value = !0;
|
|
817
817
|
try {
|
|
818
|
-
const
|
|
818
|
+
const i = await me.fetchReportPermissionsForPortal(n, r);
|
|
819
819
|
if (I.value !== n) return;
|
|
820
|
-
C.value =
|
|
821
|
-
} catch (
|
|
820
|
+
C.value = i, T.value = !0, D.value = r;
|
|
821
|
+
} catch (i) {
|
|
822
822
|
if (I.value !== n) return;
|
|
823
|
-
console.warn("Failed to fetch custom report permissions:",
|
|
823
|
+
console.warn("Failed to fetch custom report permissions:", i), C.value = [];
|
|
824
824
|
} finally {
|
|
825
|
-
I.value === n && ($.value = !1, J.value && (J.value = !1, await
|
|
825
|
+
I.value === n && ($.value = !1, J.value && (J.value = !1, await s()));
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
}
|
|
@@ -846,25 +846,25 @@ function pe() {
|
|
|
846
846
|
}
|
|
847
847
|
));
|
|
848
848
|
return {
|
|
849
|
-
fetchCustomReportPermissions:
|
|
849
|
+
fetchCustomReportPermissions: s,
|
|
850
850
|
customReportPermissions: o,
|
|
851
851
|
isLoading: U(() => $.value),
|
|
852
852
|
isLoaded: U(() => T.value)
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
855
|
function A(e) {
|
|
856
|
-
const
|
|
857
|
-
(
|
|
858
|
-
|
|
859
|
-
),
|
|
856
|
+
const s = ne(), o = fe(), n = te().restaurants, { customReportPermissions: r } = pe(), t = o.getPermissionAssignmentByUserId(e.id), i = H(
|
|
857
|
+
(t == null ? void 0 : t.permissionSetIds) ?? [],
|
|
858
|
+
s.permissionSets.value
|
|
859
|
+
), a = Q(i).map(
|
|
860
860
|
({ setNames: p, ...g }) => g
|
|
861
|
-
), u =
|
|
861
|
+
), u = t == null ? void 0 : t.customPermissions, c = u ?? e.permissions.map((p) => ({
|
|
862
862
|
...p,
|
|
863
863
|
subject: O(p.subject)
|
|
864
|
-
})), l = M(
|
|
865
|
-
le(
|
|
864
|
+
})), l = M(a, c), d = G(
|
|
865
|
+
le(a, c),
|
|
866
866
|
V
|
|
867
|
-
).filter((p) => !p.inverted),
|
|
867
|
+
).filter((p) => !p.inverted), f = ve(d), m = f ?? n.value.map((p) => p._id);
|
|
868
868
|
return {
|
|
869
869
|
doc: e,
|
|
870
870
|
id: e.id,
|
|
@@ -872,12 +872,12 @@ function A(e) {
|
|
|
872
872
|
phoneNumber: e.phoneNumber,
|
|
873
873
|
email: e.email,
|
|
874
874
|
restaurants: W(
|
|
875
|
-
|
|
875
|
+
m.map((p) => {
|
|
876
876
|
var g;
|
|
877
877
|
return ((g = n.value.find((Y) => Y._id === p)) == null ? void 0 : g.profile.name) ?? "";
|
|
878
878
|
})
|
|
879
879
|
),
|
|
880
|
-
managableRestaurantIds:
|
|
880
|
+
managableRestaurantIds: f,
|
|
881
881
|
permissionLabels: Se(d, r.value),
|
|
882
882
|
permissions: l
|
|
883
883
|
};
|
|
@@ -892,7 +892,7 @@ const be = Object.freeze(
|
|
|
892
892
|
},
|
|
893
893
|
async readTeamMembersPage(e) {
|
|
894
894
|
var o, n, r;
|
|
895
|
-
const
|
|
895
|
+
const s = b(
|
|
896
896
|
await v().get("/portal-users/paged", {
|
|
897
897
|
params: {
|
|
898
898
|
limit: e.limit,
|
|
@@ -905,8 +905,8 @@ const be = Object.freeze(
|
|
|
905
905
|
})
|
|
906
906
|
);
|
|
907
907
|
return {
|
|
908
|
-
items:
|
|
909
|
-
total:
|
|
908
|
+
items: s.items.map(A),
|
|
909
|
+
total: s.total
|
|
910
910
|
};
|
|
911
911
|
},
|
|
912
912
|
async readTeamMember(e) {
|
|
@@ -919,33 +919,33 @@ const be = Object.freeze(
|
|
|
919
919
|
b(await v().post("/portal-users", e))
|
|
920
920
|
);
|
|
921
921
|
},
|
|
922
|
-
async updateTeamMember(e,
|
|
922
|
+
async updateTeamMember(e, s) {
|
|
923
923
|
return A(
|
|
924
|
-
b(await v().put(`/portal-users/${e}`,
|
|
924
|
+
b(await v().put(`/portal-users/${e}`, s))
|
|
925
925
|
);
|
|
926
926
|
},
|
|
927
927
|
async deleteTeamMember(e) {
|
|
928
928
|
return b(await v().delete(`/portal-users/${e}`));
|
|
929
929
|
},
|
|
930
930
|
async readTeamMemberPosUserIds() {
|
|
931
|
-
return b(await v().get("/portal-users")).map((
|
|
931
|
+
return b(await v().get("/portal-users")).map((s) => s.posUserId);
|
|
932
932
|
}
|
|
933
933
|
};
|
|
934
|
-
function Te(e,
|
|
935
|
-
if (e.some((
|
|
934
|
+
function Te(e, s, o) {
|
|
935
|
+
if (e.some((i) => i.subject === "all")) return "All";
|
|
936
936
|
const n = (o ?? L).filter(
|
|
937
|
-
(
|
|
938
|
-
), r = new Set(n.map((
|
|
939
|
-
return
|
|
937
|
+
(i) => i.subject === s
|
|
938
|
+
), r = new Set(n.map((i) => w(i).value)), t = e.filter((i) => i.subject === s).filter((i) => r.has(w(i).value));
|
|
939
|
+
return t.length === n.length ? "All" : t.length === 0 ? "-" : `${t.length} permission allow`;
|
|
940
940
|
}
|
|
941
941
|
function w(e) {
|
|
942
|
-
const
|
|
942
|
+
const s = Z(e), o = s.subject;
|
|
943
943
|
return {
|
|
944
|
-
...
|
|
944
|
+
...s,
|
|
945
945
|
get conditions() {
|
|
946
|
-
if (typeof
|
|
946
|
+
if (typeof s.conditions != "string") return s.conditions;
|
|
947
947
|
try {
|
|
948
|
-
return JSON.parse(
|
|
948
|
+
return JSON.parse(s.conditions);
|
|
949
949
|
} catch {
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
@@ -960,92 +960,72 @@ function w(e) {
|
|
|
960
960
|
get isReportPermission() {
|
|
961
961
|
return o === h.F_RULE_SUBJECT.enum.report;
|
|
962
962
|
},
|
|
963
|
-
/**
|
|
964
|
-
* Order and report rules are only meaningful together with the condition
|
|
965
|
-
* that names them. A rule missing it cannot be rendered or matched against
|
|
966
|
-
* the available permission list, so callers must preserve it verbatim —
|
|
967
|
-
* see `splitRoleFormPermissions`, which routes it to `passthrough`, not
|
|
968
|
-
* `dropped`. Dropping it would silently revoke a grant the portal cannot
|
|
969
|
-
* display (HRM-0027).
|
|
970
|
-
*/
|
|
971
|
-
get isResolvable() {
|
|
972
|
-
return this.discriminator !== void 0;
|
|
973
|
-
},
|
|
974
|
-
/**
|
|
975
|
-
* The condition value that identifies this rule, if the subject needs one.
|
|
976
|
-
* An empty condition counts as missing: `{ name: '' }` is a known corrupted
|
|
977
|
-
* shape that used to resolve to the first hardcoded report permission on
|
|
978
|
-
* save (HRM-0027), so it must not look resolvable here either.
|
|
979
|
-
*/
|
|
980
|
-
get discriminator() {
|
|
981
|
-
var n, r;
|
|
982
|
-
return this.isOrderOperation ? ((n = this.conditions) == null ? void 0 : n.operation) || void 0 : this.isReportPermission ? ((r = this.conditions) == null ? void 0 : r.name) || void 0 : o.toString();
|
|
983
|
-
},
|
|
984
963
|
get formatted() {
|
|
985
|
-
|
|
986
|
-
|
|
964
|
+
var r, t;
|
|
965
|
+
const n = (i) => i.endsWith("_") ? i.slice(0, i.length - 1) : i;
|
|
966
|
+
return this.isOrderOperation ? n(((r = this.conditions) == null ? void 0 : r.operation) ?? "") : this.isReportPermission ? n(((t = this.conditions) == null ? void 0 : t.name) ?? "") : o.toString();
|
|
987
967
|
},
|
|
988
968
|
get label() {
|
|
989
|
-
return
|
|
969
|
+
return s.label || ee(this.formatted);
|
|
990
970
|
},
|
|
991
971
|
get value() {
|
|
992
|
-
|
|
993
|
-
return this.isOrderOperation
|
|
972
|
+
var n, r;
|
|
973
|
+
return this.isOrderOperation ? `${o}:${(n = this.conditions) == null ? void 0 : n.operation}` : this.isReportPermission ? `${o}:${(r = this.conditions) == null ? void 0 : r.name}` : o.toString();
|
|
994
974
|
}
|
|
995
975
|
};
|
|
996
976
|
}
|
|
997
977
|
function Je(e) {
|
|
998
978
|
var n, r;
|
|
999
|
-
const
|
|
1000
|
-
if (!
|
|
1001
|
-
const o = Number((r = (n =
|
|
979
|
+
const s = e.map((t) => w(t)).find((t) => t.isDiscountOperation);
|
|
980
|
+
if (!s) return 100;
|
|
981
|
+
const o = Number((r = (n = s.conditions) == null ? void 0 : n.adjustment) == null ? void 0 : r.$lte);
|
|
1002
982
|
return Number.isFinite(o) ? parseInt((o * 100).toFixed(0)) : 0;
|
|
1003
983
|
}
|
|
1004
984
|
function ve(e) {
|
|
1005
|
-
const
|
|
985
|
+
const s = e.find(
|
|
1006
986
|
(o) => o.subject === _.Subject.Restaurant.restaurant
|
|
1007
987
|
);
|
|
1008
|
-
return
|
|
988
|
+
return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
|
|
1009
989
|
}
|
|
1010
990
|
function Ue(e) {
|
|
1011
|
-
return (e == null ? void 0 : e.some((
|
|
991
|
+
return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
|
|
1012
992
|
}
|
|
1013
993
|
function Be(e) {
|
|
1014
|
-
const
|
|
1015
|
-
return
|
|
994
|
+
const s = e.find((o) => o.subject === _.Subject.Business.role);
|
|
995
|
+
return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
|
|
1016
996
|
}
|
|
1017
997
|
function Le(e) {
|
|
1018
|
-
const
|
|
1019
|
-
if (!
|
|
1020
|
-
const { name: o, ...n } =
|
|
998
|
+
const s = w(e);
|
|
999
|
+
if (!s.isReportPermission) return;
|
|
1000
|
+
const { name: o, ...n } = s.conditions ?? {};
|
|
1021
1001
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
1022
1002
|
}
|
|
1023
|
-
function Me(e,
|
|
1003
|
+
function Me(e, s, o) {
|
|
1024
1004
|
return e.flatMap((n) => {
|
|
1025
1005
|
const r = ge(n);
|
|
1026
1006
|
if (!r) return [];
|
|
1027
|
-
const
|
|
1007
|
+
const t = r.isReportPermission ? o == null ? void 0 : o.get(n) : void 0;
|
|
1028
1008
|
return [
|
|
1029
1009
|
{
|
|
1030
1010
|
subject: r.subject,
|
|
1031
1011
|
actions: r.actions,
|
|
1032
1012
|
conditions: {
|
|
1033
1013
|
...r.conditions,
|
|
1034
|
-
...
|
|
1035
|
-
adjustment: r.isDiscountOperation ? { $lte: parseFloat((
|
|
1014
|
+
...t ?? {},
|
|
1015
|
+
adjustment: r.isDiscountOperation ? { $lte: parseFloat((s / 100).toFixed(2)) } : void 0
|
|
1036
1016
|
}
|
|
1037
1017
|
}
|
|
1038
1018
|
];
|
|
1039
1019
|
});
|
|
1040
1020
|
}
|
|
1041
1021
|
function ge(e) {
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1022
|
+
const s = e.indexOf(":"), o = s === -1 ? e : e.slice(0, s), n = s === -1 ? void 0 : e.slice(s + 1);
|
|
1023
|
+
if (s !== -1 && !n) return;
|
|
1044
1024
|
let r;
|
|
1045
|
-
return n ? (r = L.find((
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1048
|
-
return [
|
|
1025
|
+
return n ? (r = L.find((t) => {
|
|
1026
|
+
if (t.subject !== o) return !1;
|
|
1027
|
+
const i = typeof t.conditions == "string" ? JSON.parse(t.conditions) : t.conditions;
|
|
1028
|
+
return [i == null ? void 0 : i.operation, i == null ? void 0 : i.name].includes(n);
|
|
1049
1029
|
}), !r && o === h.F_RULE_SUBJECT.enum.report && (r = {
|
|
1050
1030
|
label: "",
|
|
1051
1031
|
subject: h.F_RULE_SUBJECT.enum.report,
|
|
@@ -1053,9 +1033,9 @@ function ge(e) {
|
|
|
1053
1033
|
conditions: { name: n },
|
|
1054
1034
|
inverted: !1,
|
|
1055
1035
|
reason: ""
|
|
1056
|
-
})) : r = L.find((
|
|
1036
|
+
})) : r = L.find((t) => t.subject === o), r ? w(r) : void 0;
|
|
1057
1037
|
}
|
|
1058
|
-
function Fe(e,
|
|
1038
|
+
function Fe(e, s) {
|
|
1059
1039
|
const o = { values: [], passthrough: [], dropped: [] };
|
|
1060
1040
|
for (const n of e) {
|
|
1061
1041
|
const r = n == null ? void 0 : n.actions;
|
|
@@ -1063,20 +1043,20 @@ function Fe(e, t) {
|
|
|
1063
1043
|
o.dropped.push(n);
|
|
1064
1044
|
continue;
|
|
1065
1045
|
}
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1046
|
+
const t = w(n).value, i = `${h.F_RULE_SUBJECT.enum.report}:`, a = t.startsWith(i) ? t.slice(i.length) : "";
|
|
1047
|
+
s.has(t) || a && a !== "undefined" ? o.values.push(t) : o.passthrough.push(n);
|
|
1068
1048
|
}
|
|
1069
1049
|
return o;
|
|
1070
1050
|
}
|
|
1071
|
-
function Se(e,
|
|
1051
|
+
function Se(e, s = []) {
|
|
1072
1052
|
return W(
|
|
1073
1053
|
e.reduce((o, n) => {
|
|
1074
1054
|
const r = be.find(
|
|
1075
|
-
(
|
|
1076
|
-
) ||
|
|
1055
|
+
(t) => t.subject === n.subject && n.actions.includes("manage")
|
|
1056
|
+
) || s.find((t) => t.subject === n.subject);
|
|
1077
1057
|
if (r) {
|
|
1078
|
-
const
|
|
1079
|
-
o.push(
|
|
1058
|
+
const t = r.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : r.label;
|
|
1059
|
+
o.push(t);
|
|
1080
1060
|
}
|
|
1081
1061
|
return o;
|
|
1082
1062
|
}, [])
|
|
@@ -1085,7 +1065,7 @@ function Se(e, t = []) {
|
|
|
1085
1065
|
export {
|
|
1086
1066
|
G as N,
|
|
1087
1067
|
Q as P,
|
|
1088
|
-
|
|
1068
|
+
me as R,
|
|
1089
1069
|
Le as a,
|
|
1090
1070
|
Te as b,
|
|
1091
1071
|
H as c,
|
|
@@ -1108,7 +1088,7 @@ export {
|
|
|
1108
1088
|
Ce as t,
|
|
1109
1089
|
ne as u,
|
|
1110
1090
|
Ne as v,
|
|
1111
|
-
|
|
1091
|
+
fe as w,
|
|
1112
1092
|
Se as x,
|
|
1113
1093
|
Ae as y
|
|
1114
1094
|
};
|