@feedmepos/mf-hrm-portal 2.3.0-dev.14 → 2.3.0-dev.16

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 (60) hide show
  1. package/dist/{ApprovalCodeList-C9dauQ81.js → ApprovalCodeList-NeNAiyOr.js} +4 -4
  2. package/dist/{AuditLogList-zW_N_ECT.js → AuditLogList-Pv9kFjBr.js} +4 -4
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DJuO1qPX.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DWfp8X80.js} +2 -2
  4. package/dist/{EmployeeList-8jkHTd7q.js → EmployeeList-Bs9lymzV.js} +6 -6
  5. package/dist/{FormItem.vue_vue_type_script_setup_true_lang-CJc_g0tW.js → FormItem.vue_vue_type_script_setup_true_lang-Cb22fFWE.js} +1 -1
  6. package/dist/{GrantUserList-Dj55GA7O.js → GrantUserList-dTWAmoUv.js} +5 -5
  7. package/dist/{Main-BQNkTyET.js → Main-C_RrWM3c.js} +9 -9
  8. package/dist/{Main-CuUG6svQ.js → Main-Cp40vaRW.js} +2 -2
  9. package/dist/{Main-0TfvGJ4N.js → Main-D_iKA3Se.js} +5 -5
  10. package/dist/{PermissionSetList-BsLi-TOK.js → PermissionSetList-D9uTEllI.js} +5 -5
  11. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C2l8nWx2.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-vbO5PdcM.js} +1353 -1353
  12. package/dist/{RoleList-DLDcyVWT.js → RoleList-DyoCd2jX.js} +7 -7
  13. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CUXUPfRc.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-D0Mg9P_m.js} +111 -111
  14. package/dist/{ScheduleGeneralPage-BhYI6O9g.js → ScheduleGeneralPage-DyIBUXY1.js} +86 -87
  15. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-BLBLBtNG.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CJMPrPHl.js} +931 -823
  16. package/dist/SchedulePage-BkvOpOVt.js +18757 -0
  17. package/dist/{SchedulePositionPage-Byt6nmUj.js → SchedulePositionPage-DE5XxDl2.js} +16 -16
  18. package/dist/{SelectFilter-1fh00OZW.js → SelectFilter-D27X9BNI.js} +1 -1
  19. package/dist/{TeamMemberList-CyUX8Afk.js → TeamMemberList-YudsADAP.js} +7 -7
  20. package/dist/{TimesheetList-Q4FeNgOT.js → TimesheetList-CQXDulxg.js} +6 -6
  21. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-C3iU4Zmc.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-CWHjolT4.js} +2 -2
  22. package/dist/{app-TuHQoM7K.js → app-BMVAE__n.js} +1535 -1283
  23. package/dist/app.js +1 -1
  24. package/dist/{dayjs.min-DXnA8GYn.js → dayjs.min-6iMvK3bi.js} +1 -1
  25. package/dist/{employee-Ctnil3cD.js → employee-kAmYgyIB.js} +3 -3
  26. package/dist/{iteration-BxOzv27y.js → iteration-kNseYv0g.js} +1 -1
  27. package/dist/{lodash-CKT_RxJs.js → lodash-CoGtJ4ls.js} +1 -1
  28. package/dist/{role-CNEJPyaD.js → role-BvQeAAsI.js} +1 -1
  29. package/dist/{rule-FbuHv6Gh.js → rule-DkjcuvBR.js} +2 -2
  30. package/dist/src/views/audit-log/locales/index.d.ts +252 -0
  31. package/dist/src/views/scheduling/components/ScheduleAreaRows.vue.d.ts +2 -0
  32. package/dist/src/views/scheduling/components/ScheduleBoardAreaRows.vue.d.ts +1 -0
  33. package/dist/src/views/scheduling/components/ScheduleOnboardingSettings.vue.d.ts +6 -0
  34. package/dist/src/views/scheduling/composables/schedule-demand-domain.d.ts +13 -1
  35. package/dist/src/views/scheduling/composables/schedule-error.d.ts +3 -0
  36. package/dist/src/views/scheduling/composables/schedule-quick-pick.d.ts +22 -0
  37. package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +5 -2
  38. package/dist/src/views/scheduling/composables/useScheduleAddPick.d.ts +3 -11
  39. package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +7 -0
  40. package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +45 -1
  41. package/dist/src/views/scheduling/composables/useScheduleCostRail.d.ts +10 -0
  42. package/dist/src/views/scheduling/composables/useScheduleDayTimeline.d.ts +2 -2
  43. package/dist/src/views/scheduling/composables/useScheduleDragDrop.d.ts +1 -0
  44. package/dist/src/views/scheduling/composables/useScheduleEmployeeAccess.d.ts +14 -6
  45. package/dist/src/views/scheduling/composables/useScheduleEmployeeCandidates.d.ts +3 -0
  46. package/dist/src/views/scheduling/composables/useScheduleEmployeeValidation.d.ts +0 -2
  47. package/dist/src/views/scheduling/composables/useScheduleOnboardingEmployees.d.ts +23 -0
  48. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +160 -3
  49. package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +44 -0
  50. package/dist/src/views/scheduling/composables/useScheduleSetupBanner.d.ts +2 -2
  51. package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +22 -0
  52. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +26 -2
  53. package/dist/src/views/scheduling/country-rules/index.d.ts +8 -3
  54. package/dist/src/views/scheduling/schedule-store.d.ts +7 -7
  55. package/dist/src/views/scheduling/types.d.ts +5 -0
  56. package/dist/style.css +1 -1
  57. package/dist/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/{useReportPermissions-lemBrd1S.js → useReportPermissions-CbnelOLy.js} +3 -3
  59. package/package.json +3 -3
  60. package/dist/SchedulePage-DPU4taJt.js +0 -18041
@@ -1,9 +1,10 @@
1
- import { onMounted as Se, onBeforeUnmount as Le, ref as A, reactive as O, shallowRef as we, watch as Ie, computed as Y, defineComponent as Re, createElementBlock as C, openBlock as N, renderSlot as ze, useAttrs as ua, nextTick as be, normalizeClass as fe, createElementVNode as x, createBlock as da, mergeProps as ca, toDisplayString as W, Teleport as ya, createCommentVNode as z, withDirectives as ma, vModelText as pa, Fragment as He, renderList as fa, createTextVNode as ha, withModifiers as va, normalizeStyle as ga } from "vue";
1
+ import { onMounted as Le, onBeforeUnmount as Ie, ref as P, reactive as T, shallowRef as we, watch as Te, computed as Y, defineComponent as Re, createElementBlock as k, openBlock as b, renderSlot as Ve, useAttrs as ua, nextTick as Pe, normalizeClass as pe, createElementVNode as x, createBlock as da, mergeProps as ca, toDisplayString as W, Teleport as ma, createCommentVNode as z, withDirectives as ya, vModelText as pa, Fragment as He, renderList as fa, createTextVNode as ha, withModifiers as va, normalizeStyle as ga } from "vue";
2
2
  import { useRoute as Da, useRouter as wa } from "vue-router";
