@feedmepos/mf-hrm-portal 2.0.10-dev → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AuditLogList-DICsmRKu.js +915 -0
- package/dist/{EmployeeList-B3qXFaOz.js → EmployeeList-BeTBQG6y.js} +164 -169
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js +71 -0
- package/dist/HorizontalSplitter-o860F4xM.js +12 -0
- package/dist/Main-6YVJ8qeK.js +560 -0
- package/dist/{Main-urBwZXUq.js → Main-BSaeTSWh.js} +8 -7
- package/dist/{Main-JUX88mXA.js → Main-D9233aXd.js} +11 -10
- package/dist/PermissionSetList-vA7XmeDX.js +338 -0
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CrL1DmdL.js +3479 -0
- package/dist/{RoleList-Dl7042_3.js → RoleList-BwZRlJSm.js} +26 -24
- package/dist/TeamMemberList-DqMVgyU0.js +989 -0
- package/dist/{TimesheetList-B3cmnZN5.js → TimesheetList-HsH2fi2o.js} +11 -10
- package/dist/{app-DHFWqcG2.js → app-CvSQBSNk.js} +2376 -1092
- package/dist/app.js +2 -2
- package/dist/{dayjs.min-faWeeWGk.js → dayjs.min-Cje6yZS4.js} +1 -1
- package/dist/{employee-sOy9OKvU.js → employee-Bvza5QKq.js} +21 -20
- package/dist/index-CUPMZ2Nm.js +975 -0
- package/dist/{index-DNsMh7eu.js → index-J8WRP1Mb.js} +1 -1
- package/dist/{index-EeD0w_Es.js → iteration-tLtr3UA8.js} +3444 -4352
- package/dist/{lodash-CfsS7nDC.js → lodash-CrQQQutG.js} +1 -1
- package/dist/src/api/audit-log/index.d.ts +1 -0
- package/dist/src/api/grant-user/index.d.ts +8 -0
- package/dist/src/api/index.d.ts +3 -1
- package/dist/src/composables/useBasePermission.d.ts +37 -0
- package/dist/src/helpers/permission-set.d.ts +34 -5
- package/dist/src/helpers/permission-set.test.d.ts +1 -0
- package/dist/src/helpers/permission-sync.d.ts +12 -0
- package/dist/src/router/shared.d.ts +2 -1
- package/dist/src/stores/grant-user.d.ts +86 -0
- package/dist/src/types/grant-user.d.ts +27 -0
- package/dist/src/views/audit-log/components/AuditLogModuleTabs.vue.d.ts +17 -0
- package/dist/src/views/audit-log/constants.d.ts +30 -0
- package/dist/src/views/audit-log/locales/index.d.ts +244 -0
- package/dist/src/views/grant/GrantUserList.vue.d.ts +17 -0
- package/dist/src/views/grant/Main.vue.d.ts +2 -0
- package/dist/src/views/grant/components/GrantUserForm.vue.d.ts +17 -0
- package/dist/src/views/grant/locales/index.d.ts +232 -0
- package/dist/src/views/team/components/BasePermission.vue.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/{team-CTYZ-AfE.js → team-eAkNf8XU.js} +1 -1
- package/dist/{timesheet-CP-usx78.js → timesheet-Cj5r4laf.js} +10 -9
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-DpKptyzk.js → useAppStore-BFge6TcH.js} +1 -1
- package/dist/{useLoading-D0NWMSr4.js → useLoading-D5jjAdvm.js} +1 -1
- package/dist/{useReportPermissions-CtnMIyaq.js → useReportPermissions-BeIK2wRH.js} +12 -11
- package/dist/useRestaurantMap-e9fQJiLC.js +39 -0
- package/package.json +3 -3
- package/dist/AuditLogList-BqKDq3NZ.js +0 -492
- package/dist/PermissionSetList-BfCuoHa3.js +0 -327
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BYZbAUtK.js +0 -3334
- package/dist/TeamMemberList-BrZDh51J.js +0 -979
- package/dist/useRestaurantMap-D5BNPLKh.js +0 -107
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
import { g as b, b as g, d as X, e as j, s as L, q as M } from "./iteration-tLtr3UA8.js";
|
|
2
|
+
import { u as J, b as R, P as F, p as D, e as S, k as Q } from "./app-CvSQBSNk.js";
|
|
3
|
+
import { defineStore as x, storeToRefs as k } from "pinia";
|
|
4
|
+
import { ref as h, computed as N } from "vue";
|
|
5
|
+
import { useCoreStore as q } from "@feedmepos/mf-common";
|
|
6
|
+
const T = [
|
|
7
|
+
{
|
|
8
|
+
label: "",
|
|
9
|
+
subject: "order",
|
|
10
|
+
actions: ["update"],
|
|
11
|
+
conditions: {
|
|
12
|
+
operation: "discount",
|
|
13
|
+
adjustment: {
|
|
14
|
+
$lte: 1
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
inverted: !1,
|
|
18
|
+
reason: null
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "",
|
|
22
|
+
subject: "order",
|
|
23
|
+
actions: ["update"],
|
|
24
|
+
conditions: { operation: "changePrice" },
|
|
25
|
+
inverted: !1,
|
|
26
|
+
reason: null
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "",
|
|
30
|
+
subject: "order",
|
|
31
|
+
actions: ["update"],
|
|
32
|
+
conditions: { operation: "void" },
|
|
33
|
+
inverted: !1,
|
|
34
|
+
reason: null
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "",
|
|
38
|
+
subject: "order",
|
|
39
|
+
actions: ["update"],
|
|
40
|
+
conditions: { operation: "payment" },
|
|
41
|
+
inverted: !1,
|
|
42
|
+
reason: null
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "",
|
|
46
|
+
subject: "order",
|
|
47
|
+
actions: ["update"],
|
|
48
|
+
conditions: { operation: "claimDeposit" },
|
|
49
|
+
inverted: !1,
|
|
50
|
+
reason: null
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "",
|
|
54
|
+
subject: "order",
|
|
55
|
+
actions: ["update"],
|
|
56
|
+
conditions: { operation: "resend" },
|
|
57
|
+
inverted: !1,
|
|
58
|
+
reason: null
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "",
|
|
62
|
+
subject: "order",
|
|
63
|
+
actions: ["update"],
|
|
64
|
+
conditions: { operation: "changePaymentType" },
|
|
65
|
+
inverted: !1,
|
|
66
|
+
reason: null
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "",
|
|
70
|
+
subject: "refund",
|
|
71
|
+
actions: ["create"],
|
|
72
|
+
conditions: null,
|
|
73
|
+
inverted: !1,
|
|
74
|
+
reason: null
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "",
|
|
78
|
+
subject: "counter",
|
|
79
|
+
actions: ["manage"],
|
|
80
|
+
conditions: null,
|
|
81
|
+
inverted: !1,
|
|
82
|
+
reason: null
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "",
|
|
86
|
+
subject: "mallIntegration",
|
|
87
|
+
actions: ["manage"],
|
|
88
|
+
conditions: null,
|
|
89
|
+
inverted: !1,
|
|
90
|
+
reason: null
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "",
|
|
94
|
+
subject: "drawer",
|
|
95
|
+
actions: ["manage"],
|
|
96
|
+
conditions: null,
|
|
97
|
+
inverted: !1,
|
|
98
|
+
reason: null
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: "",
|
|
102
|
+
subject: "menu",
|
|
103
|
+
actions: ["manage"],
|
|
104
|
+
conditions: null,
|
|
105
|
+
inverted: !1,
|
|
106
|
+
reason: null
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: "",
|
|
110
|
+
subject: "inventory",
|
|
111
|
+
actions: ["manage"],
|
|
112
|
+
conditions: null,
|
|
113
|
+
inverted: !1,
|
|
114
|
+
reason: null
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: "",
|
|
118
|
+
subject: "deposit",
|
|
119
|
+
actions: ["manage"],
|
|
120
|
+
conditions: null,
|
|
121
|
+
inverted: !1,
|
|
122
|
+
reason: null
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: "",
|
|
126
|
+
subject: "delivery",
|
|
127
|
+
actions: ["manage"],
|
|
128
|
+
conditions: null,
|
|
129
|
+
inverted: !1,
|
|
130
|
+
reason: null
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: "",
|
|
134
|
+
subject: "counterRecord",
|
|
135
|
+
actions: ["manage"],
|
|
136
|
+
conditions: null,
|
|
137
|
+
inverted: !1,
|
|
138
|
+
reason: null
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "",
|
|
142
|
+
subject: "restaurantSetting",
|
|
143
|
+
actions: ["manage"],
|
|
144
|
+
conditions: null,
|
|
145
|
+
inverted: !1,
|
|
146
|
+
reason: null
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
label: "",
|
|
150
|
+
subject: "display",
|
|
151
|
+
actions: ["manage"],
|
|
152
|
+
conditions: null,
|
|
153
|
+
inverted: !1,
|
|
154
|
+
reason: null
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: "",
|
|
158
|
+
subject: "printer",
|
|
159
|
+
actions: ["manage"],
|
|
160
|
+
conditions: null,
|
|
161
|
+
inverted: !1,
|
|
162
|
+
reason: null
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: "",
|
|
166
|
+
subject: "table",
|
|
167
|
+
actions: ["manage"],
|
|
168
|
+
conditions: null,
|
|
169
|
+
inverted: !1,
|
|
170
|
+
reason: null
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "",
|
|
174
|
+
subject: "employee",
|
|
175
|
+
actions: ["manage"],
|
|
176
|
+
conditions: null,
|
|
177
|
+
inverted: !1,
|
|
178
|
+
reason: null
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: "",
|
|
182
|
+
subject: "system",
|
|
183
|
+
actions: ["manage"],
|
|
184
|
+
conditions: null,
|
|
185
|
+
inverted: !1,
|
|
186
|
+
reason: null
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: "",
|
|
190
|
+
subject: "tax",
|
|
191
|
+
actions: ["manage"],
|
|
192
|
+
conditions: null,
|
|
193
|
+
inverted: !1,
|
|
194
|
+
reason: null
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: "",
|
|
198
|
+
subject: "paymentType",
|
|
199
|
+
actions: ["manage"],
|
|
200
|
+
conditions: null,
|
|
201
|
+
inverted: !1,
|
|
202
|
+
reason: null
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "",
|
|
206
|
+
subject: "faceId",
|
|
207
|
+
actions: ["manage"],
|
|
208
|
+
conditions: null,
|
|
209
|
+
inverted: !1,
|
|
210
|
+
reason: null
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
label: "",
|
|
214
|
+
subject: "report",
|
|
215
|
+
actions: ["read"],
|
|
216
|
+
conditions: { name: "closeup" },
|
|
217
|
+
inverted: !1,
|
|
218
|
+
reason: ""
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
label: "",
|
|
222
|
+
subject: "report",
|
|
223
|
+
actions: ["read"],
|
|
224
|
+
conditions: { name: "counter" },
|
|
225
|
+
inverted: !1,
|
|
226
|
+
reason: ""
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
label: "",
|
|
230
|
+
subject: "report",
|
|
231
|
+
actions: ["read"],
|
|
232
|
+
conditions: { name: "hourlySales" },
|
|
233
|
+
inverted: !1,
|
|
234
|
+
reason: ""
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
label: "",
|
|
238
|
+
subject: "report",
|
|
239
|
+
actions: ["read"],
|
|
240
|
+
conditions: { name: "dailySales" },
|
|
241
|
+
inverted: !1,
|
|
242
|
+
reason: ""
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
label: "",
|
|
246
|
+
subject: "report",
|
|
247
|
+
actions: ["read"],
|
|
248
|
+
conditions: { name: "productSales" },
|
|
249
|
+
inverted: !1,
|
|
250
|
+
reason: ""
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
label: "",
|
|
254
|
+
subject: "report",
|
|
255
|
+
actions: ["read"],
|
|
256
|
+
conditions: { name: "sourceProductSales" },
|
|
257
|
+
inverted: !1,
|
|
258
|
+
reason: ""
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
label: "",
|
|
262
|
+
subject: "report",
|
|
263
|
+
actions: ["read"],
|
|
264
|
+
conditions: { name: "userProductSales" },
|
|
265
|
+
inverted: !1,
|
|
266
|
+
reason: ""
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
label: "",
|
|
270
|
+
subject: "report",
|
|
271
|
+
actions: ["read"],
|
|
272
|
+
conditions: { name: "categorySales" },
|
|
273
|
+
inverted: !1,
|
|
274
|
+
reason: ""
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
label: "",
|
|
278
|
+
subject: "report",
|
|
279
|
+
actions: ["read"],
|
|
280
|
+
conditions: { name: "addonSales" },
|
|
281
|
+
inverted: !1,
|
|
282
|
+
reason: ""
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
label: "",
|
|
286
|
+
subject: "report",
|
|
287
|
+
actions: ["read"],
|
|
288
|
+
conditions: { name: "slotSales" },
|
|
289
|
+
inverted: !1,
|
|
290
|
+
reason: ""
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: "",
|
|
294
|
+
subject: "report",
|
|
295
|
+
actions: ["read"],
|
|
296
|
+
conditions: { name: "drawer" },
|
|
297
|
+
inverted: !1,
|
|
298
|
+
reason: ""
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
label: "",
|
|
302
|
+
subject: "report",
|
|
303
|
+
actions: ["read"],
|
|
304
|
+
conditions: { name: "discount" },
|
|
305
|
+
inverted: !1,
|
|
306
|
+
reason: ""
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
label: "",
|
|
310
|
+
subject: "report",
|
|
311
|
+
actions: ["read"],
|
|
312
|
+
conditions: { name: "refund" },
|
|
313
|
+
inverted: !1,
|
|
314
|
+
reason: ""
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
label: "",
|
|
318
|
+
subject: "report",
|
|
319
|
+
actions: ["read"],
|
|
320
|
+
conditions: { name: "void" },
|
|
321
|
+
inverted: !1,
|
|
322
|
+
reason: ""
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
label: "",
|
|
326
|
+
subject: "report",
|
|
327
|
+
actions: ["read"],
|
|
328
|
+
conditions: { name: "timesheet" },
|
|
329
|
+
inverted: !1,
|
|
330
|
+
reason: ""
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
label: "",
|
|
334
|
+
subject: "report",
|
|
335
|
+
actions: ["read"],
|
|
336
|
+
conditions: { name: "counterPayment" },
|
|
337
|
+
inverted: !1,
|
|
338
|
+
reason: ""
|
|
339
|
+
}
|
|
340
|
+
], A = "/permission-sets", I = {
|
|
341
|
+
async read() {
|
|
342
|
+
return b(await g().get(A));
|
|
343
|
+
},
|
|
344
|
+
async create(e) {
|
|
345
|
+
return b(await g().post(A, e));
|
|
346
|
+
},
|
|
347
|
+
async update(e, t) {
|
|
348
|
+
return b(await g().put(`${A}/${e}`, t));
|
|
349
|
+
},
|
|
350
|
+
async delete(e) {
|
|
351
|
+
return b(await g().delete(`${A}/${e}`));
|
|
352
|
+
}
|
|
353
|
+
}, Z = x("permissionSet", () => {
|
|
354
|
+
const e = h([]);
|
|
355
|
+
async function t() {
|
|
356
|
+
const a = await I.read();
|
|
357
|
+
e.value = n(a);
|
|
358
|
+
}
|
|
359
|
+
async function s(a) {
|
|
360
|
+
const i = await I.create(a);
|
|
361
|
+
e.value = n([...e.value, i]);
|
|
362
|
+
}
|
|
363
|
+
async function o(a, i) {
|
|
364
|
+
const c = await I.update(a, i);
|
|
365
|
+
e.value = n(e.value.map((u) => u.id === a ? c : u));
|
|
366
|
+
}
|
|
367
|
+
async function r(a) {
|
|
368
|
+
await I.delete(a), e.value = n(e.value.filter((i) => i.id !== a));
|
|
369
|
+
}
|
|
370
|
+
function n(a) {
|
|
371
|
+
return a.sort((i, c) => i.name.localeCompare(c.name));
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
permissionSets: e,
|
|
375
|
+
readPermissionSets: t,
|
|
376
|
+
createPermissionSet: s,
|
|
377
|
+
updatePermissionSet: o,
|
|
378
|
+
deletePermissionSet: r
|
|
379
|
+
};
|
|
380
|
+
}), G = () => {
|
|
381
|
+
const e = Z();
|
|
382
|
+
return {
|
|
383
|
+
...e,
|
|
384
|
+
...k(e)
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
function Se(e) {
|
|
388
|
+
let t = e.substring(e.indexOf("_") + 1);
|
|
389
|
+
return t.includes("_") && (t = t.substring(0, t.lastIndexOf("_"))), Number.isNaN(Date.parse(t)) ? null : new Date(t).toISOString();
|
|
390
|
+
}
|
|
391
|
+
function je(e) {
|
|
392
|
+
const t = Math.floor(e / 60), s = e % 60;
|
|
393
|
+
return `${t}h ${s.toString().padStart(2, "0")}m`;
|
|
394
|
+
}
|
|
395
|
+
function H(e) {
|
|
396
|
+
const t = e.replace(/([A-Z])/g, " $1");
|
|
397
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
398
|
+
}
|
|
399
|
+
function ye(e, t, s) {
|
|
400
|
+
if (e.some((a) => a.subject === "all")) return "All";
|
|
401
|
+
const o = (s ?? T).filter(
|
|
402
|
+
(a) => a.subject === t
|
|
403
|
+
), r = new Set(o.map((a) => E(a).value)), n = e.filter((a) => a.subject === t).filter((a) => r.has(E(a).value));
|
|
404
|
+
return n.length === o.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
|
|
405
|
+
}
|
|
406
|
+
function E(e) {
|
|
407
|
+
const t = X(e), s = t.subject;
|
|
408
|
+
return {
|
|
409
|
+
...t,
|
|
410
|
+
get conditions() {
|
|
411
|
+
return typeof t.conditions == "string" ? JSON.parse(t.conditions) : t.conditions;
|
|
412
|
+
},
|
|
413
|
+
get isDiscountOperation() {
|
|
414
|
+
var o;
|
|
415
|
+
return s === j.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === j.F_RULE_ORDER_OPERATION.enum.discount;
|
|
416
|
+
},
|
|
417
|
+
get isOrderOperation() {
|
|
418
|
+
return s === j.F_RULE_SUBJECT.enum.order;
|
|
419
|
+
},
|
|
420
|
+
get isReportPermission() {
|
|
421
|
+
return s === j.F_RULE_SUBJECT.enum.report;
|
|
422
|
+
},
|
|
423
|
+
get formatted() {
|
|
424
|
+
const o = (r) => r.endsWith("_") ? r.slice(0, r.length - 1) : r;
|
|
425
|
+
return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : s.toString();
|
|
426
|
+
},
|
|
427
|
+
get label() {
|
|
428
|
+
return t.label || H(this.formatted);
|
|
429
|
+
},
|
|
430
|
+
get value() {
|
|
431
|
+
return this.isOrderOperation ? `${s}:${this.conditions.operation}` : this.isReportPermission ? `${s}:${this.conditions.name}` : s.toString();
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function he(e) {
|
|
436
|
+
const t = e.map((s) => E(s)).find((s) => s.isDiscountOperation);
|
|
437
|
+
return t ? parseInt((t.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
|
|
438
|
+
}
|
|
439
|
+
function Y(e) {
|
|
440
|
+
const t = e.find(
|
|
441
|
+
(s) => s.subject === J.Subject.Restaurant.restaurant
|
|
442
|
+
);
|
|
443
|
+
return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
|
|
444
|
+
}
|
|
445
|
+
function Pe(e) {
|
|
446
|
+
return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
|
|
447
|
+
}
|
|
448
|
+
function we(e) {
|
|
449
|
+
const t = e.find((s) => s.subject === J.Subject.Business.role);
|
|
450
|
+
return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
|
|
451
|
+
}
|
|
452
|
+
function $e(e, t) {
|
|
453
|
+
return e.map((s) => {
|
|
454
|
+
const o = ee(s);
|
|
455
|
+
return {
|
|
456
|
+
subject: o.subject,
|
|
457
|
+
actions: o.actions,
|
|
458
|
+
conditions: {
|
|
459
|
+
...o.conditions,
|
|
460
|
+
adjustment: o.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
function ee(e) {
|
|
466
|
+
const [t, s] = e.split(":");
|
|
467
|
+
let o;
|
|
468
|
+
return s ? (o = T.find(
|
|
469
|
+
(r) => r.subject === t && [
|
|
470
|
+
(typeof r.conditions == "object" ? r.conditions : JSON.parse(r.conditions)).operation,
|
|
471
|
+
r.conditions.name
|
|
472
|
+
].includes(s)
|
|
473
|
+
), !o && t === j.F_RULE_SUBJECT.enum.report && (o = {
|
|
474
|
+
label: "",
|
|
475
|
+
subject: j.F_RULE_SUBJECT.enum.report,
|
|
476
|
+
actions: ["read"],
|
|
477
|
+
conditions: { name: s },
|
|
478
|
+
inverted: !1,
|
|
479
|
+
reason: ""
|
|
480
|
+
})) : o = T.find((r) => r.subject === t), E(o || { subject: j.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
|
|
481
|
+
}
|
|
482
|
+
function ne(e, t = []) {
|
|
483
|
+
return L(
|
|
484
|
+
e.reduce((s, o) => {
|
|
485
|
+
const r = me.find((n) => n.subject === o.subject) || t.find((n) => n.subject === o.subject);
|
|
486
|
+
if (r) {
|
|
487
|
+
const n = r.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : r.label;
|
|
488
|
+
s.push(n);
|
|
489
|
+
}
|
|
490
|
+
return s;
|
|
491
|
+
}, [])
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
function W(e) {
|
|
495
|
+
const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = (r, n, a) => {
|
|
496
|
+
var i, c;
|
|
497
|
+
const u = `${n.subject}::${JSON.stringify([...n.actions].sort())}`, l = r.get(u);
|
|
498
|
+
if (!l) {
|
|
499
|
+
r.set(u, { ...n, setNames: [a.name], setId: a._id });
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (l.setNames.push(a.name), l.conditions && n.conditions) {
|
|
503
|
+
const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
|
|
504
|
+
for (const m in p)
|
|
505
|
+
(i = d[m]) != null && i.$in && (c = p[m]) != null && c.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
|
|
506
|
+
l.conditions = JSON.stringify(d);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
for (const r of e)
|
|
510
|
+
for (const n of r.permissions)
|
|
511
|
+
o(n.inverted ? s : t, n, r);
|
|
512
|
+
return [...Array.from(t.values()), ...Array.from(s.values())];
|
|
513
|
+
}
|
|
514
|
+
function C(e, t) {
|
|
515
|
+
return `${e}::${[...t].sort().join(",")}`;
|
|
516
|
+
}
|
|
517
|
+
function z(e, t) {
|
|
518
|
+
const s = [...e], o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
519
|
+
for (const i of e) {
|
|
520
|
+
const c = R(i.subject);
|
|
521
|
+
o.add(C(c, i.actions)), i.inverted && i.actions.includes("manage") && r.add(`set_${c}`), !i.inverted && i.actions.includes("manage") && n.add(c);
|
|
522
|
+
}
|
|
523
|
+
const a = [...e];
|
|
524
|
+
for (; a.length > 0; ) {
|
|
525
|
+
const i = a.shift(), c = `set_${R(i.subject)}`, u = t[c];
|
|
526
|
+
if (!u || r.has(c) || !i.actions.includes("manage") || i.inverted) continue;
|
|
527
|
+
r.add(c);
|
|
528
|
+
const l = te(i);
|
|
529
|
+
i.source && !i.source.trace && (i.source = { ...i.source, trace: l });
|
|
530
|
+
const d = [...l, `${u.name} (system)`];
|
|
531
|
+
for (const p of u.permissions ?? []) {
|
|
532
|
+
const m = R(p.subject), f = C(m, p.actions);
|
|
533
|
+
o.has(f) || n.has(m) || (o.add(f), s.push({
|
|
534
|
+
...p,
|
|
535
|
+
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
536
|
+
fields: p.fields ?? void 0,
|
|
537
|
+
source: {
|
|
538
|
+
type: "systemPermissionSet",
|
|
539
|
+
permissionSetId: u.key,
|
|
540
|
+
permissionSetName: u.name,
|
|
541
|
+
trace: d
|
|
542
|
+
}
|
|
543
|
+
}));
|
|
544
|
+
}
|
|
545
|
+
for (const p of u.permissionSets ?? []) {
|
|
546
|
+
const m = R(p), f = C(m, ["manage"]), v = {
|
|
547
|
+
subject: m,
|
|
548
|
+
actions: ["manage"],
|
|
549
|
+
source: {
|
|
550
|
+
type: "systemPermissionSet",
|
|
551
|
+
permissionSetId: u.key,
|
|
552
|
+
permissionSetName: u.name,
|
|
553
|
+
trace: d
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
o.has(f) || (o.add(f), s.push(v)), a.push(v);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return [...s.filter((i) => !i.inverted), ...s.filter((i) => i.inverted)];
|
|
560
|
+
}
|
|
561
|
+
function te(e) {
|
|
562
|
+
if (!e.source) return [];
|
|
563
|
+
const { type: t, trace: s, permissionSetName: o } = e.source;
|
|
564
|
+
if (s && s.length > 0) return s;
|
|
565
|
+
switch (t) {
|
|
566
|
+
case "permissionSet":
|
|
567
|
+
return o ? [o] : [];
|
|
568
|
+
case "custom":
|
|
569
|
+
return ["custom"];
|
|
570
|
+
default:
|
|
571
|
+
return [];
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function V(e, t, s = /* @__PURE__ */ new Set()) {
|
|
575
|
+
var r;
|
|
576
|
+
const o = [];
|
|
577
|
+
for (const n of e) {
|
|
578
|
+
if (s.has(n)) continue;
|
|
579
|
+
s.add(n);
|
|
580
|
+
const a = t.find((i) => i.id === n);
|
|
581
|
+
a && (o.push(a), (r = a.permissionSetIds) != null && r.length && o.push(...V(a.permissionSetIds, t, s)));
|
|
582
|
+
}
|
|
583
|
+
return o;
|
|
584
|
+
}
|
|
585
|
+
function Re(e) {
|
|
586
|
+
const t = W(e).map(
|
|
587
|
+
({ setNames: r, setId: n, ...a }) => a
|
|
588
|
+
), s = t.filter((r) => !r.inverted), o = t.filter((r) => r.inverted);
|
|
589
|
+
return B(s, o);
|
|
590
|
+
}
|
|
591
|
+
function Ae(e, t, s) {
|
|
592
|
+
const o = /* @__PURE__ */ new Map();
|
|
593
|
+
return e.forEach(
|
|
594
|
+
({ name: r, permissions: n }) => n.forEach(({ conditions: a, actions: i }) => {
|
|
595
|
+
var u, l;
|
|
596
|
+
const c = JSON.parse(a || "{}");
|
|
597
|
+
(u = c[t]) != null && u.$in ? (l = c[t]) == null || l.$in.forEach(
|
|
598
|
+
(d) => (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(r)
|
|
599
|
+
) : i[0] === "manage" && s.forEach((d) => {
|
|
600
|
+
(o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(r);
|
|
601
|
+
});
|
|
602
|
+
})
|
|
603
|
+
), [...o].map(([r, n]) => ({
|
|
604
|
+
id: r,
|
|
605
|
+
setNames: [...n]
|
|
606
|
+
}));
|
|
607
|
+
}
|
|
608
|
+
function Ie(e, t) {
|
|
609
|
+
const s = (i, c) => {
|
|
610
|
+
const u = { ...i }, l = JSON.parse(u.conditions || "{}");
|
|
611
|
+
if (c)
|
|
612
|
+
if (c.length > 0) {
|
|
613
|
+
const d = Object.keys(l)[0];
|
|
614
|
+
l[d].$in = c;
|
|
615
|
+
} else
|
|
616
|
+
delete u.conditions;
|
|
617
|
+
return {
|
|
618
|
+
...u,
|
|
619
|
+
inverted: !0,
|
|
620
|
+
...u.conditions && { conditions: JSON.stringify(l) }
|
|
621
|
+
};
|
|
622
|
+
}, o = new Map(e.map((i) => [i.subject, i])), r = new Map(t.map((i) => [i.subject, i])), n = [], a = /* @__PURE__ */ new Set([...o.keys(), ...r.keys()]);
|
|
623
|
+
for (const i of a) {
|
|
624
|
+
const c = o.get(i), u = r.get(i);
|
|
625
|
+
if (c && u) {
|
|
626
|
+
if (c.conditions && u.conditions) {
|
|
627
|
+
const l = JSON.parse(c.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
|
|
628
|
+
(v) => !d[p].$in.includes(v)
|
|
629
|
+
);
|
|
630
|
+
m.length > 0 && n.push(s(c, m)), d[p].$in.filter(
|
|
631
|
+
(v) => !l[p].$in.includes(v)
|
|
632
|
+
).length > 0 && n.push(u);
|
|
633
|
+
} else if (!c.conditions && u.conditions)
|
|
634
|
+
n.push(u);
|
|
635
|
+
else if (!c.conditions && !u.conditions) {
|
|
636
|
+
const l = new Set(c.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = c.actions.filter((f) => !d.has(f));
|
|
637
|
+
if (p) {
|
|
638
|
+
const f = u.actions.filter((v) => !l.has(v));
|
|
639
|
+
n.push({
|
|
640
|
+
...u,
|
|
641
|
+
actions: f
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
m.length > 0 && n.push({
|
|
645
|
+
...c,
|
|
646
|
+
actions: m,
|
|
647
|
+
inverted: !0
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
if (c) {
|
|
653
|
+
n.push(
|
|
654
|
+
s(
|
|
655
|
+
c,
|
|
656
|
+
// If base has conditions, set diffIds to empty array, disallow all access to collection
|
|
657
|
+
// otherwise, invert directly
|
|
658
|
+
c.conditions && []
|
|
659
|
+
)
|
|
660
|
+
);
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
u && n.push(u);
|
|
664
|
+
}
|
|
665
|
+
return n;
|
|
666
|
+
}
|
|
667
|
+
function Oe(e) {
|
|
668
|
+
const t = z(
|
|
669
|
+
e,
|
|
670
|
+
F
|
|
671
|
+
), s = new Set(
|
|
672
|
+
t.filter((r) => {
|
|
673
|
+
var n;
|
|
674
|
+
return ((n = r.source) == null ? void 0 : n.type) === "systemPermissionSet" && !r.inverted;
|
|
675
|
+
}).map((r) => r.subject)
|
|
676
|
+
), o = new Set(
|
|
677
|
+
t.filter(
|
|
678
|
+
(r) => {
|
|
679
|
+
var n;
|
|
680
|
+
return ((n = r.source) == null ? void 0 : n.type) === "systemPermissionSet" && !r.inverted && r.actions.includes("manage");
|
|
681
|
+
}
|
|
682
|
+
).map((r) => r.subject)
|
|
683
|
+
);
|
|
684
|
+
return e.filter((r) => r.inverted ? !(s.has(r.subject) && !o.has(r.subject)) : !s.has(r.subject));
|
|
685
|
+
}
|
|
686
|
+
const se = "business::report::";
|
|
687
|
+
function _e(e, t) {
|
|
688
|
+
const s = [], o = e.filter((r) => {
|
|
689
|
+
const n = r.subject;
|
|
690
|
+
return !n.startsWith(se) || t.has(n) ? !0 : (s.push(n), !1);
|
|
691
|
+
});
|
|
692
|
+
return s.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", s), o;
|
|
693
|
+
}
|
|
694
|
+
const oe = "business::report::reports::", ie = "business::report::allDefaultReports", re = "business::report::allCustomReports";
|
|
695
|
+
function Ee(e, t) {
|
|
696
|
+
const s = e.find(
|
|
697
|
+
(a) => !a.inverted && a.subject === ie
|
|
698
|
+
), o = e.find(
|
|
699
|
+
(a) => !a.inverted && a.subject === re
|
|
700
|
+
);
|
|
701
|
+
if (!s && !o) return e;
|
|
702
|
+
const r = s ? new Set(s.actions) : null, n = o ? new Set(o.actions) : null;
|
|
703
|
+
return e.reduce((a, i) => {
|
|
704
|
+
if (i.inverted)
|
|
705
|
+
return a.push(i), a;
|
|
706
|
+
const c = i.subject;
|
|
707
|
+
if (!c.startsWith(oe))
|
|
708
|
+
return a.push(i), a;
|
|
709
|
+
const l = t.has(c) ? r : n;
|
|
710
|
+
if (!l)
|
|
711
|
+
return a.push(i), a;
|
|
712
|
+
if (l.has("manage")) return a;
|
|
713
|
+
const d = new Set(i.actions), p = d.has("manage");
|
|
714
|
+
let m = !1;
|
|
715
|
+
for (const f of l)
|
|
716
|
+
f !== "manage" && d.delete(f) && (m = !0);
|
|
717
|
+
return p && m && d.delete("manage"), d.size === 0 || a.push({ ...i, actions: Array.from(d) }), a;
|
|
718
|
+
}, []);
|
|
719
|
+
}
|
|
720
|
+
function B(e, t) {
|
|
721
|
+
var o, r;
|
|
722
|
+
const s = new Map(e.map((n) => [n.subject, n]));
|
|
723
|
+
for (const n of t) {
|
|
724
|
+
if (n.inverted) {
|
|
725
|
+
const i = s.get(n.subject);
|
|
726
|
+
if (n.conditions) {
|
|
727
|
+
if (i != null && i.conditions) {
|
|
728
|
+
const c = JSON.parse(i.conditions), u = JSON.parse(n.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((r = c[l]) == null ? void 0 : r.$in) ?? []).filter((f) => !d.includes(f));
|
|
729
|
+
m.length > 0 ? s.set(n.subject, {
|
|
730
|
+
...i,
|
|
731
|
+
conditions: JSON.stringify({ [l]: { $in: m } })
|
|
732
|
+
}) : s.delete(n.subject);
|
|
733
|
+
} else
|
|
734
|
+
s.delete(n.subject);
|
|
735
|
+
continue;
|
|
736
|
+
}
|
|
737
|
+
if (i) {
|
|
738
|
+
const c = new Set(n.actions), u = i.actions.filter((l) => !c.has(l));
|
|
739
|
+
u.length > 0 ? s.set(n.subject, { ...i, actions: u }) : s.delete(n.subject);
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
if (n.conditions) {
|
|
745
|
+
s.set(n.subject, n);
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
const a = s.get(n.subject);
|
|
749
|
+
if (a) {
|
|
750
|
+
const i = [
|
|
751
|
+
.../* @__PURE__ */ new Set([
|
|
752
|
+
...a.actions,
|
|
753
|
+
...n.actions
|
|
754
|
+
])
|
|
755
|
+
];
|
|
756
|
+
s.set(n.subject, { ...a, actions: i });
|
|
757
|
+
} else
|
|
758
|
+
s.set(n.subject, n);
|
|
759
|
+
}
|
|
760
|
+
return Array.from(s.values());
|
|
761
|
+
}
|
|
762
|
+
function ae(e, t) {
|
|
763
|
+
const s = B(e, t), o = new Set(e.map((n) => n.subject)), r = t.filter(
|
|
764
|
+
(n) => n.inverted && !o.has(n.subject)
|
|
765
|
+
);
|
|
766
|
+
return [...s, ...r];
|
|
767
|
+
}
|
|
768
|
+
const y = "/permission-assignments", P = {
|
|
769
|
+
async readAll() {
|
|
770
|
+
return b(await g().get(y));
|
|
771
|
+
},
|
|
772
|
+
async readByUserId(e) {
|
|
773
|
+
return b(await g().get(`${y}/user/${e}`));
|
|
774
|
+
},
|
|
775
|
+
async readById(e) {
|
|
776
|
+
return b(await g().get(`${y}/${e}`));
|
|
777
|
+
},
|
|
778
|
+
async create(e) {
|
|
779
|
+
return b(await g().post(y, e));
|
|
780
|
+
},
|
|
781
|
+
async update(e, t) {
|
|
782
|
+
return b(await g().put(`${y}/${e}`, t));
|
|
783
|
+
},
|
|
784
|
+
async delete(e) {
|
|
785
|
+
return b(await g().delete(`${y}/${e}`));
|
|
786
|
+
},
|
|
787
|
+
async addReportManagePermission(e, t) {
|
|
788
|
+
return b(
|
|
789
|
+
await g().post("/my-permissions/report-manage", { permissionKey: e, label: t })
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
}, ce = x("permissionAssignment", () => {
|
|
793
|
+
const e = h([]);
|
|
794
|
+
async function t() {
|
|
795
|
+
const i = await P.readAll();
|
|
796
|
+
e.value = i;
|
|
797
|
+
}
|
|
798
|
+
async function s(i) {
|
|
799
|
+
return await P.readByUserId(i);
|
|
800
|
+
}
|
|
801
|
+
async function o(i) {
|
|
802
|
+
const c = await P.create(i);
|
|
803
|
+
e.value = [...e.value, c];
|
|
804
|
+
}
|
|
805
|
+
async function r(i, c) {
|
|
806
|
+
const u = await P.update(i, c);
|
|
807
|
+
e.value = e.value.map((l) => l.id === i ? u : l);
|
|
808
|
+
}
|
|
809
|
+
async function n(i) {
|
|
810
|
+
await P.delete(i), e.value = e.value.filter((c) => c.id !== i);
|
|
811
|
+
}
|
|
812
|
+
function a(i) {
|
|
813
|
+
return e.value.find((c) => c.userId === i);
|
|
814
|
+
}
|
|
815
|
+
return {
|
|
816
|
+
permissionAssignments: e,
|
|
817
|
+
readPermissionAssignments: t,
|
|
818
|
+
readPermissionAssignmentByUserId: s,
|
|
819
|
+
createPermissionAssignment: o,
|
|
820
|
+
updatePermissionAssignment: r,
|
|
821
|
+
deletePermissionAssignment: n,
|
|
822
|
+
getPermissionAssignmentByUserId: a
|
|
823
|
+
};
|
|
824
|
+
}), ue = () => {
|
|
825
|
+
const e = ce();
|
|
826
|
+
return {
|
|
827
|
+
...e,
|
|
828
|
+
...k(e)
|
|
829
|
+
};
|
|
830
|
+
}, le = {
|
|
831
|
+
async fetchReportPermissions(e) {
|
|
832
|
+
return b(
|
|
833
|
+
await M().get(`/report-query/hrm/${e}/reports`)
|
|
834
|
+
);
|
|
835
|
+
},
|
|
836
|
+
async fetchReportPermissionsForPortal(e) {
|
|
837
|
+
return b(
|
|
838
|
+
await M().get(
|
|
839
|
+
`/report-query/hrm/${e}/reports?isSupportPos=false`
|
|
840
|
+
)
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
}, O = h([]), _ = h(!1), w = h(!1), $ = h(null);
|
|
844
|
+
function de() {
|
|
845
|
+
const e = q();
|
|
846
|
+
async function t() {
|
|
847
|
+
var r;
|
|
848
|
+
const o = (r = e.currentBusiness.value) == null ? void 0 : r.id;
|
|
849
|
+
if (o && ($.value !== o && (O.value = [], _.value = !1, w.value = !1, $.value = o), !(_.value || w.value))) {
|
|
850
|
+
w.value = !0;
|
|
851
|
+
try {
|
|
852
|
+
const n = await le.fetchReportPermissionsForPortal(o);
|
|
853
|
+
if ($.value !== o) return;
|
|
854
|
+
O.value = n, _.value = !0;
|
|
855
|
+
} catch (n) {
|
|
856
|
+
if ($.value !== o) return;
|
|
857
|
+
console.warn("Failed to fetch custom report permissions:", n), O.value = [];
|
|
858
|
+
} finally {
|
|
859
|
+
$.value === o && (w.value = !1);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const s = N(() => O.value.map(
|
|
864
|
+
(o) => o.isDefault ? {
|
|
865
|
+
label: o.name,
|
|
866
|
+
subject: `business::report::reports::${o.permissionKey}`,
|
|
867
|
+
actions: [S.manage, S.read, S.create],
|
|
868
|
+
category: D.reports
|
|
869
|
+
} : {
|
|
870
|
+
label: o.name,
|
|
871
|
+
subject: `business::report::reports::${o.permissionKey}`,
|
|
872
|
+
actions: [
|
|
873
|
+
S.manage,
|
|
874
|
+
S.read,
|
|
875
|
+
S.create,
|
|
876
|
+
S.update,
|
|
877
|
+
S.delete
|
|
878
|
+
],
|
|
879
|
+
category: D.customReports
|
|
880
|
+
}
|
|
881
|
+
));
|
|
882
|
+
return {
|
|
883
|
+
fetchCustomReportPermissions: t,
|
|
884
|
+
customReportPermissions: s,
|
|
885
|
+
isLoading: N(() => w.value),
|
|
886
|
+
isLoaded: N(() => _.value)
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function U(e) {
|
|
890
|
+
const t = q(), s = G(), o = ue(), r = t.restaurants, { customReportPermissions: n } = de(), a = o.getPermissionAssignmentByUserId(e.id), i = V(
|
|
891
|
+
(a == null ? void 0 : a.permissionSetIds) ?? [],
|
|
892
|
+
s.permissionSets.value
|
|
893
|
+
), c = W(i).map(
|
|
894
|
+
({ setNames: f, ...v }) => v
|
|
895
|
+
), u = a == null ? void 0 : a.customPermissions, l = u ?? e.permissions.map((f) => ({
|
|
896
|
+
...f,
|
|
897
|
+
subject: R(f.subject)
|
|
898
|
+
})), d = B(c, l), p = z(
|
|
899
|
+
ae(c, l),
|
|
900
|
+
F
|
|
901
|
+
).filter((f) => !f.inverted), m = Y(p) || r.value.map((f) => f._id);
|
|
902
|
+
return {
|
|
903
|
+
doc: e,
|
|
904
|
+
id: e.id,
|
|
905
|
+
name: e.name || "-",
|
|
906
|
+
phoneNumber: e.phoneNumber,
|
|
907
|
+
email: e.email,
|
|
908
|
+
restaurants: L(
|
|
909
|
+
m.map(
|
|
910
|
+
(f) => {
|
|
911
|
+
var v;
|
|
912
|
+
return ((v = r.value.find((K) => K._id === f)) == null ? void 0 : v.profile.name) ?? "";
|
|
913
|
+
}
|
|
914
|
+
)
|
|
915
|
+
),
|
|
916
|
+
managableRestaurantIds: m,
|
|
917
|
+
permissionLabels: ne(p, n.value),
|
|
918
|
+
permissions: d
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
const me = Object.freeze(
|
|
922
|
+
Object.values(Q)
|
|
923
|
+
), Ne = {
|
|
924
|
+
async readTeamMembers() {
|
|
925
|
+
return b(
|
|
926
|
+
await g().get("/portal-users")
|
|
927
|
+
).map(U);
|
|
928
|
+
},
|
|
929
|
+
async createTeamMember(e) {
|
|
930
|
+
return U(
|
|
931
|
+
b(await g().post("/portal-users", e))
|
|
932
|
+
);
|
|
933
|
+
},
|
|
934
|
+
async updateTeamMember(e, t) {
|
|
935
|
+
return U(
|
|
936
|
+
b(await g().put(`/portal-users/${e}`, t))
|
|
937
|
+
);
|
|
938
|
+
},
|
|
939
|
+
async deleteTeamMember(e) {
|
|
940
|
+
return b(await g().delete(`/portal-users/${e}`));
|
|
941
|
+
},
|
|
942
|
+
async readTeamMemberPosUserIds() {
|
|
943
|
+
return b(await g().get("/portal-users")).map((t) => t.posUserId);
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
export {
|
|
947
|
+
z as $,
|
|
948
|
+
le as R,
|
|
949
|
+
ye as a,
|
|
950
|
+
je as b,
|
|
951
|
+
V as c,
|
|
952
|
+
ae as d,
|
|
953
|
+
T as e,
|
|
954
|
+
$e as f,
|
|
955
|
+
he as g,
|
|
956
|
+
Pe as h,
|
|
957
|
+
Se as i,
|
|
958
|
+
de as j,
|
|
959
|
+
se as k,
|
|
960
|
+
we as l,
|
|
961
|
+
Re as m,
|
|
962
|
+
_e as n,
|
|
963
|
+
Ee as o,
|
|
964
|
+
me as p,
|
|
965
|
+
Ie as q,
|
|
966
|
+
E as r,
|
|
967
|
+
Oe as s,
|
|
968
|
+
Ne as t,
|
|
969
|
+
G as u,
|
|
970
|
+
ue as v,
|
|
971
|
+
ne as w,
|
|
972
|
+
W as x,
|
|
973
|
+
Ae as y,
|
|
974
|
+
Y as z
|
|
975
|
+
};
|