2021-02-05 23:07:58 +00:00
|
|
|
<template>
|
|
|
|
<q-card
|
2021-03-22 02:25:59 +00:00
|
|
|
class="q-mx-xs q-mt-sm justify-start content-center items-center rounded-borders shadow-5"
|
2021-02-05 23:07:58 +00:00
|
|
|
bordered
|
|
|
|
>
|
2021-03-22 02:25:59 +00:00
|
|
|
<q-card-section class="text-primary q-pa-xs">
|
|
|
|
<div class="text-weight-bolder text-center" style="font-size: 1.5vw">
|
2021-02-07 19:16:21 +00:00
|
|
|
{{ event.type.name }}
|
2021-03-22 02:25:59 +00:00
|
|
|
<template v-if="event.name"
|
|
|
|
>: <span style="font-size: 1.2vw">{{ event.name }}</span>
|
|
|
|
</template>
|
2021-02-07 19:16:21 +00:00
|
|
|
</div>
|
2021-03-22 02:25:59 +00:00
|
|
|
<div v-if="event.description" class="text-weight-medium" style="font-size: 1vw">
|
2021-02-07 19:16:21 +00:00
|
|
|
{{ event.description }}
|
|
|
|
</div>
|
2021-03-22 02:25:59 +00:00
|
|
|
</q-card-section>
|
|
|
|
<q-separator />
|
|
|
|
<q-card-section class="q-pa-xs">
|
|
|
|
<!-- Jobs -->
|
|
|
|
<JobSlot
|
|
|
|
v-for="(job, index) in event.jobs"
|
|
|
|
:key="index"
|
|
|
|
v-model="event.jobs[index]"
|
|
|
|
class="col q-my-xs"
|
|
|
|
:event-id="event.id"
|
|
|
|
/>
|
|
|
|
</q-card-section>
|
|
|
|
<q-card-actions v-if="canEdit || canDelete" vertical align="center">
|
|
|
|
<router-link v-if="canEdit" :to="{ name: 'events-edit', params: { id: event.id } }">
|
|
|
|
<template #default>
|
|
|
|
<q-btn color="secondary" flat label="Bearbeiten" style="min-width: 95%" />
|
|
|
|
</template>
|
|
|
|
</router-link>
|
|
|
|
<q-btn
|
|
|
|
v-if="canDelete"
|
|
|
|
color="negative"
|
|
|
|
flat
|
|
|
|
label="Löschen"
|
|
|
|
style="min-width: 95%"
|
|
|
|
@click="remove"
|
|
|
|
/>
|
|
|
|
</q-card-actions>
|
2021-02-05 23:07:58 +00:00
|
|
|
</q-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-20 23:58:31 +00:00
|
|
|
import { defineComponent, computed, PropType } from 'vue';
|
2021-03-22 02:25:59 +00:00
|
|
|
import { hasPermission } from 'src/utils/permission';
|
|
|
|
import { PERMISSIONS } from 'src/plugins/schedule/permissions';
|
2021-03-20 23:58:31 +00:00
|
|
|
import JobSlot from './JobSlot.vue';
|
2021-02-05 23:07:58 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'Eventslot',
|
2021-03-20 23:58:31 +00:00
|
|
|
components: { JobSlot },
|
2021-02-04 23:07:51 +00:00
|
|
|
props: {
|
2021-03-20 23:58:31 +00:00
|
|
|
modelValue: {
|
2021-02-04 23:07:51 +00:00
|
|
|
required: true,
|
|
|
|
type: Object as PropType<FG.Event>,
|
|
|
|
},
|
|
|
|
},
|
2021-03-22 02:25:59 +00:00
|
|
|
emits: {
|
|
|
|
'update:modelValue': (val: FG.Event) => !!val,
|
|
|
|
removeEvent: (val: number) => typeof val === 'number',
|
|
|
|
},
|
2021-03-20 23:58:31 +00:00
|
|
|
setup(props, { emit }) {
|
2021-03-22 02:25:59 +00:00
|
|
|
const canDelete = computed(() => hasPermission(PERMISSIONS.DELETE));
|
2021-03-24 17:15:17 +00:00
|
|
|
const canEdit = computed(
|
|
|
|
() =>
|
|
|
|
hasPermission(PERMISSIONS.EDIT) &&
|
|
|
|
(props.modelValue?.end || props.modelValue.start) > new Date()
|
|
|
|
);
|
2021-03-20 23:58:31 +00:00
|
|
|
const event = computed({
|
|
|
|
get: () => props.modelValue,
|
|
|
|
set: (v) => emit('update:modelValue', v),
|
|
|
|
});
|
2021-03-22 02:25:59 +00:00
|
|
|
|
|
|
|
function remove() {
|
|
|
|
emit('removeEvent', props.modelValue.id);
|
|
|
|
}
|
|
|
|
|
2021-02-05 23:07:58 +00:00
|
|
|
return {
|
2021-03-22 02:25:59 +00:00
|
|
|
canDelete,
|
|
|
|
canEdit,
|
|
|
|
remove,
|
2021-03-20 23:58:31 +00:00
|
|
|
event,
|
2021-02-05 23:07:58 +00:00
|
|
|
};
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2021-02-05 23:07:58 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2021-02-07 19:16:21 +00:00
|
|
|
<style scoped></style>
|