adrema/resources/js/views/member/MemberCourses.vue

58 lines
2.5 KiB
Vue
Raw Normal View History

2021-11-19 22:58:27 +01:00
<template>
2023-05-20 01:45:43 +02:00
<div class="sidebar flex flex-col group is-bright">
2023-10-13 15:48:29 +02:00
<page-header title="Ausbildungen" @close="$emit('close')">
2023-05-20 02:38:38 +02:00
<template #toolbar>
2024-07-03 16:37:58 +02:00
<page-toolbar-button v-if="single === null" color="primary" icon="plus" @click.prevent="create">Neue Ausbildung</page-toolbar-button>
<page-toolbar-button v-if="single !== null" color="primary" icon="undo" @click.prevent="cancel">Zurück</page-toolbar-button>
2023-05-20 02:38:38 +02:00
</template>
2023-05-20 01:45:43 +02:00
</page-header>
2021-11-19 22:58:27 +01:00
<form v-if="single" class="p-6 grid gap-4 justify-start" @submit.prevent="submit">
2023-10-13 15:48:29 +02:00
<f-text id="completed_at" v-model="single.completed_at" type="date" label="Datum" required></f-text>
2024-07-03 16:37:58 +02:00
<f-select id="course_id" v-model="single.course_id" name="course_id" :options="meta.courses" label="Baustein" required></f-select>
2021-11-20 01:43:20 +01:00
<f-text id="event_name" v-model="single.event_name" label="Veranstaltung" required></f-text>
<f-text id="organizer" v-model="single.organizer" label="Veranstalter" required></f-text>
2021-11-19 22:58:27 +01:00
<button type="submit" class="btn btn-primary">Absenden</button>
</form>
2023-10-13 15:48:29 +02:00
<div v-else class="grow">
2022-02-10 02:18:57 +01:00
<table class="custom-table custom-table-light custom-table-sm text-sm grow">
<thead>
<th>Baustein</th>
<th>Veranstaltung</th>
<th>Veranstalter</th>
<th>Datum</th>
<th></th>
</thead>
2021-11-19 22:58:27 +01:00
2023-10-18 01:11:36 +02:00
<tr v-for="(course, index) in data" :key="index">
2022-02-10 02:18:57 +01:00
<td v-text="course.course_name"></td>
<td v-text="course.event_name"></td>
<td v-text="course.organizer"></td>
<td v-text="course.completed_at_human"></td>
<td class="flex">
2024-07-03 16:37:58 +02:00
<a href="#" class="inline-flex btn btn-warning btn-sm" @click.prevent="edit(course)"><ui-sprite src="pencil"></ui-sprite></a>
<a href="#" class="inline-flex btn btn-danger btn-sm" @click.prevent="remove(course)"><ui-sprite src="trash"></ui-sprite></a>
2022-02-10 02:18:57 +01:00
</td>
</tr>
</table>
</div>
2021-11-19 22:58:27 +01:00
</div>
</template>
2024-07-03 16:37:58 +02:00
<script lang="js" setup>
2023-10-18 01:11:36 +02:00
defineEmits(['close']);
import { useApiIndex } from '../../composables/useApiIndex.js';
2023-10-13 15:48:29 +02:00
2023-10-18 01:11:36 +02:00
const props = defineProps({
url: {
type: String,
required: true,
2023-10-13 15:48:29 +02:00
},
2023-10-18 01:11:36 +02:00
});
2021-11-19 22:58:27 +01:00
2023-10-18 01:11:36 +02:00
const { data, meta, reload, cancel, single, create, edit, submit, remove } = useApiIndex(props.url, 'course');
2021-11-19 22:58:27 +01:00
2023-10-18 01:11:36 +02:00
await reload();
2021-11-19 22:58:27 +01:00
</script>