@feedmepos/mf-hrm-portal 2.1.1-dev → 2.1.1-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.
Files changed (83) hide show
  1. package/dist/ApprovalCodeList-BH5sgVMU.js +638 -0
  2. package/dist/AuditLogList-Q4L5Te8O.js +1145 -0
  3. package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +58 -0
  4. package/dist/EmployeeList-GtKmJZbf.js +899 -0
  5. package/dist/GrantUserList-CnLjOi5_.js +468 -0
  6. package/dist/Main-Cn7Dawg4.js +120 -0
  7. package/dist/{Main-mTxcltDY.js → Main-DLlpEU3j.js} +11 -9
  8. package/dist/{Main-BLRr_ORG.js → Main-cskEZ3k_.js} +1033 -1035
  9. package/dist/PermissionSetList-C2fK2pTz.js +357 -0
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CMh0DL1_.js +3458 -0
  11. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_79737e32_lang-Czo3FLbc.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BJp9hEfv.js} +1 -2
  12. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +38 -0
  13. package/dist/RoleList-CcuT1ERb.js +567 -0
  14. package/dist/TeamMemberList-Dfs2iNdC.js +1131 -0
  15. package/dist/{TimesheetList-D21j4zLV.js → TimesheetList-B1H_6zfP.js} +136 -141
  16. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CRmmIfTk.js → TimesheetList.vue_vue_type_style_index_0_scoped_91afda4e_lang-DeTpbaRk.js} +14 -13
  17. package/dist/{app-CX-St7pv.js → app-DX-PG6wx.js} +2725 -5281
  18. package/dist/app.js +1 -1
  19. package/dist/approval-code-Q4666xp5.js +58 -0
  20. package/dist/{dayjs.min-MDoe5X-P.js → dayjs.min-BJrHE7oz.js} +1 -1
  21. package/dist/{employee-B2cdx2t4.js → employee-BJcqtqLM.js} +27 -26
  22. package/dist/grant-user-CQZaTzVt.js +67 -0
  23. package/dist/{TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js → index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js} +19 -50
  24. package/dist/iteration-Cfaqt-0s.js +7682 -0
  25. package/dist/{lodash-DZAGPZLQ.js → lodash-ClKqCmlZ.js} +1 -1
  26. package/dist/restaurant-YOVMuuFY.js +1876 -0
  27. package/dist/role-CR_-nBDY.js +82 -0
  28. package/dist/rule-BB-3S-2R.js +996 -0
  29. package/dist/src/api/approval-code/index.d.ts +7 -0
  30. package/dist/src/api/audit-log/index.d.ts +0 -6
  31. package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
  32. package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +1 -7
  33. package/dist/src/components/table/TableEmptyState.vue.d.ts +15 -7
  34. package/dist/src/composables/useBasePermission.d.ts +1 -2
  35. package/dist/src/helpers/permission-set.d.ts +4 -8
  36. package/dist/src/helpers/rule.d.ts +1 -2
  37. package/dist/src/router/shared.d.ts +3 -1
  38. package/dist/src/stores/approval-code.d.ts +140 -0
  39. package/dist/src/stores/permission-set.d.ts +3 -12
  40. package/dist/src/types/approval-code.d.ts +99 -0
  41. package/dist/src/types/audit-log.d.ts +1 -1
  42. package/dist/src/views/approval-code/ApprovalCodeList.vue.d.ts +26 -0
  43. package/dist/src/views/approval-code/components/ApprovalCodeForm.vue.d.ts +17 -0
  44. package/dist/src/views/approval-code/locales/index.d.ts +320 -0
  45. package/dist/src/views/audit-log/locales/index.d.ts +0 -296
  46. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +0 -1
  47. package/dist/src/views/pos-access/locales/index.d.ts +48 -0
  48. package/dist/src/views/team/components/BasePermission.vue.d.ts +0 -13
  49. package/dist/src/views/team/locales/index.d.ts +0 -72
  50. package/dist/style.css +1 -1
  51. package/dist/tsconfig.app.tsbuildinfo +1 -1
  52. package/dist/useAppStore-DNTlIeMv.js +93 -0
  53. package/dist/useDebounce-CWb5QR9G.js +28 -0
  54. package/dist/{useLoading-qgSjOzRD.js → useLoading-BH02lYns.js} +1 -1
  55. package/dist/{useReportPermissions-CIhkjN3B.js → useReportPermissions-ybHA26cJ.js} +3 -3
  56. package/package.json +2 -2
  57. package/dist/AuditLogList-Cvp-5_0y.js +0 -1608
  58. package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-Cb8-YaiH.js +0 -387
  59. package/dist/EmployeeList-DgrD3Hjm.js +0 -884
  60. package/dist/Main-G3am-0Xi.js +0 -577
  61. package/dist/PermissionSetList-OzyfE-Yg.js +0 -392
  62. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Ca2NnAAF.js +0 -4121
  63. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +0 -42
  64. package/dist/RoleList-DOZ5RJ6A.js +0 -684
  65. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
  66. package/dist/TeamMemberList-CAqLUyQK.js +0 -1186
  67. package/dist/iteration-B38iapI_.js +0 -9556
  68. package/dist/rule-DftQBR76.js +0 -1057
  69. package/dist/src/composables/useConditionDraft.d.ts +0 -40
  70. package/dist/src/composables/useCoverConditionOverride.d.ts +0 -61
  71. package/dist/src/helpers/business-timezone.d.ts +0 -22
  72. package/dist/src/helpers/filter.d.ts +0 -15
  73. package/dist/src/helpers/permission-reconcile.d.ts +0 -15
  74. package/dist/src/helpers/permission-reconcile.test.d.ts +0 -1
  75. package/dist/src/views/audit-log/event-line.d.ts +0 -13
  76. package/dist/src/views/audit-log/snapshot-diff.d.ts +0 -11
  77. package/dist/src/views/team/condition-builders/ConditionFormHost.vue.d.ts +0 -22
  78. package/dist/src/views/team/condition-builders/ConditionFormRenderer.vue.d.ts +0 -23
  79. package/dist/src/views/team/condition-builders/component-map.d.ts +0 -4
  80. package/dist/src/views/team/condition-builders/condition-form-dedupe.d.ts +0 -23
  81. package/dist/useAppStore-BBsP5C3E.js +0 -169
  82. package/dist/useDebounce-B8ZPVS5C.js +0 -15
  83. /package/dist/src/views/{grant → pos-access}/Main.vue.d.ts +0 -0
