@feedmepos/mf-hrm-portal 2.2.1-dev.2 → 2.2.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.
Files changed (42) hide show
  1. package/dist/{ApprovalCodeList-DZajn7xx.js → ApprovalCodeList-rL8dh-6s.js} +5 -5
  2. package/dist/{AuditLogList-CpKIq8I0.js → AuditLogList-NvISIfUq.js} +4 -4
  3. package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BJgpH-kw.js +438 -0
  4. package/dist/{EmployeeList-DDuxDdlJ.js → EmployeeList-C3VvVY6A.js} +6 -6
  5. package/dist/{GrantUserList-735upmIE.js → GrantUserList-DjZ4O0VB.js} +6 -6
  6. package/dist/{Main-DyZ6dJ2d.js → Main-ByWrRV70.js} +8 -8
  7. package/dist/{Main-tQ6MrkkP.js → Main-DVTx58X9.js} +11 -11
  8. package/dist/{Main-CHHR0r5b.js → Main-LaAbAOfs.js} +5 -5
  9. package/dist/{PermissionSetList-ZxLNYPEB.js → PermissionSetList-DD45SSY3.js} +7 -7
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-yDPvNHiW.js +4169 -0
  11. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DVVSBIx2.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-XHuHin8t.js} +1 -1
  12. package/dist/RoleList-BDxgwmAV.js +725 -0
  13. package/dist/{TeamMemberList-B58boeR9.js → TeamMemberList-DrLbMN34.js} +9 -9
  14. package/dist/{TimesheetList-DMnNVVlB.js → TimesheetList-CdaxlO97.js} +7 -7
  15. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-Ch8Ng6wi.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-ogjfztLs.js} +3 -3
  16. package/dist/{app-CtuaUGnw.js → app-B8eo04d6.js} +6 -6
  17. package/dist/app.js +1 -1
  18. package/dist/{approval-code-Q4666xp5.js → approval-code-jIjkeVEb.js} +1 -1
  19. package/dist/{dayjs.min-9pRWRTS9.js → dayjs.min-DZEHW2QB.js} +1 -1
  20. package/dist/{employee-JmfN-rQF.js → employee-DX0CZF-B.js} +4 -4
  21. package/dist/{grant-user-CQZaTzVt.js → grant-user-SNiDV22U.js} +1 -1
  22. package/dist/{iteration-CkzTvtOv.js → iteration-yBS4dpFh.js} +1 -1
  23. package/dist/{lodash-BNBzabCH.js → lodash-344d5Ope.js} +1 -1
  24. package/dist/{restaurant-YOVMuuFY.js → restaurant-BTpBmfBV.js} +12 -14
  25. package/dist/role-BXBuBxs5.js +92 -0
  26. package/dist/rule-DWlFon04.js +1094 -0
  27. package/dist/src/composables/useReportPermissions.d.ts +1 -0
  28. package/dist/src/helpers/rule.d.ts +10 -1
  29. package/dist/src/stores/role.d.ts +6 -6
  30. package/dist/src/views/team/components/PortalConditionForm.vue.d.ts +44 -0
  31. package/dist/src/views/team/condition-builders/ConditionBuilderForm.vue.d.ts +39 -0
  32. package/dist/tsconfig.app.tsbuildinfo +1 -1
  33. package/dist/{useAppStore-DNTlIeMv.js → useAppStore-DCwd8GWN.js} +1 -1
  34. package/dist/{useLoading-BH02lYns.js → useLoading-CXzTpIVv.js} +1 -1
  35. package/dist/useReportPermissions-C0exkIxU.js +71 -0
  36. package/package.json +1 -1
  37. package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-DCfvikJB.js +0 -387
  38. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-MoFevdmL.js +0 -4122
  39. package/dist/RoleList-BZbEGpCi.js +0 -685
  40. package/dist/role-R_9sO2QD.js +0 -82
  41. package/dist/rule-D1pKbnKR.js +0 -1066
  42. package/dist/useReportPermissions-ByxRc3kz.js +0 -70
