Allow shifts without a role
Allow a shift to have no role associated with it in order to simplify conflict resolution around situations like a shift being created while the role it was assoiated with was deleted. This also allows for shifts that are freestanding to be created in case having a role doesn't make sense for it.
This commit is contained in:
parent
1d2edf7535
commit
5144bf2b37
5 changed files with 32 additions and 55 deletions
|
@ -39,12 +39,7 @@
|
|||
v-model="newShiftId"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<SelectSingleEntity
|
||||
:entities="schedule.roles"
|
||||
v-model="newShiftRoleId"
|
||||
/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
Add at
|
||||
|
@ -139,12 +134,7 @@
|
|||
v-model="newShiftId"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<SelectSingleEntity
|
||||
:entities="schedule.roles"
|
||||
v-model="newShiftRoleId"
|
||||
/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td colspan="2">
|
||||
<button
|
||||
type="button"
|
||||
|
@ -244,10 +234,6 @@ const newShiftEnd = computed({
|
|||
newShiftDuration.value = dropDay(end.diff(start)).toFormat("hh:mm");
|
||||
},
|
||||
});
|
||||
const newShiftRoleId = ref(props.roleId);
|
||||
watch(() => props.roleId, () => {
|
||||
newShiftRoleId.value = props.roleId;
|
||||
});
|
||||
|
||||
function endFromTime(start: DateTime, time: string) {
|
||||
let end = start.startOf("day").plus(Duration.fromISOTime(time, { locale: accountStore.activeLocale }));
|
||||
|
@ -291,11 +277,6 @@ function newShiftSlot(options: { start?: DateTime, end?: DateTime } = {}) {
|
|||
alert("Invalid shift");
|
||||
return;
|
||||
}
|
||||
const role = schedule.value.roles.get(newShiftRoleId.value!);
|
||||
if (!role) {
|
||||
alert("Invalid role");
|
||||
return;
|
||||
}
|
||||
let start;
|
||||
let end;
|
||||
const duration = durationFromTime(newShiftDuration.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue