@feedmepos/mf-hrm-portal 2.3.0-dev.13 → 2.3.0-dev.15

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 (65) hide show
  1. package/dist/{ApprovalCodeList-D3egZFML.js → ApprovalCodeList-CY0ox1dX.js} +4 -4
  2. package/dist/{AuditLogList-BzbaEsSj.js → AuditLogList-CBkA-KQT.js} +17 -18
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-Do52KbKm.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-B8cb8yqV.js} +2 -2
  4. package/dist/{EmployeeList-BiM8dRwZ.js → EmployeeList-0PrcuHPJ.js} +255 -267
  5. package/dist/{FormItem.vue_vue_type_script_setup_true_lang-CUnlKsxk.js → FormItem.vue_vue_type_script_setup_true_lang-rjDE1B4E.js} +6 -6
  6. package/dist/{GrantUserList-Dj2ms20E.js → GrantUserList-Dw923P2j.js} +5 -5
  7. package/dist/{Main-DmpwTPaI.js → Main-BqX7n1ik.js} +9 -9
  8. package/dist/{Main-C2z7Jf9A.js → Main-C0bcn2NY.js} +5 -5
  9. package/dist/{Main-DklZWoKj.js → Main-Dpf2KdSH.js} +2 -2
  10. package/dist/{PermissionSetList-C-qgCcRO.js → PermissionSetList-xrI130SW.js} +5 -5
  11. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-ggZB5zWW.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-3_8qycrF.js} +465 -465
  12. package/dist/{RoleList-ohfin77B.js → RoleList-DPkG5dg9.js} +7 -7
  13. package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DYLLW46A.js +501 -0
  14. package/dist/{ScheduleGeneralPage-aCljFf21.js → ScheduleGeneralPage-CISbuAff.js} +141 -143
  15. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-x_-BYkcc.js → ScheduleModal.vue_vue_type_script_setup_true_lang-BeTuMw3f.js} +989 -858
  16. package/dist/SchedulePage-Dn6_TiBS.js +18757 -0
  17. package/dist/{SchedulePositionPage-CID91orD.js → SchedulePositionPage-Cu3WRfH-.js} +79 -81
  18. package/dist/{SelectFilter-CG13h83-.js → SelectFilter-ssnRUIN6.js} +1 -1
  19. package/dist/{TeamMemberList-DJIKL4dE.js → TeamMemberList-DTqNCDJb.js} +35 -36
  20. package/dist/{TimesheetList-BPXWPNfT.js → TimesheetList-CA19TmKm.js} +52 -53
  21. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-DVcV0knM.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-B1jnsZpD.js} +2 -2
  22. package/dist/{app-Bz8568j8.js → app-3xGY2Rn0.js} +2062 -1800
  23. package/dist/app.js +1 -1
  24. package/dist/{dayjs.min-DhSRKSu4.js → dayjs.min-C_c8OoEU.js} +1 -1
  25. package/dist/{employee-BM44u8b-.js → employee-Dt0y51t3.js} +3 -3
  26. package/dist/{iteration-BHDxs89d.js → iteration-C4YvbrCe.js} +1 -1
  27. package/dist/{lodash-DgSYLwYD.js → lodash-huRs3Cbj.js} +1 -1
  28. package/dist/object-Dwyg2LgX.js +16 -0
  29. package/dist/{role-BMJ7LEHN.js → role-fM58UmtC.js} +1 -1
  30. package/dist/{rule-CCo7_ckA.js → rule-CCN0QCPF.js} +2 -2
  31. package/dist/src/views/audit-log/locales/index.d.ts +252 -0
  32. package/dist/src/views/scheduling/components/ScheduleAreaRows.vue.d.ts +2 -0
  33. package/dist/src/views/scheduling/components/ScheduleBoardAreaRows.vue.d.ts +1 -0
  34. package/dist/src/views/scheduling/components/ScheduleOnboardingSettings.vue.d.ts +6 -0
  35. package/dist/src/views/scheduling/composables/onboarding-types.d.ts +2 -1
  36. package/dist/src/views/scheduling/composables/schedule-demand-domain.d.ts +13 -1
  37. package/dist/src/views/scheduling/composables/schedule-error.d.ts +3 -0
  38. package/dist/src/views/scheduling/composables/schedule-quick-pick.d.ts +22 -0
  39. package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +5 -2
  40. package/dist/src/views/scheduling/composables/useScheduleAddPick.d.ts +3 -11
  41. package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +7 -0
  42. package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +45 -1
  43. package/dist/src/views/scheduling/composables/useScheduleCostRail.d.ts +13 -1
  44. package/dist/src/views/scheduling/composables/useScheduleDayTimeline.d.ts +2 -2
  45. package/dist/src/views/scheduling/composables/useScheduleDragDrop.d.ts +1 -0
  46. package/dist/src/views/scheduling/composables/useScheduleEmployeeAccess.d.ts +14 -6
  47. package/dist/src/views/scheduling/composables/useScheduleEmployeeCandidates.d.ts +3 -0
  48. package/dist/src/views/scheduling/composables/useScheduleEmployeeValidation.d.ts +0 -2
  49. package/dist/src/views/scheduling/composables/useScheduleOnboardingEmployees.d.ts +25 -0
  50. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +163 -4
  51. package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +44 -0
  52. package/dist/src/views/scheduling/composables/useScheduleSetupBanner.d.ts +2 -2
  53. package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +22 -0
  54. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +26 -2
  55. package/dist/src/views/scheduling/country-rules/index.d.ts +8 -3
  56. package/dist/src/views/scheduling/data.d.ts +17 -0
  57. package/dist/src/views/scheduling/schedule-store.d.ts +7 -7
  58. package/dist/src/views/scheduling/types.d.ts +5 -0
  59. package/dist/style.css +1 -1
  60. package/dist/tsconfig.app.tsbuildinfo +1 -1
  61. package/dist/{useReportPermissions-C_Cd__n1.js → useReportPermissions-BlX_Mk5f.js} +3 -3
  62. package/package.json +1 -1
  63. package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-diuWysro.js +0 -492
  64. package/dist/SchedulePage-DdMHF6kX.js +0 -17993
  65. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