@@ -0,0 +1,638 @@
1
+ import { defineComponent as ne, ref as I, computed as b, resolveComponent as h, createElementBlock as k, openBlock as f, Fragment as T, renderSlot as ye, createVNode as n, unref as a, withCtx as S, createElementVNode as r, createCommentVNode as E, renderList as ee, toDisplayString as _, createBlock as M, isRef as te, withModifiers as ae, createTextVNode as se, normalizeClass as ge, h as v } from "vue";
2
+ import { useI18n as ie } from "@feedmepos/mf-common";
3
+ import { useSnackbar as ce, components as U, useDialog as _e, useBreakpoints as Ce, FmButtonVariant as Y } from "@feedmepos/ui-library";
4
+ import { S as B } from "./SelectFilter-ATOm0hdn.js";
5
+ import { _ as xe } from "./app-DX-PG6wx.js";
6
+ import { _ as le, u as be, H as he } from "./FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js";
7
+ import { _ as ke } from "./index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js";
8
+ import { u as de } from "./useLoading-BH02lYns.js";
9
+ import { u as ue } from "./approval-code-Q4666xp5.js";
10
+ import { u as pe } from "./restaurant-YOVMuuFY.js";
11
+ import { _ as Ve } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
12
+ const we = {
13
+ discount: { subject: "order", actions: ["update"], conditions: { operation: "discount" } },
14
+ payment: { subject: "order", actions: ["update"], conditions: { operation: "payment" } },
15
+ claimDeposit: {
16
+ subject: "order",
17
+ actions: ["update"],
18
+ conditions: { operation: "claimDeposit" }
19
+ },
20
+ changePrice: { subject: "order", actions: ["update"], conditions: { operation: "changePrice" } },
21
+ void: { subject: "order", actions: ["update"], conditions: { operation: "void" } },
22
+ resend: { subject: "order", actions: ["update"], conditions: { operation: "resend" } },
23
+ changePaymentType: {
24
+ subject: "order",
25
+ actions: ["update"],
26
+ conditions: { operation: "changePaymentType" }
27
+ },
28
+ refund: { subject: "refund", actions: ["create"], conditions: { operation: "refund" } },
29
+ openDrawer: { subject: "drawer", actions: ["manage"], conditions: { operation: "openDrawer" } },
30
+ openCounter: {
31
+ subject: "counterRecord",
32
+ actions: ["manage"],
33
+ conditions: { operation: "openCounter" }
34
+ },
35
+ closeCounter: {
36
+ subject: "counterRecord",
37
+ actions: ["manage"],
38
+ conditions: { operation: "closeCounter" }
39
+ },
40
+ printReceipt: { subject: "order", actions: ["read"], conditions: { operation: "printReceipt" } }
41
+ };
42
+ function Se(d, l) {
43
+ const t = we[d], y = d === "discount" && (l == null ? void 0 : l.maxPercentage) !== void 0 ? { ...t.conditions, adjustment: { $lte: l.maxPercentage / 100 } } : { ...t.conditions };
44
+ return { key: d, subject: t.subject, actions: t.actions, conditions: y };
45
+ }
46
+ function Fe(d) {
47
+ var t;
48
+ const l = (t = d.conditions) == null ? void 0 : t.adjustment;
49
+ if (l && typeof l == "object" && "$lte" in l && typeof l.$lte == "number")
50
+ return Math.round(l.$lte * 100);
51
+ }
52
+ function me(d) {
53
+ return typeof d == "string" ? d.trim() : d;
54
+ }
55
+ function $e(d) {
56
+ const l = me(d);
57
+ if (l === void 0 || l === "") return !0;
58
+ const t = Number(l);
59
+ return Number.isInteger(t) && t >= 1 && t <= 100;
60
+ }
61
+ function Ae(d) {
62
+ const l = me(d);
63
+ if (!(l === void 0 || l === ""))
64
+ return Number(l);
65
+ }
66
+ const Q = [
67
+ { key: "printReceipt", ruleKeys: ["printReceipt"] },
68
+ { key: "resend", ruleKeys: ["resend"] },
69
+ { key: "openDrawer", ruleKeys: ["openDrawer"] },
70
+ { key: "counter", ruleKeys: ["openCounter", "closeCounter"] },
71
+ { key: "discount", ruleKeys: ["discount"] },
72
+ { key: "void", ruleKeys: ["void"] },
73
+ { key: "changePaymentType", ruleKeys: ["changePaymentType"] },
74
+ { key: "refund", ruleKeys: ["refund"] }
75
+ ];
76
+ function J(d) {
77
+ return d.usedAt ?? d.revokedAt;
78
+ }
79
+ function Pe(d, l) {
80
+ if (!l || l.length === 0) return !0;
81
+ const t = new Set(
82
+ l.flatMap(
83
+ (y) => {
84
+ var g;
85
+ return ((g = Q.find((V) => V.key === y)) == null ? void 0 : g.ruleKeys) ?? [];
86
+ }
87
+ )
88
+ );
89
+ return d.permissions.some((y) => t.has(y.key));
90
+ }
91
+ const Ie = { class: "fm-typo-en-title-md-600" }, je = { class: "space-y-40" }, Re = { class: "space-y-8" }, Ne = { class: "flex items-center gap-8" }, Be = {
92
+ key: 0,
93
+ class: "pl-32 pt-8"
94
+ }, Ke = {
95
+ key: 0,
96
+ class: "text-fm-color-typo-error text-sm"
97
+ }, De = {
98
+ key: 0,
99
+ class: "text-fm-color-typo-error text-sm"
100
+ }, Le = { class: "flex gap-8 items-center justify-start" }, Me = /* @__PURE__ */ ne({
101
+ __name: "ApprovalCodeForm",
102
+ setup(d, { expose: l }) {
103
+ const t = ue(), y = pe(), g = ce(), V = de(g), { t: i } = ie(), w = I(!1), K = () => ({
104
+ name: "",
105
+ restaurantId: "",
106
+ permissions: [],
107
+ count: 1
108
+ }), u = I(K()), C = I(void 0), z = () => {
109
+ u.value = K(), C.value = void 0, w.value = !0;
110
+ }, j = b(() => i("approvalCode.form.title")), D = b(() => i("common.create")), R = b(() => y.restaurants.value.map((c) => ({
111
+ label: `${c.profile.code ? c.profile.code + " - " : ""}${c.profile.name}`,
112
+ value: c._id
113
+ }))), A = (c) => u.value.permissions.includes(c), O = (c, p) => {
114
+ p && !A(c) && (u.value.permissions = [...u.value.permissions, c]), p || (u.value.permissions = u.value.permissions.filter((x) => x !== c));
115
+ }, N = b(
116
+ () => u.value.permissions.length === 0 ? i("approvalCode.form.permissionsRequired") : ""
117
+ ), F = b(() => A("discount") ? $e(C.value) ? "" : i("approvalCode.form.discountMaxPercentageInvalid") : "");
118
+ function q() {
119
+ const c = Ae(C.value);
120
+ return u.value.permissions.flatMap((p) => {
121
+ const x = Q.find((P) => P.key === p);
122
+ return x ? x.ruleKeys.map(
123
+ (P) => Se(P, { maxPercentage: c })
124
+ ) : [];
125
+ });
126
+ }
127
+ async function X() {
128
+ if (N.value) {
129
+ g.open({ message: N.value, type: "error" });
130
+ return;
131
+ }
132
+ if (F.value) {
133
+ g.open({ message: F.value, type: "error" });
134
+ return;
135
+ }
136
+ await V.minor(async () => {
137
+ const c = await t.createApprovalCodes({
138
+ name: u.value.name,
139
+ restaurantId: u.value.restaurantId,
140
+ count: Number(u.value.count),
141
+ permissions: q()
142
+ });
143
+ g.open({
144
+ message: c.length === 1 ? i("approvalCode.create.successMessage", { passcode: c[0].passcode }) : i("approvalCode.create.successMessageBulk", { count: c.length }),
145
+ type: "success"
146
+ });
147
+ }), w.value = !1;
148
+ }
149
+ return l({
150
+ show: w,
151
+ trigger: z
152
+ }), (c, p) => {
153
+ const x = h("FmTextField"), P = h("FmSelect"), H = h("FmCheckbox"), L = h("fm-button"), W = h("fm-side-sheet");
154
+ return f(), k(T, null, [
155
+ ye(c.$slots, "default", { trigger: z }),
156
+ n(W, {
157
+ id: "approval-code-form",
158
+ modelValue: w.value,
159
+ "onUpdate:modelValue": p[5] || (p[5] = (e) => w.value = e),
160
+ "is-container": a(U).FmForm,
161
+ "is-container-props": {
162
+ onValidationSuccess: X,
163
+ blameFormChildOnValidationFailed: !0
164
+ },
165
+ "max-width": 560
166
+ }, {
167
+ "side-sheet-header": S(() => [
168
+ r("p", Ie, _(j.value), 1)
169
+ ]),
170
+ "side-sheet-footer": S(() => [
171
+ r("div", Le, [
172
+ n(L, {
173
+ label: D.value,
174
+ size: "lg",
175
+ type: "submit",
176
+ variant: "primary"
177
+ }, null, 8, ["label"]),
178
+ n(L, {
179
+ label: a(i)("common.cancel"),
180
+ size: "lg",
181
+ variant: "tertiary",
182
+ onClick: p[4] || (p[4] = () => w.value = !1)
183
+ }, null, 8, ["label"])
184
+ ])
185
+ ]),
186
+ default: S(() => [
187
+ r("div", je, [
188
+ n(Ve, {
189
+ title: a(i)("approvalCode.form.section")
190
+ }, {
191
+ default: S(() => [
192
+ n(x, {
193
+ modelValue: u.value.name,
194
+ "onUpdate:modelValue": p[0] || (p[0] = (e) => u.value.name = e),
195
+ label: a(i)("approvalCode.form.name"),
196
+ rules: [(e) => !!e || a(i)("approvalCode.form.nameRequired")]
197
+ }, null, 8, ["modelValue", "label", "rules"]),
198
+ n(le, {
199
+ label: a(i)("approvalCode.form.restaurant")
200
+ }, {
201
+ default: S(() => [
202
+ n(P, {
203
+ modelValue: u.value.restaurantId,
204
+ "onUpdate:modelValue": p[1] || (p[1] = (e) => u.value.restaurantId = e),
205
+ items: R.value,
206
+ placeholder: a(i)("approvalCode.form.selectRestaurant"),
207
+ rules: [(e) => !!e || a(i)("approvalCode.form.restaurantRequired")]
208
+ }, null, 8, ["modelValue", "items", "placeholder", "rules"])
209
+ ]),
210
+ _: 1
211
+ }, 8, ["label"]),
212
+ n(le, {
213
+ label: a(i)("approvalCode.form.permissions")
214
+ }, {
215
+ default: S(() => [
216
+ r("div", Re, [
217
+ (f(!0), k(T, null, ee(a(Q), (e) => (f(), k("div", {
218
+ key: e.key
219
+ }, [
220
+ r("div", Ne, [
221
+ n(H, {
222
+ "model-value": A(e.key),
223
+ value: e.key,
224
+ size: "sm",
225
+ dense: "",
226
+ "onUpdate:modelValue": (o) => O(e.key, o)
227
+ }, null, 8, ["model-value", "value", "onUpdate:modelValue"]),
228
+ r("span", null, _(a(i)(`approvalCode.permissions.${e.key}`)), 1)
229
+ ]),
230
+ e.key === "discount" && A("discount") ? (f(), k("div", Be, [
231
+ n(x, {
232
+ modelValue: C.value,
233
+ "onUpdate:modelValue": p[2] || (p[2] = (o) => C.value = o),
234
+ type: "number",
235
+ class: "max-w-[200px]",
236
+ label: a(i)("approvalCode.form.discountMaxPercentage")
237
+ }, null, 8, ["modelValue", "label"]),
238
+ F.value ? (f(), k("p", Ke, _(F.value), 1)) : E("", !0)
239
+ ])) : E("", !0)
240
+ ]))), 128)),
241
+ N.value ? (f(), k("p", De, _(N.value), 1)) : E("", !0)
242
+ ])
243
+ ]),
244
+ _: 1
245
+ }, 8, ["label"]),
246
+ n(x, {
247
+ modelValue: u.value.count,
248
+ "onUpdate:modelValue": p[3] || (p[3] = (e) => u.value.count = e),
249
+ modelModifiers: { number: !0 },
250
+ type: "number",
251
+ label: a(i)("approvalCode.form.count"),
252
+ rules: [
253
+ (e) => Number.isInteger(Number(e)) && Number(e) >= 1 && Number(e) <= 20 || a(i)("approvalCode.form.countRange")
254
+ ]
255
+ }, null, 8, ["modelValue", "label", "rules"])
256
+ ]),
257
+ _: 1
258
+ }, 8, ["title"])
259
+ ])
260
+ ]),
261
+ _: 1
262
+ }, 8, ["modelValue", "is-container", "is-container-props"])
263
+ ], 64);
264
+ };
265
+ }
266
+ }), Ue = {
267
+ class: "space-y-8"
268
+ }, Te = {
269
+ class: "xs:hidden flex w-full items-start justify-between"
270
+ }, Ee = {
271
+ class: "flex items-start gap-8"
272
+ }, ze = {
273
+ class: "space-y-4 hidden xs:block"
274
+ }, Oe = {
275
+ class: "px-16"
276
+ }, qe = {
277
+ class: "px-16 flex items-start gap-8"
278
+ }, He = {
279
+ class: "pb-64 hidden xs:block"
280
+ }, We = {
281
+ class: "space-y-4"
282
+ }, Ge = {
283
+ class: "flex items-center gap-8"
284
+ }, Ze = {
285
+ class: "fm-typo-en-body-lg-600"
286
+ }, Je = {
287
+ class: "font-mono text-lg font-bold mr-4"
288
+ }, Qe = {
289
+ class: "text-fm-color-typo-secondary"
290
+ }, Xe = {
291
+ class: "text-xs"
292
+ }, Ye = {
293
+ class: "flex flex-wrap gap-4 mt-4"
294
+ }, eo = {
295
+ class: "mt-4 space-y-2"
296
+ }, oo = {
297
+ class: "text-xs"
298
+ }, to = {
299
+ class: "text-xs"
300
+ }, ao = {
301
+ key: 0,
302
+ class: "text-xs"
303
+ }, so = {
304
+ class: "flex flex-col gap-4"
305
+ }, re = 10, go = /* @__PURE__ */ ne({
306
+ __name: "ApprovalCodeList",
307
+ setup(d, {
308
+ expose: l
309
+ }) {
310
+ const {
311
+ t
312
+ } = ie(), y = I(), g = I(), V = I(), i = ue(), {
313
+ restaurants: w
314
+ } = pe(), K = b(() => Q.map((e) => ({
315
+ label: t(`approvalCode.permissions.${e.key}`),
316
+ value: e.key
317
+ }))), u = b(() => i.approvalCodes), {
318
+ searchKey: C,
319
+ filter: z
320
+ } = be(), j = b(() => {
321
+ const e = {};
322
+ return w.value.forEach((o) => {
323
+ e[o._id] = o.profile.name;
324
+ }), e;
325
+ }), D = (e) => e.permissions.map((o) => {
326
+ const m = t(`approvalCode.permissions.${o.key}`), $ = Fe(o);
327
+ return $ === void 0 ? m : `${m} ≤${$}%`;
328
+ }), R = b(() => {
329
+ var e;
330
+ return (e = u.value) == null ? void 0 : e.filter((o) => {
331
+ const m = !y.value || y.value.includes(o.restaurantId), $ = !g.value || g.value.includes(o.status), G = j.value[o.restaurantId] || "";
332
+ return m && $ && Pe(o, V.value) && z([o.passcode, o.name, G, o.grantByName, ...D(o)]);
333
+ });
334
+ }), A = (e) => {
335
+ switch (e) {
336
+ case "active":
337
+ return "bg-fm-color-system-success-100 text-fm-color-typo-success";
338
+ case "used":
339
+ return "bg-fm-color-typo-tertiary text-fm-color-typo-primary";
340
+ case "revoked":
341
+ return "bg-fm-color-system-error-100 text-fm-color-typo-error";
342
+ default:
343
+ return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
344
+ }
345
+ }, O = (e) => t(`approvalCode.status.${e}`), N = [{
346
+ accessorKey: "passcode",
347
+ size: 120,
348
+ maxSize: 120,
349
+ minSize: 120,
350
+ header: () => t("approvalCode.columns.passcode"),
351
+ cell(e) {
352
+ const o = e.row.original.passcode;
353
+ return v("div", {
354
+ class: "flex items-center gap-8"
355
+ }, [v(U.FmButton, {
356
+ variant: Y.Tertiary,
357
+ textColor: "neutral-gray-400",
358
+ icon: "content_copy",
359
+ onClick: (m) => {
360
+ m.stopPropagation(), W(o);
361
+ }
362
+ }), v("span", {
363
+ class: "font-mono text-lg font-bold"
364
+ }, o)]);
365
+ }
366
+ }, {
367
+ accessorKey: "name",
368
+ header: () => t("approvalCode.columns.name"),
369
+ enableSorting: !1
370
+ }, {
371
+ accessorKey: "permissions",
372
+ header: () => t("approvalCode.columns.permissions"),
373
+ enableSorting: !1,
374
+ cell(e) {
375
+ const o = e.row.original;
376
+ return v("div", {
377
+ class: "flex flex-wrap gap-4 py-8"
378
+ }, D(o).map((m) => v(U.FmChip, {
379
+ label: m
380
+ })));
381
+ }
382
+ }, {
383
+ accessorKey: "restaurantName",
384
+ accessorFn: (e) => j.value[e.restaurantId],
385
+ header: () => t("approvalCode.columns.restaurant"),
386
+ enableSorting: !1,
387
+ meta: {
388
+ width: "220px"
389
+ },
390
+ cell(e) {
391
+ const o = e.row.original.restaurantId, m = j.value[o] || "-";
392
+ return v("div", [v("div", m), v("div", {
393
+ class: "text-fm-color-typo-secondary text-sm"
394
+ }, `${o}`)]);
395
+ }
396
+ }, {
397
+ accessorKey: "status",
398
+ header: () => t("approvalCode.columns.status"),
399
+ enableSorting: !1,
400
+ meta: {
401
+ maxWidth: "120px"
402
+ },
403
+ cell(e) {
404
+ const o = e.row.original.status;
405
+ return v(U.FmChip, {
406
+ label: O(o),
407
+ class: A(o)
408
+ });
409
+ }
410
+ }, {
411
+ accessorKey: "createdAt",
412
+ header: () => t("approvalCode.columns.createdAt"),
413
+ cell(e) {
414
+ const o = e.row.original.createdAt;
415
+ return v("div", new Date(o).toLocaleString());
416
+ }
417
+ }, {
418
+ id: "resolvedAt",
419
+ accessorFn: (e) => J(e) ?? "",
420
+ header: () => t("approvalCode.columns.resolvedAt"),
421
+ cell(e) {
422
+ const o = J(e.row.original);
423
+ return v("div", o ? new Date(o).toLocaleString() : "-");
424
+ }
425
+ }, {
426
+ accessorKey: "grantByName",
427
+ header: () => t("approvalCode.columns.grantedBy"),
428
+ enableSorting: !1,
429
+ cell(e) {
430
+ const o = e.row.original.grantById, m = e.row.original.grantByName;
431
+ return v("div", [v("div", m), v("div", {
432
+ class: "text-fm-color-typo-secondary text-sm"
433
+ }, `${o}`)]);
434
+ }
435
+ }, {
436
+ id: "action",
437
+ size: 140,
438
+ minSize: 140,
439
+ enableSorting: !1,
440
+ meta: {
441
+ cellClass: "p-16",
442
+ headerContentClass: "-mx-16"
443
+ },
444
+ cell: (e) => {
445
+ const o = e.row.original, m = [];
446
+ return o.status === "active" && m.push(v(U.FmButton, {
447
+ label: t("approvalCode.actions.revoke"),
448
+ variant: Y.Secondary,
449
+ onClick: ($) => {
450
+ $.stopPropagation(), x(o);
451
+ }
452
+ })), v("div", {
453
+ class: "w-full flex justify-end items-center gap-4"
454
+ }, m);
455
+ }
456
+ }], F = ce(), q = _e(), X = de(F), c = I(), {
457
+ breakpoints: p
458
+ } = Ce(), x = (e) => {
459
+ q.open({
460
+ title: t("approvalCode.revoke.title"),
461
+ message: t("approvalCode.revoke.message", {
462
+ name: e.name
463
+ }),
464
+ minWidth: p.value.lg ? 588 : 0,
465
+ primaryActions: {
466
+ text: t("approvalCode.actions.revoke"),
467
+ close: !1,
468
+ variant: "destructive"
469
+ },
470
+ secondaryActions: {
471
+ text: t("common.cancel"),
472
+ close: !0
473
+ }
474
+ }).onPrimary(async () => {
475
+ X.minor(async () => {
476
+ await i.revokeApprovalCode(e._id, e.restaurantId);
477
+ }, {
478
+ successMessage: t("approvalCode.revoke.successMessage", {
479
+ name: e.name
480
+ })
481
+ }), q.close();
482
+ });
483
+ };
484
+ function P() {
485
+ var e;
486
+ (e = c.value) == null || e.trigger();
487
+ }
488
+ const H = b(() => [{
489
+ label: t("approvalCode.status.active"),
490
+ value: "active"
491
+ }, {
492
+ label: t("approvalCode.status.used"),
493
+ value: "used"
494
+ }, {
495
+ label: t("approvalCode.status.revoked"),
496
+ value: "revoked"
497
+ }]), L = b(() => w.value.map((e) => ({
498
+ label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
499
+ value: e._id
500
+ })));
501
+ async function W(e) {
502
+ try {
503
+ await navigator.clipboard.writeText(e), F.open({
504
+ message: t("approvalCode.passcode.copied"),
505
+ type: "success"
506
+ });
507
+ } catch (o) {
508
+ F.open({
509
+ message: String(o),
510
+ type: "error"
511
+ });
512
+ }
513
+ }
514
+ return l({
515
+ create: P,
516
+ filteredApprovalCodes: R
517
+ }), (e, o) => {
518
+ const m = h("FmSearch"), $ = h("FmTable"), G = h("FmButton"), oe = h("FmChip"), ve = h("FmListItem"), fe = h("FmList");
519
+ return f(), k(T, null, [n(Me, {
520
+ ref_key: "approvalCodeFormRef",
521
+ ref: c,
522
+ class: "gap-8"
523
+ }, null, 512), r("div", Ue, [r("div", Te, [r("div", Ee, [n(B, {
524
+ modelValue: V.value,
525
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => V.value = s),
526
+ multiple: "",
527
+ variant: "dark",
528
+ items: K.value,
529
+ "selected-prefix": a(t)("approvalCode.filter.selected_action_prefix"),
530
+ placeholder: a(t)("approvalCode.filter.action_placeholder"),
531
+ class: "!w-auto"
532
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(B, {
533
+ modelValue: y.value,
534
+ "onUpdate:modelValue": o[1] || (o[1] = (s) => y.value = s),
535
+ multiple: "",
536
+ items: L.value,
537
+ variant: "dark",
538
+ "selected-prefix": a(t)("approvalCode.columns.restaurant"),
539
+ placeholder: a(t)("approvalCode.columns.restaurant"),
540
+ class: "!w-auto"
541
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(B, {
542
+ modelValue: g.value,
543
+ "onUpdate:modelValue": o[2] || (o[2] = (s) => g.value = s),
544
+ multiple: "",
545
+ variant: "dark",
546
+ items: H.value,
547
+ "selected-prefix": a(t)("approvalCode.filter.selected_status_prefix"),
548
+ placeholder: a(t)("approvalCode.filter.status_placeholder")
549
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), n(m, {
550
+ modelValue: a(C),
551
+ "onUpdate:modelValue": o[3] || (o[3] = (s) => te(C) ? C.value = s : null),
552
+ autofocus: "",
553
+ class: "pl-4 w-[320px]",
554
+ placeholder: a(t)("approvalCode.search.placeholder")
555
+ }, null, 8, ["modelValue", "placeholder"])]), r("div", ze, [r("div", Oe, [n(m, {
556
+ modelValue: a(C),
557
+ "onUpdate:modelValue": o[4] || (o[4] = (s) => te(C) ? C.value = s : null),
558
+ autofocus: "",
559
+ placeholder: a(t)("approvalCode.search.placeholder")
560
+ }, null, 8, ["modelValue", "placeholder"])]), n(he), r("div", qe, [n(B, {
561
+ modelValue: V.value,
562
+ "onUpdate:modelValue": o[5] || (o[5] = (s) => V.value = s),
563
+ multiple: "",
564
+ variant: "dark",
565
+ items: K.value,
566
+ "selected-prefix": a(t)("approvalCode.filter.selected_action_prefix"),
567
+ placeholder: a(t)("approvalCode.filter.action_placeholder"),
568
+ class: "!w-auto"
569
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(B, {
570
+ modelValue: y.value,
571
+ "onUpdate:modelValue": o[6] || (o[6] = (s) => y.value = s),
572
+ multiple: "",
573
+ items: L.value,
574
+ variant: "dark",
575
+ "selected-prefix": a(t)("approvalCode.columns.restaurant"),
576
+ placeholder: a(t)("approvalCode.columns.restaurant"),
577
+ class: "!w-auto"
578
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(B, {
579
+ modelValue: g.value,
580
+ "onUpdate:modelValue": o[7] || (o[7] = (s) => g.value = s),
581
+ multiple: "",
582
+ variant: "dark",
583
+ items: H.value,
584
+ "selected-prefix": a(t)("approvalCode.filter.selected_status_prefix"),
585
+ placeholder: a(t)("approvalCode.filter.status_placeholder")
586
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), u.value.length > 0 || a(i).isLoading ? (f(), M(xe, {
587
+ key: 0,
588
+ class: "overflow-auto"
589
+ }, {
590
+ default: S(() => [n($, {
591
+ class: "xs:hidden",
592
+ "column-defs": N,
593
+ "row-data": R.value,
594
+ "page-size": re,
595
+ "hide-footer": R.value.length <= re,
596
+ loading: a(i).isLoading,
597
+ virtual: !1,
598
+ "pin-header-row": ""
599
+ }, null, 8, ["row-data", "hide-footer", "loading"]), r("div", He, [n(fe, {
600
+ separator: ""
601
+ }, {
602
+ default: S(() => [(f(!0), k(T, null, ee(R.value, (s) => (f(), M(ve, {
603
+ key: s._id,
604
+ class: "py-12 px-16 items-center justify-between"
605
+ }, {
606
+ default: S(() => [r("div", We, [r("div", Ge, [n(G, {
607
+ variant: "tertiary",
608
+ "text-color": "neutral-gray-400",
609
+ icon: "content_copy",
610
+ onClick: ae((Z) => W(s.passcode), ["stop"])
611
+ }, null, 8, ["onClick"]), r("p", Ze, [r("span", Je, _(s.passcode), 1), se(" - " + _(s.name), 1)])]), r("div", Qe, [r("div", null, [se(_(j.value[s.restaurantId] || "-") + " ", 1), r("div", Xe, _(s.restaurantId), 1)]), r("div", Ye, [(f(!0), k(T, null, ee(D(s), (Z) => (f(), M(oe, {
612
+ key: Z,
613
+ label: Z
614
+ }, null, 8, ["label"]))), 128))]), r("div", eo, [r("div", oo, _(a(t)("approvalCode.columns.grantedBy")) + ": " + _(s.grantByName), 1), r("div", to, _(a(t)("approvalCode.columns.createdAt")) + ": " + _(new Date(s.createdAt).toLocaleString()), 1), a(J)(s) ? (f(), k("div", ao, _(a(t)("approvalCode.columns.resolvedAt")) + ": " + _(new Date(a(J)(s)).toLocaleString()), 1)) : E("", !0), n(oe, {
615
+ label: O(s.status),
616
+ class: ge(A(s.status))
617
+ }, null, 8, ["label", "class"])])])]), r("div", so, [s.status === "active" ? (f(), M(G, {
618
+ key: 0,
619
+ label: a(t)("approvalCode.actions.revoke"),
620
+ variant: a(Y).Secondary,
621
+ onClick: ae((Z) => x(s), ["stop"])
622
+ }, null, 8, ["label", "variant", "onClick"])) : E("", !0)])]),
623
+ _: 2
624
+ }, 1024))), 128))]),
625
+ _: 1
626
+ })])]),
627
+ _: 1
628
+ })) : (f(), M(a(ke), {
629
+ key: 1,
630
+ title: a(t)("approvalCode.noData.title"),
631
+ subtitle: a(t)("approvalCode.noData.subtitle")
632
+ }, null, 8, ["title", "subtitle"]))])], 64);
633
+ };
634
+ }
635
+ });
636
+ export {
637
+ go as default
638
+ };