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

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