@feedmepos/mf-hrm-portal 2.0.17 → 2.0.18-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.
- package/dist/AuditLogList-CaoW9uYd.js +1011 -0
- package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +58 -0
- package/dist/EmployeeList-DcMvF9U5.js +839 -0
- package/dist/FormItem.vue_vue_type_script_setup_true_lang-CoorkndT.js +34 -0
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +49 -0
- package/dist/{Main-C7Q3OELU.js → Main-CleutFvF.js} +183 -176
- package/dist/{Main-CCTDT_TG.js → Main-CvW6Vu8N.js} +758 -761
- package/dist/Main-D7k57uq5.js +87 -0
- package/dist/PermissionSetList-CM7kbWkO.js +347 -0
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Ces9YwYB.js +3443 -0
- package/dist/RoleList-DR3eVJ9f.js +545 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
- package/dist/TeamMemberList-CZZv4Pu5.js +1038 -0
- package/dist/{TimesheetList-DhKfguOb.js → TimesheetList-WqqoKPbg.js} +132 -126
- package/dist/{app--3WguZOC.js → app-R5EioPr4.js} +759 -711
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-RrLy0N6G.js → dayjs.min-CN15Ft3o.js} +1 -1
- package/dist/employee-DwQlWLkL.js +204 -0
- package/dist/{iteration-BQA73VxD.js → iteration-UBGGRoxQ.js} +9258 -9213
- package/dist/{lodash-B1ouSWpG.js → lodash-CC6qHVUo.js} +1 -1
- package/dist/{rule-BL-miuus.js → rule-B519XbW6.js} +263 -265
- package/dist/src/api/audit-log/index.d.ts +9 -0
- package/dist/src/api/restaurant/index.d.ts +5 -0
- package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
- package/dist/src/components/CollapsibleWrapper.vue.d.ts +2 -0
- package/dist/src/components/Skeleton.vue.d.ts +7 -0
- package/dist/src/composables/useBasePermission.d.ts +1 -0
- package/dist/src/composables/useRestaurantMap.d.ts +2 -329
- package/dist/src/stores/restaurant.d.ts +181 -0
- package/dist/src/stores/role.d.ts +7 -7
- package/dist/src/stores/team.d.ts +6 -6
- package/dist/src/types/restaurant.d.ts +11 -0
- package/dist/src/types/team.d.ts +1 -1
- package/dist/src/views/hr/locales/index.d.ts +16 -0
- package/dist/src/views/team/components/BasePermission.vue.d.ts +3 -7
- package/dist/src/views/team/components/PosRolePermission.vue.d.ts +2 -2
- package/dist/src/views/team/locales/index.d.ts +32 -0
- package/dist/src/views/team/member/AddMemberForm.vue.d.ts +5 -3
- package/dist/style.css +1 -1
- package/dist/team-BGLhgx5P.js +33 -0
- package/dist/{timesheet-BbtAYZ1B.js → timesheet-BylrXRfd.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/useAppStore-Akl8AoVN.js +171 -0
- package/dist/useDiscardConfirm-DPhEV6v0.js +157 -0
- package/dist/{useLoading-D7PklYeR.js → useLoading-rbrVwWuj.js} +1 -1
- package/dist/{useReportPermissions-CNcISy8f.js → useReportPermissions-BOEZU86S.js} +3 -3
- package/dist/useSearch-BAPEUu1R.js +15 -0
- package/package.json +1 -1
- package/dist/AuditLogList-DwCmJovS.js +0 -980
- package/dist/EmployeeList-8166DlII.js +0 -736
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js +0 -71
- package/dist/HorizontalSplitter-o860F4xM.js +0 -12
- package/dist/Main-C4LaqZaa.js +0 -85
- package/dist/PermissionSetList-trnHwNFR.js +0 -341
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Bc5nE9NF.js +0 -3480
- package/dist/RoleList-DJtbEUSC.js +0 -530
- package/dist/TeamMemberList-C6qx-yJi.js +0 -1108
- package/dist/employee-DSAStcBv.js +0 -204
- package/dist/useAppStore-BHWapSDk.js +0 -171
- package/dist/useDebounce-B8ZPVS5C.js +0 -15
- package/dist/useDiscardConfirm-BHni0LNu.js +0 -28
- package/dist/useSearch-B6WK1LBB.js +0 -15
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ref as S, defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
4
|
-
import { u as Y } from "./useAppStore-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useSnackbar as ie, components as
|
|
8
|
-
import { S as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { H as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { u as
|
|
13
|
-
import { u as ue } from "./useLoading-
|
|
14
|
-
import { _ as
|
|
15
|
-
const
|
|
1
|
+
import { ref as S, defineComponent as Q, computed as V, watch as ce, resolveComponent as h, createElementBlock as K, openBlock as I, Fragment as J, renderSlot as ge, createVNode as n, unref as s, withCtx as x, createElementVNode as l, toDisplayString as k, createBlock as E, isRef as re, renderList as fe, createCommentVNode as ve, withModifiers as oe, createTextVNode as ne, normalizeClass as _e, h as _ } from "vue";
|
|
2
|
+
import { useI18n as X, useCoreStore as ye } from "@feedmepos/mf-common";
|
|
3
|
+
import { _ as Ue } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
|
|
4
|
+
import { u as Y } from "./useAppStore-Akl8AoVN.js";
|
|
5
|
+
import { g as z, a as he, b as q, u as Z } from "./iteration-UBGGRoxQ.js";
|
|
6
|
+
import { defineStore as xe } from "pinia";
|
|
7
|
+
import { useSnackbar as ie, components as M, useDialog as be, useBreakpoints as we, FmButtonVariant as H } from "@feedmepos/ui-library";
|
|
8
|
+
import { S as D } from "./SelectFilter-DUj7GBtT.js";
|
|
9
|
+
import { _ as ke } from "./app-R5EioPr4.js";
|
|
10
|
+
import { _ as le, H as Ve } from "./FormItem.vue_vue_type_script_setup_true_lang-CoorkndT.js";
|
|
11
|
+
import { _ as Fe } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
12
|
+
import { u as Ie } from "./useSearch-BAPEUu1R.js";
|
|
13
|
+
import { u as ue } from "./useLoading-rbrVwWuj.js";
|
|
14
|
+
import { _ as Se } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
|
|
15
|
+
const W = {
|
|
16
16
|
async getGrantUsers() {
|
|
17
|
-
return z(await
|
|
17
|
+
return z(await q("grant").get(""));
|
|
18
18
|
},
|
|
19
19
|
async createGrantUser(p) {
|
|
20
|
-
return z(await
|
|
20
|
+
return z(await q("grant").post("", p));
|
|
21
21
|
},
|
|
22
22
|
async revokeGrantUser(p, y) {
|
|
23
23
|
return z(
|
|
24
|
-
await
|
|
24
|
+
await q("grant").patch(`/revoke/${p}`, null, {
|
|
25
25
|
params: { restaurantId: y }
|
|
26
26
|
})
|
|
27
27
|
);
|
|
@@ -35,31 +35,31 @@ const H = {
|
|
|
35
35
|
})
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, Ce = xe("grantUser", () => {
|
|
39
39
|
const p = S([]), y = S(!1);
|
|
40
40
|
async function a() {
|
|
41
41
|
y.value = !0;
|
|
42
42
|
try {
|
|
43
|
-
p.value = (await
|
|
44
|
-
(
|
|
43
|
+
p.value = (await W.getGrantUsers()).sort(
|
|
44
|
+
(u, m) => u.createdAt < m.createdAt ? 1 : -1
|
|
45
45
|
);
|
|
46
|
-
} catch (
|
|
47
|
-
throw console.error("Error reading grant users:",
|
|
46
|
+
} catch (u) {
|
|
47
|
+
throw console.error("Error reading grant users:", u), u;
|
|
48
48
|
} finally {
|
|
49
49
|
y.value = !1;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
async function U(
|
|
52
|
+
async function U(u) {
|
|
53
53
|
try {
|
|
54
|
-
const m = await
|
|
54
|
+
const m = await W.createGrantUser(u);
|
|
55
55
|
return p.value = [m, ...p.value], m;
|
|
56
56
|
} catch (m) {
|
|
57
57
|
throw console.error("Error creating grant user:", m), m;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
async function b(
|
|
60
|
+
async function b(u, m) {
|
|
61
61
|
try {
|
|
62
|
-
const r = await
|
|
62
|
+
const r = await W.revokeGrantUser(u, m), c = p.value.findIndex((i) => i._id === u);
|
|
63
63
|
c !== -1 && (p.value[c] = r);
|
|
64
64
|
} catch (r) {
|
|
65
65
|
throw console.error("Error revoking grant user:", r), r;
|
|
@@ -72,10 +72,10 @@ const H = {
|
|
|
72
72
|
createGrantUser: U,
|
|
73
73
|
revokeGrantUser: b
|
|
74
74
|
};
|
|
75
|
-
}),
|
|
75
|
+
}), 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__ */ Q({
|
|
76
76
|
__name: "GrantUserForm",
|
|
77
77
|
setup(p, { expose: y }) {
|
|
78
|
-
const a =
|
|
78
|
+
const a = ee(), U = Y(), b = Z(), u = ie(), m = ue(u), { t: r } = X(), c = S(!1), i = S({
|
|
79
79
|
name: "",
|
|
80
80
|
restaurantId: "",
|
|
81
81
|
roleId: ""
|
|
@@ -85,13 +85,13 @@ const H = {
|
|
|
85
85
|
restaurantId: "",
|
|
86
86
|
roleId: ""
|
|
87
87
|
}, c.value = !0;
|
|
88
|
-
}, C =
|
|
89
|
-
label: `${
|
|
90
|
-
value:
|
|
91
|
-
}))), R =
|
|
92
|
-
label:
|
|
93
|
-
value:
|
|
94
|
-
disabled: !
|
|
88
|
+
}, C = V(() => r("grantUser.form.title")), F = V(() => r("common.create")), G = V(() => b.restaurants.value.map((d) => ({
|
|
89
|
+
label: `${d.profile.code ? d.profile.code + " - " : ""}${d.profile.name}`,
|
|
90
|
+
value: d._id
|
|
91
|
+
}))), R = V(() => i.value.restaurantId ? U.roles.value.filter((d) => d.restaurants.some((g) => g.id === i.value.restaurantId)).map((d) => ({
|
|
92
|
+
label: d.name,
|
|
93
|
+
value: d._id,
|
|
94
|
+
disabled: !d.isUsable
|
|
95
95
|
})) : []);
|
|
96
96
|
ce(
|
|
97
97
|
() => i.value.restaurantId,
|
|
@@ -99,12 +99,12 @@ const H = {
|
|
|
99
99
|
i.value.roleId = "";
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
-
async function
|
|
102
|
+
async function P() {
|
|
103
103
|
await m.minor(async () => {
|
|
104
|
-
const
|
|
105
|
-
|
|
104
|
+
const d = await a.createGrantUser(i.value);
|
|
105
|
+
u.open({
|
|
106
106
|
message: r("grantUser.create.successMessage", {
|
|
107
|
-
passcode:
|
|
107
|
+
passcode: d.passcode
|
|
108
108
|
}),
|
|
109
109
|
type: "success"
|
|
110
110
|
});
|
|
@@ -113,28 +113,28 @@ const H = {
|
|
|
113
113
|
return y({
|
|
114
114
|
show: c,
|
|
115
115
|
trigger: w
|
|
116
|
-
}), (
|
|
117
|
-
const
|
|
118
|
-
return I(),
|
|
119
|
-
ge(
|
|
116
|
+
}), (d, g) => {
|
|
117
|
+
const T = h("FmTextField"), $ = h("FmSelect"), L = h("fm-button"), N = h("fm-side-sheet");
|
|
118
|
+
return I(), K(J, null, [
|
|
119
|
+
ge(d.$slots, "default", { trigger: w }),
|
|
120
120
|
n(N, {
|
|
121
121
|
id: "grant-user-form",
|
|
122
122
|
modelValue: c.value,
|
|
123
123
|
"onUpdate:modelValue": g[4] || (g[4] = (f) => c.value = f),
|
|
124
|
-
"is-container": s(
|
|
124
|
+
"is-container": s(M).FmForm,
|
|
125
125
|
"is-container-props": {
|
|
126
|
-
onValidationSuccess:
|
|
126
|
+
onValidationSuccess: P,
|
|
127
127
|
blameFormChildOnValidationFailed: !0
|
|
128
128
|
},
|
|
129
129
|
"max-width": 560
|
|
130
130
|
}, {
|
|
131
131
|
"side-sheet-header": x(() => [
|
|
132
|
-
l("p",
|
|
132
|
+
l("p", Be, k(C.value), 1)
|
|
133
133
|
]),
|
|
134
134
|
"side-sheet-footer": x(() => [
|
|
135
|
-
l("div",
|
|
135
|
+
l("div", Ge, [
|
|
136
136
|
n(L, {
|
|
137
|
-
label:
|
|
137
|
+
label: F.value,
|
|
138
138
|
size: "lg",
|
|
139
139
|
type: "submit",
|
|
140
140
|
variant: "primary"
|
|
@@ -148,12 +148,12 @@ const H = {
|
|
|
148
148
|
])
|
|
149
149
|
]),
|
|
150
150
|
default: x(() => [
|
|
151
|
-
l("div",
|
|
152
|
-
n(
|
|
151
|
+
l("div", $e, [
|
|
152
|
+
n(Se, {
|
|
153
153
|
title: s(r)("grantUser.form.section")
|
|
154
154
|
}, {
|
|
155
155
|
default: x(() => [
|
|
156
|
-
n(
|
|
156
|
+
n(T, {
|
|
157
157
|
modelValue: i.value.name,
|
|
158
158
|
"onUpdate:modelValue": g[0] || (g[0] = (f) => i.value.name = f),
|
|
159
159
|
label: s(r)("grantUser.form.name"),
|
|
@@ -198,73 +198,73 @@ const H = {
|
|
|
198
198
|
], 64);
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
}),
|
|
201
|
+
}), Le = {
|
|
202
202
|
class: "space-y-8"
|
|
203
|
-
}, Le = {
|
|
204
|
-
class: "xs:hidden flex w-full items-start justify-between"
|
|
205
203
|
}, Ne = {
|
|
206
|
-
class: "flex items-start
|
|
204
|
+
class: "xs:hidden flex w-full items-start justify-between"
|
|
207
205
|
}, Ae = {
|
|
208
|
-
class: "
|
|
206
|
+
class: "flex items-start gap-8"
|
|
209
207
|
}, ze = {
|
|
210
|
-
class: "
|
|
208
|
+
class: "space-y-4 hidden xs:block"
|
|
211
209
|
}, De = {
|
|
212
|
-
class: "px-16
|
|
210
|
+
class: "px-16"
|
|
213
211
|
}, Ke = {
|
|
214
|
-
class: "
|
|
212
|
+
class: "px-16 flex items-start gap-8"
|
|
215
213
|
}, Ee = {
|
|
216
|
-
class: "
|
|
214
|
+
class: "pb-64 hidden xs:block"
|
|
217
215
|
}, Me = {
|
|
218
|
-
class: "
|
|
216
|
+
class: "space-y-4"
|
|
219
217
|
}, Pe = {
|
|
220
|
-
class: "
|
|
218
|
+
class: "flex items-center gap-8"
|
|
221
219
|
}, Te = {
|
|
220
|
+
class: "fm-typo-en-body-lg-600"
|
|
221
|
+
}, Oe = {
|
|
222
222
|
class: "font-mono text-lg font-bold mr-4"
|
|
223
223
|
}, je = {
|
|
224
224
|
class: "text-fm-color-typo-secondary"
|
|
225
|
-
}, Oe = {
|
|
226
|
-
class: "text-xs"
|
|
227
225
|
}, qe = {
|
|
228
|
-
class: "mt-4 space-y-2"
|
|
229
|
-
}, He = {
|
|
230
226
|
class: "text-xs"
|
|
227
|
+
}, He = {
|
|
228
|
+
class: "mt-4 space-y-2"
|
|
231
229
|
}, We = {
|
|
232
230
|
class: "text-xs"
|
|
233
231
|
}, Je = {
|
|
232
|
+
class: "text-xs"
|
|
233
|
+
}, Qe = {
|
|
234
234
|
key: 0,
|
|
235
235
|
class: "flex flex-col gap-4"
|
|
236
|
-
},
|
|
236
|
+
}, Xe = /* @__PURE__ */ Q({
|
|
237
237
|
__name: "GrantUserList",
|
|
238
238
|
setup(p, {
|
|
239
239
|
expose: y
|
|
240
240
|
}) {
|
|
241
241
|
const {
|
|
242
242
|
t: a
|
|
243
|
-
} = X(), U = S(), b =
|
|
244
|
-
restaurants:
|
|
245
|
-
} =
|
|
243
|
+
} = X(), U = S(), b = ee(), {
|
|
244
|
+
restaurants: u
|
|
245
|
+
} = Z(), {
|
|
246
246
|
roles: m
|
|
247
|
-
} = Y(), r =
|
|
247
|
+
} = Y(), r = V(() => b.grantUsers), {
|
|
248
248
|
searchKey: c,
|
|
249
249
|
filter: i
|
|
250
|
-
} =
|
|
251
|
-
var
|
|
252
|
-
return (
|
|
253
|
-
const v = !U.value || U.value.includes(
|
|
254
|
-
return v &&
|
|
250
|
+
} = Ie(), w = V(() => {
|
|
251
|
+
var e;
|
|
252
|
+
return (e = r.value) == null ? void 0 : e.filter((t) => {
|
|
253
|
+
const v = !U.value || U.value.includes(t.restaurantId), O = !B.value || B.value.includes(t.status), A = C.value[t.restaurantId] || "", j = F.value[t.roleId] || "";
|
|
254
|
+
return v && O && i([t.passcode, t.name, A, j, t.grantByName]);
|
|
255
255
|
});
|
|
256
|
-
}), C =
|
|
257
|
-
const
|
|
258
|
-
return
|
|
259
|
-
t
|
|
260
|
-
}),
|
|
261
|
-
}),
|
|
262
|
-
const
|
|
263
|
-
return m.value.forEach((
|
|
264
|
-
t
|
|
265
|
-
}),
|
|
266
|
-
}), G = (
|
|
267
|
-
switch (
|
|
256
|
+
}), C = V(() => {
|
|
257
|
+
const e = {};
|
|
258
|
+
return u.value.forEach((t) => {
|
|
259
|
+
e[t._id] = t.profile.name;
|
|
260
|
+
}), e;
|
|
261
|
+
}), F = V(() => {
|
|
262
|
+
const e = {};
|
|
263
|
+
return m.value.forEach((t) => {
|
|
264
|
+
e[t._id] = t.name;
|
|
265
|
+
}), e;
|
|
266
|
+
}), G = (e) => {
|
|
267
|
+
switch (e) {
|
|
268
268
|
case "active":
|
|
269
269
|
return "bg-fm-color-system-success-100 text-fm-color-typo-success";
|
|
270
270
|
case "used":
|
|
@@ -274,49 +274,49 @@ const H = {
|
|
|
274
274
|
default:
|
|
275
275
|
return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
|
|
276
276
|
}
|
|
277
|
-
}, R = (
|
|
277
|
+
}, R = (e) => a(`grantUser.status.${e}`), P = [{
|
|
278
278
|
accessorKey: "passcode",
|
|
279
279
|
size: 120,
|
|
280
280
|
maxSize: 120,
|
|
281
281
|
minSize: 120,
|
|
282
282
|
header: () => a("grantUser.columns.passcode"),
|
|
283
|
-
cell(
|
|
284
|
-
const
|
|
283
|
+
cell(e) {
|
|
284
|
+
const t = e.row.original.passcode;
|
|
285
285
|
return _("div", {
|
|
286
286
|
class: "flex items-center gap-8"
|
|
287
|
-
}, [_(
|
|
288
|
-
variant:
|
|
287
|
+
}, [_(M.FmButton, {
|
|
288
|
+
variant: H.Tertiary,
|
|
289
289
|
textColor: "neutral-gray-400",
|
|
290
290
|
icon: "content_copy",
|
|
291
291
|
onClick: (v) => {
|
|
292
|
-
v.stopPropagation(),
|
|
292
|
+
v.stopPropagation(), se(t);
|
|
293
293
|
}
|
|
294
294
|
}), _("span", {
|
|
295
295
|
class: "font-mono text-lg font-bold"
|
|
296
|
-
},
|
|
296
|
+
}, t)]);
|
|
297
297
|
}
|
|
298
298
|
}, {
|
|
299
299
|
accessorKey: "name",
|
|
300
300
|
header: () => a("grantUser.columns.name")
|
|
301
301
|
}, {
|
|
302
302
|
accessorKey: "restaurantName",
|
|
303
|
-
accessorFn: (
|
|
303
|
+
accessorFn: (e) => C.value[e.restaurantId],
|
|
304
304
|
header: () => a("grantUser.columns.restaurant"),
|
|
305
305
|
meta: {
|
|
306
306
|
width: "250px"
|
|
307
307
|
},
|
|
308
|
-
cell(
|
|
309
|
-
const
|
|
308
|
+
cell(e) {
|
|
309
|
+
const t = e.row.original.restaurantId, v = C.value[t] || "-";
|
|
310
310
|
return _("div", [_("div", v), _("div", {
|
|
311
311
|
class: "text-fm-color-typo-secondary text-sm"
|
|
312
|
-
}, `${
|
|
312
|
+
}, `${t}`)]);
|
|
313
313
|
}
|
|
314
314
|
}, {
|
|
315
315
|
accessorKey: "roleName",
|
|
316
|
-
accessorFn: (
|
|
316
|
+
accessorFn: (e) => F.value[e.roleId],
|
|
317
317
|
header: () => a("grantUser.columns.role"),
|
|
318
|
-
cell(
|
|
319
|
-
const
|
|
318
|
+
cell(e) {
|
|
319
|
+
const t = e.row.original.roleId, v = F.value[t] || "-";
|
|
320
320
|
return _("div", v);
|
|
321
321
|
}
|
|
322
322
|
}, {
|
|
@@ -325,28 +325,28 @@ const H = {
|
|
|
325
325
|
meta: {
|
|
326
326
|
maxWidth: "120px"
|
|
327
327
|
},
|
|
328
|
-
cell(
|
|
329
|
-
const
|
|
330
|
-
return _(
|
|
331
|
-
label: R(
|
|
332
|
-
class: G(
|
|
328
|
+
cell(e) {
|
|
329
|
+
const t = e.row.original.status;
|
|
330
|
+
return _(M.FmChip, {
|
|
331
|
+
label: R(t),
|
|
332
|
+
class: G(t)
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}, {
|
|
336
336
|
accessorKey: "grantByName",
|
|
337
337
|
header: () => a("grantUser.columns.grantedBy"),
|
|
338
|
-
cell(
|
|
339
|
-
const
|
|
338
|
+
cell(e) {
|
|
339
|
+
const t = e.row.original.grantById, v = e.row.original.grantByName;
|
|
340
340
|
return _("div", [_("div", v), _("div", {
|
|
341
341
|
class: "text-fm-color-typo-secondary text-sm"
|
|
342
|
-
}, `${
|
|
342
|
+
}, `${t}`)]);
|
|
343
343
|
}
|
|
344
344
|
}, {
|
|
345
345
|
accessorKey: "createdAt",
|
|
346
346
|
header: () => a("grantUser.columns.createdAt"),
|
|
347
|
-
cell(
|
|
348
|
-
const
|
|
349
|
-
return _("div", new Date(
|
|
347
|
+
cell(e) {
|
|
348
|
+
const t = e.row.original.createdAt;
|
|
349
|
+
return _("div", new Date(t).toLocaleString());
|
|
350
350
|
}
|
|
351
351
|
}, {
|
|
352
352
|
id: "action",
|
|
@@ -355,25 +355,25 @@ const H = {
|
|
|
355
355
|
cellClass: "p-16",
|
|
356
356
|
headerContentClass: "-mx-16"
|
|
357
357
|
},
|
|
358
|
-
cell: (
|
|
359
|
-
const
|
|
360
|
-
return
|
|
358
|
+
cell: (e) => {
|
|
359
|
+
const t = e.row.original;
|
|
360
|
+
return t.status !== "active" ? null : _("div", {
|
|
361
361
|
class: "w-full flex justify-end items-center gap-4"
|
|
362
|
-
}, [_(
|
|
362
|
+
}, [_(M.FmButton, {
|
|
363
363
|
label: a("grantUser.actions.revoke"),
|
|
364
|
-
variant:
|
|
364
|
+
variant: H.Secondary,
|
|
365
365
|
onClick: (v) => {
|
|
366
|
-
v.stopPropagation(), N(
|
|
366
|
+
v.stopPropagation(), N(t);
|
|
367
367
|
}
|
|
368
368
|
})]);
|
|
369
369
|
}
|
|
370
|
-
}],
|
|
370
|
+
}], d = ie(), g = be(), T = ue(d), $ = S(), {
|
|
371
371
|
breakpoints: L
|
|
372
|
-
} =
|
|
372
|
+
} = we(), N = (e) => {
|
|
373
373
|
g.open({
|
|
374
374
|
title: a("grantUser.revoke.title"),
|
|
375
375
|
message: a("grantUser.revoke.message", {
|
|
376
|
-
name:
|
|
376
|
+
name: e.name
|
|
377
377
|
}),
|
|
378
378
|
minWidth: L.value.lg ? 588 : 0,
|
|
379
379
|
primaryActions: {
|
|
@@ -386,20 +386,20 @@ const H = {
|
|
|
386
386
|
close: !0
|
|
387
387
|
}
|
|
388
388
|
}).onPrimary(async () => {
|
|
389
|
-
|
|
390
|
-
await b.revokeGrantUser(
|
|
389
|
+
T.minor(async () => {
|
|
390
|
+
await b.revokeGrantUser(e._id, e.restaurantId);
|
|
391
391
|
}, {
|
|
392
392
|
successMessage: a("grantUser.revoke.successMessage", {
|
|
393
|
-
name:
|
|
393
|
+
name: e.name
|
|
394
394
|
})
|
|
395
395
|
}), g.close();
|
|
396
396
|
});
|
|
397
397
|
};
|
|
398
398
|
function f() {
|
|
399
|
-
var
|
|
400
|
-
(
|
|
399
|
+
var e;
|
|
400
|
+
(e = $.value) == null || e.trigger();
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const te = V(() => [{
|
|
403
403
|
label: a("grantUser.status.active"),
|
|
404
404
|
value: "active"
|
|
405
405
|
}, {
|
|
@@ -408,16 +408,19 @@ const H = {
|
|
|
408
408
|
}, {
|
|
409
409
|
label: a("grantUser.status.revoked"),
|
|
410
410
|
value: "revoked"
|
|
411
|
-
}]),
|
|
412
|
-
|
|
411
|
+
}]), ae = V(() => u.value.map((e) => ({
|
|
412
|
+
label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
|
|
413
|
+
value: e._id
|
|
414
|
+
}))), B = S();
|
|
415
|
+
async function se(e) {
|
|
413
416
|
try {
|
|
414
|
-
await navigator.clipboard.writeText(
|
|
417
|
+
await navigator.clipboard.writeText(e), d.open({
|
|
415
418
|
message: a("grantUser.passcode.copied"),
|
|
416
419
|
type: "success"
|
|
417
420
|
});
|
|
418
|
-
} catch (
|
|
419
|
-
|
|
420
|
-
message: String(
|
|
421
|
+
} catch (t) {
|
|
422
|
+
d.open({
|
|
423
|
+
message: String(t),
|
|
421
424
|
type: "error"
|
|
422
425
|
});
|
|
423
426
|
}
|
|
@@ -425,127 +428,131 @@ const H = {
|
|
|
425
428
|
return y({
|
|
426
429
|
create: f,
|
|
427
430
|
filteredGrantUsers: w
|
|
428
|
-
}), (
|
|
429
|
-
const v = h("FmSearch"),
|
|
430
|
-
return I(),
|
|
431
|
+
}), (e, t) => {
|
|
432
|
+
const v = h("FmSearch"), O = h("FmTable"), A = h("FmButton"), j = h("FmChip"), de = h("FmListItem"), me = h("FmList");
|
|
433
|
+
return I(), K(J, null, [n(Re, {
|
|
431
434
|
ref_key: "grantUserFormRef",
|
|
432
435
|
ref: $,
|
|
433
436
|
class: "gap-8"
|
|
434
|
-
}, null, 512), l("div",
|
|
437
|
+
}, null, 512), l("div", Le, [l("div", Ne, [l("div", Ae, [n(D, {
|
|
435
438
|
modelValue: U.value,
|
|
436
|
-
"onUpdate:modelValue":
|
|
437
|
-
"managable-only": !1,
|
|
439
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => U.value = o),
|
|
438
440
|
multiple: "",
|
|
441
|
+
items: ae.value,
|
|
439
442
|
variant: "dark",
|
|
443
|
+
"selected-prefix": s(a)("grantUser.columns.restaurant"),
|
|
444
|
+
placeholder: s(a)("grantUser.columns.restaurant"),
|
|
440
445
|
class: "!w-auto"
|
|
441
|
-
}, null, 8, ["modelValue"]), n(
|
|
446
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(D, {
|
|
442
447
|
modelValue: B.value,
|
|
443
|
-
"onUpdate:modelValue":
|
|
448
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => B.value = o),
|
|
444
449
|
multiple: "",
|
|
445
450
|
variant: "dark",
|
|
446
|
-
items:
|
|
451
|
+
items: te.value,
|
|
447
452
|
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
448
453
|
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
449
454
|
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), n(v, {
|
|
450
455
|
modelValue: s(c),
|
|
451
|
-
"onUpdate:modelValue":
|
|
456
|
+
"onUpdate:modelValue": t[2] || (t[2] = (o) => re(c) ? c.value = o : null),
|
|
452
457
|
autofocus: "",
|
|
453
458
|
class: "pl-4 w-[320px]",
|
|
454
459
|
placeholder: s(a)("grantUser.search.placeholder")
|
|
455
|
-
}, null, 8, ["modelValue", "placeholder"])]), l("div",
|
|
460
|
+
}, null, 8, ["modelValue", "placeholder"])]), l("div", ze, [l("div", De, [n(v, {
|
|
456
461
|
modelValue: s(c),
|
|
457
|
-
"onUpdate:modelValue":
|
|
462
|
+
"onUpdate:modelValue": t[3] || (t[3] = (o) => re(c) ? c.value = o : null),
|
|
458
463
|
autofocus: "",
|
|
459
464
|
placeholder: s(a)("grantUser.search.placeholder")
|
|
460
|
-
}, null, 8, ["modelValue", "placeholder"])]), n(
|
|
465
|
+
}, null, 8, ["modelValue", "placeholder"])]), n(Ve), l("div", Ke, [n(D, {
|
|
461
466
|
modelValue: U.value,
|
|
462
|
-
"onUpdate:modelValue":
|
|
463
|
-
"managable-only": !1,
|
|
467
|
+
"onUpdate:modelValue": t[4] || (t[4] = (o) => U.value = o),
|
|
464
468
|
multiple: "",
|
|
469
|
+
items: ae.value,
|
|
465
470
|
variant: "dark",
|
|
471
|
+
"selected-prefix": s(a)("grantUser.columns.restaurant"),
|
|
472
|
+
placeholder: s(a)("grantUser.columns.restaurant"),
|
|
466
473
|
class: "!w-auto"
|
|
467
|
-
}, null, 8, ["modelValue"]), n(
|
|
474
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(D, {
|
|
468
475
|
modelValue: B.value,
|
|
469
|
-
"onUpdate:modelValue":
|
|
476
|
+
"onUpdate:modelValue": t[5] || (t[5] = (o) => B.value = o),
|
|
470
477
|
multiple: "",
|
|
471
|
-
items:
|
|
478
|
+
items: te.value,
|
|
472
479
|
variant: "dark",
|
|
473
480
|
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
474
481
|
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
475
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), r.value.length > 0 || s(b).isLoading ? (I(),
|
|
482
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), r.value.length > 0 || s(b).isLoading ? (I(), E(ke, {
|
|
476
483
|
key: 0,
|
|
477
484
|
class: "overflow-auto"
|
|
478
485
|
}, {
|
|
479
|
-
default: x(() => [n(
|
|
486
|
+
default: x(() => [n(O, {
|
|
480
487
|
class: "xs:hidden",
|
|
481
|
-
"column-defs":
|
|
488
|
+
"column-defs": P,
|
|
482
489
|
"row-data": w.value,
|
|
483
490
|
"page-size": w.value.length,
|
|
484
491
|
loading: s(b).isLoading,
|
|
485
492
|
virtual: w.value.length > 0,
|
|
486
493
|
"pin-header-row": "",
|
|
487
494
|
"hide-footer": ""
|
|
488
|
-
}, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div",
|
|
495
|
+
}, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div", Ee, [n(me, {
|
|
489
496
|
separator: ""
|
|
490
497
|
}, {
|
|
491
|
-
default: x(() => [(I(!0),
|
|
498
|
+
default: x(() => [(I(!0), K(J, null, fe(w.value, (o) => (I(), E(de, {
|
|
492
499
|
key: o._id,
|
|
493
500
|
class: "py-12 px-16 items-center justify-between"
|
|
494
501
|
}, {
|
|
495
|
-
default: x(() => [l("div",
|
|
502
|
+
default: x(() => [l("div", Me, [l("div", Pe, [n(A, {
|
|
496
503
|
variant: "tertiary",
|
|
497
504
|
"text-color": "neutral-gray-400",
|
|
498
505
|
icon: "content_copy",
|
|
499
|
-
onClick:
|
|
500
|
-
}, null, 8, ["onClick"]), l("p",
|
|
506
|
+
onClick: oe((pe) => se(o.passcode), ["stop"])
|
|
507
|
+
}, null, 8, ["onClick"]), l("p", Te, [l("span", Oe, k(o.passcode), 1), ne(" - " + k(o.name), 1)])]), l("div", je, [l("div", null, [ne(k(C.value[o.restaurantId] || "-") + " ", 1), l("div", qe, k(o.restaurantId), 1), l("div", null, k(F.value[o.roleId] || "-"), 1)]), l("div", He, [l("div", We, k(s(a)("grantUser.columns.grantedBy")) + ": " + k(o.grantByName), 1), l("div", Je, k(s(a)("grantUser.columns.createdAt")) + ": " + k(new Date(o.createdAt).toLocaleString()), 1), n(j, {
|
|
501
508
|
label: R(o.status),
|
|
502
509
|
class: _e(G(o.status))
|
|
503
|
-
}, null, 8, ["label", "class"])])])]), o.status === "active" ? (I(),
|
|
510
|
+
}, null, 8, ["label", "class"])])])]), o.status === "active" ? (I(), K("div", Qe, [n(A, {
|
|
504
511
|
label: s(a)("grantUser.actions.revoke"),
|
|
505
|
-
variant: s(
|
|
506
|
-
onClick:
|
|
512
|
+
variant: s(H).Secondary,
|
|
513
|
+
onClick: oe((pe) => N(o), ["stop"])
|
|
507
514
|
}, null, 8, ["label", "variant", "onClick"])])) : ve("", !0)]),
|
|
508
515
|
_: 2
|
|
509
516
|
}, 1024))), 128))]),
|
|
510
517
|
_: 1
|
|
511
518
|
})])]),
|
|
512
519
|
_: 1
|
|
513
|
-
})) : (I(),
|
|
520
|
+
})) : (I(), E(s(Fe), {
|
|
514
521
|
key: 1,
|
|
515
522
|
title: s(a)("grantUser.noData.title"),
|
|
516
523
|
subtitle: s(a)("grantUser.noData.subtitle")
|
|
517
524
|
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
518
525
|
};
|
|
519
526
|
}
|
|
520
|
-
}),
|
|
527
|
+
}), mt = /* @__PURE__ */ Q({
|
|
521
528
|
__name: "Main",
|
|
522
529
|
setup(p) {
|
|
523
|
-
const { readGrantUsers: y } =
|
|
530
|
+
const { readGrantUsers: y } = ee(), { currentBusiness: a } = ye(), { readRoles: U } = Y(), { readRestaurants: b } = Z(), { t: u } = X(), m = S();
|
|
524
531
|
return ce(
|
|
525
|
-
|
|
532
|
+
a,
|
|
526
533
|
async () => {
|
|
527
534
|
var r;
|
|
528
|
-
(r =
|
|
535
|
+
(r = a.value) != null && r._id && await Promise.all([b(), U(), y()]);
|
|
529
536
|
},
|
|
530
537
|
{ immediate: !0 }
|
|
531
538
|
), (r, c) => {
|
|
532
539
|
const i = h("FmSpacer"), w = h("FmButton");
|
|
533
|
-
return I(),
|
|
534
|
-
heading: s(
|
|
540
|
+
return I(), E(Ue, {
|
|
541
|
+
heading: s(u)("grantUser.title")
|
|
535
542
|
}, {
|
|
536
543
|
"append-heading": x(() => [
|
|
537
544
|
n(i),
|
|
538
545
|
n(w, {
|
|
539
546
|
"prepend-icon": "add",
|
|
540
|
-
label: s(
|
|
547
|
+
label: s(u)("grantUser.actions.create"),
|
|
541
548
|
onClick: c[0] || (c[0] = (C) => {
|
|
542
|
-
var
|
|
543
|
-
return (
|
|
549
|
+
var F;
|
|
550
|
+
return (F = m.value) == null ? void 0 : F.create();
|
|
544
551
|
})
|
|
545
552
|
}, null, 8, ["label"])
|
|
546
553
|
]),
|
|
547
554
|
default: x(() => [
|
|
548
|
-
n(
|
|
555
|
+
n(Xe, {
|
|
549
556
|
ref_key: "grantUserListRef",
|
|
550
557
|
ref: m
|
|
551
558
|
}, null, 512)
|
|
@@ -556,5 +563,5 @@ const H = {
|
|
|
556
563
|
}
|
|
557
564
|
});
|
|
558
565
|
export {
|
|
559
|
-
|
|
566
|
+
mt as default
|
|
560
567
|
};
|