@feedmepos/mf-hrm-portal 2.2.5-dev.8 → 2.2.5-dev.9

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 (57) hide show
  1. package/dist/{ApprovalCodeList-BzL73nqc.js → ApprovalCodeList-D5l9vIsE.js} +2 -2
  2. package/dist/{AuditLogList-BEZoHLsX.js → AuditLogList-ByTa5UJY.js} +3 -3
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DDrP7ywR.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-mNdn1TYV.js} +2 -2
  4. package/dist/{EmployeeList-s4FYw1ZF.js → EmployeeList-Bv6ANk-P.js} +8 -9
  5. package/dist/{GrantUserList-Ci_ElhHZ.js → GrantUserList-Bt8w3p4j.js} +3 -3
  6. package/dist/{Main-BojQuzZI.js → Main-DHJcgePj.js} +5 -5
  7. package/dist/{Main-N1CNGDAy.js → Main-DkP8dWgn.js} +9 -9
  8. package/dist/{Main-CKr3RGvf.js → Main-DqiGpT4v.js} +2 -2
  9. package/dist/{PermissionSetList-DLknSOzA.js → PermissionSetList-BIGv1u67.js} +10 -11
  10. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DK2Bx8Aw.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-niywl_DX.js} +892 -893
  11. package/dist/{RoleList-Cm7_q5l9.js → RoleList-CH6NDKPU.js} +7 -7
  12. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DrJ1vA88.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-T1ACkX_6.js} +39 -39
  13. package/dist/ScheduleButton.vue_vue_type_script_setup_true_lang-BzQuLLf5.js +690 -0
  14. package/dist/{ScheduleGeneralPage-CmR4BZAp.js → ScheduleGeneralPage-DJPENJZ2.js} +96 -99
  15. package/dist/SchedulePage-C1egcbIC.js +14421 -0
  16. package/dist/{SchedulePositionPage-Bv3zraaF.js → SchedulePositionPage-OhL_hsqG.js} +10 -10
  17. package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-B8W4sTsA.js +242 -0
  18. package/dist/{TeamMemberList-D2OfkfJP.js → TeamMemberList-BwfG3go2.js} +8 -9
  19. package/dist/{TimesheetList-DEdLpYuM.js → TimesheetList-DcoqzbLO.js} +5 -5
  20. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BfMkNvCz.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-RyhiKTSd.js} +2 -2
  21. package/dist/{app-Dmmpy4k-.js → app-BcZ6C8M8.js} +8 -8
  22. package/dist/app.js +1 -1
  23. package/dist/{dayjs.min-DcfKURXN.js → dayjs.min-Ch0iysTG.js} +1 -1
  24. package/dist/employee-DwYHFacQ.js +204 -0
  25. package/dist/{index-BxkisKEs.js → iteration-D1uWLp0V.js} +726 -698
  26. package/dist/{lodash-p40sRkqQ.js → lodash-DErxm7xf.js} +1 -1
  27. package/dist/{role-CM1urkJZ.js → role-B9VanAny.js} +3 -4
  28. package/dist/{rule-BPApyMJY.js → rule-C4f_Ilzr.js} +36 -37
  29. package/dist/src/views/scheduling/components/ScheduleAutoScheduleModal.vue.d.ts +5 -1
  30. package/dist/src/views/scheduling/components/ScheduleGridSkeleton.vue.d.ts +2 -0
  31. package/dist/src/views/scheduling/components/ScheduleSelect.vue.d.ts +18 -2
  32. package/dist/src/views/scheduling/components/ScheduleShiftCell.vue.d.ts +4 -0
  33. package/dist/src/views/scheduling/components/ScheduleStaffRows.vue.d.ts +4 -0
  34. package/dist/src/views/scheduling/components/ScheduleTopbar.vue.d.ts +2 -2
  35. package/dist/src/views/scheduling/composables/schedule-add-employee-form.d.ts +4 -0
  36. package/dist/src/views/scheduling/composables/scheduleAutoSolver.d.ts +21 -0
  37. package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +11 -0
  38. package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +10 -11
  39. package/dist/src/views/scheduling/composables/useScheduleCopyWeek.d.ts +5 -3
  40. package/dist/src/views/scheduling/composables/useScheduleDemand.d.ts +7 -1
  41. package/dist/src/views/scheduling/composables/useScheduleEmployeeIdentity.d.ts +11 -2
  42. package/dist/src/views/scheduling/composables/useScheduleGapPopover.d.ts +2 -0
  43. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +11 -0
  44. package/dist/src/views/scheduling/composables/useScheduleOutlet.d.ts +1 -0
  45. package/dist/src/views/scheduling/composables/useScheduleStaffRail.d.ts +4 -1
  46. package/dist/src/views/scheduling/schedule-store.d.ts +25 -0
  47. package/dist/src/views/scheduling/types.d.ts +5 -0
  48. package/dist/style.css +1 -1
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/{useReportPermissions-5EhPvVT9.js → useReportPermissions-CTr56kBo.js} +3 -3
  51. package/package.json +1 -1
  52. package/dist/ScheduleButton.vue_vue_type_script_setup_true_lang-DX5JR7bi.js +0 -600
  53. package/dist/SchedulePage-CN3ZsQ9E.js +0 -13905
  54. package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-Buu8NEQf.js +0 -221
  55. package/dist/employee-D3ZpYH4j.js +0 -139
  56. package/dist/index-D-VlxJu9.js +0 -70
  57. package/dist/iteration-CcXrOMQe.js +0 -30
