@feedmepos/mf-hrm-portal 2.1.1-dev.4 → 2.1.1-dev.6

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.
Files changed (40) hide show
  1. package/dist/ApprovalCodeList-B1XHbhum.js +757 -0
  2. package/dist/AuditLogList-DrrL4vf4.js +1149 -0
  3. package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-zJwkM_Xb.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-CBjO1MZo.js} +2 -2
  4. package/dist/{EmployeeList-DN2pnXcS.js → EmployeeList-BMol4ah4.js} +7 -8
  5. package/dist/{GrantUserList-DoyxknJZ.js → GrantUserList-CLBl7FZ-.js} +3 -3
  6. package/dist/{Main-DQj4xtkB.js → Main-DNOHZd3j.js} +5 -5
  7. package/dist/{Main-B5BKGpLg.js → Main-D_LwrBdZ.js} +9 -9
  8. package/dist/{Main-BGONIxo8.js → Main-auigiuVZ.js} +2 -2
  9. package/dist/{PermissionSetList-4uIU9FvN.js → PermissionSetList-DLYrXFbz.js} +5 -5
  10. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-D0luaKDb.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Drcx0tL_.js} +763 -763
  11. package/dist/{RoleList-Bj5Y5jd_.js → RoleList-g8PjH_k2.js} +7 -7
  12. package/dist/{TeamMemberList-Byjlca2Y.js → TeamMemberList-B9aCagSc.js} +21 -22
  13. package/dist/{TimesheetList-DwIcsOM-.js → TimesheetList-C1IJhOYE.js} +5 -5
  14. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-B9qlQ6KG.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CqtiVm1j.js} +2 -2
  15. package/dist/{app-BZwE2coe.js → app-DnOYVjuj.js} +500 -804
  16. package/dist/app.js +1 -1
  17. package/dist/{dayjs.min-BXBPls4m.js → dayjs.min-Dxul0qTK.js} +1 -1
  18. package/dist/{employee-CJTbs1f7.js → employee-sr65CZR7.js} +3 -3
  19. package/dist/{iteration-BCbIbdHR.js → iteration-DIqDMvFa.js} +1 -1
  20. package/dist/{lodash-CUIS1iIz.js → lodash-CXlqXFmD.js} +1 -1
  21. package/dist/{role-CzXchcSS.js → role-CE3NY-63.js} +1 -1
  22. package/dist/{rule-BO6xj2Xa.js → rule-CEjrit6c.js} +2 -2
  23. package/dist/src/api/audit-log/index.d.ts +0 -6
  24. package/dist/src/stores/approval-code.d.ts +6 -6
  25. package/dist/src/types/approval-code.d.ts +51 -26
  26. package/dist/src/types/audit-log.d.ts +1 -1
  27. package/dist/src/views/approval-code/ApprovalCodeList.vue.d.ts +1 -1
  28. package/dist/src/views/approval-code/locales/index.d.ts +4 -12
  29. package/dist/src/views/audit-log/locales/index.d.ts +0 -296
  30. package/dist/style.css +1 -1
  31. package/dist/tsconfig.app.tsbuildinfo +1 -1
  32. package/dist/useDebounce-CWb5QR9G.js +28 -0
  33. package/dist/{useReportPermissions-Q-xLwz5N.js → useReportPermissions-FVW_HwcL.js} +3 -3
  34. package/package.json +1 -1
  35. package/dist/ApprovalCodeList-B0PLZwav.js +0 -758
  36. package/dist/AuditLogList-CRXwPImZ.js +0 -1611
  37. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
  38. package/dist/src/views/audit-log/event-line.d.ts +0 -13
  39. package/dist/src/views/audit-log/snapshot-diff.d.ts +0 -11
  40. package/dist/useDebounce-B8ZPVS5C.js +0 -15
