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-21 00:19:44 +00:00
|
|
|
<p>Hervorgehobenen Tagen wurde kein Buchstabe zugewiesen.</p>
|
|
|
|
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Zuordnung Buchstaben</h3>
|
2023-09-10 21:08:42 +00:00
|
|
|
<div class="tags are-medium">
|
2023-09-21 00:19:44 +00:00
|
|
|
<template v-for="(data, day) in day_data" :key="`part-${day}`">
|
|
|
|
<span v-if="data.part === ''" class="tag is-warning">
|
|
|
|
{{ day }}
|
|
|
|
</span>
|
|
|
|
<span v-else class="tag is-info">
|
|
|
|
{{ day }}: {{ data.part.split("").join(", ") }}
|
2023-09-20 14:39:00 +00:00
|
|
|
</span>
|
|
|
|
</template>
|
2023-09-10 21:08:42 +00:00
|
|
|
</div>
|
|
|
|
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Zuordnung Bilder</h3>
|
2023-09-10 21:08:42 +00:00
|
|
|
<div class="tags are-medium">
|
2023-09-12 17:31:08 +00:00
|
|
|
<span
|
2023-09-21 00:19:44 +00:00
|
|
|
v-for="(data, day) in day_data"
|
|
|
|
:key="`image-${day}`"
|
|
|
|
:class="'tag is-' + (data.part === '' ? 'warning' : 'primary')"
|
2023-09-12 17:31:08 +00:00
|
|
|
>
|
2023-09-21 00:19:44 +00:00
|
|
|
{{ day }}: {{ data.image_name }}
|
2023-09-12 17:31:08 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Alle Türchen</h3>
|
2023-09-12 17:31:08 +00:00
|
|
|
<div class="tags are-medium">
|
|
|
|
<BulmaButton
|
2023-09-21 00:19:44 +00:00
|
|
|
v-for="(data, day) in day_data"
|
|
|
|
:key="`btn-${day}`"
|
|
|
|
:class="'tag is-' + (data.part === '' ? 'warning' : 'info')"
|
2023-09-12 17:31:08 +00:00
|
|
|
icon="fa-solid fa-door-open"
|
2023-09-21 00:19:44 +00:00
|
|
|
:text="day"
|
|
|
|
@click.left="door_click(day)"
|
2023-09-12 17:31:08 +00:00
|
|
|
/>
|
2023-09-10 21:08:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</BulmaDrawer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-21 09:53:30 +00:00
|
|
|
import { NumStrDict, objForEach } 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-21 00:19:44 +00:00
|
|
|
public day_data: {
|
2023-09-21 09:53:30 +00:00
|
|
|
[day: number]: {
|
2023-09-21 00:19:44 +00:00
|
|
|
part: string;
|
|
|
|
image_name: string;
|
|
|
|
};
|
|
|
|
} = {};
|
|
|
|
|
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([
|
2023-09-21 09:53:30 +00:00
|
|
|
this.$advent22.api_get<NumStrDict>("admin/day_parts"),
|
|
|
|
this.$advent22.api_get<NumStrDict>("admin/day_image_names"),
|
2023-09-12 17:31:08 +00:00
|
|
|
])
|
|
|
|
.then(([day_parts, day_image_names]) => {
|
2023-09-21 09:53:30 +00:00
|
|
|
const _ensure_day_in_data = (day: number) => {
|
2023-09-21 00:19:44 +00:00
|
|
|
if (!(day in this.day_data)) {
|
|
|
|
this.day_data[day] = { part: "", image_name: "" };
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-09-21 09:53:30 +00:00
|
|
|
objForEach(day_parts, (day, part) => {
|
|
|
|
_ensure_day_in_data(day);
|
|
|
|
this.day_data[day].part = part;
|
|
|
|
});
|
2023-09-21 00:19:44 +00:00
|
|
|
|
2023-09-21 09:53:30 +00:00
|
|
|
objForEach(day_image_names, (day, image_name) => {
|
|
|
|
_ensure_day_in_data(day);
|
|
|
|
this.day_data[day].image_name = image_name;
|
|
|
|
});
|
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-21 09:53:30 +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-11-01 02:00:23 +00:00
|
|
|
.catch(() => this.multi_modal!.hide());
|
2023-09-10 21:08:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|