2023-09-10 21:08:42 +00:00
|
|
|
<template>
|
2023-09-14 14:20:21 +00:00
|
|
|
<MultiModal @handle="modal_handle" />
|
2023-09-10 21:08:42 +00:00
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
<BulmaDrawer header="Kalender-Assistent" @open="on_open" refreshable>
|
2023-09-10 21:08:42 +00:00
|
|
|
<div class="card-content">
|
|
|
|
<div class="content">
|
2023-09-13 19:20:11 +00:00
|
|
|
<h4>Zuordnung Buchstaben</h4>
|
2023-09-10 21:08:42 +00:00
|
|
|
<div class="tags are-medium">
|
2023-09-12 16:39:52 +00:00
|
|
|
<span
|
|
|
|
v-for="(day_part, index) in day_parts"
|
|
|
|
:key="`part-${index}`"
|
|
|
|
class="tag is-info"
|
|
|
|
>
|
2023-09-12 17:15:44 +00:00
|
|
|
{{ day_part.day }}: {{ day_part.value.split("").join(", ") }}
|
2023-09-12 16:39:52 +00:00
|
|
|
</span>
|
2023-09-10 21:08:42 +00:00
|
|
|
</div>
|
|
|
|
|
2023-09-13 19:20:11 +00:00
|
|
|
<h4>Zuordnung Bilder</h4>
|
2023-09-10 21:08:42 +00:00
|
|
|
<div class="tags are-medium">
|
2023-09-12 17:31:08 +00:00
|
|
|
<span
|
|
|
|
v-for="(day_part, index) in day_image_names"
|
|
|
|
:key="`part-${index}`"
|
|
|
|
class="tag is-primary"
|
|
|
|
>
|
|
|
|
{{ day_part.day }}: {{ day_part.value }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h4>Alle Türchen</h4>
|
|
|
|
<div class="tags are-medium">
|
|
|
|
<BulmaButton
|
|
|
|
v-for="(day_part, index) in day_parts"
|
|
|
|
:key="`btn-${index}`"
|
2023-09-14 13:54:23 +00:00
|
|
|
class="tag button is-info"
|
2023-09-12 17:31:08 +00:00
|
|
|
icon="fa-solid fa-door-open"
|
|
|
|
:text="`${day_part.day}`"
|
|
|
|
@click.left="door_click(day_part.day)"
|
|
|
|
/>
|
2023-09-10 21:08:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</BulmaDrawer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-12 17:15:44 +00:00
|
|
|
import { DayStrModel } from "@/lib/api";
|
2023-09-10 21:08:42 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
2023-09-13 16:08:05 +00:00
|
|
|
import MultiModal from "../MultiModal.vue";
|
|
|
|
import BulmaButton from "../bulma/Button.vue";
|
2023-09-14 12:51:30 +00:00
|
|
|
import BulmaDrawer from "../bulma/Drawer.vue";
|
2023-09-10 21:08:42 +00:00
|
|
|
|
|
|
|
@Options({
|
|
|
|
components: {
|
|
|
|
BulmaButton,
|
|
|
|
BulmaDrawer,
|
|
|
|
MultiModal,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class extends Vue {
|
2023-09-12 17:15:44 +00:00
|
|
|
public day_parts: DayStrModel[] = [];
|
2023-09-12 17:31:08 +00:00
|
|
|
public day_image_names: DayStrModel[] = [];
|
2023-09-14 14:20:21 +00:00
|
|
|
private multi_modal?: MultiModal;
|
2023-09-12 16:39:52 +00:00
|
|
|
|
2023-09-14 14:20:21 +00:00
|
|
|
public modal_handle(modal: MultiModal) {
|
|
|
|
this.multi_modal = modal;
|
|
|
|
}
|
2023-09-10 21:08:42 +00:00
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
public on_open(ready: () => void, fail: () => void): void {
|
2023-09-12 17:31:08 +00:00
|
|
|
Promise.all([
|
|
|
|
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
|
|
|
this.$advent22.api_get<DayStrModel[]>("admin/day_image_names"),
|
|
|
|
])
|
|
|
|
.then(([day_parts, day_image_names]) => {
|
2023-09-12 16:39:52 +00:00
|
|
|
this.day_parts = day_parts;
|
2023-09-12 17:31:08 +00:00
|
|
|
this.day_image_names = day_image_names;
|
2023-09-14 03:59:33 +00:00
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
ready();
|
2023-09-12 16:39:52 +00:00
|
|
|
})
|
2023-09-14 12:51:30 +00:00
|
|
|
.catch(fail);
|
2023-09-12 16:39:52 +00:00
|
|
|
}
|
|
|
|
|
2023-09-10 21:08:42 +00:00
|
|
|
public door_click(day: number) {
|
2023-09-14 14:20:21 +00:00
|
|
|
if (this.multi_modal === undefined) return;
|
|
|
|
this.multi_modal.show_progress();
|
2023-09-10 21:08:42 +00:00
|
|
|
|
|
|
|
this.$advent22
|
2023-09-12 22:49:18 +00:00
|
|
|
.api_get_blob(`user/image_${day}`)
|
2023-09-12 17:46:09 +00:00
|
|
|
.then((data) =>
|
2023-09-14 14:20:21 +00:00
|
|
|
this.multi_modal!.show_image(data, this.$advent22.name_door(day)),
|
2023-09-12 17:46:09 +00:00
|
|
|
)
|
2023-09-14 14:20:21 +00:00
|
|
|
.catch(() => this.multi_modal!.set_active(false));
|
2023-09-10 21:08:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|