@@ -1,758 +0,0 @@
1
- import { defineComponent as re, ref as D, computed as C, resolveComponent as k, createBlock as Y, openBlock as y, withCtx as A, createElementVNode as r, createElementBlock as S, createCommentVNode as W, toDisplayString as g, unref as a, Fragment as G, renderList as te, createVNode as i, renderSlot as be, isRef as de, withModifiers as pe, createTextVNode as he, normalizeClass as xe, h as b } from "vue";
2
- import { d as ke } from "./dayjs.min-BXBPls4m.js";
3
- import { useI18n as ne } from "@feedmepos/mf-common";
4
- import { useSnackbar as ie, components as z, useDialog as we, useBreakpoints as Ve, FmButtonVariant as le } from "@feedmepos/ui-library";
5
- import { S as H } from "./SelectFilter-ATOm0hdn.js";
6
- import { _ as Fe } from "./app-BZwE2coe.js";
7
- import { _ as me, u as $e, H as Ae } from "./FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js";
8
- import { _ as Se } from "./index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js";
9
- import { u as fe } from "./useLoading-BH02lYns.js";
10
- import { u as ye } from "./approval-code-Q4666xp5.js";
11
- import { u as ce } from "./restaurant-YOVMuuFY.js";
12
- import { _ as Pe } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
13
- const je = {
14
- discount: { subject: "order", actions: ["update"], conditions: { operation: "discount" } },
15
- payment: { subject: "order", actions: ["update"], conditions: { operation: "payment" } },
16
- claimDeposit: {
17
- subject: "order",
18
- actions: ["update"],
19
- conditions: { operation: "claimDeposit" }
20
- },
21
- changePrice: { subject: "order", actions: ["update"], conditions: { operation: "changePrice" } },
22
- void: { subject: "order", actions: ["update"], conditions: { operation: "void" } },
23
- resend: { subject: "order", actions: ["update"], conditions: { operation: "resend" } },
24
- changePaymentType: {
25
- subject: "order",
26
- actions: ["update"],
27
- conditions: { operation: "changePaymentType" }
28
- },
29
- refund: { subject: "refund", actions: ["create"], conditions: { operation: "refund" } },
30
- openDrawer: { subject: "drawer", actions: ["manage"], conditions: { operation: "openDrawer" } },
31
- openCounter: {
32
- subject: "counterRecord",
33
- actions: ["manage"],
34
- conditions: { operation: "openCounter" }
35
- },
36
- closeCounter: {
37
- subject: "counterRecord",
38
- actions: ["manage"],
39
- conditions: { operation: "closeCounter" }
40
- },
41
- printReceipt: { subject: "order", actions: ["read"], conditions: { operation: "printReceipt" } }
42
- };
43
- function Be(u, s) {
44
- const e = je[u], _ = u === "discount" && (s == null ? void 0 : s.maxPercentage) !== void 0 ? { ...e.conditions, adjustment: { $lte: s.maxPercentage / 100 } } : { ...e.conditions };
45
- return { key: u, subject: e.subject, actions: e.actions, conditions: _ };
46
- }
47
- function Ie(u) {
48
- var e;
49
- const s = (e = u.conditions) == null ? void 0 : e.adjustment;
50
- if (s && typeof s == "object" && "$lte" in s && typeof s.$lte == "number")
51
- return Math.round(s.$lte * 100);
52
- }
53
- function ue(u, s) {
54
- return u.map((e) => {
55
- const _ = s(`approvalCode.permissions.${e.key}`), d = Ie(e);
56
- return d === void 0 ? _ : `${_} ≤${d}%`;
57
- });
58
- }
59
- function _e(u, s, e) {
60
- return [
61
- `${e("approvalCode.columns.passcode")} ${u.passcode}`,
62
- ue(u.permissions, e).join(", "),
63
- s
64
- ].filter(Boolean).join(" · ");
65
- }
66
- function ge(u) {
67
- return typeof u == "string" ? u.trim() : u;
68
- }
69
- function Re(u) {
70
- const s = ge(u);
71
- if (s === void 0 || s === "") return !0;
72
- const e = Number(s);
73
- return Number.isInteger(e) && e >= 1 && e <= 100;
74
- }
75
- function De(u) {
76
- const s = ge(u);
77
- if (!(s === void 0 || s === ""))
78
- return Number(s);
79
- }
80
- const oe = [
81
- { key: "printReceipt", ruleKeys: ["printReceipt"] },
82
- { key: "resend", ruleKeys: ["resend"] },
83
- { key: "openDrawer", ruleKeys: ["openDrawer"] },
84
- { key: "counter", ruleKeys: ["openCounter", "closeCounter"] },
85
- { key: "discount", ruleKeys: ["discount"] },
86
- { key: "changePrice", ruleKeys: ["changePrice"] },
87
- { key: "void", ruleKeys: ["void"] },
88
- { key: "changePaymentType", ruleKeys: ["changePaymentType"] },
89
- { key: "refund", ruleKeys: ["refund"] }
90
- ];
91
- function ee(u) {
92
- return u.usedAt ?? u.revokedAt;
93
- }
94
- function Ne(u, s) {
95
- if (!s || s.length === 0) return !0;
96
- const e = new Set(
97
- s.flatMap(
98
- (_) => {
99
- var d;
100
- return ((d = oe.find((h) => h.key === _)) == null ? void 0 : d.ruleKeys) ?? [];
101
- }
102
- )
103
- );
104
- return u.permissions.some((_) => e.has(_.key));
105
- }
106
- const Te = { class: "pr-24" }, Me = { class: "fm-typo-en-title-md-600" }, Ke = { class: "text-fm-color-typo-secondary text-sm mt-4" }, Ue = { class: "rounded-md border border-fm-color-neutral-gray-100 p-16" }, Le = { class: "flex items-center justify-between gap-8" }, Ee = { class: "text-fm-color-typo-secondary text-sm min-w-0" }, Oe = { class: "font-mono text-xl font-bold" }, ze = { class: "w-full flex items-center justify-end gap-8" }, Ye = /* @__PURE__ */ re({
107
- __name: "ApprovalCodeCreatedDialog",
108
- emits: ["createAnother"],
109
- setup(u, { expose: s, emit: e }) {
110
- const _ = e, { t: d } = ne(), h = ie(), { restaurants: w } = ce(), V = D(!1), n = D([]), P = (f) => {
111
- f.length !== 0 && (n.value = f, V.value = !0);
112
- }, N = C(() => n.value.length > 1), c = C(() => {
113
- var j, F;
114
- const f = (j = n.value[0]) == null ? void 0 : j.restaurantId;
115
- return (F = w.value.find((p) => p._id === f)) == null ? void 0 : F.profile.name;
116
- }), B = C(() => {
117
- const f = n.value[0];
118
- return f ? [f.name, ue(f.permissions, d).join(", "), c.value].filter(Boolean).join(" · ") : "";
119
- }), I = C(
120
- () => N.value ? d("approvalCode.created.titleBulk", { count: n.value.length }) : d("approvalCode.created.title")
121
- ), E = C(
122
- () => N.value ? d("approvalCode.created.subtitleBulk") : d("approvalCode.created.subtitle")
123
- );
124
- async function T(f) {
125
- try {
126
- await navigator.clipboard.writeText(f), h.open({
127
- message: d("approvalCode.passcode.copied"),
128
- type: "success"
129
- });
130
- } catch (j) {
131
- h.open({
132
- message: String(j),
133
- type: "error"
134
- });
135
- }
136
- }
137
- const q = (f) => T(_e(f, c.value, d)), M = () => T([B.value, ...n.value.map((f) => f.passcode)].join(`
138
- `)), X = () => {
139
- V.value = !1;
140
- }, R = () => {
141
- V.value = !1, _("createAnother");
142
- };
143
- return s({ open: P }), (f, j) => {
144
- const F = k("FmButton"), p = k("FmDialog");
145
- return y(), Y(p, {
146
- modelValue: V.value,
147
- "onUpdate:modelValue": j[0] || (j[0] = (m) => V.value = m),
148
- "min-width": 360,
149
- "max-width": 560
150
- }, {
151
- "dialog-header": A(() => [
152
- r("div", Te, [
153
- r("p", Me, g(I.value), 1),
154
- r("p", Ke, g(E.value), 1)
155
- ])
156
- ]),
157
- "dialog-footer": A(() => [
158
- r("div", ze, [
159
- i(F, {
160
- variant: "secondary",
161
- label: a(d)("approvalCode.created.createAnother"),
162
- onClick: R
163
- }, null, 8, ["label"]),
164
- i(F, {
165
- variant: "primary",
166
- label: a(d)("approvalCode.created.done"),
167
- onClick: X
168
- }, null, 8, ["label"])
169
- ])
170
- ]),
171
- default: A(() => [
172
- r("div", Ue, [
173
- r("div", Le, [
174
- r("p", Ee, g(B.value), 1),
175
- N.value ? (y(), Y(F, {
176
- key: 0,
177
- class: "shrink-0 whitespace-nowrap",
178
- variant: "secondary",
179
- icon: "content_copy",
180
- label: a(d)("approvalCode.created.copyAll"),
181
- onClick: M
182
- }, null, 8, ["label"])) : W("", !0)
183
- ]),
184
- (y(!0), S(G, null, te(n.value, (m) => (y(), S("div", {
185
- key: m._id,
186
- class: "flex items-center justify-between mt-8"
187
- }, [
188
- r("span", Oe, g(m.passcode), 1),
189
- i(F, {
190
- variant: "tertiary",
191
- icon: "content_copy",
192
- label: a(d)("approvalCode.created.copy"),
193
- onClick: ($) => q(m)
194
- }, null, 8, ["label", "onClick"])
195
- ]))), 128))
196
- ])
197
- ]),
198
- _: 1
199
- }, 8, ["modelValue"]);
200
- };
201
- }
202
- }), qe = { class: "fm-typo-en-title-md-600" }, He = { class: "space-y-40" }, We = { class: "space-y-8" }, Ge = { class: "flex items-center gap-8" }, Xe = {
203
- key: 0,
204
- class: "pl-32 pt-8"
205
- }, Ze = {
206
- key: 0,
207
- class: "text-fm-color-typo-error text-sm"
208
- }, Je = {
209
- key: 0,
210
- class: "text-fm-color-typo-error text-sm"
211
- }, Qe = { class: "flex gap-8 items-center justify-start" }, et = /* @__PURE__ */ re({
212
- __name: "ApprovalCodeForm",
213
- emits: ["created"],
214
- setup(u, { expose: s, emit: e }) {
215
- const _ = e, d = ye(), h = ce(), w = ie(), V = fe(w), { t: n } = ne(), P = D(!1), N = () => ({
216
- name: "",
217
- restaurantId: "",
218
- permissions: [],
219
- count: 1
220
- }), c = D(N()), B = D(void 0), I = () => {
221
- c.value = N(), B.value = void 0, P.value = !0;
222
- }, E = C(() => n("approvalCode.form.title")), T = C(() => n("common.create")), q = C(() => h.restaurants.value.map((p) => ({
223
- label: `${p.profile.code ? p.profile.code + " - " : ""}${p.profile.name}`,
224
- value: p._id
225
- }))), M = (p) => c.value.permissions.includes(p), X = (p, m) => {
226
- m && !M(p) && (c.value.permissions = [...c.value.permissions, p]), m || (c.value.permissions = c.value.permissions.filter(($) => $ !== p));
227
- }, R = C(
228
- () => c.value.permissions.length === 0 ? n("approvalCode.form.permissionsRequired") : ""
229
- ), f = C(() => M("discount") ? Re(B.value) ? "" : n("approvalCode.form.discountMaxPercentageInvalid") : "");
230
- function j() {
231
- const p = De(B.value);
232
- return c.value.permissions.flatMap((m) => {
233
- const $ = oe.find((K) => K.key === m);
234
- return $ ? $.ruleKeys.map(
235
- (K) => Be(K, { maxPercentage: p })
236
- ) : [];
237
- });
238
- }
239
- async function F() {
240
- if (R.value) {
241
- w.open({ message: R.value, type: "error" });
242
- return;
243
- }
244
- if (f.value) {
245
- w.open({ message: f.value, type: "error" });
246
- return;
247
- }
248
- const p = await V.minor(
249
- async () => d.createApprovalCodes({
250
- name: c.value.name,
251
- restaurantId: c.value.restaurantId,
252
- count: Number(c.value.count),
253
- permissions: j()
254
- })
255
- );
256
- w.open({
257
- message: p.length === 1 ? n("approvalCode.create.successMessage", { passcode: p[0].passcode }) : n("approvalCode.create.successMessageBulk", { count: p.length }),
258
- type: "success"
259
- }), P.value = !1, _("created", p);
260
- }
261
- return s({
262
- show: P,
263
- trigger: I
264
- }), (p, m) => {
265
- const $ = k("FmTextField"), K = k("FmSelect"), Q = k("FmCheckbox"), Z = k("fm-button"), ae = k("fm-side-sheet");
266
- return y(), S(G, null, [
267
- be(p.$slots, "default", { trigger: I }),
268
- i(ae, {
269
- id: "approval-code-form",
270
- modelValue: P.value,
271
- "onUpdate:modelValue": m[5] || (m[5] = (v) => P.value = v),
272
- "is-container": a(z).FmForm,
273
- "is-container-props": {
274
- onValidationSuccess: F,
275
- blameFormChildOnValidationFailed: !0
276
- },
277
- "max-width": 560
278
- }, {
279
- "side-sheet-header": A(() => [
280
- r("p", qe, g(E.value), 1)
281
- ]),
282
- "side-sheet-footer": A(() => [
283
- r("div", Qe, [
284
- i(Z, {
285
- label: T.value,
286
- size: "lg",
287
- type: "submit",
288
- variant: "primary"
289
- }, null, 8, ["label"]),
290
- i(Z, {
291
- label: a(n)("common.cancel"),
292
- size: "lg",
293
- variant: "tertiary",
294
- onClick: m[4] || (m[4] = () => P.value = !1)
295
- }, null, 8, ["label"])
296
- ])
297
- ]),
298
- default: A(() => [
299
- r("div", He, [
300
- i(Pe, {
301
- title: a(n)("approvalCode.form.section")
302
- }, {
303
- default: A(() => [
304
- i($, {
305
- modelValue: c.value.name,
306
- "onUpdate:modelValue": m[0] || (m[0] = (v) => c.value.name = v),
307
- label: a(n)("approvalCode.form.name"),
308
- rules: [(v) => !!v || a(n)("approvalCode.form.nameRequired")]
309
- }, null, 8, ["modelValue", "label", "rules"]),
310
- i(me, {
311
- label: a(n)("approvalCode.form.restaurant")
312
- }, {
313
- default: A(() => [
314
- i(K, {
315
- modelValue: c.value.restaurantId,
316
- "onUpdate:modelValue": m[1] || (m[1] = (v) => c.value.restaurantId = v),
317
- items: q.value,
318
- placeholder: a(n)("approvalCode.form.selectRestaurant"),
319
- rules: [(v) => !!v || a(n)("approvalCode.form.restaurantRequired")]
320
- }, null, 8, ["modelValue", "items", "placeholder", "rules"])
321
- ]),
322
- _: 1
323
- }, 8, ["label"]),
324
- i(me, {
325
- label: a(n)("approvalCode.form.permissions")
326
- }, {
327
- default: A(() => [
328
- r("div", We, [
329
- (y(!0), S(G, null, te(a(oe), (v) => (y(), S("div", {
330
- key: v.key
331
- }, [
332
- r("div", Ge, [
333
- i(Q, {
334
- "model-value": M(v.key),
335
- value: v.key,
336
- size: "sm",
337
- dense: "",
338
- "onUpdate:modelValue": (t) => X(v.key, t)
339
- }, null, 8, ["model-value", "value", "onUpdate:modelValue"]),
340
- r("span", null, g(a(n)(`approvalCode.permissions.${v.key}`)), 1)
341
- ]),
342
- v.key === "discount" && M("discount") ? (y(), S("div", Xe, [
343
- i($, {
344
- modelValue: B.value,
345
- "onUpdate:modelValue": m[2] || (m[2] = (t) => B.value = t),
346
- type: "number",
347
- class: "max-w-[200px]",
348
- label: a(n)("approvalCode.form.discountMaxPercentage")
349
- }, null, 8, ["modelValue", "label"]),
350
- f.value ? (y(), S("p", Ze, g(f.value), 1)) : W("", !0)
351
- ])) : W("", !0)
352
- ]))), 128)),
353
- R.value ? (y(), S("p", Je, g(R.value), 1)) : W("", !0)
354
- ])
355
- ]),
356
- _: 1
357
- }, 8, ["label"]),
358
- i($, {
359
- modelValue: c.value.count,
360
- "onUpdate:modelValue": m[3] || (m[3] = (v) => c.value.count = v),
361
- modelModifiers: { number: !0 },
362
- type: "number",
363
- label: a(n)("approvalCode.form.count"),
364
- rules: [
365
- (v) => Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= 10 || a(n)("approvalCode.form.countRange")
366
- ]
367
- }, null, 8, ["modelValue", "label", "rules"])
368
- ]),
369
- _: 1
370
- }, 8, ["title"])
371
- ])
372
- ]),
373
- _: 1
374
- }, 8, ["modelValue", "is-container", "is-container-props"])
375
- ], 64);
376
- };
377
- }
378
- }), tt = {
379
- class: "space-y-8"
380
- }, ot = {
381
- class: "xs:hidden flex w-full items-start justify-between"
382
- }, at = {
383
- class: "flex items-start gap-8"
384
- }, st = {
385
- class: "space-y-4 hidden xs:block"
386
- }, lt = {
387
- class: "px-16"
388
- }, rt = {
389
- class: "px-16 flex items-start gap-8"
390
- }, nt = {
391
- class: "pb-64 hidden xs:block"
392
- }, it = {
393
- class: "space-y-4"
394
- }, ct = {
395
- class: "flex items-center gap-8"
396
- }, ut = {
397
- class: "fm-typo-en-body-lg-600"
398
- }, dt = {
399
- class: "font-mono text-lg font-bold mr-4"
400
- }, pt = {
401
- class: "text-fm-color-typo-secondary"
402
- }, mt = {
403
- class: "flex flex-wrap gap-4 mt-4"
404
- }, vt = {
405
- class: "mt-4 space-y-2"
406
- }, ft = {
407
- class: "text-xs"
408
- }, yt = {
409
- class: "text-xs"
410
- }, _t = {
411
- key: 0,
412
- class: "text-xs"
413
- }, gt = {
414
- class: "flex flex-col gap-4"
415
- }, ve = 10, Ct = 2, Bt = /* @__PURE__ */ re({
416
- __name: "ApprovalCodeList",
417
- setup(u, {
418
- expose: s
419
- }) {
420
- const {
421
- t: e
422
- } = ne(), _ = (t) => ke(t).format("DD/MM/YYYY, h:mm:ss A"), d = D(), h = D(), w = D(), V = ye(), {
423
- restaurants: n
424
- } = ce(), P = C(() => oe.map((t) => ({
425
- label: e(`approvalCode.permissions.${t.key}`),
426
- value: t.key
427
- }))), N = C(() => V.approvalCodes), {
428
- searchKey: c,
429
- filter: B
430
- } = $e(), I = C(() => {
431
- const t = {};
432
- return n.value.forEach((o) => {
433
- t[o._id] = o.profile.name;
434
- }), t;
435
- }), E = (t) => ue(t.permissions, e), T = C(() => {
436
- var t;
437
- return (t = N.value) == null ? void 0 : t.filter((o) => {
438
- const x = !d.value || d.value.includes(o.restaurantId), U = !h.value || h.value.includes(o.status), L = I.value[o.restaurantId] || "";
439
- return x && U && Ne(o, w.value) && B([o.passcode, o.name, L, o.grantByName, ...E(o)]);
440
- });
441
- }), q = (t) => {
442
- switch (t) {
443
- case "active":
444
- return "bg-fm-color-system-success-100 text-fm-color-typo-success";
445
- case "used":
446
- return "bg-fm-color-typo-tertiary text-fm-color-typo-primary";
447
- case "revoked":
448
- return "bg-fm-color-system-error-100 text-fm-color-typo-error";
449
- default:
450
- return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
451
- }
452
- }, M = (t) => e(`approvalCode.status.${t}`), X = [{
453
- accessorKey: "passcode",
454
- size: 120,
455
- maxSize: 120,
456
- minSize: 120,
457
- header: () => e("approvalCode.columns.passcode"),
458
- cell(t) {
459
- const o = t.row.original;
460
- return b("div", {
461
- class: "flex items-center gap-8"
462
- }, [b(z.FmButton, {
463
- variant: le.Tertiary,
464
- textColor: "neutral-gray-400",
465
- icon: "content_copy",
466
- onClick: (x) => {
467
- x.stopPropagation(), v(o);
468
- }
469
- }), b("span", {
470
- class: "font-mono text-lg font-bold"
471
- }, o.passcode)]);
472
- }
473
- }, {
474
- accessorKey: "name",
475
- header: () => e("approvalCode.columns.name"),
476
- enableSorting: !1
477
- }, {
478
- accessorKey: "permissions",
479
- header: () => e("approvalCode.columns.permissions"),
480
- enableSorting: !1,
481
- cell(t) {
482
- const o = t.row.original, x = E(o), U = x.slice(0, Ct), L = x.length - U.length, J = b("div", {
483
- class: "flex flex-wrap gap-4 py-8"
484
- }, [...U.map((se) => b(z.FmChip, {
485
- label: se
486
- })), ...L > 0 ? [b(z.FmChip, {
487
- label: `+${L}`
488
- })] : []]);
489
- return L === 0 ? J : b(z.FmTooltip, {
490
- variant: "plain",
491
- placement: "top"
492
- }, {
493
- default: () => J,
494
- content: () => b("div", x.join(", "))
495
- });
496
- }
497
- }, {
498
- accessorKey: "restaurantName",
499
- accessorFn: (t) => I.value[t.restaurantId],
500
- header: () => e("approvalCode.columns.restaurant"),
501
- enableSorting: !1,
502
- meta: {
503
- width: "220px"
504
- },
505
- cell(t) {
506
- return b("div", I.value[t.row.original.restaurantId] || "-");
507
- }
508
- }, {
509
- accessorKey: "status",
510
- header: () => e("approvalCode.columns.status"),
511
- enableSorting: !1,
512
- meta: {
513
- maxWidth: "120px"
514
- },
515
- cell(t) {
516
- const o = t.row.original.status;
517
- return b(z.FmChip, {
518
- label: M(o),
519
- class: q(o)
520
- });
521
- }
522
- }, {
523
- accessorKey: "createdAt",
524
- header: () => e("approvalCode.columns.createdAt"),
525
- cell(t) {
526
- const o = t.row.original.createdAt;
527
- return b("div", _(o));
528
- }
529
- }, {
530
- id: "resolvedAt",
531
- accessorFn: (t) => ee(t) ?? "",
532
- header: () => e("approvalCode.columns.resolvedAt"),
533
- cell(t) {
534
- const o = ee(t.row.original);
535
- return b("div", o ? _(o) : "-");
536
- }
537
- }, {
538
- accessorKey: "grantByName",
539
- header: () => e("approvalCode.columns.grantedBy"),
540
- enableSorting: !1,
541
- cell(t) {
542
- return b("div", t.row.original.grantByName);
543
- }
544
- }, {
545
- id: "action",
546
- size: 140,
547
- minSize: 140,
548
- enableSorting: !1,
549
- meta: {
550
- cellClass: "p-16",
551
- headerContentClass: "-mx-16"
552
- },
553
- cell: (t) => {
554
- const o = t.row.original, x = [];
555
- return o.status === "active" && x.push(b(z.FmButton, {
556
- label: e("approvalCode.actions.revoke"),
557
- variant: le.Secondary,
558
- onClick: (U) => {
559
- U.stopPropagation(), $(o);
560
- }
561
- })), b("div", {
562
- class: "w-full flex justify-end items-center gap-4"
563
- }, x);
564
- }
565
- }], R = ie(), f = we(), j = fe(R), F = D(), p = D(), {
566
- breakpoints: m
567
- } = Ve(), $ = (t) => {
568
- f.open({
569
- title: e("approvalCode.revoke.title"),
570
- message: e("approvalCode.revoke.message", {
571
- name: t.name
572
- }),
573
- minWidth: m.value.lg ? 588 : 0,
574
- primaryActions: {
575
- text: e("approvalCode.actions.revoke"),
576
- close: !1,
577
- variant: "destructive"
578
- },
579
- secondaryActions: {
580
- text: e("common.cancel"),
581
- close: !0
582
- }
583
- }).onPrimary(async () => {
584
- j.minor(async () => {
585
- await V.revokeApprovalCode(t._id, t.restaurantId);
586
- }, {
587
- successMessage: e("approvalCode.revoke.successMessage", {
588
- name: t.name
589
- })
590
- }), f.close();
591
- });
592
- };
593
- function K() {
594
- var t;
595
- (t = F.value) == null || t.trigger();
596
- }
597
- const Q = C(() => [{
598
- label: e("approvalCode.status.active"),
599
- value: "active"
600
- }, {
601
- label: e("approvalCode.status.used"),
602
- value: "used"
603
- }, {
604
- label: e("approvalCode.status.revoked"),
605
- value: "revoked"
606
- }]), Z = C(() => n.value.map((t) => ({
607
- label: `${t.profile.code ? `${t.profile.code} - ` : ""}${t.profile.name}`,
608
- value: t._id
609
- })));
610
- function ae(t) {
611
- return _e(t, I.value[t.restaurantId], e);
612
- }
613
- async function v(t) {
614
- try {
615
- await navigator.clipboard.writeText(ae(t)), R.open({
616
- message: e("approvalCode.passcode.copied"),
617
- type: "success"
618
- });
619
- } catch (o) {
620
- R.open({
621
- message: String(o),
622
- type: "error"
623
- });
624
- }
625
- }
626
- return s({
627
- create: K,
628
- filteredApprovalCodes: T
629
- }), (t, o) => {
630
- const x = k("FmSearch"), U = k("FmTable"), L = k("FmButton"), J = k("FmChip"), se = k("FmListItem"), Ce = k("FmList");
631
- return y(), S(G, null, [i(et, {
632
- ref_key: "approvalCodeFormRef",
633
- ref: F,
634
- class: "gap-8",
635
- onCreated: o[0] || (o[0] = (l) => {
636
- var O;
637
- return (O = p.value) == null ? void 0 : O.open(l);
638
- })
639
- }, null, 512), i(Ye, {
640
- ref_key: "createdDialogRef",
641
- ref: p,
642
- onCreateAnother: K
643
- }, null, 512), r("div", tt, [r("div", ot, [r("div", at, [i(H, {
644
- modelValue: w.value,
645
- "onUpdate:modelValue": o[1] || (o[1] = (l) => w.value = l),
646
- multiple: "",
647
- variant: "dark",
648
- items: P.value,
649
- "selected-prefix": a(e)("approvalCode.filter.selected_action_prefix"),
650
- placeholder: a(e)("approvalCode.filter.action_placeholder"),
651
- class: "!w-auto"
652
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(H, {
653
- modelValue: d.value,
654
- "onUpdate:modelValue": o[2] || (o[2] = (l) => d.value = l),
655
- multiple: "",
656
- items: Z.value,
657
- variant: "dark",
658
- "selected-prefix": a(e)("approvalCode.columns.restaurant"),
659
- placeholder: a(e)("approvalCode.columns.restaurant"),
660
- class: "!w-auto"
661
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(H, {
662
- modelValue: h.value,
663
- "onUpdate:modelValue": o[3] || (o[3] = (l) => h.value = l),
664
- multiple: "",
665
- variant: "dark",
666
- items: Q.value,
667
- "selected-prefix": a(e)("approvalCode.filter.selected_status_prefix"),
668
- placeholder: a(e)("approvalCode.filter.status_placeholder")
669
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), i(x, {
670
- modelValue: a(c),
671
- "onUpdate:modelValue": o[4] || (o[4] = (l) => de(c) ? c.value = l : null),
672
- autofocus: "",
673
- class: "pl-4 w-[320px]",
674
- placeholder: a(e)("approvalCode.search.placeholder")
675
- }, null, 8, ["modelValue", "placeholder"])]), r("div", st, [r("div", lt, [i(x, {
676
- modelValue: a(c),
677
- "onUpdate:modelValue": o[5] || (o[5] = (l) => de(c) ? c.value = l : null),
678
- autofocus: "",
679
- placeholder: a(e)("approvalCode.search.placeholder")
680
- }, null, 8, ["modelValue", "placeholder"])]), i(Ae), r("div", rt, [i(H, {
681
- modelValue: w.value,
682
- "onUpdate:modelValue": o[6] || (o[6] = (l) => w.value = l),
683
- multiple: "",
684
- variant: "dark",
685
- items: P.value,
686
- "selected-prefix": a(e)("approvalCode.filter.selected_action_prefix"),
687
- placeholder: a(e)("approvalCode.filter.action_placeholder"),
688
- class: "!w-auto"
689
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(H, {
690
- modelValue: d.value,
691
- "onUpdate:modelValue": o[7] || (o[7] = (l) => d.value = l),
692
- multiple: "",
693
- items: Z.value,
694
- variant: "dark",
695
- "selected-prefix": a(e)("approvalCode.columns.restaurant"),
696
- placeholder: a(e)("approvalCode.columns.restaurant"),
697
- class: "!w-auto"
698
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(H, {
699
- modelValue: h.value,
700
- "onUpdate:modelValue": o[8] || (o[8] = (l) => h.value = l),
701
- multiple: "",
702
- variant: "dark",
703
- items: Q.value,
704
- "selected-prefix": a(e)("approvalCode.filter.selected_status_prefix"),
705
- placeholder: a(e)("approvalCode.filter.status_placeholder")
706
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), N.value.length > 0 || a(V).isLoading ? (y(), Y(Fe, {
707
- key: 0,
708
- class: "overflow-auto"
709
- }, {
710
- default: A(() => [i(U, {
711
- class: "xs:hidden",
712
- "column-defs": X,
713
- "row-data": T.value,
714
- "page-size": ve,
715
- "hide-footer": T.value.length <= ve,
716
- loading: a(V).isLoading,
717
- virtual: !1,
718
- "pin-header-row": ""
719
- }, null, 8, ["row-data", "hide-footer", "loading"]), r("div", nt, [i(Ce, {
720
- separator: ""
721
- }, {
722
- default: A(() => [(y(!0), S(G, null, te(T.value, (l) => (y(), Y(se, {
723
- key: l._id,
724
- class: "py-12 px-16 items-center justify-between"
725
- }, {
726
- default: A(() => [r("div", it, [r("div", ct, [i(L, {
727
- variant: "tertiary",
728
- "text-color": "neutral-gray-400",
729
- icon: "content_copy",
730
- onClick: pe((O) => v(l), ["stop"])
731
- }, null, 8, ["onClick"]), r("p", ut, [r("span", dt, g(l.passcode), 1), he(" - " + g(l.name), 1)])]), r("div", pt, [r("div", null, g(I.value[l.restaurantId] || "-"), 1), r("div", mt, [(y(!0), S(G, null, te(E(l), (O) => (y(), Y(J, {
732
- key: O,
733
- label: O
734
- }, null, 8, ["label"]))), 128))]), r("div", vt, [r("div", ft, g(a(e)("approvalCode.columns.grantedBy")) + ": " + g(l.grantByName), 1), r("div", yt, g(a(e)("approvalCode.columns.createdAt")) + ": " + g(_(l.createdAt)), 1), a(ee)(l) ? (y(), S("div", _t, g(a(e)("approvalCode.columns.resolvedAt")) + ": " + g(_(a(ee)(l))), 1)) : W("", !0), i(J, {
735
- label: M(l.status),
736
- class: xe(q(l.status))
737
- }, null, 8, ["label", "class"])])])]), r("div", gt, [l.status === "active" ? (y(), Y(L, {
738
- key: 0,
739
- label: a(e)("approvalCode.actions.revoke"),
740
- variant: a(le).Secondary,
741
- onClick: pe((O) => $(l), ["stop"])
742
- }, null, 8, ["label", "variant", "onClick"])) : W("", !0)])]),
743
- _: 2
744
- }, 1024))), 128))]),
745
- _: 1
746
- })])]),
747
- _: 1
748
- })) : (y(), Y(a(Se), {
749
- key: 1,
750
- title: a(e)("approvalCode.noData.title"),
751
- subtitle: a(e)("approvalCode.noData.subtitle")
752
- }, null, 8, ["title", "subtitle"]))])], 64);
753
- };
754
- }
755
- });
756
- export {
757
- Bt as default
758
- };