@feedmepos/mf-hrm-portal 2.3.0-dev → 2.3.0-dev.2

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 (134) hide show
  1. package/dist/{ApprovalCodeList-cG0zmQVJ.js → ApprovalCodeList-CJaNPHZC.js} +2 -2
  2. package/dist/{AuditLogList-BTifJhO1.js → AuditLogList-CHA98ZqW.js} +3 -3
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-qr5TwLTK.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C7rvthEI.js} +2 -2
  4. package/dist/{EmployeeList-DzcMtxJ3.js → EmployeeList-CVmMKt71.js} +4 -4
  5. package/dist/{GrantUserList-D5b7tJ8Y.js → GrantUserList-MYjgt5-F.js} +3 -3
  6. package/dist/{Main-DkLBemi7.js → Main-BgB9lD4K.js} +9 -9
  7. package/dist/{Main-DFwdAWqn.js → Main-C0cnqQ3B.js} +5 -5
  8. package/dist/{Main-B2r59IOW.js → Main-hlcHtrsc.js} +2 -2
  9. package/dist/{PermissionSetList-B80hrfMW.js → PermissionSetList-5f1WIaVa.js} +5 -5
  10. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DjNcJQM9.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CFoTAGIX.js} +823 -823
  11. package/dist/{RoleList-DHO4JRKF.js → RoleList-DNR4miXr.js} +7 -7
  12. package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-B4VUyKW3.js +470 -0
  13. package/dist/{ScheduleGeneralPage-WlBM8bxV.js → ScheduleGeneralPage-Cd5AlY4z.js} +273 -236
  14. package/dist/ScheduleModal.vue_vue_type_script_setup_true_lang-Cf0l2MRg.js +2188 -0
  15. package/dist/SchedulePage-C8m0-m3l.js +18257 -0
  16. package/dist/{SchedulePositionPage-C0hrO11d.js → SchedulePositionPage-DyRckyUx.js} +67 -66
  17. package/dist/{TeamMemberList-CgFWLRBM.js → TeamMemberList-mw5OveZG.js} +6 -6
  18. package/dist/{TimesheetList-Dp40G-0I.js → TimesheetList-BzXarZbM.js} +5 -5
  19. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BFjrMhUG.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-Dq5i4poN.js} +2 -2
  20. package/dist/{app-CmBSTvaI.js → app-DSsdRLHg.js} +657 -577
  21. package/dist/app.js +1 -1
  22. package/dist/{dayjs.min-CfL2DQ3d.js → dayjs.min-B6xBXQtU.js} +1 -1
  23. package/dist/{employee-DQcHjoij.js → employee-hMhzuqk1.js} +28 -27
  24. package/dist/{iteration-BlavheWG.js → iteration-B34AvpNC.js} +1 -1
  25. package/dist/{lodash-QerqayrJ.js → lodash-1Vyuy7Mu.js} +1 -1
  26. package/dist/{role-RM2YLO7n.js → role-DKOrgO6f.js} +1 -1
  27. package/dist/{rule-DjlvYIuP.js → rule-CBzQ3GeV.js} +2 -2
  28. package/dist/src/api/schedule/index.d.ts +5 -1
  29. package/dist/src/components/layout/withScheduleShell.d.ts +10 -0
  30. package/dist/src/types/employee.d.ts +1 -0
  31. package/dist/src/types/schedule.d.ts +1 -1
  32. package/dist/src/views/scheduling/components/ScheduleBoardAreaRows.vue.d.ts +28 -0
  33. package/dist/src/views/scheduling/components/ScheduleBoardEditOverlays.vue.d.ts +19 -0
  34. package/dist/src/views/scheduling/components/ScheduleBoardEmployeeRows.vue.d.ts +38 -0
  35. package/dist/src/views/scheduling/components/ScheduleBoardGridHeader.vue.d.ts +24 -0
  36. package/dist/src/views/scheduling/components/ScheduleBoardInteractionOverlays.vue.d.ts +38 -0
  37. package/dist/src/views/scheduling/components/ScheduleBoardOnboardingOverlays.vue.d.ts +25 -0
  38. package/dist/src/views/scheduling/components/ScheduleBoardRails.vue.d.ts +17 -0
  39. package/dist/src/views/scheduling/components/ScheduleBoardToolbar.vue.d.ts +39 -0
  40. package/dist/src/views/scheduling/components/ScheduleBoardUtilityOverlays.vue.d.ts +22 -0
  41. package/dist/src/views/scheduling/components/{ScheduleOnboardingComplete.vue.d.ts → ScheduleCompletionDialog.vue.d.ts} +8 -3
  42. package/dist/src/views/scheduling/components/{ScheduleOpenShiftCardMenu.vue.d.ts → ScheduleContextMenu.vue.d.ts} +10 -3
  43. package/dist/src/views/scheduling/components/{SchedulePdfPreview.vue.d.ts → ScheduleExportPreview.vue.d.ts} +1 -0
  44. package/dist/src/views/scheduling/components/ScheduleLoadState.vue.d.ts +10 -0
  45. package/dist/src/views/scheduling/components/ScheduleModal.vue.d.ts +26 -0
  46. package/dist/src/views/scheduling/components/{ScheduleTourAllSet.vue.d.ts → ScheduleOnboardingClosedDayConfirm.vue.d.ts} +2 -2
  47. package/dist/src/views/scheduling/components/{ScheduleEmployeeMenu.vue.d.ts → ScheduleOnboardingDemandDays.vue.d.ts} +2 -2
  48. package/dist/src/views/scheduling/components/{ScheduleExportDoneDialog.vue.d.ts → ScheduleOnboardingDemandFooter.vue.d.ts} +2 -2
  49. package/dist/src/views/scheduling/components/ScheduleOnboardingDemandHeader.vue.d.ts +6 -0
  50. package/dist/src/views/scheduling/components/ScheduleOnboardingHoursProfileNotice.vue.d.ts +10 -0
  51. package/dist/src/views/scheduling/components/ScheduleOnboardingPositions.vue.d.ts +6 -0
  52. package/dist/src/views/scheduling/components/ScheduleOnboardingReview.vue.d.ts +6 -0
  53. package/dist/src/views/scheduling/components/ScheduleOnboardingWizardFooter.vue.d.ts +6 -0
  54. package/dist/src/views/scheduling/components/ScheduleOnboardingWizardHeader.vue.d.ts +11 -0
  55. package/dist/src/views/scheduling/components/ScheduleSelect.vue.d.ts +7 -1
  56. package/dist/src/views/scheduling/components/ScheduleSetupBanner.vue.d.ts +12 -0
  57. package/dist/src/views/scheduling/components/ScheduleShiftPopover.vue.d.ts +2 -2
  58. package/dist/src/views/scheduling/components/ScheduleStaffRail.vue.d.ts +4 -4
  59. package/dist/src/views/scheduling/components/ScheduleStaffRows.vue.d.ts +2 -2
  60. package/dist/src/views/scheduling/components/ScheduleTopbar.vue.d.ts +3 -3
  61. package/dist/src/views/scheduling/composables/onboarding-types.d.ts +1 -1
  62. package/dist/src/views/scheduling/composables/remyPrompt.d.ts +13 -0
  63. package/dist/src/views/scheduling/composables/schedule-board-helpers.d.ts +1 -1
  64. package/dist/src/views/scheduling/composables/schedule-breaks.d.ts +7 -1
  65. package/dist/src/views/scheduling/composables/schedule-calendar.d.ts +7 -0
  66. package/dist/src/views/scheduling/composables/schedule-cost.d.ts +19 -0
  67. package/dist/src/views/scheduling/composables/schedule-demand-domain.d.ts +11 -0
  68. package/dist/src/views/scheduling/composables/schedule-export-matrix.d.ts +14 -0
  69. package/dist/src/views/scheduling/composables/schedule-time.d.ts +8 -0
  70. package/dist/src/views/scheduling/composables/schedule-week-cache.d.ts +1 -4
  71. package/dist/src/views/scheduling/composables/useRemyAppStore.d.ts +10 -0
  72. package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +14 -13
  73. package/dist/src/views/scheduling/composables/useScheduleAssign.d.ts +3 -1
  74. package/dist/src/views/scheduling/composables/useScheduleAssignmentMutations.d.ts +13 -0
  75. package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +18 -2
  76. package/dist/src/views/scheduling/composables/useScheduleCloneOutletModal.d.ts +3 -1
  77. package/dist/src/views/scheduling/composables/useScheduleCostRail.d.ts +6 -1
  78. package/dist/src/views/scheduling/composables/useScheduleDayNote.d.ts +1 -1
  79. package/dist/src/views/scheduling/composables/useScheduleDemand.d.ts +4 -19
  80. package/dist/src/views/scheduling/composables/useScheduleDemandSheet.d.ts +13 -2
  81. package/dist/src/views/scheduling/composables/useScheduleEmployeeAccess.d.ts +11 -0
  82. package/dist/src/views/scheduling/composables/useScheduleEmployeeAvailability.d.ts +13 -0
  83. package/dist/src/views/scheduling/composables/useScheduleEmployeeCandidates.d.ts +26 -0
  84. package/dist/src/views/scheduling/composables/useScheduleEmployeeCompensation.d.ts +7 -0
  85. package/dist/src/views/scheduling/composables/useScheduleEmployeeForm.d.ts +22 -0
  86. package/dist/src/views/scheduling/composables/useScheduleEmployeeIdentity.d.ts +9 -0
  87. package/dist/src/views/scheduling/composables/useScheduleEmployeeMenu.d.ts +6 -3
  88. package/dist/src/views/scheduling/composables/useScheduleEmployeePersistence.d.ts +25 -0
  89. package/dist/src/views/scheduling/composables/useScheduleEmployeeValidation.d.ts +18 -0
  90. package/dist/src/views/scheduling/composables/useScheduleExport.d.ts +19 -11
  91. package/dist/src/views/scheduling/composables/useScheduleGapPopover.d.ts +3 -6
  92. package/dist/src/views/scheduling/composables/useScheduleOnboardingAvailability.d.ts +58 -0
  93. package/dist/src/views/scheduling/composables/useScheduleOnboardingDemand.d.ts +45 -0
  94. package/dist/src/views/scheduling/composables/useScheduleOnboardingEmployees.d.ts +187 -0
  95. package/dist/src/views/scheduling/composables/useScheduleOnboardingHours.d.ts +15 -0
  96. package/dist/src/views/scheduling/composables/useScheduleOnboardingNavigation.d.ts +11 -0
  97. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +64 -487
  98. package/dist/src/views/scheduling/composables/useSchedulePageActions.d.ts +18 -0
  99. package/dist/src/views/scheduling/composables/useSchedulePageCellActions.d.ts +21 -0
  100. package/dist/src/views/scheduling/composables/useSchedulePageCellDrop.d.ts +18 -0
  101. package/dist/src/views/scheduling/composables/useSchedulePageEmployeeActions.d.ts +22 -0
  102. package/dist/src/views/scheduling/composables/useSchedulePageOverlays.d.ts +10 -3
  103. package/dist/src/views/scheduling/composables/useSchedulePdfExport.d.ts +19 -0
  104. package/dist/src/views/scheduling/composables/useSchedulePositionModal.d.ts +3 -1
  105. package/dist/src/views/scheduling/composables/useSchedulePositions.d.ts +3 -1
  106. package/dist/src/views/scheduling/composables/useSchedulePublish.d.ts +7 -1
  107. package/dist/src/views/scheduling/composables/useSchedulePublishPersistence.d.ts +11 -0
  108. package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +6 -0
  109. package/dist/src/views/scheduling/composables/useScheduleSettings.d.ts +2 -24
  110. package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +6 -1
  111. package/dist/src/views/scheduling/composables/useScheduleShiftDraft.d.ts +62 -0
  112. package/dist/src/views/scheduling/composables/useScheduleShiftPersistence.d.ts +17 -0
  113. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +10 -5
  114. package/dist/src/views/scheduling/composables/useScheduleStatsRow.d.ts +4 -1
  115. package/dist/src/views/scheduling/composables/useScheduleTour.d.ts +6 -4
  116. package/dist/src/views/scheduling/country-rules/index.d.ts +24 -0
  117. package/dist/src/views/scheduling/data.d.ts +11 -6
  118. package/dist/src/views/scheduling/locales/index.d.ts +80 -0
  119. package/dist/src/views/scheduling/schedule-constants.d.ts +7 -0
  120. package/dist/src/views/scheduling/schedule-state.d.ts +32 -8
  121. package/dist/src/views/scheduling/schedule-store.d.ts +4 -1
  122. package/dist/src/views/scheduling/types.d.ts +5 -0
  123. package/dist/style.css +1 -1
  124. package/dist/tsconfig.app.tsbuildinfo +1 -1
  125. package/dist/{useReportPermissions-Bl6Br79r.js → useReportPermissions-B2ev0j4w.js} +3 -3
  126. package/package.json +2 -1
  127. package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-B-XtB64L.js +0 -452
  128. package/dist/SchedulePage-Nm0krGVU.js +0 -17056
  129. package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-DTDXir_7.js +0 -1150
  130. package/dist/src/components/layout/AppSidebar.vue.d.ts +0 -2
  131. package/dist/src/components/layout/withShell.d.ts +0 -14
  132. package/dist/src/views/scheduling/components/ScheduleShiftCardMenu.vue.d.ts +0 -12
  133. package/dist/src/views/scheduling/composables/useScheduleStaffRail.d.ts +0 -17
  134. package/dist/src/views/scheduling/composables/useScheduleTopbar.d.ts +0 -10