3
- import { useCoreStore as Ve } from "@feedmepos/mf-common";
4
- import { g, b as f, u as Ha } from "./restaurant-BbYRA_IT.js";
5
- import { E as Pe, u as Ke } from "./employee-Ctnil3cD.js";
6
- function Kn(e) {
3
+ import { useCoreStore as Ke } from "@feedmepos/mf-common";
4
+ import { g as w, b as v, u as Ha } from "./restaurant-BbYRA_IT.js";
5
+ import { E as be, u as Ge } from "./employee-kAmYgyIB.js";
6
+ import { t as Oe, q as Aa } from "./rule-DkjcuvBR.js";
7
+ function Qn(e) {
7
8
  let a = null;
8
9
  function t() {
9
10
  if (!a) return;
@@ -11,104 +12,104 @@ function Kn(e) {
11
12
  const n = a.getBoundingClientRect().top;
12
13
  a.style.height = `${Math.max(0, window.innerHeight - n)}px`;
13
14
  }
14
- Se(() => {
15
+ Le(() => {
15
16
  var n;
16
17
  a = ((n = e.value) == null ? void 0 : n.closest(".sch-page")) ?? null, t(), window.addEventListener("resize", t);
17
- }), Le(() => {
18
+ }), Ie(() => {
18
19
  window.removeEventListener("resize", t), a && (a.style.height = "");
19
20
  });
20
21
  }
21
- function Ne(e) {
22
+ function ke(e) {
22
23
  const [a, t] = String(e || "0:0").split(":").map(Number);
23
24
  return (Number.isFinite(a) ? a : 0) * 60 + (Number.isFinite(t) ? t : 0);
24
25
  }
25
- function Aa(e) {
26
+ function Ea(e) {
26
27
  const a = Math.max(0, Math.min(1439, Math.round(e)));
27
28
  return `${String(Math.floor(a / 60)).padStart(2, "0")}:${String(a % 60).padStart(2, "0")}`;
28
29
  }
29
- function Ea(e, a) {
30
- const t = Ne(e);
31
- let n = Ne(a);
30
+ function Pa(e, a) {
31
+ const t = ke(e);
32
+ let n = ke(a);
32
33
  return n <= t && (n += 1440), [t, n];
33
34
  }
34
- function Ge(e, a) {
35
- const [t, n] = Ea(e, a);
35
+ function je(e, a) {
36
+ const [t, n] = Pa(e, a);
36
37
  return Math.max(0, n - t);
37
38
  }
38
39
  function ba(e) {
39
- const a = (Ne(e) % 1440 + 1440) % 1440, t = Math.floor(a / 60), n = a % 60, i = t < 12 ? "am" : "pm", o = t % 12 || 12;
40
+ const a = (ke(e) % 1440 + 1440) % 1440, t = Math.floor(a / 60), n = a % 60, i = t < 12 ? "am" : "pm", o = t % 12 || 12;
40
41
  return n ? `${o}:${String(n).padStart(2, "0")}${i}` : `${o}${i}`;
41
42
  }
42
- function Gn(e) {
43
- return ba(Aa(e % 1440));
43
+ function Xn(e) {
44
+ return ba(Ea(e % 1440));
44
45
  }
45
- function je(e) {
46
+ function Qe(e) {
46
47
  const a = Array.isArray(e) ? e : e == null ? void 0 : e.breaks;
47
48
  return a != null && a.length ? a.reduce((t, n) => {
48
49
  if (n.type === "DURATION") return t + n.minutes;
49
- const [i, o] = n.startTime.split(":").map(Number), [l, s] = n.endTime.split(":").map(Number);
50
- let u = l * 60 + s - (i * 60 + o);
51
- return u < 0 && (u += 24 * 60), t + u;
50
+ const [i, o] = n.startTime.split(":").map(Number), [r, s] = n.endTime.split(":").map(Number);
51
+ let d = r * 60 + s - (i * 60 + o);
52
+ return d < 0 && (d += 24 * 60), t + d;
52
53
  }, 0) : Math.max(0, e && !Array.isArray(e) ? e.breakMins ?? 0 : 0);
53
54
  }
54
- function jn(e, a) {
55
+ function Jn(e, a) {
55
56
  var i;
56
- const t = a ?? Ge(e.start, e.end), n = (i = e.breaks) != null && i.length ? e.breaks.reduce((o, l) => o + (l.breakPayType === "UNPAID" ? je([l]) : 0), 0) : Math.max(0, e.breakMins ?? 0);
57
+ const t = a ?? je(e.start, e.end), n = (i = e.breaks) != null && i.length ? e.breaks.reduce((o, r) => o + (r.breakPayType === "UNPAID" ? Qe([r]) : 0), 0) : Math.max(0, e.breakMins ?? 0);
57
58
  return Math.max(0, t - Math.min(t, n));
58
59
  }
59
- function Qn(e) {
60
+ function Zn(e) {
60
61
  const a = Math.max(0, Math.round(e ?? 0));
61
62
  return a ? [{ type: "DURATION", minutes: a, breakPayType: "UNPAID" }] : [];
62
63
  }
63
- const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
64
+ const te = 500, ka = 10, $e = 6, qn = 1500, Xe = 1e6, H = {
64
65
  async listEmployeeProfiles(e) {
65
- return g(
66
- await f("schedules").get("employees", {
66
+ return w(
67
+ await v("schedules").get("employees", {
67
68
  params: e != null && e.length ? { ids: e.join(",") } : void 0
68
69
  })
69
70
  );
70
71
  },
71
72
  async listEmployeeConfigs(e) {
72
- return g(
73
- await f(`restaurants/${e}/schedules`).get("employee-configs")
73
+ return w(
74
+ await v(`restaurants/${e}/schedules`).get("employee-configs")
74
75
  );
75
76
  },
76
77
  async saveEmployeeConfigs(e, a) {
77
- return g(
78
- await f(`restaurants/${e}/schedules`).post(
78
+ return w(
79
+ await v(`restaurants/${e}/schedules`).post(
79
80
  "employee-configs/reorder",
80
81
  a
81
82
  )
82
83
  );
83
84
  },
84
85
  async getSettings(e) {
85
- return g(
86
- await f(`restaurants/${e}/schedules`).get("settings")
86
+ return w(
87
+ await v(`restaurants/${e}/schedules`).get("settings")
87
88
  );
88
89
  },
89
90
  async saveSettings(e, a) {
90
- return g(
91
- await f(`restaurants/${e}/schedules`).post("settings", a)
91
+ return w(
92
+ await v(`restaurants/${e}/schedules`).post("settings", a)
92
93
  );
93
94
  },
94
95
  async generateAutoSchedule(e, a) {
95
- return g(
96
- await f(`restaurants/${e}/schedules`).post(
96
+ return w(
97
+ await v(`restaurants/${e}/schedules`).post(
97
98
  "auto-schedule/generate",
98
99
  a
99
100
  )
100
101
  );
101
102
  },
102
103
  async getAutoScheduleCapabilities(e) {
103
- return g(
104
- await f(`restaurants/${e}/schedules`).get(
104
+ return w(
105
+ await v(`restaurants/${e}/schedules`).get(
105
106
  "auto-schedule/capabilities"
106
107
  )
107
108
  );
108
109
  },
109
110
  async applyAutoSchedule(e, a) {
110
- return g(
111
- await f(`restaurants/${e}/schedules`).post(
111
+ return w(
112
+ await v(`restaurants/${e}/schedules`).post(
112
113
  "auto-schedule/apply",
113
114
  a
114
115
  )
@@ -116,75 +117,75 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
116
117
  },
117
118
  /** One outlet's whole board over `[from, to]` (inclusive, 'YYYY-MM-DD'). */
118
119
  async readBoard(e, a, t) {
119
- return g(
120
- await f(`restaurants/${e}/schedules`).get("board", {
120
+ return w(
121
+ await v(`restaurants/${e}/schedules`).get("board", {
121
122
  params: { from: a, to: t }
122
123
  })
123
124
  );
124
125
  },
125
126
  async createTimeOff(e, a) {
126
- return g(
127
- await f(`restaurants/${e}/schedules`).post("time-off", a)
127
+ return w(
128
+ await v(`restaurants/${e}/schedules`).post("time-off", a)
128
129
  );
129
130
  },
130
131
  async updateTimeOffStatus(e, a, t) {
131
- return g(
132
- await f(`restaurants/${e}/schedules`).post(
132
+ return w(
133
+ await v(`restaurants/${e}/schedules`).post(
133
134
  `time-off/${a}/status`,
134
135
  t
135
136
  )
136
137
  );
137
138
  },
138
139
  async deleteTimeOff(e, a) {
139
- await f(`restaurants/${e}/schedules`).delete(`time-off/${a}`);
140
+ await v(`restaurants/${e}/schedules`).delete(`time-off/${a}`);
140
141
  },
141
142
  /** Creates or updates the employee's shared business-level scheduling profile. */
142
143
  async createEmployeeProfile(e, a) {
143
- return g(await f("schedules").post("employees", a));
144
+ return w(await v("schedules").post("employees", a));
144
145
  },
145
146
  /** Edits the employee's shared business-level scheduling profile. */
146
147
  async updateEmployeeProfile(e, a, t) {
147
- return g(
148
- await f("schedules").post("employees", { employeeId: a, ...t })
148
+ return w(
149
+ await v("schedules").post("employees", { employeeId: a, ...t })
149
150
  );
150
151
  },
151
152
  async validatePosAccess(e) {
152
- await f("schedules").post("employees/validate-pos-access", e);
153
+ await v("schedules").post("employees/validate-pos-access", e);
153
154
  },
154
155
  /** Positions are shared across the business. */
155
156
  async createPosition(e) {
156
- return g(await f("schedules").post("positions", e));
157
+ return w(await v("schedules").post("positions", e));
157
158
  },
158
159
  async updatePosition(e, a) {
159
- return g(await f("schedules").post(`positions/${e}`, a));
160
+ return w(await v("schedules").post(`positions/${e}`, a));
160
161
  },
161
162
  /** Deleting one position is `deletePositions` with a single-id array — the backend's
162
163
  * `DELETE positions/:id` route is gone; this is now `DELETE positions?ids=`. */
163
164
  async deletePosition(e) {
164
- await f("schedules").delete("positions", {
165
+ await v("schedules").delete("positions", {
165
166
  params: { ids: e }
166
167
  });
167
168
  },
168
169
  /** Creates one flat demand interval. */
169
170
  async createDemand(e, a) {
170
- return g(
171
- await f(`restaurants/${e}/schedules`).post("demands", a)
171
+ return w(
172
+ await v(`restaurants/${e}/schedules`).post("demands", a)
172
173
  );
173
174
  },
174
175
  /** Deletes a batch of demands in one request — e.g. `saveDemand` replacing a whole
175
176
  * day/weekday's demand rows wholesale. Deleting one demand is just this with a single-id
176
177
  * array. */
177
178
  async deleteDemands(e, a) {
178
- return g(
179
- await f(`restaurants/${e}/schedules`).delete("demands", {
179
+ return w(
180
+ await v(`restaurants/${e}/schedules`).delete("demands", {
180
181
  params: { ids: a.join(",") }
181
182
  })
182
183
  );
183
184
  },
184
185
  /** Atomically replaces one date/weekday's flattened demand rows. */
185
186
  async replaceDemands(e, a) {
186
- return g(
187
- await f(`restaurants/${e}/schedules`).post(
187
+ return w(
188
+ await v(`restaurants/${e}/schedules`).post(
188
189
  "demands/replace",
189
190
  a
190
191
  )
@@ -192,8 +193,8 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
192
193
  },
193
194
  /** Atomically replaces several date/weekday demand generations. */
194
195
  async bulkReplaceDemands(e, a) {
195
- return g(
196
- await f(`restaurants/${e}/schedules`).post(
196
+ return w(
197
+ await v(`restaurants/${e}/schedules`).post(
197
198
  "demands/bulk-replace",
198
199
  a
199
200
  )
@@ -201,8 +202,8 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
201
202
  },
202
203
  /** Replaces one date's note/holiday-mark. All three fields back to empty/false clears it. */
203
204
  async saveScheduleDay(e, a, t) {
204
- return g(
205
- await f(`restaurants/${e}/schedules`).post(
205
+ return w(
206
+ await v(`restaurants/${e}/schedules`).post(
206
207
  `days/${a}`,
207
208
  t
208
209
  )
@@ -210,13 +211,13 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
210
211
  },
211
212
  /** A one-off shift assignment. */
212
213
  async createAssignment(e, a) {
213
- return g(
214
- await f(`restaurants/${e}/schedules`).post("assignments", a)
214
+ return w(
215
+ await v(`restaurants/${e}/schedules`).post("assignments", a)
215
216
  );
216
217
  },
217
218
  async updateAssignment(e, a, t) {
218
- return g(
219
- await f(`restaurants/${e}/schedules`).patch(
219
+ return w(
220
+ await v(`restaurants/${e}/schedules`).patch(
220
221
  `assignments/${a}`,
221
222
  t
222
223
  )
@@ -224,8 +225,8 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
224
225
  },
225
226
  /** Atomically applies assignment updates, creates, and deletes used by moves and swaps. */
226
227
  async bulkSaveAssignments(e, a) {
227
- return g(
228
- await f(`restaurants/${e}/schedules`).post(
228
+ return w(
229
+ await v(`restaurants/${e}/schedules`).post(
229
230
  "assignments/bulk",
230
231
  a
231
232
  )
@@ -235,8 +236,8 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
235
236
  * getting replaced wholesale. Deleting one assignment is just this with a single-id
236
237
  * array. */
237
238
  async deleteAssignments(e, a) {
238
- return g(
239
- await f(`restaurants/${e}/schedules`).delete("assignments", {
239
+ return w(
240
+ await v(`restaurants/${e}/schedules`).delete("assignments", {
240
241
  params: { ids: a.join(",") }
241
242
  })
242
243
  );
@@ -244,37 +245,37 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
244
245
  /** Flips a batch of assignments to one status in a single request — e.g. Publish sending
245
246
  * every DRAFT shift on the board to PUBLISHED at once. */
246
247
  async bulkUpdateAssignmentStatus(e, a) {
247
- return g(
248
- await f(`restaurants/${e}/schedules`).patch(
248
+ return w(
249
+ await v(`restaurants/${e}/schedules`).patch(
249
250
  "assignments/bulk-status",
250
251
  a
251
252
  )
252
253
  );
253
254
  }
254
- }, Xe = {
255
+ }, Je = {
255
256
  payload: we(null),
256
- loading: A(!1),
257
- rosterLoading: A(!1),
258
- loadError: A(null),
259
- scheduleSetupCompleted: A(!1),
260
- dataVersion: A(0),
261
- outletId: A(""),
262
- restaurantEmployees: A([]),
263
- employeeConfigs: A([]),
257
+ loading: P(!1),
258
+ rosterLoading: P(!1),
259
+ loadError: P(null),
260
+ scheduleSetupCompleted: P(!1),
261
+ dataVersion: P(0),
262
+ outletId: P(""),
263
+ restaurantEmployees: P([]),
264
+ employeeConfigs: P([]),
264
265
  employeeOutletIds: we({}),
265
266
  businessEmployees: we([]),
266
- positions: O([]),
267
- positionRecords: O([]),
268
- rolePositions: O({}),
269
- outlet: O({ name: "" }),
270
- locationOptions: O([]),
271
- locationLabelById: O({}),
272
- departmentOptions: O([]),
273
- compensationGroupOptions: O([]),
274
- compensationGroupMeta: O({}),
275
- existingStaff: O([]),
276
- shiftTemplates: O([]),
277
- rules: O({
267
+ positions: T([]),
268
+ positionRecords: T([]),
269
+ rolePositions: T({}),
270
+ outlet: T({ name: "" }),
271
+ locationOptions: T([]),
272
+ locationLabelById: T({}),
273
+ departmentOptions: T([]),
274
+ compensationGroupOptions: T([]),
275
+ compensationGroupMeta: T({}),
276
+ existingStaff: T([]),
277
+ shiftTemplates: T([]),
278
+ rules: T({
278
279
  coverage: {},
279
280
  openFrom: "00:00",
280
281
  openTo: "24:00",
@@ -290,7 +291,11 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
290
291
  budgetFromSales: !1,
291
292
  budget: 0,
292
293
  otCapHours: null,
293
- workingHours: { minHoursPerDay: null, maxHoursPerDay: 8, maxHoursPerWeek: 45 },
294
+ workingHours: {
295
+ minHoursPerDay: null,
296
+ maxHoursPerDay: 8,
297
+ maxHoursPerWeek: 45
298
+ },
294
299
  otBudget: 0,
295
300
  notify: {
296
301
  waConnected: !1,
@@ -300,43 +305,47 @@ const ae = 500, Pa = 10, Te = 6, Xn = 1500, Qe = 1e6, D = {
300
305
  }
301
306
  })
302
307
  }, {
303
- payload: c,
304
- loading: $e,
305
- rosterLoading: xe,
306
- loadError: he,
307
- scheduleSetupCompleted: Je,
308
- dataVersion: K,
308
+ payload: l,
309
+ loading: xe,
310
+ rosterLoading: Ye,
311
+ loadError: fe,
312
+ scheduleSetupCompleted: Ze,
313
+ dataVersion: G,
309
314
  outletId: m,
310
- restaurantEmployees: ie,
315
+ restaurantEmployees: re,
311
316
  employeeConfigs: F,
312
- employeeOutletIds: Ze,
317
+ employeeOutletIds: qe,
313
318
  businessEmployees: Ae,
314
319
  positions: Na,
315
320
  positionRecords: B,
316
- rolePositions: Jn,
317
- outlet: ka,
318
- locationOptions: Ye,
319
- locationLabelById: ne,
320
- compensationGroupMeta: Zn,
321
- existingStaff: qn,
322
- shiftTemplates: eo,
323
- rules: M
324
- } = Xe;
325
- function Ca() {
326
- const e = Xe.rules;
327
- Object.keys(e.coverage).forEach((a) => delete e.coverage[a]), e.openFrom = "00:00", e.openTo = "24:00", e.dayHours.splice(0, e.dayHours.length, ...Array.from({ length: 7 }, () => [])), Object.assign(e.payRate.NORMAL, { overtime: 1.5 }), Object.assign(e.payRate.REST_DAY, { regular: 1, overtime: 2 }), Object.assign(e.payRate.PUBLIC_HOLIDAY, { regular: 2, overtime: 3 }), e.salesForecast = 0, e.closedWeekdays.splice(0, e.closedWeekdays.length), e.labourTarget = 0, e.budgetFromSales = !1, e.budget = 0, e.otCapHours = null, e.workingHours = { minHoursPerDay: null, maxHoursPerDay: 8, maxHoursPerWeek: 45 }, e.otBudget = 0, Object.assign(e.notify, {
321
+ rolePositions: eo,
322
+ outlet: Ca,
323
+ locationOptions: Be,
324
+ locationLabelById: oe,
325
+ compensationGroupMeta: ao,
326
+ existingStaff: to,
327
+ shiftTemplates: no,
328
+ rules: N
329
+ } = Je;
330
+ function Ma() {
331
+ const e = Je.rules;
332
+ Object.keys(e.coverage).forEach((a) => delete e.coverage[a]), e.openFrom = "00:00", e.openTo = "24:00", e.dayHours.splice(0, e.dayHours.length, ...Array.from({ length: 7 }, () => [])), Object.assign(e.payRate.NORMAL, { overtime: 1.5 }), Object.assign(e.payRate.REST_DAY, { regular: 1, overtime: 2 }), Object.assign(e.payRate.PUBLIC_HOLIDAY, { regular: 2, overtime: 3 }), e.salesForecast = 0, e.closedWeekdays.splice(0, e.closedWeekdays.length), e.labourTarget = 0, e.budgetFromSales = !1, e.budget = 0, e.otCapHours = null, e.workingHours = {
333
+ minHoursPerDay: null,
334
+ maxHoursPerDay: 8,
335
+ maxHoursPerWeek: 45
336
+ }, e.otBudget = 0, Object.assign(e.notify, {
328
337
  waConnected: !1,
329
338
  waNumber: "",
330
339
  waDisplayName: "",
331
340
  defaults: { wa: !1, push: !1, email: !1 }
332
341
  });
333
342
  }
334
- const ke = 7;
335
- function Ma(e) {
343
+ const Ne = 7;
344
+ function Sa(e) {
336
345
  const a = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
337
346
  return `${a}-${t}-${n}`;
338
347
  }
339
- function oe(e, a) {
348
+ function se(e, a) {
340
349
  const t = new Date(e);
341
350
  return t.setDate(t.getDate() + a), t;
342
351
  }
@@ -344,58 +353,66 @@ function Ce(e) {
344
353
  const a = new Date(e);
345
354
  return a.setHours(0, 0, 0, 0), a.setDate(a.getDate() - (a.getDay() + 6) % 7), a;
346
355
  }
347
- function ao(e, a = /* @__PURE__ */ new Date()) {
348
- const t = oe(Ce(a), e * ke);
349
- return Array.from({ length: ke }, (n, i) => oe(t, i));
356
+ function oo(e, a = /* @__PURE__ */ new Date()) {
357
+ const t = se(Ce(a), e * Ne);
358
+ return Array.from({ length: Ne }, (n, i) => se(t, i));
350
359
  }
351
- function to(e, a) {
360
+ function so(e, a) {
352
361
  const t = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), n = t(Ce(e)), i = t(Ce(a));
353
- return Math.trunc((i - n) / (ke * 24 * 60 * 60 * 1e3));
362
+ return Math.trunc((i - n) / (Ne * 24 * 60 * 60 * 1e3));
354
363
  }
355
- const re = Ma;
356
- let G = null, j = null, V = null, te = 0, ve = null;
357
- function Be(e) {
358
- return e === m.value ? !1 : (Ca(), m.value = e, c.value = null, G = null, j = null, he.value = null, ve = null, Je.value = !1, ie.value = [], F.value = [], V = null, te += 1, K.value += 1, !0);
364
+ const j = Sa;
365
+ let Q = null, X = null, V = null, ne = 0, he = null;
366
+ function _e(e) {
367
+ return e === m.value ? !1 : (Ma(), m.value = e, l.value = null, Q = null, X = null, fe.value = null, he = null, Ze.value = !1, re.value = [], F.value = [], V = null, ne += 1, G.value += 1, !0);
359
368
  }
360
369
  async function Me(e) {
361
- if (!(!e || ve === e)) {
362
- xe.value = !0;
370
+ if (!(!e || he === e)) {
371
+ Ye.value = !0;
363
372
  try {
364
- await Sa(e);
373
+ await La(e);
365
374
  } finally {
366
- xe.value = !1;
375
+ Ye.value = !1;
367
376
  }
368
377
  }
369
378
  }
370
- async function Sa(e) {
371
- const a = await Pe.readEmployeesPage({
372
- limit: ae,
379
+ async function La(e) {
380
+ const a = await be.readEmployeesPage({
381
+ limit: te,
373
382
  offset: 0,
374
383
  restaurantIds: [e]
375
384
  });
376
- e === m.value && (ie.value = a.items, F.value = await D.listEmployeeConfigs(e), ve = e, K.value += 1, Oa().then((t) => {
377
- e === m.value && (Ze.value = t, K.value += 1);
385
+ e === m.value && (re.value = a.items, F.value = await H.listEmployeeConfigs(e), he = e, G.value += 1, $a().then((t) => {
386
+ e === m.value && (qe.value = t, G.value += 1);
378
387
  }));
379
388
  }
380
- async function La(e) {
389
+ async function Ia(e) {
381
390
  const a = m.value;
382
391
  if (!a || !e.length) return;
383
- const t = await D.saveEmployeeConfigs(a, { configs: e });
384
- F.value = t, K.value += 1;
392
+ const t = await H.saveEmployeeConfigs(a, { configs: e });
393
+ F.value = t, G.value += 1;
385
394
  }
386
- async function Ia(e, a) {
395
+ async function io(e) {
396
+ const a = m.value;
397
+ if (!a) throw new Error("No outlet selected");
398
+ const t = await H.saveSettings(a, e);
399
+ return m.value === a && l.value && (l.value = { ...l.value, settings: t }), t;
400
+ }
401
+ async function Ta(e, a) {
387
402
  const t = F.value.find((i) => i.employeeId === e), n = (t == null ? void 0 : t.displayOrder) ?? (a && F.value.some((i) => i.displayOrder !== null) ? Math.max(
388
403
  0,
389
- ...F.value.filter((i) => i.displayOrder !== null).map((i) => i.displayOrder)
404
+ ...F.value.filter(
405
+ (i) => i.displayOrder !== null
406
+ ).map((i) => i.displayOrder)
390
407
  ) + 100 : null);
391
- await La([{ employeeId: e, enabled: a, displayOrder: n }]);
408
+ await Ia([{ employeeId: e, enabled: a, displayOrder: n }]);
392
409
  }
393
- async function Oe() {
410
+ async function Se() {
394
411
  const e = m.value;
395
- e && (ve = null, await Me(e));
412
+ e && (he = null, await Me(e));
396
413
  }
397
- async function qe(e, a) {
398
- const t = Ke(), n = (await le(!0)).find((s) => s._id === e);
414
+ async function Ra(e, a) {
415
+ const t = Ge(), n = (await K(!0)).find((s) => s._id === e);
399
416
  if (!n) throw new Error("Could not find this employee");
400
417
  const i = n.restaurantRole.map((s) => ({
401
418
  restaurantId: s.restaurantId,
@@ -413,82 +430,92 @@ async function qe(e, a) {
413
430
  user: { name: n.name, passcode: n.passcode },
414
431
  roles: o,
415
432
  previousRoles: i
416
- }), await le(!0);
417
- }
418
- async function no(e, a, t = "") {
419
- const n = [...new Set(a.filter(Boolean))];
420
- n.length && (await qe(e, (i) => [
421
- ...i.filter((o) => !n.includes(o.restaurantId)),
422
- ...n.map((o) => ({ restaurantId: o, roleId: t }))
423
- ]), m.value && n.includes(m.value) && await Ia(e, !0), await Oe());
424
- }
425
- async function oo(e, a) {
426
- if (!a.length) return;
427
- const t = new Map(a.map((n) => [n.restaurantId, n.roleId]));
428
- await qe(e, (n) => [
429
- ...n.filter((i) => !t.has(i.restaurantId)),
430
- ...[...t.entries()].map(([i, o]) => ({ restaurantId: i, roleId: o }))
431
- ]), await Oe();
432
- }
433
- async function so(e, a) {
434
- const t = Ke(), n = (await le(!0)).find((u) => u._id === e);
433
+ }), await K(!0);
434
+ }
435
+ async function ro(e, a, t = "", n = !0) {
436
+ const i = [...new Set(a.filter(Boolean))];
437
+ i.length && (await Ra(e, (o) => [
438
+ ...o.filter((r) => !i.includes(r.restaurantId)),
439
+ ...i.map((r) => ({ restaurantId: r, roleId: t }))
440
+ ]), n && m.value && i.includes(m.value) && await Ta(e, !0), await Se());
441
+ }
442
+ async function lo(e, a) {
443
+ const t = Ge(), n = (await K(!0)).find(
444
+ (p) => p._id === e
445
+ );
435
446
  if (!n) throw new Error("Could not find this employee");
436
- const i = (u) => u.slice().sort((v, E) => v.restaurantId.localeCompare(E.restaurantId)).map((v) => `${v.restaurantId}:${v.roleId}`).join("|"), o = i(n.restaurantRole) !== i(a.roles), l = n.passcode !== a.passcode || n.isMasterUser !== a.masterUser || a.masterUser && (n.code ?? "") !== a.masterCode;
437
- if (!o && !l) return;
438
- const s = n.restaurantRole.map((u) => ({
439
- restaurantId: u.restaurantId,
440
- roleId: u.roleId
441
- }));
447
+ const i = (p) => p.slice().sort((g, C) => g.restaurantId.localeCompare(C.restaurantId)).map((g) => `${g.restaurantId}:${g.roleId}`).join("|"), o = i(n.restaurantRole) !== i(a.roles), r = n.name !== a.name || n.passcode !== a.passcode || n.isMasterUser !== a.masterUser || a.masterUser && (n.code ?? "") !== a.masterCode;
448
+ if (!o && !r) return;
449
+ const s = n.restaurantRole.map((p) => ({
450
+ restaurantId: p.restaurantId,
451
+ roleId: p.roleId
452
+ })), d = n.isMasterUser ? (await Oe.readTeamMembers()).find((p) => p.doc.posUserId === e) : void 0;
453
+ if (d) {
454
+ const p = Aa(), g = p.getPermissionAssignmentByUserId(d.id) ?? await p.readPermissionAssignmentByUserId(d.id), C = a.masterUser ? {
455
+ code: a.masterCode,
456
+ name: a.name,
457
+ passcode: a.passcode,
458
+ roles: a.roles
459
+ } : null;
460
+ await Oe.updateTeamMember(d.id, {
461
+ permissions: d.permissions,
462
+ customPermissions: (g == null ? void 0 : g.customPermissions) ?? d.permissions,
463
+ permissionSetIds: (g == null ? void 0 : g.permissionSetIds) ?? d.doc.permissionSetIds ?? [],
464
+ posUser: C
465
+ }), await K(!0), await Se();
466
+ return;
467
+ }
442
468
  if (a.masterUser) {
443
- const u = {
469
+ const p = {
444
470
  user: { name: a.name, passcode: a.passcode, code: a.masterCode },
445
471
  roles: a.roles,
446
472
  previousRoles: s
447
473
  };
448
- n.isMasterUser ? await t.updateMasterEmployee(e, u) : await t.migrateToMasterUser(e, u);
449
- } else {
450
- if (n.isMasterUser)
451
- throw new Error("Master users cannot be converted back from this form");
452
- await t.updateEmployee(e, {
474
+ n.isMasterUser ? await t.updateMasterEmployee(e, p) : await t.migrateToMasterUser(e, p);
475
+ } else
476
+ n.isMasterUser ? await t.updateMasterEmployee(e, {
477
+ user: { name: n.name, passcode: n.passcode, code: n.code ?? "" },
478
+ roles: [],
479
+ previousRoles: s
480
+ }) : await t.updateEmployee(e, {
453
481
  user: { name: a.name, passcode: a.passcode },
454
482
  roles: a.roles,
455
483
  previousRoles: s
456
484
  });
457
- }
458
- await le(!0), await Oe();
485
+ await K(!0), await Se();
459
486
  }
460
- let ee = null;
461
- async function Ra() {
462
- const e = await Pe.readEmployeesPage({
463
- limit: ae,
487
+ let ae = null;
488
+ async function Oa() {
489
+ const e = await be.readEmployeesPage({
490
+ limit: te,
464
491
  offset: 0,
465
492
  includeEmptyPasscode: !0
466
- }), a = Math.min(Pa, Math.ceil(e.total / ae)), t = await Promise.all(
493
+ }), a = Math.min(ka, Math.ceil(e.total / te)), t = await Promise.all(
467
494
  Array.from(
468
495
  { length: Math.max(0, a - 1) },
469
- (n, i) => Pe.readEmployeesPage({
470
- limit: ae,
471
- offset: (i + 1) * ae,
496
+ (n, i) => be.readEmployeesPage({
497
+ limit: te,
498
+ offset: (i + 1) * te,
472
499
  includeEmptyPasscode: !0
473
500
  })
474
501
  )
475
502
  );
476
503
  return [...e.items, ...t.flatMap((n) => n.items)];
477
504
  }
478
- function le(e = !1) {
505
+ function K(e = !1) {
479
506
  if (!e) {
480
- if (ee) return ee;
507
+ if (ae) return ae;
481
508
  if (Ae.value.length) return Promise.resolve(Ae.value);
482
509
  }
483
- const a = Ra().then((t) => (Ae.value = t, t)).finally(() => {
484
- ee === a && (ee = null);
510
+ const a = Oa().then((t) => (Ae.value = t, t)).finally(() => {
511
+ ae === a && (ae = null);
485
512
  });
486
- return ee = a, a;
513
+ return ae = a, a;
487
514
  }
488
- async function Oa() {
515
+ async function $a() {
489
516
  const e = {};
490
517
  try {
491
- (await le()).forEach((a) => {
518
+ (await K()).forEach((a) => {
492
519
  e[a._id] = [...new Set(a.restaurantRole.map((t) => t.restaurantId))];
493
520
  });
494
521
  } catch {
@@ -496,91 +523,91 @@ async function Oa() {
496
523
  }
497
524
  return e;
498
525
  }
499
- function _e(e, a) {
500
- return G !== null && j !== null && G <= e && j >= a;
526
+ function Fe(e, a) {
527
+ return Q !== null && X !== null && Q <= e && X >= a;
501
528
  }
502
- async function Ta(e) {
503
- const a = re(e), t = re(oe(e, 6));
504
- _e(a, t) || V && (await V, _e(a, t)) || await ea(
505
- oe(e, -7 * Te),
506
- oe(e, 7 * Te)
529
+ async function xa(e) {
530
+ const a = j(e), t = j(se(e, 6));
531
+ Fe(a, t) || V && (await V, Fe(a, t)) || await ea(
532
+ se(e, -7 * $e),
533
+ se(e, 7 * $e)
507
534
  );
508
535
  }
509
- async function io() {
510
- !G || !j || await ea(/* @__PURE__ */ new Date(`${G}T00:00:00`), /* @__PURE__ */ new Date(`${j}T00:00:00`));
536
+ async function uo() {
537
+ !Q || !X || await ea(/* @__PURE__ */ new Date(`${Q}T00:00:00`), /* @__PURE__ */ new Date(`${X}T00:00:00`));
511
538
  }
512
- async function ro(e) {
539
+ async function co(e) {
513
540
  if (!m.value) throw new Error("No outlet selected");
514
- const a = await D.createEmployeeProfile(m.value, e);
515
- c.value && (c.value.employees.push(a), K.value += 1);
541
+ const a = await H.createEmployeeProfile(m.value, e);
542
+ l.value && (l.value.employees.push(a), G.value += 1);
516
543
  }
517
- async function lo(e) {
518
- await D.validatePosAccess(e);
544
+ async function mo(e) {
545
+ await H.validatePosAccess(e);
519
546
  }
520
- async function uo(e, a) {
547
+ async function yo(e, a) {
521
548
  if (!m.value) throw new Error("No outlet selected");
522
- const t = await D.updateEmployeeProfile(m.value, e, a);
523
- if (c.value) {
524
- const n = c.value.employees.findIndex((i) => i.employeeId === e);
525
- n > -1 && (c.value = {
526
- ...c.value,
527
- employees: c.value.employees.map((i, o) => o === n ? t : i)
549
+ const t = await H.updateEmployeeProfile(m.value, e, a);
550
+ if (l.value) {
551
+ const n = l.value.employees.findIndex((i) => i.employeeId === e);
552
+ n > -1 && (l.value = {
553
+ ...l.value,
554
+ employees: l.value.employees.map((i, o) => o === n ? t : i)
528
555
  });
529
556
  }
530
557
  }
531
- async function co(e) {
532
- const a = await D.createPosition(e);
533
- c.value && (c.value = { ...c.value, positions: [...c.value.positions, a] });
534
- }
535
- async function yo(e, a) {
536
- const t = await D.updatePosition(e, a);
537
- if (c.value) {
538
- const n = c.value.positions.find((o) => o.id === e), i = (o) => o.positionId === e || !o.positionId && o.positionName === (n == null ? void 0 : n.name);
539
- c.value = {
540
- ...c.value,
541
- positions: c.value.positions.map((o) => o.id === e ? t : o),
542
- employees: c.value.employees.map((o) => ({
558
+ async function po(e) {
559
+ const a = await H.createPosition(e);
560
+ l.value && (l.value = { ...l.value, positions: [...l.value.positions, a] });
561
+ }
562
+ async function fo(e, a) {
563
+ const t = await H.updatePosition(e, a);
564
+ if (l.value) {
565
+ const n = l.value.positions.find((o) => o.id === e), i = (o) => o.positionId === e || !o.positionId && o.positionName === (n == null ? void 0 : n.name);
566
+ l.value = {
567
+ ...l.value,
568
+ positions: l.value.positions.map((o) => o.id === e ? t : o),
569
+ employees: l.value.employees.map((o) => ({
543
570
  ...o,
544
571
  primaryPosition: o.primaryPosition && i(o.primaryPosition) ? { ...o.primaryPosition, positionName: t.name } : o.primaryPosition,
545
572
  secondaryPositions: o.secondaryPositions.map(
546
- (l) => i(l) ? { ...l, positionName: t.name } : l
573
+ (r) => i(r) ? { ...r, positionName: t.name } : r
547
574
  )
548
575
  }))
549
576
  };
550
577
  }
551
578
  }
552
- async function mo(e) {
553
- await D.deletePosition(e), c.value && (c.value = {
554
- ...c.value,
555
- positions: c.value.positions.filter((a) => a.id !== e)
579
+ async function ho(e) {
580
+ await H.deletePosition(e), l.value && (l.value = {
581
+ ...l.value,
582
+ positions: l.value.positions.filter((a) => a.id !== e)
556
583
  });
557
584
  }
558
- async function po(e, a) {
585
+ async function vo(e, a) {
559
586
  var i;
560
587
  if (!m.value) throw new Error("No outlet selected");
561
- const t = (i = c.value) == null ? void 0 : i.days.find((o) => o.date === e), n = await D.saveScheduleDay(m.value, e, {
588
+ const t = (i = l.value) == null ? void 0 : i.days.find((o) => o.date === e), n = await H.saveScheduleDay(m.value, e, {
562
589
  ...a,
563
590
  expectedUpdatedAt: a.expectedUpdatedAt ?? (t == null ? void 0 : t.updatedAt)
564
591
  });
565
- if (c.value) {
566
- const o = c.value.days.filter((l) => l.date !== e);
567
- n && o.push(n), c.value = { ...c.value, days: o };
592
+ if (l.value) {
593
+ const o = l.value.days.filter((r) => r.date !== e);
594
+ n && o.push(n), l.value = { ...l.value, days: o };
568
595
  }
569
596
  }
570
- async function fo(e) {
571
- await xa([e]);
597
+ async function go(e) {
598
+ await Ba([e]);
572
599
  }
573
- function $a(e) {
600
+ function Ya(e) {
574
601
  const a = e.periods.flatMap((t) => {
575
- const n = (t.roles ?? []).filter((l) => l.positionName && l.headcount > 0), i = n.reduce((l, s) => l + s.headcount, 0), o = {
602
+ const n = (t.roles ?? []).filter((r) => r.positionName && r.headcount > 0), i = n.reduce((r, s) => r + s.headcount, 0), o = {
576
603
  startTime: t.startTime,
577
604
  endTime: t.endTime
578
605
  };
579
606
  return [
580
- ...n.map((l) => ({
607
+ ...n.map((r) => ({
581
608
  ...o,
582
- headcount: l.headcount,
583
- position: { positionId: l.positionId, positionName: l.positionName }
609
+ headcount: r.headcount,
610
+ position: { positionId: r.positionId, positionName: r.positionName }
584
611
  })),
585
612
  ...t.headcount > i ? [{ ...o, headcount: t.headcount - i }] : []
586
613
  ];
@@ -590,29 +617,31 @@ function $a(e) {
590
617
  demands: a
591
618
  };
592
619
  }
593
- async function xa(e) {
620
+ async function Ba(e) {
594
621
  if (!m.value) throw new Error("No outlet selected");
595
622
  if (!e.length) return;
596
- const a = e.map($a), t = e.length === 1 ? await D.replaceDemands(m.value, a[0]) : await D.bulkReplaceDemands(m.value, { replacements: a });
597
- if (c.value) {
598
- const n = new Set(e.map((o) => o.date)), i = c.value.demands.filter((o) => o.date === null || !n.has(o.date));
599
- c.value = { ...c.value, demands: [...i, ...t] };
623
+ const a = e.map(Ya), t = e.length === 1 ? await H.replaceDemands(m.value, a[0]) : await H.bulkReplaceDemands(m.value, { replacements: a });
624
+ if (l.value) {
625
+ const n = new Set(e.map((o) => o.date)), i = l.value.demands.filter((o) => o.date === null || !n.has(o.date));
626
+ l.value = { ...l.value, demands: [...i, ...t] };
600
627
  }
601
628
  }
602
- async function ho(e, a) {
629
+ async function Do(e, a) {
603
630
  if (!m.value) throw new Error("No outlet selected");
604
- const t = c.value;
631
+ const t = l.value;
605
632
  if (!t || t.demands.some((o) => o.date === a)) return 0;
606
633
  const n = t.demands.filter((o) => o.date === e);
607
634
  if (!n.length) return 0;
608
635
  const i = await Promise.all(
609
636
  n.map(
610
- (o) => D.createDemand(m.value, {
637
+ (o) => H.createDemand(m.value, {
611
638
  date: a,
612
639
  startTime: o.startTime,
613
640
  endTime: o.endTime,
614
641
  headcount: o.headcount,
615
- ...o.position ? {
642
+ ...o.position && t.positions.some(
643
+ (r) => o.position.positionId ? r.id === o.position.positionId : r.name.toLocaleLowerCase() === o.position.positionName.toLocaleLowerCase()
644
+ ) ? {
616
645
  position: {
617
646
  positionId: o.position.positionId,
618
647
  positionName: o.position.positionName
@@ -621,80 +650,103 @@ async function ho(e, a) {
621
650
  })
622
651
  )
623
652
  );
624
- return c.value && (c.value = { ...c.value, demands: [...c.value.demands, ...i] }), i.length;
653
+ return l.value && (l.value = { ...l.value, demands: [...l.value.demands, ...i] }), i.length;
625
654
  }
626
- async function vo(e) {
655
+ async function wo(e) {
627
656
  if (!m.value) throw new Error("No outlet selected");
628
- return D.generateAutoSchedule(m.value, e);
657
+ return H.generateAutoSchedule(m.value, e);
629
658
  }
630
- async function go() {
659
+ async function Ho() {
631
660
  if (!m.value) throw new Error("No outlet selected");
632
- return D.getAutoScheduleCapabilities(m.value);
661
+ return H.getAutoScheduleCapabilities(m.value);
633
662
  }
634
- async function Do(e) {
663
+ async function Ao(e) {
635
664
  if (!m.value) throw new Error("No outlet selected");
636
- return D.applyAutoSchedule(m.value, e);
665
+ return H.applyAutoSchedule(m.value, e);
637
666
  }
638
- async function wo(e) {
667
+ async function Eo(e) {
639
668
  if (!m.value) throw new Error("No outlet selected");
640
- return D.bulkSaveAssignments(m.value, e);
669
+ const a = await H.bulkSaveAssignments(m.value, e);
670
+ if (l.value) {
671
+ const t = new Set(e.deleteIds), n = new Map(
672
+ l.value.assignments.filter((i) => !t.has(i.id)).map((i) => [i.id, i])
673
+ );
674
+ a.updated.forEach((i) => n.set(i.id, i)), a.created.forEach((i) => n.set(i.id, i)), l.value = { ...l.value, assignments: [...n.values()] };
675
+ }
676
+ return a;
641
677
  }
642
- async function Ho(e) {
678
+ async function Po(e) {
643
679
  if (!m.value) throw new Error("No outlet selected");
644
- e.length && await D.deleteAssignments(m.value, e);
680
+ if (e.length && (await H.deleteAssignments(m.value, e), l.value)) {
681
+ const a = new Set(e);
682
+ l.value = {
683
+ ...l.value,
684
+ assignments: l.value.assignments.filter((t) => !a.has(t.id))
685
+ };
686
+ }
645
687
  }
646
- async function Ao(e) {
688
+ async function bo(e) {
647
689
  if (!m.value) throw new Error("No outlet selected");
648
- const a = await D.createTimeOff(m.value, e);
649
- return c.value && (c.value = { ...c.value, timeOff: [...c.value.timeOff, a] }), a;
690
+ const a = await H.createTimeOff(m.value, e);
691
+ return l.value && (l.value = { ...l.value, timeOff: [...l.value.timeOff, a] }), a;
650
692
  }
651
- async function Eo(e, a) {
693
+ async function ko(e, a) {
652
694
  if (!m.value) throw new Error("No outlet selected");
653
- const t = await D.updateTimeOffStatus(m.value, e, a);
654
- return t && c.value && (c.value = {
655
- ...c.value,
656
- timeOff: c.value.timeOff.map((n) => n.id === e ? t : n)
695
+ const t = await H.updateTimeOffStatus(m.value, e, a);
696
+ return t && l.value && (l.value = {
697
+ ...l.value,
698
+ timeOff: l.value.timeOff.map((n) => n.id === e ? t : n)
657
699
  }), t;
658
700
  }
659
- async function bo(e) {
701
+ async function No(e) {
660
702
  if (!m.value) throw new Error("No outlet selected");
661
- await D.deleteTimeOff(m.value, e), c.value && (c.value = {
662
- ...c.value,
663
- timeOff: c.value.timeOff.filter((a) => a.id !== e)
703
+ await H.deleteTimeOff(m.value, e), l.value && (l.value = {
704
+ ...l.value,
705
+ timeOff: l.value.timeOff.filter((a) => a.id !== e)
664
706
  });
665
707
  }
666
- async function Po(e) {
708
+ async function Co(e) {
667
709
  if (!m.value) throw new Error("No outlet selected");
668
- return D.bulkUpdateAssignmentStatus(m.value, e);
710
+ const a = await H.bulkUpdateAssignmentStatus(m.value, e);
711
+ if (l.value && a.length) {
712
+ const t = new Map(a.map((n) => [n.id, n]));
713
+ l.value = {
714
+ ...l.value,
715
+ assignments: l.value.assignments.map(
716
+ (n) => t.get(n.id) ?? n
717
+ )
718
+ };
719
+ }
720
+ return a;
669
721
  }
670
722
  async function ea(e, a) {
671
723
  const t = m.value;
672
724
  if (!t) {
673
- he.value = "No outlet selected";
725
+ fe.value = "No outlet selected";
674
726
  return;
675
727
  }
676
- const n = re(e), i = re(a), o = ++te;
677
- $e.value = !0, he.value = null;
678
- const l = (async () => {
728
+ const n = j(e), i = j(a), o = ++ne;
729
+ xe.value = !0, fe.value = null;
730
+ const r = (async () => {
679
731
  try {
680
- const s = await D.readBoard(t, n, i);
681
- if (m.value !== t || o !== te) return;
682
- c.value = s, Je.value = s.settings.setupCompleted, G = n, j = i, K.value += 1;
732
+ const s = await H.readBoard(t, n, i);
733
+ if (m.value !== t || o !== ne) return;
734
+ l.value = s, Ze.value = s.settings.setupCompleted, Q = n, X = i, G.value += 1;
683
735
  } catch (s) {
684
- if (m.value !== t || o !== te) return;
685
- he.value = s instanceof Error ? s.message : "Could not load the schedule";
736
+ if (m.value !== t || o !== ne) return;
737
+ fe.value = s instanceof Error ? s.message : "Could not load the schedule";
686
738
  } finally {
687
- m.value === t && o === te && ($e.value = !1);
739
+ m.value === t && o === ne && (xe.value = !1);
688
740
  }
689
741
  })();
690
- V = l;
742
+ V = r;
691
743
  try {
692
- await l;
744
+ await r;
693
745
  } finally {
694
- V === l && (V = null);
746
+ V === r && (V = null);
695
747
  }
696
748
  }
697
- const Ya = "AE", Ba = "Asia/Dubai", _a = {
749
+ const _a = "AE", Fa = "Asia/Dubai", Ua = {
698
750
  NORMAL: {
699
751
  overtime: 1.25
700
752
  },
@@ -706,13 +758,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
706
758
  regular: 2.5,
707
759
  overtime: 1.5
708
760
  }
709
- }, Fa = {
761
+ }, Wa = {
710
762
  maxHoursPerMonth: null
711
- }, Ua = {
712
- minHoursPerDay: null,
713
- maxHoursPerDay: 8,
714
- maxHoursPerWeek: 48
715
- }, Wa = [
763
+ }, za = {
764
+ fullTime: {
765
+ minHoursPerDay: null,
766
+ maxHoursPerDay: 8,
767
+ maxHoursPerWeek: 48
768
+ },
769
+ partTime: {
770
+ maxHoursPerWeek: 32
771
+ }
772
+ }, Va = [
716
773
  {
717
774
  month: 1,
718
775
  day: 1,
@@ -728,7 +785,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
728
785
  day: 3,
729
786
  name: "UAE National Day Holiday"
730
787
  }
731
- ], za = {
788
+ ], Ka = {
732
789
  2026: {
733
790
  "2026-01-01": "Gregorian New Year",
734
791
  "2026-03-20": "Eid Al-Fitr Holiday",
@@ -758,15 +815,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
758
815
  "2027-12-02": "UAE National Day",
759
816
  "2027-12-03": "UAE National Day Holiday"
760
817
  }
761
- }, Va = {
762
- countryCode: Ya,
763
- timezone: Ba,
764
- payRate: _a,
765
- overtime: Fa,
766
- workingHours: Ua,
767
- recurringPublicHolidays: Wa,
768
- publicHolidays: za
769
- }, Ka = "BN", Ga = "Asia/Brunei", ja = {
818
+ }, Ga = {
819
+ countryCode: _a,
820
+ timezone: Fa,
821
+ payRate: Ua,
822
+ overtime: Wa,
823
+ workingHours: za,
824
+ recurringPublicHolidays: Va,
825
+ publicHolidays: Ka
826
+ }, ja = "BN", Qa = "Asia/Brunei", Xa = {
770
827
  NORMAL: {
771
828
  overtime: 1.5
772
829
  },
@@ -778,13 +835,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
778
835
  regular: 2,
779
836
  overtime: 3
780
837
  }
781
- }, Qa = {
838
+ }, Ja = {
782
839
  maxHoursPerMonth: 72
783
- }, Xa = {
784
- minHoursPerDay: null,
785
- maxHoursPerDay: 8,
786
- maxHoursPerWeek: 44
787
- }, Ja = [
840
+ }, Za = {
841
+ fullTime: {
842
+ minHoursPerDay: null,
843
+ maxHoursPerDay: 8,
844
+ maxHoursPerWeek: 44
845
+ },
846
+ partTime: {
847
+ maxHoursPerWeek: 30
848
+ }
849
+ }, qa = [
788
850
  {
789
851
  month: 1,
790
852
  day: 1,
@@ -810,7 +872,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
810
872
  day: 25,
811
873
  name: "Christmas Day"
812
874
  }
813
- ], Za = {
875
+ ], et = {
814
876
  2026: {
815
877
  "2026-01-01": "New Year's Day",
816
878
  "2026-02-17": "Chinese New Year",
@@ -840,15 +902,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
840
902
  "2027-08-15": "Prophet Muhammad's Birthday",
841
903
  "2027-12-25": "Christmas Day"
842
904
  }
843
- }, qa = {
844
- countryCode: Ka,
845
- timezone: Ga,
846
- payRate: ja,
847
- overtime: Qa,
848
- workingHours: Xa,
849
- recurringPublicHolidays: Ja,
850
- publicHolidays: Za
851
- }, et = "ID", at = "Asia/Jakarta", tt = {
905
+ }, at = {
906
+ countryCode: ja,
907
+ timezone: Qa,
908
+ payRate: Xa,
909
+ overtime: Ja,
910
+ workingHours: Za,
911
+ recurringPublicHolidays: qa,
912
+ publicHolidays: et
913
+ }, tt = "ID", nt = "Asia/Jakarta", ot = {
852
914
  NORMAL: {
853
915
  overtime: 1.5
854
916
  },
@@ -860,13 +922,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
860
922
  regular: 2,
861
923
  overtime: 2
862
924
  }
863
- }, nt = {
925
+ }, st = {
864
926
  maxHoursPerMonth: 72
865
- }, ot = {
866
- minHoursPerDay: null,
867
- maxHoursPerDay: 8,
868
- maxHoursPerWeek: 40
869
- }, st = [
927
+ }, it = {
928
+ fullTime: {
929
+ minHoursPerDay: null,
930
+ maxHoursPerDay: 8,
931
+ maxHoursPerWeek: 40
932
+ },
933
+ partTime: {
934
+ maxHoursPerWeek: null
935
+ }
936
+ }, rt = [
870
937
  {
871
938
  month: 1,
872
939
  day: 1,
@@ -887,7 +954,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
887
954
  day: 25,
888
955
  name: "Christmas Day"
889
956
  }
890
- ], it = {
957
+ ], lt = {
891
958
  2026: {
892
959
  "2026-01-01": "New Year's Day",
893
960
  "2026-01-16": "Isra Mi'raj",
@@ -927,15 +994,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
927
994
  "2027-12-25": "Christmas Day",
928
995
  "2027-12-26": "Isra Mi'raj"
929
996
  }
930
- }, rt = {
931
- countryCode: et,
932
- timezone: at,
933
- payRate: tt,
934
- overtime: nt,
935
- workingHours: ot,
936
- recurringPublicHolidays: st,
937
- publicHolidays: it
938
- }, lt = "MO", ut = "Asia/Macau", dt = {
997
+ }, ut = {
998
+ countryCode: tt,
999
+ timezone: nt,
1000
+ payRate: ot,
1001
+ overtime: st,
1002
+ workingHours: it,
1003
+ recurringPublicHolidays: rt,
1004
+ publicHolidays: lt
1005
+ }, dt = "MO", ct = "Asia/Macau", mt = {
939
1006
  NORMAL: {
940
1007
  overtime: 1.5
941
1008
  },
@@ -947,13 +1014,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
947
1014
  regular: 2,
948
1015
  overtime: 3
949
1016
  }
950
- }, ct = {
951
- maxHoursPerMonth: null
952
1017
  }, yt = {
953
- minHoursPerDay: null,
954
- maxHoursPerDay: 8,
955
- maxHoursPerWeek: 48
956
- }, mt = [
1018
+ maxHoursPerMonth: null
1019
+ }, pt = {
1020
+ fullTime: {
1021
+ minHoursPerDay: null,
1022
+ maxHoursPerDay: 8,
1023
+ maxHoursPerWeek: 48
1024
+ },
1025
+ partTime: {
1026
+ maxHoursPerWeek: null
1027
+ }
1028
+ }, ft = [
957
1029
  {
958
1030
  month: 1,
959
1031
  day: 1,
@@ -979,7 +1051,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
979
1051
  day: 25,
980
1052
  name: "Christmas Day"
981
1053
  }
982
- ], pt = {
1054
+ ], ht = {
983
1055
  2026: {
984
1056
  "2026-01-01": "New Year's Day",
985
1057
  "2026-02-17": "Lunar New Year's Day",
@@ -1036,15 +1108,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1036
1108
  "2027-12-25": "Christmas Day",
1037
1109
  "2027-12-27": "Compensatory rest day"
1038
1110
  }
1039
- }, ft = {
1040
- countryCode: lt,
1041
- timezone: ut,
1042
- payRate: dt,
1043
- overtime: ct,
1044
- workingHours: yt,
1045
- recurringPublicHolidays: mt,
1046
- publicHolidays: pt
1047
- }, ht = "MV", vt = "Indian/Maldives", gt = {
1111
+ }, vt = {
1112
+ countryCode: dt,
1113
+ timezone: ct,
1114
+ payRate: mt,
1115
+ overtime: yt,
1116
+ workingHours: pt,
1117
+ recurringPublicHolidays: ft,
1118
+ publicHolidays: ht
1119
+ }, gt = "MV", Dt = "Indian/Maldives", wt = {
1048
1120
  NORMAL: {
1049
1121
  overtime: 1.5
1050
1122
  },
@@ -1056,13 +1128,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1056
1128
  regular: 2,
1057
1129
  overtime: 3
1058
1130
  }
1059
- }, Dt = {
1131
+ }, Ht = {
1060
1132
  maxHoursPerMonth: null
1061
- }, wt = {
1062
- minHoursPerDay: null,
1063
- maxHoursPerDay: 8,
1064
- maxHoursPerWeek: 48
1065
- }, Ht = [
1133
+ }, At = {
1134
+ fullTime: {
1135
+ minHoursPerDay: null,
1136
+ maxHoursPerDay: 8,
1137
+ maxHoursPerWeek: 48
1138
+ },
1139
+ partTime: {
1140
+ maxHoursPerWeek: null
1141
+ }
1142
+ }, Et = [
1066
1143
  {
1067
1144
  month: 1,
1068
1145
  day: 1,
@@ -1088,7 +1165,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1088
1165
  day: 11,
1089
1166
  name: "Republic Day"
1090
1167
  }
1091
- ], At = {
1168
+ ], Pt = {
1092
1169
  2026: {
1093
1170
  "2026-01-01": "New Year's Day",
1094
1171
  "2026-03-20": "Eid al-Fitr Holiday",
@@ -1126,15 +1203,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1126
1203
  "2027-11-03": "Victory Day",
1127
1204
  "2027-11-11": "Republic Day"
1128
1205
  }
1129
- }, Et = {
1130
- countryCode: ht,
1131
- timezone: vt,
1132
- payRate: gt,
1133
- overtime: Dt,
1134
- workingHours: wt,
1135
- recurringPublicHolidays: Ht,
1136
- publicHolidays: At
1137
- }, bt = "MY", Pt = "Asia/Kuala_Lumpur", Nt = {
1206
+ }, bt = {
1207
+ countryCode: gt,
1208
+ timezone: Dt,
1209
+ payRate: wt,
1210
+ overtime: Ht,
1211
+ workingHours: At,
1212
+ recurringPublicHolidays: Et,
1213
+ publicHolidays: Pt
1214
+ }, kt = "MY", Nt = "Asia/Kuala_Lumpur", Ct = {
1138
1215
  NORMAL: {
1139
1216
  overtime: 1.5
1140
1217
  },
@@ -1146,13 +1223,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1146
1223
  regular: 2,
1147
1224
  overtime: 3
1148
1225
  }
1149
- }, kt = {
1226
+ }, Mt = {
1150
1227
  maxHoursPerMonth: 104
1151
- }, Ct = {
1152
- minHoursPerDay: null,
1153
- maxHoursPerDay: 8,
1154
- maxHoursPerWeek: 45
1155
- }, Mt = [
1228
+ }, St = {
1229
+ fullTime: {
1230
+ minHoursPerDay: null,
1231
+ maxHoursPerDay: 8,
1232
+ maxHoursPerWeek: 45
1233
+ },
1234
+ partTime: {
1235
+ maxHoursPerWeek: 31.5
1236
+ }
1237
+ }, Lt = [
1156
1238
  {
1157
1239
  month: 1,
1158
1240
  day: 1,
@@ -1178,7 +1260,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1178
1260
  day: 25,
1179
1261
  name: "Christmas Day"
1180
1262
  }
1181
- ], St = {
1263
+ ], It = {
1182
1264
  2026: {
1183
1265
  "2026-01-01": "New Year's Day",
1184
1266
  "2026-02-17": "Chinese New Year",
@@ -1216,15 +1298,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1216
1298
  "2027-10-28": "Deepavali",
1217
1299
  "2027-12-25": "Christmas Day"
1218
1300
  }
1219
- }, Lt = {
1220
- countryCode: bt,
1221
- timezone: Pt,
1222
- payRate: Nt,
1223
- overtime: kt,
1224
- workingHours: Ct,
1225
- recurringPublicHolidays: Mt,
1226
- publicHolidays: St
1227
- }, It = "PK", Rt = "Asia/Karachi", Ot = {
1301
+ }, Tt = {
1302
+ countryCode: kt,
1303
+ timezone: Nt,
1304
+ payRate: Ct,
1305
+ overtime: Mt,
1306
+ workingHours: St,
1307
+ recurringPublicHolidays: Lt,
1308
+ publicHolidays: It
1309
+ }, Rt = "PK", Ot = "Asia/Karachi", $t = {
1228
1310
  NORMAL: {
1229
1311
  overtime: 1.5
1230
1312
  },
@@ -1236,13 +1318,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1236
1318
  regular: 2,
1237
1319
  overtime: 3
1238
1320
  }
1239
- }, Tt = {
1321
+ }, xt = {
1240
1322
  maxHoursPerMonth: null
1241
- }, $t = {
1242
- minHoursPerDay: null,
1243
- maxHoursPerDay: 9,
1244
- maxHoursPerWeek: 48
1245
- }, xt = [
1323
+ }, Yt = {
1324
+ fullTime: {
1325
+ minHoursPerDay: null,
1326
+ maxHoursPerDay: 9,
1327
+ maxHoursPerWeek: 48
1328
+ },
1329
+ partTime: {
1330
+ maxHoursPerWeek: null
1331
+ }
1332
+ }, Bt = [
1246
1333
  {
1247
1334
  month: 1,
1248
1335
  day: 1,
@@ -1273,7 +1360,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1273
1360
  day: 25,
1274
1361
  name: "Quaid-e-Azam Day and Christmas Day"
1275
1362
  }
1276
- ], Yt = {
1363
+ ], _t = {
1277
1364
  2026: {
1278
1365
  "2026-01-01": "New Year's Day",
1279
1366
  "2026-02-05": "Kashmir Day",
@@ -1298,15 +1385,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1298
1385
  "2027-08-15": "Eid Milad-un-Nabi",
1299
1386
  "2027-12-25": "Quaid-e-Azam Day and Christmas Day"
1300
1387
  }
1301
- }, Bt = {
1302
- countryCode: It,
1303
- timezone: Rt,
1304
- payRate: Ot,
1305
- overtime: Tt,
1306
- workingHours: $t,
1307
- recurringPublicHolidays: xt,
1308
- publicHolidays: Yt
1309
- }, _t = "SG", Ft = "Asia/Singapore", Ut = {
1388
+ }, Ft = {
1389
+ countryCode: Rt,
1390
+ timezone: Ot,
1391
+ payRate: $t,
1392
+ overtime: xt,
1393
+ workingHours: Yt,
1394
+ recurringPublicHolidays: Bt,
1395
+ publicHolidays: _t
1396
+ }, Ut = "SG", Wt = "Asia/Singapore", zt = {
1310
1397
  NORMAL: {
1311
1398
  overtime: 1.5
1312
1399
  },
@@ -1318,13 +1405,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1318
1405
  regular: 2,
1319
1406
  overtime: 1.5
1320
1407
  }
1321
- }, Wt = {
1408
+ }, Vt = {
1322
1409
  maxHoursPerMonth: 72
1323
- }, zt = {
1324
- minHoursPerDay: null,
1325
- maxHoursPerDay: 12,
1326
- maxHoursPerWeek: 44
1327
- }, Vt = [
1410
+ }, Kt = {
1411
+ fullTime: {
1412
+ minHoursPerDay: null,
1413
+ maxHoursPerDay: 12,
1414
+ maxHoursPerWeek: 44
1415
+ },
1416
+ partTime: {
1417
+ maxHoursPerWeek: 35
1418
+ }
1419
+ }, Gt = [
1328
1420
  {
1329
1421
  month: 1,
1330
1422
  day: 1,
@@ -1345,7 +1437,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1345
1437
  day: 25,
1346
1438
  name: "Christmas Day"
1347
1439
  }
1348
- ], Kt = {
1440
+ ], jt = {
1349
1441
  2026: {
1350
1442
  "2026-01-01": "New Year's Day",
1351
1443
  "2026-02-17": "Chinese New Year's Day",
@@ -1376,15 +1468,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1376
1468
  "2027-10-28": "Deepavali",
1377
1469
  "2027-12-25": "Christmas Day"
1378
1470
  }
1379
- }, Gt = {
1380
- countryCode: _t,
1381
- timezone: Ft,
1382
- payRate: Ut,
1383
- overtime: Wt,
1384
- workingHours: zt,
1385
- recurringPublicHolidays: Vt,
1386
- publicHolidays: Kt
1387
- }, jt = "TH", Qt = "Asia/Bangkok", Xt = {
1471
+ }, Qt = {
1472
+ countryCode: Ut,
1473
+ timezone: Wt,
1474
+ payRate: zt,
1475
+ overtime: Vt,
1476
+ workingHours: Kt,
1477
+ recurringPublicHolidays: Gt,
1478
+ publicHolidays: jt
1479
+ }, Xt = "TH", Jt = "Asia/Bangkok", Zt = {
1388
1480
  NORMAL: {
1389
1481
  overtime: 1.5
1390
1482
  },
@@ -1396,13 +1488,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1396
1488
  regular: 2,
1397
1489
  overtime: 3
1398
1490
  }
1399
- }, Jt = {
1491
+ }, qt = {
1400
1492
  maxHoursPerMonth: 36
1401
- }, Zt = {
1402
- minHoursPerDay: null,
1403
- maxHoursPerDay: 8,
1404
- maxHoursPerWeek: 48
1405
- }, qt = [
1493
+ }, en = {
1494
+ fullTime: {
1495
+ minHoursPerDay: null,
1496
+ maxHoursPerDay: 8,
1497
+ maxHoursPerWeek: 48
1498
+ },
1499
+ partTime: {
1500
+ maxHoursPerWeek: null
1501
+ }
1502
+ }, an = [
1406
1503
  {
1407
1504
  month: 1,
1408
1505
  day: 1,
@@ -1448,7 +1545,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1448
1545
  day: 31,
1449
1546
  name: "New Year's Eve"
1450
1547
  }
1451
- ], en = {
1548
+ ], tn = {
1452
1549
  2026: {
1453
1550
  "2026-01-01": "New Year's Day",
1454
1551
  "2026-03-03": "Makha Bucha Day",
@@ -1488,15 +1585,15 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1488
1585
  "2027-12-10": "Constitution Day",
1489
1586
  "2027-12-31": "New Year's Eve"
1490
1587
  }
1491
- }, an = {
1492
- countryCode: jt,
1493
- timezone: Qt,
1494
- payRate: Xt,
1495
- overtime: Jt,
1496
- workingHours: Zt,
1497
- recurringPublicHolidays: qt,
1498
- publicHolidays: en
1499
- }, tn = "VN", nn = "Asia/Ho_Chi_Minh", on = {
1588
+ }, nn = {
1589
+ countryCode: Xt,
1590
+ timezone: Jt,
1591
+ payRate: Zt,
1592
+ overtime: qt,
1593
+ workingHours: en,
1594
+ recurringPublicHolidays: an,
1595
+ publicHolidays: tn
1596
+ }, on = "VN", sn = "Asia/Ho_Chi_Minh", rn = {
1500
1597
  NORMAL: {
1501
1598
  overtime: 1.5
1502
1599
  },
@@ -1508,13 +1605,18 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1508
1605
  regular: 2,
1509
1606
  overtime: 3
1510
1607
  }
1511
- }, sn = {
1608
+ }, ln = {
1512
1609
  maxHoursPerMonth: 40
1513
- }, rn = {
1514
- minHoursPerDay: null,
1515
- maxHoursPerDay: 8,
1516
- maxHoursPerWeek: 48
1517
- }, ln = [
1610
+ }, un = {
1611
+ fullTime: {
1612
+ minHoursPerDay: null,
1613
+ maxHoursPerDay: 8,
1614
+ maxHoursPerWeek: 48
1615
+ },
1616
+ partTime: {
1617
+ maxHoursPerWeek: null
1618
+ }
1619
+ }, dn = [
1518
1620
  {
1519
1621
  month: 1,
1520
1622
  day: 1,
@@ -1535,7 +1637,7 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1535
1637
  day: 2,
1536
1638
  name: "National Day"
1537
1639
  }
1538
- ], un = {
1640
+ ], cn = {
1539
1641
  2026: {
1540
1642
  "2026-01-01": "New Year's Day",
1541
1643
  "2026-02-16": "Tet Holiday",
@@ -1563,16 +1665,16 @@ const Ya = "AE", Ba = "Asia/Dubai", _a = {
1563
1665
  "2027-09-02": "National Day",
1564
1666
  "2027-09-03": "National Day Holiday"
1565
1667
  }
1566
- }, dn = {
1567
- countryCode: tn,
1568
- timezone: nn,
1569
- payRate: on,
1570
- overtime: sn,
1571
- workingHours: rn,
1572
- recurringPublicHolidays: ln,
1573
- publicHolidays: un
1574
- }, Fe = { AE: Va, BN: qa, ID: rt, MO: ft, MV: Et, MY: Lt, PK: Bt, SG: Gt, TH: an, VN: dn };
1575
- function cn(e) {
1668
+ }, mn = {
1669
+ countryCode: on,
1670
+ timezone: sn,
1671
+ payRate: rn,
1672
+ overtime: ln,
1673
+ workingHours: un,
1674
+ recurringPublicHolidays: dn,
1675
+ publicHolidays: cn
1676
+ }, Ue = { AE: Ga, BN: at, ID: ut, MO: vt, MV: bt, MY: Tt, PK: Ft, SG: Qt, TH: nn, VN: mn };
1677
+ function yn(e) {
1576
1678
  if (typeof e == "string") return e.toUpperCase();
1577
1679
  if (e && typeof e == "object" && "code" in e) {
1578
1680
  const a = e.code;
@@ -1580,17 +1682,17 @@ function cn(e) {
1580
1682
  }
1581
1683
  return "MY";
1582
1684
  }
1583
- function yn(e) {
1584
- return Fe[cn(e)] ?? Fe.MY;
1685
+ function pn(e) {
1686
+ return Ue[yn(e)] ?? Ue.MY;
1585
1687
  }
1586
- function No(e, a) {
1587
- var o, l;
1688
+ function Mo(e, a) {
1689
+ var o, r;
1588
1690
  const t = (o = e.publicHolidays[a.slice(0, 4)]) == null ? void 0 : o[a];
1589
1691
  if (t) return t;
1590
1692
  const n = Number(a.slice(5, 7)), i = Number(a.slice(8, 10));
1591
- return ((l = e.recurringPublicHolidays.find((s) => s.month === n && s.day === i)) == null ? void 0 : l.name) ?? null;
1693
+ return ((r = e.recurringPublicHolidays.find((s) => s.month === n && s.day === i)) == null ? void 0 : r.name) ?? null;
1592
1694
  }
1593
- const mn = Ve(), aa = "unassigned", ko = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Co = "All Stations", Mo = [{ id: aa, label: "Assigned", roles: [], system: !0 }], Ue = [
1695
+ const fn = Ke(), aa = "unassigned", So = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Lo = "All Stations", Io = [{ id: aa, label: "Assigned", roles: [], system: !0 }], We = [
1594
1696
  "#903E1F",
1595
1697
  "#5F090A",
1596
1698
  "#0A5384",
@@ -1600,105 +1702,105 @@ const mn = Ve(), aa = "unassigned", ko = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sa
1600
1702
  "#0F5C5C",
1601
1703
  "#6E2142"
1602
1704
  ];
1603
- function pn(e) {
1705
+ function hn(e) {
1604
1706
  var t;
1605
1707
  const a = e.trim().toLocaleLowerCase();
1606
1708
  return (t = B.find((n) => n.name.toLocaleLowerCase() === a)) == null ? void 0 : t.id;
1607
1709
  }
1608
- function So(e, a) {
1710
+ function To(e, a) {
1609
1711
  if (e)
1610
- return { positionId: a ?? pn(e), positionName: e };
1712
+ return { positionId: a ?? hn(e), positionName: e };
1611
1713
  }
1612
- function se(e, a = B) {
1714
+ function ie(e, a = B) {
1613
1715
  var t;
1614
1716
  if (e)
1615
1717
  return (e.positionId && ((t = a.find((n) => n.id === e.positionId)) == null ? void 0 : t.name)) ?? e.positionName;
1616
1718
  }
1617
- function Lo(e, a = B) {
1719
+ function Ro(e, a = B) {
1618
1720
  var t, n;
1619
1721
  if (e)
1620
1722
  return e.positionId ? (t = a.find((i) => i.id === e.positionId)) == null ? void 0 : t.name : (n = a.find((i) => i.name.toLocaleLowerCase() === e.positionName.toLocaleLowerCase())) == null ? void 0 : n.name;
1621
1723
  }
1622
- function Io(e, a) {
1724
+ function Oo(e, a) {
1623
1725
  return a ? !B.some((t) => t.id === a) : !!e && !B.some((t) => t.name.toLocaleLowerCase() === e.toLocaleLowerCase());
1624
1726
  }
1625
- const Ro = [1, 1, 1, 1, 1, 1, 1];
1626
- function ue(e) {
1727
+ const $o = [1, 1, 1, 1, 1, 1, 1];
1728
+ function le(e) {
1627
1729
  return (e + 6) % 7;
1628
1730
  }
1629
- function Oo(e) {
1731
+ function xo(e) {
1630
1732
  return (e + 1) % 7;
1631
1733
  }
1632
- function pe(e, a) {
1734
+ function ye(e, a) {
1633
1735
  e.splice(0, e.length, ...a);
1634
1736
  }
1635
- function fn(e, a) {
1636
- return Ge(e, a) / 60;
1737
+ function vn(e, a) {
1738
+ return je(e, a) / 60;
1637
1739
  }
1638
- function hn(e) {
1740
+ function gn(e) {
1639
1741
  var t;
1640
1742
  const a = e.trim().split(/\s+/).filter(Boolean);
1641
1743
  return a.length ? (a[0][0] + (((t = a[1]) == null ? void 0 : t[0]) ?? "")).toUpperCase() : "??";
1642
1744
  }
1643
1745
  const ta = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map();
1644
- function To(e) {
1746
+ function Yo(e) {
1645
1747
  return ta.get(e);
1646
1748
  }
1647
- function vn(e) {
1749
+ function Dn(e) {
1648
1750
  const a = Ee.get(e);
1649
1751
  if (a !== void 0) return a;
1650
- const t = Qe + Ee.size + 1;
1752
+ const t = Xe + Ee.size + 1;
1651
1753
  return Ee.set(e, t), ta.set(t, e), t;
1652
1754
  }
1653
- function $o(e) {
1755
+ function Bo(e) {
1654
1756
  return e.sourceId || String(e.id);
1655
1757
  }
1656
- function gn(e) {
1657
- ka.name = (e == null ? void 0 : e.outlet.name) ?? "", pe(Na, (e == null ? void 0 : e.positions.map((s) => s.name)) ?? []), pe(B, (e == null ? void 0 : e.positions) ?? []);
1758
+ function wn(e) {
1759
+ Ca.name = (e == null ? void 0 : e.outlet.name) ?? "", ye(Na, (e == null ? void 0 : e.positions.map((s) => s.name)) ?? []), ye(B, (e == null ? void 0 : e.positions) ?? []);
1658
1760
  const a = (e == null ? void 0 : e.restaurantProfile.operatingHours) ?? [], t = Array.from({ length: 7 }, () => []);
1659
- for (const s of a) t[ue(s.dayOfWeek)] = s.closed ? [] : s.hours;
1660
- pe(M.dayHours, t);
1761
+ for (const s of a) t[le(s.dayOfWeek)] = s.closed ? [] : s.hours;
1762
+ ye(N.dayHours, t);
1661
1763
  const n = a.filter((s) => !s.closed).flatMap((s) => s.hours);
1662
- M.openFrom = n.length ? n.map((s) => s.start).reduce((s, u) => u < s ? u : s) : "00:00", M.openTo = n.length ? n.map((s) => s.end).reduce((s, u) => u > s ? u : s) : "24:00", pe(
1663
- M.closedWeekdays,
1664
- a.filter((s) => s.closed).map((s) => ue(s.dayOfWeek)).sort((s, u) => s - u)
1764
+ N.openFrom = n.length ? n.map((s) => s.start).reduce((s, d) => d < s ? d : s) : "00:00", N.openTo = n.length ? n.map((s) => s.end).reduce((s, d) => d > s ? d : s) : "24:00", ye(
1765
+ N.closedWeekdays,
1766
+ a.filter((s) => s.closed).map((s) => le(s.dayOfWeek)).sort((s, d) => s - d)
1665
1767
  );
1666
- const i = yn(mn.currentCountry.value), o = (e == null ? void 0 : e.settings.settingsConfigured) === !0, l = o ? e.settings.payRate : i.payRate;
1667
- M.otCapHours = o ? e.settings.overtime.maxHoursPerMonth : i.overtime.maxHoursPerMonth, M.workingHours = o ? e.settings.workingHours : {
1768
+ const i = pn(fn.currentCountry.value), o = (e == null ? void 0 : e.settings.settingsConfigured) === !0, r = o ? e.settings.payRate : i.payRate;
1769
+ N.otCapHours = o ? e.settings.overtime.maxHoursPerMonth : i.overtime.maxHoursPerMonth, N.workingHours = o ? e.settings.workingHours : {
1668
1770
  minHoursPerDay: null,
1669
- maxHoursPerDay: i.workingHours.maxHoursPerDay,
1670
- maxHoursPerWeek: i.workingHours.maxHoursPerWeek
1671
- }, M.payRate.NORMAL.overtime = l.NORMAL.overtime, M.payRate.REST_DAY.regular = l.REST_DAY.regular, M.payRate.REST_DAY.overtime = l.REST_DAY.overtime, M.payRate.PUBLIC_HOLIDAY.regular = l.PUBLIC_HOLIDAY.regular, M.payRate.PUBLIC_HOLIDAY.overtime = l.PUBLIC_HOLIDAY.overtime;
1771
+ maxHoursPerDay: i.workingHours.fullTime.maxHoursPerDay,
1772
+ maxHoursPerWeek: i.workingHours.fullTime.maxHoursPerWeek
1773
+ }, N.payRate.NORMAL.overtime = r.NORMAL.overtime, N.payRate.REST_DAY.regular = r.REST_DAY.regular, N.payRate.REST_DAY.overtime = r.REST_DAY.overtime, N.payRate.PUBLIC_HOLIDAY.regular = r.PUBLIC_HOLIDAY.regular, N.payRate.PUBLIC_HOLIDAY.overtime = r.PUBLIC_HOLIDAY.overtime;
1672
1774
  }
1673
- Ie(c, gn, { immediate: !0 });
1674
- function ge(e) {
1775
+ Te(l, wn, { immediate: !0 });
1776
+ function ve(e) {
1675
1777
  var a, t, n;
1676
1778
  return {
1677
- minHoursPerDay: ((a = e.workingHours) == null ? void 0 : a.minHoursPerDay) ?? M.workingHours.minHoursPerDay,
1678
- maxHoursPerDay: ((t = e.workingHours) == null ? void 0 : t.maxHoursPerDay) ?? M.workingHours.maxHoursPerDay,
1679
- maxHoursPerWeek: ((n = e.workingHours) == null ? void 0 : n.maxHoursPerWeek) ?? M.workingHours.maxHoursPerWeek
1779
+ minHoursPerDay: ((a = e.workingHours) == null ? void 0 : a.minHoursPerDay) ?? N.workingHours.minHoursPerDay,
1780
+ maxHoursPerDay: ((t = e.workingHours) == null ? void 0 : t.maxHoursPerDay) ?? N.workingHours.maxHoursPerDay,
1781
+ maxHoursPerWeek: ((n = e.workingHours) == null ? void 0 : n.maxHoursPerWeek) ?? N.workingHours.maxHoursPerWeek
1680
1782
  };
1681
1783
  }
1682
- function Dn(e) {
1784
+ function Hn(e) {
1683
1785
  return e.reduce(
1684
1786
  (a, t) => {
1685
- const n = ge(t).maxHoursPerWeek;
1787
+ const n = ve(t).maxHoursPerWeek;
1686
1788
  return t.employmentType === "FULLTIME" && n != null ? Math.max(a, n) : a;
1687
1789
  },
1688
1790
  0
1689
1791
  );
1690
1792
  }
1691
- function wn(e, a) {
1793
+ function An(e, a) {
1692
1794
  if (e.wage.type === "HOURLY") return e.wage.amount;
1693
- const t = ge(e).maxHoursPerWeek ?? a;
1795
+ const t = ve(e).maxHoursPerWeek ?? a;
1694
1796
  return t ? e.wage.amount / (t * (52 / 12)) : 0;
1695
1797
  }
1696
- function Hn(e, a) {
1798
+ function En(e, a) {
1697
1799
  if (e.employmentType === "FULLTIME") return 100;
1698
- const t = ge(e).maxHoursPerWeek;
1800
+ const t = ve(e).maxHoursPerWeek;
1699
1801
  return !a || t == null ? 0 : Math.min(99, Math.round(t / a * 100));
1700
1802
  }
1701
- function An(e) {
1803
+ function Pn(e) {
1702
1804
  var a;
1703
1805
  return {
1704
1806
  start: e.startTime,
@@ -1707,12 +1809,12 @@ function An(e) {
1707
1809
  // stay blank rather than falling back to the employee's own primary position, or a reload
1708
1810
  // silently reassigns every "Any position" shift to whatever station the employee is normally
1709
1811
  // pinned to.
1710
- role: se(e.position) ?? "",
1812
+ role: ie(e.position) ?? "",
1711
1813
  positionId: ((a = e.position) == null ? void 0 : a.positionId) || void 0,
1712
1814
  // Mongo distinguishes a draft from a published/confirmed assignment; the board's third
1713
1815
  // state ('ot') is a costing outcome, never something stored.
1714
1816
  status: e.status === "DRAFT" ? "pending" : "confirmed",
1715
- breakMins: je(e.breaks),
1817
+ breakMins: Qe(e.breaks),
1716
1818
  breaks: e.breaks,
1717
1819
  // Carried through so an edit updates this same ScheduleShiftAssignments document instead of
1718
1820
  // creating a duplicate — see useScheduleBoard's commitShift/persistSlot.
@@ -1720,10 +1822,10 @@ function An(e) {
1720
1822
  updatedAt: e.updatedAt
1721
1823
  };
1722
1824
  }
1723
- function En(e) {
1825
+ function bn(e) {
1724
1826
  return e.type === "OFF_DAY" ? "Off day" : e.leaveType === "MEDICAL" ? "Medical Leave" : e.leaveType === "EMERGENCY" ? "Emergency Leave" : e.leaveType === "UNPAID" ? "Unpaid Leave" : "Annual Leave";
1725
1827
  }
1726
- function bn(e, a) {
1828
+ function kn(e, a) {
1727
1829
  if (a < e.startDate || a > e.endDate) return null;
1728
1830
  const n = e.startDate === e.endDate || a === e.startDate ? e.startPart : a === e.endDate ? e.endPart : "FULL_DAY";
1729
1831
  return {
@@ -1731,12 +1833,12 @@ function bn(e, a) {
1731
1833
  type: e.type,
1732
1834
  leaveType: e.leaveType ?? void 0,
1733
1835
  timeOff: e.status === "PENDING" ? "pending" : "approved",
1734
- reason: En(e),
1836
+ reason: bn(e),
1735
1837
  half: n !== "FULL_DAY",
1736
1838
  halfPart: n === "FULL_DAY" ? void 0 : n
1737
1839
  };
1738
1840
  }
1739
- function Pn(e) {
1841
+ function Nn(e) {
1740
1842
  return {
1741
1843
  employeeId: e._id,
1742
1844
  name: e.name,
@@ -1747,89 +1849,94 @@ function Pn(e) {
1747
1849
  availability: []
1748
1850
  };
1749
1851
  }
1750
- function Nn(e) {
1751
- const a = ne[m.value];
1852
+ function Cn(e) {
1853
+ const a = oe[m.value];
1752
1854
  return !a || !e.includes(a) ? e : [a, ...e.filter((t) => t !== a)];
1753
1855
  }
1754
- function kn(e) {
1856
+ function Mn(e) {
1755
1857
  var n;
1756
- const t = (Ze.value[e] ?? ((n = ie.value.find((i) => i._id === e)) == null ? void 0 : n.restaurantRole.map((i) => i.restaurantId)) ?? []).map((i) => ne[i]).filter((i) => !!i);
1757
- return t.length ? Nn([...new Set(t)]) : void 0;
1858
+ const t = (qe.value[e] ?? ((n = re.value.find((i) => i._id === e)) == null ? void 0 : n.restaurantRole.map((i) => i.restaurantId)) ?? []).map((i) => oe[i]).filter((i) => !!i);
1859
+ return t.length ? Cn([...new Set(t)]) : void 0;
1758
1860
  }
1759
- function xo(e = []) {
1760
- const a = c.value;
1861
+ function _o(e = []) {
1862
+ const a = l.value;
1761
1863
  if (!a) return [];
1762
1864
  const t = new Map(a.employees.map((s) => [s.employeeId, s])), n = new Map(
1763
1865
  F.value.map((s) => [s.employeeId, s])
1764
- ), i = ie.value.filter((s) => {
1765
- var u;
1766
- return ((u = n.get(s._id)) == null ? void 0 : u.enabled) !== !1;
1767
- }).map((s) => t.get(s._id) ?? Pn(s)), o = Dn(i), l = /* @__PURE__ */ new Map();
1866
+ ), i = re.value.filter((s) => {
1867
+ var d;
1868
+ return ((d = n.get(s._id)) == null ? void 0 : d.enabled) !== !1;
1869
+ }).map((s) => t.get(s._id) ?? Nn(s)), o = Hn(i), r = /* @__PURE__ */ new Map();
1768
1870
  for (const s of a.assignments) {
1769
- const u = `${s.employeeId}|${s.date}`, v = l.get(u);
1770
- v ? v.push(s) : l.set(u, [s]);
1871
+ const d = `${s.employeeId}|${s.date}`, p = r.get(d);
1872
+ p ? p.push(s) : r.set(d, [s]);
1771
1873
  }
1772
1874
  return i.map((s) => {
1773
- const u = ie.value.find((h) => h._id === s.employeeId) ?? {
1875
+ const d = re.value.find((h) => h._id === s.employeeId) ?? {
1876
+ name: s.name,
1774
1877
  code: void 0,
1775
1878
  passcode: "",
1776
1879
  isMasterUser: !1
1777
- }, v = ge(s), E = vn(s.employeeId), $ = new Set(B.map((h) => h.id)), Q = new Set(B.map((h) => h.name.toLocaleLowerCase())), p = (h) => h.positionId ? $.has(h.positionId) : Q.has(h.positionName.toLocaleLowerCase()), w = se(s.primaryPosition), I = !!s.primaryPosition && p(s.primaryPosition), R = s.secondaryPositions.filter(p).map((h) => se(h)).filter((h) => !!h), X = w ? I ? [w, ...R] : [] : R, J = [
1778
- ...w && !I ? [w] : [],
1779
- ...s.secondaryPositions.filter((h) => !p(h)).map((h) => se(h)).filter((h) => !!h)
1780
- ], _ = X[0] ?? "", S = e.map((h) => {
1781
- const b = re(h), H = (a.timeOff ?? []).filter((P) => P.employeeId === s.employeeId).map((P) => bn(P, b)).find((P) => P !== null);
1782
- if (H) return H;
1783
- const U = (l.get(`${s.employeeId}|${b}`) ?? []).filter((P) => P.startTime && P.endTime).map((P) => An(P)).sort((P, ye) => P.start.localeCompare(ye.start));
1784
- return U.length ? U.length === 1 ? U[0] : U : null;
1785
- }), Z = s.availability.length > 0, de = Array.from(
1880
+ }, p = ve(s), g = Dn(s.employeeId), C = new Set(B.map((h) => h.id)), J = new Set(B.map((h) => h.name.toLocaleLowerCase())), f = (h) => h.positionId ? C.has(h.positionId) : J.has(h.positionName.toLocaleLowerCase()), A = ie(s.primaryPosition), S = !!s.primaryPosition && f(s.primaryPosition), L = s.secondaryPositions.filter(f).map((h) => ie(h)).filter((h) => !!h), Z = A ? S ? [A, ...L] : [] : L, q = [
1881
+ ...A && !S ? [A] : [],
1882
+ ...s.secondaryPositions.filter((h) => !f(h)).map((h) => ie(h)).filter((h) => !!h)
1883
+ ], _ = Z[0] ?? "", I = e.map((h) => {
1884
+ const E = j(h);
1885
+ return (a.timeOff ?? []).filter((D) => D.employeeId === s.employeeId).map((D) => kn(D, E)).find((D) => D !== null) ?? null;
1886
+ }), U = e.map((h) => {
1887
+ const E = j(h), R = (r.get(`${s.employeeId}|${E}`) ?? []).filter(($) => $.startTime && $.endTime).map(($) => Pn($)).sort(($, ce) => $.start.localeCompare(ce.start));
1888
+ return R.length ? R.length === 1 ? R[0] : R : null;
1889
+ }), ue = s.availability.length > 0, de = Array.from(
1786
1890
  { length: 7 },
1787
- (h, b) => Z ? s.availability.some((H) => ue(H.dayOfWeek) === b) : !0
1788
- ), ce = Array.from({ length: 7 }, (h, b) => {
1789
- const H = s.availability.find((k) => ue(k.dayOfWeek) === b);
1790
- return { from: (H == null ? void 0 : H.start) ?? "", to: (H == null ? void 0 : H.end) ?? "" };
1891
+ (h, E) => ue ? s.availability.some((D) => le(D.dayOfWeek) === E) : !0
1892
+ ), ge = Array.from({ length: 7 }, (h, E) => {
1893
+ const D = s.availability.find((R) => le(R.dayOfWeek) === E);
1894
+ return { from: (D == null ? void 0 : D.start) ?? "", to: (D == null ? void 0 : D.end) ?? "" };
1791
1895
  });
1792
1896
  return {
1793
- id: E,
1897
+ id: g,
1794
1898
  sourceId: s.employeeId,
1795
- name: s.name,
1899
+ // Employee page edits update the POS employee name. Use that as the display
1900
+ // source so Scheduling reflects those changes after its roster refresh.
1901
+ name: d.name,
1796
1902
  // POS access belongs to the POS roster, not the scheduling profile. Keep these
1797
1903
  // fields on the board employee so the edit form can initialise its access section
1798
1904
  // from the employee's existing POS account.
1799
- passcode: u.passcode || void 0,
1800
- code: u.code,
1801
- masterUser: u.isMasterUser,
1905
+ passcode: d.passcode || void 0,
1906
+ code: d.code,
1907
+ masterUser: d.isMasterUser,
1802
1908
  employmentType: s.employmentType,
1803
1909
  role: _,
1804
- initials: hn(s.name),
1805
- color: Ue[(E - Qe - 1) % Ue.length],
1910
+ initials: gn(d.name),
1911
+ color: We[(g - Xe - 1) % We.length],
1806
1912
  // Gross hours actually rostered this week — the figure the cost rail multiplies by
1807
1913
  // the rate. Contracted hours are a separate question, answered by RULES.contract.
1808
1914
  // Rounded to one decimal — `hoursBetween` divides by 60, so an unrounded sum reads
1809
1915
  // as a long, meaningless float (e.g. 31.983333333333334) everywhere this is shown
1810
1916
  // verbatim, matching the rounding `employeeLoadOf`'s own hours figure already uses.
1811
1917
  weekHours: Math.round(
1812
- S.reduce(
1813
- (h, b) => h + (Array.isArray(b) ? b : b && "start" in b ? [b] : []).reduce(
1814
- (H, k) => H + fn(k.start, k.end),
1918
+ U.reduce(
1919
+ (h, E) => h + (Array.isArray(E) ? E : E && "start" in E ? [E] : []).reduce(
1920
+ (D, R) => D + vn(R.start, R.end),
1815
1921
  0
1816
1922
  ),
1817
1923
  0
1818
1924
  ) * 10
1819
1925
  ) / 10,
1820
- pct: Hn(s, o),
1821
- contractHours: v.maxHoursPerWeek ?? void 0,
1822
- minHoursPerDay: v.minHoursPerDay ?? void 0,
1926
+ pct: En(s, o),
1927
+ contractHours: p.maxHoursPerWeek ?? void 0,
1928
+ minHoursPerDay: p.minHoursPerDay ?? void 0,
1823
1929
  // Keep the persisted override shape here. Consumers that need the effective value use
1824
1930
  // effectiveWorkingHours(), so an inherited null remains distinguishable from an override.
1825
1931
  workingHours: s.workingHours,
1826
1932
  // Every outlet the POS says this person works at, not just this one — the Add / Edit form
1827
1933
  // shows them, and saving keeps them.
1828
- locations: kn(s.employeeId),
1829
- rate: wn(s, o),
1830
- positions: X,
1831
- archivedPositions: J.length ? J : void 0,
1832
- shifts: S,
1934
+ locations: Mn(s.employeeId),
1935
+ rate: An(s, o),
1936
+ positions: Z,
1937
+ archivedPositions: q.length ? q : void 0,
1938
+ shifts: U,
1939
+ timeOff: I,
1833
1940
  // Remarks live in their own collection in the older scheduling design and are not
1834
1941
  // part of this board's payload yet.
1835
1942
  remarks: [],
@@ -1837,55 +1944,55 @@ function xo(e = []) {
1837
1944
  payBasis: s.wage.type === "HOURLY" ? "hourly" : "monthly",
1838
1945
  payAmount: s.wage.amount,
1839
1946
  availDays: de,
1840
- availHours: ce
1947
+ availHours: ge
1841
1948
  };
1842
1949
  });
1843
1950
  }
1844
- function Yo() {
1951
+ function Fo() {
1845
1952
  return [];
1846
1953
  }
1847
- function Bo() {
1954
+ function Uo() {
1848
1955
  var n, i;
1849
- const e = c.value, a = {}, t = {};
1956
+ const e = l.value, a = {}, t = {};
1850
1957
  for (const o of (e == null ? void 0 : e.demands) ?? []) {
1851
- const l = o.date ? a[n = o.date] ?? (a[n] = []) : o.dayOfWeek !== null ? t[i = ue(o.dayOfWeek)] ?? (t[i] = []) : null;
1852
- if (!l) continue;
1853
- let s = l.find((u) => u.from === o.startTime && u.to === o.endTime);
1854
- s || (s = { from: o.startTime, to: o.endTime, n: 0, roles: [] }, l.push(s)), s.n += o.headcount, o.position && s.roles.push({
1855
- position: se(o.position) ?? "",
1958
+ const r = o.date ? a[n = o.date] ?? (a[n] = []) : o.dayOfWeek !== null ? t[i = le(o.dayOfWeek)] ?? (t[i] = []) : null;
1959
+ if (!r) continue;
1960
+ let s = r.find((d) => d.from === o.startTime && d.to === o.endTime);
1961
+ s || (s = { from: o.startTime, to: o.endTime, n: 0, roles: [] }, r.push(s)), s.n += o.headcount, o.position && s.roles.push({
1962
+ position: ie(o.position) ?? "",
1856
1963
  positionId: o.position.positionId || void 0,
1857
1964
  n: o.headcount
1858
1965
  });
1859
1966
  }
1860
1967
  return { byDate: a, byWeekday: t };
1861
1968
  }
1862
- function _o() {
1863
- const e = Ve(), { restaurants: a, readRestaurants: t } = Ha(), n = Da(), i = wa(), o = A(!1), l = Y(
1864
- () => a.value.filter((p) => p.managable).map((p) => ({ value: p._id, label: p.profile.name })).sort((p, w) => p.label.localeCompare(w.label))
1969
+ function Wo() {
1970
+ const e = Ke(), { restaurants: a, readRestaurants: t } = Ha(), n = Da(), i = wa(), o = P(!1), r = Y(
1971
+ () => a.value.filter((f) => f.managable).map((f) => ({ value: f._id, label: f.profile.name })).sort((f, A) => f.label.localeCompare(A.label))
1865
1972
  ), s = () => {
1866
- var p;
1867
- return `hrm-schedule-outlet:${((p = e.currentBusiness.value) == null ? void 0 : p._id) ?? ""}`;
1868
- }, u = Y(() => {
1869
- var p;
1870
- return ((p = e.currentRestaurant.value) == null ? void 0 : p._id) ?? "";
1973
+ var f;
1974
+ return `hrm-schedule-outlet:${((f = e.currentBusiness.value) == null ? void 0 : f._id) ?? ""}`;
1975
+ }, d = Y(() => {
1976
+ var f;
1977
+ return ((f = e.currentRestaurant.value) == null ? void 0 : f._id) ?? "";
1871
1978
  });
1872
- async function v(p, w) {
1873
- return Be(p) ? (localStorage.setItem(s(), p), n.query.restaurantId !== p && i.replace({ query: { ...n.query, restaurantId: p } }), await Promise.all([Me(p), Ta(w)]), !0) : !1;
1979
+ async function p(f, A) {
1980
+ return _e(f) ? (localStorage.setItem(s(), f), n.query.restaurantId !== f && i.replace({ query: { ...n.query, restaurantId: f } }), await Promise.all([Me(f), xa(A)]), !0) : !1;
1874
1981
  }
1875
- const E = (p) => !!p && l.value.some((w) => w.value === p);
1876
- async function $() {
1877
- var I;
1878
- await t(), Ye.splice(0, Ye.length, ...l.value.map((R) => R.label)), Object.keys(ne).forEach((R) => delete ne[R]), a.value.forEach((R) => ne[R._id] = R.profile.name);
1879
- const p = localStorage.getItem(s()) ?? "", w = [m.value, p, u.value].find(E) ?? ((I = l.value[0]) == null ? void 0 : I.value) ?? "";
1880
- return w && Be(w), o.value = !0, w;
1982
+ const g = (f) => !!f && r.value.some((A) => A.value === f);
1983
+ async function C() {
1984
+ var S;
1985
+ await t(), Be.splice(0, Be.length, ...r.value.map((L) => L.label)), Object.keys(oe).forEach((L) => delete oe[L]), a.value.forEach((L) => oe[L._id] = L.profile.name);
1986
+ const f = localStorage.getItem(s()) ?? "", A = [m.value, f, d.value].find(g) ?? ((S = r.value[0]) == null ? void 0 : S.value) ?? "";
1987
+ return A && _e(A), o.value = !0, A;
1881
1988
  }
1882
- async function Q() {
1883
- const p = await $();
1884
- return p && await Me(p), p;
1989
+ async function J() {
1990
+ const f = await C();
1991
+ return f && await Me(f), f;
1885
1992
  }
1886
- return { options: l, ready: o, outletId: m, resolve: Q, resolveOutlet: $, switchTo: v };
1993
+ return { options: r, ready: o, outletId: m, resolve: J, resolveOutlet: C, switchTo: p };
1887
1994
  }
1888
- const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re({
1995
+ const Sn = ["data-hierarchy", "data-size", "data-icon"], zo = /* @__PURE__ */ Re({
1889
1996
  __name: "ScheduleButton",
1890
1997
  props: {
1891
1998
  hierarchy: { default: "primary" },
@@ -1893,32 +2000,32 @@ const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re
1893
2000
  iconOnly: { type: Boolean, default: !1 }
1894
2001
  },
1895
2002
  setup(e) {
1896
- return (a, t) => (N(), C("button", {
2003
+ return (a, t) => (b(), k("button", {
1897
2004
  type: "button",
1898
2005
  class: "sch-button",
1899
2006
  "data-hierarchy": e.hierarchy,
1900
2007
  "data-size": e.size,
1901
2008
  "data-icon": e.iconOnly ? "only" : void 0
1902
2009
  }, [
1903
- ze(a.$slots, "default")
1904
- ], 8, Cn));
2010
+ Ve(a.$slots, "default")
2011
+ ], 8, Sn));
1905
2012
  }
1906
- }), Mn = ["disabled", "aria-expanded"], Sn = { class: "fx-btn-label" }, Ln = { class: "sch" }, In = ["aria-multiselectable"], Rn = {
2013
+ }), Ln = ["disabled", "aria-expanded"], In = { class: "fx-btn-label" }, Tn = { class: "sch" }, Rn = ["aria-multiselectable"], On = {
1907
2014
  key: 0,
1908
2015
  class: "fx-pop-head"
1909
- }, On = {
2016
+ }, $n = {
1910
2017
  key: 1,
1911
2018
  class: "fx-pop-search"
1912
- }, Tn = {
2019
+ }, xn = {
1913
2020
  key: 2,
1914
2021
  class: "fx-opt is-off"
1915
- }, $n = {
2022
+ }, Yn = {
1916
2023
  key: 0,
1917
2024
  class: "fx-grp"
1918
- }, xn = ["aria-selected", "onClick"], Yn = {
2025
+ }, Bn = ["aria-selected", "onClick"], _n = {
1919
2026
  key: 0,
1920
2027
  class: "fx-opt-text"
1921
- }, Bn = { key: 0 }, Uo = /* @__PURE__ */ Re({
2028
+ }, Fn = { key: 0 }, Vo = /* @__PURE__ */ Re({
1922
2029
  inheritAttrs: !1,
1923
2030
  __name: "ScheduleSelect",
1924
2031
  props: {
@@ -1936,192 +2043,192 @@ const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re
1936
2043
  },
1937
2044
  emits: ["update:modelValue", "toggle"],
1938
2045
  setup(e, { emit: a }) {
1939
- const t = e, n = a, i = ua(), o = Y(() => i.class ?? ""), l = A(!1), s = A(!1), u = A(null), v = A(null), E = A(null), $ = Y(() => t.teleport !== !1 && s.value);
1940
- Se(() => {
2046
+ const t = e, n = a, i = ua(), o = Y(() => i.class ?? ""), r = P(!1), s = P(!1), d = P(null), p = P(null), g = P(null), C = Y(() => t.teleport !== !1 && s.value);
2047
+ Le(() => {
1941
2048
  s.value = typeof document < "u" && !!document.body;
1942
2049
  });
1943
- const Q = Y(() => {
1944
- var r, y;
2050
+ const J = Y(() => {
2051
+ var u, y;
1945
2052
  if (t.selectedLabel != null) return t.selectedLabel;
1946
2053
  if (t.multiple) {
1947
- const d = ((r = t.selected) == null ? void 0 : r.length) ?? 0;
1948
- return d ? `${d} selected` : t.placeholder ?? "";
2054
+ const c = ((u = t.selected) == null ? void 0 : u.length) ?? 0;
2055
+ return c ? `${c} selected` : t.placeholder ?? "";
1949
2056
  }
1950
- return ((y = t.options.find((d) => d.value === t.modelValue)) == null ? void 0 : y.label) ?? "";
2057
+ return ((y = t.options.find((c) => c.value === t.modelValue)) == null ? void 0 : y.label) ?? t.placeholder ?? "";
1951
2058
  });
1952
- function p(r) {
2059
+ function f(u) {
1953
2060
  var y;
1954
- return t.multiple ? !!((y = t.selected) != null && y.includes(r.value)) : t.selectedId != null ? r.id === t.selectedId : r.value === t.modelValue;
2061
+ return t.multiple ? !!((y = t.selected) != null && y.includes(u.value)) : t.selectedId != null ? u.id === t.selectedId : u.value === t.modelValue;
1955
2062
  }
1956
- const w = Y(() => !!t.menuTitle || t.options.some((r) => r.hint)), I = A(""), R = A(null), X = Y(() => {
1957
- const r = I.value.trim().toLowerCase();
1958
- return !t.searchable || !r ? t.options : t.options.filter((y) => `${y.label} ${y.hint ?? ""}`.toLowerCase().includes(r));
1959
- }), J = Y(() => {
1960
- const r = [];
2063
+ const A = Y(() => !!t.menuTitle || t.options.some((u) => u.hint)), S = P(""), L = P(null), Z = Y(() => {
2064
+ const u = S.value.trim().toLowerCase();
2065
+ return !t.searchable || !u ? t.options : t.options.filter((y) => `${y.label} ${y.hint ?? ""}`.toLowerCase().includes(u));
2066
+ }), q = Y(() => {
2067
+ const u = [];
1961
2068
  let y;
1962
- for (const d of X.value)
1963
- d.group !== y && (y = d.group, y && r.push({ heading: y })), r.push({ option: d });
1964
- return r;
1965
- }), _ = 5, S = 8;
1966
- function Z() {
1967
- const r = E.value, y = v.value;
1968
- if (!r || !y) return;
1969
- const d = y.getBoundingClientRect(), L = window.innerWidth || document.documentElement.clientWidth, T = window.innerHeight || document.documentElement.clientHeight;
1970
- r.style.minWidth = `${Math.round(d.width)}px`, r.style.maxWidth = `${Math.max(180, Math.round(L - S * 2))}px`;
1971
- const q = T - d.bottom - _ - S, ia = d.top - _ - S;
1972
- r.style.maxHeight = `${Math.max(120, Math.min(320, Math.max(q, ia)))}px`;
1973
- const me = r.offsetHeight, ra = r.offsetWidth;
1974
- let De = d.bottom + _;
1975
- De + me > T - S && (De = d.top - _ - me >= S ? d.top - _ - me : Math.max(S, T - me - S));
1976
- const la = Math.min(Math.max(S, d.left), Math.max(S, L - ra - S));
1977
- r.style.top = `${Math.round(De)}px`, r.style.left = `${Math.round(la)}px`, r.style.visibility = "visible";
2069
+ for (const c of Z.value)
2070
+ c.group !== y && (y = c.group, y && u.push({ heading: y })), u.push({ option: c });
2071
+ return u;
2072
+ }), _ = 5, I = 8;
2073
+ function U() {
2074
+ const u = g.value, y = p.value;
2075
+ if (!u || !y) return;
2076
+ const c = y.getBoundingClientRect(), M = window.innerWidth || document.documentElement.clientWidth, O = window.innerHeight || document.documentElement.clientHeight;
2077
+ u.style.minWidth = `${Math.round(c.width)}px`, u.style.maxWidth = `${Math.max(180, Math.round(M - I * 2))}px`;
2078
+ const ee = O - c.bottom - _ - I, ia = c.top - _ - I;
2079
+ u.style.maxHeight = `${Math.max(120, Math.min(320, Math.max(ee, ia)))}px`;
2080
+ const me = u.offsetHeight, ra = u.offsetWidth;
2081
+ let De = c.bottom + _;
2082
+ De + me > O - I && (De = c.top - _ - me >= I ? c.top - _ - me : Math.max(I, O - me - I));
2083
+ const la = Math.min(Math.max(I, c.left), Math.max(I, M - ra - I));
2084
+ u.style.top = `${Math.round(De)}px`, u.style.left = `${Math.round(la)}px`, u.style.visibility = "visible";
1978
2085
  }
1979
- function de(r) {
1980
- var d, L;
1981
- const y = r.target;
1982
- y && ((d = u.value) != null && d.contains(y) || (L = E.value) != null && L.contains(y)) || k();
2086
+ function ue(u) {
2087
+ var c, M;
2088
+ const y = u.target;
2089
+ y && ((c = d.value) != null && c.contains(y) || (M = g.value) != null && M.contains(y)) || D();
1983
2090
  }
1984
- function ce(r) {
1985
- const y = E.value, d = r.target;
1986
- if (y && d && d !== document && y.contains(d)) return;
1987
- const L = v.value;
1988
- if (!L) return;
1989
- const T = L.getBoundingClientRect(), q = window.innerHeight || document.documentElement.clientHeight;
1990
- if (T.bottom < 0 || T.top > q) {
1991
- k();
2091
+ function de(u) {
2092
+ const y = g.value, c = u.target;
2093
+ if (y && c && c !== document && y.contains(c)) return;
2094
+ const M = p.value;
2095
+ if (!M) return;
2096
+ const O = M.getBoundingClientRect(), ee = window.innerHeight || document.documentElement.clientHeight;
2097
+ if (O.bottom < 0 || O.top > ee) {
2098
+ D();
1992
2099
  return;
1993
2100
  }
1994
- Z();
2101
+ U();
1995
2102
  }
1996
- function h() {
1997
- document.addEventListener("click", de), document.addEventListener("scroll", ce, !0), window.addEventListener("resize", k);
2103
+ function ge() {
2104
+ document.addEventListener("click", ue), document.addEventListener("scroll", de, !0), window.addEventListener("resize", D);
1998
2105
  }
1999
- function b() {
2000
- document.removeEventListener("click", de), document.removeEventListener("scroll", ce, !0), window.removeEventListener("resize", k);
2106
+ function h() {
2107
+ document.removeEventListener("click", ue), document.removeEventListener("scroll", de, !0), window.removeEventListener("resize", D);
2001
2108
  }
2002
- async function H() {
2003
- var r, y, d;
2004
- t.disabled || l.value || (I.value = "", l.value = !0, await be(), Z(), (r = R.value) == null || r.focus(), (d = (y = E.value) == null ? void 0 : y.querySelector(".fx-opt.is-on")) == null || d.scrollIntoView({ block: "nearest" }), h());
2109
+ async function E() {
2110
+ var u, y, c;
2111
+ t.disabled || r.value || (S.value = "", r.value = !0, await Pe(), U(), (u = L.value) == null || u.focus(), (c = (y = g.value) == null ? void 0 : y.querySelector(".fx-opt.is-on")) == null || c.scrollIntoView({ block: "nearest" }), ge());
2005
2112
  }
2006
- function k() {
2007
- l.value && (l.value = !1, I.value = "", b());
2113
+ function D() {
2114
+ r.value && (r.value = !1, S.value = "", h());
2008
2115
  }
2009
- Ie(I, async () => {
2010
- l.value && (await be(), Z());
2116
+ Te(S, async () => {
2117
+ r.value && (await Pe(), U());
2011
2118
  });
2012
- function U(r) {
2119
+ function R(u) {
2013
2120
  var y;
2014
- if (r.key === "Escape")
2015
- r.preventDefault(), k(), (y = v.value) == null || y.focus();
2016
- else if (r.key === "Enter") {
2017
- r.preventDefault();
2018
- const d = X.value.find((L) => !L.disabled);
2019
- d && ye(d);
2121
+ if (u.key === "Escape")
2122
+ u.preventDefault(), D(), (y = p.value) == null || y.focus();
2123
+ else if (u.key === "Enter") {
2124
+ u.preventDefault();
2125
+ const c = Z.value.find((M) => !M.disabled);
2126
+ c && ce(c);
2020
2127
  }
2021
2128
  }
2022
- function P() {
2023
- l.value ? k() : H();
2129
+ function $() {
2130
+ r.value ? D() : E();
2024
2131
  }
2025
- function ye(r) {
2026
- if (!r.disabled) {
2027
- if (t.multiple && !r.command) {
2028
- n("toggle", r.value);
2132
+ function ce(u) {
2133
+ if (!u.disabled) {
2134
+ if (t.multiple && !u.command) {
2135
+ n("toggle", u.value);
2029
2136
  return;
2030
2137
  }
2031
- if (k(), t.multiple) {
2032
- n("update:modelValue", r.value);
2138
+ if (D(), t.multiple) {
2139
+ n("update:modelValue", u.value);
2033
2140
  return;
2034
2141
  }
2035
- r.value !== t.modelValue && n("update:modelValue", r.value);
2142
+ u.value !== t.modelValue && n("update:modelValue", u.value);
2036
2143
  }
2037
2144
  }
2038
- const na = Y(() => t.options.filter((r) => !r.disabled));
2039
- function oa(r) {
2145
+ const na = Y(() => t.options.filter((u) => !u.disabled));
2146
+ function oa(u) {
2040
2147
  const y = na.value;
2041
2148
  if (t.multiple || !y.length) {
2042
- H();
2149
+ E();
2043
2150
  return;
2044
2151
  }
2045
- const d = y.findIndex((q) => q.value === t.modelValue), L = r === "Home" ? 0 : r === "End" ? y.length - 1 : r === "ArrowDown" ? Math.min(y.length - 1, (d < 0 ? -1 : d) + 1) : Math.max(0, (d < 0 ? 1 : d) - 1), T = y[L];
2046
- T && T.value !== t.modelValue ? n("update:modelValue", T.value) : H();
2152
+ const c = y.findIndex((ee) => ee.value === t.modelValue), M = u === "Home" ? 0 : u === "End" ? y.length - 1 : u === "ArrowDown" ? Math.min(y.length - 1, (c < 0 ? -1 : c) + 1) : Math.max(0, (c < 0 ? 1 : c) - 1), O = y[M];
2153
+ O && O.value !== t.modelValue ? n("update:modelValue", O.value) : E();
2047
2154
  }
2048
- function sa(r) {
2155
+ function sa(u) {
2049
2156
  var y;
2050
- if (r.key === "Escape") {
2051
- if (!l.value) return;
2052
- r.preventDefault(), k(), (y = v.value) == null || y.focus();
2157
+ if (u.key === "Escape") {
2158
+ if (!r.value) return;
2159
+ u.preventDefault(), D(), (y = p.value) == null || y.focus();
2053
2160
  return;
2054
2161
  }
2055
- if (r.key === "Enter" || r.key === " ") {
2056
- r.preventDefault(), P();
2162
+ if (u.key === "Enter" || u.key === " ") {
2163
+ u.preventDefault(), $();
2057
2164
  return;
2058
2165
  }
2059
- r.key !== "ArrowDown" && r.key !== "ArrowUp" && r.key !== "Home" && r.key !== "End" || (r.preventDefault(), oa(r.key));
2166
+ u.key !== "ArrowDown" && u.key !== "ArrowUp" && u.key !== "Home" && u.key !== "End" || (u.preventDefault(), oa(u.key));
2060
2167
  }
2061
- return Le(b), (r, y) => (N(), C("div", {
2168
+ return Ie(h), (u, y) => (b(), k("div", {
2062
2169
  ref_key: "rootEl",
2063
- ref: u,
2064
- class: fe(["fx-sel", o.value])
2170
+ ref: d,
2171
+ class: pe(["fx-sel", o.value])
2065
2172
  }, [
2066
2173
  x("button", ca({
2067
2174
  ref_key: "btnEl",
2068
- ref: v
2069
- }, r.$attrs, {
2175
+ ref: p
2176
+ }, u.$attrs, {
2070
2177
  type: "button",
2071
- class: ["sch-input fx-btn", { "is-open": l.value }],
2178
+ class: ["sch-input fx-btn", { "is-open": r.value }],
2072
2179
  disabled: e.disabled,
2073
2180
  "aria-haspopup": "listbox",
2074
- "aria-expanded": l.value,
2075
- onClick: y[0] || (y[0] = (d) => P()),
2181
+ "aria-expanded": r.value,
2182
+ onClick: y[0] || (y[0] = (c) => $()),
2076
2183
  onKeydown: sa
2077
2184
  }), [
2078
- x("span", Sn, W(Q.value), 1)
2079
- ], 16, Mn),
2080
- (N(), da(ya, {
2185
+ x("span", In, W(J.value), 1)
2186
+ ], 16, Ln),
2187
+ (b(), da(ma, {
2081
2188
  to: "body",
2082
- disabled: !$.value
2189
+ disabled: !C.value
2083
2190
  }, [
2084
- x("div", Ln, [
2085
- l.value ? (N(), C("div", {
2191
+ x("div", Tn, [
2192
+ r.value ? (b(), k("div", {
2086
2193
  key: 0,
2087
2194
  ref_key: "popEl",
2088
- ref: E,
2089
- class: fe(["fx-pop", { "fx-pop-rich": w.value }]),
2195
+ ref: g,
2196
+ class: pe(["fx-pop", { "fx-pop-rich": A.value }]),
2090
2197
  role: "listbox",
2091
2198
  "aria-multiselectable": e.multiple || void 0,
2092
2199
  style: { visibility: "hidden" }
2093
2200
  }, [
2094
- e.menuTitle ? (N(), C("div", Rn, W(e.menuTitle), 1)) : z("", !0),
2095
- e.searchable ? (N(), C("div", On, [
2096
- ma(x("input", {
2201
+ e.menuTitle ? (b(), k("div", On, W(e.menuTitle), 1)) : z("", !0),
2202
+ e.searchable ? (b(), k("div", $n, [
2203
+ ya(x("input", {
2097
2204
  ref_key: "searchEl",
2098
- ref: R,
2099
- "onUpdate:modelValue": y[1] || (y[1] = (d) => I.value = d),
2205
+ ref: L,
2206
+ "onUpdate:modelValue": y[1] || (y[1] = (c) => S.value = c),
2100
2207
  class: "sch-input fx-pop-q",
2101
2208
  type: "search",
2102
2209
  placeholder: "Search",
2103
2210
  autocomplete: "off",
2104
2211
  spellcheck: "false",
2105
2212
  "aria-label": "Search",
2106
- onKeydown: U
2213
+ onKeydown: R
2107
2214
  }, null, 544), [
2108
- [pa, I.value]
2215
+ [pa, S.value]
2109
2216
  ])
2110
2217
  ])) : z("", !0),
2111
- e.searchable && !J.value.length ? (N(), C("div", Tn, "No matches")) : z("", !0),
2112
- (N(!0), C(He, null, fa(J.value, (d) => (N(), C(He, {
2113
- key: "heading" in d ? `heading:${d.heading}` : `option:${d.option.value}`
2218
+ e.searchable && !q.value.length ? (b(), k("div", xn, "No matches")) : z("", !0),
2219
+ (b(!0), k(He, null, fa(q.value, (c) => (b(), k(He, {
2220
+ key: "heading" in c ? `heading:${c.heading}` : `option:${c.option.value}`
2114
2221
  }, [
2115
- "heading" in d ? (N(), C("div", $n, W(d.heading), 1)) : (N(), C("div", {
2222
+ "heading" in c ? (b(), k("div", Yn, W(c.heading), 1)) : (b(), k("div", {
2116
2223
  key: 1,
2117
- class: fe(["fx-opt", {
2118
- "is-on": p(d.option),
2119
- "is-off": d.option.disabled,
2120
- "is-new": d.option.command
2224
+ class: pe(["fx-opt", {
2225
+ "is-on": f(c.option),
2226
+ "is-off": c.option.disabled,
2227
+ "is-new": c.option.command
2121
2228
  }]),
2122
2229
  role: "option",
2123
- "aria-selected": p(d.option),
2124
- onClick: (L) => ye(d.option)
2230
+ "aria-selected": f(c.option),
2231
+ onClick: (M) => ce(c.option)
2125
2232
  }, [
2126
2233
  y[2] || (y[2] = x("span", {
2127
2234
  class: "fx-tick",
@@ -2142,20 +2249,20 @@ const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re
2142
2249
  })
2143
2250
  ])
2144
2251
  ], -1)),
2145
- w.value ? (N(), C("span", Yn, [
2146
- x("b", null, W(d.option.label), 1),
2147
- d.option.hint ? (N(), C("small", Bn, W(d.option.hint), 1)) : z("", !0)
2148
- ])) : (N(), C(He, { key: 1 }, [
2149
- ha(W(d.option.label), 1)
2252
+ A.value ? (b(), k("span", _n, [
2253
+ x("b", null, W(c.option.label), 1),
2254
+ c.option.hint ? (b(), k("small", Fn, W(c.option.hint), 1)) : z("", !0)
2255
+ ])) : (b(), k(He, { key: 1 }, [
2256
+ ha(W(c.option.label), 1)
2150
2257
  ], 64))
2151
- ], 10, xn))
2258
+ ], 10, Bn))
2152
2259
  ], 64))), 128))
2153
- ], 10, In)) : z("", !0)
2260
+ ], 10, Rn)) : z("", !0)
2154
2261
  ])
2155
2262
  ], 8, ["disabled"]))
2156
2263
  ], 2));
2157
2264
  }
2158
- }), _n = ["id", "aria-labelledby", "aria-label"], We = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', Wo = /* @__PURE__ */ Re({
2265
+ }), Un = ["id", "aria-labelledby", "aria-label"], ze = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', Ko = /* @__PURE__ */ Re({
2159
2266
  __name: "ScheduleModal",
2160
2267
  props: {
2161
2268
  open: { type: Boolean },
@@ -2167,44 +2274,44 @@ const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re
2167
2274
  },
2168
2275
  emits: ["close"],
2169
2276
  setup(e, { emit: a }) {
2170
- const t = e, n = a, i = A(null);
2277
+ const t = e, n = a, i = P(null);
2171
2278
  let o = null;
2172
- function l() {
2173
- be(() => {
2174
- const u = i.value;
2175
- u && (u.querySelector(We) ?? u).focus();
2279
+ function r() {
2280
+ Pe(() => {
2281
+ const d = i.value;
2282
+ d && (d.querySelector(ze) ?? d).focus();
2176
2283
  });
2177
2284
  }
2178
- function s(u) {
2285
+ function s(d) {
2179
2286
  if (!t.open) return;
2180
- if (u.key === "Escape") {
2181
- u.preventDefault(), n("close");
2287
+ if (d.key === "Escape") {
2288
+ d.preventDefault(), n("close");
2182
2289
  return;
2183
2290
  }
2184
- if (u.key !== "Tab" || !i.value) return;
2185
- const v = Array.from(i.value.querySelectorAll(We));
2186
- if (!v.length) return;
2187
- const E = v[0], $ = v[v.length - 1];
2188
- u.shiftKey && document.activeElement === E ? (u.preventDefault(), $.focus()) : !u.shiftKey && document.activeElement === $ && (u.preventDefault(), E.focus());
2291
+ if (d.key !== "Tab" || !i.value) return;
2292
+ const p = Array.from(i.value.querySelectorAll(ze));
2293
+ if (!p.length) return;
2294
+ const g = p[0], C = p[p.length - 1];
2295
+ d.shiftKey && document.activeElement === g ? (d.preventDefault(), C.focus()) : !d.shiftKey && document.activeElement === C && (d.preventDefault(), g.focus());
2189
2296
  }
2190
- return Ie(
2297
+ return Te(
2191
2298
  () => t.open,
2192
- (u) => {
2193
- u ? (o = document.activeElement instanceof HTMLElement ? document.activeElement : null, l()) : (o == null || o.focus(), o = null);
2299
+ (d) => {
2300
+ d ? (o = document.activeElement instanceof HTMLElement ? document.activeElement : null, r()) : (o == null || o.focus(), o = null);
2194
2301
  },
2195
2302
  { immediate: !0 }
2196
- ), Se(() => document.addEventListener("keydown", s)), Le(() => {
2303
+ ), Le(() => document.addEventListener("keydown", s)), Ie(() => {
2197
2304
  document.removeEventListener("keydown", s), o = null;
2198
- }), (u, v) => e.open ? (N(), C("div", {
2305
+ }), (d, p) => e.open ? (b(), k("div", {
2199
2306
  key: 0,
2200
2307
  class: "modal-overlay open",
2201
- onClick: v[0] || (v[0] = va((E) => n("close"), ["self"]))
2308
+ onClick: p[0] || (p[0] = va((g) => n("close"), ["self"]))
2202
2309
  }, [
2203
2310
  x("div", {
2204
2311
  id: e.id,
2205
2312
  ref_key: "panel",
2206
2313
  ref: i,
2207
- class: fe(["schedule-modal-panel", e.panelClass]),
2314
+ class: pe(["schedule-modal-panel", e.panelClass]),
2208
2315
  style: ga(e.panelStyle),
2209
2316
  role: "dialog",
2210
2317
  "aria-modal": "true",
@@ -2212,100 +2319,101 @@ const Cn = ["data-hierarchy", "data-size", "data-icon"], Fo = /* @__PURE__ */ Re
2212
2319
  "aria-label": e.label,
2213
2320
  tabindex: "-1"
2214
2321
  }, [
2215
- ze(u.$slots, "default")
2216
- ], 14, _n)
2322
+ Ve(d.$slots, "default")
2323
+ ], 14, Un)
2217
2324
  ])) : z("", !0);
2218
2325
  }
2219
2326
  });
2220
2327
  export {
2221
- le as $,
2222
- Co as A,
2223
- Ge as B,
2224
- Zn as C,
2225
- Ne as D,
2226
- ba as E,
2227
- eo as F,
2228
- uo as G,
2229
- Io as H,
2230
- Aa as I,
2231
- bo as J,
2232
- Eo as K,
2233
- Ao as L,
2234
- Je as M,
2235
- D as N,
2236
- F as O,
2328
+ H as $,
2329
+ Lo as A,
2330
+ Jn as B,
2331
+ ao as C,
2332
+ se as D,
2333
+ je as E,
2334
+ ke as F,
2335
+ ba as G,
2336
+ no as H,
2337
+ yo as I,
2338
+ Oo as J,
2339
+ Ea as K,
2340
+ No as L,
2341
+ ko as M,
2342
+ bo as N,
2343
+ Ze as O,
2237
2344
  Na as P,
2238
- La as Q,
2239
- Jn as R,
2240
- Mo as S,
2241
- Ye as T,
2345
+ io as Q,
2346
+ eo as R,
2347
+ Io as S,
2348
+ F as T,
2242
2349
  aa as U,
2243
- Oo as V,
2244
- ko as W,
2245
- qn as X,
2246
- ue as Y,
2247
- se as Z,
2248
- Nn as _,
2249
- xo as a,
2250
- ne as a0,
2251
- so as a1,
2252
- ro as a2,
2253
- Oe as a3,
2254
- oo as a4,
2255
- no as a5,
2256
- lo as a6,
2257
- vn as a7,
2258
- re as a8,
2259
- Do as a9,
2260
- vo as aa,
2261
- go as ab,
2262
- Ro as ac,
2263
- Ta as ad,
2264
- ho as ae,
2265
- ka as af,
2266
- Gn as ag,
2267
- xa as ah,
2268
- $e as ai,
2269
- Bo as aj,
2270
- pn as ak,
2271
- fo as al,
2272
- xe as am,
2273
- he as an,
2274
- Me as ao,
2275
- Ia as ap,
2276
- Fo as aq,
2277
- Uo as ar,
2278
- Wo as as,
2279
- B as at,
2280
- Kn as au,
2281
- _o as av,
2282
- mo as aw,
2283
- co as ax,
2284
- ie as ay,
2285
- yo as az,
2286
- M as b,
2287
- Yo as c,
2288
- K as d,
2289
- Qn as e,
2290
- c as f,
2291
- yn as g,
2292
- No as h,
2293
- Ma as i,
2294
- po as j,
2295
- To as k,
2296
- wo as l,
2297
- Ho as m,
2298
- Po as n,
2350
+ Ia as V,
2351
+ So as W,
2352
+ Be as X,
2353
+ xo as Y,
2354
+ to as Z,
2355
+ K as _,
2356
+ _o as a,
2357
+ le as a0,
2358
+ ie as a1,
2359
+ Cn as a2,
2360
+ oe as a3,
2361
+ lo as a4,
2362
+ co as a5,
2363
+ Se as a6,
2364
+ ro as a7,
2365
+ Ta as a8,
2366
+ mo as a9,
2367
+ fo as aA,
2368
+ Dn as aa,
2369
+ j as ab,
2370
+ Ao as ac,
2371
+ wo as ad,
2372
+ Ho as ae,
2373
+ $o as af,
2374
+ xa as ag,
2375
+ Do as ah,
2376
+ Ca as ai,
2377
+ Xn as aj,
2378
+ Ba as ak,
2379
+ xe as al,
2380
+ Uo as am,
2381
+ go as an,
2382
+ Ye as ao,
2383
+ fe as ap,
2384
+ Me as aq,
2385
+ zo as ar,
2386
+ Vo as as,
2387
+ Ko as at,
2388
+ B as au,
2389
+ Qn as av,
2390
+ Wo as aw,
2391
+ ho as ax,
2392
+ po as ay,
2393
+ re as az,
2394
+ N as b,
2395
+ Fo as c,
2396
+ G as d,
2397
+ To as e,
2398
+ Zn as f,
2399
+ pn as g,
2400
+ Mo as h,
2401
+ Sa as i,
2402
+ vo as j,
2403
+ Yo as k,
2404
+ Eo as l,
2405
+ Po as m,
2406
+ Co as n,
2299
2407
  m as o,
2300
- So as p,
2408
+ l as p,
2301
2409
  Ce as q,
2302
- io as r,
2303
- Ea as s,
2304
- to as t,
2305
- Lo as u,
2306
- ke as v,
2307
- ao as w,
2308
- Xn as x,
2309
- $o as y,
2310
- jn as z
2410
+ uo as r,
2411
+ Pa as s,
2412
+ so as t,
2413
+ Ro as u,
2414
+ Ne as v,
2415
+ oo as w,
2416
+ hn as x,
2417
+ qn as y,
2418
+ Bo as z
2311
2419
  };