Add assigment of crew to events and shifts
This commit is contained in:
parent
0aff9cc94a
commit
cef6b13dd1
7 changed files with 153 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
|||
<th>event</th>
|
||||
<th>s</th>
|
||||
<th>location</th>
|
||||
<th>assigned</th>
|
||||
<th v-if="edit"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -53,6 +54,7 @@
|
|||
>{{ location.name }}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
Add at
|
||||
<button
|
||||
|
@ -108,6 +110,13 @@
|
|||
>{{ location.name }}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<AssignedCrew
|
||||
:edit="true"
|
||||
:modelValue="es.assigned"
|
||||
@update:modelValue="editEventSlot(es, { assigned: $event })"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
:disabled="removed.has(es.id)"
|
||||
|
@ -147,6 +156,8 @@
|
|||
v-model="newEventName"
|
||||
>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td colspan="2">
|
||||
<button
|
||||
type="button"
|
||||
|
@ -176,6 +187,7 @@
|
|||
<td>{{ es.name }}</td>
|
||||
<td>{{ status(es) }}</td>
|
||||
<td>{{ es.location }}</td>
|
||||
<td><AssignedCrew :modelValue="es.assigned" :edit="false" /></td>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
|
@ -225,6 +237,7 @@ interface EventSlot {
|
|||
origLocation: string,
|
||||
name: string,
|
||||
location: string,
|
||||
assigned: number[],
|
||||
start: DateTime,
|
||||
end: DateTime,
|
||||
}
|
||||
|
@ -332,6 +345,7 @@ function mergeSlot(event: ScheduleEvent, eventSlot: EventSlot): ScheduleEvent {
|
|||
return {
|
||||
...s,
|
||||
locations: [...locations],
|
||||
assigned: eventSlot.assigned.length ? eventSlot.assigned : undefined,
|
||||
start,
|
||||
end,
|
||||
};
|
||||
|
@ -349,6 +363,7 @@ function mergeSlot(event: ScheduleEvent, eventSlot: EventSlot): ScheduleEvent {
|
|||
slots: [...event.slots, {
|
||||
id: oldSlot ? oldSlot.id : `${event.id}-${nextId}`,
|
||||
locations: [eventSlot.location],
|
||||
assigned: eventSlot.assigned.length ? eventSlot.assigned : undefined,
|
||||
start,
|
||||
end,
|
||||
}],
|
||||
|
@ -487,6 +502,7 @@ function editEventSlot(
|
|||
duration?: string,
|
||||
name?: string,
|
||||
location?: string,
|
||||
assigned?: number[],
|
||||
}
|
||||
) {
|
||||
if (edits.start) {
|
||||
|
@ -522,6 +538,12 @@ function editEventSlot(
|
|||
location: edits.location,
|
||||
};
|
||||
}
|
||||
if (edits.assigned !== undefined) {
|
||||
eventSlot = {
|
||||
...eventSlot,
|
||||
assigned: edits.assigned,
|
||||
};
|
||||
}
|
||||
const change = { op: "set" as const, data: eventSlot };
|
||||
changes.value = replaceChange(change, changes.value);
|
||||
}
|
||||
|
@ -568,6 +590,7 @@ function newEventSlot(options: { start?: DateTime, end?: DateTime } = {}) {
|
|||
name,
|
||||
origLocation: location,
|
||||
location,
|
||||
assigned: [],
|
||||
start,
|
||||
end,
|
||||
},
|
||||
|
@ -612,6 +635,7 @@ const eventSlots = computed(() => {
|
|||
slot,
|
||||
name: event.name,
|
||||
location,
|
||||
assigned: slot.assigned ?? [],
|
||||
origLocation: location,
|
||||
start: DateTime.fromISO(slot.start, { zone: timezone.value }),
|
||||
end: DateTime.fromISO(slot.end, { zone: timezone.value }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue