<script setup lang="ts">
import { SessionUser } from '@/components/session/token/SessionUser.vue';
import TimeBookingsNewSummaryLine
  from "@/views/dashboards/departmentDashboard/modules/time-bookings/book/displays/TimeBookingsNewSummaryLine.vue";
import { timeBookingsNewProcess } from "@/views/dashboards/departmentDashboard/modules/time-bookings/book/TimeBookingsNewProcess.vue";
import {ref, computed} from "vue";

</script>

<template>
  <div>
    <label class="label">{{ SessionUser.objects.global.language.summary }}</label>
    <!-- Phone number summary line -->
    <TimeBookingsNewSummaryLine label="Telefonnummer" :value="`${timeBookingsNewProcess.phone_country_code.value} ${timeBookingsNewProcess.phone.value}`"/>
    <!-- Registration number summary line -->
    <TimeBookingsNewSummaryLine label="Registreringsnummer" :value="timeBookingsNewProcess.reg_1.value"/>
    <!-- Primary vehicle type summary line -->
    <TimeBookingsNewSummaryLine
        v-if="timeBookingsNewProcess.vehicleTypeObject.value"
        label="Primær køretøjstype"
        v-bind:value="timeBookingsNewProcess.vehicleTypeObject.value ? timeBookingsNewProcess.vehicleTypeObject.value.label : 'Ikke valgt'"
      />
    <!-- Department summary line -->
    <TimeBookingsNewSummaryLine
        v-if="timeBookingsNewProcess.department.value && timeBookingsNewProcess.departmentObject.value && timeBookingsNewProcess.departmentObject.value.label"
        label="Afdeling"
        v-bind:value="timeBookingsNewProcess.departmentObject.value.label"
    />
    <!-- Time slot summary line: Date -->
    <TimeBookingsNewSummaryLine
        v-if="timeBookingsNewProcess.time_slot.value"
        label="Dato"
        v-bind:value="timeBookingsNewProcess.time_slot.value ? SessionUser.functions.date.toWords(timeBookingsNewProcess.time_slot.value.date) : 'Ikke valgt'"
        />
    <!-- Time slot summary line: Start time -->
    <TimeBookingsNewSummaryLine
        v-if="timeBookingsNewProcess.time_slot.value"
        label="Starttidspunkt"
        v-bind:value="timeBookingsNewProcess.time_slot.value ? SessionUser.functions.date.toLocalTimeHours(timeBookingsNewProcess.time_slot.value.date) : 'Ikke valgt'"
    />
    <!-- Price summary line -->
    <TimeBookingsNewSummaryLine
        v-if="timeBookingsNewProcess.vehicleTypeObject.value"
        v-bind:label="timeBookingsNewProcess.vehicleTypeObject.value ? timeBookingsNewProcess.vehicleTypeObject.value.label : 'Ikke valgt'"
        v-bind:value="timeBookingsNewProcess.vehicleTypeObject.value ? SessionUser.functions.currency.toLocal(timeBookingsNewProcess.vehicleTypeObject.value.price) : 'Ikke valgt'"
        color="is-success"
    />
    <!-- Addons summary line -->
    <template v-for="addon in timeBookingsNewProcess.addonObjects.value" :key="addon.id">
      <TimeBookingsNewSummaryLine
        :label="addon.name"
        v-bind:value="SessionUser.functions.currency.toLocal(addon.product.price)"
        icon="fas fa-plus"
        color="is-info"
      />
    </template>
  </div>
</template>

<style scoped>

</style>