Changed layout for Vendors

This commit is contained in:
2024-05-01 09:52:33 +02:00
parent 7a337482d4
commit 86cd55102c
2 changed files with 83 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
<script setup> <script setup>
import HistoryDisplay from "~/components/HistoryDisplay.vue"; import HistoryDisplay from "~/components/HistoryDisplay.vue";
import dayjs from "dayjs";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
@@ -18,7 +19,7 @@ const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
name: "", name: "",
customer: null, customer: null,
active: true active: true,
}) })
//Functions //Functions
@@ -157,6 +158,7 @@ setupPage()
option-attribute="name" option-attribute="name"
value-attribute="id" value-attribute="id"
:options="dataStore.customers" :options="dataStore.customers"
@change="itemInfo.contact = null"
searchable searchable
:search-attributes="['name']" :search-attributes="['name']"
> >
@@ -165,6 +167,23 @@ setupPage()
</template> </template>
</USelectMenu> </USelectMenu>
</UFormGroup> </UFormGroup>
<UFormGroup
label="Ansprechpartner:"
v-if="itemInfo.customer"
>
<USelectMenu
v-model="itemInfo.contact"
option-attribute="fullName"
value-attribute="id"
:options="dataStore.getContactsByCustomerId(itemInfo.customer)"
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Ansprechpartner ausgewählt" }}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup <UFormGroup
label="Vertrag aktiv:" label="Vertrag aktiv:"
@@ -174,10 +193,70 @@ setupPage()
/> />
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
label="Beschreibung:" label="Vertragsstart:"
class="mt-2"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.startDate ? dayjs(itemInfo.startDate).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.startDate" @close="close" />
</template>
</UPopover>
</UFormGroup>
<UFormGroup
label="Vertragsende(voraussichtlich):"
class="mt-2"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.endDate ? dayjs(itemInfo.endDate).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.endDate" @close="close" />
</template>
</UPopover>
</UFormGroup>
<UFormGroup
label="mindest Vertragslaufzeit:"
>
<USelectMenu
:options="['12 Monate','24 Monate','36 Monate','48 Monate']"
v-model="itemInfo.duration"
/>
</UFormGroup>
<UFormGroup
label="Datum der Unterzeichnung:"
class="mt-2"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.signDate ? dayjs(itemInfo.signDate).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.signDate" @close="close" />
</template>
</UPopover>
</UFormGroup>
<UFormGroup
label="Notizen:"
> >
<UTextarea <UTextarea
v-model="itemInfo.description" v-model="itemInfo.notes"
rows="6"
maxrows="12"
/> />
</UFormGroup> </UFormGroup>
</UForm> </UForm>

View File

@@ -33,7 +33,7 @@ const setupPage = async () => {
} }
if(mode.value === "edit") itemInfo.value = currentItem.value if(mode.value === "edit") itemInfo.value = currentItem.value
if(currentItem.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(currentItem.value)) if(currentItem.value) oldItemInfo.value = JSON.parse(JSON.stringify(currentItem.value))
} }
const editItem = async () => { const editItem = async () => {