@feedmepos/mf-hrm-portal 2.0.5 → 2.0.6-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AuditLogList-Bkl9koQT.js → AuditLogList-C23_MiyK.js} +7 -6
- package/dist/{EmployeeList-BnbjfqyP.js → EmployeeList-vXPEVqoh.js} +164 -169
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js +71 -0
- package/dist/HorizontalSplitter-o860F4xM.js +12 -0
- package/dist/Main-CQWe1-SW.js +599 -0
- package/dist/{Main-CoVghvwW.js → Main-DC9H9bAs.js} +11 -10
- package/dist/{Main-8ZaM5D9M.js → Main-k56Iy_zg.js} +8 -7
- package/dist/{PermissionSetList-B0yqDASK.js → PermissionSetList-B8tJCNpR.js} +53 -52
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CXirNGg0.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BPJpVG8_.js} +588 -587
- package/dist/{RoleList-CiNle1dZ.js → RoleList-C5WA3Kxu.js} +26 -24
- package/dist/{TeamMemberList-5DyItOsQ.js → TeamMemberList-Ic-iWBHd.js} +10 -9
- package/dist/{TimesheetList-DxQ-vb_m.js → TimesheetList-DlGpcOUp.js} +11 -10
- package/dist/{app-CVfFuJ_U.js → app-D0xH_99A.js} +984 -713
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-CeMMJfCO.js → dayjs.min-C1rTVn8X.js} +1 -1
- package/dist/{employee-BsYVIIOi.js → employee-BK4sYiRy.js} +21 -20
- package/dist/index-C2ubYSVV.js +968 -0
- package/dist/{index-DIVnaoZ6.js → index-DSAB4vz3.js} +1 -1
- package/dist/{index-DwcKO5a4.js → iteration-BSGKcAZm.js} +3468 -4430
- package/dist/{lodash-DazWE7Hy.js → lodash-CeTePH4O.js} +1 -1
- package/dist/src/api/grant-user/index.d.ts +8 -0
- package/dist/src/api/index.d.ts +3 -1
- package/dist/src/router/shared.d.ts +2 -1
- package/dist/src/stores/grant-user.d.ts +86 -0
- package/dist/src/types/grant-user.d.ts +27 -0
- package/dist/src/views/grant/GrantUserList.vue.d.ts +17 -0
- package/dist/src/views/grant/Main.vue.d.ts +2 -0
- package/dist/src/views/grant/components/GrantUserForm.vue.d.ts +17 -0
- package/dist/src/views/grant/locales/index.d.ts +232 -0
- package/dist/{team-C9sSArLP.js → team-B25hRkju.js} +1 -1
- package/dist/{timesheet-C0-tKt4w.js → timesheet-C8oy-bxz.js} +10 -9
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-4NX8u34B.js → useAppStore-WGnUS7Wm.js} +1 -1
- package/dist/{useLoading-BDG-so15.js → useLoading-BCi2g_rf.js} +1 -1
- package/dist/{useReportPermissions-1NZr3RRg.js → useReportPermissions--LOfl1e-.js} +12 -11
- package/dist/useRestaurantMap-e9fQJiLC.js +39 -0
- package/package.json +1 -1
- package/dist/useRestaurantMap-D5BNPLKh.js +0 -107
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent as i, createElementBlock as s, openBlock as o, createElementVNode as l, renderSlot as n, createCommentVNode as c, toDisplayString as a, normalizeClass as d, createVNode as m, withCtx as f } from "vue";
|
|
2
|
+
const p = { class: "space-y-8" }, y = { class: "flex items-center justify-between" }, h = { class: "space-y-8" }, u = { class: "fm-typo-en-body-lg-600" }, _ = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
5
|
+
}, w = /* @__PURE__ */ i({
|
|
6
|
+
__name: "FormItem",
|
|
7
|
+
props: {
|
|
8
|
+
label: {},
|
|
9
|
+
description: {}
|
|
10
|
+
},
|
|
11
|
+
setup(e) {
|
|
12
|
+
return (t, r) => (o(), s("div", p, [
|
|
13
|
+
l("div", y, [
|
|
14
|
+
l("div", h, [
|
|
15
|
+
l("p", u, a(e.label), 1),
|
|
16
|
+
e.description ? (o(), s("p", _, a(e.description), 1)) : c("", !0)
|
|
17
|
+
]),
|
|
18
|
+
n(t.$slots, "append")
|
|
19
|
+
]),
|
|
20
|
+
n(t.$slots, "default")
|
|
21
|
+
]));
|
|
22
|
+
}
|
|
23
|
+
}), b = /* @__PURE__ */ i({
|
|
24
|
+
__name: "FormColumn",
|
|
25
|
+
props: {
|
|
26
|
+
shrinkable: { type: Boolean }
|
|
27
|
+
},
|
|
28
|
+
setup(e) {
|
|
29
|
+
return (t, r) => (o(), s("div", {
|
|
30
|
+
class: d(["flex-1 flex flex-col space-y-24", { "min-h-0": e.shrinkable }])
|
|
31
|
+
}, [
|
|
32
|
+
n(t.$slots, "default")
|
|
33
|
+
], 2));
|
|
34
|
+
}
|
|
35
|
+
}), k = {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: "flex flex-row justify-between items-center"
|
|
38
|
+
}, $ = { class: "space-y-4" }, x = { class: "fm-typo-en-title-sm-600" }, v = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
41
|
+
}, B = /* @__PURE__ */ i({
|
|
42
|
+
__name: "FormSection",
|
|
43
|
+
props: {
|
|
44
|
+
title: {},
|
|
45
|
+
subTitle: {},
|
|
46
|
+
shrinkable: { type: Boolean }
|
|
47
|
+
},
|
|
48
|
+
setup(e) {
|
|
49
|
+
return (t, r) => (o(), s("div", {
|
|
50
|
+
class: d(["flex flex-col space-y-16", { "min-h-0": e.shrinkable }])
|
|
51
|
+
}, [
|
|
52
|
+
e.title ? (o(), s("div", k, [
|
|
53
|
+
l("div", $, [
|
|
54
|
+
l("p", x, a(e.title), 1),
|
|
55
|
+
e.subTitle ? (o(), s("p", v, a(e.subTitle), 1)) : c("", !0)
|
|
56
|
+
]),
|
|
57
|
+
n(t.$slots, "append-title")
|
|
58
|
+
])) : c("", !0),
|
|
59
|
+
m(b, { shrinkable: e.shrinkable }, {
|
|
60
|
+
default: f(() => [
|
|
61
|
+
n(t.$slots, "default")
|
|
62
|
+
]),
|
|
63
|
+
_: 3
|
|
64
|
+
}, 8, ["shrinkable"])
|
|
65
|
+
], 2));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
B as _,
|
|
70
|
+
w as a
|
|
71
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createElementBlock as e, openBlock as o, createElementVNode as t } from "vue";
|
|
2
|
+
import { _ as l } from "./SelectFilter-DUj7GBtT.js";
|
|
3
|
+
const n = {};
|
|
4
|
+
function c(s, r) {
|
|
5
|
+
return o(), e("div", null, [...r[0] || (r[0] = [
|
|
6
|
+
t("div", { class: "h-px w-full bg-fm-color-neutral-gray-100" }, null, -1)
|
|
7
|
+
])]);
|
|
8
|
+
}
|
|
9
|
+
const i = /* @__PURE__ */ l(n, [["render", c]]);
|
|
10
|
+
export {
|
|
11
|
+
i as H
|
|
12
|
+
};
|
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import { ref as k, defineComponent as Y, computed as I, watch as ue, resolveComponent as x, createElementBlock as E, openBlock as S, Fragment as X, renderSlot as _e, createVNode as o, unref as s, withCtx as h, createElementVNode as l, toDisplayString as V, createBlock as j, isRef as oe, renderList as Ue, createCommentVNode as xe, withModifiers as ne, createTextVNode as le, normalizeClass as be, h as y } from "vue";
|
|
2
|
+
import { useCoreStore as Z, useI18n as ee, RestaurantSelector as J } from "@feedmepos/mf-common";
|
|
3
|
+
import { _ as he } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
|
|
4
|
+
import { u as te } from "./useAppStore-WGnUS7Wm.js";
|
|
5
|
+
import { defineStore as we } from "pinia";
|
|
6
|
+
import { g as M, a as Ve, b as Q } from "./iteration-BSGKcAZm.js";
|
|
7
|
+
import { useSnackbar as de, components as O, useDialog as ke, useBreakpoints as Fe, FmButtonVariant as K } from "@feedmepos/ui-library";
|
|
8
|
+
import { S as ce } from "./SelectFilter-DUj7GBtT.js";
|
|
9
|
+
import { _ as Ie } from "./app-D0xH_99A.js";
|
|
10
|
+
import { H as Se } from "./HorizontalSplitter-o860F4xM.js";
|
|
11
|
+
import { _ as Ce } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
12
|
+
import { u as Be } from "./useSearch-B6WK1LBB.js";
|
|
13
|
+
import { u as me } from "./useLoading-BCi2g_rf.js";
|
|
14
|
+
import { _ as $e, a as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js";
|
|
15
|
+
const q = {
|
|
16
|
+
async getGrantUsers() {
|
|
17
|
+
return M(await Q("grant").get(""));
|
|
18
|
+
},
|
|
19
|
+
async createGrantUser(p) {
|
|
20
|
+
return M(await Q("grant").post("", p));
|
|
21
|
+
},
|
|
22
|
+
async revokeGrantUser(p, _) {
|
|
23
|
+
return M(
|
|
24
|
+
await Q("grant").patch(`/revoke/${p}`, null, {
|
|
25
|
+
params: { restaurantId: _ }
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
// TODO: For testing, remove when deploy
|
|
30
|
+
async validatePasscode(p, _) {
|
|
31
|
+
return M(
|
|
32
|
+
await Ve().post("", {
|
|
33
|
+
passcode: p,
|
|
34
|
+
restaurantId: _
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}, Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
39
|
+
__proto__: null,
|
|
40
|
+
default: q
|
|
41
|
+
}, Symbol.toStringTag, { value: "Module" })), Re = we("grantUser", () => {
|
|
42
|
+
const p = k([]), _ = k(!1);
|
|
43
|
+
async function a() {
|
|
44
|
+
_.value = !0;
|
|
45
|
+
try {
|
|
46
|
+
p.value = (await q.getGrantUsers()).sort(
|
|
47
|
+
(d, m) => d.createdAt < m.createdAt ? 1 : -1
|
|
48
|
+
);
|
|
49
|
+
} catch (d) {
|
|
50
|
+
throw console.error("Error reading grant users:", d), d;
|
|
51
|
+
} finally {
|
|
52
|
+
_.value = !1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function U(d) {
|
|
56
|
+
try {
|
|
57
|
+
const m = await q.createGrantUser(d);
|
|
58
|
+
return p.value = [m, ...p.value], m;
|
|
59
|
+
} catch (m) {
|
|
60
|
+
throw console.error("Error creating grant user:", m), m;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function b(d, m) {
|
|
64
|
+
try {
|
|
65
|
+
const n = await q.revokeGrantUser(d, m), c = p.value.findIndex((i) => i._id === d);
|
|
66
|
+
c !== -1 && (p.value[c] = n);
|
|
67
|
+
} catch (n) {
|
|
68
|
+
throw console.error("Error revoking grant user:", n), n;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
grantUsers: p,
|
|
73
|
+
isLoading: _,
|
|
74
|
+
readGrantUsers: a,
|
|
75
|
+
createGrantUser: U,
|
|
76
|
+
revokeGrantUser: b
|
|
77
|
+
};
|
|
78
|
+
}), ae = Re, Le = { class: "fm-typo-en-title-md-600" }, Ne = { class: "space-y-40" }, Pe = { class: "flex gap-8 items-center justify-start" }, Ae = /* @__PURE__ */ Y({
|
|
79
|
+
__name: "GrantUserForm",
|
|
80
|
+
setup(p, { expose: _ }) {
|
|
81
|
+
const a = ae(), U = te(), b = Z(), d = de(), m = me(d), { t: n } = ee(), c = k(!1), i = k({
|
|
82
|
+
name: "",
|
|
83
|
+
restaurantId: "",
|
|
84
|
+
roleId: ""
|
|
85
|
+
}), w = () => {
|
|
86
|
+
i.value = {
|
|
87
|
+
name: "",
|
|
88
|
+
restaurantId: "",
|
|
89
|
+
roleId: ""
|
|
90
|
+
}, c.value = !0;
|
|
91
|
+
}, C = I(() => n("grantUser.form.title")), F = I(() => n("common.create")), L = I(() => b.restaurants.value.map((u) => ({
|
|
92
|
+
label: `${u.profile.code ? u.profile.code + " - " : ""}${u.profile.name}`,
|
|
93
|
+
value: u._id
|
|
94
|
+
}))), N = I(() => i.value.restaurantId ? U.roles.value.filter((u) => u.restaurants.some((v) => v.id === i.value.restaurantId)).map((u) => ({
|
|
95
|
+
label: u.name,
|
|
96
|
+
value: u._id,
|
|
97
|
+
disabled: !u.isUsable
|
|
98
|
+
})) : []);
|
|
99
|
+
ue(
|
|
100
|
+
() => i.value.restaurantId,
|
|
101
|
+
() => {
|
|
102
|
+
i.value.roleId = "";
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
async function H() {
|
|
106
|
+
await m.minor(async () => {
|
|
107
|
+
const u = await a.createGrantUser(i.value);
|
|
108
|
+
d.open({
|
|
109
|
+
message: n("grantUser.create.successMessage", {
|
|
110
|
+
passcode: u.passcode
|
|
111
|
+
}),
|
|
112
|
+
type: "success"
|
|
113
|
+
});
|
|
114
|
+
}), c.value = !1;
|
|
115
|
+
}
|
|
116
|
+
return _({
|
|
117
|
+
show: c,
|
|
118
|
+
trigger: w
|
|
119
|
+
}), (u, v) => {
|
|
120
|
+
const P = x("FmTextField"), R = x("FmSelect"), A = x("fm-button"), z = x("fm-side-sheet");
|
|
121
|
+
return S(), E(X, null, [
|
|
122
|
+
_e(u.$slots, "default", { trigger: w }),
|
|
123
|
+
o(z, {
|
|
124
|
+
id: "grant-user-form",
|
|
125
|
+
modelValue: c.value,
|
|
126
|
+
"onUpdate:modelValue": v[4] || (v[4] = (g) => c.value = g),
|
|
127
|
+
"is-container": s(O).FmForm,
|
|
128
|
+
"is-container-props": {
|
|
129
|
+
onValidationSuccess: H,
|
|
130
|
+
blameFormChildOnValidationFailed: !0
|
|
131
|
+
},
|
|
132
|
+
"max-width": 560
|
|
133
|
+
}, {
|
|
134
|
+
"side-sheet-header": h(() => [
|
|
135
|
+
l("p", Le, V(C.value), 1)
|
|
136
|
+
]),
|
|
137
|
+
"side-sheet-footer": h(() => [
|
|
138
|
+
l("div", Pe, [
|
|
139
|
+
o(A, {
|
|
140
|
+
label: F.value,
|
|
141
|
+
size: "lg",
|
|
142
|
+
type: "submit",
|
|
143
|
+
variant: "primary"
|
|
144
|
+
}, null, 8, ["label"]),
|
|
145
|
+
o(A, {
|
|
146
|
+
label: s(n)("common.cancel"),
|
|
147
|
+
size: "lg",
|
|
148
|
+
variant: "tertiary",
|
|
149
|
+
onClick: v[3] || (v[3] = () => c.value = !1)
|
|
150
|
+
}, null, 8, ["label"])
|
|
151
|
+
])
|
|
152
|
+
]),
|
|
153
|
+
default: h(() => [
|
|
154
|
+
l("div", Ne, [
|
|
155
|
+
o($e, {
|
|
156
|
+
title: s(n)("grantUser.form.section")
|
|
157
|
+
}, {
|
|
158
|
+
default: h(() => [
|
|
159
|
+
o(P, {
|
|
160
|
+
modelValue: i.value.name,
|
|
161
|
+
"onUpdate:modelValue": v[0] || (v[0] = (g) => i.value.name = g),
|
|
162
|
+
label: s(n)("grantUser.form.name"),
|
|
163
|
+
rules: [(g) => !!g || s(n)("grantUser.form.nameRequired")]
|
|
164
|
+
}, null, 8, ["modelValue", "label", "rules"]),
|
|
165
|
+
o(ie, {
|
|
166
|
+
label: s(n)("grantUser.form.restaurant")
|
|
167
|
+
}, {
|
|
168
|
+
default: h(() => [
|
|
169
|
+
o(R, {
|
|
170
|
+
modelValue: i.value.restaurantId,
|
|
171
|
+
"onUpdate:modelValue": v[1] || (v[1] = (g) => i.value.restaurantId = g),
|
|
172
|
+
items: L.value,
|
|
173
|
+
placeholder: s(n)("grantUser.form.selectRestaurant"),
|
|
174
|
+
rules: [(g) => !!g || s(n)("grantUser.form.restaurantRequired")]
|
|
175
|
+
}, null, 8, ["modelValue", "items", "placeholder", "rules"])
|
|
176
|
+
]),
|
|
177
|
+
_: 1
|
|
178
|
+
}, 8, ["label"]),
|
|
179
|
+
o(ie, {
|
|
180
|
+
label: s(n)("grantUser.form.role")
|
|
181
|
+
}, {
|
|
182
|
+
default: h(() => [
|
|
183
|
+
o(R, {
|
|
184
|
+
modelValue: i.value.roleId,
|
|
185
|
+
"onUpdate:modelValue": v[2] || (v[2] = (g) => i.value.roleId = g),
|
|
186
|
+
items: N.value,
|
|
187
|
+
placeholder: s(n)("grantUser.form.selectRole"),
|
|
188
|
+
disabled: !i.value.restaurantId,
|
|
189
|
+
rules: [(g) => !!g || s(n)("grantUser.form.roleRequired")]
|
|
190
|
+
}, null, 8, ["modelValue", "items", "placeholder", "disabled", "rules"])
|
|
191
|
+
]),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 8, ["label"])
|
|
194
|
+
]),
|
|
195
|
+
_: 1
|
|
196
|
+
}, 8, ["title"])
|
|
197
|
+
])
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
}, 8, ["modelValue", "is-container", "is-container-props"])
|
|
201
|
+
], 64);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}), ze = {
|
|
205
|
+
class: "py-16 bg-fm-color-surface-secondary rounded-8 space-y-8"
|
|
206
|
+
}, Te = {
|
|
207
|
+
class: "flex items-center"
|
|
208
|
+
}, De = {
|
|
209
|
+
class: "space-y-8"
|
|
210
|
+
}, Me = {
|
|
211
|
+
class: "xs:hidden flex w-full items-start justify-between"
|
|
212
|
+
}, Ke = {
|
|
213
|
+
class: "flex items-start gap-8"
|
|
214
|
+
}, Ee = {
|
|
215
|
+
class: "space-y-4 hidden xs:block"
|
|
216
|
+
}, je = {
|
|
217
|
+
class: "px-16"
|
|
218
|
+
}, Oe = {
|
|
219
|
+
class: "px-16 flex items-start gap-8"
|
|
220
|
+
}, qe = {
|
|
221
|
+
class: "pb-64 hidden xs:block"
|
|
222
|
+
}, He = {
|
|
223
|
+
class: "space-y-4"
|
|
224
|
+
}, We = {
|
|
225
|
+
class: "flex items-center gap-8"
|
|
226
|
+
}, Je = {
|
|
227
|
+
class: "fm-typo-en-body-lg-600"
|
|
228
|
+
}, Qe = {
|
|
229
|
+
class: "font-mono text-lg font-bold mr-4"
|
|
230
|
+
}, Xe = {
|
|
231
|
+
class: "text-fm-color-typo-secondary"
|
|
232
|
+
}, Ye = {
|
|
233
|
+
class: "text-xs"
|
|
234
|
+
}, Ze = {
|
|
235
|
+
class: "mt-4 space-y-2"
|
|
236
|
+
}, et = {
|
|
237
|
+
class: "text-xs"
|
|
238
|
+
}, tt = {
|
|
239
|
+
class: "text-xs"
|
|
240
|
+
}, at = {
|
|
241
|
+
key: 0,
|
|
242
|
+
class: "flex flex-col gap-4"
|
|
243
|
+
}, st = /* @__PURE__ */ Y({
|
|
244
|
+
__name: "GrantUserList",
|
|
245
|
+
setup(p, {
|
|
246
|
+
expose: _
|
|
247
|
+
}) {
|
|
248
|
+
const {
|
|
249
|
+
t: a
|
|
250
|
+
} = ee(), U = k(), b = ae(), {
|
|
251
|
+
restaurants: d
|
|
252
|
+
} = Z(), {
|
|
253
|
+
roles: m
|
|
254
|
+
} = te(), n = I(() => b.grantUsers), {
|
|
255
|
+
searchKey: c,
|
|
256
|
+
filter: i
|
|
257
|
+
} = Be(""), w = I(() => {
|
|
258
|
+
var t;
|
|
259
|
+
return (t = n.value) == null ? void 0 : t.filter((e) => {
|
|
260
|
+
const f = !U.value || U.value.includes(e.restaurantId), G = !$.value || $.value.includes(e.status), D = C.value[e.restaurantId] || "", W = F.value[e.roleId] || "";
|
|
261
|
+
return f && G && i([e.passcode, e.name, D, W, e.grantByName]);
|
|
262
|
+
});
|
|
263
|
+
}), C = I(() => {
|
|
264
|
+
const t = {};
|
|
265
|
+
return d.value.forEach((e) => {
|
|
266
|
+
t[e._id] = e.profile.name;
|
|
267
|
+
}), t;
|
|
268
|
+
}), F = I(() => {
|
|
269
|
+
const t = {};
|
|
270
|
+
return m.value.forEach((e) => {
|
|
271
|
+
t[e._id] = e.name;
|
|
272
|
+
}), t;
|
|
273
|
+
}), L = (t) => {
|
|
274
|
+
switch (t) {
|
|
275
|
+
case "active":
|
|
276
|
+
return "bg-fm-color-system-success-100 text-fm-color-typo-success";
|
|
277
|
+
case "used":
|
|
278
|
+
return "bg-fm-color-typo-tertiary text-fm-color-typo-primary";
|
|
279
|
+
case "revoked":
|
|
280
|
+
return "bg-fm-color-system-error-100 text-fm-color-typo-error";
|
|
281
|
+
default:
|
|
282
|
+
return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
|
|
283
|
+
}
|
|
284
|
+
}, N = (t) => a(`grantUser.status.${t}`), H = [{
|
|
285
|
+
accessorKey: "passcode",
|
|
286
|
+
size: 120,
|
|
287
|
+
maxSize: 120,
|
|
288
|
+
minSize: 120,
|
|
289
|
+
header: () => a("grantUser.columns.passcode"),
|
|
290
|
+
cell(t) {
|
|
291
|
+
const e = t.row.original.passcode;
|
|
292
|
+
return y("div", {
|
|
293
|
+
class: "flex items-center gap-8"
|
|
294
|
+
}, [y(O.FmButton, {
|
|
295
|
+
variant: K.Tertiary,
|
|
296
|
+
textColor: "neutral-gray-400",
|
|
297
|
+
icon: "content_copy",
|
|
298
|
+
onClick: (f) => {
|
|
299
|
+
f.stopPropagation(), re(e);
|
|
300
|
+
}
|
|
301
|
+
}), y("span", {
|
|
302
|
+
class: "font-mono text-lg font-bold"
|
|
303
|
+
}, e)]);
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
accessorKey: "name",
|
|
307
|
+
header: () => a("grantUser.columns.name")
|
|
308
|
+
}, {
|
|
309
|
+
accessorKey: "restaurantName",
|
|
310
|
+
accessorFn: (t) => C.value[t.restaurantId],
|
|
311
|
+
header: () => a("grantUser.columns.restaurant"),
|
|
312
|
+
meta: {
|
|
313
|
+
width: "250px"
|
|
314
|
+
},
|
|
315
|
+
cell(t) {
|
|
316
|
+
const e = t.row.original.restaurantId, f = C.value[e] || "-";
|
|
317
|
+
return y("div", [y("div", f), y("div", {
|
|
318
|
+
class: "text-fm-color-typo-secondary text-sm"
|
|
319
|
+
}, `${e}`)]);
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
accessorKey: "roleName",
|
|
323
|
+
accessorFn: (t) => F.value[t.roleId],
|
|
324
|
+
header: () => a("grantUser.columns.role"),
|
|
325
|
+
cell(t) {
|
|
326
|
+
const e = t.row.original.roleId, f = F.value[e] || "-";
|
|
327
|
+
return y("div", f);
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
accessorKey: "status",
|
|
331
|
+
header: () => a("grantUser.columns.status"),
|
|
332
|
+
meta: {
|
|
333
|
+
maxWidth: "120px"
|
|
334
|
+
},
|
|
335
|
+
cell(t) {
|
|
336
|
+
const e = t.row.original.status;
|
|
337
|
+
return y(O.FmChip, {
|
|
338
|
+
label: N(e),
|
|
339
|
+
class: L(e)
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}, {
|
|
343
|
+
accessorKey: "grantByName",
|
|
344
|
+
header: () => a("grantUser.columns.grantedBy"),
|
|
345
|
+
cell(t) {
|
|
346
|
+
const e = t.row.original.grantById, f = t.row.original.grantByName;
|
|
347
|
+
return y("div", [y("div", f), y("div", {
|
|
348
|
+
class: "text-fm-color-typo-secondary text-sm"
|
|
349
|
+
}, `${e}`)]);
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
accessorKey: "createdAt",
|
|
353
|
+
header: () => a("grantUser.columns.createdAt"),
|
|
354
|
+
cell(t) {
|
|
355
|
+
const e = t.row.original.createdAt;
|
|
356
|
+
return y("div", new Date(e).toLocaleString());
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
id: "action",
|
|
360
|
+
size: 180,
|
|
361
|
+
meta: {
|
|
362
|
+
cellClass: "p-16",
|
|
363
|
+
headerContentClass: "-mx-16"
|
|
364
|
+
},
|
|
365
|
+
cell: (t) => {
|
|
366
|
+
const e = t.row.original;
|
|
367
|
+
return e.status !== "active" ? null : y("div", {
|
|
368
|
+
class: "w-full flex justify-end items-center gap-4"
|
|
369
|
+
}, [y(O.FmButton, {
|
|
370
|
+
label: a("grantUser.actions.revoke"),
|
|
371
|
+
variant: K.Secondary,
|
|
372
|
+
onClick: (f) => {
|
|
373
|
+
f.stopPropagation(), z(e);
|
|
374
|
+
}
|
|
375
|
+
})]);
|
|
376
|
+
}
|
|
377
|
+
}], u = de(), v = ke(), P = me(u), R = k(), {
|
|
378
|
+
breakpoints: A
|
|
379
|
+
} = Fe(), z = (t) => {
|
|
380
|
+
v.open({
|
|
381
|
+
title: a("grantUser.revoke.title"),
|
|
382
|
+
message: a("grantUser.revoke.message", {
|
|
383
|
+
name: t.name
|
|
384
|
+
}),
|
|
385
|
+
minWidth: A.value.lg ? 588 : 0,
|
|
386
|
+
primaryActions: {
|
|
387
|
+
text: a("grantUser.actions.revoke"),
|
|
388
|
+
close: !1,
|
|
389
|
+
variant: "destructive"
|
|
390
|
+
},
|
|
391
|
+
secondaryActions: {
|
|
392
|
+
text: a("common.cancel"),
|
|
393
|
+
close: !0
|
|
394
|
+
}
|
|
395
|
+
}).onPrimary(async () => {
|
|
396
|
+
P.minor(async () => {
|
|
397
|
+
await b.revokeGrantUser(t._id, t.restaurantId);
|
|
398
|
+
}, {
|
|
399
|
+
successMessage: a("grantUser.revoke.successMessage", {
|
|
400
|
+
name: t.name
|
|
401
|
+
})
|
|
402
|
+
}), v.close();
|
|
403
|
+
});
|
|
404
|
+
};
|
|
405
|
+
function g() {
|
|
406
|
+
var t;
|
|
407
|
+
(t = R.value) == null || t.trigger();
|
|
408
|
+
}
|
|
409
|
+
const se = I(() => [{
|
|
410
|
+
label: a("grantUser.status.active"),
|
|
411
|
+
value: "active"
|
|
412
|
+
}, {
|
|
413
|
+
label: a("grantUser.status.used"),
|
|
414
|
+
value: "used"
|
|
415
|
+
}, {
|
|
416
|
+
label: a("grantUser.status.revoked"),
|
|
417
|
+
value: "revoked"
|
|
418
|
+
}]), $ = k();
|
|
419
|
+
async function re(t) {
|
|
420
|
+
try {
|
|
421
|
+
await navigator.clipboard.writeText(t), u.open({
|
|
422
|
+
message: a("grantUser.passcode.copied"),
|
|
423
|
+
type: "success"
|
|
424
|
+
});
|
|
425
|
+
} catch (e) {
|
|
426
|
+
u.open({
|
|
427
|
+
message: String(e),
|
|
428
|
+
type: "error"
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const B = k(""), T = k("");
|
|
433
|
+
async function pe(t, e) {
|
|
434
|
+
const {
|
|
435
|
+
default: f
|
|
436
|
+
} = await Promise.resolve().then(() => Ge);
|
|
437
|
+
P.minor(async () => {
|
|
438
|
+
(await f.validatePasscode(t, e)).bypass && b.readGrantUsers();
|
|
439
|
+
}, {
|
|
440
|
+
successMessage: `Passcode ${t} valid!`
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
return _({
|
|
444
|
+
create: g,
|
|
445
|
+
filteredGrantUsers: w
|
|
446
|
+
}), (t, e) => {
|
|
447
|
+
const f = x("FmTextField"), G = x("FmButton"), D = x("FmSearch"), W = x("FmTable"), ve = x("FmChip"), ge = x("FmListItem"), fe = x("FmList");
|
|
448
|
+
return S(), E(X, null, [o(Ae, {
|
|
449
|
+
ref_key: "grantUserFormRef",
|
|
450
|
+
ref: R,
|
|
451
|
+
class: "gap-8"
|
|
452
|
+
}, null, 512), l("div", ze, [e[10] || (e[10] = l("p", {
|
|
453
|
+
class: "fm-typo-en-body-md-600"
|
|
454
|
+
}, "Test Passcode Validation", -1)), l("div", Te, [o(f, {
|
|
455
|
+
modelValue: B.value,
|
|
456
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => B.value = r),
|
|
457
|
+
type: "number",
|
|
458
|
+
"max-length": 4,
|
|
459
|
+
class: "!w-[100px]",
|
|
460
|
+
placeholder: "0000",
|
|
461
|
+
onInput: e[1] || (e[1] = (r) => B.value = B.value.replace(/[^0-9]/g, ""))
|
|
462
|
+
}, null, 8, ["modelValue"]), o(s(J), {
|
|
463
|
+
modelValue: T.value,
|
|
464
|
+
"onUpdate:modelValue": e[2] || (e[2] = (r) => T.value = r),
|
|
465
|
+
"managable-only": !1,
|
|
466
|
+
variant: "dark",
|
|
467
|
+
class: "!w-[200px] ml-2"
|
|
468
|
+
}, null, 8, ["modelValue"]), o(G, {
|
|
469
|
+
label: "Validate",
|
|
470
|
+
variant: s(K).Primary,
|
|
471
|
+
disabled: !B.value || B.value.length !== 4 || !T.value,
|
|
472
|
+
onClick: e[3] || (e[3] = (r) => pe(B.value, T.value))
|
|
473
|
+
}, null, 8, ["variant", "disabled"])])]), l("div", De, [l("div", Me, [l("div", Ke, [o(s(J), {
|
|
474
|
+
modelValue: U.value,
|
|
475
|
+
"onUpdate:modelValue": e[4] || (e[4] = (r) => U.value = r),
|
|
476
|
+
"managable-only": !1,
|
|
477
|
+
multiple: "",
|
|
478
|
+
variant: "dark",
|
|
479
|
+
class: "!w-auto"
|
|
480
|
+
}, null, 8, ["modelValue"]), o(ce, {
|
|
481
|
+
modelValue: $.value,
|
|
482
|
+
"onUpdate:modelValue": e[5] || (e[5] = (r) => $.value = r),
|
|
483
|
+
multiple: "",
|
|
484
|
+
variant: "dark",
|
|
485
|
+
items: se.value,
|
|
486
|
+
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
487
|
+
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
488
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), o(D, {
|
|
489
|
+
modelValue: s(c),
|
|
490
|
+
"onUpdate:modelValue": e[6] || (e[6] = (r) => oe(c) ? c.value = r : null),
|
|
491
|
+
autofocus: "",
|
|
492
|
+
class: "pl-4 w-[320px]",
|
|
493
|
+
placeholder: s(a)("grantUser.search.placeholder")
|
|
494
|
+
}, null, 8, ["modelValue", "placeholder"])]), l("div", Ee, [l("div", je, [o(D, {
|
|
495
|
+
modelValue: s(c),
|
|
496
|
+
"onUpdate:modelValue": e[7] || (e[7] = (r) => oe(c) ? c.value = r : null),
|
|
497
|
+
autofocus: "",
|
|
498
|
+
placeholder: s(a)("grantUser.search.placeholder")
|
|
499
|
+
}, null, 8, ["modelValue", "placeholder"])]), o(Se), l("div", Oe, [o(s(J), {
|
|
500
|
+
modelValue: U.value,
|
|
501
|
+
"onUpdate:modelValue": e[8] || (e[8] = (r) => U.value = r),
|
|
502
|
+
"managable-only": !1,
|
|
503
|
+
multiple: "",
|
|
504
|
+
variant: "dark",
|
|
505
|
+
class: "!w-auto"
|
|
506
|
+
}, null, 8, ["modelValue"]), o(ce, {
|
|
507
|
+
modelValue: $.value,
|
|
508
|
+
"onUpdate:modelValue": e[9] || (e[9] = (r) => $.value = r),
|
|
509
|
+
multiple: "",
|
|
510
|
+
items: se.value,
|
|
511
|
+
variant: "dark",
|
|
512
|
+
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
513
|
+
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
514
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), n.value.length > 0 || s(b).isLoading ? (S(), j(Ie, {
|
|
515
|
+
key: 0,
|
|
516
|
+
class: "overflow-auto"
|
|
517
|
+
}, {
|
|
518
|
+
default: h(() => [o(W, {
|
|
519
|
+
class: "xs:hidden",
|
|
520
|
+
"column-defs": H,
|
|
521
|
+
"row-data": w.value,
|
|
522
|
+
"page-size": w.value.length,
|
|
523
|
+
loading: s(b).isLoading,
|
|
524
|
+
virtual: w.value.length > 0,
|
|
525
|
+
"pin-header-row": "",
|
|
526
|
+
"hide-footer": ""
|
|
527
|
+
}, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div", qe, [o(fe, {
|
|
528
|
+
separator: ""
|
|
529
|
+
}, {
|
|
530
|
+
default: h(() => [(S(!0), E(X, null, Ue(w.value, (r) => (S(), j(ge, {
|
|
531
|
+
key: r._id,
|
|
532
|
+
class: "py-12 px-16 items-center justify-between"
|
|
533
|
+
}, {
|
|
534
|
+
default: h(() => [l("div", He, [l("div", We, [o(G, {
|
|
535
|
+
variant: "tertiary",
|
|
536
|
+
"text-color": "neutral-gray-400",
|
|
537
|
+
icon: "content_copy",
|
|
538
|
+
onClick: ne((ye) => re(r.passcode), ["stop"])
|
|
539
|
+
}, null, 8, ["onClick"]), l("p", Je, [l("span", Qe, V(r.passcode), 1), le(" - " + V(r.name), 1)])]), l("div", Xe, [l("div", null, [le(V(C.value[r.restaurantId] || "-") + " ", 1), l("div", Ye, V(r.restaurantId), 1), l("div", null, V(F.value[r.roleId] || "-"), 1)]), l("div", Ze, [l("div", et, V(s(a)("grantUser.columns.grantedBy")) + ": " + V(r.grantByName), 1), l("div", tt, V(s(a)("grantUser.columns.createdAt")) + ": " + V(new Date(r.createdAt).toLocaleString()), 1), o(ve, {
|
|
540
|
+
label: N(r.status),
|
|
541
|
+
class: be(L(r.status))
|
|
542
|
+
}, null, 8, ["label", "class"])])])]), r.status === "active" ? (S(), E("div", at, [o(G, {
|
|
543
|
+
label: s(a)("grantUser.actions.revoke"),
|
|
544
|
+
variant: s(K).Secondary,
|
|
545
|
+
onClick: ne((ye) => z(r), ["stop"])
|
|
546
|
+
}, null, 8, ["label", "variant", "onClick"])])) : xe("", !0)]),
|
|
547
|
+
_: 2
|
|
548
|
+
}, 1024))), 128))]),
|
|
549
|
+
_: 1
|
|
550
|
+
})])]),
|
|
551
|
+
_: 1
|
|
552
|
+
})) : (S(), j(s(Ce), {
|
|
553
|
+
key: 1,
|
|
554
|
+
title: s(a)("grantUser.noData.title"),
|
|
555
|
+
subtitle: s(a)("grantUser.noData.subtitle")
|
|
556
|
+
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}), _t = /* @__PURE__ */ Y({
|
|
560
|
+
__name: "Main",
|
|
561
|
+
setup(p) {
|
|
562
|
+
const { readGrantUsers: _ } = ae(), { readRestaurants: a, currentBusiness: U } = Z(), { readRoles: b } = te(), { t: d } = ee(), m = k();
|
|
563
|
+
return ue(
|
|
564
|
+
U,
|
|
565
|
+
async () => {
|
|
566
|
+
var n;
|
|
567
|
+
(n = U.value) != null && n._id && await Promise.all([a(), b(), _()]);
|
|
568
|
+
},
|
|
569
|
+
{ immediate: !0 }
|
|
570
|
+
), (n, c) => {
|
|
571
|
+
const i = x("FmSpacer"), w = x("FmButton");
|
|
572
|
+
return S(), j(he, {
|
|
573
|
+
heading: s(d)("grantUser.title")
|
|
574
|
+
}, {
|
|
575
|
+
"append-heading": h(() => [
|
|
576
|
+
o(i),
|
|
577
|
+
o(w, {
|
|
578
|
+
"prepend-icon": "add",
|
|
579
|
+
label: s(d)("grantUser.actions.create"),
|
|
580
|
+
onClick: c[0] || (c[0] = (C) => {
|
|
581
|
+
var F;
|
|
582
|
+
return (F = m.value) == null ? void 0 : F.create();
|
|
583
|
+
})
|
|
584
|
+
}, null, 8, ["label"])
|
|
585
|
+
]),
|
|
586
|
+
default: h(() => [
|
|
587
|
+
o(st, {
|
|
588
|
+
ref_key: "grantUserListRef",
|
|
589
|
+
ref: m
|
|
590
|
+
}, null, 512)
|
|
591
|
+
]),
|
|
592
|
+
_: 1
|
|
593
|
+
}, 8, ["heading"]);
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
export {
|
|
598
|
+
_t as default
|
|
599
|
+
};
|