@@ -1,8 +1,8 @@
1
1
  import { computed as r, ref as n } from "vue";
2
- import { e as d } from "./index-BxkisKEs.js";
2
+ import { e as d } from "./iteration-D1uWLp0V.js";
3
3
  import { useCoreStore as h } from "@feedmepos/mf-common";
4
- import { R as K } from "./rule-BPApyMJY.js";
5
- import { D as g } from "./app-Dmmpy4k-.js";
4
+ import { R as K } from "./rule-C4f_Ilzr.js";
5
+ import { D as g } from "./app-BcZ6C8M8.js";
6
6
  const a = n([]), i = n(!1), l = n(!1), f = n(null), p = n(null), u = n(!1);
7
7
  function B() {
8
8
  const v = h();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-hrm-portal",
3
- "version": "2.2.5-dev.8",
3
+ "version": "2.2.5-dev.9",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,600 +0,0 @@
1
- import { onMounted as ae, onBeforeUnmount as se, ref as S, shallowRef as K, reactive as h, watch as oe, computed as U, defineComponent as re, createElementBlock as ie, openBlock as ue, renderSlot as le } from "vue";
2
- import { useCoreStore as ce } from "@feedmepos/mf-common";
3
- import { g as v, b as f, u as de } from "./restaurant-BTpBmfBV.js";
4
- import { E as V } from "./index-D-VlxJu9.js";
5
- function Ce(e) {
6
- let t = null;
7
- function n() {
8
- if (!t) return;
9
- t.style.height = "";
10
- const r = t.getBoundingClientRect().top;
11
- t.style.height = `${Math.max(0, window.innerHeight - r)}px`;
12
- }
13
- ae(() => {
14
- var r;
15
- t = ((r = e.value) == null ? void 0 : r.closest(".sch-page")) ?? null, n(), window.addEventListener("resize", n);
16
- }), se(() => {
17
- window.removeEventListener("resize", n), t && (t.style.height = "");
18
- });
19
- }
20
- const m = {
21
- async generateAutoSchedule(e, t) {
22
- return v(
23
- await f(`restaurants/${e}/schedules`).post(
24
- "auto-schedule/generate",
25
- t
26
- )
27
- );
28
- },
29
- /** One outlet's whole board over `[from, to]` (inclusive, 'YYYY-MM-DD'). */
30
- async readBoard(e, t, n) {
31
- return v(
32
- await f(`restaurants/${e}/schedules`).get("board", {
33
- params: { from: t, to: n }
34
- })
35
- );
36
- },
37
- /** Creates or updates the employee's shared business-level scheduling profile. */
38
- async createEmployeeProfile(e, t) {
39
- return v(await f("schedules").post("employees", t));
40
- },
41
- /** Edits the employee's shared business-level scheduling profile. */
42
- async updateEmployeeProfile(e, t, n) {
43
- return v(
44
- await f("schedules").post("employees", { employeeId: t, ...n })
45
- );
46
- },
47
- /** Positions are shared across the business. */
48
- async createPosition(e) {
49
- return v(await f("schedules").post("positions", e));
50
- },
51
- async updatePosition(e, t) {
52
- return v(await f("schedules").post(`positions/${e}`, t));
53
- },
54
- /** Deleting one position is `deletePositions` with a single-id array — the backend's
55
- * `DELETE positions/:id` route is gone; this is now `DELETE positions?ids=`. */
56
- async deletePosition(e) {
57
- await f("schedules").delete("positions", {
58
- params: { ids: e }
59
- });
60
- },
61
- /** Creates one flat demand interval. */
62
- async createDemand(e, t) {
63
- return v(
64
- await f(`restaurants/${e}/schedules`).post("demands", t)
65
- );
66
- },
67
- /** Deletes a batch of demands in one request — e.g. `saveDemand` replacing a whole
68
- * day/weekday's demand rows wholesale. Deleting one demand is just this with a single-id
69
- * array. */
70
- async deleteDemands(e, t) {
71
- return v(
72
- await f(`restaurants/${e}/schedules`).delete("demands", {
73
- params: { ids: t.join(",") }
74
- })
75
- );
76
- },
77
- /** Replaces one date's note/holiday-mark. All three fields back to empty/false clears it. */
78
- async saveScheduleDay(e, t, n) {
79
- return v(
80
- await f(`restaurants/${e}/schedules`).post(
81
- `days/${t}`,
82
- n
83
- )
84
- );
85
- },
86
- /** A one-off shift assignment. */
87
- async createAssignment(e, t) {
88
- return v(
89
- await f(`restaurants/${e}/schedules`).post("assignments", t)
90
- );
91
- },
92
- async updateAssignment(e, t, n) {
93
- return v(
94
- await f(`restaurants/${e}/schedules`).post(
95
- `assignments/${t}`,
96
- n
97
- )
98
- );
99
- },
100
- /** Deletes a batch of assignments in one request — e.g. a shift split into several segments
101
- * getting replaced wholesale. Deleting one assignment is just this with a single-id
102
- * array. */
103
- async deleteAssignments(e, t) {
104
- return v(
105
- await f(`restaurants/${e}/schedules`).delete("assignments", {
106
- params: { ids: t.join(",") }
107
- })
108
- );
109
- },
110
- /** Flips a batch of assignments to one status in a single request — e.g. Publish sending
111
- * every DRAFT shift on the board to PUBLISHED at once. */
112
- async bulkUpdateAssignmentStatus(e, t) {
113
- return v(
114
- await f(`restaurants/${e}/schedules`).post(
115
- "assignments/bulk-status",
116
- t
117
- )
118
- );
119
- }
120
- };
121
- function D(e) {
122
- const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
123
- return `${t}-${n}-${r}`;
124
- }
125
- function H(e, t) {
126
- const n = new Date(e);
127
- return n.setDate(n.getDate() + t), n;
128
- }
129
- const W = 6, i = K(null), Y = S(!1), R = S(null), He = S(!1), k = S(0), u = S(""), C = S([]);
130
- let I = null, P = null, T = null, F = null;
131
- function b(e) {
132
- return e === u.value ? !1 : (u.value = e, i.value = null, I = null, P = null, R.value = null, F = null, C.value = [], T = null, k.value += 1, !0);
133
- }
134
- async function x(e) {
135
- if (!e || F === e) return;
136
- const [t, n] = await Promise.all([
137
- V.readEmployeesPage({
138
- limit: 500,
139
- offset: 0,
140
- restaurantIds: [e]
141
- }),
142
- fe()
143
- ]);
144
- e === u.value && (C.value = t.items, J.value = n, F = e, k.value += 1);
145
- }
146
- const J = K({});
147
- async function fe() {
148
- const e = {};
149
- try {
150
- for (let n = 0, r = 1 / 0; n < r && n < 500 * 10; n += 500) {
151
- const o = await V.readEmployeesPage({ limit: 500, offset: n });
152
- if (r = o.total, o.items.forEach((a) => {
153
- e[a._id] = [...new Set(a.restaurantRole.map((s) => s.restaurantId))];
154
- }), !o.items.length) break;
155
- }
156
- } catch {
157
- return e;
158
- }
159
- return e;
160
- }
161
- function G(e, t) {
162
- return I !== null && P !== null && I <= e && P >= t;
163
- }
164
- async function me(e) {
165
- const t = D(e), n = D(H(e, 6));
166
- G(t, n) || T && (await T, G(t, n)) || await Q(
167
- H(e, -7 * W),
168
- H(e, 7 * W)
169
- );
170
- }
171
- async function Me() {
172
- !I || !P || await Q(/* @__PURE__ */ new Date(`${I}T00:00:00`), /* @__PURE__ */ new Date(`${P}T00:00:00`));
173
- }
174
- async function Fe(e) {
175
- if (!u.value) throw new Error("No outlet selected");
176
- const t = await m.createEmployeeProfile(u.value, e);
177
- i.value && (i.value.employees.push(t), k.value += 1);
178
- }
179
- async function Be(e, t) {
180
- if (!u.value) throw new Error("No outlet selected");
181
- const n = await m.updateEmployeeProfile(u.value, e, t);
182
- if (i.value) {
183
- const r = i.value.employees.findIndex((o) => o.employeeId === e);
184
- r > -1 && (i.value.employees[r] = n);
185
- }
186
- }
187
- async function $e(e) {
188
- const t = await m.createPosition(e);
189
- i.value && (i.value = { ...i.value, positions: [...i.value.positions, t] });
190
- }
191
- async function Ue(e, t) {
192
- const n = await m.updatePosition(e, t);
193
- i.value && (i.value = {
194
- ...i.value,
195
- positions: i.value.positions.map((r) => r.id === e ? n : r)
196
- });
197
- }
198
- async function We(e) {
199
- await m.deletePosition(e), i.value && (i.value = {
200
- ...i.value,
201
- positions: i.value.positions.filter((t) => t.id !== e)
202
- });
203
- }
204
- async function Ye(e, t) {
205
- if (!u.value) throw new Error("No outlet selected");
206
- const n = await m.saveScheduleDay(u.value, e, t);
207
- if (i.value) {
208
- const r = i.value.days.filter((o) => o.date !== e);
209
- n && r.push(n), i.value = { ...i.value, days: r };
210
- }
211
- }
212
- async function be(e) {
213
- var o;
214
- if (!u.value) throw new Error("No outlet selected");
215
- const t = (((o = i.value) == null ? void 0 : o.demands) ?? []).filter(
216
- (a) => e.date ? a.date === e.date : a.dayOfWeek === e.dayOfWeek
217
- ), n = e.periods.flatMap((a) => {
218
- const s = (a.roles ?? []).filter((l) => l.positionName && l.headcount > 0), c = s.reduce((l, y) => l + y.headcount, 0), p = {
219
- ...e.date ? { date: e.date } : { dayOfWeek: e.dayOfWeek },
220
- startTime: a.startTime,
221
- endTime: a.endTime
222
- };
223
- return [
224
- ...s.map((l) => ({
225
- ...p,
226
- headcount: l.headcount,
227
- position: { positionId: l.positionId, positionName: l.positionName }
228
- })),
229
- ...a.headcount > c ? [{ ...p, headcount: a.headcount - c }] : []
230
- ];
231
- });
232
- t.length && await m.deleteDemands(
233
- u.value,
234
- t.map((a) => a.id)
235
- );
236
- const r = await Promise.all(
237
- n.map((a) => m.createDemand(u.value, a))
238
- );
239
- if (i.value) {
240
- const a = i.value.demands.filter((s) => !t.some((c) => c.id === s.id));
241
- i.value = { ...i.value, demands: [...a, ...r] };
242
- }
243
- }
244
- async function xe(e) {
245
- if (!u.value) throw new Error("No outlet selected");
246
- return m.generateAutoSchedule(u.value, e);
247
- }
248
- async function Ge(e) {
249
- if (!u.value) throw new Error("No outlet selected");
250
- return m.createAssignment(u.value, e);
251
- }
252
- async function ze(e, t) {
253
- if (!u.value) throw new Error("No outlet selected");
254
- return m.updateAssignment(u.value, e, t);
255
- }
256
- async function je(e) {
257
- if (!u.value) throw new Error("No outlet selected");
258
- e.length && await m.deleteAssignments(u.value, e);
259
- }
260
- async function Ke(e) {
261
- if (!u.value) throw new Error("No outlet selected");
262
- return m.bulkUpdateAssignmentStatus(u.value, e);
263
- }
264
- async function Q(e, t) {
265
- const n = u.value;
266
- if (!n) {
267
- R.value = "No outlet selected";
268
- return;
269
- }
270
- const r = D(e), o = D(t);
271
- Y.value = !0, R.value = null;
272
- const a = (async () => {
273
- try {
274
- const s = await m.readBoard(n, r, o);
275
- if (u.value !== n) return;
276
- i.value = s, I = r, P = o, k.value += 1;
277
- } catch (s) {
278
- if (u.value !== n) return;
279
- R.value = s instanceof Error ? s.message : "Could not load the schedule";
280
- } finally {
281
- u.value === n && (Y.value = !1);
282
- }
283
- })();
284
- T = a;
285
- try {
286
- await a;
287
- } finally {
288
- T === a && (T = null);
289
- }
290
- }
291
- const X = "unassigned", Ve = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Je = "All Stations", Qe = [
292
- { id: X, label: "Unassigned", roles: [], system: !0 }
293
- ], Z = 1e6, z = [
294
- "#903E1F",
295
- "#5F090A",
296
- "#0A5384",
297
- "#1F5F3E",
298
- "#5B2C6F",
299
- "#7D5A00",
300
- "#0F5C5C",
301
- "#6E2142"
302
- ], pe = h([]), q = h([]);
303
- function ye(e) {
304
- var t;
305
- return (t = q.find((n) => n.name === e)) == null ? void 0 : t.id;
306
- }
307
- function Xe(e) {
308
- if (e)
309
- return { positionId: ye(e), positionName: e };
310
- }
311
- const Ze = h({}), ve = h({ name: "" }), j = h([]), L = h({});
312
- h([]);
313
- h([]);
314
- const qe = h({}), et = h([]), tt = h([]), nt = [1, 1, 1, 1, 1, 1, 1], A = h({
315
- coverage: {},
316
- openFrom: "00:00",
317
- openTo: "24:00",
318
- dayHours: Array.from({ length: 7 }, () => []),
319
- payRate: {
320
- NORMAL: { overtime: 1 },
321
- REST_DAY: { regular: 1, overtime: 1 },
322
- PUBLIC_HOLIDAY: { regular: 1, overtime: 1 }
323
- },
324
- otAfterDaily: 0,
325
- salesForecast: 0,
326
- closedWeekdays: [],
327
- labourTarget: 0,
328
- budgetFromSales: !1,
329
- budget: 0,
330
- otCapHours: 0,
331
- otBudget: 0,
332
- notify: {
333
- waConnected: !1,
334
- waNumber: "",
335
- waDisplayName: "",
336
- defaults: { wa: !1, push: !1, email: !1 }
337
- }
338
- });
339
- function N(e) {
340
- return (e + 6) % 7;
341
- }
342
- function at(e) {
343
- return (e + 1) % 7;
344
- }
345
- function _(e, t) {
346
- e.splice(0, e.length, ...t);
347
- }
348
- function he(e, t) {
349
- const n = (a) => {
350
- const [s, c] = a.split(":").map(Number);
351
- return (s || 0) * 60 + (c || 0);
352
- }, r = n(e);
353
- let o = n(t);
354
- return o <= r && (o += 1440), (o - r) / 60;
355
- }
356
- function ge(e) {
357
- var n;
358
- const t = e.trim().split(/\s+/).filter(Boolean);
359
- return t.length ? (t[0][0] + (((n = t[1]) == null ? void 0 : n[0]) ?? "")).toUpperCase() : "??";
360
- }
361
- const ee = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
362
- function st(e) {
363
- return ee.get(e);
364
- }
365
- function we(e) {
366
- const t = M.get(e);
367
- if (t !== void 0) return t;
368
- const n = Z + M.size + 1;
369
- return M.set(e, n), ee.set(n, e), n;
370
- }
371
- function Ee(e) {
372
- ve.name = (e == null ? void 0 : e.outlet.name) ?? "", _(pe, (e == null ? void 0 : e.positions.map((a) => a.name)) ?? []), _(q, (e == null ? void 0 : e.positions) ?? []);
373
- const t = (e == null ? void 0 : e.restaurantProfile.operatingHours) ?? [], n = Array.from({ length: 7 }, () => []);
374
- for (const a of t) n[N(a.dayOfWeek)] = a.closed ? [] : a.hours;
375
- _(A.dayHours, n);
376
- const r = t.filter((a) => !a.closed).flatMap((a) => a.hours);
377
- A.openFrom = r.length ? r.map((a) => a.start).reduce((a, s) => s < a ? s : a) : "00:00", A.openTo = r.length ? r.map((a) => a.end).reduce((a, s) => s > a ? s : a) : "24:00", _(
378
- A.closedWeekdays,
379
- t.filter((a) => a.closed).map((a) => N(a.dayOfWeek)).sort((a, s) => a - s)
380
- );
381
- const o = e == null ? void 0 : e.settings.payRate;
382
- A.payRate.NORMAL.overtime = (o == null ? void 0 : o.NORMAL.overtime) ?? 1, A.payRate.REST_DAY.regular = (o == null ? void 0 : o.REST_DAY.regular) ?? 1, A.payRate.REST_DAY.overtime = (o == null ? void 0 : o.REST_DAY.overtime) ?? 1, A.payRate.PUBLIC_HOLIDAY.regular = (o == null ? void 0 : o.PUBLIC_HOLIDAY.regular) ?? 1, A.payRate.PUBLIC_HOLIDAY.overtime = (o == null ? void 0 : o.PUBLIC_HOLIDAY.overtime) ?? 1;
383
- }
384
- oe(i, Ee, { immediate: !0 });
385
- function Ae(e) {
386
- return e.reduce(
387
- (t, n) => n.employmentType === "FULLTIME" ? Math.max(t, n.workingHour) : t,
388
- 0
389
- );
390
- }
391
- function Oe(e, t) {
392
- if (e.wage.type === "HOURLY") return e.wage.amount;
393
- const n = e.workingHour || t;
394
- return n ? e.wage.amount / (n * (52 / 12)) : 0;
395
- }
396
- function Se(e, t) {
397
- return e.employmentType === "FULLTIME" ? 100 : !t || !e.workingHour ? 0 : Math.min(99, Math.round(e.workingHour / t * 100));
398
- }
399
- function Te(e, t) {
400
- var n;
401
- return {
402
- start: e.startTime,
403
- end: e.endTime,
404
- role: ((n = e.position) == null ? void 0 : n.positionName) || t,
405
- // Mongo distinguishes a draft from a published/confirmed assignment; the board's third
406
- // state ('ot') is a costing outcome, never something stored.
407
- status: e.status === "DRAFT" ? "pending" : "confirmed",
408
- breakMins: e.breakMinutes,
409
- // Carried through so an edit updates this same ShiftAssignments document instead of
410
- // creating a duplicate — see useScheduleBoard's commitShift/persistSlot.
411
- assignmentId: e.id
412
- };
413
- }
414
- function Ie(e) {
415
- return {
416
- employeeId: e._id,
417
- name: e.name,
418
- employmentType: "FULLTIME",
419
- workingHour: 0,
420
- wage: { type: "HOURLY", amount: 0 },
421
- primaryPosition: null,
422
- secondaryPositions: [],
423
- availability: []
424
- };
425
- }
426
- function Pe(e) {
427
- const t = L[u.value];
428
- return !t || !e.includes(t) ? e : [t, ...e.filter((n) => n !== t)];
429
- }
430
- function Le(e) {
431
- var r;
432
- const n = (J.value[e] ?? ((r = C.value.find((o) => o._id === e)) == null ? void 0 : r.restaurantRole.map((o) => o.restaurantId)) ?? []).map((o) => L[o]).filter((o) => !!o);
433
- return n.length ? Pe([...new Set(n)]) : void 0;
434
- }
435
- function ot(e = []) {
436
- const t = i.value;
437
- if (!t) return [];
438
- const n = new Map(t.employees.map((s) => [s.employeeId, s])), r = C.value.map(
439
- (s) => n.get(s._id) ?? Ie(s)
440
- ), o = Ae(r), a = /* @__PURE__ */ new Map();
441
- for (const s of t.assignments) {
442
- const c = `${s.employeeId}|${s.date}`, p = a.get(c);
443
- p ? p.push(s) : a.set(c, [s]);
444
- }
445
- return r.map((s) => {
446
- var B, $;
447
- const c = we(s.employeeId), p = ((B = s.primaryPosition) == null ? void 0 : B.positionName) ?? "", l = [
448
- ($ = s.primaryPosition) == null ? void 0 : $.positionName,
449
- ...s.secondaryPositions.map((E) => E.positionName)
450
- ].filter((E) => !!E), y = e.map((E) => {
451
- const d = (a.get(`${s.employeeId}|${D(E)}`) ?? []).filter((g) => g.startTime && g.endTime).map((g) => Te(g, p)).sort((g, ne) => g.start.localeCompare(ne.start));
452
- return d.length ? d.length === 1 ? d[0] : d : null;
453
- }), O = Array.from(
454
- { length: 7 },
455
- (E, w) => s.availability.some((d) => N(d.dayOfWeek) === w)
456
- ), te = Array.from({ length: 7 }, (E, w) => {
457
- const d = s.availability.find((g) => N(g.dayOfWeek) === w);
458
- return { from: (d == null ? void 0 : d.start) ?? "", to: (d == null ? void 0 : d.end) ?? "" };
459
- });
460
- return {
461
- id: c,
462
- name: s.name,
463
- role: p,
464
- initials: ge(s.name),
465
- color: z[(c - Z - 1) % z.length],
466
- // Gross hours actually rostered this week — the figure the cost rail multiplies by
467
- // the rate. Contracted hours are a separate question, answered by RULES.contract.
468
- // Rounded to one decimal — `hoursBetween` divides by 60, so an unrounded sum reads
469
- // as a long, meaningless float (e.g. 31.983333333333334) everywhere this is shown
470
- // verbatim, matching the rounding `employeeLoadOf`'s own hours figure already uses.
471
- weekHours: Math.round(
472
- y.reduce(
473
- (E, w) => E + (Array.isArray(w) ? w : w && "start" in w ? [w] : []).reduce(
474
- (d, g) => d + he(g.start, g.end),
475
- 0
476
- ),
477
- 0
478
- ) * 10
479
- ) / 10,
480
- pct: Se(s, o),
481
- contractHours: s.workingHour || void 0,
482
- // Every outlet the POS says this person works at, not just this one — the Add / Edit form
483
- // shows them, and saving keeps them.
484
- locations: Le(s.employeeId),
485
- rate: Oe(s, o),
486
- positions: l,
487
- shifts: y,
488
- // Remarks live in their own collection in the older scheduling design and are not
489
- // part of this board's payload yet.
490
- remarks: [],
491
- section: X,
492
- payBasis: s.wage.type === "HOURLY" ? "hourly" : "monthly",
493
- payAmount: s.wage.amount,
494
- availDays: O,
495
- availHours: te
496
- };
497
- });
498
- }
499
- function rt() {
500
- return [];
501
- }
502
- function it() {
503
- var r, o;
504
- const e = i.value, t = {}, n = {};
505
- for (const a of (e == null ? void 0 : e.demands) ?? []) {
506
- const s = a.date ? t[r = a.date] ?? (t[r] = []) : a.dayOfWeek !== null ? n[o = N(a.dayOfWeek)] ?? (n[o] = []) : null;
507
- if (!s) continue;
508
- let c = s.find((p) => p.from === a.startTime && p.to === a.endTime);
509
- c || (c = { from: a.startTime, to: a.endTime, n: 0, roles: [] }, s.push(c)), c.n += a.headcount, a.position && c.roles.push({ position: a.position.positionName, n: a.headcount });
510
- }
511
- return { byDate: t, byWeekday: n };
512
- }
513
- function ut() {
514
- const e = ce(), { restaurants: t, readRestaurants: n } = de(), r = S(!1), o = U(
515
- () => [...t.value].map((l) => ({ value: l._id, label: l.profile.name })).sort((l, y) => l.label.localeCompare(y.label))
516
- ), a = U(() => {
517
- var l;
518
- return ((l = e.currentRestaurant.value) == null ? void 0 : l._id) ?? "";
519
- });
520
- async function s(l, y) {
521
- return b(l) ? (await Promise.all([x(l), me(y)]), !0) : !1;
522
- }
523
- const c = (l) => !!l && o.value.some((y) => y.value === l);
524
- async function p() {
525
- var y;
526
- await n(), j.splice(0, j.length, ...o.value.map((O) => O.label)), Object.keys(L).forEach((O) => delete L[O]), o.value.forEach((O) => L[O.value] = O.label);
527
- const l = c(u.value) ? u.value : c(a.value) ? a.value : ((y = o.value[0]) == null ? void 0 : y.value) ?? "";
528
- return l && (b(l), await x(l)), r.value = !0, l;
529
- }
530
- return { options: o, ready: r, outletId: u, resolve: p, switchTo: s };
531
- }
532
- const De = ["data-hierarchy", "data-size", "data-icon"], lt = /* @__PURE__ */ re({
533
- __name: "ScheduleButton",
534
- props: {
535
- hierarchy: { default: "primary" },
536
- size: { default: "sm" },
537
- iconOnly: { type: Boolean, default: !1 }
538
- },
539
- setup(e) {
540
- return (t, n) => (ue(), ie("button", {
541
- type: "button",
542
- class: "rebus-button",
543
- "data-hierarchy": e.hierarchy,
544
- "data-size": e.size,
545
- "data-icon": e.iconOnly ? "only" : void 0
546
- }, [
547
- le(t.$slots, "default")
548
- ], 8, De));
549
- }
550
- });
551
- export {
552
- Je as A,
553
- ut as B,
554
- qe as C,
555
- me as D,
556
- et as E,
557
- R as F,
558
- Me as G,
559
- Y as H,
560
- it as I,
561
- q as J,
562
- We as K,
563
- j as L,
564
- Ue as M,
565
- $e as N,
566
- C as O,
567
- pe as P,
568
- ve as Q,
569
- Ze as R,
570
- Qe as S,
571
- X as U,
572
- Ve as W,
573
- lt as _,
574
- ot as a,
575
- A as b,
576
- rt as c,
577
- k as d,
578
- i as e,
579
- Ke as f,
580
- st as g,
581
- Ge as h,
582
- je as i,
583
- Be as j,
584
- tt as k,
585
- at as l,
586
- L as m,
587
- Pe as n,
588
- u as o,
589
- Xe as p,
590
- Fe as q,
591
- xe as r,
592
- Ye as s,
593
- we as t,
594
- ze as u,
595
- nt as v,
596
- be as w,
597
- ye as x,
598
- He as y,
599
- Ce as z
600
- };