@@ -1,5 +1,5 @@
1
1
  import { defineStore as p } from "pinia";
2
- import { g as s } from "./restaurant-YOVMuuFY.js";
2
+ import { g as s } from "./restaurant-BTpBmfBV.js";
3
3
  import { baseClientInstance as d } from "@feedmepos/mf-common";
4
4
  var n = [];
5
5
  for (var r = 0; r < 256; ++r)
@@ -1,6 +1,6 @@
1
1
  import { computed as I, isRef as L, watch as M } from "vue";
2
2
  import { SnackbarPosition as y } from "@feedmepos/ui-library";
3
- import { u as w, v } from "./useAppStore-DNTlIeMv.js";
3
+ import { u as w, v } from "./useAppStore-DCwd8GWN.js";
4
4
  const E = (r) => {
5
5
  async function d(u, e) {
6
6
  var l, a;
@@ -0,0 +1,71 @@
1
+ import { computed as i, ref as t } from "vue";
2
+ import { e as m } from "./iteration-yBS4dpFh.js";
3
+ import { useCoreStore as h } from "@feedmepos/mf-common";
4
+ import { e as S, R as L } from "./rule-DWlFon04.js";
5
+ import "./app-B8eo04d6.js";
6
+ const l = t([]), a = t(!1), r = t(!1), d = t(null), p = t(null), u = t(!1);
7
+ function B() {
8
+ const v = h();
9
+ async function f() {
10
+ var e;
11
+ const s = (e = v.currentBusiness.value) == null ? void 0 : e.id;
12
+ if (!s) return;
13
+ d.value !== s && (l.value = [], a.value = !1, r.value = !1, d.value = s, u.value = !1);
14
+ const o = localStorage.getItem("locale");
15
+ if (!(a.value && p.value === o)) {
16
+ if (r.value) {
17
+ u.value = !0;
18
+ return;
19
+ }
20
+ r.value = !0;
21
+ try {
22
+ l.value = await L.fetchReportPermissions(
23
+ s,
24
+ o
25
+ ), a.value = !0, p.value = o;
26
+ } catch (n) {
27
+ console.warn("Failed to fetch dynamic report permissions, keeping last known list:", n), a.value = !1;
28
+ } finally {
29
+ r.value = !1, u.value && (u.value = !1, await f());
30
+ }
31
+ }
32
+ }
33
+ const c = S.filter(
34
+ (s) => s.subject === m.F_RULE_SUBJECT.enum.report && s.conditions
35
+ ), y = i(() => {
36
+ const s = new Set(
37
+ c.map((e) => {
38
+ const n = typeof e.conditions == "string" ? JSON.parse(e.conditions) : e.conditions;
39
+ return n == null ? void 0 : n.name;
40
+ })
41
+ ), o = l.value.filter((e) => !s.has(e.permissionKey)).map((e) => ({
42
+ label: e.name,
43
+ subject: m.F_RULE_SUBJECT.enum.report,
44
+ actions: ["read"],
45
+ conditions: { name: e.permissionKey },
46
+ inverted: !1,
47
+ reason: ""
48
+ }));
49
+ return [...c, ...o];
50
+ }), R = i(() => {
51
+ const s = new Set(
52
+ c.map((o) => {
53
+ const e = typeof o.conditions == "string" ? JSON.parse(o.conditions) : o.conditions;
54
+ return e == null ? void 0 : e.name;
55
+ })
56
+ );
57
+ for (const o of l.value)
58
+ s.add(o.permissionKey);
59
+ return s;
60
+ });
61
+ return {
62
+ fetchReportPermissions: f,
63
+ allReportPermissions: y,
64
+ availableReportKeys: R,
65
+ isLoading: i(() => r.value),
66
+ isLoaded: i(() => a.value)
67
+ };
68
+ }
69
+ export {
70
+ B as u
71
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-hrm-portal",
3
- "version": "2.2.1-dev.2",
3
+ "version": "2.2.1-dev.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,387 +0,0 @@
1
- import { defineComponent as B, ref as N, onMounted as te, nextTick as ne, onUnmounted as oe, resolveComponent as h, createElementBlock as g, openBlock as s, Fragment as U, createElementVNode as x, renderSlot as P, createCommentVNode as E, toDisplayString as ae, createVNode as le, normalizeStyle as ue, watch as W, defineAsyncComponent as re, computed as I, renderList as A, createBlock as p, withCtx as G, unref as D, resolveDynamicComponent as ie } from "vue";
2
- import { O as H, f as se, U as j } from "./app-CtuaUGnw.js";
3
- import { useI18n as de, useCoreStore as ce } from "@feedmepos/mf-common";
4
- import { l as me } from "./lodash-BNBzabCH.js";
5
- const fe = { class: "flex items-center" }, ve = {
6
- key: 0,
7
- class: "ml-8 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
8
- }, be = { class: "ml-auto" }, Ne = /* @__PURE__ */ B({
9
- __name: "CollapsibleWrapper",
10
- props: {
11
- title: { default: "" },
12
- subtitle: { default: "" },
13
- initiallyCollapsed: { type: Boolean, default: !1 }
14
- },
15
- setup(t) {
16
- const l = N(t.initiallyCollapsed), c = N(), m = N(0);
17
- let f;
18
- function F() {
19
- l.value = !l.value;
20
- }
21
- function v() {
22
- c.value && (m.value = c.value.scrollHeight);
23
- }
24
- return te(async () => {
25
- await ne(), c.value && (f = new ResizeObserver(() => {
26
- v();
27
- }), f.observe(c.value));
28
- }), oe(() => {
29
- f == null || f.disconnect();
30
- }), (k, r) => {
31
- const d = h("FmButton");
32
- return s(), g(U, null, [
33
- x("div", { onClick: F }, [
34
- x("div", fe, [
35
- P(k.$slots, "title"),
36
- l.value && t.subtitle ? (s(), g("span", ve, ae(t.subtitle), 1)) : E("", !0),
37
- x("div", be, [
38
- le(d, {
39
- icon: l.value ? "keyboard_arrow_down" : "keyboard_arrow_up",
40
- "text-color": "neutral-gray-400",
41
- variant: "tertiary",
42
- size: "md"
43
- }, null, 8, ["icon"])
44
- ])
45
- ])
46
- ]),
47
- x("div", {
48
- ref_key: "contentRef",
49
- ref: c,
50
- class: "transition-all duration-300 ease-in-out overflow-hidden",
51
- style: ue({ maxHeight: l.value ? "0" : m.value + "px" })
52
- }, [
53
- P(k.$slots, "default")
54
- ], 4)
55
- ], 64);
56
- };
57
- }
58
- });
59
- function _(t) {
60
- return `${t.subject}::${t.builderKey}`;
61
- }
62
- function Se(t) {
63
- const u = N(/* @__PURE__ */ new Map());
64
- function l(r, d) {
65
- const y = new Map(u.value);
66
- y.set(_(r), d), u.value = y;
67
- }
68
- function c(r) {
69
- return u.value.get(_(r));
70
- }
71
- function m(r) {
72
- for (const d of u.value.keys())
73
- if (d.startsWith(`${r}::`)) return !0;
74
- return !1;
75
- }
76
- function f(r) {
77
- const d = /* @__PURE__ */ new Map();
78
- for (const [y, S] of u.value.entries())
79
- y.startsWith(`${r}::`) && d.set(y, S);
80
- return d;
81
- }
82
- function F(r) {
83
- const d = new Map(u.value);
84
- for (const y of Array.from(d.keys()))
85
- y.startsWith(`${r}::`) && d.delete(y);
86
- u.value = d;
87
- }
88
- function v() {
89
- u.value = /* @__PURE__ */ new Map();
90
- }
91
- function k(r) {
92
- const d = new Map(u.value);
93
- d.delete(_(r)), u.value = d;
94
- }
95
- return t && W(
96
- t,
97
- () => {
98
- v();
99
- },
100
- { deep: !0 }
101
- ), {
102
- drafts: u,
103
- setDraft: l,
104
- getDraft: c,
105
- hasDraftsForSubject: m,
106
- getDraftsForSubject: f,
107
- clearDraftsForSubject: F,
108
- clearAllDrafts: v,
109
- clearDraft: k
110
- };
111
- }
112
- const ye = {}, L = /* @__PURE__ */ new Map();
113
- function pe(t) {
114
- const u = L.get(t);
115
- if (u) return u;
116
- const l = ye[t];
117
- if (!l) return;
118
- const c = re(l);
119
- return L.set(t, c), c;
120
- }
121
- function ke(t, u) {
122
- return !me.isEqual(t, u);
123
- }
124
- const Ve = { class: "flex flex-col gap-8" }, he = { class: "flex flex-col gap-4" }, ge = "condition-form-select-menu", Z = 120, Fe = 220, Ce = /* @__PURE__ */ B({
125
- __name: "ConditionFormRenderer",
126
- props: {
127
- config: {},
128
- modelValue: {},
129
- disabled: { type: Boolean, default: !1 },
130
- optionProviders: { default: () => ({}) }
131
- },
132
- emits: ["update:modelValue"],
133
- setup(t, { emit: u }) {
134
- const l = t, c = u, { t: m } = de(), f = ce(), F = I(() => H(l.config, l.modelValue));
135
- let v = l.modelValue;
136
- W(
137
- () => l.modelValue,
138
- (e) => {
139
- v = e;
140
- }
141
- );
142
- function k(e) {
143
- return "static" in e ? e.static.map((n) => ({ value: n.value, label: m(n.labelKey) })) : l.optionProviders[e.provider] ?? [];
144
- }
145
- function r(e, n) {
146
- const a = d(
147
- se(l.config, { ...l.modelValue, [e]: n })
148
- );
149
- ke(a, v) && (v = a, c("update:modelValue", a));
150
- }
151
- function d(e) {
152
- const n = { ...e };
153
- for (const a of H(l.config, n))
154
- a.kind === "date" && !n[a.key] && (n[a.key] = K(J()));
155
- return n;
156
- }
157
- function y() {
158
- const e = f.currentBusiness.value;
159
- if (e != null && e.timezone) return e.timezone;
160
- if (e != null && e.timeZone) return e.timeZone;
161
- const n = (e == null ? void 0 : e.country) ?? (f.currentCountry.value instanceof Object ? f.currentCountry.value.code : f.currentCountry.value);
162
- return S(n);
163
- }
164
- function S(e) {
165
- switch ((e || "").toUpperCase()) {
166
- case "MY":
167
- return "Asia/Kuala_Lumpur";
168
- case "SG":
169
- return "Asia/Singapore";
170
- case "TH":
171
- return "Asia/Bangkok";
172
- case "ID":
173
- return "Asia/Jakarta";
174
- case "MO":
175
- return "Asia/Macau";
176
- case "BN":
177
- return "Asia/Brunei";
178
- case "PK":
179
- return "Asia/Karachi";
180
- case "MV":
181
- return "Indian/Maldives";
182
- case "VN":
183
- return "Asia/Ho_Chi_Minh";
184
- case "JP":
185
- return "Asia/Tokyo";
186
- case "AU":
187
- return "Australia/Sydney";
188
- case "AE":
189
- return "Asia/Dubai";
190
- case "UK":
191
- return "Europe/London";
192
- default:
193
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
194
- }
195
- }
196
- function $(e, n) {
197
- const a = new Intl.DateTimeFormat("en-CA", {
198
- timeZone: n,
199
- year: "numeric",
200
- month: "2-digit",
201
- day: "2-digit",
202
- hour: "2-digit",
203
- minute: "2-digit",
204
- second: "2-digit",
205
- hourCycle: "h23"
206
- }).formatToParts(e), b = Object.fromEntries(
207
- a.filter((V) => V.type !== "literal").map((V) => [V.type, V.value])
208
- );
209
- return {
210
- year: Number(b.year),
211
- month: Number(b.month),
212
- day: Number(b.day),
213
- hour: Number(b.hour),
214
- minute: Number(b.minute),
215
- second: Number(b.second)
216
- };
217
- }
218
- function z(e, n) {
219
- try {
220
- const a = $(n, e);
221
- return (Date.UTC(
222
- a.year,
223
- a.month - 1,
224
- a.day,
225
- a.hour,
226
- a.minute,
227
- a.second
228
- ) - n.getTime()) / 6e4;
229
- } catch {
230
- return 0;
231
- }
232
- }
233
- function K(e) {
234
- const [n, a, b] = e.split("-").map(Number);
235
- if (!n || !a || !b) return "";
236
- const V = y(), C = new Date(Date.UTC(n, a - 1, b, 0, 0, 0, 0)), M = z(V, C), w = new Date(C.getTime() - M * 6e4), O = z(V, w);
237
- return new Date(C.getTime() - O * 6e4).toISOString();
238
- }
239
- function R(e) {
240
- const n = new Date(e);
241
- if (Number.isNaN(n.getTime())) return "";
242
- try {
243
- const a = $(n, y());
244
- return `${String(a.year).padStart(4, "0")}-${String(a.month).padStart(2, "0")}-${String(a.day).padStart(2, "0")}`;
245
- } catch {
246
- return e.slice(0, 10);
247
- }
248
- }
249
- function J() {
250
- return R((/* @__PURE__ */ new Date()).toISOString());
251
- }
252
- function T(e) {
253
- return "options" in e ? k(e.options) : [];
254
- }
255
- function X(e) {
256
- const n = l.modelValue[e];
257
- return n == null ? "" : String(n);
258
- }
259
- function q(e) {
260
- const n = l.modelValue[e];
261
- return typeof n != "string" || !n ? "" : R(n);
262
- }
263
- function Y(e, n) {
264
- r(e, n ? K(n) : "");
265
- }
266
- function Q(e, n) {
267
- let a = Math.floor(Number(n) || (e.min ?? 0));
268
- e.min !== void 0 && (a = Math.max(e.min, a)), e.max !== void 0 && (a = Math.min(e.max, a)), r(e.key, a);
269
- }
270
- return (e, n) => {
271
- const a = h("FmRadio"), b = h("FmRadioGroup"), V = h("FmSelect"), C = h("FmTextField"), M = h("FmDatePicker"), w = h("FmCheckbox"), O = h("FmFormGroup");
272
- return s(), g("div", Ve, [
273
- (s(!0), g(U, null, A(F.value, (o) => (s(), g(U, {
274
- key: o.key
275
- }, [
276
- o.kind === "radio" ? (s(), p(b, {
277
- key: 0,
278
- "model-value": t.modelValue[o.key],
279
- disabled: t.disabled,
280
- "onUpdate:modelValue": (i) => r(o.key, i)
281
- }, {
282
- default: G(() => [
283
- (s(!0), g(U, null, A(T(o), (i) => (s(), p(a, {
284
- key: i.value,
285
- value: i.value,
286
- label: i.label
287
- }, null, 8, ["value", "label"]))), 128))
288
- ]),
289
- _: 2
290
- }, 1032, ["model-value", "disabled", "onUpdate:modelValue"])) : o.kind === "select" ? (s(), p(V, {
291
- key: 1,
292
- "model-value": t.modelValue[o.key],
293
- label: D(m)(o.labelKey),
294
- items: T(o),
295
- "menu-id": ge,
296
- "menu-z-index": Z,
297
- "max-height": Fe,
298
- "shift-menu": "",
299
- placement: "bottom-start",
300
- disabled: t.disabled,
301
- "onUpdate:modelValue": (i) => r(o.key, i)
302
- }, null, 8, ["model-value", "label", "items", "disabled", "onUpdate:modelValue"])) : o.kind === "number" ? (s(), p(C, {
303
- key: 2,
304
- "model-value": X(o.key),
305
- type: "number",
306
- class: "!w-[120px] ml-32",
307
- label: D(m)(o.labelKey),
308
- disabled: t.disabled,
309
- "onUpdate:modelValue": (i) => Q(o, i)
310
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "text" ? (s(), p(C, {
311
- key: 3,
312
- "model-value": t.modelValue[o.key] ?? "",
313
- label: D(m)(o.labelKey),
314
- disabled: t.disabled,
315
- "onUpdate:modelValue": (i) => r(o.key, i)
316
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "date" ? (s(), p(M, {
317
- key: 4,
318
- "model-value": q(o.key),
319
- label: D(m)(o.labelKey),
320
- "z-index": Z,
321
- disabled: t.disabled,
322
- "onUpdate:modelValue": (i) => Y(o.key, i)
323
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "switch" ? (s(), p(w, {
324
- key: 5,
325
- "model-value": !!t.modelValue[o.key],
326
- value: !0,
327
- label: D(m)(o.labelKey),
328
- disabled: t.disabled,
329
- "onUpdate:modelValue": (i) => r(o.key, i)
330
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "multiselect" ? (s(), p(O, {
331
- key: 6,
332
- "model-value": t.modelValue[o.key] ?? [],
333
- "onUpdate:modelValue": (i) => r(o.key, i)
334
- }, {
335
- default: G(() => [
336
- x("div", he, [
337
- (s(!0), g(U, null, A(T(o), (i) => (s(), p(w, {
338
- key: i.value,
339
- "model-value": t.modelValue[o.key] ?? [],
340
- value: i.value,
341
- label: i.label,
342
- disabled: t.disabled,
343
- "onUpdate:modelValue": (ee) => r(o.key, ee)
344
- }, null, 8, ["model-value", "value", "label", "disabled", "onUpdate:modelValue"]))), 128))
345
- ])
346
- ]),
347
- _: 2
348
- }, 1032, ["model-value", "onUpdate:modelValue"])) : E("", !0)
349
- ], 64))), 128))
350
- ]);
351
- };
352
- }
353
- }), Te = /* @__PURE__ */ B({
354
- __name: "ConditionFormHost",
355
- props: {
356
- builder: {},
357
- modelValue: {},
358
- disable: { type: Boolean, default: !1 },
359
- optionProviders: { default: () => ({}) }
360
- },
361
- emits: ["update:modelValue"],
362
- setup(t, { emit: u }) {
363
- const l = t, c = u, m = I(
364
- () => l.builder.form && j(l.builder.form) ? l.builder.form : void 0
365
- ), f = I(
366
- () => l.builder.form && !j(l.builder.form) ? pe(l.builder.form.component) : void 0
367
- );
368
- return (F, v) => m.value ? (s(), p(Ce, {
369
- key: 0,
370
- config: m.value,
371
- "model-value": t.modelValue ?? m.value.defaults,
372
- disabled: t.disable,
373
- "option-providers": t.optionProviders,
374
- "onUpdate:modelValue": v[0] || (v[0] = (k) => c("update:modelValue", k))
375
- }, null, 8, ["config", "model-value", "disabled", "option-providers"])) : f.value ? (s(), p(ie(f.value), {
376
- key: 1,
377
- "model-value": t.modelValue,
378
- disable: t.disable,
379
- "onUpdate:modelValue": v[1] || (v[1] = (k) => c("update:modelValue", k))
380
- }, null, 8, ["model-value", "disable"])) : E("", !0);
381
- }
382
- });
383
- export {
384
- Ne as _,
385
- Te as a,
386
- Se as u
387
- };