@feedmepos/mf-hrm-portal 2.2.5 → 2.3.0-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/{ApprovalCodeList-Df5_U7Fj.js → ApprovalCodeList-cG0zmQVJ.js} +7 -7
  2. package/dist/{AuditLogList-BT-YM-CP.js → AuditLogList-BTifJhO1.js} +19 -18
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-Df3IHAyZ.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-qr5TwLTK.js} +2 -2
  4. package/dist/{EmployeeList-BfhG5ktC.js → EmployeeList-DzcMtxJ3.js} +31 -30
  5. package/dist/{FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js → FormItem.vue_vue_type_script_setup_true_lang-CUnlKsxk.js} +1 -1
  6. package/dist/{GrantUserList-B_WhIR9L.js → GrantUserList-D5b7tJ8Y.js} +8 -8
  7. package/dist/{Main-CGrtJkUl.js → Main-B2r59IOW.js} +5 -5
  8. package/dist/{Main-DKOPDO1K.js → Main-DFwdAWqn.js} +8 -8
  9. package/dist/{Main-Cxwiaabw.js → Main-DkLBemi7.js} +11 -11
  10. package/dist/{PermissionSetList-CqiLsqaj.js → PermissionSetList-B80hrfMW.js} +7 -7
  11. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DjNcJQM9.js +4167 -0
  12. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-Z-DH7ouY.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-fe-Rdwn4.js} +1 -1
  13. package/dist/{RoleList-iudKGaCg.js → RoleList-DHO4JRKF.js} +9 -9
  14. package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-B-XtB64L.js +452 -0
  15. package/dist/ScheduleGeneralPage-WlBM8bxV.js +629 -0
  16. package/dist/SchedulePage-Nm0krGVU.js +17056 -0
  17. package/dist/SchedulePositionPage-C0hrO11d.js +263 -0
  18. package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-DTDXir_7.js +1150 -0
  19. package/dist/SelectFilter-CG13h83-.js +264 -0
  20. package/dist/{TeamMemberList-D_8d24Vw.js → TeamMemberList-CgFWLRBM.js} +38 -37
  21. package/dist/{TimesheetList-VvIiAVLt.js → TimesheetList-Dp40G-0I.js} +54 -53
  22. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-Bmiz85Y3.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BFjrMhUG.js} +3 -3
  23. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  24. package/dist/{app-CVqQjVFY.js → app-CmBSTvaI.js} +3024 -2327
  25. package/dist/app.js +1 -1
  26. package/dist/{approval-code-BRClD2HN.js → approval-code-C9DmR4Md.js} +1 -1
  27. package/dist/{dayjs.min-Bhe9FtFt.js → dayjs.min-CfL2DQ3d.js} +1 -1
  28. package/dist/{employee-thZndJWE.js → employee-DQcHjoij.js} +4 -4
  29. package/dist/{grant-user-Dhi3ilC_.js → grant-user-Bv-pJ9Wt.js} +1 -1
  30. package/dist/{iteration-Cd5fl3-x.js → iteration-BlavheWG.js} +1 -1
  31. package/dist/{lodash-DiJ9xZIF.js → lodash-QerqayrJ.js} +1 -1
  32. package/dist/{restaurant-DiYb0pCm.js → restaurant-D7PEQjPY.js} +258 -252
  33. package/dist/{role-DdizOTVB.js → role-RM2YLO7n.js} +2 -2
  34. package/dist/{rule-CYFm43rI.js → rule-DjlvYIuP.js} +36 -36
  35. package/dist/src/api/restaurant/index.d.ts +2 -0
  36. package/dist/src/api/schedule/index.d.ts +51 -0
  37. package/dist/src/components/layout/AppSidebar.vue.d.ts +2 -0
  38. package/dist/src/components/layout/PortalShell.vue.d.ts +12 -0
  39. package/dist/src/components/layout/withShell.d.ts +14 -0
  40. package/dist/src/composables/useMessage.d.ts +8 -2
  41. package/dist/src/router/shared.d.ts +4 -1
  42. package/dist/src/types/schedule.d.ts +24 -0
  43. package/dist/src/views/scheduling/ScheduleGeneralPage.vue.d.ts +3 -0
  44. package/dist/src/views/scheduling/SchedulePage.vue.d.ts +3 -0
  45. package/dist/src/views/scheduling/SchedulePositionPage.vue.d.ts +3 -0
  46. package/dist/src/views/scheduling/components/ScheduleAddEmployeeIdentitySection.vue.d.ts +6 -0
  47. package/dist/src/views/scheduling/components/ScheduleAddEmployeeModal.vue.d.ts +12 -0
  48. package/dist/src/views/scheduling/components/ScheduleAddEmployeeModeStep.vue.d.ts +6 -0
  49. package/dist/src/views/scheduling/components/ScheduleAddEmployeePosAccessSection.vue.d.ts +6 -0
  50. package/dist/src/views/scheduling/components/ScheduleAddEmployeePositionsSection.vue.d.ts +10 -0
  51. package/dist/src/views/scheduling/components/ScheduleAddEmployeeSchedulingSection.vue.d.ts +6 -0
  52. package/dist/src/views/scheduling/components/ScheduleAddPickPopover.vue.d.ts +6 -0
  53. package/dist/src/views/scheduling/components/ScheduleAddPositionModal.vue.d.ts +6 -0
  54. package/dist/src/views/scheduling/components/ScheduleAllShiftsRow.vue.d.ts +22 -0
  55. package/dist/src/views/scheduling/components/ScheduleAreaRows.vue.d.ts +45 -0
  56. package/dist/src/views/scheduling/components/ScheduleAssignEmployeePopover.vue.d.ts +6 -0
  57. package/dist/src/views/scheduling/components/ScheduleAutoScheduleDetailsModal.vue.d.ts +6 -0
  58. package/dist/src/views/scheduling/components/ScheduleAutoScheduleModal.vue.d.ts +10 -0
  59. package/dist/src/views/scheduling/components/ScheduleButton.vue.d.ts +23 -0
  60. package/dist/src/views/scheduling/components/ScheduleChangeEmployeeModal.vue.d.ts +8 -0
  61. package/dist/src/views/scheduling/components/ScheduleCloneOutletModal.vue.d.ts +6 -0
  62. package/dist/src/views/scheduling/components/ScheduleCoach.vue.d.ts +6 -0
  63. package/dist/src/views/scheduling/components/ScheduleConfirmModal.vue.d.ts +32 -0
  64. package/dist/src/views/scheduling/components/ScheduleCostRail.vue.d.ts +8 -0
  65. package/dist/src/views/scheduling/components/ScheduleCostRailEmptyArt.vue.d.ts +2 -0
  66. package/dist/src/views/scheduling/components/ScheduleDateRangePopover.vue.d.ts +6 -0
  67. package/dist/src/views/scheduling/components/ScheduleDayNotePopover.vue.d.ts +6 -0
  68. package/dist/src/views/scheduling/components/ScheduleDayTimeline.vue.d.ts +12 -0
  69. package/dist/src/views/scheduling/components/ScheduleDemandRow.vue.d.ts +23 -0
  70. package/dist/src/views/scheduling/components/ScheduleDemandSheet.vue.d.ts +10 -0
  71. package/dist/src/views/scheduling/components/ScheduleDotsIcon.vue.d.ts +2 -0
  72. package/dist/src/views/scheduling/components/ScheduleEmployeeDetailPanel.vue.d.ts +12 -0
  73. package/dist/src/views/scheduling/components/ScheduleEmployeeIdentity.vue.d.ts +17 -0
  74. package/dist/src/views/scheduling/components/ScheduleEmployeeMenu.vue.d.ts +6 -0
  75. package/dist/src/views/scheduling/components/ScheduleExportDoneDialog.vue.d.ts +6 -0
  76. package/dist/src/views/scheduling/components/ScheduleFilterBar.vue.d.ts +18 -0
  77. package/dist/src/views/scheduling/components/ScheduleGapPopover.vue.d.ts +6 -0
  78. package/dist/src/views/scheduling/components/ScheduleGridHeader.vue.d.ts +18 -0
  79. package/dist/src/views/scheduling/components/ScheduleGridSkeleton.vue.d.ts +2 -0
  80. package/dist/src/views/scheduling/components/ScheduleLeaveEditModal.vue.d.ts +6 -0
  81. package/dist/src/views/scheduling/components/ScheduleOnboardingComplete.vue.d.ts +10 -0
  82. package/dist/src/views/scheduling/components/ScheduleOnboardingDoneArt.vue.d.ts +2 -0
  83. package/dist/src/views/scheduling/components/ScheduleOnboardingWelcome.vue.d.ts +11 -0
  84. package/dist/src/views/scheduling/components/ScheduleOnboardingWizard.vue.d.ts +9 -0
  85. package/dist/src/views/scheduling/components/ScheduleOpenShiftCardMenu.vue.d.ts +14 -0
  86. package/dist/src/views/scheduling/components/SchedulePdfPreview.vue.d.ts +6 -0
  87. package/dist/src/views/scheduling/components/SchedulePublishModal.vue.d.ts +8 -0
  88. package/dist/src/views/scheduling/components/ScheduleReviewBar.vue.d.ts +12 -0
  89. package/dist/src/views/scheduling/components/ScheduleSelect.vue.d.ts +54 -0
  90. package/dist/src/views/scheduling/components/ScheduleSelectExistingEmployeeModal.vue.d.ts +6 -0
  91. package/dist/src/views/scheduling/components/ScheduleShiftCardMenu.vue.d.ts +12 -0
  92. package/dist/src/views/scheduling/components/ScheduleShiftCell.vue.d.ts +35 -0
  93. package/dist/src/views/scheduling/components/ScheduleShiftHeadcountEditor.vue.d.ts +10 -0
  94. package/dist/src/views/scheduling/components/ScheduleShiftImpact.vue.d.ts +6 -0
  95. package/dist/src/views/scheduling/components/ScheduleShiftMoreOptions.vue.d.ts +8 -0
  96. package/dist/src/views/scheduling/components/ScheduleShiftPopover.vue.d.ts +16 -0
  97. package/dist/src/views/scheduling/components/ScheduleShiftRepeatDaysRow.vue.d.ts +8 -0
  98. package/dist/src/views/scheduling/components/ScheduleShiftSegmentsEditor.vue.d.ts +8 -0
  99. package/dist/src/views/scheduling/components/ScheduleShiftWhoPicker.vue.d.ts +25 -0
  100. package/dist/src/views/scheduling/components/ScheduleStackPopover.vue.d.ts +14 -0
  101. package/dist/src/views/scheduling/components/ScheduleStaffRail.vue.d.ts +16 -0
  102. package/dist/src/views/scheduling/components/ScheduleStaffRows.vue.d.ts +60 -0
  103. package/dist/src/views/scheduling/components/ScheduleStatsRow.vue.d.ts +12 -0
  104. package/dist/src/views/scheduling/components/ScheduleSwapShiftsModal.vue.d.ts +8 -0
  105. package/dist/src/views/scheduling/components/ScheduleTimePickerPopover.vue.d.ts +6 -0
  106. package/dist/src/views/scheduling/components/ScheduleTopbar.vue.d.ts +20 -0
  107. package/dist/src/views/scheduling/components/ScheduleTourAllSet.vue.d.ts +6 -0
  108. package/dist/src/views/scheduling/composables/auto-schedule-mapping.d.ts +33 -0
  109. package/dist/src/views/scheduling/composables/onboarding-constants.d.ts +5 -0
  110. package/dist/src/views/scheduling/composables/onboarding-hours.d.ts +7 -0
  111. package/dist/src/views/scheduling/composables/onboarding-types.d.ts +50 -0
  112. package/dist/src/views/scheduling/composables/schedule-add-employee-form.d.ts +78 -0
  113. package/dist/src/views/scheduling/composables/schedule-board-helpers.d.ts +59 -0
  114. package/dist/src/views/scheduling/composables/schedule-breaks.d.ts +3 -0
  115. package/dist/src/views/scheduling/composables/schedule-day-meta.d.ts +23 -0
  116. package/dist/src/views/scheduling/composables/schedule-employee-profile.d.ts +7 -0
  117. package/dist/src/views/scheduling/composables/schedule-popover-position.d.ts +16 -0
  118. package/dist/src/views/scheduling/composables/schedule-shift-time.d.ts +26 -0
  119. package/dist/src/views/scheduling/composables/schedule-week-cache.d.ts +10 -0
  120. package/dist/src/views/scheduling/composables/useCollapsedList.d.ts +9 -0
  121. package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +101 -0
  122. package/dist/src/views/scheduling/composables/useScheduleAddPick.d.ts +81 -0
  123. package/dist/src/views/scheduling/composables/useScheduleAllShiftsRow.d.ts +77 -0
  124. package/dist/src/views/scheduling/composables/useScheduleAreaBoard.d.ts +63 -0
  125. package/dist/src/views/scheduling/composables/useScheduleAreaDragDrop.d.ts +18 -0
  126. package/dist/src/views/scheduling/composables/useScheduleAssign.d.ts +122 -0
  127. package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +289 -0
  128. package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +523 -0
  129. package/dist/src/views/scheduling/composables/useScheduleCellState.d.ts +27 -0
  130. package/dist/src/views/scheduling/composables/useScheduleClashDetection.d.ts +28 -0
  131. package/dist/src/views/scheduling/composables/useScheduleCloneOutletModal.d.ts +19 -0
  132. package/dist/src/views/scheduling/composables/useScheduleCoach.d.ts +80 -0
  133. package/dist/src/views/scheduling/composables/useScheduleCopyWeek.d.ts +19 -0
  134. package/dist/src/views/scheduling/composables/useScheduleCostRail.d.ts +43 -0
  135. package/dist/src/views/scheduling/composables/useScheduleDayNote.d.ts +45 -0
  136. package/dist/src/views/scheduling/composables/useScheduleDayTimeline.d.ts +100 -0
  137. package/dist/src/views/scheduling/composables/useScheduleDemand.d.ts +76 -0
  138. package/dist/src/views/scheduling/composables/useScheduleDemandRow.d.ts +47 -0
  139. package/dist/src/views/scheduling/composables/useScheduleDemandSheet.d.ts +145 -0
  140. package/dist/src/views/scheduling/composables/useScheduleDragDrop.d.ts +54 -0
  141. package/dist/src/views/scheduling/composables/useScheduleEmployeeIdentity.d.ts +41 -0
  142. package/dist/src/views/scheduling/composables/useScheduleEmployeeMenu.d.ts +35 -0
  143. package/dist/src/views/scheduling/composables/useScheduleEmployeeProfile.d.ts +16 -0
  144. package/dist/src/views/scheduling/composables/useScheduleExport.d.ts +43 -0
  145. package/dist/src/views/scheduling/composables/useScheduleFilterBar.d.ts +14 -0
  146. package/dist/src/views/scheduling/composables/useScheduleGapPopover.d.ts +80 -0
  147. package/dist/src/views/scheduling/composables/useScheduleLeave.d.ts +59 -0
  148. package/dist/src/views/scheduling/composables/useScheduleLegend.d.ts +15 -0
  149. package/dist/src/views/scheduling/composables/useScheduleOnboardingFlow.d.ts +9 -0
  150. package/dist/src/views/scheduling/composables/useScheduleOnboardingPersistence.d.ts +13 -0
  151. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1568 -0
  152. package/dist/src/views/scheduling/composables/useScheduleOpenShiftCard.d.ts +23 -0
  153. package/dist/src/views/scheduling/composables/useScheduleOutlet.d.ts +22 -0
  154. package/dist/src/views/scheduling/composables/useSchedulePageBootstrap.d.ts +9 -0
  155. package/dist/src/views/scheduling/composables/useSchedulePageClearActions.d.ts +20 -0
  156. package/dist/src/views/scheduling/composables/useSchedulePageOverlays.d.ts +18 -0
  157. package/dist/src/views/scheduling/composables/useSchedulePositionModal.d.ts +52 -0
  158. package/dist/src/views/scheduling/composables/useSchedulePositions.d.ts +27 -0
  159. package/dist/src/views/scheduling/composables/useSchedulePublish.d.ts +118 -0
  160. package/dist/src/views/scheduling/composables/useScheduleRangeCalendar.d.ts +27 -0
  161. package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +241 -0
  162. package/dist/src/views/scheduling/composables/useScheduleSettings.d.ts +57 -0
  163. package/dist/src/views/scheduling/composables/useScheduleSetupBanner.d.ts +17 -0
  164. package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +202 -0
  165. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +209 -0
  166. package/dist/src/views/scheduling/composables/useScheduleStaffRail.d.ts +17 -0
  167. package/dist/src/views/scheduling/composables/useScheduleStatsRow.d.ts +24 -0
  168. package/dist/src/views/scheduling/composables/useScheduleTimePicker.d.ts +49 -0
  169. package/dist/src/views/scheduling/composables/useScheduleTopbar.d.ts +10 -0
  170. package/dist/src/views/scheduling/composables/useScheduleTour.d.ts +93 -0
  171. package/dist/src/views/scheduling/composables/useScheduleViewportFit.d.ts +9 -0
  172. package/dist/src/views/scheduling/data.d.ts +97 -0
  173. package/dist/src/views/scheduling/locales/index.d.ts +608 -0
  174. package/dist/src/views/scheduling/schedule-state.d.ts +679 -0
  175. package/dist/src/views/scheduling/schedule-store.d.ts +107 -0
  176. package/dist/src/views/scheduling/types.d.ts +351 -0
  177. package/dist/src/views/team/components/PortalConditionForm.vue.d.ts +2 -2
  178. package/dist/src/views/team/condition-builders/ConditionBuilderForm.vue.d.ts +2 -2
  179. package/dist/style.css +1 -1
  180. package/dist/tsconfig.app.tsbuildinfo +1 -1
  181. package/dist/{useAppStore-BGhlB1_1.js → useAppStore-d_nHyK5u.js} +1 -1
  182. package/dist/{useLoading-CvgqVDbF.js → useLoading-JFoghhRz.js} +1 -1
  183. package/dist/{useReportPermissions-hVMtRNmj.js → useReportPermissions-Bl6Br79r.js} +3 -3
  184. package/package.json +3 -2
  185. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CmNTqB0v.js +0 -4167
  186. package/dist/SelectFilter-ATOm0hdn.js +0 -269
