@feedmepos/mf-hrm-portal 2.3.2-dev.17 → 2.3.2-dev.18

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 (108) hide show
  1. package/dist/{ApprovalCodeList-Bo8IbNxV.js → ApprovalCodeList-Cv4-P7fX.js} +14 -15
  2. package/dist/{AuditLogList-C7CjPILA.js → AuditLogList-KH-H5uzM.js} +823 -833
  3. package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BQq5xW8d.js +459 -0
  4. package/dist/EmployeeList-BCjOwL1V.js +896 -0
  5. package/dist/FormSection.vue_vue_type_script_setup_true_lang-D4e5iSQq.js +90 -0
  6. package/dist/{GrantUserList-CXWGr3Wo.js → GrantUserList-CfvdU440.js} +15 -16
  7. package/dist/Main-CVF5eDBd.js +101 -0
  8. package/dist/{Main-bru10M5U.js → Main-DKKGpzdb.js} +2102 -2097
  9. package/dist/{Main-DeuWov9n.js → Main-YrCgPqZU.js} +5 -5
  10. package/dist/MyPosProfile-z84_PtAn.js +360 -0
  11. package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js +126 -0
  12. package/dist/{PermissionSetList--xt0piQz.js → PermissionSetList-9xD_n1VF.js} +136 -137
  13. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-IX3av4mS.js +4212 -0
  14. package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-sPatt5hV.js +1797 -0
  15. package/dist/RoleForm.vue_vue_type_script_setup_true_lang-CSsgsqvl.js +547 -0
  16. package/dist/RoleList-oSqkcGgN.js +274 -0
  17. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Cqo5kHcF.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-qJhZA2DN.js} +1 -1
  18. package/dist/{ScheduleGeneralPage-DxhgBLix.js → ScheduleGeneralPage-BxXDcGD4.js} +2 -2
  19. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-DGPwmNQb.js → ScheduleModal.vue_vue_type_script_setup_true_lang-Dcr2USSq.js} +187 -186
  20. package/dist/{SchedulePage-oBdEvGWN.js → SchedulePage-C_M2ABMR.js} +20 -20
  21. package/dist/{SchedulePositionPage-BZps-kKs.js → SchedulePositionPage-XaIHUH4A.js} +3 -3
  22. package/dist/{SelectFilter-Bs_LCk3L.js → SelectFilter-BzqdpDfg.js} +1 -1
  23. package/dist/TeamMemberList--WEaatay.js +2082 -0
  24. package/dist/{TimesheetList-BW6iCigo.js → TimesheetList-D6FG69-S.js} +9 -9
  25. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-Dv66Af5C.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-GIIAlhti.js} +3 -3
  26. package/dist/{app-B8xnhtVI.js → app-DSUfooPD.js} +7973 -4103
  27. package/dist/app.js +3 -3
  28. package/dist/{approval-code-B0jU1bvk.js → approval-code-BZYlghBT.js} +1 -1
  29. package/dist/{dayjs.min-CdpSCqn1.js → dayjs.min-5UvwoDGv.js} +34 -34
  30. package/dist/{employee-DlFGiUgI.js → employee-CT3TDtIM.js} +48 -47
  31. package/dist/{grant-user-C3C6glCk.js → grant-user-CgvKn27g.js} +1 -1
  32. package/dist/{iteration-BM0iyDBd.js → iteration-BFI7vEBg.js} +1 -1
  33. package/dist/{lodash-KK9U7NAy.js → lodash-DJ0F99PK.js} +1 -1
  34. package/dist/member-grant-BmthjLCk.js +54 -0
  35. package/dist/restaurant-CeR-XM1L.js +49 -0
  36. package/dist/{role-DYCorsOh.js → role-C2QeFrHr.js} +19 -20
  37. package/dist/rule-CYsTf24V.js +839 -0
  38. package/dist/src/api/my-pos-profile/index.d.ts +3 -0
  39. package/dist/src/api/sso-provider/index.d.ts +5 -0
  40. package/dist/src/api/staff-invite/index.d.ts +16 -0
  41. package/dist/src/components/CollapsibleWrapper.vue.d.ts +11 -3
  42. package/dist/src/components/form/SegmentedTabs.vue.d.ts +23 -0
  43. package/dist/src/composables/useMenuAccess.d.ts +56 -0
  44. package/dist/src/composables/useSsoProviders.d.ts +19 -0
  45. package/dist/src/composables/useStaffInviteProviders.d.ts +8 -0
  46. package/dist/src/composables/useTenant.d.ts +11 -0
  47. package/dist/src/helpers/member-grant.d.ts +36 -0
  48. package/dist/src/helpers/my-pos-profile.d.ts +37 -0
  49. package/dist/src/helpers/permission-set.d.ts +1 -102
  50. package/dist/src/helpers/pos-assignment-rows.d.ts +28 -0
  51. package/dist/src/helpers/rule.d.ts +2 -2
  52. package/dist/src/helpers/staff-invite.d.ts +54 -0
  53. package/dist/src/helpers/string.d.ts +10 -1
  54. package/dist/src/router/courtGuard.d.ts +4 -0
  55. package/dist/src/router/menu-access-guard.d.ts +17 -0
  56. package/dist/src/router/shared.d.ts +3 -1
  57. package/dist/src/stores/restaurant.d.ts +7 -7
  58. package/dist/src/stores/team.d.ts +31 -1
  59. package/dist/src/types/my-pos-profile.d.ts +24 -0
  60. package/dist/src/types/sso-provider.d.ts +10 -0
  61. package/dist/src/types/staff-invite.d.ts +100 -0
  62. package/dist/src/types/team.d.ts +17 -1
  63. package/dist/src/views/audit-log/locales/index.d.ts +12 -0
  64. package/dist/src/views/audit-log/useTraceIdDeepLink.d.ts +1 -1
  65. package/dist/src/views/hr/locales/index.d.ts +20 -0
  66. package/dist/src/views/hr/role/RoleForm.vue.d.ts +29 -2
  67. package/dist/src/views/my-pos-profile/MyPosProfile.vue.d.ts +2 -0
  68. package/dist/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +4 -0
  69. package/dist/src/views/my-pos-profile/locales/index.d.ts +236 -0
  70. package/dist/src/views/scheduling/composables/useScheduleOnboardingAvailability.d.ts +1 -1
  71. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1 -1
  72. package/dist/src/views/scheduling/composables/useScheduleShiftDraft.d.ts +1 -1
  73. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +1 -1
  74. package/dist/src/views/team/components/BasePermission.vue.d.ts +11 -0
  75. package/dist/src/views/team/components/ConditionPermission.vue.d.ts +11 -0
  76. package/dist/src/views/team/components/MemberGrantFields.vue.d.ts +51 -0
  77. package/dist/src/views/team/{member/MemberInfo.vue.d.ts → components/MemberStatusBadge.vue.d.ts} +2 -2
  78. package/dist/src/views/team/components/PortalPermissionEditor.vue.d.ts +21 -0
  79. package/dist/src/views/team/components/PosAssignmentRows.vue.d.ts +44 -0
  80. package/dist/src/views/team/components/PosRolePermission.vue.d.ts +11 -0
  81. package/dist/src/views/team/locales/index.d.ts +716 -0
  82. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +48 -3
  83. package/dist/src/views/team/member/ExistingMemberNotice.vue.d.ts +11 -0
  84. package/dist/src/views/team/member/MemberDetailsCard.vue.d.ts +35 -0
  85. package/dist/src/views/team/member/MemberHeaderCard.vue.d.ts +19 -0
  86. package/dist/src/views/team/member/TeamMemberList.vue.d.ts +1 -0
  87. package/dist/string-DZQ1uNjn.js +22 -0
  88. package/dist/style.css +1 -1
  89. package/dist/tsconfig.app.tsbuildinfo +1 -1
  90. package/dist/{useAppStore-C1lk2Q2j.js → useAppStore-KvMQH09O.js} +1 -1
  91. package/dist/{useLoading-CXdGsnHm.js → useLoading-4s1zzjal.js} +1 -1
  92. package/dist/useReportPermissions-BVxVU0SS.js +80 -0
  93. package/dist/useSsoProviders-CKRDQYcP.js +41 -0
  94. package/package.json +2 -2
  95. package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C-4BaMN-.js +0 -438
  96. package/dist/EmployeeList-BOP-gaTp.js +0 -776
  97. package/dist/FormItem.vue_vue_type_script_setup_true_lang-BEOR-8QD.js +0 -45
  98. package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +0 -49
  99. package/dist/Main-BrP1frfO.js +0 -96
  100. package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-CqG0v0Sz.js +0 -243
  101. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-D5nvRsW3.js +0 -4167
  102. package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DiNDrCy0.js +0 -35
  103. package/dist/RoleList-BEE-8EQK.js +0 -740
  104. package/dist/TeamMemberList-DCgNcs4P.js +0 -1154
  105. package/dist/restaurant-C7o2Yk6j.js +0 -2688
  106. package/dist/rule-BhGHZqKO.js +0 -783
  107. package/dist/string-VNuQNweN.js +0 -15
  108. package/dist/useReportPermissions-D_I4rFVo.js +0 -82
