@feedmepos/mf-hrm-portal 2.2.1-dev.3 → 2.2.1
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-rL8dh-6s.js → ApprovalCodeList-BWQBJGCZ.js} +5 -5
- package/dist/AuditLogList-CymSyHag.js +1149 -0
- package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BJgpH-kw.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BDOdtKwI.js} +2 -2
- package/dist/{EmployeeList-C3VvVY6A.js → EmployeeList-BZ6fxRCN.js} +71 -71
- package/dist/{GrantUserList-DjZ4O0VB.js → GrantUserList-CaVpRVzA.js} +6 -6
- package/dist/{Main-DVTx58X9.js → Main-CEKiyT80.js} +11 -11
- package/dist/{Main-LaAbAOfs.js → Main-CQpEciKH.js} +5 -5
- package/dist/{Main-ByWrRV70.js → Main-DrfRLxA5.js} +8 -8
- package/dist/{PermissionSetList-DD45SSY3.js → PermissionSetList-BgOSJy4y.js} +78 -77
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-yDPvNHiW.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B2SX3ZoV.js} +1383 -1378
- package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-XHuHin8t.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-Z-DH7ouY.js} +1 -1
- package/dist/RoleList-C2PrTc1f.js +739 -0
- package/dist/{TeamMemberList-DrLbMN34.js → TeamMemberList-BXk_pXjc.js} +312 -313
- package/dist/{TimesheetList-CdaxlO97.js → TimesheetList-DgaZmgug.js} +7 -7
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-ogjfztLs.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-B_Lc8Xmy.js} +3 -3
- package/dist/{app-B8eo04d6.js → app-DzagkC6l.js} +513 -805
- package/dist/app.js +1 -1
- package/dist/{approval-code-jIjkeVEb.js → approval-code-BRClD2HN.js} +1 -1
- package/dist/{dayjs.min-DZEHW2QB.js → dayjs.min-CqJsImsm.js} +1 -1
- package/dist/{employee-DX0CZF-B.js → employee-CXBuv0Bx.js} +4 -4
- package/dist/{grant-user-SNiDV22U.js → grant-user-Dhi3ilC_.js} +1 -1
- package/dist/{iteration-yBS4dpFh.js → iteration-BCfwR_XH.js} +1 -1
- package/dist/{lodash-344d5Ope.js → lodash-BJl3phr9.js} +1 -1
- package/dist/{restaurant-BTpBmfBV.js → restaurant-DiYb0pCm.js} +2 -2
- package/dist/{role-BXBuBxs5.js → role-BfCNRnuy.js} +2 -2
- package/dist/{rule-DWlFon04.js → rule-B3Eg-J8O.js} +279 -259
- package/dist/src/api/audit-log/index.d.ts +0 -6
- package/dist/src/api/user/index.d.ts +2 -2
- package/dist/src/composables/useReportPermissions.d.ts +1 -0
- package/dist/src/helpers/rule.d.ts +2 -0
- package/dist/src/types/audit-log.d.ts +1 -1
- package/dist/src/types/role.d.ts +1 -0
- package/dist/src/views/audit-log/locales/index.d.ts +0 -296
- package/dist/src/views/hr/locales/index.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-DCwd8GWN.js → useAppStore-BGhlB1_1.js} +1 -1
- package/dist/useDebounce-CWb5QR9G.js +28 -0
- package/dist/{useLoading-CXzTpIVv.js → useLoading-CvgqVDbF.js} +1 -1
- package/dist/useReportPermissions-CXXq725N.js +82 -0
- package/package.json +1 -1
- package/dist/AuditLogList-NvISIfUq.js +0 -1611
- package/dist/RoleList-BDxgwmAV.js +0 -725
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
- package/dist/src/views/audit-log/event-line.d.ts +0 -13
- package/dist/src/views/audit-log/snapshot-diff.d.ts +0 -11
- package/dist/useDebounce-B8ZPVS5C.js +0 -15
- package/dist/useReportPermissions-C0exkIxU.js +0 -71
|
@@ -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-BCfwR_XH.js";
|
|
2
|
+
import { h as O, P as V, e as _, b as F, n as j, d as q } from "./app-DzagkC6l.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-DiYb0pCm.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, t) {
|
|
358
|
+
return b(await v().put(`${E}/${e}`, t));
|
|
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(), t = 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
|
+
t.value = u(d), n.value = c;
|
|
373
373
|
} finally {
|
|
374
374
|
o.value = !1;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
async function
|
|
377
|
+
async function s(c) {
|
|
378
378
|
const l = await N.create(c);
|
|
379
|
-
|
|
379
|
+
t.value = u([...t.value, l]);
|
|
380
380
|
}
|
|
381
|
-
async function
|
|
381
|
+
async function a(c, l) {
|
|
382
382
|
const d = await N.update(c, l);
|
|
383
|
-
|
|
383
|
+
t.value = u(t.value.map((m) => m.id === c ? d : m));
|
|
384
384
|
}
|
|
385
|
-
async function
|
|
386
|
-
await N.delete(c),
|
|
385
|
+
async function i(c) {
|
|
386
|
+
await N.delete(c), t.value = u(t.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: t,
|
|
393
393
|
isLoading: o,
|
|
394
394
|
readPermissionSets: r,
|
|
395
|
-
createPermissionSet:
|
|
396
|
-
updatePermissionSet:
|
|
397
|
-
deletePermissionSet:
|
|
395
|
+
createPermissionSet: s,
|
|
396
|
+
updatePermissionSet: a,
|
|
397
|
+
deletePermissionSet: i
|
|
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
|
+
(t) => t !== null && typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 1 && Array.isArray(t.$in)
|
|
423
423
|
) : !0;
|
|
424
424
|
}
|
|
425
425
|
function Q(e) {
|
|
426
|
-
const
|
|
427
|
-
var
|
|
428
|
-
const c = k(
|
|
429
|
-
let l = `${
|
|
426
|
+
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = (r, s, a) => {
|
|
427
|
+
var i, u;
|
|
428
|
+
const c = k(s.conditions);
|
|
429
|
+
let l = `${s.subject}::${JSON.stringify([...s.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, { ...s, setNames: [a.name], setId: a._id });
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
|
-
d.setNames.push(
|
|
437
|
-
const
|
|
438
|
-
if (!
|
|
436
|
+
d.setNames.push(a.name);
|
|
437
|
+
const m = k(d.conditions);
|
|
438
|
+
if (!m || !c) {
|
|
439
439
|
d.conditions = void 0;
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
(
|
|
444
|
-
/* @__PURE__ */ new Set([...f
|
|
445
|
-
) : f
|
|
446
|
-
d.conditions = JSON.stringify(
|
|
442
|
+
for (const f in c)
|
|
443
|
+
(i = m[f]) != null && i.$in && (u = c[f]) != null && u.$in ? m[f].$in = Array.from(
|
|
444
|
+
/* @__PURE__ */ new Set([...m[f].$in, ...c[f].$in])
|
|
445
|
+
) : m[f] || (m[f] = c[f]);
|
|
446
|
+
d.conditions = JSON.stringify(m);
|
|
447
447
|
};
|
|
448
448
|
for (const r of e)
|
|
449
|
-
for (const
|
|
450
|
-
n(
|
|
451
|
-
return [...Array.from(
|
|
449
|
+
for (const s of r.permissions)
|
|
450
|
+
n(s.inverted ? o : t, s, r);
|
|
451
|
+
return [...Array.from(t.values()), ...Array.from(o.values())];
|
|
452
452
|
}
|
|
453
|
-
function B(e,
|
|
454
|
-
return `${e}::${[...
|
|
453
|
+
function B(e, t) {
|
|
454
|
+
return `${e}::${[...t].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, t) {
|
|
457
|
+
const o = [...e], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
458
|
+
for (const i of e) {
|
|
459
|
+
const u = O(i.subject);
|
|
460
|
+
n.add(B(u, i.actions)), i.inverted && i.actions.includes("manage") && r.add(`set_${u}`), !i.inverted && i.actions.includes("manage") && s.add(u);
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
for (;
|
|
464
|
-
const
|
|
465
|
-
if (!c || r.has(u) || !
|
|
462
|
+
const a = [...e];
|
|
463
|
+
for (; a.length > 0; ) {
|
|
464
|
+
const i = a.shift(), u = `set_${O(i.subject)}`, c = t[u];
|
|
465
|
+
if (!c || r.has(u) || !i.actions.includes("manage") || i.inverted) continue;
|
|
466
466
|
r.add(u);
|
|
467
|
-
const l = oe(
|
|
468
|
-
|
|
467
|
+
const l = oe(i);
|
|
468
|
+
i.source && !i.source.trace && (i.source = { ...i.source, trace: l });
|
|
469
469
|
const d = [...l, `${c.name} (system)`];
|
|
470
|
-
for (const
|
|
471
|
-
const
|
|
472
|
-
n.has(p) ||
|
|
473
|
-
...
|
|
470
|
+
for (const m of c.permissions ?? []) {
|
|
471
|
+
const f = O(m.subject), p = B(f, m.actions);
|
|
472
|
+
n.has(p) || s.has(f) || (n.add(p), o.push({
|
|
473
|
+
...m,
|
|
474
474
|
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
475
|
-
fields:
|
|
475
|
+
fields: m.fields ?? void 0,
|
|
476
476
|
source: {
|
|
477
477
|
type: "systemPermissionSet",
|
|
478
478
|
permissionSetId: c.key,
|
|
@@ -481,9 +481,9 @@ function G(e, s) {
|
|
|
481
481
|
}
|
|
482
482
|
}));
|
|
483
483
|
}
|
|
484
|
-
for (const
|
|
485
|
-
const
|
|
486
|
-
subject:
|
|
484
|
+
for (const m of c.permissionSets ?? []) {
|
|
485
|
+
const f = O(m), p = B(f, ["manage"]), g = {
|
|
486
|
+
subject: f,
|
|
487
487
|
actions: ["manage"],
|
|
488
488
|
source: {
|
|
489
489
|
type: "systemPermissionSet",
|
|
@@ -492,16 +492,16 @@ function G(e, s) {
|
|
|
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)), a.push(g);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
return [...o.filter((
|
|
498
|
+
return [...o.filter((i) => !i.inverted), ...o.filter((i) => i.inverted)];
|
|
499
499
|
}
|
|
500
500
|
function oe(e) {
|
|
501
501
|
if (!e.source) return [];
|
|
502
|
-
const { type:
|
|
502
|
+
const { type: t, trace: o, permissionSetName: n } = e.source;
|
|
503
503
|
if (o && o.length > 0) return o;
|
|
504
|
-
switch (
|
|
504
|
+
switch (t) {
|
|
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, t, 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 s of e) {
|
|
517
|
+
if (o.has(s)) continue;
|
|
518
|
+
o.add(s);
|
|
519
|
+
const a = t.find((i) => i.id === s);
|
|
520
|
+
a && (n.push(a), (r = a.permissionSetIds) != null && r.length && n.push(...H(a.permissionSetIds, t, o)));
|
|
521
521
|
}
|
|
522
522
|
return n;
|
|
523
523
|
}
|
|
524
524
|
function Ie(e) {
|
|
525
|
-
const
|
|
526
|
-
({ setNames: r, setId:
|
|
527
|
-
), o =
|
|
525
|
+
const t = Q(e).map(
|
|
526
|
+
({ setNames: r, setId: s, ...a }) => a
|
|
527
|
+
), o = t.filter((r) => !r.inverted), n = t.filter((r) => r.inverted);
|
|
528
528
|
return M(o, n);
|
|
529
529
|
}
|
|
530
|
-
function Ae(e,
|
|
530
|
+
function Ae(e, t, o) {
|
|
531
531
|
const n = /* @__PURE__ */ new Map();
|
|
532
532
|
return e.forEach(
|
|
533
|
-
({ name: r, permissions:
|
|
533
|
+
({ name: r, permissions: s }) => s.forEach(({ conditions: a, actions: i }) => {
|
|
534
534
|
var c, l;
|
|
535
|
-
const u = JSON.parse(
|
|
536
|
-
(c = u[
|
|
535
|
+
const u = JSON.parse(a || "{}");
|
|
536
|
+
(c = u[t]) != null && c.$in ? (l = u[t]) == null || l.$in.forEach(
|
|
537
537
|
(d) => (n.get(d) ?? n.set(d, /* @__PURE__ */ new Set()).get(d)).add(r)
|
|
538
|
-
) :
|
|
538
|
+
) : i[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, s]) => ({
|
|
543
543
|
id: r,
|
|
544
|
-
setNames: [...
|
|
544
|
+
setNames: [...s]
|
|
545
545
|
}));
|
|
546
546
|
}
|
|
547
|
-
function Oe(e,
|
|
548
|
-
const o = (
|
|
549
|
-
const c = { ...
|
|
547
|
+
function Oe(e, t) {
|
|
548
|
+
const o = (i, u) => {
|
|
549
|
+
const c = { ...i }, 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, s) {
|
|
|
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((i) => [i.subject, i])), r = new Map(t.map((i) => [i.subject, i])), s = [], a = /* @__PURE__ */ new Set([...n.keys(), ...r.keys()]);
|
|
562
|
+
for (const i of a) {
|
|
563
|
+
const u = n.get(i), c = r.get(i);
|
|
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) && s.push(c);
|
|
569
569
|
continue;
|
|
570
570
|
}
|
|
571
|
-
const
|
|
572
|
-
(g) => !d[
|
|
571
|
+
const m = Object.keys(l)[0], f = l[m].$in.filter(
|
|
572
|
+
(g) => !d[m].$in.includes(g)
|
|
573
573
|
);
|
|
574
|
-
|
|
575
|
-
(g) => !l[
|
|
576
|
-
).length > 0 &&
|
|
574
|
+
f.length > 0 && s.push(o(u, f)), d[m].$in.filter(
|
|
575
|
+
(g) => !l[m].$in.includes(g)
|
|
576
|
+
).length > 0 && s.push(c);
|
|
577
577
|
} else if (!u.conditions && c.conditions)
|
|
578
|
-
|
|
578
|
+
s.push(c);
|
|
579
579
|
else if (u.conditions && !c.conditions)
|
|
580
|
-
y(JSON.parse(u.conditions)) ||
|
|
580
|
+
y(JSON.parse(u.conditions)) || s.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), m = c.actions.some((p) => !l.has(p)), f = u.actions.filter((p) => !d.has(p));
|
|
583
|
+
if (m) {
|
|
584
584
|
const p = c.actions.filter((g) => !l.has(g));
|
|
585
|
-
|
|
585
|
+
s.push({
|
|
586
586
|
...c,
|
|
587
587
|
actions: p
|
|
588
588
|
});
|
|
589
589
|
}
|
|
590
|
-
|
|
590
|
+
f.length > 0 && s.push({
|
|
591
591
|
...u,
|
|
592
|
-
actions:
|
|
592
|
+
actions: f,
|
|
593
593
|
inverted: !0
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
596
|
continue;
|
|
597
597
|
}
|
|
598
598
|
if (u) {
|
|
599
|
-
|
|
599
|
+
s.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, s) {
|
|
|
606
606
|
);
|
|
607
607
|
continue;
|
|
608
608
|
}
|
|
609
|
-
c &&
|
|
609
|
+
c && s.push(c);
|
|
610
610
|
}
|
|
611
|
-
return
|
|
611
|
+
return s;
|
|
612
612
|
}
|
|
613
613
|
function _e(e) {
|
|
614
|
-
const
|
|
614
|
+
const t = G(
|
|
615
615
|
e,
|
|
616
616
|
V
|
|
617
617
|
), o = new Set(
|
|
618
|
-
|
|
619
|
-
var
|
|
620
|
-
return ((
|
|
618
|
+
t.filter((r) => {
|
|
619
|
+
var s;
|
|
620
|
+
return ((s = r.source) == null ? void 0 : s.type) === "systemPermissionSet" && !r.inverted;
|
|
621
621
|
}).map((r) => r.subject)
|
|
622
622
|
), n = new Set(
|
|
623
|
-
|
|
623
|
+
t.filter(
|
|
624
624
|
(r) => {
|
|
625
|
-
var
|
|
626
|
-
return ((
|
|
625
|
+
var s;
|
|
626
|
+
return ((s = r.source) == null ? void 0 : s.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, t) {
|
|
634
634
|
const o = [], n = e.filter((r) => {
|
|
635
|
-
const
|
|
636
|
-
return !
|
|
635
|
+
const s = r.subject;
|
|
636
|
+
return !s.startsWith(re) || t.has(s) ? !0 : (o.push(s), !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, t) {
|
|
642
|
+
return e.conditions ? !!t.conditions && e.conditions === t.conditions : !t.conditions;
|
|
643
643
|
}
|
|
644
|
-
function Ne(e,
|
|
644
|
+
function Ne(e, t) {
|
|
645
645
|
const o = e.find(
|
|
646
|
-
(
|
|
646
|
+
(a) => !a.inverted && a.subject === ae
|
|
647
647
|
), n = e.find(
|
|
648
|
-
(
|
|
648
|
+
(a) => !a.inverted && a.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, s = n ? new Set(n.actions) : null;
|
|
652
|
+
return e.reduce((a, i) => {
|
|
653
|
+
if (i.inverted)
|
|
654
|
+
return a.push(i), a;
|
|
655
|
+
const u = i.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 a.push(i), a;
|
|
658
|
+
const c = t.has(u), l = c ? r : s, d = c ? o : n;
|
|
659
|
+
if (!l || !d || !ue(d, i))
|
|
660
|
+
return a.push(i), a;
|
|
661
|
+
if (l.has("manage")) return a;
|
|
662
|
+
const m = i.actions;
|
|
663
|
+
if (m.includes("manage"))
|
|
664
|
+
return a.push(i), a;
|
|
665
|
+
const f = new Set(m);
|
|
666
666
|
for (const p of l)
|
|
667
|
-
|
|
668
|
-
return
|
|
667
|
+
f.delete(p);
|
|
668
|
+
return f.size === 0 || a.push({ ...i, actions: Array.from(f) }), a;
|
|
669
669
|
}, []);
|
|
670
670
|
}
|
|
671
|
-
function M(e,
|
|
671
|
+
function M(e, t) {
|
|
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((s) => [s.subject, s]));
|
|
674
|
+
for (const s of t) {
|
|
675
|
+
if (s.inverted) {
|
|
676
|
+
const i = o.get(s.subject);
|
|
677
|
+
if (s.conditions) {
|
|
678
|
+
if (i != null && i.conditions) {
|
|
679
|
+
const u = JSON.parse(i.conditions), c = JSON.parse(s.conditions);
|
|
680
680
|
if (!y(u) || !y(c)) {
|
|
681
|
-
o.delete(
|
|
681
|
+
o.delete(s.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) ?? [], f = (((r = u[l]) == null ? void 0 : r.$in) ?? []).filter((p) => !d.includes(p));
|
|
685
|
+
f.length > 0 ? o.set(s.subject, {
|
|
686
|
+
...i,
|
|
687
|
+
conditions: JSON.stringify({ [l]: { $in: f } })
|
|
688
|
+
}) : o.delete(s.subject);
|
|
689
689
|
} else
|
|
690
|
-
o.delete(
|
|
690
|
+
o.delete(s.subject);
|
|
691
691
|
continue;
|
|
692
692
|
}
|
|
693
|
-
if (
|
|
694
|
-
const u = new Set(
|
|
695
|
-
c.length > 0 ? o.set(
|
|
693
|
+
if (i) {
|
|
694
|
+
const u = new Set(s.actions), c = i.actions.filter((l) => !u.has(l));
|
|
695
|
+
c.length > 0 ? o.set(s.subject, { ...i, actions: c }) : o.delete(s.subject);
|
|
696
696
|
continue;
|
|
697
697
|
}
|
|
698
698
|
continue;
|
|
699
699
|
}
|
|
700
|
-
if (
|
|
701
|
-
o.set(
|
|
700
|
+
if (s.conditions) {
|
|
701
|
+
o.set(s.subject, s);
|
|
702
702
|
continue;
|
|
703
703
|
}
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
706
|
-
o.set(
|
|
704
|
+
const a = o.get(s.subject);
|
|
705
|
+
if (a != null && a.conditions && !y(JSON.parse(a.conditions))) {
|
|
706
|
+
o.set(s.subject, s);
|
|
707
707
|
continue;
|
|
708
708
|
}
|
|
709
|
-
if (
|
|
710
|
-
const
|
|
709
|
+
if (a) {
|
|
710
|
+
const i = [
|
|
711
711
|
.../* @__PURE__ */ new Set([
|
|
712
|
-
...
|
|
713
|
-
...
|
|
712
|
+
...a.actions,
|
|
713
|
+
...s.actions
|
|
714
714
|
])
|
|
715
715
|
];
|
|
716
|
-
o.set(
|
|
716
|
+
o.set(s.subject, { ...a, actions: i });
|
|
717
717
|
} else
|
|
718
|
-
o.set(
|
|
718
|
+
o.set(s.subject, s);
|
|
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, t) {
|
|
723
|
+
const o = M(e, t), n = new Set(e.map((s) => s.subject)), r = t.filter(
|
|
724
|
+
(s) => s.inverted && !n.has(s.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, t) {
|
|
742
|
+
return b(await v().put(`${P}/${e}`, t));
|
|
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, t) {
|
|
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: t })
|
|
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 t() {
|
|
755
|
+
const i = await R.readAll();
|
|
756
|
+
e.value = i;
|
|
757
757
|
}
|
|
758
|
-
async function o(
|
|
759
|
-
return await R.readByUserId(
|
|
758
|
+
async function o(i) {
|
|
759
|
+
return await R.readByUserId(i);
|
|
760
760
|
}
|
|
761
|
-
async function n(
|
|
762
|
-
const u = await R.create(
|
|
761
|
+
async function n(i) {
|
|
762
|
+
const u = await R.create(i);
|
|
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(i, u) {
|
|
766
|
+
const c = await R.update(i, u);
|
|
767
|
+
e.value = e.value.map((l) => l.id === i ? c : l);
|
|
768
768
|
}
|
|
769
|
-
async function
|
|
770
|
-
await R.delete(
|
|
769
|
+
async function s(i) {
|
|
770
|
+
await R.delete(i), e.value = e.value.filter((u) => u.id !== i);
|
|
771
771
|
}
|
|
772
|
-
function i
|
|
773
|
-
return e.value.find((u) => u.userId ===
|
|
772
|
+
function a(i) {
|
|
773
|
+
return e.value.find((u) => u.userId === i);
|
|
774
774
|
}
|
|
775
775
|
return {
|
|
776
776
|
permissionAssignments: e,
|
|
777
|
-
readPermissionAssignments:
|
|
777
|
+
readPermissionAssignments: t,
|
|
778
778
|
readPermissionAssignmentByUserId: o,
|
|
779
779
|
createPermissionAssignment: n,
|
|
780
780
|
updatePermissionAssignment: r,
|
|
781
|
-
deletePermissionAssignment:
|
|
782
|
-
getPermissionAssignmentByUserId:
|
|
781
|
+
deletePermissionAssignment: s,
|
|
782
|
+
getPermissionAssignmentByUserId: a
|
|
783
783
|
};
|
|
784
|
-
}),
|
|
784
|
+
}), me = () => {
|
|
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
|
+
}, fe = {
|
|
791
|
+
async fetchReportPermissions(e, t) {
|
|
792
|
+
const o = t ? { lang: t } : {};
|
|
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, t) {
|
|
798
|
+
const o = t ? { isSupportPos: !1, lang: t } : { 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 t() {
|
|
807
|
+
var s;
|
|
808
|
+
const n = (s = e.currentBusiness.value) == null ? void 0 : s.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 a = await fe.fetchReportPermissionsForPortal(n, r);
|
|
819
819
|
if (I.value !== n) return;
|
|
820
|
-
C.value =
|
|
821
|
-
} catch (
|
|
820
|
+
C.value = a, T.value = !0, D.value = r;
|
|
821
|
+
} catch (a) {
|
|
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:", a), 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 t()));
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
}
|
|
@@ -846,25 +846,25 @@ function pe() {
|
|
|
846
846
|
}
|
|
847
847
|
));
|
|
848
848
|
return {
|
|
849
|
-
fetchCustomReportPermissions:
|
|
849
|
+
fetchCustomReportPermissions: t,
|
|
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 t = ne(), o = me(), n = te().restaurants, { customReportPermissions: r } = pe(), s = o.getPermissionAssignmentByUserId(e.id), a = H(
|
|
857
|
+
(s == null ? void 0 : s.permissionSetIds) ?? [],
|
|
858
|
+
t.permissionSets.value
|
|
859
|
+
), i = Q(a).map(
|
|
860
860
|
({ setNames: p, ...g }) => g
|
|
861
|
-
), u =
|
|
861
|
+
), u = s == null ? void 0 : s.customPermissions, c = u ?? e.permissions.map((p) => ({
|
|
862
862
|
...p,
|
|
863
863
|
subject: O(p.subject)
|
|
864
|
-
})), l = M(
|
|
865
|
-
le(
|
|
864
|
+
})), l = M(i, c), d = G(
|
|
865
|
+
le(i, c),
|
|
866
866
|
V
|
|
867
|
-
).filter((p) => !p.inverted),
|
|
867
|
+
).filter((p) => !p.inverted), m = ve(d), f = m ?? 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
|
+
f.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: m,
|
|
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 t = 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: t.items.map(A),
|
|
909
|
+
total: t.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, t) {
|
|
923
923
|
return A(
|
|
924
|
-
b(await v().put(`/portal-users/${e}`,
|
|
924
|
+
b(await v().put(`/portal-users/${e}`, t))
|
|
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((t) => t.posUserId);
|
|
932
932
|
}
|
|
933
933
|
};
|
|
934
|
-
function Te(e,
|
|
935
|
-
if (e.some((
|
|
934
|
+
function Te(e, t, o) {
|
|
935
|
+
if (e.some((a) => a.subject === "all")) return "All";
|
|
936
936
|
const n = (o ?? L).filter(
|
|
937
|
-
(
|
|
938
|
-
), r = new Set(n.map((
|
|
939
|
-
return
|
|
937
|
+
(a) => a.subject === t
|
|
938
|
+
), r = new Set(n.map((a) => w(a).value)), s = e.filter((a) => a.subject === t).filter((a) => r.has(w(a).value));
|
|
939
|
+
return s.length === n.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
|
|
940
940
|
}
|
|
941
941
|
function w(e) {
|
|
942
|
-
const
|
|
942
|
+
const t = Z(e), o = t.subject;
|
|
943
943
|
return {
|
|
944
|
-
...
|
|
944
|
+
...t,
|
|
945
945
|
get conditions() {
|
|
946
|
-
if (typeof
|
|
946
|
+
if (typeof t.conditions != "string") return t.conditions;
|
|
947
947
|
try {
|
|
948
|
-
return JSON.parse(
|
|
948
|
+
return JSON.parse(t.conditions);
|
|
949
949
|
} catch {
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
@@ -960,72 +960,92 @@ 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
|
+
},
|
|
963
984
|
get formatted() {
|
|
964
|
-
|
|
965
|
-
|
|
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();
|
|
985
|
+
const n = this.discriminator;
|
|
986
|
+
return n === void 0 ? o.toString() : n.endsWith("_") ? n.slice(0, n.length - 1) : n;
|
|
967
987
|
},
|
|
968
988
|
get label() {
|
|
969
|
-
return
|
|
989
|
+
return t.label || ee(this.formatted);
|
|
970
990
|
},
|
|
971
991
|
get value() {
|
|
972
|
-
|
|
973
|
-
return this.isOrderOperation
|
|
992
|
+
const n = this.discriminator;
|
|
993
|
+
return this.isOrderOperation || this.isReportPermission ? n === void 0 ? o.toString() : `${o}:${n}` : o.toString();
|
|
974
994
|
}
|
|
975
995
|
};
|
|
976
996
|
}
|
|
977
997
|
function Je(e) {
|
|
978
998
|
var n, r;
|
|
979
|
-
const
|
|
980
|
-
if (!
|
|
981
|
-
const o = Number((r = (n =
|
|
999
|
+
const t = e.map((s) => w(s)).find((s) => s.isDiscountOperation);
|
|
1000
|
+
if (!t) return 100;
|
|
1001
|
+
const o = Number((r = (n = t.conditions) == null ? void 0 : n.adjustment) == null ? void 0 : r.$lte);
|
|
982
1002
|
return Number.isFinite(o) ? parseInt((o * 100).toFixed(0)) : 0;
|
|
983
1003
|
}
|
|
984
1004
|
function ve(e) {
|
|
985
|
-
const
|
|
1005
|
+
const t = e.find(
|
|
986
1006
|
(o) => o.subject === _.Subject.Restaurant.restaurant
|
|
987
1007
|
);
|
|
988
|
-
return
|
|
1008
|
+
return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
|
|
989
1009
|
}
|
|
990
1010
|
function Ue(e) {
|
|
991
|
-
return (e == null ? void 0 : e.some((
|
|
1011
|
+
return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
|
|
992
1012
|
}
|
|
993
1013
|
function Be(e) {
|
|
994
|
-
const
|
|
995
|
-
return
|
|
1014
|
+
const t = e.find((o) => o.subject === _.Subject.Business.role);
|
|
1015
|
+
return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
|
|
996
1016
|
}
|
|
997
1017
|
function Le(e) {
|
|
998
|
-
const
|
|
999
|
-
if (!
|
|
1000
|
-
const { name: o, ...n } =
|
|
1018
|
+
const t = w(e);
|
|
1019
|
+
if (!t.isReportPermission) return;
|
|
1020
|
+
const { name: o, ...n } = t.conditions ?? {};
|
|
1001
1021
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
1002
1022
|
}
|
|
1003
|
-
function Me(e,
|
|
1023
|
+
function Me(e, t, o) {
|
|
1004
1024
|
return e.flatMap((n) => {
|
|
1005
1025
|
const r = ge(n);
|
|
1006
1026
|
if (!r) return [];
|
|
1007
|
-
const
|
|
1027
|
+
const s = r.isReportPermission ? o == null ? void 0 : o.get(n) : void 0;
|
|
1008
1028
|
return [
|
|
1009
1029
|
{
|
|
1010
1030
|
subject: r.subject,
|
|
1011
1031
|
actions: r.actions,
|
|
1012
1032
|
conditions: {
|
|
1013
1033
|
...r.conditions,
|
|
1014
|
-
...
|
|
1015
|
-
adjustment: r.isDiscountOperation ? { $lte: parseFloat((
|
|
1034
|
+
...s ?? {},
|
|
1035
|
+
adjustment: r.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
|
|
1016
1036
|
}
|
|
1017
1037
|
}
|
|
1018
1038
|
];
|
|
1019
1039
|
});
|
|
1020
1040
|
}
|
|
1021
1041
|
function ge(e) {
|
|
1022
|
-
const
|
|
1023
|
-
if (
|
|
1042
|
+
const t = e.indexOf(":"), o = t === -1 ? e : e.slice(0, t), n = t === -1 ? void 0 : e.slice(t + 1);
|
|
1043
|
+
if (t !== -1 && !n) return;
|
|
1024
1044
|
let r;
|
|
1025
|
-
return n ? (r = L.find((
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1028
|
-
return [
|
|
1045
|
+
return n ? (r = L.find((s) => {
|
|
1046
|
+
if (s.subject !== o) return !1;
|
|
1047
|
+
const a = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
|
|
1048
|
+
return [a == null ? void 0 : a.operation, a == null ? void 0 : a.name].includes(n);
|
|
1029
1049
|
}), !r && o === h.F_RULE_SUBJECT.enum.report && (r = {
|
|
1030
1050
|
label: "",
|
|
1031
1051
|
subject: h.F_RULE_SUBJECT.enum.report,
|
|
@@ -1033,9 +1053,9 @@ function ge(e) {
|
|
|
1033
1053
|
conditions: { name: n },
|
|
1034
1054
|
inverted: !1,
|
|
1035
1055
|
reason: ""
|
|
1036
|
-
})) : r = L.find((
|
|
1056
|
+
})) : r = L.find((s) => s.subject === o), r ? w(r) : void 0;
|
|
1037
1057
|
}
|
|
1038
|
-
function Fe(e,
|
|
1058
|
+
function Fe(e, t) {
|
|
1039
1059
|
const o = { values: [], passthrough: [], dropped: [] };
|
|
1040
1060
|
for (const n of e) {
|
|
1041
1061
|
const r = n == null ? void 0 : n.actions;
|
|
@@ -1043,20 +1063,20 @@ function Fe(e, s) {
|
|
|
1043
1063
|
o.dropped.push(n);
|
|
1044
1064
|
continue;
|
|
1045
1065
|
}
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1066
|
+
const s = w(n).value, a = `${h.F_RULE_SUBJECT.enum.report}:`, i = s.startsWith(a) ? s.slice(a.length) : "";
|
|
1067
|
+
t.has(s) || i && i !== "undefined" ? o.values.push(s) : o.passthrough.push(n);
|
|
1048
1068
|
}
|
|
1049
1069
|
return o;
|
|
1050
1070
|
}
|
|
1051
|
-
function Se(e,
|
|
1071
|
+
function Se(e, t = []) {
|
|
1052
1072
|
return W(
|
|
1053
1073
|
e.reduce((o, n) => {
|
|
1054
1074
|
const r = be.find(
|
|
1055
|
-
(
|
|
1056
|
-
) ||
|
|
1075
|
+
(s) => s.subject === n.subject && n.actions.includes("manage")
|
|
1076
|
+
) || t.find((s) => s.subject === n.subject);
|
|
1057
1077
|
if (r) {
|
|
1058
|
-
const
|
|
1059
|
-
o.push(
|
|
1078
|
+
const s = r.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : r.label;
|
|
1079
|
+
o.push(s);
|
|
1060
1080
|
}
|
|
1061
1081
|
return o;
|
|
1062
1082
|
}, [])
|
|
@@ -1065,7 +1085,7 @@ function Se(e, s = []) {
|
|
|
1065
1085
|
export {
|
|
1066
1086
|
G as N,
|
|
1067
1087
|
Q as P,
|
|
1068
|
-
|
|
1088
|
+
fe as R,
|
|
1069
1089
|
Le as a,
|
|
1070
1090
|
Te as b,
|
|
1071
1091
|
H as c,
|
|
@@ -1088,7 +1108,7 @@ export {
|
|
|
1088
1108
|
Ce as t,
|
|
1089
1109
|
ne as u,
|
|
1090
1110
|
Ne as v,
|
|
1091
|
-
|
|
1111
|
+
me as w,
|
|
1092
1112
|
Se as x,
|
|
1093
1113
|
Ae as y
|
|
1094
1114
|
};
|