@@ -1,16 +1,16 @@
1
1
  import { computed as y, defineComponent as Pe, ref as V, watch as le, onMounted as Me, resolveComponent as F, createBlock as M, openBlock as v, unref as o, withCtx as g, createElementVNode as u, createVNode as c, createElementBlock as R, Fragment as P, createCommentVNode as _e, renderList as ne, normalizeClass as Ue, toDisplayString as $, h as A, createTextVNode as ge, resolveDynamicComponent as Ee, withModifiers as Ze, nextTick as De } from "vue";
2
- import { e as D } from "./iteration-BlavheWG.js";
2
+ import { e as D } from "./iteration-B34AvpNC.js";
3
3
  import { useI18n as Te } from "@feedmepos/mf-common";
4
4
  import { useBreakpoints as Be, useSnackbar as je, components as ye, useDialog as es, FmButtonColorThemeVariant as ss } from "@feedmepos/ui-library";
5
- import { D as ts, k as as, A as ls, S as os, _ as rs } from "./app-CmBSTvaI.js";
5
+ import { D as ts, k as as, A as ls, S as os, _ as rs } from "./app-DSsdRLHg.js";
6
6
  import { u as ns, _ as $e } from "./useDiscardConfirm-DPhEV6v0.js";
7
7
  import { _ as is } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
