2023-01-17 18:25:56 +00:00
|
|
|
<template>
|
2023-01-19 00:22:01 +00:00
|
|
|
<div class="box">
|
|
|
|
<p class="title is-4">Türchen bearbeiten</p>
|
|
|
|
|
2023-02-02 12:50:12 +00:00
|
|
|
<BulmaBreadcrumbs :steps="steps" v-model="current_step" />
|
2023-01-19 00:22:01 +00:00
|
|
|
|
2023-02-02 14:12:44 +00:00
|
|
|
<DoorPlacer v-if="current_step === 0" v-model:doors="doors" />
|
2023-02-02 15:29:26 +00:00
|
|
|
<DoorChooser v-if="current_step === 1" v-model:doors="doors" />
|
2023-09-07 03:30:21 +00:00
|
|
|
<template v-if="current_step === 2">
|
|
|
|
<Calendar :doors="doors" />
|
2023-09-07 16:51:19 +00:00
|
|
|
<BulmaButton class="is-success" @click.left="load_doors">
|
2023-09-07 16:44:44 +00:00
|
|
|
Laden
|
|
|
|
</BulmaButton>
|
2023-09-07 15:43:05 +00:00
|
|
|
<BulmaButton
|
|
|
|
class="is-success"
|
|
|
|
icon="fa-solid fa-crosshairs"
|
|
|
|
@click.left="save_doors"
|
|
|
|
>
|
|
|
|
Speichern
|
|
|
|
</BulmaButton>
|
2023-09-07 03:30:21 +00:00
|
|
|
</template>
|
2023-01-17 18:25:56 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-07 03:30:21 +00:00
|
|
|
import { Door, DoorSerialized } from "@/lib/door";
|
2023-09-06 16:25:35 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
2023-01-17 18:25:56 +00:00
|
|
|
|
2023-02-02 12:50:12 +00:00
|
|
|
import BulmaBreadcrumbs, { Step } from "./BulmaBreadcrumbs.vue";
|
2023-09-07 15:43:05 +00:00
|
|
|
import BulmaButton from "./BulmaButton.vue";
|
2023-09-07 00:41:38 +00:00
|
|
|
import Calendar from "./Calendar.vue";
|
2023-09-07 02:08:56 +00:00
|
|
|
import DoorChooser from "./calendar/editor/DoorChooser.vue";
|
|
|
|
import DoorPlacer from "./calendar/editor/DoorPlacer.vue";
|
2023-01-24 00:14:50 +00:00
|
|
|
|
2023-01-17 18:25:56 +00:00
|
|
|
@Options({
|
|
|
|
components: {
|
2023-02-02 12:50:12 +00:00
|
|
|
BulmaBreadcrumbs,
|
2023-09-07 15:43:05 +00:00
|
|
|
BulmaButton,
|
2023-01-19 17:59:18 +00:00
|
|
|
DoorPlacer,
|
2023-01-24 00:14:50 +00:00
|
|
|
DoorChooser,
|
2023-09-07 00:41:38 +00:00
|
|
|
Calendar,
|
2023-01-17 18:25:56 +00:00
|
|
|
},
|
|
|
|
})
|
2023-01-24 23:19:25 +00:00
|
|
|
export default class extends Vue {
|
2023-09-06 16:25:35 +00:00
|
|
|
public readonly steps: Step[] = [
|
2023-01-20 00:42:47 +00:00
|
|
|
{ label: "Platzieren", icon: "fa-solid fa-crosshairs" },
|
|
|
|
{ label: "Ordnen", icon: "fa-solid fa-list-ol" },
|
|
|
|
{ label: "Überprüfen", icon: "fa-solid fa-check" },
|
|
|
|
];
|
2023-09-06 16:25:35 +00:00
|
|
|
public current_step = 0;
|
|
|
|
public doors: Door[] = [];
|
2023-09-07 03:30:21 +00:00
|
|
|
|
2023-09-07 16:44:44 +00:00
|
|
|
public load_doors() {
|
2023-09-07 17:00:28 +00:00
|
|
|
this.$advent22.api_get<DoorSerialized[]>("/general/doors").then((data) => {
|
|
|
|
this.doors.length = 0;
|
2023-09-07 16:44:44 +00:00
|
|
|
|
2023-09-07 17:00:28 +00:00
|
|
|
for (const value of data) {
|
|
|
|
this.doors.push(Door.deserialize(value));
|
|
|
|
}
|
|
|
|
});
|
2023-09-07 16:44:44 +00:00
|
|
|
}
|
|
|
|
|
2023-09-07 15:43:05 +00:00
|
|
|
public save_doors() {
|
2023-09-07 03:30:21 +00:00
|
|
|
const data: DoorSerialized[] = [];
|
|
|
|
|
|
|
|
for (const door of this.doors) {
|
|
|
|
if (door.day === -1) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
data.push(door.serialized);
|
|
|
|
}
|
|
|
|
|
2023-09-07 16:44:44 +00:00
|
|
|
this.$advent22.api_put("/general/doors", data);
|
2023-09-07 03:30:21 +00:00
|
|
|
}
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
</script>
|