Disable editing of public events in UI for crew
This commit is contained in:
parent
b22d32dada
commit
27d853d102
1 changed files with 11 additions and 1 deletions
|
@ -23,12 +23,14 @@
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
:value="event.name"
|
:value="event.name"
|
||||||
|
:disabled="!canEdit(event)"
|
||||||
@input="editEvent(event, { name: ($event as any).target.value })"
|
@input="editEvent(event, { name: ($event as any).target.value })"
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
:disabled="!canEdit(event)"
|
||||||
:value="event.description"
|
:value="event.description"
|
||||||
@input="editEvent(event, { description: ($event as any).target.value })"
|
@input="editEvent(event, { description: ($event as any).target.value })"
|
||||||
>
|
>
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
:disabled="!canEditPublic"
|
||||||
:value="!event.crew"
|
:value="!event.crew"
|
||||||
:checked="!event.crew"
|
:checked="!event.crew"
|
||||||
@change="editEvent(event, { crew: !($event as any).target.value })"
|
@change="editEvent(event, { crew: !($event as any).target.value })"
|
||||||
|
@ -45,7 +48,7 @@
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="removed.has(event.id)"
|
:disabled="!canEdit(event) || removed.has(event.id)"
|
||||||
@click="delEvent(event.id)"
|
@click="delEvent(event.id)"
|
||||||
>Delete</button>
|
>Delete</button>
|
||||||
<button
|
<button
|
||||||
|
@ -72,6 +75,7 @@
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
:disabled="!canEditPublic"
|
||||||
v-model="newEventPublic"
|
v-model="newEventPublic"
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
|
@ -131,6 +135,12 @@ defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const schedule = await useSchedule();
|
const schedule = await useSchedule();
|
||||||
|
const { data: session } = await useAccountSession();
|
||||||
|
const canEditPublic = computed(() => session.value?.account.type === "admin");
|
||||||
|
|
||||||
|
function canEdit(event: ScheduleEvent) {
|
||||||
|
return event.crew || canEditPublic.value;
|
||||||
|
}
|
||||||
|
|
||||||
const changes = ref<ChangeRecord<ScheduleEvent>[]>([]);
|
const changes = ref<ChangeRecord<ScheduleEvent>[]>([]);
|
||||||
const removed = computed(() => new Set(changes.value.filter(c => c.op === "del").map(c => c.data.id)));
|
const removed = computed(() => new Set(changes.value.filter(c => c.op === "del").map(c => c.data.id)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue