@feedmepos/mf-hrm-portal 2.1.0-dev → 2.1.0-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/AuditLogList-C8VefmfL.js +1608 -0
- package/dist/{ConditionFormHost.vue_vue_type_script_setup_true_lang-tiuei7CA.js → ConditionFormHost.vue_vue_type_script_setup_true_lang-B25U2YoL.js} +2 -2
- package/dist/EmployeeList-DDY8DxQr.js +884 -0
- package/dist/{FormItem.vue_vue_type_script_setup_true_lang-D3MOFOUI.js → FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js} +1 -1
- package/dist/{Main-BgOhmojO.js → Main-BQ36wEVl.js} +188 -185
- package/dist/Main-D7xrzW8p.js +94 -0
- package/dist/{Main-D2Wf__wM.js → Main-D8zj09ZS.js} +1987 -1979
- package/dist/PermissionSetList-zdFnxyCb.js +392 -0
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DOgOa3cu.js +4042 -0
- package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-D-14ca2J.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-DqY-OTuj.js} +1 -1
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +42 -0
- package/dist/{RoleList-tSC8RJHe.js → RoleList-CRYU_eRb.js} +231 -221
- package/dist/SelectFilter-ATOm0hdn.js +269 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
- package/dist/{index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js → TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js} +54 -20
- package/dist/{TeamMemberList-Bz-kDJ0e.js → TeamMemberList-CMK7Yfn6.js} +137 -131
- package/dist/{TimesheetList-BFVhmcRt.js → TimesheetList-C00-tU7K.js} +140 -134
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_d7ed31d7_lang-CtHuL5tW.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-dT_CJJDV.js} +2 -2
- package/dist/{app-DRnSocX8.js → app-C-wWQrRY.js} +792 -475
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-B8xOAypU.js → dayjs.min-Bk9YhjTx.js} +1 -1
- package/dist/{employee-UrXqUaik.js → employee-DzKKMXNo.js} +3 -3
- package/dist/{iteration-LEYoQKiI.js → iteration-BV93u72h.js} +1 -1
- package/dist/{lodash-Bq6_eZZ0.js → lodash-psyQLJ6h.js} +1 -1
- package/dist/{rule-CJC6Cq6S.js → rule-mNiIG4E8.js} +116 -110
- package/dist/src/api/audit-log/index.d.ts +23 -0
- package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +7 -1
- package/dist/src/components/form/SelectFilter.vue.d.ts +3 -0
- package/dist/src/components/table/EmptyDataTemplate/index.vue.d.ts +4 -1
- package/dist/src/components/table/TableEmptyState.vue.d.ts +31 -0
- package/dist/src/stores/permission-set.d.ts +12 -3
- package/dist/src/stores/team.d.ts +4 -1
- package/dist/src/types/audit-log.d.ts +1 -1
- package/dist/src/views/audit-log/event-line.d.ts +13 -0
- package/dist/src/views/audit-log/locales/index.d.ts +320 -16
- package/dist/src/views/audit-log/snapshot-diff.d.ts +11 -0
- package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +1 -0
- package/dist/src/views/hr/locales/index.d.ts +4 -0
- package/dist/src/views/team/locales/index.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BGsfYWAR.js → useAppStore-CEgLVGO6.js} +1 -1
- package/dist/useDebounce-B8ZPVS5C.js +15 -0
- package/dist/{useLoading-BUM5R2qV.js → useLoading-CJtXNU4d.js} +1 -1
- package/dist/{useReportPermissions-nlQ_BBL2.js → useReportPermissions-DoQyFUKj.js} +3 -3
- package/package.json +1 -1
- package/dist/AuditLogList-C1bGND8z.js +0 -1037
- package/dist/EmployeeList-DqQF9xEx.js +0 -851
- package/dist/Main-DcKVuIjB.js +0 -90
- package/dist/PermissionSetList-CQpTa0eY.js +0 -384
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CCKVpAwv.js +0 -4030
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +0 -38
- package/dist/SelectFilter-DUj7GBtT.js +0 -251
- package/dist/useDebounce-CWb5QR9G.js +0 -28
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { useSnackbar as
|
|
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
4
|
import { _ as xe } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
|
|
5
|
-
import { u as
|
|
6
|
-
import { g as z, a as be, b as
|
|
7
|
-
import { defineStore as
|
|
8
|
-
import { S as D } from "./SelectFilter-
|
|
9
|
-
import { _ as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { _ as Se } from "./
|
|
12
|
-
import { u as ue } from "./useLoading-
|
|
5
|
+
import { u as Y } from "./useAppStore-CEgLVGO6.js";
|
|
6
|
+
import { g as z, a as be, b as q, u as Z } from "./iteration-BV93u72h.js";
|
|
7
|
+
import { defineStore as we } from "pinia";
|
|
8
|
+
import { S as D } from "./SelectFilter-ATOm0hdn.js";
|
|
9
|
+
import { _ as ke } from "./app-C-wWQrRY.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-CJtXNU4d.js";
|
|
13
13
|
import { _ as Ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
|
|
14
|
-
const
|
|
14
|
+
const H = {
|
|
15
15
|
async getGrantUsers() {
|
|
16
|
-
return z(await
|
|
16
|
+
return z(await q("grant").get(""));
|
|
17
17
|
},
|
|
18
18
|
async createGrantUser(m) {
|
|
19
|
-
return z(await
|
|
19
|
+
return z(await q("grant").post("", m));
|
|
20
20
|
},
|
|
21
21
|
async revokeGrantUser(m, y) {
|
|
22
22
|
return z(
|
|
23
|
-
await
|
|
23
|
+
await q("grant").patch(`/revoke/${m}`, null, {
|
|
24
24
|
params: { restaurantId: y }
|
|
25
25
|
})
|
|
26
26
|
);
|
|
@@ -34,12 +34,12 @@ const W = {
|
|
|
34
34
|
})
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
}, Ce =
|
|
38
|
-
const m =
|
|
37
|
+
}, Ce = we("grantUser", () => {
|
|
38
|
+
const m = S([]), y = S(!1);
|
|
39
39
|
async function a() {
|
|
40
40
|
y.value = !0;
|
|
41
41
|
try {
|
|
42
|
-
m.value = (await
|
|
42
|
+
m.value = (await H.getGrantUsers()).sort(
|
|
43
43
|
(u, p) => u.createdAt < p.createdAt ? 1 : -1
|
|
44
44
|
);
|
|
45
45
|
} catch (u) {
|
|
@@ -50,15 +50,15 @@ const W = {
|
|
|
50
50
|
}
|
|
51
51
|
async function U(u) {
|
|
52
52
|
try {
|
|
53
|
-
const p = await
|
|
53
|
+
const p = await H.createGrantUser(u);
|
|
54
54
|
return m.value = [p, ...m.value], p;
|
|
55
55
|
} catch (p) {
|
|
56
56
|
throw console.error("Error creating grant user:", p), p;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
async function
|
|
59
|
+
async function w(u, p) {
|
|
60
60
|
try {
|
|
61
|
-
const l = await
|
|
61
|
+
const l = await H.revokeGrantUser(u, p), i = m.value.findIndex((o) => o._id === u);
|
|
62
62
|
i !== -1 && (m.value[i] = l);
|
|
63
63
|
} catch (l) {
|
|
64
64
|
throw console.error("Error revoking grant user:", l), l;
|
|
@@ -69,38 +69,38 @@ const W = {
|
|
|
69
69
|
isLoading: y,
|
|
70
70
|
readGrantUsers: a,
|
|
71
71
|
createGrantUser: U,
|
|
72
|
-
revokeGrantUser:
|
|
72
|
+
revokeGrantUser: w
|
|
73
73
|
};
|
|
74
|
-
}),
|
|
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
75
|
__name: "GrantUserForm",
|
|
76
76
|
setup(m, { expose: y }) {
|
|
77
|
-
const a =
|
|
77
|
+
const a = ee(), U = Y(), w = Z(), u = X(), p = ue(u), { t: l } = Q(), i = S(!1), o = S({
|
|
78
78
|
name: "",
|
|
79
79
|
restaurantId: "",
|
|
80
80
|
roleId: ""
|
|
81
|
-
}),
|
|
82
|
-
|
|
81
|
+
}), b = () => {
|
|
82
|
+
o.value = {
|
|
83
83
|
name: "",
|
|
84
84
|
restaurantId: "",
|
|
85
85
|
roleId: ""
|
|
86
86
|
}, i.value = !0;
|
|
87
|
-
}, V = F(() => l("grantUser.form.title")),
|
|
87
|
+
}, V = F(() => l("grantUser.form.title")), I = F(() => l("common.create")), C = F(() => w.restaurants.value.map((d) => ({
|
|
88
88
|
label: `${d.profile.code ? d.profile.code + " - " : ""}${d.profile.name}`,
|
|
89
89
|
value: d._id
|
|
90
|
-
}))), R = F(() =>
|
|
90
|
+
}))), R = F(() => o.value.restaurantId ? U.roles.value.filter((d) => d.restaurants.some((g) => g.id === o.value.restaurantId)).map((d) => ({
|
|
91
91
|
label: d.name,
|
|
92
92
|
value: d._id,
|
|
93
93
|
disabled: !d.isUsable
|
|
94
94
|
})) : []);
|
|
95
|
-
|
|
96
|
-
() =>
|
|
95
|
+
ce(
|
|
96
|
+
() => o.value.restaurantId,
|
|
97
97
|
() => {
|
|
98
|
-
|
|
98
|
+
o.value.roleId = "";
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
|
-
async function
|
|
101
|
+
async function M() {
|
|
102
102
|
await p.minor(async () => {
|
|
103
|
-
const d = await a.createGrantUser(
|
|
103
|
+
const d = await a.createGrantUser(o.value);
|
|
104
104
|
u.open({
|
|
105
105
|
message: l("grantUser.create.successMessage", {
|
|
106
106
|
passcode: d.passcode
|
|
@@ -111,35 +111,35 @@ const W = {
|
|
|
111
111
|
}
|
|
112
112
|
return y({
|
|
113
113
|
show: i,
|
|
114
|
-
trigger:
|
|
114
|
+
trigger: b
|
|
115
115
|
}), (d, g) => {
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
ge(d.$slots, "default", { trigger:
|
|
119
|
-
|
|
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
120
|
id: "grant-user-form",
|
|
121
121
|
modelValue: i.value,
|
|
122
122
|
"onUpdate:modelValue": g[4] || (g[4] = (f) => i.value = f),
|
|
123
|
-
"is-container":
|
|
123
|
+
"is-container": s(K).FmForm,
|
|
124
124
|
"is-container-props": {
|
|
125
|
-
onValidationSuccess:
|
|
125
|
+
onValidationSuccess: M,
|
|
126
126
|
blameFormChildOnValidationFailed: !0
|
|
127
127
|
},
|
|
128
128
|
"max-width": 560
|
|
129
129
|
}, {
|
|
130
130
|
"side-sheet-header": x(() => [
|
|
131
|
-
c("p", Be,
|
|
131
|
+
c("p", Be, k(V.value), 1)
|
|
132
132
|
]),
|
|
133
133
|
"side-sheet-footer": x(() => [
|
|
134
134
|
c("div", Ge, [
|
|
135
|
-
|
|
136
|
-
label:
|
|
135
|
+
r(L, {
|
|
136
|
+
label: I.value,
|
|
137
137
|
size: "lg",
|
|
138
138
|
type: "submit",
|
|
139
139
|
variant: "primary"
|
|
140
140
|
}, null, 8, ["label"]),
|
|
141
|
-
|
|
142
|
-
label:
|
|
141
|
+
r(L, {
|
|
142
|
+
label: s(l)("common.cancel"),
|
|
143
143
|
size: "lg",
|
|
144
144
|
variant: "tertiary",
|
|
145
145
|
onClick: g[3] || (g[3] = () => i.value = !1)
|
|
@@ -148,41 +148,41 @@ const W = {
|
|
|
148
148
|
]),
|
|
149
149
|
default: x(() => [
|
|
150
150
|
c("div", $e, [
|
|
151
|
-
|
|
152
|
-
title:
|
|
151
|
+
r(Ie, {
|
|
152
|
+
title: s(l)("grantUser.form.section")
|
|
153
153
|
}, {
|
|
154
154
|
default: x(() => [
|
|
155
|
-
|
|
156
|
-
modelValue:
|
|
157
|
-
"onUpdate:modelValue": g[0] || (g[0] = (f) =>
|
|
158
|
-
label:
|
|
159
|
-
rules: [(f) => !!f ||
|
|
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
160
|
}, null, 8, ["modelValue", "label", "rules"]),
|
|
161
|
-
|
|
162
|
-
label:
|
|
161
|
+
r(le, {
|
|
162
|
+
label: s(l)("grantUser.form.restaurant")
|
|
163
163
|
}, {
|
|
164
164
|
default: x(() => [
|
|
165
|
-
|
|
166
|
-
modelValue:
|
|
167
|
-
"onUpdate:modelValue": g[1] || (g[1] = (f) =>
|
|
168
|
-
items:
|
|
169
|
-
placeholder:
|
|
170
|
-
rules: [(f) => !!f ||
|
|
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
171
|
}, null, 8, ["modelValue", "items", "placeholder", "rules"])
|
|
172
172
|
]),
|
|
173
173
|
_: 1
|
|
174
174
|
}, 8, ["label"]),
|
|
175
|
-
|
|
176
|
-
label:
|
|
175
|
+
r(le, {
|
|
176
|
+
label: s(l)("grantUser.form.role")
|
|
177
177
|
}, {
|
|
178
178
|
default: x(() => [
|
|
179
|
-
|
|
180
|
-
modelValue:
|
|
181
|
-
"onUpdate:modelValue": g[2] || (g[2] = (f) =>
|
|
179
|
+
r(G, {
|
|
180
|
+
modelValue: o.value.roleId,
|
|
181
|
+
"onUpdate:modelValue": g[2] || (g[2] = (f) => o.value.roleId = f),
|
|
182
182
|
items: R.value,
|
|
183
|
-
placeholder:
|
|
184
|
-
disabled: !
|
|
185
|
-
rules: [(f) => !!f ||
|
|
183
|
+
placeholder: s(l)("grantUser.form.selectRole"),
|
|
184
|
+
disabled: !o.value.restaurantId,
|
|
185
|
+
rules: [(f) => !!f || s(l)("grantUser.form.roleRequired")]
|
|
186
186
|
}, null, 8, ["modelValue", "items", "placeholder", "disabled", "rules"])
|
|
187
187
|
]),
|
|
188
188
|
_: 1
|
|
@@ -210,59 +210,61 @@ const W = {
|
|
|
210
210
|
}, Ee = {
|
|
211
211
|
class: "px-16 flex items-start gap-8"
|
|
212
212
|
}, Ke = {
|
|
213
|
-
class: "
|
|
213
|
+
class: "flex h-full flex-col overflow-auto"
|
|
214
214
|
}, Me = {
|
|
215
|
-
class: "
|
|
215
|
+
class: "pb-64 hidden xs:block"
|
|
216
216
|
}, Pe = {
|
|
217
|
-
class: "
|
|
217
|
+
class: "space-y-4"
|
|
218
218
|
}, Te = {
|
|
219
|
-
class: "
|
|
219
|
+
class: "flex items-center gap-8"
|
|
220
220
|
}, Oe = {
|
|
221
|
-
class: "
|
|
221
|
+
class: "fm-typo-en-body-lg-600"
|
|
222
222
|
}, je = {
|
|
223
|
-
class: "text-
|
|
223
|
+
class: "font-mono text-lg font-bold mr-4"
|
|
224
224
|
}, qe = {
|
|
225
|
-
class: "text-
|
|
225
|
+
class: "text-fm-color-typo-secondary"
|
|
226
226
|
}, He = {
|
|
227
|
-
class: "mt-4 space-y-2"
|
|
228
|
-
}, We = {
|
|
229
227
|
class: "text-xs"
|
|
228
|
+
}, We = {
|
|
229
|
+
class: "mt-4 space-y-2"
|
|
230
230
|
}, Je = {
|
|
231
231
|
class: "text-xs"
|
|
232
232
|
}, Qe = {
|
|
233
|
+
class: "text-xs"
|
|
234
|
+
}, Xe = {
|
|
233
235
|
key: 0,
|
|
234
236
|
class: "flex flex-col gap-4"
|
|
235
|
-
},
|
|
237
|
+
}, Ye = /* @__PURE__ */ J({
|
|
236
238
|
__name: "GrantUserList",
|
|
237
239
|
setup(m, {
|
|
238
240
|
expose: y
|
|
239
241
|
}) {
|
|
240
242
|
const {
|
|
241
243
|
t: a
|
|
242
|
-
} =
|
|
244
|
+
} = Q(), U = S(), w = ee(), {
|
|
243
245
|
restaurants: u
|
|
244
|
-
} =
|
|
246
|
+
} = Z(), {
|
|
245
247
|
roles: p
|
|
246
|
-
} =
|
|
248
|
+
} = Y(), l = F(() => w.grantUsers), {
|
|
247
249
|
searchKey: i,
|
|
248
|
-
filter:
|
|
249
|
-
} = Fe(),
|
|
250
|
+
filter: o
|
|
251
|
+
} = Fe(), b = F(() => {
|
|
250
252
|
var e;
|
|
251
253
|
return (e = l.value) == null ? void 0 : e.filter((t) => {
|
|
252
|
-
const v = !U.value || U.value.includes(t.restaurantId),
|
|
253
|
-
return v &&
|
|
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]);
|
|
254
256
|
});
|
|
255
257
|
}), V = F(() => {
|
|
256
258
|
const e = {};
|
|
257
259
|
return u.value.forEach((t) => {
|
|
258
260
|
e[t._id] = t.profile.name;
|
|
259
261
|
}), e;
|
|
260
|
-
}),
|
|
262
|
+
}), I = F(() => {
|
|
261
263
|
const e = {};
|
|
262
264
|
return p.value.forEach((t) => {
|
|
263
265
|
e[t._id] = t.name;
|
|
264
266
|
}), e;
|
|
265
|
-
}),
|
|
267
|
+
}), C = (e) => {
|
|
266
268
|
switch (e) {
|
|
267
269
|
case "active":
|
|
268
270
|
return "bg-fm-color-system-success-100 text-fm-color-typo-success";
|
|
@@ -273,7 +275,7 @@ const W = {
|
|
|
273
275
|
default:
|
|
274
276
|
return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
|
|
275
277
|
}
|
|
276
|
-
}, R = (e) => a(`grantUser.status.${e}`),
|
|
278
|
+
}, R = (e) => a(`grantUser.status.${e}`), M = [{
|
|
277
279
|
accessorKey: "passcode",
|
|
278
280
|
size: 120,
|
|
279
281
|
maxSize: 120,
|
|
@@ -283,8 +285,8 @@ const W = {
|
|
|
283
285
|
const t = e.row.original.passcode;
|
|
284
286
|
return _("div", {
|
|
285
287
|
class: "flex items-center gap-8"
|
|
286
|
-
}, [_(
|
|
287
|
-
variant:
|
|
288
|
+
}, [_(K.FmButton, {
|
|
289
|
+
variant: j.Tertiary,
|
|
288
290
|
textColor: "neutral-gray-400",
|
|
289
291
|
icon: "content_copy",
|
|
290
292
|
onClick: (v) => {
|
|
@@ -312,10 +314,10 @@ const W = {
|
|
|
312
314
|
}
|
|
313
315
|
}, {
|
|
314
316
|
accessorKey: "roleName",
|
|
315
|
-
accessorFn: (e) =>
|
|
317
|
+
accessorFn: (e) => I.value[e.roleId],
|
|
316
318
|
header: () => a("grantUser.columns.role"),
|
|
317
319
|
cell(e) {
|
|
318
|
-
const t = e.row.original.roleId, v =
|
|
320
|
+
const t = e.row.original.roleId, v = I.value[t] || "-";
|
|
319
321
|
return _("div", v);
|
|
320
322
|
}
|
|
321
323
|
}, {
|
|
@@ -326,9 +328,9 @@ const W = {
|
|
|
326
328
|
},
|
|
327
329
|
cell(e) {
|
|
328
330
|
const t = e.row.original.status;
|
|
329
|
-
return _(
|
|
331
|
+
return _(K.FmChip, {
|
|
330
332
|
label: R(t),
|
|
331
|
-
class:
|
|
333
|
+
class: C(t)
|
|
332
334
|
});
|
|
333
335
|
}
|
|
334
336
|
}, {
|
|
@@ -358,15 +360,15 @@ const W = {
|
|
|
358
360
|
const t = e.row.original;
|
|
359
361
|
return t.status !== "active" ? null : _("div", {
|
|
360
362
|
class: "w-full flex justify-end items-center gap-4"
|
|
361
|
-
}, [_(
|
|
363
|
+
}, [_(K.FmButton, {
|
|
362
364
|
label: a("grantUser.actions.revoke"),
|
|
363
|
-
variant:
|
|
365
|
+
variant: j.Secondary,
|
|
364
366
|
onClick: (v) => {
|
|
365
367
|
v.stopPropagation(), N(t);
|
|
366
368
|
}
|
|
367
369
|
})]);
|
|
368
370
|
}
|
|
369
|
-
}], d =
|
|
371
|
+
}], d = X(), g = Ue(), P = ue(d), G = S(), {
|
|
370
372
|
breakpoints: L
|
|
371
373
|
} = he(), N = (e) => {
|
|
372
374
|
g.open({
|
|
@@ -385,8 +387,8 @@ const W = {
|
|
|
385
387
|
close: !0
|
|
386
388
|
}
|
|
387
389
|
}).onPrimary(async () => {
|
|
388
|
-
|
|
389
|
-
await
|
|
390
|
+
P.minor(async () => {
|
|
391
|
+
await w.revokeGrantUser(e._id, e.restaurantId);
|
|
390
392
|
}, {
|
|
391
393
|
successMessage: a("grantUser.revoke.successMessage", {
|
|
392
394
|
name: e.name
|
|
@@ -398,7 +400,7 @@ const W = {
|
|
|
398
400
|
var e;
|
|
399
401
|
(e = G.value) == null || e.trigger();
|
|
400
402
|
}
|
|
401
|
-
const
|
|
403
|
+
const te = F(() => [{
|
|
402
404
|
label: a("grantUser.status.active"),
|
|
403
405
|
value: "active"
|
|
404
406
|
}, {
|
|
@@ -407,10 +409,10 @@ const W = {
|
|
|
407
409
|
}, {
|
|
408
410
|
label: a("grantUser.status.revoked"),
|
|
409
411
|
value: "revoked"
|
|
410
|
-
}]),
|
|
412
|
+
}]), ae = F(() => u.value.map((e) => ({
|
|
411
413
|
label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
|
|
412
414
|
value: e._id
|
|
413
|
-
}))),
|
|
415
|
+
}))), B = S();
|
|
414
416
|
async function se(e) {
|
|
415
417
|
try {
|
|
416
418
|
await navigator.clipboard.writeText(e), d.open({
|
|
@@ -426,140 +428,141 @@ const W = {
|
|
|
426
428
|
}
|
|
427
429
|
return y({
|
|
428
430
|
create: f,
|
|
429
|
-
filteredGrantUsers:
|
|
431
|
+
filteredGrantUsers: b
|
|
430
432
|
}), (e, t) => {
|
|
431
|
-
const v = h("FmSearch"),
|
|
432
|
-
return
|
|
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, {
|
|
433
435
|
ref_key: "grantUserFormRef",
|
|
434
436
|
ref: G,
|
|
435
437
|
class: "gap-8"
|
|
436
|
-
}, null, 512), c("div", Le, [c("div", Ne, [c("div", Ae, [
|
|
438
|
+
}, null, 512), c("div", Le, [c("div", Ne, [c("div", Ae, [r(D, {
|
|
437
439
|
modelValue: U.value,
|
|
438
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
440
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => U.value = n),
|
|
439
441
|
multiple: "",
|
|
440
|
-
items:
|
|
442
|
+
items: ae.value,
|
|
441
443
|
variant: "dark",
|
|
442
|
-
"selected-prefix":
|
|
443
|
-
placeholder:
|
|
444
|
+
"selected-prefix": s(a)("grantUser.columns.restaurant"),
|
|
445
|
+
placeholder: s(a)("grantUser.columns.restaurant"),
|
|
444
446
|
class: "!w-auto"
|
|
445
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]),
|
|
446
|
-
modelValue:
|
|
447
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
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),
|
|
448
450
|
multiple: "",
|
|
449
451
|
variant: "dark",
|
|
450
|
-
items:
|
|
451
|
-
"selected-prefix":
|
|
452
|
-
placeholder:
|
|
453
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]),
|
|
454
|
-
modelValue:
|
|
455
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
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),
|
|
456
458
|
autofocus: "",
|
|
457
459
|
class: "pl-4 w-[320px]",
|
|
458
|
-
placeholder:
|
|
459
|
-
}, null, 8, ["modelValue", "placeholder"])]), c("div", ze, [c("div", De, [
|
|
460
|
-
modelValue:
|
|
461
|
-
"onUpdate:modelValue": t[3] || (t[3] = (
|
|
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),
|
|
462
464
|
autofocus: "",
|
|
463
|
-
placeholder:
|
|
464
|
-
}, null, 8, ["modelValue", "placeholder"])]),
|
|
465
|
+
placeholder: s(a)("grantUser.search.placeholder")
|
|
466
|
+
}, null, 8, ["modelValue", "placeholder"])]), r(Ve), c("div", Ee, [r(D, {
|
|
465
467
|
modelValue: U.value,
|
|
466
|
-
"onUpdate:modelValue": t[4] || (t[4] = (
|
|
468
|
+
"onUpdate:modelValue": t[4] || (t[4] = (n) => U.value = n),
|
|
467
469
|
multiple: "",
|
|
468
|
-
items:
|
|
470
|
+
items: ae.value,
|
|
469
471
|
variant: "dark",
|
|
470
|
-
"selected-prefix":
|
|
471
|
-
placeholder:
|
|
472
|
+
"selected-prefix": s(a)("grantUser.columns.restaurant"),
|
|
473
|
+
placeholder: s(a)("grantUser.columns.restaurant"),
|
|
472
474
|
class: "!w-auto"
|
|
473
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]),
|
|
474
|
-
modelValue:
|
|
475
|
-
"onUpdate:modelValue": t[5] || (t[5] = (
|
|
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),
|
|
476
478
|
multiple: "",
|
|
477
|
-
items:
|
|
479
|
+
items: te.value,
|
|
478
480
|
variant: "dark",
|
|
479
|
-
"selected-prefix":
|
|
480
|
-
placeholder:
|
|
481
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]),
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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, {
|
|
495
502
|
separator: ""
|
|
496
503
|
}, {
|
|
497
|
-
default: x(() => [(
|
|
498
|
-
key:
|
|
504
|
+
default: x(() => [($(!0), E(W, null, fe(b.value, (n) => ($(), ie(de, {
|
|
505
|
+
key: n._id,
|
|
499
506
|
class: "py-12 px-16 items-center justify-between"
|
|
500
507
|
}, {
|
|
501
|
-
default: x(() => [c("div",
|
|
508
|
+
default: x(() => [c("div", Pe, [c("div", Te, [r(A, {
|
|
502
509
|
variant: "tertiary",
|
|
503
510
|
"text-color": "neutral-gray-400",
|
|
504
511
|
icon: "content_copy",
|
|
505
|
-
onClick:
|
|
506
|
-
}, null, 8, ["onClick"]), c("p",
|
|
507
|
-
label: R(
|
|
508
|
-
class: _e(
|
|
509
|
-
}, null, 8, ["label", "class"])])])]),
|
|
510
|
-
label:
|
|
511
|
-
variant:
|
|
512
|
-
onClick:
|
|
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"])
|
|
513
520
|
}, null, 8, ["label", "variant", "onClick"])])) : ve("", !0)]),
|
|
514
521
|
_: 2
|
|
515
522
|
}, 1024))), 128))]),
|
|
516
523
|
_: 1
|
|
517
|
-
})])]),
|
|
524
|
+
})])])]),
|
|
518
525
|
_: 1
|
|
519
|
-
}))
|
|
520
|
-
key: 1,
|
|
521
|
-
title: r(a)("grantUser.noData.title"),
|
|
522
|
-
subtitle: r(a)("grantUser.noData.subtitle")
|
|
523
|
-
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
526
|
+
})])], 64);
|
|
524
527
|
};
|
|
525
528
|
}
|
|
526
|
-
}),
|
|
529
|
+
}), mt = /* @__PURE__ */ J({
|
|
527
530
|
__name: "Main",
|
|
528
531
|
setup(m) {
|
|
529
|
-
const { readGrantUsers: y } =
|
|
530
|
-
return
|
|
532
|
+
const { readGrantUsers: y } = ee(), { currentBusiness: a } = ye(), { readRoles: U } = Y(), { readRestaurants: w } = Z(), { t: u } = Q(), p = X(), l = S();
|
|
533
|
+
return ce(
|
|
531
534
|
a,
|
|
532
535
|
async () => {
|
|
533
536
|
var i;
|
|
534
537
|
if ((i = a.value) != null && i._id)
|
|
535
538
|
try {
|
|
536
|
-
await Promise.all([
|
|
537
|
-
} catch (
|
|
538
|
-
console.error("Failed to load grant dependencies:",
|
|
539
|
-
message:
|
|
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),
|
|
540
543
|
type: "error"
|
|
541
544
|
});
|
|
542
545
|
}
|
|
543
546
|
},
|
|
544
547
|
{ immediate: !0 }
|
|
545
|
-
), (i,
|
|
546
|
-
const
|
|
547
|
-
return
|
|
548
|
-
heading:
|
|
548
|
+
), (i, o) => {
|
|
549
|
+
const b = h("FmSpacer"), V = h("FmButton");
|
|
550
|
+
return $(), ie(xe, {
|
|
551
|
+
heading: s(u)("grantUser.title")
|
|
549
552
|
}, {
|
|
550
553
|
"append-heading": x(() => [
|
|
551
|
-
|
|
552
|
-
|
|
554
|
+
r(b),
|
|
555
|
+
r(V, {
|
|
553
556
|
"prepend-icon": "add",
|
|
554
|
-
label:
|
|
555
|
-
onClick:
|
|
556
|
-
var
|
|
557
|
-
return (
|
|
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();
|
|
558
561
|
})
|
|
559
562
|
}, null, 8, ["label"])
|
|
560
563
|
]),
|
|
561
564
|
default: x(() => [
|
|
562
|
-
|
|
565
|
+
r(Ye, {
|
|
563
566
|
ref_key: "grantUserListRef",
|
|
564
567
|
ref: l
|
|
565
568
|
}, null, 512)
|
|
@@ -570,5 +573,5 @@ const W = {
|
|
|
570
573
|
}
|
|
571
574
|
});
|
|
572
575
|
export {
|
|
573
|
-
|
|
576
|
+
mt as default
|
|
574
577
|
};
|