@@ -1,5 +1,5 @@
1
1
  import { defineStore as p } from "pinia";
2
- import { g as s } from "./restaurant-C7o2Yk6j.js";
2
+ import { g as s } from "./app-DSUfooPD.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-C1lk2Q2j.js";
3
+ import { u as w, v } from "./useAppStore-KvMQH09O.js";
4
4
  const E = (r) => {
5
5
  async function d(u, e) {
6
6
  var l, a;
@@ -0,0 +1,80 @@
1
+ import { computed as a, ref as o } from "vue";
2
+ import { e as d } from "./iteration-BFI7vEBg.js";
3
+ import { u as K, n as S } from "./app-DSUfooPD.js";
4
+ import { i as g } from "./rule-CYsTf24V.js";
5
+ const i = o([]), r = o(!1), l = o(!1), f = o(null), p = o(null), u = o(!1);
6
+ function J() {
7
+ const v = K();
8
+ async function m() {
9
+ const s = v.id.value;
10
+ if (!s) return;
11
+ f.value !== s && (i.value = [], r.value = !1, l.value = !1, f.value = s, u.value = !1);
12
+ const n = localStorage.getItem("locale");
13
+ if (!(r.value && p.value === n)) {
14
+ if (l.value) {
15
+ u.value = !0;
16
+ return;
17
+ }
18
+ l.value = !0;
19
+ try {
20
+ i.value = await g.fetchReportPermissions(
21
+ s,
22
+ n
23
+ ), r.value = !0, p.value = n;
24
+ } catch (e) {
25
+ console.warn("Failed to fetch dynamic report permissions, keeping last known list:", e), r.value = !1;
26
+ } finally {
27
+ l.value = !1, u.value && (u.value = !1, await m());
28
+ }
29
+ }
30
+ }
31
+ const c = S.filter(
32
+ (s) => s.subject === d.F_RULE_SUBJECT.enum.report && s.conditions
33
+ ), y = a(() => {
34
+ const s = new Set(
35
+ c.map((e) => {
36
+ const t = typeof e.conditions == "string" ? JSON.parse(e.conditions) : e.conditions;
37
+ return t == null ? void 0 : t.name;
38
+ })
39
+ ), n = i.value.filter((e) => !s.has(e.permissionKey)).map((e) => ({
40
+ label: e.name,
41
+ subject: d.F_RULE_SUBJECT.enum.report,
42
+ actions: ["read"],
43
+ conditions: { name: e.permissionKey },
44
+ inverted: !1,
45
+ reason: ""
46
+ }));
47
+ return [...c, ...n];
48
+ }), R = a(() => {
49
+ const s = new Set(
50
+ c.map((n) => {
51
+ const e = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
52
+ return e == null ? void 0 : e.name;
53
+ })
54
+ );
55
+ for (const n of i.value)
56
+ s.add(n.permissionKey);
57
+ return s;
58
+ }), h = a(() => {
59
+ const s = new Set(
60
+ c.map((e) => {
61
+ const t = typeof e.conditions == "string" ? JSON.parse(e.conditions) : e.conditions;
62
+ return t == null ? void 0 : t.name;
63
+ })
64
+ ), n = /* @__PURE__ */ new Set();
65
+ for (const e of i.value)
66
+ s.has(e.permissionKey) || n.add(e.permissionKey);
67
+ return n;
68
+ });
69
+ return {
70
+ fetchReportPermissions: m,
71
+ allReportPermissions: y,
72
+ availableReportKeys: R,
73
+ customReportKeys: h,
74
+ isLoading: a(() => l.value),
75
+ isLoaded: a(() => r.value)
76
+ };
77
+ }
78
+ export {
79
+ J as u
80
+ };
@@ -0,0 +1,41 @@
1
+ import { computed as v, ref as u } from "vue";
2
+ import { useCoreStore as f } from "@feedmepos/mf-common";
3
+ import { g as p, b as m } from "./app-DSUfooPD.js";
4
+ const P = {
5
+ async readProviders() {
6
+ return p(await m("sso-providers").get(""));
7
+ }
8
+ }, n = u([]), t = u(null);
9
+ let s = null;
10
+ function g() {
11
+ const i = f();
12
+ async function a() {
13
+ var r, o;
14
+ const e = (r = i.currentBusiness.value) == null ? void 0 : r.id;
15
+ if (!(!e || s === e)) {
16
+ s = e, n.value = [], t.value = null;
17
+ try {
18
+ const c = await P.readProviders();
19
+ s === e && (n.value = c);
20
+ } catch {
21
+ s === e && (s = null);
22
+ } finally {
23
+ ((o = i.currentBusiness.value) == null ? void 0 : o.id) === e && (t.value = e);
24
+ }
25
+ }
26
+ }
27
+ const l = v(
28
+ () => {
29
+ var e;
30
+ return !!t.value && t.value === ((e = i.currentBusiness.value) == null ? void 0 : e.id);
31
+ }
32
+ );
33
+ function d(e) {
34
+ var r;
35
+ return ((r = n.value.find((o) => o.slug === e)) == null ? void 0 : r.label) ?? e;
36
+ }
37
+ return { providers: n, isLoaded: l, loadProviders: a, providerLabel: d };
38
+ }
39
+ export {
40
+ g as u
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-hrm-portal",
3
- "version": "2.3.2-dev.17",
3
+ "version": "2.3.2-dev.18",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@feedmepos/auth": "^1.6.4",
18
18
  "@feedmepos/core": "^2.14.36",
19
- "@feedmepos/mf-common": "^1.29.10",
19
+ "@feedmepos/mf-common": "1.29.36",
20
20
  "@feedmepos/mf-remy-panel": "0.15.0",
21
21
  "@feedmepos/ui-library": "^1.10.13",
22
22
  "@feedmepos/feature-flag": "^0.0.15",
@@ -1,438 +0,0 @@
1
- import { defineComponent as M, ref as S, onMounted as ae, nextTick as le, onUnmounted as ue, resolveComponent as F, createElementBlock as p, openBlock as s, Fragment as C, createElementVNode as U, renderSlot as _, createCommentVNode as w, toDisplayString as J, createVNode as E, normalizeStyle as re, watch as X, defineAsyncComponent as se, computed as z, renderList as T, createBlock as h, withCtx as H, unref as x, resolveDynamicComponent as ie, normalizeClass as de } from "vue";
2
- import { useI18n as q, useCoreStore as me } from "@feedmepos/mf-common";
3
- import { f as j, G as ce, U as L } from "./app-B8xnhtVI.js";
4
- import { l as fe } from "./lodash-KK9U7NAy.js";
5
- const ye = { class: "flex items-center" }, be = {
6
- key: 0,
7
- class: "ml-8 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
8
- }, ve = { class: "ml-auto" }, Be = /* @__PURE__ */ M({
9
- __name: "CollapsibleWrapper",
10
- props: {
11
- title: { default: "" },
12
- subtitle: { default: "" },
13
- initiallyCollapsed: { type: Boolean, default: !1 }
14
- },
15
- setup(t) {
16
- const a = S(t.initiallyCollapsed), c = S(), f = S(0);
17
- let m;
18
- function g() {
19
- a.value = !a.value;
20
- }
21
- function d() {
22
- c.value && (f.value = c.value.scrollHeight);
23
- }
24
- return ae(async () => {
25
- await le(), c.value && (m = new ResizeObserver(() => {
26
- d();
27
- }), m.observe(c.value));
28
- }), ue(() => {
29
- m == null || m.disconnect();
30
- }), (b, r) => {
31
- const y = F("FmButton");
32
- return s(), p(C, null, [
33
- U("div", { onClick: g }, [
34
- U("div", ye, [
35
- _(b.$slots, "title"),
36
- a.value && t.subtitle ? (s(), p("span", be, J(t.subtitle), 1)) : w("", !0),
37
- U("div", ve, [
38
- E(y, {
39
- icon: a.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
- U("div", {
48
- ref_key: "contentRef",
49
- ref: c,
50
- class: "transition-all duration-300 ease-in-out overflow-hidden",
51
- style: re({ maxHeight: a.value ? "0" : f.value + "px" })
52
- }, [
53
- _(b.$slots, "default")
54
- ], 4)
55
- ], 64);
56
- };
57
- }
58
- });
59
- function I(t) {
60
- return `${t.subject}::${t.builderKey}`;
61
- }
62
- function Oe(t) {
63
- const u = S(/* @__PURE__ */ new Map());
64
- function a(r, y) {
65
- const k = new Map(u.value);
66
- k.set(I(r), y), u.value = k;
67
- }
68
- function c(r) {
69
- return u.value.get(I(r));
70
- }
71
- function f(r) {
72
- for (const y of u.value.keys())
73
- if (y.startsWith(`${r}::`)) return !0;
74
- return !1;
75
- }
76
- function m(r) {
77
- const y = /* @__PURE__ */ new Map();
78
- for (const [k, A] of u.value.entries())
79
- k.startsWith(`${r}::`) && y.set(k, A);
80
- return y;
81
- }
82
- function g(r) {
83
- const y = new Map(u.value);
84
- for (const k of Array.from(y.keys()))
85
- k.startsWith(`${r}::`) && y.delete(k);
86
- u.value = y;
87
- }
88
- function d() {
89
- u.value = /* @__PURE__ */ new Map();
90
- }
91
- function b(r) {
92
- const y = new Map(u.value);
93
- y.delete(I(r)), u.value = y;
94
- }
95
- return t && X(
96
- t,
97
- () => {
98
- d();
99
- },
100
- { deep: !0 }
101
- ), {
102
- drafts: u,
103
- setDraft: a,
104
- getDraft: c,
105
- hasDraftsForSubject: f,
106
- getDraftsForSubject: m,
107
- clearDraftsForSubject: g,
108
- clearAllDrafts: d,
109
- clearDraft: b
110
- };
111
- }
112
- const pe = {}, W = /* @__PURE__ */ new Map();
113
- function ke(t) {
114
- const u = W.get(t);
115
- if (u) return u;
116
- const a = pe[t];
117
- if (!a) return;
118
- const c = se(a);
119
- return W.set(t, c), c;
120
- }
121
- function he(t, u) {
122
- return !fe.isEqual(t, u);
123
- }
124
- const Ve = { class: "flex flex-col gap-8" }, Fe = { class: "flex flex-col gap-4" }, ge = "condition-form-select-menu", Z = 120, Ce = 220, De = /* @__PURE__ */ M({
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 a = t, c = u, { t: f } = q(), m = me(), g = z(() => j(a.config, a.modelValue));
135
- let d = a.modelValue;
136
- X(
137
- () => a.modelValue,
138
- (e) => {
139
- d = e;
140
- }
141
- );
142
- function b(e) {
143
- return "static" in e ? e.static.map((n) => ({ value: n.value, label: f(n.labelKey) })) : a.optionProviders[e.provider] ?? [];
144
- }
145
- function r(e, n) {
146
- const l = y(
147
- ce(a.config, { ...a.modelValue, [e]: n })
148
- );
149
- he(l, d) && (d = l, c("update:modelValue", l));
150
- }
151
- function y(e) {
152
- const n = { ...e };
153
- for (const l of j(a.config, n))
154
- l.kind === "date" && !n[l.key] && (n[l.key] = P(Y()));
155
- return n;
156
- }
157
- function k() {
158
- const e = m.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) ?? (m.currentCountry.value instanceof Object ? m.currentCountry.value.code : m.currentCountry.value);
162
- return A(n);
163
- }
164
- function A(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 K(e, n) {
197
- const l = 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), v = Object.fromEntries(
207
- l.filter((V) => V.type !== "literal").map((V) => [V.type, V.value])
208
- );
209
- return {
210
- year: Number(v.year),
211
- month: Number(v.month),
212
- day: Number(v.day),
213
- hour: Number(v.hour),
214
- minute: Number(v.minute),
215
- second: Number(v.second)
216
- };
217
- }
218
- function R(e, n) {
219
- try {
220
- const l = K(n, e);
221
- return (Date.UTC(
222
- l.year,
223
- l.month - 1,
224
- l.day,
225
- l.hour,
226
- l.minute,
227
- l.second
228
- ) - n.getTime()) / 6e4;
229
- } catch {
230
- return 0;
231
- }
232
- }
233
- function P(e) {
234
- const [n, l, v] = e.split("-").map(Number);
235
- if (!n || !l || !v) return "";
236
- const V = k(), D = new Date(Date.UTC(n, l - 1, v, 0, 0, 0, 0)), O = R(V, D), N = new Date(D.getTime() - O * 6e4), $ = R(V, N);
237
- return new Date(D.getTime() - $ * 6e4).toISOString();
238
- }
239
- function G(e) {
240
- const n = new Date(e);
241
- if (Number.isNaN(n.getTime())) return "";
242
- try {
243
- const l = K(n, k());
244
- return `${String(l.year).padStart(4, "0")}-${String(l.month).padStart(2, "0")}-${String(l.day).padStart(2, "0")}`;
245
- } catch {
246
- return e.slice(0, 10);
247
- }
248
- }
249
- function Y() {
250
- return G((/* @__PURE__ */ new Date()).toISOString());
251
- }
252
- function B(e) {
253
- return "options" in e ? b(e.options) : [];
254
- }
255
- function Q(e) {
256
- const n = a.modelValue[e];
257
- return n == null ? "" : String(n);
258
- }
259
- function ee(e) {
260
- const n = a.modelValue[e];
261
- return typeof n != "string" || !n ? "" : G(n);
262
- }
263
- function te(e, n) {
264
- r(e, n ? P(n) : "");
265
- }
266
- function ne(e, n) {
267
- let l = Math.floor(Number(n) || (e.min ?? 0));
268
- e.min !== void 0 && (l = Math.max(e.min, l)), e.max !== void 0 && (l = Math.min(e.max, l)), r(e.key, l);
269
- }
270
- return (e, n) => {
271
- const l = F("FmRadio"), v = F("FmRadioGroup"), V = F("FmSelect"), D = F("FmTextField"), O = F("FmDatePicker"), N = F("FmCheckbox"), $ = F("FmFormGroup");
272
- return s(), p("div", Ve, [
273
- (s(!0), p(C, null, T(g.value, (o) => (s(), p(C, {
274
- key: o.key
275
- }, [
276
- o.kind === "radio" ? (s(), h(v, {
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: H(() => [
283
- (s(!0), p(C, null, T(B(o), (i) => (s(), h(l, {
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(), h(V, {
291
- key: 1,
292
- "model-value": t.modelValue[o.key],
293
- label: x(f)(o.labelKey),
294
- items: B(o),
295
- "menu-id": ge,
296
- "menu-z-index": Z,
297
- "max-height": Ce,
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(), h(D, {
303
- key: 2,
304
- "model-value": Q(o.key),
305
- type: "number",
306
- class: "!w-[120px] ml-32",
307
- label: x(f)(o.labelKey),
308
- disabled: t.disabled,
309
- "onUpdate:modelValue": (i) => ne(o, i)
310
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "text" ? (s(), h(D, {
311
- key: 3,
312
- "model-value": t.modelValue[o.key] ?? "",
313
- label: x(f)(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(), h(O, {
317
- key: 4,
318
- "model-value": ee(o.key),
319
- label: x(f)(o.labelKey),
320
- "z-index": Z,
321
- disabled: t.disabled,
322
- "onUpdate:modelValue": (i) => te(o.key, i)
323
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : o.kind === "switch" ? (s(), h(N, {
324
- key: 5,
325
- "model-value": !!t.modelValue[o.key],
326
- value: !0,
327
- label: x(f)(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(), h($, {
331
- key: 6,
332
- "model-value": t.modelValue[o.key] ?? [],
333
- "onUpdate:modelValue": (i) => r(o.key, i)
334
- }, {
335
- default: H(() => [
336
- U("div", Fe, [
337
- (s(!0), p(C, null, T(B(o), (i) => (s(), h(N, {
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": (oe) => r(o.key, oe)
344
- }, null, 8, ["model-value", "value", "label", "disabled", "onUpdate:modelValue"]))), 128))
345
- ])
346
- ]),
347
- _: 2
348
- }, 1032, ["model-value", "onUpdate:modelValue"])) : w("", !0)
349
- ], 64))), 128))
350
- ]);
351
- };
352
- }
353
- }), xe = /* @__PURE__ */ M({
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 a = t, c = u, f = z(
364
- () => a.builder.form && L(a.builder.form) ? a.builder.form : void 0
365
- ), m = z(
366
- () => a.builder.form && !L(a.builder.form) ? ke(a.builder.form.component) : void 0
367
- );
368
- return (g, d) => f.value ? (s(), h(De, {
369
- key: 0,
370
- config: f.value,
371
- "model-value": t.modelValue ?? f.value.defaults,
372
- disabled: t.disable,
373
- "option-providers": t.optionProviders,
374
- "onUpdate:modelValue": d[0] || (d[0] = (b) => c("update:modelValue", b))
375
- }, null, 8, ["config", "model-value", "disabled", "option-providers"])) : m.value ? (s(), h(ie(m.value), {
376
- key: 1,
377
- "model-value": t.modelValue,
378
- disable: t.disable,
379
- "onUpdate:modelValue": d[1] || (d[1] = (b) => c("update:modelValue", b))
380
- }, null, 8, ["model-value", "disable"])) : w("", !0);
381
- }
382
- }), Ue = {
383
- key: 0,
384
- class: "fm-typo-en-title-sm-600"
385
- }, we = {
386
- key: 0,
387
- class: "h-px w-full bg-fm-color-neutral-gray-200"
388
- }, Ne = { class: "flex justify-end pt-8" }, $e = /* @__PURE__ */ M({
389
- __name: "ConditionBuilderForm",
390
- props: {
391
- builders: {},
392
- formValueFor: {},
393
- hasChanges: { type: Boolean },
394
- title: { default: "" },
395
- disable: { type: Boolean, default: !1 },
396
- fullWidth: { type: Boolean, default: !1 }
397
- },
398
- emits: ["update-form", "apply"],
399
- setup(t, { emit: u }) {
400
- const a = u, { t: c } = q();
401
- return (f, m) => {
402
- const g = F("FmButton");
403
- return s(), p("div", {
404
- class: de(["flex flex-col gap-12 p-16", t.fullWidth ? "w-full" : "w-[320px]"])
405
- }, [
406
- t.title ? (s(), p("p", Ue, J(t.title), 1)) : w("", !0),
407
- (s(!0), p(C, null, T(t.builders, (d, b) => (s(), p(C, {
408
- key: d.builderKey
409
- }, [
410
- b > 0 ? (s(), p("div", we)) : w("", !0),
411
- _(f.$slots, "section", { builder: d }, () => [
412
- E(xe, {
413
- builder: d,
414
- "model-value": t.formValueFor(d),
415
- disable: t.disable,
416
- "onUpdate:modelValue": (r) => a("update-form", { builder: d, form: r })
417
- }, null, 8, ["builder", "model-value", "disable", "onUpdate:modelValue"])
418
- ])
419
- ], 64))), 128)),
420
- U("div", Ne, [
421
- E(g, {
422
- label: x(c)("team.memberForm.permissions.conditionApply"),
423
- size: "md",
424
- variant: "primary",
425
- disabled: t.disable || !t.hasChanges,
426
- onClick: m[0] || (m[0] = (d) => a("apply"))
427
- }, null, 8, ["label", "disabled"])
428
- ])
429
- ], 2);
430
- };
431
- }
432
- });
433
- export {
434
- Be as _,
435
- $e as a,
436
- xe as b,
437
- Oe as u
438
- };