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