<template>
  <div class="card-content">
    <div class="content">
      <h3>Steuerung</h3>
      <ul>
        <li>Linksklick: Türchen bearbeiten</li>
        <li>Tastatur: Tag eingeben</li>
        <li>[Enter]: Tag speichern</li>
        <li>[Esc]: Eingabe Abbrechen</li>
        <li>[Entf]: Tag entfernen</li>
      </ul>
    </div>
    <figure class="image is-unselectable">
      <img :src="$advent22.api_url('general/background')" />
      <ThouCanvas>
        <PreviewDoor
          v-for="(_, index) in doors"
          :key="`door-${index}`"
          v-model:door="doors[index]"
        />
      </ThouCanvas>
    </figure>
  </div>
</template>

<script lang="ts">
import { Door } from "@/lib/door";
import { Options, Vue } from "vue-class-component";

import ThouCanvas from "../calendar/ThouCanvas.vue";
import PreviewDoor from "./PreviewDoor.vue";

@Options({
  components: {
    ThouCanvas,
    PreviewDoor,
  },
  props: {
    doors: Array,
  },
  emits: ["update:doors"],
})
export default class extends Vue {
  public doors!: Door[];

  public beforeUnmount() {
    this.$emit("update:doors", this.doors);
  }
}
</script>