- import { r as ie, h as Ae, f as us, s as cs, g as Ie, e as ms, a as oe } from "./rule-DjlvYIuP.js";
8
+ import { r as ie, h as Ae, f as us, s as cs, g as Ie, e as ms, a as oe } from "./rule-CBzQ3GeV.js";
9
9
  import { u as xe } from "./restaurant-D7PEQjPY.js";
10
- import { u as Oe } from "./role-RM2YLO7n.js";
11
- import { u as Ne } from "./useReportPermissions-Bl6Br79r.js";
12
- import { l as re } from "./lodash-QerqayrJ.js";
13
- import { u as ds, _ as ps, a as Le } from "./ConditionBuilderForm.vue_vue_type_script_setup_true_lang-qr5TwLTK.js";
10
+ import { u as Oe } from "./role-DKOrgO6f.js";
11
+ import { u as Ne } from "./useReportPermissions-B2ev0j4w.js";
12
+ import { l as re } from "./lodash-1Vyuy7Mu.js";
13
+ import { u as ds, _ as ps, a as Le } from "./ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C7rvthEI.js";
14
14
  import { _ as be } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
15
15
  import { u as fs } from "./useLoading-JFoghhRz.js";
16
16
  function vs() {
@@ -0,0 +1,470 @@
1
+ import { ref as f, watch as he, computed as N, reactive as ge, nextTick as ke, defineComponent as be, createBlock as J, openBlock as h, withCtx as x, createElementVNode as n, createVNode as B, toDisplayString as v, unref as R, createElementBlock as $, withDirectives as ae, withKeys as we, vModelText as le, normalizeClass as te, createTextVNode as T, createCommentVNode as U, Fragment as ne, renderList as Ie } from "vue";
2
+ import { ap as W, a as Pe, aq as $e, ar as oe, f as q, as as Ce, at as Se, E as Q, p as G, am as Ee, ak as O } from "./ScheduleModal.vue_vue_type_script_setup_true_lang-Cf0l2MRg.js";
3
+ import { useI18n as Ne } from "@feedmepos/mf-common";
4
+ function se() {
5
+ return W.map((e) => ({ id: e.id, name: e.name }));
6
+ }
7
+ function aa(e = {}) {
8
+ const s = f(se());
9
+ he(
10
+ () => W.map((d) => `${d.id}:${d.name}`).join(" "),
11
+ () => {
12
+ s.value = se();
13
+ }
14
+ );
15
+ const b = N(() => Pe()), a = f(!1), t = f(""), i = f(null), w = f(!1), y = f(null);
16
+ function z(d) {
17
+ return b.value.filter((g) => g.positions.includes(d)).length;
18
+ }
19
+ function j(d) {
20
+ return s.value.some((g) => g.name.toLowerCase() === d.toLowerCase());
21
+ }
22
+ function C() {
23
+ a.value = !0, t.value = "", i.value = null, y.value = null;
24
+ }
25
+ function D() {
26
+ a.value = !1, t.value = "";
27
+ }
28
+ async function M() {
29
+ var g, p;
30
+ const d = t.value.trim().slice(0, 40);
31
+ if (!(!d || j(d))) {
32
+ w.value = !0, y.value = null;
33
+ try {
34
+ await oe({ name: d }), a.value = !1, t.value = "", (g = e.notify) == null || g.call(e, "Position added", "success");
35
+ } catch (I) {
36
+ y.value = I instanceof Error ? I.message : "Could not add this position", (p = e.notify) == null || p.call(e, y.value, "error");
37
+ } finally {
38
+ w.value = !1;
39
+ }
40
+ }
41
+ }
42
+ function S(d) {
43
+ i.value = d;
44
+ }
45
+ function L() {
46
+ i.value = null;
47
+ }
48
+ async function H(d) {
49
+ var g, p;
50
+ w.value = !0, y.value = null;
51
+ try {
52
+ await $e(d), i.value = null, (g = e.notify) == null || g.call(e, "Position removed", "success");
53
+ } catch (I) {
54
+ y.value = I instanceof Error ? I.message : "Could not delete this position", (p = e.notify) == null || p.call(e, y.value, "error");
55
+ } finally {
56
+ w.value = !1;
57
+ }
58
+ }
59
+ const F = N(() => s.value.length);
60
+ return {
61
+ positions: s,
62
+ count: F,
63
+ isAdding: a,
64
+ newName: t,
65
+ pendingDeleteId: i,
66
+ saving: w,
67
+ error: y,
68
+ usageCountFor: z,
69
+ startAdd: C,
70
+ cancelAdd: D,
71
+ confirmAdd: M,
72
+ askDelete: S,
73
+ cancelDelete: L,
74
+ confirmDelete: H
75
+ };
76
+ }
77
+ function pe(e) {
78
+ var b;
79
+ const s = e.trim().split(/\s+/).filter(Boolean);
80
+ return s.length ? (s[0][0] + (((b = s[1]) == null ? void 0 : b[0]) ?? "")).toUpperCase() : "??";
81
+ }
82
+ function la(e, s = {}) {
83
+ const b = f(!1), a = f(""), t = f(""), i = ge({}), w = f(!1), y = f(null), z = f(null), j = f(!1), C = f(null);
84
+ let D = "", M = /* @__PURE__ */ new Set();
85
+ const S = N(() => {
86
+ var o;
87
+ const l = new Map((((o = q.value) == null ? void 0 : o.employees) ?? []).map((u) => [u.employeeId, u]));
88
+ return Ce.value.map((u) => {
89
+ var r;
90
+ const m = l.get(u._id), k = [
91
+ (r = m == null ? void 0 : m.primaryPosition) == null ? void 0 : r.positionName,
92
+ ...((m == null ? void 0 : m.secondaryPositions) ?? []).map((A) => A.positionName)
93
+ ].filter((A) => !!A);
94
+ return { employeeId: u._id, name: u.name, initials: pe(u.name), held: k };
95
+ });
96
+ }), L = N(() => {
97
+ const l = t.value.trim().toLowerCase();
98
+ return S.value.filter((o) => !l || o.name.toLowerCase().includes(l));
99
+ }), H = N(
100
+ () => S.value.filter((l) => i[l.employeeId]).map((l) => l.employeeId)
101
+ ), F = N(
102
+ () => L.value.length > 0 && L.value.every((l) => i[l.employeeId])
103
+ ), d = N(() => a.value.trim().slice(0, 40)), g = N(
104
+ () => !!d.value && W.some(
105
+ (l) => l.id !== C.value && l.name.toLowerCase() === d.value.toLowerCase()
106
+ )
107
+ ), p = N(() => !!d.value && !g.value && !w.value);
108
+ function I() {
109
+ a.value = "", t.value = "", Object.keys(i).forEach((l) => delete i[l]), y.value = null, j.value = !1, z.value = null, C.value = null, D = "", M = /* @__PURE__ */ new Set();
110
+ }
111
+ function ie() {
112
+ I(), b.value = !0;
113
+ }
114
+ function de(l, o) {
115
+ I(), C.value = l, a.value = o, D = o, M = new Set(
116
+ S.value.filter((u) => u.held.includes(o)).map((u) => u.employeeId)
117
+ ), M.forEach((u) => i[u] = !0), b.value = !0;
118
+ }
119
+ function ue() {
120
+ b.value = !1, I();
121
+ }
122
+ function me(l) {
123
+ i[l] = !i[l];
124
+ }
125
+ function ce() {
126
+ if (F.value) {
127
+ Object.keys(i).forEach((l) => delete i[l]);
128
+ return;
129
+ }
130
+ L.value.forEach((l) => i[l.employeeId] = !0);
131
+ }
132
+ function X(l, o) {
133
+ const u = !!(l != null && l.primaryPosition), m = ((l == null ? void 0 : l.secondaryPositions) ?? []).map((k) => k.positionName);
134
+ return {
135
+ ...u ? {} : { primaryPosition: G(o) },
136
+ secondaryPositions: (u ? [...m, o] : m).map((k) => G(k)).filter((k) => !!k)
137
+ };
138
+ }
139
+ async function re() {
140
+ var k;
141
+ const l = d.value;
142
+ await oe({ name: l }), await ke(), e == null || e(l);
143
+ const o = S.value.filter((r) => i[r.employeeId]), m = (await Promise.allSettled(
144
+ o.map((r) => {
145
+ var c;
146
+ const A = (c = q.value) == null ? void 0 : c.employees.find((P) => P.employeeId === r.employeeId);
147
+ return Q(r.employeeId, {
148
+ employeeName: r.name,
149
+ ...X(A, l)
150
+ });
151
+ })
152
+ )).filter((r) => r.status === "rejected").length;
153
+ return z.value = { name: l, assigned: o.length - m, failed: m }, (k = s.notify) == null || k.call(
154
+ s,
155
+ m ? `Position added, but ${m} employee assignment${m === 1 ? "" : "s"} failed` : "Position added",
156
+ m ? "error" : "success"
157
+ ), !0;
158
+ }
159
+ async function ve(l) {
160
+ var A;
161
+ const o = d.value;
162
+ await Se(l, { name: o }), e == null || e(o);
163
+ const u = S.value.filter(
164
+ (c) => i[c.employeeId] && !M.has(c.employeeId)
165
+ ), m = S.value.filter(
166
+ (c) => !i[c.employeeId] && M.has(c.employeeId)
167
+ ), r = (await Promise.allSettled([
168
+ ...u.map((c) => {
169
+ var V;
170
+ const P = (V = q.value) == null ? void 0 : V.employees.find((K) => K.employeeId === c.employeeId);
171
+ return Q(c.employeeId, {
172
+ employeeName: c.name,
173
+ ...X(P, o)
174
+ });
175
+ }),
176
+ ...m.map((c) => {
177
+ var _, ee;
178
+ const P = (_ = q.value) == null ? void 0 : _.employees.find((E) => E.employeeId === c.employeeId), V = ((P == null ? void 0 : P.secondaryPositions) ?? []).map((E) => E.positionName).filter((E) => E !== D), K = ((ee = P == null ? void 0 : P.primaryPosition) == null ? void 0 : ee.positionName) === D, fe = K ? V.shift() : void 0;
179
+ return Q(c.employeeId, {
180
+ employeeName: c.name,
181
+ ...K ? { primaryPosition: G(fe ?? "") ?? null } : {},
182
+ secondaryPositions: V.map((E) => G(E)).filter((E) => !!E)
183
+ });
184
+ })
185
+ ])).filter((c) => c.status === "rejected").length;
186
+ return z.value = { name: o, assigned: Math.max(0, u.length - r), failed: r }, (A = s.notify) == null || A.call(
187
+ s,
188
+ r ? `Position updated, but ${r} employee assignment${r === 1 ? "" : "s"} failed` : "Position updated",
189
+ r ? "error" : "success"
190
+ ), !0;
191
+ }
192
+ async function Y() {
193
+ var l;
194
+ if (!d.value)
195
+ return j.value = !0, !1;
196
+ if (!p.value) return !1;
197
+ w.value = !0, y.value = null;
198
+ try {
199
+ return await (C.value ? ve(C.value) : re());
200
+ } catch (o) {
201
+ return y.value = o instanceof Error ? o.message : `Could not ${C.value ? "save" : "add"} this position`, (l = s.notify) == null || l.call(s, y.value, "error"), !1;
202
+ } finally {
203
+ w.value = !1;
204
+ }
205
+ }
206
+ function Z() {
207
+ I();
208
+ }
209
+ async function ye() {
210
+ await Y() && Z();
211
+ }
212
+ return {
213
+ open: b,
214
+ name: a,
215
+ search: t,
216
+ picks: i,
217
+ saving: w,
218
+ error: y,
219
+ done: z,
220
+ nameError: j,
221
+ people: S,
222
+ visible: L,
223
+ pickedIds: H,
224
+ allPicked: F,
225
+ nameTaken: g,
226
+ canSave: p,
227
+ editingId: C,
228
+ openNew: ie,
229
+ openEdit: de,
230
+ close: ue,
231
+ toggle: me,
232
+ toggleAll: ce,
233
+ save: Y,
234
+ saveAndAnother: ye,
235
+ another: Z
236
+ };
237
+ }
238
+ const Ae = { class: "am-head" }, xe = {
239
+ id: "schedule-position-title",
240
+ class: "am-title"
241
+ }, Me = { class: "ce-body" }, Te = { key: 0 }, Oe = { class: "ce-field" }, ze = {
242
+ class: "ce-field asg-field",
243
+ style: { "margin-bottom": "0" }
244
+ }, De = { class: "asg-head" }, Le = { class: "asg-count" }, je = { class: "asg-list" }, Ve = ["checked", "onChange"], Be = { class: "asg-av" }, Fe = { class: "asg-id" }, Ke = { class: "asg-nm" }, Re = { class: "asg-sub" }, Ue = { key: 1 }, qe = {
245
+ key: 0,
246
+ class: "asg-sub",
247
+ style: { padding: "10px" }
248
+ }, Ge = { key: 1 }, He = { class: "cg-done" }, Je = { class: "cg-st-main" }, Qe = {
249
+ key: 0,
250
+ class: "cg-done-also"
251
+ }, We = { class: "am-foot" }, Xe = {
252
+ key: 0,
253
+ class: "am-foot-btns"
254
+ }, Ye = {
255
+ key: 1,
256
+ class: "am-foot-btns"
257
+ }, ta = /* @__PURE__ */ be({
258
+ __name: "ScheduleAddPositionModal",
259
+ props: {
260
+ modal: {}
261
+ },
262
+ setup(e) {
263
+ const { t: s } = Ne();
264
+ return (b, a) => (h(), J(Ee, {
265
+ open: e.modal.open.value,
266
+ "panel-class": "ce-modal",
267
+ "panel-style": "width: min(480px, 95vw)",
268
+ "labelled-by": "schedule-position-title",
269
+ onClose: a[11] || (a[11] = (t) => e.modal.close())
270
+ }, {
271
+ default: x(() => [
272
+ n("div", Ae, [
273
+ n("div", xe, v(e.modal.editingId.value ? R(s)("scheduling.positionModal.editTitle") : R(s)("scheduling.positionModal.addTitle")), 1),
274
+ B(O, {
275
+ hierarchy: "ghost",
276
+ size: "xs",
277
+ "icon-only": "",
278
+ class: "ce-close-x",
279
+ type: "button",
280
+ "aria-label": "Close",
281
+ onClick: a[0] || (a[0] = (t) => e.modal.close())
282
+ }, {
283
+ default: x(() => [...a[12] || (a[12] = [
284
+ n("svg", {
285
+ width: "20",
286
+ height: "20",
287
+ viewBox: "0 0 20 20",
288
+ fill: "none",
289
+ stroke: "currentColor",
290
+ "stroke-width": "1.8",
291
+ "stroke-linecap": "round",
292
+ "aria-hidden": "true"
293
+ }, [
294
+ n("path", { d: "M5.5 5.5l9 9M14.5 5.5l-9 9" })
295
+ ], -1)
296
+ ])]),
297
+ _: 1
298
+ })
299
+ ]),
300
+ n("div", Me, [
301
+ e.modal.done.value ? (h(), $("div", Ge, [
302
+ n("div", He, [
303
+ a[16] || (a[16] = n("span", {
304
+ class: "cg-done-tick",
305
+ "aria-hidden": "true"
306
+ }, "✓", -1)),
307
+ n("div", Je, [
308
+ n("b", null, v(e.modal.done.value.name), 1),
309
+ n("small", null, v(e.modal.editingId.value ? "Position updated" : e.modal.done.value.assigned ? `Added to ${e.modal.done.value.assigned} ${e.modal.done.value.assigned === 1 ? "employee" : "employees"}` : "Position added"), 1)
310
+ ])
311
+ ]),
312
+ e.modal.done.value.failed ? (h(), $("div", Qe, v(e.modal.done.value.failed) + " " + v(e.modal.done.value.failed === 1 ? "employee" : "employees") + " could not be updated. Add the position to them from their profile. ", 1)) : U("", !0)
313
+ ])) : (h(), $("div", Te, [
314
+ n("div", Oe, [
315
+ a[13] || (a[13] = n("label", {
316
+ class: "ce-label",
317
+ for: "skName"
318
+ }, "Position name", -1)),
319
+ ae(n("input", {
320
+ id: "skName",
321
+ "onUpdate:modelValue": a[1] || (a[1] = (t) => e.modal.name.value = t),
322
+ class: "sch-input ce-input",
323
+ maxlength: "40",
324
+ placeholder: "e.g. FOH, Kitchen, Manager, Cashier…",
325
+ autocomplete: "off",
326
+ onInput: a[2] || (a[2] = (t) => e.modal.nameError.value = !1),
327
+ onKeyup: a[3] || (a[3] = we((t) => e.modal.save(), ["enter"]))
328
+ }, null, 544), [
329
+ [le, e.modal.name.value]
330
+ ]),
331
+ n("div", {
332
+ class: te(["ce-err", { show: e.modal.nameError.value || e.modal.nameTaken.value }])
333
+ }, v(e.modal.nameTaken.value ? "A position with this name already exists" : "Give the position a name"), 3)
334
+ ]),
335
+ n("div", ze, [
336
+ n("div", De, [
337
+ a[14] || (a[14] = n("span", { class: "asg-lbl" }, "Employees with this position", -1)),
338
+ B(O, {
339
+ hierarchy: "ghost",
340
+ size: "sm",
341
+ class: "ce-add-link asg-all",
342
+ type: "button",
343
+ onClick: a[4] || (a[4] = (t) => e.modal.toggleAll())
344
+ }, {
345
+ default: x(() => [
346
+ T(v(e.modal.allPicked.value ? "Clear all" : "Select all"), 1)
347
+ ]),
348
+ _: 1
349
+ }),
350
+ n("span", Le, v(e.modal.pickedIds.value.length) + " selected", 1)
351
+ ]),
352
+ ae(n("input", {
353
+ "onUpdate:modelValue": a[5] || (a[5] = (t) => e.modal.search.value = t),
354
+ class: "sch-input ce-input asg-search",
355
+ placeholder: "Search team…",
356
+ autocomplete: "off"
357
+ }, null, 512), [
358
+ [le, e.modal.search.value]
359
+ ]),
360
+ n("div", je, [
361
+ (h(!0), $(ne, null, Ie(e.modal.visible.value, (t) => (h(), $("label", {
362
+ key: t.employeeId,
363
+ class: "asg-row"
364
+ }, [
365
+ n("input", {
366
+ type: "checkbox",
367
+ class: "sch-checkbox asg-check",
368
+ checked: !!e.modal.picks[t.employeeId],
369
+ onChange: (i) => e.modal.toggle(t.employeeId),
370
+ "data-platform": "desktop"
371
+ }, null, 40, Ve),
372
+ n("span", Be, v(t.initials), 1),
373
+ n("span", Fe, [
374
+ n("span", Ke, v(t.name), 1),
375
+ n("span", Re, [
376
+ t.held.length ? (h(), $(ne, { key: 0 }, [
377
+ T(v(t.held.join(", ")), 1)
378
+ ], 64)) : (h(), $("i", Ue, "No positions added"))
379
+ ])
380
+ ])
381
+ ]))), 128)),
382
+ e.modal.visible.value.length ? U("", !0) : (h(), $("div", qe, " No one matches. "))
383
+ ]),
384
+ a[15] || (a[15] = n("div", { class: "ce-hint" }, "Ticked people can work this position.", -1))
385
+ ]),
386
+ n("div", {
387
+ class: te(["ce-err", { show: !!e.modal.error.value }])
388
+ }, v(e.modal.error.value), 3)
389
+ ]))
390
+ ]),
391
+ n("div", We, [
392
+ a[19] || (a[19] = n("div", { class: "am-cost-preview" }, null, -1)),
393
+ e.modal.done.value ? (h(), $("div", Ye, [
394
+ e.modal.editingId.value ? U("", !0) : (h(), J(O, {
395
+ key: 0,
396
+ hierarchy: "secondary",
397
+ size: "sm",
398
+ class: "am-btn am-btn-sec",
399
+ type: "button",
400
+ onClick: a[9] || (a[9] = (t) => e.modal.another())
401
+ }, {
402
+ default: x(() => [...a[18] || (a[18] = [
403
+ T("Add another", -1)
404
+ ])]),
405
+ _: 1
406
+ })),
407
+ B(O, {
408
+ hierarchy: "primary",
409
+ size: "sm",
410
+ class: "am-btn am-btn-primary",
411
+ type: "button",
412
+ onClick: a[10] || (a[10] = (t) => e.modal.close())
413
+ }, {
414
+ default: x(() => [
415
+ T(v(R(s)("scheduling.common.done")), 1)
416
+ ]),
417
+ _: 1
418
+ })
419
+ ])) : (h(), $("div", Xe, [
420
+ B(O, {
421
+ hierarchy: "secondary",
422
+ size: "sm",
423
+ class: "am-btn am-btn-sec",
424
+ type: "button",
425
+ onClick: a[6] || (a[6] = (t) => e.modal.close())
426
+ }, {
427
+ default: x(() => [
428
+ T(v(R(s)("scheduling.common.cancel")), 1)
429
+ ]),
430
+ _: 1
431
+ }),
432
+ e.modal.editingId.value ? U("", !0) : (h(), J(O, {
433
+ key: 0,
434
+ hierarchy: "secondary",
435
+ size: "sm",
436
+ class: "am-btn am-btn-sec",
437
+ type: "button",
438
+ disabled: !e.modal.canSave.value,
439
+ onClick: a[7] || (a[7] = (t) => e.modal.saveAndAnother())
440
+ }, {
441
+ default: x(() => [...a[17] || (a[17] = [
442
+ T(" Save & add another ", -1)
443
+ ])]),
444
+ _: 1
445
+ }, 8, ["disabled"])),
446
+ B(O, {
447
+ hierarchy: "primary",
448
+ size: "sm",
449
+ class: "am-btn am-btn-primary",
450
+ type: "button",
451
+ disabled: !e.modal.canSave.value,
452
+ onClick: a[8] || (a[8] = (t) => e.modal.save())
453
+ }, {
454
+ default: x(() => [
455
+ T(v(e.modal.editingId.value ? e.modal.saving.value ? "Saving…" : "Save changes" : e.modal.saving.value ? "Adding…" : "Add position"), 1)
456
+ ]),
457
+ _: 1
458
+ }, 8, ["disabled"])
459
+ ]))
460
+ ])
461
+ ]),
462
+ _: 1
463
+ }, 8, ["open"]));
464
+ }
465
+ });
466
+ export {
467
+ ta as _,
468
+ la as a,
469
+ aa as u
470
+ };