@feedmepos/mf-hrm-portal 2.2.5-dev.6 → 2.2.5-dev.8
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.
- package/dist/{ApprovalCodeList-CtCpcbAC.js → ApprovalCodeList-BzL73nqc.js} +2 -2
- package/dist/{AuditLogList-BYOvk3l4.js → AuditLogList-BEZoHLsX.js} +3 -3
- package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DS4_vkTG.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DDrP7ywR.js} +2 -2
- package/dist/{EmployeeList-B_sTjkdO.js → EmployeeList-s4FYw1ZF.js} +5 -5
- package/dist/{GrantUserList-_nRUyHYM.js → GrantUserList-Ci_ElhHZ.js} +3 -3
- package/dist/{Main-CloHiemF.js → Main-BojQuzZI.js} +5 -5
- package/dist/{Main-DoLU6s-8.js → Main-CKr3RGvf.js} +2 -2
- package/dist/{Main-DqY2oGAM.js → Main-N1CNGDAy.js} +9 -9
- package/dist/{PermissionSetList-uL-0fN9H.js → PermissionSetList-DLknSOzA.js} +5 -5
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-dCgJ2s08.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DK2Bx8Aw.js} +1066 -1066
- package/dist/{RoleList-CwrDYFXz.js → RoleList-Cm7_q5l9.js} +7 -7
- package/dist/ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DrJ1vA88.js +426 -0
- package/dist/ScheduleButton.vue_vue_type_script_setup_true_lang-DX5JR7bi.js +600 -0
- package/dist/ScheduleGeneralPage-CmR4BZAp.js +323 -0
- package/dist/SchedulePage-CN3ZsQ9E.js +13905 -0
- package/dist/SchedulePositionPage-Bv3zraaF.js +293 -0
- package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-Buu8NEQf.js +221 -0
- package/dist/{TeamMemberList-qyKCeSsW.js → TeamMemberList-D2OfkfJP.js} +6 -6
- package/dist/{TimesheetList-D1EJG90Z.js → TimesheetList-DEdLpYuM.js} +4 -4
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-Car-HXjq.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BfMkNvCz.js} +1 -1
- package/dist/{app-By1O6mq8.js → app-Dmmpy4k-.js} +127 -127
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-_ZoZF_Ra.js → dayjs.min-DcfKURXN.js} +1 -1
- package/dist/{employee-BC7QM1dX.js → employee-D3ZpYH4j.js} +3 -3
- package/dist/{index-u10uXqFM.js → index-BxkisKEs.js} +1 -1
- package/dist/{index-CHf8MAN1.js → index-D-VlxJu9.js} +1 -1
- package/dist/{lodash-BsAtPIfh.js → lodash-p40sRkqQ.js} +1 -1
- package/dist/{role-PShfEEXE.js → role-CM1urkJZ.js} +1 -1
- package/dist/{rule-RU8uWecT.js → rule-BPApyMJY.js} +2 -2
- package/dist/src/api/schedule/index.d.ts +0 -3
- package/dist/src/views/scheduling/ScheduleGeneralPage.vue.d.ts +1 -2
- package/dist/src/views/scheduling/SchedulePage.vue.d.ts +1 -2
- package/dist/src/views/scheduling/SchedulePositionPage.vue.d.ts +1 -2
- package/dist/src/views/scheduling/components/ScheduleAddEmployeeModal.vue.d.ts +5 -1
- package/dist/src/views/scheduling/components/ScheduleAddEmployeePositionsSection.vue.d.ts +5 -1
- package/dist/src/views/scheduling/components/ScheduleAddPositionModal.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleButton.vue.d.ts +23 -0
- package/dist/src/views/scheduling/components/ScheduleConfirmModal.vue.d.ts +1 -1
- package/dist/src/views/scheduling/components/ScheduleEmployeeMenu.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleLeaveEditModal.vue.d.ts +4 -2
- package/dist/src/views/scheduling/components/ScheduleOnboardingWizard.vue.d.ts +3 -0
- package/dist/src/views/scheduling/components/ScheduleSelect.vue.d.ts +14 -0
- package/dist/src/views/scheduling/components/ScheduleShiftHeadcountEditor.vue.d.ts +5 -1
- package/dist/src/views/scheduling/components/ScheduleShiftPopover.vue.d.ts +2 -0
- package/dist/src/views/scheduling/components/ScheduleStaffRail.vue.d.ts +4 -2
- package/dist/src/views/scheduling/components/ScheduleStaffRows.vue.d.ts +4 -2
- package/dist/src/views/scheduling/components/ScheduleTopbar.vue.d.ts +2 -4
- package/dist/src/views/scheduling/composables/schedule-add-employee-form.d.ts +1 -0
- package/dist/src/views/scheduling/composables/schedule-popover-position.d.ts +16 -0
- package/dist/src/views/scheduling/composables/useCollapsedList.d.ts +9 -0
- package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +1 -0
- package/dist/src/views/scheduling/composables/useScheduleAddPick.d.ts +14 -7
- package/dist/src/views/scheduling/composables/useScheduleAssign.d.ts +11 -2
- package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +8 -0
- package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +11 -0
- package/dist/src/views/scheduling/composables/useScheduleDayTimeline.d.ts +0 -5
- package/dist/src/views/scheduling/composables/useScheduleDemand.d.ts +5 -3
- package/dist/src/views/scheduling/composables/useScheduleDemandSheet.d.ts +7 -1
- package/dist/src/views/scheduling/composables/useScheduleEmployeeMenu.d.ts +35 -0
- package/dist/src/views/scheduling/composables/useScheduleLeave.d.ts +53 -3
- package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1181 -55
- package/dist/src/views/scheduling/composables/useSchedulePositionModal.d.ts +50 -0
- package/dist/src/views/scheduling/composables/useSchedulePublish.d.ts +2 -0
- package/dist/src/views/scheduling/composables/useScheduleRangeCalendar.d.ts +10 -1
- package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +6 -0
- package/dist/src/views/scheduling/composables/useScheduleSetupBanner.d.ts +5 -5
- package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +6 -0
- package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +7 -0
- package/dist/src/views/scheduling/composables/useScheduleTimePicker.d.ts +6 -1
- package/dist/src/views/scheduling/composables/useScheduleViewportFit.d.ts +9 -0
- package/dist/src/views/scheduling/data.d.ts +6 -1
- package/dist/src/views/scheduling/schedule-store.d.ts +11 -1
- package/dist/src/views/scheduling/types.d.ts +9 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useReportPermissions-Bu-l3ebR.js → useReportPermissions-5EhPvVT9.js} +3 -3
- package/package.json +1 -1
- package/dist/ScheduleGeneralPage-CgQOHHb8.js +0 -242
- package/dist/SchedulePage-C7q1IL70.js +0 -10761
- package/dist/SchedulePositionPage-Dys7X035.js +0 -220
- package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-Cm2VWp8s.js +0 -201
- package/dist/useScheduleOutlet-BOmEn1hr.js +0 -546
- package/dist/useSchedulePositions-upgaNffa.js +0 -103
|
@@ -0,0 +1,600 @@
|
|
|
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
|
+
};
|