show door number in ConfigView

This commit is contained in:
Jörn-Michael Miehe 2023-09-26 22:23:43 +00:00
parent 1d760f91db
commit 3a3dfcd94d

View file

@ -52,13 +52,12 @@
<dt>Hintergrundbild</dt> <dt>Hintergrundbild</dt>
<dd>{{ config_model.calendar.background }}</dd> <dd>{{ config_model.calendar.background }}</dd>
<dt>Türchen</dt> <dt>Türchen ({{ doors.length }} Stück)</dt>
<dd> <dd>
<template v-for="(part, day) in day_parts" :key="`door-${day}`"> <template v-for="(door, index) in doors" :key="`door-${index}`">
<span> <span>
<template v-if="Number(day) > 1">, </template> <template v-if="door.day > 1">, </template>
<span v-if="part == ''" class="tag is-warning">_</span> {{ door.day }}
<template v-else>{{ part }}</template>
</span> </span>
</template> </template>
</dd> </dd>
@ -125,7 +124,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { ConfigModel, Credentials, DoorsSaved, NumStrDict } from "@/lib/api"; import { ConfigModel, Credentials, DoorsSaved } from "@/lib/api";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { Options, Vue } from "vue-class-component"; import { Options, Vue } from "vue-class-component";
@ -165,7 +164,8 @@ export default class extends Vue {
config_file: "sed diam nonumy", config_file: "sed diam nonumy",
}, },
}; };
public day_parts: NumStrDict = {}; public doors: DoorsSaved = [];
public footer = "";
public num_user_doors = 0; public num_user_doors = 0;
public next_door: number | null = null; public next_door: number | null = null;
public dav_credentials: Credentials = ["", ""]; public dav_credentials: Credentials = ["", ""];
@ -181,14 +181,16 @@ export default class extends Vue {
public on_open(ready: () => void, fail: () => void): void { public on_open(ready: () => void, fail: () => void): void {
Promise.all([ Promise.all([
this.$advent22.api_get<ConfigModel>("admin/config_model"), this.$advent22.api_get<ConfigModel>("admin/config_model"),
this.$advent22.api_get<NumStrDict>("admin/day_parts"), this.$advent22.api_get<DoorsSaved>("admin/doors"),
this.$advent22.api_get<DoorsSaved>("user/doors"), this.$advent22.api_get<DoorsSaved>("user/doors"),
this.$advent22.api_get<string>("user/footer"),
this.$advent22.api_get<number | null>("user/next_door"), this.$advent22.api_get<number | null>("user/next_door"),
]) ])
.then(([config_model, day_parts, user_doors, next_door]) => { .then(([config_model, doors, user_doors, footer, next_door]) => {
this.config_model = config_model; this.config_model = config_model;
this.day_parts = day_parts; this.doors = doors;
this.num_user_doors = user_doors.length; this.num_user_doors = user_doors.length;
this.footer = footer;
this.next_door = next_door; this.next_door = next_door;
ready(); ready();