@@ -1,9 +1,10 @@
1
- import { onMounted as Se, onBeforeUnmount as Le, ref as A, reactive as R, shallowRef as we, watch as Ie, computed as $, defineComponent as Re, createElementBlock as k, openBlock as N, renderSlot as ze, useAttrs as la, nextTick as be, normalizeClass as pe, createElementVNode as Y, createBlock as ua, mergeProps as da, toDisplayString as U, Teleport as ca, createCommentVNode as W, withDirectives as ya, vModelText as ma, Fragment as He, renderList as pa, createTextVNode as fa, withModifiers as ha, normalizeStyle as va } from "vue";
2
- import { useRoute as ga, useRouter as Da } from "vue-router";
3
- import { useCoreStore as Ve } from "@feedmepos/mf-common";
4
- import { g as v, b as f, u as wa } from "./restaurant-BbYRA_IT.js";
5
- import { E as Pe, u as Ke } from "./employee-BM44u8b-.js";
6
- function zn(e) {
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
+ import { useRoute as Da, useRouter as wa } from "vue-router";
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-Dt0y51t3.js";
6
+ import { t as Oe, q as Aa } from "./rule-CCN0QCPF.js";
7
+ function Qn(e) {
7
8
  let a = null;
8
9
  function t() {
9
10
  if (!a) return;
@@ -11,104 +12,104 @@ function zn(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 Ha(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 Aa(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] = Aa(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
- function Ea(e) {
39
- const a = (Ne(e) % 1440 + 1440) % 1440, t = Math.floor(a / 60), n = a % 60, i = t < 12 ? "am" : "pm", s = t % 12 || 12;
40
- return n ? `${s}:${String(n).padStart(2, "0")}${i}` : `${s}${i}`;
39
+ function ba(e) {
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;
41
+ return n ? `${o}:${String(n).padStart(2, "0")}${i}` : `${o}${i}`;
41
42
  }
42
- function Vn(e) {
43
- return Ea(Ha(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, s] = n.startTime.split(":").map(Number), [l, o] = n.endTime.split(":").map(Number);
50
- let u = l * 60 + o - (i * 60 + s);
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 Kn(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((s, l) => s + (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 Gn(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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
64
+ const te = 500, ka = 10, $e = 6, qn = 1500, Xe = 1e6, H = {
64
65
  async listEmployeeProfiles(e) {
65
- return v(
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 v(
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 v(
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 v(
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 v(
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 v(
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 v(
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 v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
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 v(
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 v(
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 v(
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 v(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 v(
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 v(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 v(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 v(
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 v(
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 v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
192
193
  },
193
194
  /** Atomically replaces several date/weekday demand generations. */
194
195
  async bulkReplaceDemands(e, a) {
195
- return v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
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 v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
210
211
  },
211
212
  /** A one-off shift assignment. */
212
213
  async createAssignment(e, a) {
213
- return v(
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 v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
224
225
  },
225
226
  /** Atomically applies assignment updates, creates, and deletes used by moves and swaps. */
226
227
  async bulkSaveAssignments(e, a) {
227
- return v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
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 v(
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
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 v(
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: R([]),
267
- positionRecords: R([]),
268
- rolePositions: R({}),
269
- outlet: R({ name: "" }),
270
- locationOptions: R([]),
271
- locationLabelById: R({}),
272
- departmentOptions: R([]),
273
- compensationGroupOptions: R([]),
274
- compensationGroupMeta: R({}),
275
- existingStaff: R([]),
276
- shiftTemplates: R([]),
277
- rules: R({
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
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, ba = 10, Te = 6, jn = 1500, Qe = 1e6, w = {
300
305
  }
301
306
  })
302
307
  }, {
303
- payload: c,
304
- loading: $e,
308
+ payload: l,
309
+ loading: xe,
305
310
  rosterLoading: Ye,
306
311
  loadError: fe,
307
- scheduleSetupCompleted: Je,
308
- dataVersion: V,
312
+ scheduleSetupCompleted: Ze,
313
+ dataVersion: G,
309
314
  outletId: m,
310
- restaurantEmployees: se,
315
+ restaurantEmployees: re,
311
316
  employeeConfigs: F,
312
- employeeOutletIds: Ze,
317
+ employeeOutletIds: qe,
313
318
  businessEmployees: Ae,
314
- positions: Pa,
315
- positionRecords: K,
316
- rolePositions: Qn,
317
- outlet: Na,
318
- locationOptions: xe,
319
- locationLabelById: ne,
320
- compensationGroupMeta: Xn,
321
- existingStaff: Jn,
322
- shiftTemplates: Zn,
323
- rules: C
324
- } = Xe;
325
- function ka() {
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, {
319
+ positions: Na,
320
+ positionRecords: B,
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 Ca(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,151 +353,169 @@ 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 qn(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 eo(e, a) {
352
- const t = (s) => Date.UTC(s.getFullYear(), s.getMonth(), s.getDate()), n = t(Ce(e)), i = t(Ce(a));
353
- return Math.trunc((i - n) / (ke * 24 * 60 * 60 * 1e3));
360
+ function so(e, a) {
361
+ const t = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), n = t(Ce(e)), i = t(Ce(a));
362
+ return Math.trunc((i - n) / (Ne * 24 * 60 * 60 * 1e3));
354
363
  }
355
- const ie = Ca;
356
- let G = null, j = null, z = null, te = 0, he = null;
357
- function Be(e) {
358
- return e === m.value ? !1 : (ka(), m.value = e, c.value = null, G = null, j = null, fe.value = null, he = null, Je.value = !1, se.value = [], F.value = [], z = null, te += 1, V.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
370
  if (!(!e || he === e)) {
362
371
  Ye.value = !0;
363
372
  try {
364
- await Ma(e);
373
+ await La(e);
365
374
  } finally {
366
375
  Ye.value = !1;
367
376
  }
368
377
  }
369
378
  }
370
- async function Ma(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 && (se.value = a.items, F.value = await w.listEmployeeConfigs(e), he = e, V.value += 1, Ra().then((t) => {
377
- e === m.value && (Ze.value = t, V.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 Sa(e) {
389
+ async function Ia(e) {
381
390
  const a = m.value;
382
391
  if (!a || !e.length) return;
383
- const t = await w.saveEmployeeConfigs(a, { configs: e });
384
- F.value = t, V.value += 1;
392
+ const t = await H.saveEmployeeConfigs(a, { configs: e });
393
+ F.value = t, G.value += 1;
385
394
  }
386
- async function La(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 Sa([{ 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
412
  e && (he = null, await Me(e));
396
413
  }
397
- async function qe(e, a) {
398
- const t = Ke(), n = (await re(!0)).find((o) => o._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
- const i = n.restaurantRole.map((o) => ({
401
- restaurantId: o.restaurantId,
402
- roleId: o.roleId
403
- })), s = a(i);
404
- if (!s.length)
417
+ const i = n.restaurantRole.map((s) => ({
418
+ restaurantId: s.restaurantId,
419
+ roleId: s.roleId
420
+ })), o = a(i);
421
+ if (!o.length)
405
422
  throw new Error(
406
423
  "An employee must keep at least 1 location, otherwise they are deleted. To delete them, use the Employee page."
407
424
  );
408
425
  (n.isMasterUser ? "master" : "user") === "master" ? await t.updateMasterEmployee(e, {
409
426
  user: { name: n.name, passcode: n.passcode, code: n.code ?? "" },
410
- roles: s,
427
+ roles: o,
411
428
  previousRoles: i
412
429
  }) : await t.updateEmployee(e, {
413
430
  user: { name: n.name, passcode: n.passcode },
414
- roles: s,
431
+ roles: o,
415
432
  previousRoles: i
416
- }), await re(!0);
417
- }
418
- async function ao(e, a, t = "") {
419
- const n = [...new Set(a.filter(Boolean))];
420
- n.length && (await qe(e, (i) => [
421
- ...i.filter((s) => !n.includes(s.restaurantId)),
422
- ...n.map((s) => ({ restaurantId: s, roleId: t }))
423
- ]), m.value && n.includes(m.value) && await La(e, !0), await Oe());
424
- }
425
- async function to(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, s]) => ({ restaurantId: i, roleId: s }))
431
- ]), await Oe();
432
- }
433
- async function no(e, a) {
434
- const t = Ke(), n = (await re(!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((h, E) => h.restaurantId.localeCompare(E.restaurantId)).map((h) => `${h.restaurantId}:${h.roleId}`).join("|"), s = i(n.restaurantRole) !== i(a.roles), l = n.passcode !== a.passcode || n.isMasterUser !== a.masterUser || a.masterUser && (n.code ?? "") !== a.masterCode;
437
- if (!s && !l) return;
438
- const o = 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
- previousRoles: o
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
- previousRoles: o
483
+ previousRoles: s
456
484
  });
457
- }
458
- await re(!0), await Oe();
485
+ await K(!0), await Se();
459
486
  }
460
- let ee = null;
461
- async function Ia() {
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(ba, 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 re(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 = Ia().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 Ra() {
515
+ async function $a() {
489
516
  const e = {};
490
517
  try {
491
- (await re()).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,83 +523,93 @@ async function Ra() {
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 Oa(e) {
503
- const a = ie(e), t = ie(oe(e, 6));
504
- _e(a, t) || z && (await z, _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 oo() {
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 so(e) {
539
+ async function co(e) {
513
540
  if (!m.value) throw new Error("No outlet selected");
514
- const a = await w.createEmployeeProfile(m.value, e);
515
- c.value && (c.value.employees.push(a), V.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 io(e) {
518
- await w.validatePosAccess(e);
544
+ async function mo(e) {
545
+ await H.validatePosAccess(e);
519
546
  }
520
- async function ro(e, a) {
547
+ async function yo(e, a) {
521
548
  if (!m.value) throw new Error("No outlet selected");
522
- const t = await w.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, s) => s === 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 lo(e) {
532
- const a = await w.createPosition(e);
533
- c.value && (c.value = { ...c.value, positions: [...c.value.positions, a] });
534
- }
535
- async function uo(e, a) {
536
- const t = await w.updatePosition(e, a);
537
- c.value && (c.value = {
538
- ...c.value,
539
- positions: c.value.positions.map((n) => n.id === e ? t : n)
540
- });
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) => ({
570
+ ...o,
571
+ primaryPosition: o.primaryPosition && i(o.primaryPosition) ? { ...o.primaryPosition, positionName: t.name } : o.primaryPosition,
572
+ secondaryPositions: o.secondaryPositions.map(
573
+ (r) => i(r) ? { ...r, positionName: t.name } : r
574
+ )
575
+ }))
576
+ };
577
+ }
541
578
  }
542
- async function co(e) {
543
- await w.deletePosition(e), c.value && (c.value = {
544
- ...c.value,
545
- 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)
546
583
  });
547
584
  }
548
- async function yo(e, a) {
585
+ async function vo(e, a) {
549
586
  var i;
550
587
  if (!m.value) throw new Error("No outlet selected");
551
- const t = (i = c.value) == null ? void 0 : i.days.find((s) => s.date === e), n = await w.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, {
552
589
  ...a,
553
590
  expectedUpdatedAt: a.expectedUpdatedAt ?? (t == null ? void 0 : t.updatedAt)
554
591
  });
555
- if (c.value) {
556
- const s = c.value.days.filter((l) => l.date !== e);
557
- n && s.push(n), c.value = { ...c.value, days: s };
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 };
558
595
  }
559
596
  }
560
- async function mo(e) {
561
- await $a([e]);
597
+ async function go(e) {
598
+ await Ba([e]);
562
599
  }
563
- function Ta(e) {
600
+ function Ya(e) {
564
601
  const a = e.periods.flatMap((t) => {
565
- const n = (t.roles ?? []).filter((l) => l.positionName && l.headcount > 0), i = n.reduce((l, o) => l + o.headcount, 0), s = {
602
+ const n = (t.roles ?? []).filter((r) => r.positionName && r.headcount > 0), i = n.reduce((r, s) => r + s.headcount, 0), o = {
566
603
  startTime: t.startTime,
567
604
  endTime: t.endTime
568
605
  };
569
606
  return [
570
- ...n.map((l) => ({
571
- ...s,
572
- headcount: l.headcount,
573
- position: { positionId: l.positionId, positionName: l.positionName }
607
+ ...n.map((r) => ({
608
+ ...o,
609
+ headcount: r.headcount,
610
+ position: { positionId: r.positionId, positionName: r.positionName }
574
611
  })),
575
- ...t.headcount > i ? [{ ...s, headcount: t.headcount - i }] : []
612
+ ...t.headcount > i ? [{ ...o, headcount: t.headcount - i }] : []
576
613
  ];
577
614
  });
578
615
  return {
@@ -580,82 +617,107 @@ function Ta(e) {
580
617
  demands: a
581
618
  };
582
619
  }
583
- async function $a(e) {
620
+ async function Ba(e) {
584
621
  if (!m.value) throw new Error("No outlet selected");
585
622
  if (!e.length) return;
586
- const a = e.map(Ta), t = e.length === 1 ? await w.replaceDemands(m.value, a[0]) : await w.bulkReplaceDemands(m.value, { replacements: a });
587
- if (c.value) {
588
- const n = new Set(e.map((s) => s.date)), i = c.value.demands.filter((s) => s.date === null || !n.has(s.date));
589
- 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] };
590
627
  }
591
628
  }
592
- async function po(e, a) {
629
+ async function Do(e, a) {
593
630
  if (!m.value) throw new Error("No outlet selected");
594
- const t = c.value;
595
- if (!t || t.demands.some((s) => s.date === a)) return 0;
596
- const n = t.demands.filter((s) => s.date === e);
631
+ const t = l.value;
632
+ if (!t || t.demands.some((o) => o.date === a)) return 0;
633
+ const n = t.demands.filter((o) => o.date === e);
597
634
  if (!n.length) return 0;
598
635
  const i = await Promise.all(
599
636
  n.map(
600
- (s) => w.createDemand(m.value, {
637
+ (o) => H.createDemand(m.value, {
601
638
  date: a,
602
- startTime: s.startTime,
603
- endTime: s.endTime,
604
- headcount: s.headcount,
605
- ...s.position ? {
639
+ startTime: o.startTime,
640
+ endTime: o.endTime,
641
+ headcount: o.headcount,
642
+ ...o.position && t.positions.some(
643
+ (r) => o.position.positionId ? r.id === o.position.positionId : r.name.toLocaleLowerCase() === o.position.positionName.toLocaleLowerCase()
644
+ ) ? {
606
645
  position: {
607
- positionId: s.position.positionId,
608
- positionName: s.position.positionName
646
+ positionId: o.position.positionId,
647
+ positionName: o.position.positionName
609
648
  }
610
649
  } : {}
611
650
  })
612
651
  )
613
652
  );
614
- 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;
615
654
  }
616
- async function fo(e) {
655
+ async function wo(e) {
617
656
  if (!m.value) throw new Error("No outlet selected");
618
- return w.generateAutoSchedule(m.value, e);
657
+ return H.generateAutoSchedule(m.value, e);
619
658
  }
620
- async function ho() {
659
+ async function Ho() {
621
660
  if (!m.value) throw new Error("No outlet selected");
622
- return w.getAutoScheduleCapabilities(m.value);
661
+ return H.getAutoScheduleCapabilities(m.value);
623
662
  }
624
- async function vo(e) {
663
+ async function Ao(e) {
625
664
  if (!m.value) throw new Error("No outlet selected");
626
- return w.applyAutoSchedule(m.value, e);
665
+ return H.applyAutoSchedule(m.value, e);
627
666
  }
628
- async function go(e) {
667
+ async function Eo(e) {
629
668
  if (!m.value) throw new Error("No outlet selected");
630
- return w.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;
631
677
  }
632
- async function Do(e) {
678
+ async function Po(e) {
633
679
  if (!m.value) throw new Error("No outlet selected");
634
- e.length && await w.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
+ }
635
687
  }
636
- async function wo(e) {
688
+ async function bo(e) {
637
689
  if (!m.value) throw new Error("No outlet selected");
638
- const a = await w.createTimeOff(m.value, e);
639
- 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;
640
692
  }
641
- async function Ho(e, a) {
693
+ async function ko(e, a) {
642
694
  if (!m.value) throw new Error("No outlet selected");
643
- const t = await w.updateTimeOffStatus(m.value, e, a);
644
- return t && c.value && (c.value = {
645
- ...c.value,
646
- 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)
647
699
  }), t;
648
700
  }
649
- async function Ao(e) {
701
+ async function No(e) {
650
702
  if (!m.value) throw new Error("No outlet selected");
651
- await w.deleteTimeOff(m.value, e), c.value && (c.value = {
652
- ...c.value,
653
- 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)
654
706
  });
655
707
  }
656
- async function Eo(e) {
708
+ async function Co(e) {
657
709
  if (!m.value) throw new Error("No outlet selected");
658
- return w.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;
659
721
  }
660
722
  async function ea(e, a) {
661
723
  const t = m.value;
@@ -663,28 +725,28 @@ async function ea(e, a) {
663
725
  fe.value = "No outlet selected";
664
726
  return;
665
727
  }
666
- const n = ie(e), i = ie(a), s = ++te;
667
- $e.value = !0, fe.value = null;
668
- const l = (async () => {
728
+ const n = j(e), i = j(a), o = ++ne;
729
+ xe.value = !0, fe.value = null;
730
+ const r = (async () => {
669
731
  try {
670
- const o = await w.readBoard(t, n, i);
671
- if (m.value !== t || s !== te) return;
672
- c.value = o, Je.value = o.settings.setupCompleted, G = n, j = i, V.value += 1;
673
- } catch (o) {
674
- if (m.value !== t || s !== te) return;
675
- fe.value = o instanceof Error ? o.message : "Could not load the schedule";
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;
735
+ } catch (s) {
736
+ if (m.value !== t || o !== ne) return;
737
+ fe.value = s instanceof Error ? s.message : "Could not load the schedule";
676
738
  } finally {
677
- m.value === t && s === te && ($e.value = !1);
739
+ m.value === t && o === ne && (xe.value = !1);
678
740
  }
679
741
  })();
680
- z = l;
742
+ V = r;
681
743
  try {
682
- await l;
744
+ await r;
683
745
  } finally {
684
- z === l && (z = null);
746
+ V === r && (V = null);
685
747
  }
686
748
  }
687
- const Ya = "AE", xa = "Asia/Dubai", Ba = {
749
+ const _a = "AE", Fa = "Asia/Dubai", Ua = {
688
750
  NORMAL: {
689
751
  overtime: 1.25
690
752
  },
@@ -696,13 +758,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
696
758
  regular: 2.5,
697
759
  overtime: 1.5
698
760
  }
699
- }, _a = {
761
+ }, Wa = {
700
762
  maxHoursPerMonth: null
701
- }, Fa = {
702
- minHoursPerDay: null,
703
- maxHoursPerDay: 8,
704
- maxHoursPerWeek: 48
705
- }, Ua = [
763
+ }, za = {
764
+ fullTime: {
765
+ minHoursPerDay: null,
766
+ maxHoursPerDay: 8,
767
+ maxHoursPerWeek: 48
768
+ },
769
+ partTime: {
770
+ maxHoursPerWeek: 32
771
+ }
772
+ }, Va = [
706
773
  {
707
774
  month: 1,
708
775
  day: 1,
@@ -718,7 +785,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
718
785
  day: 3,
719
786
  name: "UAE National Day Holiday"
720
787
  }
721
- ], Wa = {
788
+ ], Ka = {
722
789
  2026: {
723
790
  "2026-01-01": "Gregorian New Year",
724
791
  "2026-03-20": "Eid Al-Fitr Holiday",
@@ -748,15 +815,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
748
815
  "2027-12-02": "UAE National Day",
749
816
  "2027-12-03": "UAE National Day Holiday"
750
817
  }
751
- }, za = {
752
- countryCode: Ya,
753
- timezone: xa,
754
- payRate: Ba,
755
- overtime: _a,
756
- workingHours: Fa,
757
- recurringPublicHolidays: Ua,
758
- publicHolidays: Wa
759
- }, Va = "BN", Ka = "Asia/Brunei", Ga = {
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 = {
760
827
  NORMAL: {
761
828
  overtime: 1.5
762
829
  },
@@ -768,13 +835,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
768
835
  regular: 2,
769
836
  overtime: 3
770
837
  }
771
- }, ja = {
838
+ }, Ja = {
772
839
  maxHoursPerMonth: 72
773
- }, Qa = {
774
- minHoursPerDay: null,
775
- maxHoursPerDay: 8,
776
- maxHoursPerWeek: 44
777
- }, Xa = [
840
+ }, Za = {
841
+ fullTime: {
842
+ minHoursPerDay: null,
843
+ maxHoursPerDay: 8,
844
+ maxHoursPerWeek: 44
845
+ },
846
+ partTime: {
847
+ maxHoursPerWeek: 30
848
+ }
849
+ }, qa = [
778
850
  {
779
851
  month: 1,
780
852
  day: 1,
@@ -800,7 +872,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
800
872
  day: 25,
801
873
  name: "Christmas Day"
802
874
  }
803
- ], Ja = {
875
+ ], et = {
804
876
  2026: {
805
877
  "2026-01-01": "New Year's Day",
806
878
  "2026-02-17": "Chinese New Year",
@@ -830,15 +902,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
830
902
  "2027-08-15": "Prophet Muhammad's Birthday",
831
903
  "2027-12-25": "Christmas Day"
832
904
  }
833
- }, Za = {
834
- countryCode: Va,
835
- timezone: Ka,
836
- payRate: Ga,
837
- overtime: ja,
838
- workingHours: Qa,
839
- recurringPublicHolidays: Xa,
840
- publicHolidays: Ja
841
- }, qa = "ID", et = "Asia/Jakarta", at = {
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 = {
842
914
  NORMAL: {
843
915
  overtime: 1.5
844
916
  },
@@ -850,13 +922,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
850
922
  regular: 2,
851
923
  overtime: 2
852
924
  }
853
- }, tt = {
925
+ }, st = {
854
926
  maxHoursPerMonth: 72
855
- }, nt = {
856
- minHoursPerDay: null,
857
- maxHoursPerDay: 8,
858
- maxHoursPerWeek: 40
859
- }, ot = [
927
+ }, it = {
928
+ fullTime: {
929
+ minHoursPerDay: null,
930
+ maxHoursPerDay: 8,
931
+ maxHoursPerWeek: 40
932
+ },
933
+ partTime: {
934
+ maxHoursPerWeek: null
935
+ }
936
+ }, rt = [
860
937
  {
861
938
  month: 1,
862
939
  day: 1,
@@ -877,7 +954,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
877
954
  day: 25,
878
955
  name: "Christmas Day"
879
956
  }
880
- ], st = {
957
+ ], lt = {
881
958
  2026: {
882
959
  "2026-01-01": "New Year's Day",
883
960
  "2026-01-16": "Isra Mi'raj",
@@ -917,15 +994,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
917
994
  "2027-12-25": "Christmas Day",
918
995
  "2027-12-26": "Isra Mi'raj"
919
996
  }
920
- }, it = {
921
- countryCode: qa,
922
- timezone: et,
923
- payRate: at,
924
- overtime: tt,
925
- workingHours: nt,
926
- recurringPublicHolidays: ot,
927
- publicHolidays: st
928
- }, rt = "MO", lt = "Asia/Macau", ut = {
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 = {
929
1006
  NORMAL: {
930
1007
  overtime: 1.5
931
1008
  },
@@ -937,13 +1014,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
937
1014
  regular: 2,
938
1015
  overtime: 3
939
1016
  }
940
- }, dt = {
1017
+ }, yt = {
941
1018
  maxHoursPerMonth: null
942
- }, ct = {
943
- minHoursPerDay: null,
944
- maxHoursPerDay: 8,
945
- maxHoursPerWeek: 48
946
- }, yt = [
1019
+ }, pt = {
1020
+ fullTime: {
1021
+ minHoursPerDay: null,
1022
+ maxHoursPerDay: 8,
1023
+ maxHoursPerWeek: 48
1024
+ },
1025
+ partTime: {
1026
+ maxHoursPerWeek: null
1027
+ }
1028
+ }, ft = [
947
1029
  {
948
1030
  month: 1,
949
1031
  day: 1,
@@ -969,7 +1051,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
969
1051
  day: 25,
970
1052
  name: "Christmas Day"
971
1053
  }
972
- ], mt = {
1054
+ ], ht = {
973
1055
  2026: {
974
1056
  "2026-01-01": "New Year's Day",
975
1057
  "2026-02-17": "Lunar New Year's Day",
@@ -1026,15 +1108,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1026
1108
  "2027-12-25": "Christmas Day",
1027
1109
  "2027-12-27": "Compensatory rest day"
1028
1110
  }
1029
- }, pt = {
1030
- countryCode: rt,
1031
- timezone: lt,
1032
- payRate: ut,
1033
- overtime: dt,
1034
- workingHours: ct,
1035
- recurringPublicHolidays: yt,
1036
- publicHolidays: mt
1037
- }, ft = "MV", ht = "Indian/Maldives", vt = {
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 = {
1038
1120
  NORMAL: {
1039
1121
  overtime: 1.5
1040
1122
  },
@@ -1046,13 +1128,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1046
1128
  regular: 2,
1047
1129
  overtime: 3
1048
1130
  }
1049
- }, gt = {
1131
+ }, Ht = {
1050
1132
  maxHoursPerMonth: null
1051
- }, Dt = {
1052
- minHoursPerDay: null,
1053
- maxHoursPerDay: 8,
1054
- maxHoursPerWeek: 48
1055
- }, wt = [
1133
+ }, At = {
1134
+ fullTime: {
1135
+ minHoursPerDay: null,
1136
+ maxHoursPerDay: 8,
1137
+ maxHoursPerWeek: 48
1138
+ },
1139
+ partTime: {
1140
+ maxHoursPerWeek: null
1141
+ }
1142
+ }, Et = [
1056
1143
  {
1057
1144
  month: 1,
1058
1145
  day: 1,
@@ -1078,7 +1165,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1078
1165
  day: 11,
1079
1166
  name: "Republic Day"
1080
1167
  }
1081
- ], Ht = {
1168
+ ], Pt = {
1082
1169
  2026: {
1083
1170
  "2026-01-01": "New Year's Day",
1084
1171
  "2026-03-20": "Eid al-Fitr Holiday",
@@ -1116,15 +1203,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1116
1203
  "2027-11-03": "Victory Day",
1117
1204
  "2027-11-11": "Republic Day"
1118
1205
  }
1119
- }, At = {
1120
- countryCode: ft,
1121
- timezone: ht,
1122
- payRate: vt,
1123
- overtime: gt,
1124
- workingHours: Dt,
1125
- recurringPublicHolidays: wt,
1126
- publicHolidays: Ht
1127
- }, Et = "MY", bt = "Asia/Kuala_Lumpur", Pt = {
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 = {
1128
1215
  NORMAL: {
1129
1216
  overtime: 1.5
1130
1217
  },
@@ -1136,13 +1223,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1136
1223
  regular: 2,
1137
1224
  overtime: 3
1138
1225
  }
1139
- }, Nt = {
1226
+ }, Mt = {
1140
1227
  maxHoursPerMonth: 104
1141
- }, kt = {
1142
- minHoursPerDay: null,
1143
- maxHoursPerDay: 8,
1144
- maxHoursPerWeek: 45
1145
- }, Ct = [
1228
+ }, St = {
1229
+ fullTime: {
1230
+ minHoursPerDay: null,
1231
+ maxHoursPerDay: 8,
1232
+ maxHoursPerWeek: 45
1233
+ },
1234
+ partTime: {
1235
+ maxHoursPerWeek: 31.5
1236
+ }
1237
+ }, Lt = [
1146
1238
  {
1147
1239
  month: 1,
1148
1240
  day: 1,
@@ -1168,7 +1260,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1168
1260
  day: 25,
1169
1261
  name: "Christmas Day"
1170
1262
  }
1171
- ], Mt = {
1263
+ ], It = {
1172
1264
  2026: {
1173
1265
  "2026-01-01": "New Year's Day",
1174
1266
  "2026-02-17": "Chinese New Year",
@@ -1206,15 +1298,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1206
1298
  "2027-10-28": "Deepavali",
1207
1299
  "2027-12-25": "Christmas Day"
1208
1300
  }
1209
- }, St = {
1210
- countryCode: Et,
1211
- timezone: bt,
1212
- payRate: Pt,
1213
- overtime: Nt,
1214
- workingHours: kt,
1215
- recurringPublicHolidays: Ct,
1216
- publicHolidays: Mt
1217
- }, Lt = "PK", It = "Asia/Karachi", Rt = {
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 = {
1218
1310
  NORMAL: {
1219
1311
  overtime: 1.5
1220
1312
  },
@@ -1226,13 +1318,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1226
1318
  regular: 2,
1227
1319
  overtime: 3
1228
1320
  }
1229
- }, Ot = {
1321
+ }, xt = {
1230
1322
  maxHoursPerMonth: null
1231
- }, Tt = {
1232
- minHoursPerDay: null,
1233
- maxHoursPerDay: 9,
1234
- maxHoursPerWeek: 48
1235
- }, $t = [
1323
+ }, Yt = {
1324
+ fullTime: {
1325
+ minHoursPerDay: null,
1326
+ maxHoursPerDay: 9,
1327
+ maxHoursPerWeek: 48
1328
+ },
1329
+ partTime: {
1330
+ maxHoursPerWeek: null
1331
+ }
1332
+ }, Bt = [
1236
1333
  {
1237
1334
  month: 1,
1238
1335
  day: 1,
@@ -1263,7 +1360,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1263
1360
  day: 25,
1264
1361
  name: "Quaid-e-Azam Day and Christmas Day"
1265
1362
  }
1266
- ], Yt = {
1363
+ ], _t = {
1267
1364
  2026: {
1268
1365
  "2026-01-01": "New Year's Day",
1269
1366
  "2026-02-05": "Kashmir Day",
@@ -1288,15 +1385,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1288
1385
  "2027-08-15": "Eid Milad-un-Nabi",
1289
1386
  "2027-12-25": "Quaid-e-Azam Day and Christmas Day"
1290
1387
  }
1291
- }, xt = {
1292
- countryCode: Lt,
1293
- timezone: It,
1294
- payRate: Rt,
1295
- overtime: Ot,
1296
- workingHours: Tt,
1297
- recurringPublicHolidays: $t,
1298
- publicHolidays: Yt
1299
- }, Bt = "SG", _t = "Asia/Singapore", Ft = {
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 = {
1300
1397
  NORMAL: {
1301
1398
  overtime: 1.5
1302
1399
  },
@@ -1308,13 +1405,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1308
1405
  regular: 2,
1309
1406
  overtime: 1.5
1310
1407
  }
1311
- }, Ut = {
1408
+ }, Vt = {
1312
1409
  maxHoursPerMonth: 72
1313
- }, Wt = {
1314
- minHoursPerDay: null,
1315
- maxHoursPerDay: 12,
1316
- maxHoursPerWeek: 44
1317
- }, zt = [
1410
+ }, Kt = {
1411
+ fullTime: {
1412
+ minHoursPerDay: null,
1413
+ maxHoursPerDay: 12,
1414
+ maxHoursPerWeek: 44
1415
+ },
1416
+ partTime: {
1417
+ maxHoursPerWeek: 35
1418
+ }
1419
+ }, Gt = [
1318
1420
  {
1319
1421
  month: 1,
1320
1422
  day: 1,
@@ -1335,7 +1437,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1335
1437
  day: 25,
1336
1438
  name: "Christmas Day"
1337
1439
  }
1338
- ], Vt = {
1440
+ ], jt = {
1339
1441
  2026: {
1340
1442
  "2026-01-01": "New Year's Day",
1341
1443
  "2026-02-17": "Chinese New Year's Day",
@@ -1366,15 +1468,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1366
1468
  "2027-10-28": "Deepavali",
1367
1469
  "2027-12-25": "Christmas Day"
1368
1470
  }
1369
- }, Kt = {
1370
- countryCode: Bt,
1371
- timezone: _t,
1372
- payRate: Ft,
1373
- overtime: Ut,
1374
- workingHours: Wt,
1375
- recurringPublicHolidays: zt,
1376
- publicHolidays: Vt
1377
- }, Gt = "TH", jt = "Asia/Bangkok", Qt = {
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 = {
1378
1480
  NORMAL: {
1379
1481
  overtime: 1.5
1380
1482
  },
@@ -1386,13 +1488,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1386
1488
  regular: 2,
1387
1489
  overtime: 3
1388
1490
  }
1389
- }, Xt = {
1491
+ }, qt = {
1390
1492
  maxHoursPerMonth: 36
1391
- }, Jt = {
1392
- minHoursPerDay: null,
1393
- maxHoursPerDay: 8,
1394
- maxHoursPerWeek: 48
1395
- }, Zt = [
1493
+ }, en = {
1494
+ fullTime: {
1495
+ minHoursPerDay: null,
1496
+ maxHoursPerDay: 8,
1497
+ maxHoursPerWeek: 48
1498
+ },
1499
+ partTime: {
1500
+ maxHoursPerWeek: null
1501
+ }
1502
+ }, an = [
1396
1503
  {
1397
1504
  month: 1,
1398
1505
  day: 1,
@@ -1438,7 +1545,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1438
1545
  day: 31,
1439
1546
  name: "New Year's Eve"
1440
1547
  }
1441
- ], qt = {
1548
+ ], tn = {
1442
1549
  2026: {
1443
1550
  "2026-01-01": "New Year's Day",
1444
1551
  "2026-03-03": "Makha Bucha Day",
@@ -1478,15 +1585,15 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1478
1585
  "2027-12-10": "Constitution Day",
1479
1586
  "2027-12-31": "New Year's Eve"
1480
1587
  }
1481
- }, en = {
1482
- countryCode: Gt,
1483
- timezone: jt,
1484
- payRate: Qt,
1485
- overtime: Xt,
1486
- workingHours: Jt,
1487
- recurringPublicHolidays: Zt,
1488
- publicHolidays: qt
1489
- }, an = "VN", tn = "Asia/Ho_Chi_Minh", nn = {
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 = {
1490
1597
  NORMAL: {
1491
1598
  overtime: 1.5
1492
1599
  },
@@ -1498,13 +1605,18 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1498
1605
  regular: 2,
1499
1606
  overtime: 3
1500
1607
  }
1501
- }, on = {
1608
+ }, ln = {
1502
1609
  maxHoursPerMonth: 40
1503
- }, sn = {
1504
- minHoursPerDay: null,
1505
- maxHoursPerDay: 8,
1506
- maxHoursPerWeek: 48
1507
- }, rn = [
1610
+ }, un = {
1611
+ fullTime: {
1612
+ minHoursPerDay: null,
1613
+ maxHoursPerDay: 8,
1614
+ maxHoursPerWeek: 48
1615
+ },
1616
+ partTime: {
1617
+ maxHoursPerWeek: null
1618
+ }
1619
+ }, dn = [
1508
1620
  {
1509
1621
  month: 1,
1510
1622
  day: 1,
@@ -1525,7 +1637,7 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1525
1637
  day: 2,
1526
1638
  name: "National Day"
1527
1639
  }
1528
- ], ln = {
1640
+ ], cn = {
1529
1641
  2026: {
1530
1642
  "2026-01-01": "New Year's Day",
1531
1643
  "2026-02-16": "Tet Holiday",
@@ -1553,16 +1665,16 @@ const Ya = "AE", xa = "Asia/Dubai", Ba = {
1553
1665
  "2027-09-02": "National Day",
1554
1666
  "2027-09-03": "National Day Holiday"
1555
1667
  }
1556
- }, un = {
1557
- countryCode: an,
1558
- timezone: tn,
1559
- payRate: nn,
1560
- overtime: on,
1561
- workingHours: sn,
1562
- recurringPublicHolidays: rn,
1563
- publicHolidays: ln
1564
- }, Fe = { AE: za, BN: Za, ID: it, MO: pt, MV: At, MY: St, PK: xt, SG: Kt, TH: en, VN: un };
1565
- function dn(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) {
1566
1678
  if (typeof e == "string") return e.toUpperCase();
1567
1679
  if (e && typeof e == "object" && "code" in e) {
1568
1680
  const a = e.code;
@@ -1570,17 +1682,17 @@ function dn(e) {
1570
1682
  }
1571
1683
  return "MY";
1572
1684
  }
1573
- function cn(e) {
1574
- return Fe[dn(e)] ?? Fe.MY;
1685
+ function pn(e) {
1686
+ return Ue[yn(e)] ?? Ue.MY;
1575
1687
  }
1576
- function bo(e, a) {
1577
- var s, l;
1578
- const t = (s = e.publicHolidays[a.slice(0, 4)]) == null ? void 0 : s[a];
1688
+ function Mo(e, a) {
1689
+ var o, r;
1690
+ const t = (o = e.publicHolidays[a.slice(0, 4)]) == null ? void 0 : o[a];
1579
1691
  if (t) return t;
1580
1692
  const n = Number(a.slice(5, 7)), i = Number(a.slice(8, 10));
1581
- return ((l = e.recurringPublicHolidays.find((o) => o.month === n && o.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;
1582
1694
  }
1583
- const yn = Ve(), aa = "unassigned", Po = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], No = "All Stations", ko = [{ 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 = [
1584
1696
  "#903E1F",
1585
1697
  "#5F090A",
1586
1698
  "#0A5384",
@@ -1590,76 +1702,86 @@ const yn = Ve(), aa = "unassigned", Po = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sa
1590
1702
  "#0F5C5C",
1591
1703
  "#6E2142"
1592
1704
  ];
1593
- function mn(e) {
1705
+ function hn(e) {
1594
1706
  var t;
1595
1707
  const a = e.trim().toLocaleLowerCase();
1596
- return (t = K.find((n) => n.name.toLocaleLowerCase() === a)) == null ? void 0 : t.id;
1708
+ return (t = B.find((n) => n.name.toLocaleLowerCase() === a)) == null ? void 0 : t.id;
1597
1709
  }
1598
- function Co(e, a) {
1710
+ function To(e, a) {
1599
1711
  if (e)
1600
- return { positionId: a ?? mn(e), positionName: e };
1712
+ return { positionId: a ?? hn(e), positionName: e };
1601
1713
  }
1602
- function Mo(e, a) {
1603
- return a ? !K.some((t) => t.id === a) : !!e && !K.some((t) => t.name.toLocaleLowerCase() === e.toLocaleLowerCase());
1714
+ function ie(e, a = B) {
1715
+ var t;
1716
+ if (e)
1717
+ return (e.positionId && ((t = a.find((n) => n.id === e.positionId)) == null ? void 0 : t.name)) ?? e.positionName;
1718
+ }
1719
+ function Ro(e, a = B) {
1720
+ var t, n;
1721
+ if (e)
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;
1604
1723
  }
1605
- const So = [1, 1, 1, 1, 1, 1, 1];
1724
+ function Oo(e, a) {
1725
+ return a ? !B.some((t) => t.id === a) : !!e && !B.some((t) => t.name.toLocaleLowerCase() === e.toLocaleLowerCase());
1726
+ }
1727
+ const $o = [1, 1, 1, 1, 1, 1, 1];
1606
1728
  function le(e) {
1607
1729
  return (e + 6) % 7;
1608
1730
  }
1609
- function Lo(e) {
1731
+ function xo(e) {
1610
1732
  return (e + 1) % 7;
1611
1733
  }
1612
- function me(e, a) {
1734
+ function ye(e, a) {
1613
1735
  e.splice(0, e.length, ...a);
1614
1736
  }
1615
- function pn(e, a) {
1616
- return Ge(e, a) / 60;
1737
+ function vn(e, a) {
1738
+ return je(e, a) / 60;
1617
1739
  }
1618
- function fn(e) {
1740
+ function gn(e) {
1619
1741
  var t;
1620
1742
  const a = e.trim().split(/\s+/).filter(Boolean);
1621
1743
  return a.length ? (a[0][0] + (((t = a[1]) == null ? void 0 : t[0]) ?? "")).toUpperCase() : "??";
1622
1744
  }
1623
1745
  const ta = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map();
1624
- function Io(e) {
1746
+ function Yo(e) {
1625
1747
  return ta.get(e);
1626
1748
  }
1627
- function hn(e) {
1749
+ function Dn(e) {
1628
1750
  const a = Ee.get(e);
1629
1751
  if (a !== void 0) return a;
1630
- const t = Qe + Ee.size + 1;
1752
+ const t = Xe + Ee.size + 1;
1631
1753
  return Ee.set(e, t), ta.set(t, e), t;
1632
1754
  }
1633
- function Ro(e) {
1755
+ function Bo(e) {
1634
1756
  return e.sourceId || String(e.id);
1635
1757
  }
1636
- function vn(e) {
1637
- Na.name = (e == null ? void 0 : e.outlet.name) ?? "", me(Pa, (e == null ? void 0 : e.positions.map((o) => o.name)) ?? []), me(K, (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) ?? []);
1638
1760
  const a = (e == null ? void 0 : e.restaurantProfile.operatingHours) ?? [], t = Array.from({ length: 7 }, () => []);
1639
- for (const o of a) t[le(o.dayOfWeek)] = o.closed ? [] : o.hours;
1640
- me(C.dayHours, t);
1641
- const n = a.filter((o) => !o.closed).flatMap((o) => o.hours);
1642
- C.openFrom = n.length ? n.map((o) => o.start).reduce((o, u) => u < o ? u : o) : "00:00", C.openTo = n.length ? n.map((o) => o.end).reduce((o, u) => u > o ? u : o) : "24:00", me(
1643
- C.closedWeekdays,
1644
- a.filter((o) => o.closed).map((o) => le(o.dayOfWeek)).sort((o, u) => o - u)
1761
+ for (const s of a) t[le(s.dayOfWeek)] = s.closed ? [] : s.hours;
1762
+ ye(N.dayHours, t);
1763
+ const n = a.filter((s) => !s.closed).flatMap((s) => s.hours);
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)
1645
1767
  );
1646
- const i = cn(yn.currentCountry.value), s = (e == null ? void 0 : e.settings.settingsConfigured) === !0, l = s ? e.settings.payRate : i.payRate;
1647
- C.otCapHours = s ? e.settings.overtime.maxHoursPerMonth : i.overtime.maxHoursPerMonth, C.workingHours = s ? 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 : {
1648
1770
  minHoursPerDay: null,
1649
- maxHoursPerDay: i.workingHours.maxHoursPerDay,
1650
- maxHoursPerWeek: i.workingHours.maxHoursPerWeek
1651
- }, C.payRate.NORMAL.overtime = l.NORMAL.overtime, C.payRate.REST_DAY.regular = l.REST_DAY.regular, C.payRate.REST_DAY.overtime = l.REST_DAY.overtime, C.payRate.PUBLIC_HOLIDAY.regular = l.PUBLIC_HOLIDAY.regular, C.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;
1652
1774
  }
1653
- Ie(c, vn, { immediate: !0 });
1775
+ Te(l, wn, { immediate: !0 });
1654
1776
  function ve(e) {
1655
1777
  var a, t, n;
1656
1778
  return {
1657
- minHoursPerDay: ((a = e.workingHours) == null ? void 0 : a.minHoursPerDay) ?? C.workingHours.minHoursPerDay,
1658
- maxHoursPerDay: ((t = e.workingHours) == null ? void 0 : t.maxHoursPerDay) ?? C.workingHours.maxHoursPerDay,
1659
- maxHoursPerWeek: ((n = e.workingHours) == null ? void 0 : n.maxHoursPerWeek) ?? C.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
1660
1782
  };
1661
1783
  }
1662
- function gn(e) {
1784
+ function Hn(e) {
1663
1785
  return e.reduce(
1664
1786
  (a, t) => {
1665
1787
  const n = ve(t).maxHoursPerWeek;
@@ -1668,18 +1790,18 @@ function gn(e) {
1668
1790
  0
1669
1791
  );
1670
1792
  }
1671
- function Dn(e, a) {
1793
+ function An(e, a) {
1672
1794
  if (e.wage.type === "HOURLY") return e.wage.amount;
1673
1795
  const t = ve(e).maxHoursPerWeek ?? a;
1674
1796
  return t ? e.wage.amount / (t * (52 / 12)) : 0;
1675
1797
  }
1676
- function wn(e, a) {
1798
+ function En(e, a) {
1677
1799
  if (e.employmentType === "FULLTIME") return 100;
1678
1800
  const t = ve(e).maxHoursPerWeek;
1679
1801
  return !a || t == null ? 0 : Math.min(99, Math.round(t / a * 100));
1680
1802
  }
1681
- function Hn(e) {
1682
- var a, t;
1803
+ function Pn(e) {
1804
+ var a;
1683
1805
  return {
1684
1806
  start: e.startTime,
1685
1807
  end: e.endTime,
@@ -1687,12 +1809,12 @@ function Hn(e) {
1687
1809
  // stay blank rather than falling back to the employee's own primary position, or a reload
1688
1810
  // silently reassigns every "Any position" shift to whatever station the employee is normally
1689
1811
  // pinned to.
1690
- role: ((a = e.position) == null ? void 0 : a.positionName) ?? "",
1691
- positionId: ((t = e.position) == null ? void 0 : t.positionId) || void 0,
1812
+ role: ie(e.position) ?? "",
1813
+ positionId: ((a = e.position) == null ? void 0 : a.positionId) || void 0,
1692
1814
  // Mongo distinguishes a draft from a published/confirmed assignment; the board's third
1693
1815
  // state ('ot') is a costing outcome, never something stored.
1694
1816
  status: e.status === "DRAFT" ? "pending" : "confirmed",
1695
- breakMins: je(e.breaks),
1817
+ breakMins: Qe(e.breaks),
1696
1818
  breaks: e.breaks,
1697
1819
  // Carried through so an edit updates this same ScheduleShiftAssignments document instead of
1698
1820
  // creating a duplicate — see useScheduleBoard's commitShift/persistSlot.
@@ -1700,10 +1822,10 @@ function Hn(e) {
1700
1822
  updatedAt: e.updatedAt
1701
1823
  };
1702
1824
  }
1703
- function An(e) {
1825
+ function bn(e) {
1704
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";
1705
1827
  }
1706
- function En(e, a) {
1828
+ function kn(e, a) {
1707
1829
  if (a < e.startDate || a > e.endDate) return null;
1708
1830
  const n = e.startDate === e.endDate || a === e.startDate ? e.startPart : a === e.endDate ? e.endPart : "FULL_DAY";
1709
1831
  return {
@@ -1711,12 +1833,12 @@ function En(e, a) {
1711
1833
  type: e.type,
1712
1834
  leaveType: e.leaveType ?? void 0,
1713
1835
  timeOff: e.status === "PENDING" ? "pending" : "approved",
1714
- reason: An(e),
1836
+ reason: bn(e),
1715
1837
  half: n !== "FULL_DAY",
1716
1838
  halfPart: n === "FULL_DAY" ? void 0 : n
1717
1839
  };
1718
1840
  }
1719
- function bn(e) {
1841
+ function Nn(e) {
1720
1842
  return {
1721
1843
  employeeId: e._id,
1722
1844
  name: e.name,
@@ -1727,146 +1849,150 @@ function bn(e) {
1727
1849
  availability: []
1728
1850
  };
1729
1851
  }
1730
- function Pn(e) {
1731
- const a = ne[m.value];
1852
+ function Cn(e) {
1853
+ const a = oe[m.value];
1732
1854
  return !a || !e.includes(a) ? e : [a, ...e.filter((t) => t !== a)];
1733
1855
  }
1734
- function Nn(e) {
1856
+ function Mn(e) {
1735
1857
  var n;
1736
- const t = (Ze.value[e] ?? ((n = se.value.find((i) => i._id === e)) == null ? void 0 : n.restaurantRole.map((i) => i.restaurantId)) ?? []).map((i) => ne[i]).filter((i) => !!i);
1737
- return t.length ? Pn([...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;
1738
1860
  }
1739
- function Oo(e = []) {
1740
- const a = c.value;
1861
+ function _o(e = []) {
1862
+ const a = l.value;
1741
1863
  if (!a) return [];
1742
- const t = new Map(a.employees.map((o) => [o.employeeId, o])), n = new Map(
1743
- F.value.map((o) => [o.employeeId, o])
1744
- ), i = se.value.filter((o) => {
1745
- var u;
1746
- return ((u = n.get(o._id)) == null ? void 0 : u.enabled) !== !1;
1747
- }).map((o) => t.get(o._id) ?? bn(o)), s = gn(i), l = /* @__PURE__ */ new Map();
1748
- for (const o of a.assignments) {
1749
- const u = `${o.employeeId}|${o.date}`, h = l.get(u);
1750
- h ? h.push(o) : l.set(u, [o]);
1751
- }
1752
- return i.map((o) => {
1753
- var ce;
1754
- const u = se.value.find((g) => g._id === o.employeeId) ?? {
1864
+ const t = new Map(a.employees.map((s) => [s.employeeId, s])), n = new Map(
1865
+ F.value.map((s) => [s.employeeId, s])
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();
1870
+ for (const s of a.assignments) {
1871
+ const d = `${s.employeeId}|${s.date}`, p = r.get(d);
1872
+ p ? p.push(s) : r.set(d, [s]);
1873
+ }
1874
+ return i.map((s) => {
1875
+ const d = re.value.find((h) => h._id === s.employeeId) ?? {
1876
+ name: s.name,
1755
1877
  code: void 0,
1756
1878
  passcode: "",
1757
1879
  isMasterUser: !1
1758
- }, h = ve(o), E = hn(o.employeeId), T = new Set(K.map((g) => g.id)), Q = new Set(K.map((g) => g.name.toLocaleLowerCase())), p = (g) => g.positionId ? T.has(g.positionId) : Q.has(g.positionName.toLocaleLowerCase()), H = (ce = o.primaryPosition) == null ? void 0 : ce.positionName, L = !!o.primaryPosition && p(o.primaryPosition), I = o.secondaryPositions.filter(p).map((g) => g.positionName), X = H ? L ? [H, ...I] : [] : I, J = [
1759
- ...H && !L ? [H] : [],
1760
- ...o.secondaryPositions.filter((g) => !p(g)).map((g) => g.positionName)
1761
- ], x = X[0] ?? "", M = e.map((g) => {
1762
- const b = ie(g), D = (a.timeOff ?? []).filter((P) => P.employeeId === o.employeeId).map((P) => En(P, b)).find((P) => P !== null);
1763
- if (D) return D;
1764
- const _ = (l.get(`${o.employeeId}|${b}`) ?? []).filter((P) => P.startTime && P.endTime).map((P) => Hn(P)).sort((P, ge) => P.start.localeCompare(ge.start));
1765
- return _.length ? _.length === 1 ? _[0] : _ : null;
1766
- }), Z = o.availability.length > 0, ue = 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(
1767
1890
  { length: 7 },
1768
- (g, b) => Z ? o.availability.some((D) => le(D.dayOfWeek) === b) : !0
1769
- ), de = Array.from({ length: 7 }, (g, b) => {
1770
- const D = o.availability.find((B) => le(B.dayOfWeek) === b);
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);
1771
1894
  return { from: (D == null ? void 0 : D.start) ?? "", to: (D == null ? void 0 : D.end) ?? "" };
1772
1895
  });
1773
1896
  return {
1774
- id: E,
1775
- sourceId: o.employeeId,
1776
- name: o.name,
1897
+ id: g,
1898
+ sourceId: s.employeeId,
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,
1777
1902
  // POS access belongs to the POS roster, not the scheduling profile. Keep these
1778
1903
  // fields on the board employee so the edit form can initialise its access section
1779
1904
  // from the employee's existing POS account.
1780
- passcode: u.passcode || void 0,
1781
- code: u.code,
1782
- masterUser: u.isMasterUser,
1783
- employmentType: o.employmentType,
1784
- role: x,
1785
- initials: fn(o.name),
1786
- color: Ue[(E - Qe - 1) % Ue.length],
1905
+ passcode: d.passcode || void 0,
1906
+ code: d.code,
1907
+ masterUser: d.isMasterUser,
1908
+ employmentType: s.employmentType,
1909
+ role: _,
1910
+ initials: gn(d.name),
1911
+ color: We[(g - Xe - 1) % We.length],
1787
1912
  // Gross hours actually rostered this week — the figure the cost rail multiplies by
1788
1913
  // the rate. Contracted hours are a separate question, answered by RULES.contract.
1789
1914
  // Rounded to one decimal — `hoursBetween` divides by 60, so an unrounded sum reads
1790
1915
  // as a long, meaningless float (e.g. 31.983333333333334) everywhere this is shown
1791
1916
  // verbatim, matching the rounding `employeeLoadOf`'s own hours figure already uses.
1792
1917
  weekHours: Math.round(
1793
- M.reduce(
1794
- (g, b) => g + (Array.isArray(b) ? b : b && "start" in b ? [b] : []).reduce(
1795
- (D, B) => D + pn(B.start, B.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),
1796
1921
  0
1797
1922
  ),
1798
1923
  0
1799
1924
  ) * 10
1800
1925
  ) / 10,
1801
- pct: wn(o, s),
1802
- contractHours: h.maxHoursPerWeek ?? void 0,
1803
- minHoursPerDay: h.minHoursPerDay ?? void 0,
1926
+ pct: En(s, o),
1927
+ contractHours: p.maxHoursPerWeek ?? void 0,
1928
+ minHoursPerDay: p.minHoursPerDay ?? void 0,
1804
1929
  // Keep the persisted override shape here. Consumers that need the effective value use
1805
1930
  // effectiveWorkingHours(), so an inherited null remains distinguishable from an override.
1806
- workingHours: o.workingHours,
1931
+ workingHours: s.workingHours,
1807
1932
  // Every outlet the POS says this person works at, not just this one — the Add / Edit form
1808
1933
  // shows them, and saving keeps them.
1809
- locations: Nn(o.employeeId),
1810
- rate: Dn(o, s),
1811
- positions: X,
1812
- archivedPositions: J.length ? J : void 0,
1813
- shifts: M,
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,
1814
1940
  // Remarks live in their own collection in the older scheduling design and are not
1815
1941
  // part of this board's payload yet.
1816
1942
  remarks: [],
1817
1943
  section: aa,
1818
- payBasis: o.wage.type === "HOURLY" ? "hourly" : "monthly",
1819
- payAmount: o.wage.amount,
1820
- availDays: ue,
1821
- availHours: de
1944
+ payBasis: s.wage.type === "HOURLY" ? "hourly" : "monthly",
1945
+ payAmount: s.wage.amount,
1946
+ availDays: de,
1947
+ availHours: ge
1822
1948
  };
1823
1949
  });
1824
1950
  }
1825
- function To() {
1951
+ function Fo() {
1826
1952
  return [];
1827
1953
  }
1828
- function $o() {
1954
+ function Uo() {
1829
1955
  var n, i;
1830
- const e = c.value, a = {}, t = {};
1831
- for (const s of (e == null ? void 0 : e.demands) ?? []) {
1832
- const l = s.date ? a[n = s.date] ?? (a[n] = []) : s.dayOfWeek !== null ? t[i = le(s.dayOfWeek)] ?? (t[i] = []) : null;
1833
- if (!l) continue;
1834
- let o = l.find((u) => u.from === s.startTime && u.to === s.endTime);
1835
- o || (o = { from: s.startTime, to: s.endTime, n: 0, roles: [] }, l.push(o)), o.n += s.headcount, s.position && o.roles.push({
1836
- position: s.position.positionName,
1837
- positionId: s.position.positionId || void 0,
1838
- n: s.headcount
1956
+ const e = l.value, a = {}, t = {};
1957
+ for (const o of (e == null ? void 0 : e.demands) ?? []) {
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) ?? "",
1963
+ positionId: o.position.positionId || void 0,
1964
+ n: o.headcount
1839
1965
  });
1840
1966
  }
1841
1967
  return { byDate: a, byWeekday: t };
1842
1968
  }
1843
- function Yo() {
1844
- const e = Ve(), { restaurants: a, readRestaurants: t } = wa(), n = ga(), i = Da(), s = A(!1), l = $(
1845
- () => a.value.filter((p) => p.managable).map((p) => ({ value: p._id, label: p.profile.name })).sort((p, H) => p.label.localeCompare(H.label))
1846
- ), o = () => {
1847
- var p;
1848
- return `hrm-schedule-outlet:${((p = e.currentBusiness.value) == null ? void 0 : p._id) ?? ""}`;
1849
- }, u = $(() => {
1850
- var p;
1851
- return ((p = e.currentRestaurant.value) == null ? void 0 : p._id) ?? "";
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))
1972
+ ), s = () => {
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) ?? "";
1852
1978
  });
1853
- async function h(p, H) {
1854
- return Be(p) ? (localStorage.setItem(o(), p), n.query.restaurantId !== p && i.replace({ query: { ...n.query, restaurantId: p } }), await Promise.all([Me(p), Oa(H)]), !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;
1855
1981
  }
1856
- const E = (p) => !!p && l.value.some((H) => H.value === p);
1857
- async function T() {
1858
- var L;
1859
- await t(), xe.splice(0, xe.length, ...l.value.map((I) => I.label)), Object.keys(ne).forEach((I) => delete ne[I]), a.value.forEach((I) => ne[I._id] = I.profile.name);
1860
- const p = localStorage.getItem(o()) ?? "", H = [m.value, p, u.value].find(E) ?? ((L = l.value[0]) == null ? void 0 : L.value) ?? "";
1861
- return H && Be(H), s.value = !0, H;
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;
1862
1988
  }
1863
- async function Q() {
1864
- const p = await T();
1865
- return p && await Me(p), p;
1989
+ async function J() {
1990
+ const f = await C();
1991
+ return f && await Me(f), f;
1866
1992
  }
1867
- return { options: l, ready: s, outletId: m, resolve: Q, resolveOutlet: T, switchTo: h };
1993
+ return { options: r, ready: o, outletId: m, resolve: J, resolveOutlet: C, switchTo: p };
1868
1994
  }
1869
- const kn = ["data-hierarchy", "data-size", "data-icon"], xo = /* @__PURE__ */ Re({
1995
+ const Sn = ["data-hierarchy", "data-size", "data-icon"], zo = /* @__PURE__ */ Re({
1870
1996
  __name: "ScheduleButton",
1871
1997
  props: {
1872
1998
  hierarchy: { default: "primary" },
@@ -1874,32 +2000,32 @@ const kn = ["data-hierarchy", "data-size", "data-icon"], xo = /* @__PURE__ */ Re
1874
2000
  iconOnly: { type: Boolean, default: !1 }
1875
2001
  },
1876
2002
  setup(e) {
1877
- return (a, t) => (N(), k("button", {
2003
+ return (a, t) => (b(), k("button", {
1878
2004
  type: "button",
1879
2005
  class: "sch-button",
1880
2006
  "data-hierarchy": e.hierarchy,
1881
2007
  "data-size": e.size,
1882
2008
  "data-icon": e.iconOnly ? "only" : void 0
1883
2009
  }, [
1884
- ze(a.$slots, "default")
1885
- ], 8, kn));
2010
+ Ve(a.$slots, "default")
2011
+ ], 8, Sn));
1886
2012
  }
1887
- }), Cn = ["disabled", "aria-expanded"], Mn = { class: "sch" }, Sn = ["aria-multiselectable"], Ln = {
2013
+ }), Ln = ["disabled", "aria-expanded"], In = { class: "fx-btn-label" }, Tn = { class: "sch" }, Rn = ["aria-multiselectable"], On = {
1888
2014
  key: 0,
1889
2015
  class: "fx-pop-head"
1890
- }, In = {
2016
+ }, $n = {
1891
2017
  key: 1,
1892
2018
  class: "fx-pop-search"
1893
- }, Rn = {
2019
+ }, xn = {
1894
2020
  key: 2,
1895
2021
  class: "fx-opt is-off"
1896
- }, On = {
2022
+ }, Yn = {
1897
2023
  key: 0,
1898
2024
  class: "fx-grp"
1899
- }, Tn = ["aria-selected", "onClick"], $n = {
2025
+ }, Bn = ["aria-selected", "onClick"], _n = {
1900
2026
  key: 0,
1901
2027
  class: "fx-opt-text"
1902
- }, Yn = { key: 0 }, Bo = /* @__PURE__ */ Re({
2028
+ }, Fn = { key: 0 }, Vo = /* @__PURE__ */ Re({
1903
2029
  inheritAttrs: !1,
1904
2030
  __name: "ScheduleSelect",
1905
2031
  props: {
@@ -1917,202 +2043,204 @@ const kn = ["data-hierarchy", "data-size", "data-icon"], xo = /* @__PURE__ */ Re
1917
2043
  },
1918
2044
  emits: ["update:modelValue", "toggle"],
1919
2045
  setup(e, { emit: a }) {
1920
- const t = e, n = a, i = la(), s = $(() => i.class ?? ""), l = A(!1), o = A(!1), u = A(null), h = A(null), E = A(null), T = $(() => t.teleport !== !1 && o.value);
1921
- Se(() => {
1922
- o.value = typeof document < "u" && !!document.body;
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(() => {
2048
+ s.value = typeof document < "u" && !!document.body;
1923
2049
  });
1924
- const Q = $(() => {
1925
- var r, y;
1926
- if (!t.multiple && t.selectedLabel != null) return t.selectedLabel;
2050
+ const J = Y(() => {
2051
+ var u, y;
2052
+ if (t.selectedLabel != null) return t.selectedLabel;
1927
2053
  if (t.multiple) {
1928
- const d = ((r = t.selected) == null ? void 0 : r.length) ?? 0;
1929
- 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 ?? "";
1930
2056
  }
1931
- 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 ?? "";
1932
2058
  });
1933
- function p(r) {
2059
+ function f(u) {
1934
2060
  var y;
1935
- 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;
1936
2062
  }
1937
- const H = $(() => !!t.menuTitle || t.options.some((r) => r.hint)), L = A(""), I = A(null), X = $(() => {
1938
- const r = L.value.trim().toLowerCase();
1939
- return !t.searchable || !r ? t.options : t.options.filter((y) => `${y.label} ${y.hint ?? ""}`.toLowerCase().includes(r));
1940
- }), J = $(() => {
1941
- 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 = [];
1942
2068
  let y;
1943
- for (const d of X.value)
1944
- d.group !== y && (y = d.group, y && r.push({ heading: y })), r.push({ option: d });
1945
- return r;
1946
- }), x = 5, M = 8;
1947
- function Z() {
1948
- const r = E.value, y = h.value;
1949
- if (!r || !y) return;
1950
- const d = y.getBoundingClientRect(), S = window.innerWidth || document.documentElement.clientWidth, O = window.innerHeight || document.documentElement.clientHeight;
1951
- r.style.minWidth = `${Math.round(d.width)}px`, r.style.maxWidth = `${Math.max(180, Math.round(S - M * 2))}px`;
1952
- const q = O - d.bottom - x - M, sa = d.top - x - M;
1953
- r.style.maxHeight = `${Math.max(120, Math.min(320, Math.max(q, sa)))}px`;
1954
- const ye = r.offsetHeight, ia = r.offsetWidth;
1955
- let De = d.bottom + x;
1956
- De + ye > O - M && (De = d.top - x - ye >= M ? d.top - x - ye : Math.max(M, O - ye - M));
1957
- const ra = Math.min(Math.max(M, d.left), Math.max(M, S - ia - M));
1958
- r.style.top = `${Math.round(De)}px`, r.style.left = `${Math.round(ra)}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";
1959
2085
  }
1960
- function ue(r) {
1961
- var d, S;
1962
- const y = r.target;
1963
- y && ((d = u.value) != null && d.contains(y) || (S = E.value) != null && S.contains(y)) || D();
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();
1964
2090
  }
1965
- function de(r) {
1966
- const y = E.value, d = r.target;
1967
- if (y && d && d !== document && y.contains(d)) return;
1968
- const S = h.value;
1969
- if (!S) return;
1970
- const O = S.getBoundingClientRect(), q = window.innerHeight || document.documentElement.clientHeight;
1971
- if (O.bottom < 0 || O.top > q) {
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) {
1972
2098
  D();
1973
2099
  return;
1974
2100
  }
1975
- Z();
2101
+ U();
1976
2102
  }
1977
- function ce() {
2103
+ function ge() {
1978
2104
  document.addEventListener("click", ue), document.addEventListener("scroll", de, !0), window.addEventListener("resize", D);
1979
2105
  }
1980
- function g() {
2106
+ function h() {
1981
2107
  document.removeEventListener("click", ue), document.removeEventListener("scroll", de, !0), window.removeEventListener("resize", D);
1982
2108
  }
1983
- async function b() {
1984
- var r, y, d;
1985
- t.disabled || l.value || (L.value = "", l.value = !0, await be(), Z(), (r = I.value) == null || r.focus(), (d = (y = E.value) == null ? void 0 : y.querySelector(".fx-opt.is-on")) == null || d.scrollIntoView({ block: "nearest" }), ce());
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());
1986
2112
  }
1987
2113
  function D() {
1988
- l.value && (l.value = !1, L.value = "", g());
2114
+ r.value && (r.value = !1, S.value = "", h());
1989
2115
  }
1990
- Ie(L, async () => {
1991
- l.value && (await be(), Z());
2116
+ Te(S, async () => {
2117
+ r.value && (await Pe(), U());
1992
2118
  });
1993
- function B(r) {
2119
+ function R(u) {
1994
2120
  var y;
1995
- if (r.key === "Escape")
1996
- r.preventDefault(), D(), (y = h.value) == null || y.focus();
1997
- else if (r.key === "Enter") {
1998
- r.preventDefault();
1999
- const d = X.value.find((S) => !S.disabled);
2000
- d && P(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);
2001
2127
  }
2002
2128
  }
2003
- function _() {
2004
- l.value ? D() : b();
2129
+ function $() {
2130
+ r.value ? D() : E();
2005
2131
  }
2006
- function P(r) {
2007
- if (!r.disabled) {
2008
- if (t.multiple && !r.command) {
2009
- n("toggle", r.value);
2132
+ function ce(u) {
2133
+ if (!u.disabled) {
2134
+ if (t.multiple && !u.command) {
2135
+ n("toggle", u.value);
2010
2136
  return;
2011
2137
  }
2012
2138
  if (D(), t.multiple) {
2013
- n("update:modelValue", r.value);
2139
+ n("update:modelValue", u.value);
2014
2140
  return;
2015
2141
  }
2016
- r.value !== t.modelValue && n("update:modelValue", r.value);
2142
+ u.value !== t.modelValue && n("update:modelValue", u.value);
2017
2143
  }
2018
2144
  }
2019
- const ge = $(() => t.options.filter((r) => !r.disabled));
2020
- function na(r) {
2021
- const y = ge.value;
2145
+ const na = Y(() => t.options.filter((u) => !u.disabled));
2146
+ function oa(u) {
2147
+ const y = na.value;
2022
2148
  if (t.multiple || !y.length) {
2023
- b();
2149
+ E();
2024
2150
  return;
2025
2151
  }
2026
- const d = y.findIndex((q) => q.value === t.modelValue), S = 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), O = y[S];
2027
- O && O.value !== t.modelValue ? n("update:modelValue", O.value) : b();
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();
2028
2154
  }
2029
- function oa(r) {
2155
+ function sa(u) {
2030
2156
  var y;
2031
- if (r.key === "Escape") {
2032
- if (!l.value) return;
2033
- r.preventDefault(), D(), (y = h.value) == null || y.focus();
2157
+ if (u.key === "Escape") {
2158
+ if (!r.value) return;
2159
+ u.preventDefault(), D(), (y = p.value) == null || y.focus();
2034
2160
  return;
2035
2161
  }
2036
- if (r.key === "Enter" || r.key === " ") {
2037
- r.preventDefault(), _();
2162
+ if (u.key === "Enter" || u.key === " ") {
2163
+ u.preventDefault(), $();
2038
2164
  return;
2039
2165
  }
2040
- r.key !== "ArrowDown" && r.key !== "ArrowUp" && r.key !== "Home" && r.key !== "End" || (r.preventDefault(), na(r.key));
2166
+ u.key !== "ArrowDown" && u.key !== "ArrowUp" && u.key !== "Home" && u.key !== "End" || (u.preventDefault(), oa(u.key));
2041
2167
  }
2042
- return Le(g), (r, y) => (N(), k("div", {
2168
+ return Ie(h), (u, y) => (b(), k("div", {
2043
2169
  ref_key: "rootEl",
2044
- ref: u,
2045
- class: pe(["fx-sel", s.value])
2170
+ ref: d,
2171
+ class: pe(["fx-sel", o.value])
2046
2172
  }, [
2047
- Y("button", da({
2173
+ x("button", ca({
2048
2174
  ref_key: "btnEl",
2049
- ref: h
2050
- }, r.$attrs, {
2175
+ ref: p
2176
+ }, u.$attrs, {
2051
2177
  type: "button",
2052
- class: ["sch-input fx-btn", { "is-open": l.value }],
2178
+ class: ["sch-input fx-btn", { "is-open": r.value }],
2053
2179
  disabled: e.disabled,
2054
2180
  "aria-haspopup": "listbox",
2055
- "aria-expanded": l.value,
2056
- onClick: y[0] || (y[0] = (d) => _()),
2057
- onKeydown: oa
2058
- }), U(Q.value), 17, Cn),
2059
- (N(), ua(ca, {
2181
+ "aria-expanded": r.value,
2182
+ onClick: y[0] || (y[0] = (c) => $()),
2183
+ onKeydown: sa
2184
+ }), [
2185
+ x("span", In, W(J.value), 1)
2186
+ ], 16, Ln),
2187
+ (b(), da(ma, {
2060
2188
  to: "body",
2061
- disabled: !T.value
2189
+ disabled: !C.value
2062
2190
  }, [
2063
- Y("div", Mn, [
2064
- l.value ? (N(), k("div", {
2191
+ x("div", Tn, [
2192
+ r.value ? (b(), k("div", {
2065
2193
  key: 0,
2066
2194
  ref_key: "popEl",
2067
- ref: E,
2068
- class: pe(["fx-pop", { "fx-pop-rich": H.value }]),
2195
+ ref: g,
2196
+ class: pe(["fx-pop", { "fx-pop-rich": A.value }]),
2069
2197
  role: "listbox",
2070
2198
  "aria-multiselectable": e.multiple || void 0,
2071
2199
  style: { visibility: "hidden" }
2072
2200
  }, [
2073
- e.menuTitle ? (N(), k("div", Ln, U(e.menuTitle), 1)) : W("", !0),
2074
- e.searchable ? (N(), k("div", In, [
2075
- ya(Y("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", {
2076
2204
  ref_key: "searchEl",
2077
- ref: I,
2078
- "onUpdate:modelValue": y[1] || (y[1] = (d) => L.value = d),
2205
+ ref: L,
2206
+ "onUpdate:modelValue": y[1] || (y[1] = (c) => S.value = c),
2079
2207
  class: "sch-input fx-pop-q",
2080
2208
  type: "search",
2081
2209
  placeholder: "Search",
2082
2210
  autocomplete: "off",
2083
2211
  spellcheck: "false",
2084
2212
  "aria-label": "Search",
2085
- onKeydown: B
2213
+ onKeydown: R
2086
2214
  }, null, 544), [
2087
- [ma, L.value]
2215
+ [pa, S.value]
2088
2216
  ])
2089
- ])) : W("", !0),
2090
- e.searchable && !J.value.length ? (N(), k("div", Rn, "No matches")) : W("", !0),
2091
- (N(!0), k(He, null, pa(J.value, (d) => (N(), k(He, {
2092
- key: "heading" in d ? `heading:${d.heading}` : `option:${d.option.value}`
2217
+ ])) : z("", !0),
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}`
2093
2221
  }, [
2094
- "heading" in d ? (N(), k("div", On, U(d.heading), 1)) : (N(), k("div", {
2222
+ "heading" in c ? (b(), k("div", Yn, W(c.heading), 1)) : (b(), k("div", {
2095
2223
  key: 1,
2096
2224
  class: pe(["fx-opt", {
2097
- "is-on": p(d.option),
2098
- "is-off": d.option.disabled,
2099
- "is-new": d.option.command
2225
+ "is-on": f(c.option),
2226
+ "is-off": c.option.disabled,
2227
+ "is-new": c.option.command
2100
2228
  }]),
2101
2229
  role: "option",
2102
- "aria-selected": p(d.option),
2103
- onClick: (S) => P(d.option)
2230
+ "aria-selected": f(c.option),
2231
+ onClick: (M) => ce(c.option)
2104
2232
  }, [
2105
- y[2] || (y[2] = Y("span", {
2233
+ y[2] || (y[2] = x("span", {
2106
2234
  class: "fx-tick",
2107
2235
  "aria-hidden": "true"
2108
2236
  }, [
2109
- Y("svg", {
2237
+ x("svg", {
2110
2238
  width: "11",
2111
2239
  height: "11",
2112
2240
  viewBox: "0 0 16 16",
2113
2241
  fill: "none"
2114
2242
  }, [
2115
- Y("path", {
2243
+ x("path", {
2116
2244
  d: "m3.5 8.4 3 3 6-7",
2117
2245
  stroke: "currentColor",
2118
2246
  "stroke-width": "2.2",
@@ -2121,20 +2249,20 @@ const kn = ["data-hierarchy", "data-size", "data-icon"], xo = /* @__PURE__ */ Re
2121
2249
  })
2122
2250
  ])
2123
2251
  ], -1)),
2124
- H.value ? (N(), k("span", $n, [
2125
- Y("b", null, U(d.option.label), 1),
2126
- d.option.hint ? (N(), k("small", Yn, U(d.option.hint), 1)) : W("", !0)
2127
- ])) : (N(), k(He, { key: 1 }, [
2128
- fa(U(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)
2129
2257
  ], 64))
2130
- ], 10, Tn))
2258
+ ], 10, Bn))
2131
2259
  ], 64))), 128))
2132
- ], 10, Sn)) : W("", !0)
2260
+ ], 10, Rn)) : z("", !0)
2133
2261
  ])
2134
2262
  ], 8, ["disabled"]))
2135
2263
  ], 2));
2136
2264
  }
2137
- }), xn = ["id", "aria-labelledby", "aria-label"], We = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', _o = /* @__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({
2138
2266
  __name: "ScheduleModal",
2139
2267
  props: {
2140
2268
  open: { type: Boolean },
@@ -2146,143 +2274,146 @@ const kn = ["data-hierarchy", "data-size", "data-icon"], xo = /* @__PURE__ */ Re
2146
2274
  },
2147
2275
  emits: ["close"],
2148
2276
  setup(e, { emit: a }) {
2149
- const t = e, n = a, i = A(null);
2150
- let s = null;
2151
- function l() {
2152
- be(() => {
2153
- const u = i.value;
2154
- u && (u.querySelector(We) ?? u).focus();
2277
+ const t = e, n = a, i = P(null);
2278
+ let o = null;
2279
+ function r() {
2280
+ Pe(() => {
2281
+ const d = i.value;
2282
+ d && (d.querySelector(ze) ?? d).focus();
2155
2283
  });
2156
2284
  }
2157
- function o(u) {
2285
+ function s(d) {
2158
2286
  if (!t.open) return;
2159
- if (u.key === "Escape") {
2160
- u.preventDefault(), n("close");
2287
+ if (d.key === "Escape") {
2288
+ d.preventDefault(), n("close");
2161
2289
  return;
2162
2290
  }
2163
- if (u.key !== "Tab" || !i.value) return;
2164
- const h = Array.from(i.value.querySelectorAll(We));
2165
- if (!h.length) return;
2166
- const E = h[0], T = h[h.length - 1];
2167
- u.shiftKey && document.activeElement === E ? (u.preventDefault(), T.focus()) : !u.shiftKey && document.activeElement === T && (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());
2168
2296
  }
2169
- return Ie(
2297
+ return Te(
2170
2298
  () => t.open,
2171
- (u) => {
2172
- u ? (s = document.activeElement instanceof HTMLElement ? document.activeElement : null, l()) : (s == null || s.focus(), s = null);
2299
+ (d) => {
2300
+ d ? (o = document.activeElement instanceof HTMLElement ? document.activeElement : null, r()) : (o == null || o.focus(), o = null);
2173
2301
  },
2174
2302
  { immediate: !0 }
2175
- ), Se(() => document.addEventListener("keydown", o)), Le(() => {
2176
- document.removeEventListener("keydown", o), s = null;
2177
- }), (u, h) => e.open ? (N(), k("div", {
2303
+ ), Le(() => document.addEventListener("keydown", s)), Ie(() => {
2304
+ document.removeEventListener("keydown", s), o = null;
2305
+ }), (d, p) => e.open ? (b(), k("div", {
2178
2306
  key: 0,
2179
2307
  class: "modal-overlay open",
2180
- onClick: h[0] || (h[0] = ha((E) => n("close"), ["self"]))
2308
+ onClick: p[0] || (p[0] = va((g) => n("close"), ["self"]))
2181
2309
  }, [
2182
- Y("div", {
2310
+ x("div", {
2183
2311
  id: e.id,
2184
2312
  ref_key: "panel",
2185
2313
  ref: i,
2186
2314
  class: pe(["schedule-modal-panel", e.panelClass]),
2187
- style: va(e.panelStyle),
2315
+ style: ga(e.panelStyle),
2188
2316
  role: "dialog",
2189
2317
  "aria-modal": "true",
2190
2318
  "aria-labelledby": e.labelledBy,
2191
2319
  "aria-label": e.label,
2192
2320
  tabindex: "-1"
2193
2321
  }, [
2194
- ze(u.$slots, "default")
2195
- ], 14, xn)
2196
- ])) : W("", !0);
2322
+ Ve(d.$slots, "default")
2323
+ ], 14, Un)
2324
+ ])) : z("", !0);
2197
2325
  }
2198
2326
  });
2199
2327
  export {
2200
- no as $,
2201
- No as A,
2202
- Ne as B,
2203
- Xn as C,
2204
- Ea as D,
2205
- Zn as E,
2206
- ro as F,
2207
- Mo as G,
2208
- Ha as H,
2209
- Ao as I,
2210
- Ho as J,
2211
- wo as K,
2212
- Je as L,
2213
- w as M,
2214
- F as N,
2215
- Sa as O,
2216
- Pa as P,
2217
- xe as Q,
2218
- Qn as R,
2219
- ko as S,
2220
- Lo as T,
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,
2344
+ Na as P,
2345
+ io as Q,
2346
+ eo as R,
2347
+ Io as S,
2348
+ F as T,
2221
2349
  aa as U,
2222
- Jn as V,
2223
- Po as W,
2224
- le as X,
2225
- Pn as Y,
2226
- re as Z,
2227
- ne as _,
2228
- Oo as a,
2229
- so as a0,
2230
- Oe as a1,
2231
- to as a2,
2232
- ao as a3,
2233
- io as a4,
2234
- hn as a5,
2235
- ie as a6,
2236
- vo as a7,
2237
- fo as a8,
2238
- ho as a9,
2239
- So as aa,
2240
- Oa as ab,
2241
- po as ac,
2242
- Na as ad,
2243
- Vn as ae,
2244
- $a as af,
2245
- $e as ag,
2246
- $o as ah,
2247
- mn as ai,
2248
- mo as aj,
2249
- Ye as ak,
2250
- fe as al,
2251
- Me as am,
2252
- La as an,
2253
- xo as ao,
2254
- Bo as ap,
2255
- _o as aq,
2256
- K as ar,
2257
- zn as as,
2258
- Yo as at,
2259
- co as au,
2260
- lo as av,
2261
- se as aw,
2262
- uo as ax,
2263
- C as b,
2264
- To as c,
2265
- V as d,
2266
- Gn as e,
2267
- c as f,
2268
- cn as g,
2269
- bo as h,
2270
- Ca as i,
2271
- yo as j,
2272
- Io as k,
2273
- go as l,
2274
- Do as m,
2275
- Eo 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,
2276
2407
  m as o,
2277
- Co as p,
2408
+ l as p,
2278
2409
  Ce as q,
2279
- oo as r,
2280
- Aa as s,
2281
- eo as t,
2282
- ke as u,
2283
- jn as v,
2284
- qn as w,
2285
- Ro as x,
2286
- Kn as y,
2287
- Ge 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
2288
2419
  };