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