@@ -0,0 +1,1150 @@
1
+ import { onMounted as Ge, onBeforeUnmount as ke, ref as S, reactive as L, shallowRef as le, watch as De, computed as R, defineComponent as be, createElementBlock as D, openBlock as k, renderSlot as ze, useAttrs as Ke, nextTick as ve, normalizeClass as ie, createElementVNode as B, createBlock as je, mergeProps as qe, toDisplayString as H, Teleport as Xe, createCommentVNode as K, withDirectives as Je, vModelText as Qe, Fragment as re, renderList as Ze, createTextVNode as et } from "vue";
2
+ import { useRoute as tt, useRouter as at } from "vue-router";
3
+ import { useCoreStore as nt } from "@feedmepos/mf-common";
4
+ import { g as w, b as y, u as st } from "./restaurant-D7PEQjPY.js";
5
+ import { E as fe, u as ot } from "./employee-DQcHjoij.js";
6
+ function zt(e) {
7
+ let t = null;
8
+ function a() {
9
+ if (!t) return;
10
+ t.style.height = "";
11
+ const s = t.getBoundingClientRect().top;
12
+ t.style.height = `${Math.max(0, window.innerHeight - s)}px`;
13
+ }
14
+ Ge(() => {
15
+ var s;
16
+ t = ((s = e.value) == null ? void 0 : s.closest(".sch-page")) ?? null, a(), window.addEventListener("resize", a);
17
+ }), ke(() => {
18
+ window.removeEventListener("resize", a), t && (t.style.height = "");
19
+ });
20
+ }
21
+ function lt(e) {
22
+ return (e ?? []).reduce((t, a) => {
23
+ if (a.type === "DURATION") return t + a.minutes;
24
+ const [s, o] = a.startTime.split(":").map(Number), [n, r] = a.endTime.split(":").map(Number);
25
+ let i = n * 60 + r - (s * 60 + o);
26
+ return i < 0 && (i += 24 * 60), t + i;
27
+ }, 0);
28
+ }
29
+ function Kt(e) {
30
+ const t = Math.max(0, Math.round(e ?? 0));
31
+ return t ? [{ type: "DURATION", minutes: t, breakPayType: "UNPAID" }] : [];
32
+ }
33
+ const h = {
34
+ async listEmployeeProfiles(e) {
35
+ return w(
36
+ await y("schedules").get("employees", {
37
+ params: e != null && e.length ? { ids: e.join(",") } : void 0
38
+ })
39
+ );
40
+ },
41
+ async listEmployeeConfigs(e) {
42
+ return w(
43
+ await y(`restaurants/${e}/schedules`).get("employee-configs")
44
+ );
45
+ },
46
+ async saveEmployeeConfigs(e, t) {
47
+ return w(
48
+ await y(`restaurants/${e}/schedules`).post(
49
+ "employee-configs/reorder",
50
+ t
51
+ )
52
+ );
53
+ },
54
+ async getSettings(e) {
55
+ return w(
56
+ await y(`restaurants/${e}/schedules`).get("settings")
57
+ );
58
+ },
59
+ async saveSettings(e, t) {
60
+ return w(
61
+ await y(`restaurants/${e}/schedules`).post("settings", t)
62
+ );
63
+ },
64
+ async generateAutoSchedule(e, t) {
65
+ return w(
66
+ await y(`restaurants/${e}/schedules`).post(
67
+ "auto-schedule/generate",
68
+ t
69
+ )
70
+ );
71
+ },
72
+ async getAutoScheduleCapabilities(e) {
73
+ return w(
74
+ await y(`restaurants/${e}/schedules`).get(
75
+ "auto-schedule/capabilities"
76
+ )
77
+ );
78
+ },
79
+ async applyAutoSchedule(e, t) {
80
+ return w(
81
+ await y(`restaurants/${e}/schedules`).post(
82
+ "auto-schedule/apply",
83
+ t
84
+ )
85
+ );
86
+ },
87
+ /** One outlet's whole board over `[from, to]` (inclusive, 'YYYY-MM-DD'). */
88
+ async readBoard(e, t, a) {
89
+ return w(
90
+ await y(`restaurants/${e}/schedules`).get("board", {
91
+ params: { from: t, to: a }
92
+ })
93
+ );
94
+ },
95
+ async createTimeOff(e, t) {
96
+ return w(
97
+ await y(`restaurants/${e}/schedules`).post("time-off", t)
98
+ );
99
+ },
100
+ async updateTimeOffStatus(e, t, a) {
101
+ return w(
102
+ await y(`restaurants/${e}/schedules`).post(
103
+ `time-off/${t}/status`,
104
+ a
105
+ )
106
+ );
107
+ },
108
+ async deleteTimeOff(e, t) {
109
+ await y(`restaurants/${e}/schedules`).delete(`time-off/${t}`);
110
+ },
111
+ /** Creates or updates the employee's shared business-level scheduling profile. */
112
+ async createEmployeeProfile(e, t) {
113
+ return w(await y("schedules").post("employees", t));
114
+ },
115
+ /** Edits the employee's shared business-level scheduling profile. */
116
+ async updateEmployeeProfile(e, t, a) {
117
+ return w(
118
+ await y("schedules").post("employees", { employeeId: t, ...a })
119
+ );
120
+ },
121
+ /** Positions are shared across the business. */
122
+ async createPosition(e) {
123
+ return w(await y("schedules").post("positions", e));
124
+ },
125
+ async updatePosition(e, t) {
126
+ return w(await y("schedules").post(`positions/${e}`, t));
127
+ },
128
+ /** Deleting one position is `deletePositions` with a single-id array — the backend's
129
+ * `DELETE positions/:id` route is gone; this is now `DELETE positions?ids=`. */
130
+ async deletePosition(e) {
131
+ await y("schedules").delete("positions", {
132
+ params: { ids: e }
133
+ });
134
+ },
135
+ /** Creates one flat demand interval. */
136
+ async createDemand(e, t) {
137
+ return w(
138
+ await y(`restaurants/${e}/schedules`).post("demands", t)
139
+ );
140
+ },
141
+ /** Deletes a batch of demands in one request — e.g. `saveDemand` replacing a whole
142
+ * day/weekday's demand rows wholesale. Deleting one demand is just this with a single-id
143
+ * array. */
144
+ async deleteDemands(e, t) {
145
+ return w(
146
+ await y(`restaurants/${e}/schedules`).delete("demands", {
147
+ params: { ids: t.join(",") }
148
+ })
149
+ );
150
+ },
151
+ /** Replaces one date's note/holiday-mark. All three fields back to empty/false clears it. */
152
+ async saveScheduleDay(e, t, a) {
153
+ return w(
154
+ await y(`restaurants/${e}/schedules`).post(
155
+ `days/${t}`,
156
+ a
157
+ )
158
+ );
159
+ },
160
+ /** A one-off shift assignment. */
161
+ async createAssignment(e, t) {
162
+ return w(
163
+ await y(`restaurants/${e}/schedules`).post("assignments", t)
164
+ );
165
+ },
166
+ async updateAssignment(e, t, a) {
167
+ return w(
168
+ await y(`restaurants/${e}/schedules`).post(
169
+ `assignments/${t}`,
170
+ a
171
+ )
172
+ );
173
+ },
174
+ /** Deletes a batch of assignments in one request — e.g. a shift split into several segments
175
+ * getting replaced wholesale. Deleting one assignment is just this with a single-id
176
+ * array. */
177
+ async deleteAssignments(e, t) {
178
+ return w(
179
+ await y(`restaurants/${e}/schedules`).delete("assignments", {
180
+ params: { ids: t.join(",") }
181
+ })
182
+ );
183
+ },
184
+ /** Flips a batch of assignments to one status in a single request — e.g. Publish sending
185
+ * every DRAFT shift on the board to PUBLISHED at once. */
186
+ async bulkUpdateAssignmentStatus(e, t) {
187
+ return w(
188
+ await y(`restaurants/${e}/schedules`).post(
189
+ "assignments/bulk-status",
190
+ t
191
+ )
192
+ );
193
+ }
194
+ }, it = {
195
+ payload: le(null),
196
+ loading: S(!1),
197
+ rosterLoading: S(!1),
198
+ loadError: S(null),
199
+ scheduleSetupCompleted: S(!1),
200
+ dataVersion: S(0),
201
+ outletId: S(""),
202
+ restaurantEmployees: S([]),
203
+ employeeConfigs: S([]),
204
+ employeeOutletIds: le({}),
205
+ businessEmployees: le([]),
206
+ positions: L([]),
207
+ positionRecords: L([]),
208
+ rolePositions: L({}),
209
+ outlet: L({ name: "" }),
210
+ locationOptions: L([]),
211
+ locationLabelById: L({}),
212
+ departmentOptions: L([]),
213
+ compensationGroupOptions: L([]),
214
+ compensationGroupMeta: L({}),
215
+ existingStaff: L([]),
216
+ shiftTemplates: L([]),
217
+ rules: L({
218
+ coverage: {},
219
+ openFrom: "00:00",
220
+ openTo: "24:00",
221
+ dayHours: Array.from({ length: 7 }, () => []),
222
+ payRate: {
223
+ NORMAL: { overtime: 1.5 },
224
+ REST_DAY: { regular: 1, overtime: 2 },
225
+ PUBLIC_HOLIDAY: { regular: 2, overtime: 3 }
226
+ },
227
+ otAfterDaily: 0,
228
+ salesForecast: 0,
229
+ closedWeekdays: [],
230
+ labourTarget: 0,
231
+ budgetFromSales: !1,
232
+ budget: 0,
233
+ otCapHours: 0,
234
+ otBudget: 0,
235
+ notify: {
236
+ waConnected: !1,
237
+ waNumber: "",
238
+ waDisplayName: "",
239
+ defaults: { wa: !1, push: !1, email: !1 }
240
+ }
241
+ })
242
+ }, {
243
+ payload: u,
244
+ loading: ge,
245
+ rosterLoading: we,
246
+ loadError: ee,
247
+ scheduleSetupCompleted: Pe,
248
+ dataVersion: W,
249
+ outletId: d,
250
+ restaurantEmployees: te,
251
+ employeeConfigs: F,
252
+ employeeOutletIds: Le,
253
+ businessEmployees: ue,
254
+ positions: rt,
255
+ positionRecords: Ie,
256
+ rolePositions: jt,
257
+ outlet: ut,
258
+ locationOptions: Ee,
259
+ locationLabelById: q,
260
+ compensationGroupMeta: qt,
261
+ existingStaff: Xt,
262
+ shiftTemplates: Jt,
263
+ rules: M
264
+ } = it;
265
+ function X(e) {
266
+ const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0");
267
+ return `${t}-${a}-${s}`;
268
+ }
269
+ function ce(e, t) {
270
+ const a = new Date(e);
271
+ return a.setDate(a.getDate() + t), a;
272
+ }
273
+ const Oe = 6;
274
+ let Y = null, V = null, U = null, ae = null;
275
+ function Ae(e) {
276
+ return e === d.value ? !1 : (d.value = e, u.value = null, Y = null, V = null, ee.value = null, ae = null, Pe.value = !1, te.value = [], F.value = [], U = null, W.value += 1, !0);
277
+ }
278
+ async function pe(e) {
279
+ if (!(!e || ae === e)) {
280
+ we.value = !0;
281
+ try {
282
+ await ct(e);
283
+ } finally {
284
+ we.value = !1;
285
+ }
286
+ }
287
+ }
288
+ async function ct(e) {
289
+ const t = await fe.readEmployeesPage({
290
+ limit: 500,
291
+ offset: 0,
292
+ restaurantIds: [e]
293
+ });
294
+ e === d.value && (te.value = t.items, F.value = await h.listEmployeeConfigs(e), ae = e, W.value += 1, mt().then((a) => {
295
+ e === d.value && (Le.value = a, W.value += 1);
296
+ }));
297
+ }
298
+ async function dt(e) {
299
+ const t = d.value;
300
+ if (!t || !e.length) return;
301
+ const a = await h.saveEmployeeConfigs(t, { configs: e });
302
+ F.value = a, W.value += 1;
303
+ }
304
+ async function ft(e, t) {
305
+ const a = F.value.find((o) => o.employeeId === e), s = (a == null ? void 0 : a.displayOrder) ?? (t && F.value.some((o) => o.displayOrder !== null) ? Math.max(
306
+ 0,
307
+ ...F.value.filter((o) => o.displayOrder !== null).map((o) => o.displayOrder)
308
+ ) + 100 : null);
309
+ await dt([{ employeeId: e, enabled: t, displayOrder: s }]);
310
+ }
311
+ async function Ne() {
312
+ const e = d.value;
313
+ e && (ae = null, await pe(e));
314
+ }
315
+ async function Me(e, t) {
316
+ const a = ot(), s = (await _e(!0)).find((i) => i._id === e);
317
+ if (!s) throw new Error("Could not find this employee");
318
+ const o = s.restaurantRole.map((i) => ({
319
+ restaurantId: i.restaurantId,
320
+ roleId: i.roleId
321
+ })), n = t(o);
322
+ if (!n.length)
323
+ throw new Error(
324
+ "An employee must keep at least 1 location, otherwise they are deleted. To delete them, use the Employee page."
325
+ );
326
+ (s.isMasterUser ? "master" : "user") === "master" ? await a.updateMasterEmployee(e, {
327
+ user: { name: s.name, passcode: s.passcode, code: s.code ?? "" },
328
+ roles: n,
329
+ previousRoles: o
330
+ }) : await a.updateEmployee(e, {
331
+ user: { name: s.name, passcode: s.passcode },
332
+ roles: n,
333
+ previousRoles: o
334
+ });
335
+ }
336
+ async function Qt(e, t, a = "") {
337
+ const s = [...new Set(t.filter(Boolean))];
338
+ s.length && (await Me(e, (o) => [
339
+ ...o.filter((n) => !s.includes(n.restaurantId)),
340
+ ...s.map((n) => ({ restaurantId: n, roleId: a }))
341
+ ]), d.value && s.includes(d.value) && await ft(e, !0), await Ne());
342
+ }
343
+ async function Zt(e, t) {
344
+ const a = new Set(t);
345
+ a.size && (await Me(e, (s) => s.filter((o) => !a.has(o.restaurantId))), await Ne());
346
+ }
347
+ let j = null;
348
+ async function pt() {
349
+ const a = await fe.readEmployeesPage({ limit: 500, offset: 0 }), s = Math.min(10, Math.ceil(a.total / 500)), o = await Promise.all(
350
+ Array.from(
351
+ { length: Math.max(0, s - 1) },
352
+ (n, r) => fe.readEmployeesPage({ limit: 500, offset: (r + 1) * 500 })
353
+ )
354
+ );
355
+ return [...a.items, ...o.flatMap((n) => n.items)];
356
+ }
357
+ function _e(e = !1) {
358
+ if (!e) {
359
+ if (j) return j;
360
+ if (ue.value.length) return Promise.resolve(ue.value);
361
+ }
362
+ const t = pt().then((a) => (ue.value = a, a)).finally(() => {
363
+ j === t && (j = null);
364
+ });
365
+ return j = t, t;
366
+ }
367
+ async function mt() {
368
+ const e = {};
369
+ try {
370
+ (await _e()).forEach((t) => {
371
+ e[t._id] = [...new Set(t.restaurantRole.map((a) => a.restaurantId))];
372
+ });
373
+ } catch {
374
+ return e;
375
+ }
376
+ return e;
377
+ }
378
+ function Se(e, t) {
379
+ return Y !== null && V !== null && Y <= e && V >= t;
380
+ }
381
+ async function yt(e) {
382
+ const t = X(e), a = X(ce(e, 6));
383
+ Se(t, a) || U && (await U, Se(t, a)) || await Ce(
384
+ ce(e, -7 * Oe),
385
+ ce(e, 7 * Oe)
386
+ );
387
+ }
388
+ async function ea() {
389
+ !Y || !V || await Ce(/* @__PURE__ */ new Date(`${Y}T00:00:00`), /* @__PURE__ */ new Date(`${V}T00:00:00`));
390
+ }
391
+ async function ta(e) {
392
+ if (!d.value) throw new Error("No outlet selected");
393
+ const t = await h.createEmployeeProfile(d.value, e);
394
+ u.value && (u.value.employees.push(t), W.value += 1);
395
+ }
396
+ async function aa(e, t) {
397
+ if (!d.value) throw new Error("No outlet selected");
398
+ const a = await h.updateEmployeeProfile(d.value, e, t);
399
+ if (u.value) {
400
+ const s = u.value.employees.findIndex((o) => o.employeeId === e);
401
+ s > -1 && (u.value = {
402
+ ...u.value,
403
+ employees: u.value.employees.map((o, n) => n === s ? a : o)
404
+ });
405
+ }
406
+ }
407
+ async function na(e) {
408
+ const t = await h.createPosition(e);
409
+ u.value && (u.value = { ...u.value, positions: [...u.value.positions, t] });
410
+ }
411
+ async function sa(e, t) {
412
+ const a = await h.updatePosition(e, t);
413
+ u.value && (u.value = {
414
+ ...u.value,
415
+ positions: u.value.positions.map((s) => s.id === e ? a : s)
416
+ });
417
+ }
418
+ async function oa(e) {
419
+ await h.deletePosition(e), u.value && (u.value = {
420
+ ...u.value,
421
+ positions: u.value.positions.filter((t) => t.id !== e)
422
+ });
423
+ }
424
+ async function la(e, t) {
425
+ if (!d.value) throw new Error("No outlet selected");
426
+ const a = await h.saveScheduleDay(d.value, e, t);
427
+ if (u.value) {
428
+ const s = u.value.days.filter((o) => o.date !== e);
429
+ a && s.push(a), u.value = { ...u.value, days: s };
430
+ }
431
+ }
432
+ async function ia(e) {
433
+ var o;
434
+ if (!d.value) throw new Error("No outlet selected");
435
+ const t = (((o = u.value) == null ? void 0 : o.demands) ?? []).filter(
436
+ (n) => e.date ? n.date === e.date : n.dayOfWeek === e.dayOfWeek
437
+ ), a = e.periods.flatMap((n) => {
438
+ const r = (n.roles ?? []).filter((v) => v.positionName && v.headcount > 0), i = r.reduce((v, _) => v + _.headcount, 0), g = {
439
+ ...e.date ? { date: e.date } : { dayOfWeek: e.dayOfWeek },
440
+ startTime: n.startTime,
441
+ endTime: n.endTime
442
+ };
443
+ return [
444
+ ...r.map((v) => ({
445
+ ...g,
446
+ headcount: v.headcount,
447
+ position: { positionId: v.positionId, positionName: v.positionName }
448
+ })),
449
+ ...n.headcount > i ? [{ ...g, headcount: n.headcount - i }] : []
450
+ ];
451
+ }), s = [];
452
+ try {
453
+ for (const n of a) s.push(await h.createDemand(d.value, n));
454
+ } catch (n) {
455
+ if (s.length)
456
+ try {
457
+ await h.deleteDemands(
458
+ d.value,
459
+ s.map((r) => r.id)
460
+ );
461
+ } catch {
462
+ }
463
+ throw n;
464
+ }
465
+ if (t.length)
466
+ try {
467
+ await h.deleteDemands(
468
+ d.value,
469
+ t.map((n) => n.id)
470
+ );
471
+ } catch (n) {
472
+ if (s.length)
473
+ try {
474
+ await h.deleteDemands(
475
+ d.value,
476
+ s.map((r) => r.id)
477
+ );
478
+ } catch {
479
+ }
480
+ throw n;
481
+ }
482
+ if (u.value) {
483
+ const n = u.value.demands.filter((r) => !t.some((i) => i.id === r.id));
484
+ u.value = { ...u.value, demands: [...n, ...s] };
485
+ }
486
+ }
487
+ async function ra(e, t) {
488
+ if (!d.value) throw new Error("No outlet selected");
489
+ const a = u.value;
490
+ if (!a || a.demands.some((n) => n.date === t)) return 0;
491
+ const s = a.demands.filter((n) => n.date === e);
492
+ if (!s.length) return 0;
493
+ const o = await Promise.all(
494
+ s.map(
495
+ (n) => h.createDemand(d.value, {
496
+ date: t,
497
+ startTime: n.startTime,
498
+ endTime: n.endTime,
499
+ headcount: n.headcount,
500
+ ...n.position ? {
501
+ position: {
502
+ positionId: n.position.positionId,
503
+ positionName: n.position.positionName
504
+ }
505
+ } : {}
506
+ })
507
+ )
508
+ );
509
+ return u.value && (u.value = { ...u.value, demands: [...u.value.demands, ...o] }), o.length;
510
+ }
511
+ async function ua(e) {
512
+ if (!d.value) throw new Error("No outlet selected");
513
+ return h.generateAutoSchedule(d.value, e);
514
+ }
515
+ async function ca() {
516
+ if (!d.value) throw new Error("No outlet selected");
517
+ return h.getAutoScheduleCapabilities(d.value);
518
+ }
519
+ async function da(e) {
520
+ if (!d.value) throw new Error("No outlet selected");
521
+ return h.applyAutoSchedule(d.value, e);
522
+ }
523
+ async function fa(e) {
524
+ if (!d.value) throw new Error("No outlet selected");
525
+ return h.createAssignment(d.value, e);
526
+ }
527
+ async function pa(e, t) {
528
+ if (!d.value) throw new Error("No outlet selected");
529
+ return h.updateAssignment(d.value, e, t);
530
+ }
531
+ async function ma(e) {
532
+ if (!d.value) throw new Error("No outlet selected");
533
+ e.length && await h.deleteAssignments(d.value, e);
534
+ }
535
+ async function ya(e) {
536
+ if (!d.value) throw new Error("No outlet selected");
537
+ const t = await h.createTimeOff(d.value, e);
538
+ return u.value && (u.value = { ...u.value, timeOff: [...u.value.timeOff, t] }), t;
539
+ }
540
+ async function ha(e, t) {
541
+ if (!d.value) throw new Error("No outlet selected");
542
+ const a = await h.updateTimeOffStatus(d.value, e, t);
543
+ return a && u.value && (u.value = {
544
+ ...u.value,
545
+ timeOff: u.value.timeOff.map((s) => s.id === e ? a : s)
546
+ }), a;
547
+ }
548
+ async function va(e) {
549
+ if (!d.value) throw new Error("No outlet selected");
550
+ await h.deleteTimeOff(d.value, e), u.value && (u.value = {
551
+ ...u.value,
552
+ timeOff: u.value.timeOff.filter((t) => t.id !== e)
553
+ });
554
+ }
555
+ async function ga(e) {
556
+ if (!d.value) throw new Error("No outlet selected");
557
+ return h.bulkUpdateAssignmentStatus(d.value, e);
558
+ }
559
+ async function Ce(e, t) {
560
+ const a = d.value;
561
+ if (!a) {
562
+ ee.value = "No outlet selected";
563
+ return;
564
+ }
565
+ const s = X(e), o = X(t);
566
+ ge.value = !0, ee.value = null;
567
+ const n = (async () => {
568
+ try {
569
+ const r = await h.readBoard(a, s, o);
570
+ if (d.value !== a) return;
571
+ u.value = r, Pe.value = r.settings.setupCompleted, Y = s, V = o, W.value += 1;
572
+ } catch (r) {
573
+ if (d.value !== a) return;
574
+ ee.value = r instanceof Error ? r.message : "Could not load the schedule";
575
+ } finally {
576
+ d.value === a && (ge.value = !1);
577
+ }
578
+ })();
579
+ U = n;
580
+ try {
581
+ await n;
582
+ } finally {
583
+ U === n && (U = null);
584
+ }
585
+ }
586
+ const Re = "unassigned", wa = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Ea = "All Stations", Oa = [
587
+ { id: Re, label: "Unassigned", roles: [], system: !0 }
588
+ ], xe = 1e6, Te = [
589
+ "#903E1F",
590
+ "#5F090A",
591
+ "#0A5384",
592
+ "#1F5F3E",
593
+ "#5B2C6F",
594
+ "#7D5A00",
595
+ "#0F5C5C",
596
+ "#6E2142"
597
+ ];
598
+ function ht(e) {
599
+ var t;
600
+ return (t = Ie.find((a) => a.name === e)) == null ? void 0 : t.id;
601
+ }
602
+ function Aa(e) {
603
+ if (e)
604
+ return { positionId: ht(e), positionName: e };
605
+ }
606
+ const Sa = [1, 1, 1, 1, 1, 1, 1];
607
+ function J(e) {
608
+ return (e + 6) % 7;
609
+ }
610
+ function Ta(e) {
611
+ return (e + 1) % 7;
612
+ }
613
+ function Z(e, t) {
614
+ e.splice(0, e.length, ...t);
615
+ }
616
+ function vt(e, t) {
617
+ const a = (n) => {
618
+ const [r, i] = n.split(":").map(Number);
619
+ return (r || 0) * 60 + (i || 0);
620
+ }, s = a(e);
621
+ let o = a(t);
622
+ return o <= s && (o += 1440), (o - s) / 60;
623
+ }
624
+ function gt(e) {
625
+ var a;
626
+ const t = e.trim().split(/\s+/).filter(Boolean);
627
+ return t.length ? (t[0][0] + (((a = t[1]) == null ? void 0 : a[0]) ?? "")).toUpperCase() : "??";
628
+ }
629
+ const $e = /* @__PURE__ */ new Map(), de = /* @__PURE__ */ new Map();
630
+ function ka(e) {
631
+ return $e.get(e);
632
+ }
633
+ function wt(e) {
634
+ const t = de.get(e);
635
+ if (t !== void 0) return t;
636
+ const a = xe + de.size + 1;
637
+ return de.set(e, a), $e.set(a, e), a;
638
+ }
639
+ function Et(e) {
640
+ ut.name = (e == null ? void 0 : e.outlet.name) ?? "", Z(rt, (e == null ? void 0 : e.positions.map((n) => n.name)) ?? []), Z(Ie, (e == null ? void 0 : e.positions) ?? []);
641
+ const t = (e == null ? void 0 : e.restaurantProfile.operatingHours) ?? [], a = Array.from({ length: 7 }, () => []);
642
+ for (const n of t) a[J(n.dayOfWeek)] = n.closed ? [] : n.hours;
643
+ Z(M.dayHours, a);
644
+ const s = t.filter((n) => !n.closed).flatMap((n) => n.hours);
645
+ M.openFrom = s.length ? s.map((n) => n.start).reduce((n, r) => r < n ? r : n) : "00:00", M.openTo = s.length ? s.map((n) => n.end).reduce((n, r) => r > n ? r : n) : "24:00", Z(
646
+ M.closedWeekdays,
647
+ t.filter((n) => n.closed).map((n) => J(n.dayOfWeek)).sort((n, r) => n - r)
648
+ );
649
+ const o = e == null ? void 0 : e.settings.payRate;
650
+ M.payRate.NORMAL.overtime = (o == null ? void 0 : o.NORMAL.overtime) ?? 1.5, M.payRate.REST_DAY.regular = (o == null ? void 0 : o.REST_DAY.regular) ?? 1, M.payRate.REST_DAY.overtime = (o == null ? void 0 : o.REST_DAY.overtime) ?? 2, M.payRate.PUBLIC_HOLIDAY.regular = (o == null ? void 0 : o.PUBLIC_HOLIDAY.regular) ?? 2, M.payRate.PUBLIC_HOLIDAY.overtime = (o == null ? void 0 : o.PUBLIC_HOLIDAY.overtime) ?? 3;
651
+ }
652
+ De(u, Et, { immediate: !0 });
653
+ function Ot(e) {
654
+ return e.reduce(
655
+ (t, a) => a.employmentType === "FULLTIME" ? Math.max(t, a.workingHour) : t,
656
+ 0
657
+ );
658
+ }
659
+ function At(e, t) {
660
+ if (e.wage.type === "HOURLY") return e.wage.amount;
661
+ const a = e.workingHour || t;
662
+ return a ? e.wage.amount / (a * (52 / 12)) : 0;
663
+ }
664
+ function St(e, t) {
665
+ return e.employmentType === "FULLTIME" ? 100 : !t || !e.workingHour ? 0 : Math.min(99, Math.round(e.workingHour / t * 100));
666
+ }
667
+ function Tt(e, t) {
668
+ var a;
669
+ return {
670
+ start: e.startTime,
671
+ end: e.endTime,
672
+ role: ((a = e.position) == null ? void 0 : a.positionName) || t,
673
+ // Mongo distinguishes a draft from a published/confirmed assignment; the board's third
674
+ // state ('ot') is a costing outcome, never something stored.
675
+ status: e.status === "DRAFT" ? "pending" : "confirmed",
676
+ breakMins: lt(e.breaks),
677
+ breaks: e.breaks,
678
+ // Carried through so an edit updates this same ScheduleShiftAssignments document instead of
679
+ // creating a duplicate — see useScheduleBoard's commitShift/persistSlot.
680
+ assignmentId: e.id
681
+ };
682
+ }
683
+ function kt(e) {
684
+ return e.type === "OFF_DAY" ? "Off day" : e.leaveType === "MEDICAL" ? "Medical Leave" : e.leaveType === "EMERGENCY" ? "Emergency Leave" : e.leaveType === "UNPAID" ? "Unpaid Leave" : "Annual Leave";
685
+ }
686
+ function Dt(e, t) {
687
+ if (t < e.startDate || t > e.endDate) return null;
688
+ const s = e.startDate === e.endDate || t === e.startDate ? e.startPart : t === e.endDate ? e.endPart : "FULL_DAY";
689
+ return {
690
+ requestId: e.id,
691
+ type: e.type,
692
+ leaveType: e.leaveType ?? void 0,
693
+ timeOff: e.status === "PENDING" ? "pending" : "approved",
694
+ reason: kt(e),
695
+ half: s !== "FULL_DAY",
696
+ halfPart: s === "FULL_DAY" ? void 0 : s
697
+ };
698
+ }
699
+ function bt(e) {
700
+ return {
701
+ employeeId: e._id,
702
+ name: e.name,
703
+ employmentType: "FULLTIME",
704
+ workingHour: 0,
705
+ wage: { type: "HOURLY", amount: 0 },
706
+ primaryPosition: null,
707
+ secondaryPositions: [],
708
+ availability: []
709
+ };
710
+ }
711
+ function Pt(e) {
712
+ const t = q[d.value];
713
+ return !t || !e.includes(t) ? e : [t, ...e.filter((a) => a !== t)];
714
+ }
715
+ function Lt(e) {
716
+ var s;
717
+ const a = (Le.value[e] ?? ((s = te.value.find((o) => o._id === e)) == null ? void 0 : s.restaurantRole.map((o) => o.restaurantId)) ?? []).map((o) => q[o]).filter((o) => !!o);
718
+ return a.length ? Pt([...new Set(a)]) : void 0;
719
+ }
720
+ function Da(e = []) {
721
+ const t = u.value;
722
+ if (!t) return [];
723
+ const a = new Map(t.employees.map((i) => [i.employeeId, i])), s = new Map(F.value.map((i) => [i.employeeId, i])), o = te.value.filter((i) => {
724
+ var g;
725
+ return ((g = s.get(i._id)) == null ? void 0 : g.enabled) !== !1;
726
+ }).map((i) => a.get(i._id) ?? bt(i)), n = Ot(o), r = /* @__PURE__ */ new Map();
727
+ for (const i of t.assignments) {
728
+ const g = `${i.employeeId}|${i.date}`, v = r.get(g);
729
+ v ? v.push(i) : r.set(g, [i]);
730
+ }
731
+ return o.map((i) => {
732
+ var b, G;
733
+ const g = wt(i.employeeId), v = ((b = i.primaryPosition) == null ? void 0 : b.positionName) ?? "", _ = [
734
+ (G = i.primaryPosition) == null ? void 0 : G.positionName,
735
+ ...i.secondaryPositions.map((P) => P.positionName)
736
+ ].filter((P) => !!P), x = e.map((P) => {
737
+ const E = X(P), m = (t.timeOff ?? []).filter((A) => A.employeeId === i.employeeId).map((A) => Dt(A, E)).find((A) => A !== null);
738
+ if (m) return m;
739
+ const $ = (r.get(`${i.employeeId}|${E}`) ?? []).filter((A) => A.startTime && A.endTime).map((A) => Tt(A, v)).sort((A, ne) => A.start.localeCompare(ne.start));
740
+ return $.length ? $.length === 1 ? $[0] : $ : null;
741
+ }), p = Array.from(
742
+ { length: 7 },
743
+ (P, E) => i.availability.some((m) => J(m.dayOfWeek) === E)
744
+ ), O = Array.from({ length: 7 }, (P, E) => {
745
+ const m = i.availability.find((N) => J(N.dayOfWeek) === E);
746
+ return { from: (m == null ? void 0 : m.start) ?? "", to: (m == null ? void 0 : m.end) ?? "" };
747
+ });
748
+ return {
749
+ id: g,
750
+ name: i.name,
751
+ employmentType: i.employmentType,
752
+ role: v,
753
+ initials: gt(i.name),
754
+ color: Te[(g - xe - 1) % Te.length],
755
+ // Gross hours actually rostered this week — the figure the cost rail multiplies by
756
+ // the rate. Contracted hours are a separate question, answered by RULES.contract.
757
+ // Rounded to one decimal — `hoursBetween` divides by 60, so an unrounded sum reads
758
+ // as a long, meaningless float (e.g. 31.983333333333334) everywhere this is shown
759
+ // verbatim, matching the rounding `employeeLoadOf`'s own hours figure already uses.
760
+ weekHours: Math.round(
761
+ x.reduce(
762
+ (P, E) => P + (Array.isArray(E) ? E : E && "start" in E ? [E] : []).reduce(
763
+ (m, N) => m + vt(N.start, N.end),
764
+ 0
765
+ ),
766
+ 0
767
+ ) * 10
768
+ ) / 10,
769
+ pct: St(i, n),
770
+ contractHours: i.workingHour || void 0,
771
+ // Every outlet the POS says this person works at, not just this one — the Add / Edit form
772
+ // shows them, and saving keeps them.
773
+ locations: Lt(i.employeeId),
774
+ rate: At(i, n),
775
+ positions: _,
776
+ shifts: x,
777
+ // Remarks live in their own collection in the older scheduling design and are not
778
+ // part of this board's payload yet.
779
+ remarks: [],
780
+ section: Re,
781
+ payBasis: i.wage.type === "HOURLY" ? "hourly" : "monthly",
782
+ payAmount: i.wage.amount,
783
+ availDays: p,
784
+ availHours: O
785
+ };
786
+ });
787
+ }
788
+ function ba() {
789
+ return [];
790
+ }
791
+ function Pa() {
792
+ var s, o;
793
+ const e = u.value, t = {}, a = {};
794
+ for (const n of (e == null ? void 0 : e.demands) ?? []) {
795
+ const r = n.date ? t[s = n.date] ?? (t[s] = []) : n.dayOfWeek !== null ? a[o = J(n.dayOfWeek)] ?? (a[o] = []) : null;
796
+ if (!r) continue;
797
+ let i = r.find((g) => g.from === n.startTime && g.to === n.endTime);
798
+ i || (i = { from: n.startTime, to: n.endTime, n: 0, roles: [] }, r.push(i)), i.n += n.headcount, n.position && i.roles.push({ position: n.position.positionName, n: n.headcount });
799
+ }
800
+ return { byDate: t, byWeekday: a };
801
+ }
802
+ function La() {
803
+ const e = nt(), { restaurants: t, readRestaurants: a } = st(), s = tt(), o = at(), n = S(!1), r = R(
804
+ () => [...t.value].map((p) => ({ value: p._id, label: p.profile.name })).sort((p, O) => p.label.localeCompare(O.label))
805
+ ), i = R(() => {
806
+ var p;
807
+ return ((p = e.currentRestaurant.value) == null ? void 0 : p._id) ?? "";
808
+ });
809
+ async function g(p, O) {
810
+ return Ae(p) ? (s.query.restaurantId !== p && o.replace({ query: { ...s.query, restaurantId: p } }), await Promise.all([pe(p), yt(O)]), !0) : !1;
811
+ }
812
+ const v = (p) => !!p && r.value.some((O) => O.value === p);
813
+ async function _() {
814
+ var O;
815
+ await a(), Ee.splice(0, Ee.length, ...r.value.map((b) => b.label)), Object.keys(q).forEach((b) => delete q[b]), r.value.forEach((b) => q[b.value] = b.label);
816
+ const p = v(d.value) ? d.value : v(i.value) ? i.value : ((O = r.value[0]) == null ? void 0 : O.value) ?? "";
817
+ return p && Ae(p), n.value = !0, p;
818
+ }
819
+ async function x() {
820
+ const p = await _();
821
+ return p && await pe(p), p;
822
+ }
823
+ return { options: r, ready: n, outletId: d, resolve: x, resolveOutlet: _, switchTo: g };
824
+ }
825
+ const It = ["data-hierarchy", "data-size", "data-icon"], Ia = /* @__PURE__ */ be({
826
+ __name: "ScheduleButton",
827
+ props: {
828
+ hierarchy: { default: "primary" },
829
+ size: { default: "sm" },
830
+ iconOnly: { type: Boolean, default: !1 }
831
+ },
832
+ setup(e) {
833
+ return (t, a) => (k(), D("button", {
834
+ type: "button",
835
+ class: "sch-button",
836
+ "data-hierarchy": e.hierarchy,
837
+ "data-size": e.size,
838
+ "data-icon": e.iconOnly ? "only" : void 0
839
+ }, [
840
+ ze(t.$slots, "default")
841
+ ], 8, It));
842
+ }
843
+ }), Nt = ["disabled", "aria-expanded"], Mt = { class: "sch" }, _t = ["aria-multiselectable"], Ct = {
844
+ key: 0,
845
+ class: "fx-pop-head"
846
+ }, Rt = {
847
+ key: 1,
848
+ class: "fx-pop-search"
849
+ }, xt = {
850
+ key: 2,
851
+ class: "fx-opt is-off"
852
+ }, $t = {
853
+ key: 0,
854
+ class: "fx-grp"
855
+ }, Bt = ["aria-selected", "onClick"], Ft = {
856
+ key: 0,
857
+ class: "fx-opt-text"
858
+ }, Ht = { key: 0 }, Na = /* @__PURE__ */ be({
859
+ inheritAttrs: !1,
860
+ __name: "ScheduleSelect",
861
+ props: {
862
+ modelValue: {},
863
+ options: {},
864
+ multiple: { type: Boolean },
865
+ selected: {},
866
+ placeholder: {},
867
+ disabled: { type: Boolean },
868
+ menuTitle: {},
869
+ searchable: { type: Boolean }
870
+ },
871
+ emits: ["update:modelValue", "toggle"],
872
+ setup(e, { emit: t }) {
873
+ const a = e, s = t, o = Ke(), n = R(() => o.class ?? ""), r = S(!1), i = S(null), g = S(null), v = S(null), _ = R(() => {
874
+ var l, f;
875
+ if (a.multiple) {
876
+ const c = ((l = a.selected) == null ? void 0 : l.length) ?? 0;
877
+ return c ? `${c} selected` : a.placeholder ?? "";
878
+ }
879
+ return ((f = a.options.find((c) => c.value === a.modelValue)) == null ? void 0 : f.label) ?? "";
880
+ });
881
+ function x(l) {
882
+ var f;
883
+ return a.multiple ? !!((f = a.selected) != null && f.includes(l.value)) : l.value === a.modelValue;
884
+ }
885
+ const p = R(() => !!a.menuTitle || a.options.some((l) => l.hint)), O = S(""), b = S(null), G = R(() => {
886
+ const l = O.value.trim().toLowerCase();
887
+ return !a.searchable || !l ? a.options : a.options.filter((f) => `${f.label} ${f.hint ?? ""}`.toLowerCase().includes(l));
888
+ }), P = R(() => {
889
+ const l = [];
890
+ let f;
891
+ for (const c of G.value)
892
+ c.group !== f && (f = c.group, f && l.push({ heading: f })), l.push({ option: c });
893
+ return l;
894
+ }), E = 5, m = 8;
895
+ function N() {
896
+ const l = v.value, f = g.value;
897
+ if (!l || !f) return;
898
+ const c = f.getBoundingClientRect(), T = window.innerWidth || document.documentElement.clientWidth, I = window.innerHeight || document.documentElement.clientHeight;
899
+ l.style.minWidth = `${Math.round(c.width)}px`, l.style.maxWidth = `${Math.max(180, Math.round(T - m * 2))}px`;
900
+ const z = I - c.bottom - E - m, We = c.top - E - m;
901
+ l.style.maxHeight = `${Math.max(120, Math.min(320, Math.max(z, We)))}px`;
902
+ const Q = l.offsetHeight, Ye = l.offsetWidth;
903
+ let oe = c.bottom + E;
904
+ oe + Q > I - m && (oe = c.top - E - Q >= m ? c.top - E - Q : Math.max(m, I - Q - m));
905
+ const Ve = Math.min(Math.max(m, c.left), Math.max(m, T - Ye - m));
906
+ l.style.top = `${Math.round(oe)}px`, l.style.left = `${Math.round(Ve)}px`, l.style.visibility = "visible";
907
+ }
908
+ function $(l) {
909
+ var c, T;
910
+ const f = l.target;
911
+ f && ((c = i.value) != null && c.contains(f) || (T = v.value) != null && T.contains(f)) || C();
912
+ }
913
+ function A(l) {
914
+ const f = v.value, c = l.target;
915
+ if (f && c && c !== document && f.contains(c)) return;
916
+ const T = g.value;
917
+ if (!T) return;
918
+ const I = T.getBoundingClientRect(), z = window.innerHeight || document.documentElement.clientHeight;
919
+ if (I.bottom < 0 || I.top > z) {
920
+ C();
921
+ return;
922
+ }
923
+ N();
924
+ }
925
+ function ne() {
926
+ document.addEventListener("click", $), document.addEventListener("scroll", A, !0), window.addEventListener("resize", C);
927
+ }
928
+ function me() {
929
+ document.removeEventListener("click", $), document.removeEventListener("scroll", A, !0), window.removeEventListener("resize", C);
930
+ }
931
+ async function se() {
932
+ var l, f, c;
933
+ a.disabled || r.value || (O.value = "", r.value = !0, await ve(), N(), (l = b.value) == null || l.focus(), (c = (f = v.value) == null ? void 0 : f.querySelector(".fx-opt.is-on")) == null || c.scrollIntoView({ block: "nearest" }), ne());
934
+ }
935
+ function C() {
936
+ r.value && (r.value = !1, O.value = "", me());
937
+ }
938
+ De(O, async () => {
939
+ r.value && (await ve(), N());
940
+ });
941
+ function Be(l) {
942
+ var f;
943
+ if (l.key === "Escape")
944
+ l.preventDefault(), C(), (f = g.value) == null || f.focus();
945
+ else if (l.key === "Enter") {
946
+ l.preventDefault();
947
+ const c = G.value.find((T) => !T.disabled);
948
+ c && he(c);
949
+ }
950
+ }
951
+ function ye() {
952
+ r.value ? C() : se();
953
+ }
954
+ function he(l) {
955
+ if (!l.disabled) {
956
+ if (a.multiple && !l.command) {
957
+ s("toggle", l.value);
958
+ return;
959
+ }
960
+ if (C(), a.multiple) {
961
+ s("update:modelValue", l.value);
962
+ return;
963
+ }
964
+ l.value !== a.modelValue && s("update:modelValue", l.value);
965
+ }
966
+ }
967
+ const Fe = R(() => a.options.filter((l) => !l.disabled));
968
+ function He(l) {
969
+ const f = Fe.value;
970
+ if (a.multiple || !f.length) {
971
+ se();
972
+ return;
973
+ }
974
+ const c = f.findIndex((z) => z.value === a.modelValue), T = l === "Home" ? 0 : l === "End" ? f.length - 1 : l === "ArrowDown" ? Math.min(f.length - 1, (c < 0 ? -1 : c) + 1) : Math.max(0, (c < 0 ? 1 : c) - 1), I = f[T];
975
+ I && I.value !== a.modelValue ? s("update:modelValue", I.value) : se();
976
+ }
977
+ function Ue(l) {
978
+ var f;
979
+ if (l.key === "Escape") {
980
+ if (!r.value) return;
981
+ l.preventDefault(), C(), (f = g.value) == null || f.focus();
982
+ return;
983
+ }
984
+ if (l.key === "Enter" || l.key === " ") {
985
+ l.preventDefault(), ye();
986
+ return;
987
+ }
988
+ l.key !== "ArrowDown" && l.key !== "ArrowUp" && l.key !== "Home" && l.key !== "End" || (l.preventDefault(), He(l.key));
989
+ }
990
+ return ke(me), (l, f) => (k(), D("div", {
991
+ ref_key: "rootEl",
992
+ ref: i,
993
+ class: ie(["fx-sel", n.value])
994
+ }, [
995
+ B("button", qe({
996
+ ref_key: "btnEl",
997
+ ref: g
998
+ }, l.$attrs, {
999
+ type: "button",
1000
+ class: ["sch-input fx-btn", { "is-open": r.value }],
1001
+ disabled: e.disabled,
1002
+ "aria-haspopup": "listbox",
1003
+ "aria-expanded": r.value,
1004
+ onClick: f[0] || (f[0] = (c) => ye()),
1005
+ onKeydown: Ue
1006
+ }), H(_.value), 17, Nt),
1007
+ (k(), je(Xe, { to: "body" }, [
1008
+ B("div", Mt, [
1009
+ r.value ? (k(), D("div", {
1010
+ key: 0,
1011
+ ref_key: "popEl",
1012
+ ref: v,
1013
+ class: ie(["fx-pop", { "fx-pop-rich": p.value }]),
1014
+ role: "listbox",
1015
+ "aria-multiselectable": e.multiple || void 0,
1016
+ style: { visibility: "hidden" }
1017
+ }, [
1018
+ e.menuTitle ? (k(), D("div", Ct, H(e.menuTitle), 1)) : K("", !0),
1019
+ e.searchable ? (k(), D("div", Rt, [
1020
+ Je(B("input", {
1021
+ ref_key: "searchEl",
1022
+ ref: b,
1023
+ "onUpdate:modelValue": f[1] || (f[1] = (c) => O.value = c),
1024
+ class: "sch-input fx-pop-q",
1025
+ type: "search",
1026
+ placeholder: "Search",
1027
+ autocomplete: "off",
1028
+ spellcheck: "false",
1029
+ "aria-label": "Search",
1030
+ onKeydown: Be
1031
+ }, null, 544), [
1032
+ [Qe, O.value]
1033
+ ])
1034
+ ])) : K("", !0),
1035
+ e.searchable && !P.value.length ? (k(), D("div", xt, "No matches")) : K("", !0),
1036
+ (k(!0), D(re, null, Ze(P.value, (c, T) => (k(), D(re, { key: T }, [
1037
+ "heading" in c ? (k(), D("div", $t, H(c.heading), 1)) : (k(), D("div", {
1038
+ key: 1,
1039
+ class: ie(["fx-opt", {
1040
+ "is-on": x(c.option),
1041
+ "is-off": c.option.disabled,
1042
+ "is-new": c.option.command
1043
+ }]),
1044
+ role: "option",
1045
+ "aria-selected": x(c.option),
1046
+ onClick: (I) => he(c.option)
1047
+ }, [
1048
+ f[2] || (f[2] = B("span", {
1049
+ class: "fx-tick",
1050
+ "aria-hidden": "true"
1051
+ }, [
1052
+ B("svg", {
1053
+ width: "11",
1054
+ height: "11",
1055
+ viewBox: "0 0 16 16",
1056
+ fill: "none"
1057
+ }, [
1058
+ B("path", {
1059
+ d: "m3.5 8.4 3 3 6-7",
1060
+ stroke: "currentColor",
1061
+ "stroke-width": "2.2",
1062
+ "stroke-linecap": "round",
1063
+ "stroke-linejoin": "round"
1064
+ })
1065
+ ])
1066
+ ], -1)),
1067
+ p.value ? (k(), D("span", Ft, [
1068
+ B("b", null, H(c.option.label), 1),
1069
+ c.option.hint ? (k(), D("small", Ht, H(c.option.hint), 1)) : K("", !0)
1070
+ ])) : (k(), D(re, { key: 1 }, [
1071
+ et(H(c.option.label), 1)
1072
+ ], 64))
1073
+ ], 10, Bt))
1074
+ ], 64))), 128))
1075
+ ], 10, _t)) : K("", !0)
1076
+ ])
1077
+ ]))
1078
+ ], 2));
1079
+ }
1080
+ });
1081
+ export {
1082
+ ge as $,
1083
+ Ea as A,
1084
+ Qt as B,
1085
+ qt as C,
1086
+ Zt as D,
1087
+ Xt as E,
1088
+ ta as F,
1089
+ _e as G,
1090
+ Ne as H,
1091
+ wt as I,
1092
+ X as J,
1093
+ da as K,
1094
+ Ee as L,
1095
+ ea as M,
1096
+ ua as N,
1097
+ ca as O,
1098
+ rt as P,
1099
+ Sa as Q,
1100
+ jt as R,
1101
+ Oa as S,
1102
+ yt as T,
1103
+ Re as U,
1104
+ ra as V,
1105
+ wa as W,
1106
+ ut as X,
1107
+ ia as Y,
1108
+ ht as Z,
1109
+ Pe as _,
1110
+ Da as a,
1111
+ we as a0,
1112
+ ee as a1,
1113
+ pe as a2,
1114
+ Pa as a3,
1115
+ Ia as a4,
1116
+ Na as a5,
1117
+ zt as a6,
1118
+ La as a7,
1119
+ ft as a8,
1120
+ Ie as a9,
1121
+ oa as aa,
1122
+ na as ab,
1123
+ te as ac,
1124
+ sa as ad,
1125
+ M as b,
1126
+ ba as c,
1127
+ W as d,
1128
+ Kt as e,
1129
+ u as f,
1130
+ ma as g,
1131
+ ga as h,
1132
+ ka as i,
1133
+ fa as j,
1134
+ aa as k,
1135
+ Jt as l,
1136
+ va as m,
1137
+ ha as n,
1138
+ ya as o,
1139
+ Aa as p,
1140
+ F as q,
1141
+ dt as r,
1142
+ la as s,
1143
+ Ta as t,
1144
+ pa as u,
1145
+ q as v,
1146
+ d as w,
1147
+ h as x,
1148
+ J as y,
1149
+ Pt as z
1150
+ };