@feedmepos/mf-hrm-portal 2.2.5-dev.5 → 2.2.5-dev.6
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-DqR6ouRS.js → ApprovalCodeList-CtCpcbAC.js} +4 -4
- package/dist/{AuditLogList-CG2BiQX6.js → AuditLogList-BYOvk3l4.js} +18 -17
- package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C7nMXx8R.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DS4_vkTG.js} +2 -2
- package/dist/{EmployeeList-CGZzol7v.js → EmployeeList-B_sTjkdO.js} +29 -27
- package/dist/{FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js → FormItem.vue_vue_type_script_setup_true_lang-CUnlKsxk.js} +1 -1
- package/dist/{GrantUserList-D1fBv1KQ.js → GrantUserList-_nRUyHYM.js} +5 -5
- package/dist/{Main-CFoZot3K.js → Main-CloHiemF.js} +5 -5
- package/dist/{Main-zg7fbEtx.js → Main-DoLU6s-8.js} +2 -2
- package/dist/{Main-BOt-Y1wv.js → Main-DqY2oGAM.js} +9 -9
- package/dist/{PermissionSetList-bJpwD62u.js → PermissionSetList-uL-0fN9H.js} +11 -10
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C4C8Cvf4.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-dCgJ2s08.js} +1019 -1018
- package/dist/{RoleList-DUVZ7dkO.js → RoleList-CwrDYFXz.js} +7 -7
- package/dist/ScheduleGeneralPage-CgQOHHb8.js +242 -0
- package/dist/SchedulePage-C7q1IL70.js +10761 -0
- package/dist/SchedulePositionPage-Dys7X035.js +220 -0
- package/dist/ScheduleSelect.vue_vue_type_script_setup_true_lang-Cm2VWp8s.js +201 -0
- package/dist/SelectFilter-CG13h83-.js +264 -0
- package/dist/{TeamMemberList-DAnM-DSd.js → TeamMemberList-qyKCeSsW.js} +36 -34
- package/dist/{TimesheetList-5sdcWjEf.js → TimesheetList-D1EJG90Z.js} +54 -53
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-GhPw_mCW.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-Car-HXjq.js} +2 -2
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/{app-D-cQzgkr.js → app-By1O6mq8.js} +2881 -2296
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-DqFS0ebn.js → dayjs.min-_ZoZF_Ra.js} +1 -1
- package/dist/employee-BC7QM1dX.js +139 -0
- package/dist/index-CHf8MAN1.js +70 -0
- package/dist/{iteration-BjW8Cs9e.js → index-u10uXqFM.js} +698 -726
- package/dist/iteration-CcXrOMQe.js +30 -0
- package/dist/{lodash-wjhSWqez.js → lodash-BsAtPIfh.js} +1 -1
- package/dist/{role-CEUcSmA6.js → role-PShfEEXE.js} +4 -3
- package/dist/{rule-Df8LOhxm.js → rule-RU8uWecT.js} +71 -70
- package/dist/src/api/schedule/index.d.ts +44 -0
- package/dist/src/components/layout/AppSidebar.vue.d.ts +2 -0
- package/dist/src/components/layout/PortalShell.vue.d.ts +12 -0
- package/dist/src/components/layout/withShell.d.ts +14 -0
- package/dist/src/router/shared.d.ts +4 -1
- package/dist/src/types/schedule.d.ts +232 -0
- package/dist/src/views/scheduling/ScheduleGeneralPage.vue.d.ts +4 -0
- package/dist/src/views/scheduling/SchedulePage.vue.d.ts +4 -0
- package/dist/src/views/scheduling/SchedulePositionPage.vue.d.ts +4 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeeIdentitySection.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeeModal.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeeModeStep.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeePosAccessSection.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeePositionsSection.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddEmployeeSchedulingSection.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAddPickPopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAllShiftsRow.vue.d.ts +22 -0
- package/dist/src/views/scheduling/components/ScheduleAreaRows.vue.d.ts +34 -0
- package/dist/src/views/scheduling/components/ScheduleAssignEmployeePopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleAutoScheduleModal.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleChangeEmployeeModal.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleConfirmModal.vue.d.ts +24 -0
- package/dist/src/views/scheduling/components/ScheduleCostRail.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleDateRangePopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleDayNotePopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleDayTimeline.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleDemandRow.vue.d.ts +23 -0
- package/dist/src/views/scheduling/components/ScheduleDemandSheet.vue.d.ts +10 -0
- package/dist/src/views/scheduling/components/ScheduleDotsIcon.vue.d.ts +2 -0
- package/dist/src/views/scheduling/components/ScheduleEmployeeDetailPanel.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleEmployeeIdentity.vue.d.ts +17 -0
- package/dist/src/views/scheduling/components/ScheduleFilterBar.vue.d.ts +18 -0
- package/dist/src/views/scheduling/components/ScheduleGapPopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleGridHeader.vue.d.ts +18 -0
- package/dist/src/views/scheduling/components/ScheduleLeaveEditModal.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleLegendBar.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleOnboardingWelcome.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleOnboardingWizard.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleOpenShiftCardMenu.vue.d.ts +14 -0
- package/dist/src/views/scheduling/components/SchedulePdfPreview.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/SchedulePublishModal.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleReviewBar.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleSelect.vue.d.ts +24 -0
- package/dist/src/views/scheduling/components/ScheduleSelectExistingEmployeeModal.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleShiftCardMenu.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleShiftCell.vue.d.ts +31 -0
- package/dist/src/views/scheduling/components/ScheduleShiftHeadcountEditor.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleShiftImpact.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleShiftMoreOptions.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleShiftPopover.vue.d.ts +14 -0
- package/dist/src/views/scheduling/components/ScheduleShiftRepeatDaysRow.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleShiftSegmentsEditor.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleShiftWhoPicker.vue.d.ts +25 -0
- package/dist/src/views/scheduling/components/ScheduleStackPopover.vue.d.ts +14 -0
- package/dist/src/views/scheduling/components/ScheduleStaffRail.vue.d.ts +16 -0
- package/dist/src/views/scheduling/components/ScheduleStaffRows.vue.d.ts +54 -0
- package/dist/src/views/scheduling/components/ScheduleStatsRow.vue.d.ts +12 -0
- package/dist/src/views/scheduling/components/ScheduleSwapShiftsModal.vue.d.ts +8 -0
- package/dist/src/views/scheduling/components/ScheduleTimePickerPopover.vue.d.ts +6 -0
- package/dist/src/views/scheduling/components/ScheduleTopbar.vue.d.ts +22 -0
- package/dist/src/views/scheduling/composables/schedule-add-employee-form.d.ts +67 -0
- package/dist/src/views/scheduling/composables/schedule-board-helpers.d.ts +38 -0
- package/dist/src/views/scheduling/composables/schedule-day-meta.d.ts +29 -0
- package/dist/src/views/scheduling/composables/schedule-employee-profile.d.ts +7 -0
- package/dist/src/views/scheduling/composables/schedule-shift-time.d.ts +14 -0
- package/dist/src/views/scheduling/composables/schedule-week-cache.d.ts +10 -0
- package/dist/src/views/scheduling/composables/useScheduleAddEmployee.d.ts +86 -0
- package/dist/src/views/scheduling/composables/useScheduleAddPick.d.ts +66 -0
- package/dist/src/views/scheduling/composables/useScheduleAllShiftsRow.d.ts +77 -0
- package/dist/src/views/scheduling/composables/useScheduleAreaBoard.d.ts +50 -0
- package/dist/src/views/scheduling/composables/useScheduleAreaDragDrop.d.ts +18 -0
- package/dist/src/views/scheduling/composables/useScheduleAssign.d.ts +113 -0
- package/dist/src/views/scheduling/composables/useScheduleAutoSchedule.d.ts +136 -0
- package/dist/src/views/scheduling/composables/useScheduleBoard.d.ts +415 -0
- package/dist/src/views/scheduling/composables/useScheduleCellState.d.ts +27 -0
- package/dist/src/views/scheduling/composables/useScheduleClashDetection.d.ts +18 -0
- package/dist/src/views/scheduling/composables/useScheduleCopyWeek.d.ts +17 -0
- package/dist/src/views/scheduling/composables/useScheduleCostRail.d.ts +43 -0
- package/dist/src/views/scheduling/composables/useScheduleDayNote.d.ts +48 -0
- package/dist/src/views/scheduling/composables/useScheduleDayTimeline.d.ts +82 -0
- package/dist/src/views/scheduling/composables/useScheduleDemand.d.ts +68 -0
- package/dist/src/views/scheduling/composables/useScheduleDemandRow.d.ts +45 -0
- package/dist/src/views/scheduling/composables/useScheduleDemandSheet.d.ts +139 -0
- package/dist/src/views/scheduling/composables/useScheduleDragDrop.d.ts +22 -0
- package/dist/src/views/scheduling/composables/useScheduleEmployeeIdentity.d.ts +32 -0
- package/dist/src/views/scheduling/composables/useScheduleEmployeeProfile.d.ts +16 -0
- package/dist/src/views/scheduling/composables/useScheduleExport.d.ts +26 -0
- package/dist/src/views/scheduling/composables/useScheduleFilterBar.d.ts +14 -0
- package/dist/src/views/scheduling/composables/useScheduleGapPopover.d.ts +80 -0
- package/dist/src/views/scheduling/composables/useScheduleLeave.d.ts +20 -0
- package/dist/src/views/scheduling/composables/useScheduleLegend.d.ts +15 -0
- package/dist/src/views/scheduling/composables/useScheduleLegendBar.d.ts +35 -0
- package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +179 -0
- package/dist/src/views/scheduling/composables/useScheduleOpenShiftCard.d.ts +23 -0
- package/dist/src/views/scheduling/composables/useScheduleOutlet.d.ts +19 -0
- package/dist/src/views/scheduling/composables/useSchedulePositions.d.ts +32 -0
- package/dist/src/views/scheduling/composables/useSchedulePublish.d.ts +91 -0
- package/dist/src/views/scheduling/composables/useScheduleRangeCalendar.d.ts +18 -0
- package/dist/src/views/scheduling/composables/useScheduleRoster.d.ts +183 -0
- package/dist/src/views/scheduling/composables/useScheduleSettings.d.ts +54 -0
- package/dist/src/views/scheduling/composables/useScheduleSetupBanner.d.ts +18 -0
- package/dist/src/views/scheduling/composables/useScheduleShiftActions.d.ts +225 -0
- package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +174 -0
- package/dist/src/views/scheduling/composables/useScheduleStaffRail.d.ts +20 -0
- package/dist/src/views/scheduling/composables/useScheduleStatsRow.d.ts +25 -0
- package/dist/src/views/scheduling/composables/useScheduleTimePicker.d.ts +44 -0
- package/dist/src/views/scheduling/composables/useScheduleTopbar.d.ts +10 -0
- package/dist/src/views/scheduling/data.d.ts +105 -0
- package/dist/src/views/scheduling/locales/index.d.ts +496 -0
- package/dist/src/views/scheduling/schedule-store.d.ts +116 -0
- package/dist/src/views/scheduling/types.d.ts +311 -0
- package/dist/src/views/team/components/PortalConditionForm.vue.d.ts +2 -2
- package/dist/src/views/team/condition-builders/ConditionBuilderForm.vue.d.ts +2 -2
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useReportPermissions-4wm7pJcK.js → useReportPermissions-Bu-l3ebR.js} +3 -3
- package/dist/useScheduleOutlet-BOmEn1hr.js +546 -0
- package/dist/useSchedulePositions-upgaNffa.js +103 -0
- package/package.json +1 -1
- package/dist/SelectFilter-ATOm0hdn.js +0 -269
- package/dist/employee-DvvnCQMK.js +0 -204
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed as r, ref as n } from "vue";
|
|
2
|
-
import { e as d } from "./
|
|
2
|
+
import { e as d } from "./index-u10uXqFM.js";
|
|
3
3
|
import { useCoreStore as h } from "@feedmepos/mf-common";
|
|
4
|
-
import { R as K } from "./rule-
|
|
5
|
-
import { D as g } from "./app-
|
|
4
|
+
import { R as K } from "./rule-RU8uWecT.js";
|
|
5
|
+
import { D as g } from "./app-By1O6mq8.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();
|
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { ref as I, shallowRef as q, reactive as g, watch as ee, computed as U } from "vue";
|
|
2
|
+
import { useCoreStore as te } from "@feedmepos/mf-common";
|
|
3
|
+
import { g as p, b as f, u as ne } from "./restaurant-BTpBmfBV.js";
|
|
4
|
+
import { E as ae } from "./index-CHf8MAN1.js";
|
|
5
|
+
const m = {
|
|
6
|
+
async generateAutoSchedule(e, t) {
|
|
7
|
+
return p(
|
|
8
|
+
await f(`restaurants/${e}/schedules`).post(
|
|
9
|
+
"auto-schedule/generate",
|
|
10
|
+
t
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
/** One outlet's whole board over `[from, to]` (inclusive, 'YYYY-MM-DD'). */
|
|
15
|
+
async readBoard(e, t, a) {
|
|
16
|
+
return p(
|
|
17
|
+
await f(`restaurants/${e}/schedules`).get("board", {
|
|
18
|
+
params: { from: t, to: a }
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
/** Creates or updates the employee's shared business-level scheduling profile. */
|
|
23
|
+
async createEmployeeProfile(e, t) {
|
|
24
|
+
return p(await f("schedules").post("employees", t));
|
|
25
|
+
},
|
|
26
|
+
/** Edits the employee's shared business-level scheduling profile. */
|
|
27
|
+
async updateEmployeeProfile(e, t, a) {
|
|
28
|
+
return p(
|
|
29
|
+
await f("schedules").post("employees", { employeeId: t, ...a })
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
/** Positions are shared across the business. */
|
|
33
|
+
async createPosition(e) {
|
|
34
|
+
return p(await f("schedules").post("positions", e));
|
|
35
|
+
},
|
|
36
|
+
async updatePosition(e, t) {
|
|
37
|
+
return p(await f("schedules").post(`positions/${e}`, t));
|
|
38
|
+
},
|
|
39
|
+
/** Deleting one position is `deletePositions` with a single-id array — the backend's
|
|
40
|
+
* `DELETE positions/:id` route is gone; this is now `DELETE positions?ids=`. */
|
|
41
|
+
async deletePosition(e) {
|
|
42
|
+
await f("schedules").delete("positions", {
|
|
43
|
+
params: { ids: e }
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
/** Creates one flat demand interval. */
|
|
47
|
+
async createDemand(e, t) {
|
|
48
|
+
return p(
|
|
49
|
+
await f(`restaurants/${e}/schedules`).post("demands", t)
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
/** Deletes a batch of demands in one request — e.g. `saveDemand` replacing a whole
|
|
53
|
+
* day/weekday's demand rows wholesale. Deleting one demand is just this with a single-id
|
|
54
|
+
* array. */
|
|
55
|
+
async deleteDemands(e, t) {
|
|
56
|
+
return p(
|
|
57
|
+
await f(`restaurants/${e}/schedules`).delete("demands", {
|
|
58
|
+
params: { ids: t.join(",") }
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
/** Replaces one date's note/holiday-mark. All three fields back to empty/false clears it. */
|
|
63
|
+
async saveScheduleDay(e, t, a) {
|
|
64
|
+
return p(
|
|
65
|
+
await f(`restaurants/${e}/schedules`).post(
|
|
66
|
+
`days/${t}`,
|
|
67
|
+
a
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
/** A one-off shift assignment. */
|
|
72
|
+
async createAssignment(e, t) {
|
|
73
|
+
return p(
|
|
74
|
+
await f(`restaurants/${e}/schedules`).post("assignments", t)
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
async updateAssignment(e, t, a) {
|
|
78
|
+
return p(
|
|
79
|
+
await f(`restaurants/${e}/schedules`).post(
|
|
80
|
+
`assignments/${t}`,
|
|
81
|
+
a
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
/** Deletes a batch of assignments in one request — e.g. a shift split into several segments
|
|
86
|
+
* getting replaced wholesale. Deleting one assignment is just this with a single-id
|
|
87
|
+
* array. */
|
|
88
|
+
async deleteAssignments(e, t) {
|
|
89
|
+
return p(
|
|
90
|
+
await f(`restaurants/${e}/schedules`).delete("assignments", {
|
|
91
|
+
params: { ids: t.join(",") }
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
/** Flips a batch of assignments to one status in a single request — e.g. Publish sending
|
|
96
|
+
* every DRAFT shift on the board to PUBLISHED at once. */
|
|
97
|
+
async bulkUpdateAssignmentStatus(e, t) {
|
|
98
|
+
return p(
|
|
99
|
+
await f(`restaurants/${e}/schedules`).post(
|
|
100
|
+
"assignments/bulk-status",
|
|
101
|
+
t
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
// ── DEV-ONLY TEST HELPER — delete freely. See the matching block in
|
|
106
|
+
// apps/hrm-backend/src/schedule/schedule.controller.ts for the rest of what to remove
|
|
107
|
+
// alongside this: the backend route + service method, and the store wrapper + menu item
|
|
108
|
+
// on the portal side. ──
|
|
109
|
+
async devResetOutlet(e) {
|
|
110
|
+
return p(
|
|
111
|
+
await f(`restaurants/${e}/schedules`).delete("dev-reset")
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function P(e) {
|
|
116
|
+
const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
117
|
+
return `${t}-${a}-${r}`;
|
|
118
|
+
}
|
|
119
|
+
function _(e, t) {
|
|
120
|
+
const a = new Date(e);
|
|
121
|
+
return a.setDate(a.getDate() + t), a;
|
|
122
|
+
}
|
|
123
|
+
const W = 6, u = q(null), B = I(!1), R = I(null), L = I(0), i = I(""), C = I([]);
|
|
124
|
+
let S = null, T = null, A = null, F = null;
|
|
125
|
+
function Y(e) {
|
|
126
|
+
return e === i.value ? !1 : (i.value = e, u.value = null, S = null, T = null, R.value = null, F = null, C.value = [], A = null, L.value += 1, !0);
|
|
127
|
+
}
|
|
128
|
+
async function x(e) {
|
|
129
|
+
if (!e || F === e) return;
|
|
130
|
+
const t = await ae.readEmployeesPage({
|
|
131
|
+
limit: 500,
|
|
132
|
+
offset: 0,
|
|
133
|
+
restaurantIds: [e]
|
|
134
|
+
});
|
|
135
|
+
e === i.value && (C.value = t.items, F = e, L.value += 1);
|
|
136
|
+
}
|
|
137
|
+
function j(e, t) {
|
|
138
|
+
return S !== null && T !== null && S <= e && T >= t;
|
|
139
|
+
}
|
|
140
|
+
async function se(e) {
|
|
141
|
+
const t = P(e), a = P(_(e, 6));
|
|
142
|
+
j(t, a) || A && (await A, j(t, a)) || await K(
|
|
143
|
+
_(e, -7 * W),
|
|
144
|
+
_(e, 7 * W)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
async function oe() {
|
|
148
|
+
!S || !T || await K(/* @__PURE__ */ new Date(`${S}T00:00:00`), /* @__PURE__ */ new Date(`${T}T00:00:00`));
|
|
149
|
+
}
|
|
150
|
+
async function Se(e) {
|
|
151
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
152
|
+
const t = await m.createEmployeeProfile(i.value, e);
|
|
153
|
+
u.value && (u.value.employees.push(t), L.value += 1);
|
|
154
|
+
}
|
|
155
|
+
async function Te(e, t) {
|
|
156
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
157
|
+
const a = await m.updateEmployeeProfile(i.value, e, t);
|
|
158
|
+
if (u.value) {
|
|
159
|
+
const r = u.value.employees.findIndex((o) => o.employeeId === e);
|
|
160
|
+
r > -1 && (u.value.employees[r] = a);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function Ie(e) {
|
|
164
|
+
const t = await m.createPosition(e);
|
|
165
|
+
u.value && (u.value = { ...u.value, positions: [...u.value.positions, t] });
|
|
166
|
+
}
|
|
167
|
+
async function Pe(e, t) {
|
|
168
|
+
const a = await m.updatePosition(e, t);
|
|
169
|
+
u.value && (u.value = {
|
|
170
|
+
...u.value,
|
|
171
|
+
positions: u.value.positions.map((r) => r.id === e ? a : r)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async function Ne(e) {
|
|
175
|
+
await m.deletePosition(e), u.value && (u.value = {
|
|
176
|
+
...u.value,
|
|
177
|
+
positions: u.value.positions.filter((t) => t.id !== e)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function De(e, t) {
|
|
181
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
182
|
+
const a = await m.saveScheduleDay(i.value, e, t);
|
|
183
|
+
if (u.value) {
|
|
184
|
+
const r = u.value.days.filter((o) => o.date !== e);
|
|
185
|
+
a && r.push(a), u.value = { ...u.value, days: r };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function Re(e) {
|
|
189
|
+
var o;
|
|
190
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
191
|
+
const t = (((o = u.value) == null ? void 0 : o.demands) ?? []).filter(
|
|
192
|
+
(n) => e.date ? n.date === e.date : n.dayOfWeek === e.dayOfWeek
|
|
193
|
+
), a = e.periods.flatMap((n) => {
|
|
194
|
+
const s = (n.roles ?? []).filter((l) => l.positionName && l.headcount > 0), c = s.reduce((l, v) => l + v.headcount, 0), y = {
|
|
195
|
+
...e.date ? { date: e.date } : { dayOfWeek: e.dayOfWeek },
|
|
196
|
+
startTime: n.startTime,
|
|
197
|
+
endTime: n.endTime
|
|
198
|
+
};
|
|
199
|
+
return [
|
|
200
|
+
...s.map((l) => ({
|
|
201
|
+
...y,
|
|
202
|
+
headcount: l.headcount,
|
|
203
|
+
position: { positionId: l.positionId, positionName: l.positionName }
|
|
204
|
+
})),
|
|
205
|
+
...n.headcount > c ? [{ ...y, headcount: n.headcount - c }] : []
|
|
206
|
+
];
|
|
207
|
+
});
|
|
208
|
+
t.length && await m.deleteDemands(
|
|
209
|
+
i.value,
|
|
210
|
+
t.map((n) => n.id)
|
|
211
|
+
);
|
|
212
|
+
const r = await Promise.all(
|
|
213
|
+
a.map((n) => m.createDemand(i.value, n))
|
|
214
|
+
);
|
|
215
|
+
if (u.value) {
|
|
216
|
+
const n = u.value.demands.filter((s) => !t.some((c) => c.id === s.id));
|
|
217
|
+
u.value = { ...u.value, demands: [...n, ...r] };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async function Le(e) {
|
|
221
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
222
|
+
return m.generateAutoSchedule(i.value, e);
|
|
223
|
+
}
|
|
224
|
+
async function ke(e) {
|
|
225
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
226
|
+
return m.createAssignment(i.value, e);
|
|
227
|
+
}
|
|
228
|
+
async function _e(e, t) {
|
|
229
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
230
|
+
return m.updateAssignment(i.value, e, t);
|
|
231
|
+
}
|
|
232
|
+
async function He(e) {
|
|
233
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
234
|
+
e.length && await m.deleteAssignments(i.value, e);
|
|
235
|
+
}
|
|
236
|
+
async function Fe(e) {
|
|
237
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
238
|
+
return m.bulkUpdateAssignmentStatus(i.value, e);
|
|
239
|
+
}
|
|
240
|
+
async function Ce() {
|
|
241
|
+
if (!i.value) throw new Error("No outlet selected");
|
|
242
|
+
const { removed: e } = await m.devResetOutlet(i.value);
|
|
243
|
+
return await oe(), e;
|
|
244
|
+
}
|
|
245
|
+
async function K(e, t) {
|
|
246
|
+
const a = i.value;
|
|
247
|
+
if (!a) {
|
|
248
|
+
R.value = "No outlet selected";
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const r = P(e), o = P(t);
|
|
252
|
+
B.value = !0, R.value = null;
|
|
253
|
+
const n = (async () => {
|
|
254
|
+
try {
|
|
255
|
+
const s = await m.readBoard(a, r, o);
|
|
256
|
+
if (i.value !== a) return;
|
|
257
|
+
u.value = s, S = r, T = o, L.value += 1;
|
|
258
|
+
} catch (s) {
|
|
259
|
+
if (i.value !== a) return;
|
|
260
|
+
R.value = s instanceof Error ? s.message : "Could not load the schedule";
|
|
261
|
+
} finally {
|
|
262
|
+
i.value === a && (B.value = !1);
|
|
263
|
+
}
|
|
264
|
+
})();
|
|
265
|
+
A = n;
|
|
266
|
+
try {
|
|
267
|
+
await n;
|
|
268
|
+
} finally {
|
|
269
|
+
A === n && (A = null);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const V = "unassigned", Me = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], re = "Any position", $e = "All Stations", Ue = ["senior", "junior"], We = [
|
|
273
|
+
{ id: V, label: "Unassigned", roles: [], system: !0 }
|
|
274
|
+
], z = 1e6, G = [
|
|
275
|
+
"#903E1F",
|
|
276
|
+
"#5F090A",
|
|
277
|
+
"#0A5384",
|
|
278
|
+
"#1F5F3E",
|
|
279
|
+
"#5B2C6F",
|
|
280
|
+
"#7D5A00",
|
|
281
|
+
"#0F5C5C",
|
|
282
|
+
"#6E2142"
|
|
283
|
+
], ue = g([]), J = g([]);
|
|
284
|
+
function ie(e) {
|
|
285
|
+
var t;
|
|
286
|
+
return (t = J.find((a) => a.name === e)) == null ? void 0 : t.id;
|
|
287
|
+
}
|
|
288
|
+
function Be(e) {
|
|
289
|
+
if (e)
|
|
290
|
+
return { positionId: ie(e), positionName: e };
|
|
291
|
+
}
|
|
292
|
+
const Ye = g({}), le = g({ name: "" }), b = g([]);
|
|
293
|
+
g([]);
|
|
294
|
+
g([]);
|
|
295
|
+
const xe = g({}), je = g([]), Ge = g([]), be = [1, 1, 1, 1, 1, 1, 1], E = g({
|
|
296
|
+
coverage: {},
|
|
297
|
+
openFrom: "00:00",
|
|
298
|
+
openTo: "24:00",
|
|
299
|
+
dayHours: Array.from({ length: 7 }, () => []),
|
|
300
|
+
payRate: {
|
|
301
|
+
NORMAL: { overtime: 1 },
|
|
302
|
+
REST_DAY: { regular: 1, overtime: 1 },
|
|
303
|
+
PUBLIC_HOLIDAY: { regular: 1, overtime: 1 }
|
|
304
|
+
},
|
|
305
|
+
otAfterDaily: 0,
|
|
306
|
+
salesForecast: 0,
|
|
307
|
+
closedWeekdays: [],
|
|
308
|
+
labourTarget: 0,
|
|
309
|
+
budgetFromSales: !1,
|
|
310
|
+
budget: 0,
|
|
311
|
+
otCapHours: 0,
|
|
312
|
+
otBudget: 0,
|
|
313
|
+
notify: {
|
|
314
|
+
waConnected: !1,
|
|
315
|
+
waNumber: "",
|
|
316
|
+
waDisplayName: "",
|
|
317
|
+
defaults: { wa: !1, push: !1, email: !1 }
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
function N(e) {
|
|
321
|
+
return (e + 6) % 7;
|
|
322
|
+
}
|
|
323
|
+
function Ke(e) {
|
|
324
|
+
return (e + 1) % 7;
|
|
325
|
+
}
|
|
326
|
+
function D(e, t) {
|
|
327
|
+
e.splice(0, e.length, ...t);
|
|
328
|
+
}
|
|
329
|
+
function ce(e, t) {
|
|
330
|
+
const a = (n) => {
|
|
331
|
+
const [s, c] = n.split(":").map(Number);
|
|
332
|
+
return (s || 0) * 60 + (c || 0);
|
|
333
|
+
}, r = a(e);
|
|
334
|
+
let o = a(t);
|
|
335
|
+
return o <= r && (o += 1440), (o - r) / 60;
|
|
336
|
+
}
|
|
337
|
+
function de(e) {
|
|
338
|
+
var a;
|
|
339
|
+
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
340
|
+
return t.length ? (t[0][0] + (((a = t[1]) == null ? void 0 : a[0]) ?? "")).toUpperCase() : "??";
|
|
341
|
+
}
|
|
342
|
+
const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
|
|
343
|
+
function Ve(e) {
|
|
344
|
+
return X.get(e);
|
|
345
|
+
}
|
|
346
|
+
function fe(e) {
|
|
347
|
+
const t = H.get(e);
|
|
348
|
+
if (t !== void 0) return t;
|
|
349
|
+
const a = z + H.size + 1;
|
|
350
|
+
return H.set(e, a), X.set(a, e), a;
|
|
351
|
+
}
|
|
352
|
+
function me(e) {
|
|
353
|
+
le.name = (e == null ? void 0 : e.outlet.name) ?? "", D(ue, (e == null ? void 0 : e.positions.map((n) => n.name)) ?? []), D(J, (e == null ? void 0 : e.positions) ?? []);
|
|
354
|
+
const t = (e == null ? void 0 : e.restaurantProfile.operatingHours) ?? [], a = Array.from({ length: 7 }, () => []);
|
|
355
|
+
for (const n of t) a[N(n.dayOfWeek)] = n.closed ? [] : n.hours;
|
|
356
|
+
D(E.dayHours, a);
|
|
357
|
+
const r = t.filter((n) => !n.closed).flatMap((n) => n.hours);
|
|
358
|
+
E.openFrom = r.length ? r.map((n) => n.start).reduce((n, s) => s < n ? s : n) : "00:00", E.openTo = r.length ? r.map((n) => n.end).reduce((n, s) => s > n ? s : n) : "24:00", D(
|
|
359
|
+
E.closedWeekdays,
|
|
360
|
+
t.filter((n) => n.closed).map((n) => N(n.dayOfWeek)).sort((n, s) => n - s)
|
|
361
|
+
);
|
|
362
|
+
const o = e == null ? void 0 : e.settings.payRate;
|
|
363
|
+
E.payRate.NORMAL.overtime = (o == null ? void 0 : o.NORMAL.overtime) ?? 1, E.payRate.REST_DAY.regular = (o == null ? void 0 : o.REST_DAY.regular) ?? 1, E.payRate.REST_DAY.overtime = (o == null ? void 0 : o.REST_DAY.overtime) ?? 1, E.payRate.PUBLIC_HOLIDAY.regular = (o == null ? void 0 : o.PUBLIC_HOLIDAY.regular) ?? 1, E.payRate.PUBLIC_HOLIDAY.overtime = (o == null ? void 0 : o.PUBLIC_HOLIDAY.overtime) ?? 1;
|
|
364
|
+
}
|
|
365
|
+
ee(u, me, { immediate: !0 });
|
|
366
|
+
function pe(e) {
|
|
367
|
+
return e.reduce(
|
|
368
|
+
(t, a) => a.employmentType === "FULLTIME" ? Math.max(t, a.workingHour) : t,
|
|
369
|
+
0
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function ye(e, t) {
|
|
373
|
+
if (e.wage.type === "HOURLY") return e.wage.amount;
|
|
374
|
+
const a = e.workingHour || t;
|
|
375
|
+
return a ? e.wage.amount / (a * (52 / 12)) : 0;
|
|
376
|
+
}
|
|
377
|
+
function ve(e, t) {
|
|
378
|
+
return e.employmentType === "FULLTIME" ? 100 : !t || !e.workingHour ? 0 : Math.min(99, Math.round(e.workingHour / t * 100));
|
|
379
|
+
}
|
|
380
|
+
function he(e, t) {
|
|
381
|
+
var a;
|
|
382
|
+
return {
|
|
383
|
+
start: e.startTime,
|
|
384
|
+
end: e.endTime,
|
|
385
|
+
role: ((a = e.position) == null ? void 0 : a.positionName) || t,
|
|
386
|
+
// Mongo distinguishes a draft from a published/confirmed assignment; the board's third
|
|
387
|
+
// state ('ot') is a costing outcome, never something stored.
|
|
388
|
+
status: e.status === "DRAFT" ? "pending" : "confirmed",
|
|
389
|
+
breakMins: e.breakMinutes,
|
|
390
|
+
// Carried through so an edit updates this same ShiftAssignments document instead of
|
|
391
|
+
// creating a duplicate — see useScheduleBoard's commitShift/persistSlot.
|
|
392
|
+
assignmentId: e.id
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function ge(e) {
|
|
396
|
+
return {
|
|
397
|
+
employeeId: e._id,
|
|
398
|
+
name: e.name,
|
|
399
|
+
employmentType: "FULLTIME",
|
|
400
|
+
workingHour: 0,
|
|
401
|
+
wage: { type: "HOURLY", amount: 0 },
|
|
402
|
+
primaryPosition: null,
|
|
403
|
+
secondaryPositions: [],
|
|
404
|
+
availability: []
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function ze(e = []) {
|
|
408
|
+
const t = u.value;
|
|
409
|
+
if (!t) return [];
|
|
410
|
+
const a = new Map(t.employees.map((s) => [s.employeeId, s])), r = C.value.map(
|
|
411
|
+
(s) => a.get(s._id) ?? ge(s)
|
|
412
|
+
), o = pe(r), n = /* @__PURE__ */ new Map();
|
|
413
|
+
for (const s of t.assignments) {
|
|
414
|
+
const c = `${s.employeeId}|${s.date}`, y = n.get(c);
|
|
415
|
+
y ? y.push(s) : n.set(c, [s]);
|
|
416
|
+
}
|
|
417
|
+
return r.map((s) => {
|
|
418
|
+
var M, $;
|
|
419
|
+
const c = fe(s.employeeId), y = ((M = s.primaryPosition) == null ? void 0 : M.positionName) || re, l = [
|
|
420
|
+
($ = s.primaryPosition) == null ? void 0 : $.positionName,
|
|
421
|
+
...s.secondaryPositions.map((O) => O.positionName)
|
|
422
|
+
].filter((O) => !!O), v = e.map((O) => {
|
|
423
|
+
const d = (n.get(`${s.employeeId}|${P(O)}`) ?? []).filter((h) => h.startTime && h.endTime).map((h) => he(h, y)).sort((h, Z) => h.start.localeCompare(Z.start));
|
|
424
|
+
return d.length ? d.length === 1 ? d[0] : d : null;
|
|
425
|
+
}), k = Array.from(
|
|
426
|
+
{ length: 7 },
|
|
427
|
+
(O, w) => s.availability.some((d) => N(d.dayOfWeek) === w)
|
|
428
|
+
), Q = Array.from({ length: 7 }, (O, w) => {
|
|
429
|
+
const d = s.availability.find((h) => N(h.dayOfWeek) === w);
|
|
430
|
+
return { from: (d == null ? void 0 : d.start) ?? "", to: (d == null ? void 0 : d.end) ?? "" };
|
|
431
|
+
});
|
|
432
|
+
return {
|
|
433
|
+
id: c,
|
|
434
|
+
name: s.name,
|
|
435
|
+
role: y,
|
|
436
|
+
initials: de(s.name),
|
|
437
|
+
color: G[(c - z - 1) % G.length],
|
|
438
|
+
// Gross hours actually rostered this week — the figure the cost rail multiplies by
|
|
439
|
+
// the rate. Contracted hours are a separate question, answered by RULES.contract.
|
|
440
|
+
// Rounded to one decimal — `hoursBetween` divides by 60, so an unrounded sum reads
|
|
441
|
+
// as a long, meaningless float (e.g. 31.983333333333334) everywhere this is shown
|
|
442
|
+
// verbatim, matching the rounding `employeeLoadOf`'s own hours figure already uses.
|
|
443
|
+
weekHours: Math.round(
|
|
444
|
+
v.reduce(
|
|
445
|
+
(O, w) => O + (Array.isArray(w) ? w : w && "start" in w ? [w] : []).reduce(
|
|
446
|
+
(d, h) => d + ce(h.start, h.end),
|
|
447
|
+
0
|
|
448
|
+
),
|
|
449
|
+
0
|
|
450
|
+
) * 10
|
|
451
|
+
) / 10,
|
|
452
|
+
pct: ve(s, o),
|
|
453
|
+
contractHours: s.workingHour || void 0,
|
|
454
|
+
rate: ye(s, o),
|
|
455
|
+
positions: l,
|
|
456
|
+
shifts: v,
|
|
457
|
+
// Remarks live in their own collection in the older scheduling design and are not
|
|
458
|
+
// part of this board's payload yet.
|
|
459
|
+
remarks: [],
|
|
460
|
+
section: V,
|
|
461
|
+
payBasis: s.wage.type === "HOURLY" ? "hourly" : "monthly",
|
|
462
|
+
payAmount: s.wage.amount,
|
|
463
|
+
availDays: k,
|
|
464
|
+
availHours: Q
|
|
465
|
+
};
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
function Je() {
|
|
469
|
+
return [];
|
|
470
|
+
}
|
|
471
|
+
function Xe() {
|
|
472
|
+
var r, o;
|
|
473
|
+
const e = u.value, t = {}, a = {};
|
|
474
|
+
for (const n of (e == null ? void 0 : e.demands) ?? []) {
|
|
475
|
+
const s = n.date ? t[r = n.date] ?? (t[r] = []) : n.dayOfWeek !== null ? a[o = N(n.dayOfWeek)] ?? (a[o] = []) : null;
|
|
476
|
+
if (!s) continue;
|
|
477
|
+
let c = s.find((y) => y.from === n.startTime && y.to === n.endTime);
|
|
478
|
+
c || (c = { from: n.startTime, to: n.endTime, n: 0, roles: [] }, s.push(c)), c.n += n.headcount, n.position && c.roles.push({ position: n.position.positionName, n: n.headcount });
|
|
479
|
+
}
|
|
480
|
+
return { byDate: t, byWeekday: a };
|
|
481
|
+
}
|
|
482
|
+
function Qe() {
|
|
483
|
+
const e = te(), { restaurants: t, readRestaurants: a } = ne(), r = I(!1), o = U(
|
|
484
|
+
() => [...t.value].map((l) => ({ value: l._id, label: l.profile.name })).sort((l, v) => l.label.localeCompare(v.label))
|
|
485
|
+
), n = U(() => {
|
|
486
|
+
var l;
|
|
487
|
+
return ((l = e.currentRestaurant.value) == null ? void 0 : l._id) ?? "";
|
|
488
|
+
});
|
|
489
|
+
async function s(l, v) {
|
|
490
|
+
return Y(l) ? (await Promise.all([x(l), se(v)]), !0) : !1;
|
|
491
|
+
}
|
|
492
|
+
const c = (l) => !!l && o.value.some((v) => v.value === l);
|
|
493
|
+
async function y() {
|
|
494
|
+
var v;
|
|
495
|
+
await a(), b.splice(0, b.length, ...o.value.map((k) => k.label));
|
|
496
|
+
const l = c(i.value) ? i.value : c(n.value) ? n.value : ((v = o.value[0]) == null ? void 0 : v.value) ?? "";
|
|
497
|
+
return l && (Y(l), await x(l)), r.value = !0, l;
|
|
498
|
+
}
|
|
499
|
+
return { options: o, ready: r, outletId: i, resolve: y, switchTo: s };
|
|
500
|
+
}
|
|
501
|
+
export {
|
|
502
|
+
$e as A,
|
|
503
|
+
oe as B,
|
|
504
|
+
xe as C,
|
|
505
|
+
B as D,
|
|
506
|
+
je as E,
|
|
507
|
+
Xe as F,
|
|
508
|
+
Ce as G,
|
|
509
|
+
J as H,
|
|
510
|
+
Ne as I,
|
|
511
|
+
Pe as J,
|
|
512
|
+
Ie as K,
|
|
513
|
+
b as L,
|
|
514
|
+
le as O,
|
|
515
|
+
ue as P,
|
|
516
|
+
Ye as R,
|
|
517
|
+
We as S,
|
|
518
|
+
V as U,
|
|
519
|
+
Me as W,
|
|
520
|
+
ze as a,
|
|
521
|
+
E as b,
|
|
522
|
+
Je as c,
|
|
523
|
+
L as d,
|
|
524
|
+
u as e,
|
|
525
|
+
Fe as f,
|
|
526
|
+
Ve as g,
|
|
527
|
+
ke as h,
|
|
528
|
+
He as i,
|
|
529
|
+
Te as j,
|
|
530
|
+
Ge as k,
|
|
531
|
+
Ke as l,
|
|
532
|
+
Se as m,
|
|
533
|
+
Le as n,
|
|
534
|
+
i as o,
|
|
535
|
+
Be as p,
|
|
536
|
+
fe as q,
|
|
537
|
+
be as r,
|
|
538
|
+
De as s,
|
|
539
|
+
Re as t,
|
|
540
|
+
_e as u,
|
|
541
|
+
ie as v,
|
|
542
|
+
Ue as w,
|
|
543
|
+
Qe as x,
|
|
544
|
+
se as y,
|
|
545
|
+
R as z
|
|
546
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ref as t, watch as O, computed as d } from "vue";
|
|
2
|
+
import { H as g, a as k, I as L, J as R, K as T } from "./useScheduleOutlet-BOmEn1hr.js";
|
|
3
|
+
function m() {
|
|
4
|
+
return g.map((l) => ({ id: l.id, name: l.name }));
|
|
5
|
+
}
|
|
6
|
+
function x() {
|
|
7
|
+
const l = t(m());
|
|
8
|
+
O(
|
|
9
|
+
() => g.map((e) => `${e.id}:${e.name}`).join(" "),
|
|
10
|
+
() => {
|
|
11
|
+
l.value = m();
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
const h = d(() => k()), s = t(!1), r = t(""), c = t(null), v = t(""), i = t(null), u = t(!1), a = t(null);
|
|
15
|
+
function p(e) {
|
|
16
|
+
return h.value.filter((n) => n.role === e).length;
|
|
17
|
+
}
|
|
18
|
+
function f(e, n) {
|
|
19
|
+
return l.value.some(
|
|
20
|
+
(o) => o.id !== n && o.name.toLowerCase() === e.toLowerCase()
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function y() {
|
|
24
|
+
s.value = !0, r.value = "", c.value = null, i.value = null, a.value = null;
|
|
25
|
+
}
|
|
26
|
+
function E() {
|
|
27
|
+
s.value = !1, r.value = "";
|
|
28
|
+
}
|
|
29
|
+
async function w() {
|
|
30
|
+
const e = r.value.trim().slice(0, 40);
|
|
31
|
+
if (!(!e || f(e))) {
|
|
32
|
+
u.value = !0, a.value = null;
|
|
33
|
+
try {
|
|
34
|
+
await T({ name: e }), s.value = !1, r.value = "";
|
|
35
|
+
} catch (n) {
|
|
36
|
+
a.value = n instanceof Error ? n.message : "Could not add this position";
|
|
37
|
+
} finally {
|
|
38
|
+
u.value = !1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function C(e) {
|
|
43
|
+
const n = l.value.find((o) => o.id === e);
|
|
44
|
+
n && (c.value = e, v.value = n.name, s.value = !1, i.value = null, a.value = null);
|
|
45
|
+
}
|
|
46
|
+
function P() {
|
|
47
|
+
c.value = null, v.value = "";
|
|
48
|
+
}
|
|
49
|
+
async function D(e) {
|
|
50
|
+
const n = v.value.trim().slice(0, 40);
|
|
51
|
+
if (!(!n || f(n, e))) {
|
|
52
|
+
u.value = !0, a.value = null;
|
|
53
|
+
try {
|
|
54
|
+
await R(e, { name: n }), c.value = null, v.value = "";
|
|
55
|
+
} catch (o) {
|
|
56
|
+
a.value = o instanceof Error ? o.message : "Could not rename this position";
|
|
57
|
+
} finally {
|
|
58
|
+
u.value = !1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function I(e) {
|
|
63
|
+
i.value = e;
|
|
64
|
+
}
|
|
65
|
+
function A() {
|
|
66
|
+
i.value = null;
|
|
67
|
+
}
|
|
68
|
+
async function S(e) {
|
|
69
|
+
u.value = !0, a.value = null;
|
|
70
|
+
try {
|
|
71
|
+
await L(e), i.value = null;
|
|
72
|
+
} catch (n) {
|
|
73
|
+
a.value = n instanceof Error ? n.message : "Could not delete this position";
|
|
74
|
+
} finally {
|
|
75
|
+
u.value = !1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const N = d(() => l.value.length);
|
|
79
|
+
return {
|
|
80
|
+
positions: l,
|
|
81
|
+
count: N,
|
|
82
|
+
isAdding: s,
|
|
83
|
+
newName: r,
|
|
84
|
+
editingId: c,
|
|
85
|
+
editingName: v,
|
|
86
|
+
pendingDeleteId: i,
|
|
87
|
+
saving: u,
|
|
88
|
+
error: a,
|
|
89
|
+
usageCountFor: p,
|
|
90
|
+
startAdd: y,
|
|
91
|
+
cancelAdd: E,
|
|
92
|
+
confirmAdd: w,
|
|
93
|
+
startEdit: C,
|
|
94
|
+
cancelEdit: P,
|
|
95
|
+
saveEdit: D,
|
|
96
|
+
askDelete: I,
|
|
97
|
+
cancelDelete: A,
|
|
98
|
+
confirmDelete: S
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
x as u
|
|
103
|
+
};
|