Zwischenstand
This commit is contained in:
@@ -116,7 +116,7 @@ async function onSubmit(event: FormSubmitEvent<any>) {
|
||||
emit('saved')
|
||||
isOpen.value = false
|
||||
} catch (error: any) {
|
||||
toast.add({ title: 'Fehler', description: error.message, color: 'red' })
|
||||
toast.add({ title: 'Fehler', description: error.message, color: 'error' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -125,56 +125,62 @@ async function onSubmit(event: FormSubmitEvent<any>) {
|
||||
|
||||
<template>
|
||||
<UModal v-model:open="isOpen">
|
||||
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||
{{ entry ? 'Eintrag bearbeiten' : 'Neue Zeit erfassen' }}
|
||||
</h3>
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="isOpen = false" />
|
||||
</div>
|
||||
</template>
|
||||
<template #content>
|
||||
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||
{{ entry ? 'Eintrag bearbeiten' : 'Neue Zeit erfassen' }}
|
||||
</h3>
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="isOpen = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit">
|
||||
<UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit">
|
||||
<UFormField label="Typ" name="type">
|
||||
<USelectMenu
|
||||
v-model="state.type"
|
||||
:items="types"
|
||||
value-key="value"
|
||||
label-key="label"
|
||||
/>
|
||||
</UFormField>
|
||||
|
||||
<UFormGroup label="Typ" name="type">
|
||||
<USelectMenu v-model="state.type" :options="types" value-attribute="value" option-attribute="label" />
|
||||
</UFormGroup>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormField label="Start Datum" name="start_date">
|
||||
<div class="flex items-center gap-2">
|
||||
<UInput type="date" v-model="state.start_date" class="flex-1" />
|
||||
<UButton color="gray" variant="soft" label="Heute" @click="setDateFieldToToday('start_date')" />
|
||||
</div>
|
||||
</UFormField>
|
||||
<UFormField label="Start Zeit" name="start_time">
|
||||
<UInput type="time" v-model="state.start_time" />
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormGroup label="Start Datum" name="start_date">
|
||||
<div class="flex items-center gap-2">
|
||||
<UInput type="date" v-model="state.start_date" class="flex-1" />
|
||||
<UButton color="gray" variant="soft" label="Heute" @click="setDateFieldToToday('start_date')" />
|
||||
</div>
|
||||
</UFormGroup>
|
||||
<UFormGroup label="Start Zeit" name="start_time">
|
||||
<UInput type="time" v-model="state.start_time" />
|
||||
</UFormGroup>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormField label="Ende Datum" name="end_date">
|
||||
<div class="flex items-center gap-2">
|
||||
<UInput type="date" v-model="state.end_date" class="flex-1" />
|
||||
<UButton color="gray" variant="soft" label="Heute" @click="setDateFieldToToday('end_date')" />
|
||||
</div>
|
||||
</UFormField>
|
||||
<UFormField label="Ende Zeit" name="end_time">
|
||||
<UInput type="time" v-model="state.end_time" />
|
||||
</UFormField>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 -mt-2">Leer lassen, wenn die Zeit noch läuft.</p>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormGroup label="Ende Datum" name="end_date">
|
||||
<div class="flex items-center gap-2">
|
||||
<UInput type="date" v-model="state.end_date" class="flex-1" />
|
||||
<UButton color="gray" variant="soft" label="Heute" @click="setDateFieldToToday('end_date')" />
|
||||
</div>
|
||||
</UFormGroup>
|
||||
<UFormGroup label="Ende Zeit" name="end_time">
|
||||
<UInput type="time" v-model="state.end_time" />
|
||||
</UFormGroup>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 -mt-2">Leer lassen, wenn die Zeit noch läuft.</p>
|
||||
<UFormField label="Beschreibung / Notiz" name="description">
|
||||
<UTextarea v-model="state.description" placeholder="Was wurde gemacht?" />
|
||||
</UFormField>
|
||||
|
||||
<UFormGroup label="Beschreibung / Notiz" name="description">
|
||||
<UTextarea v-model="state.description" placeholder="Was wurde gemacht?" />
|
||||
</UFormGroup>
|
||||
|
||||
<div class="flex justify-end gap-2 pt-4">
|
||||
<UButton label="Abbrechen" color="gray" variant="ghost" @click="isOpen = false" />
|
||||
<UButton type="submit" label="Speichern" color="primary" :loading="loading" />
|
||||
</div>
|
||||
</UForm>
|
||||
</UCard>
|
||||
<div class="flex justify-end gap-2 pt-4">
|
||||
<UButton label="Abbrechen" color="gray" variant="ghost" @click="isOpen = false" />
|
||||
<UButton type="submit" label="Speichern" color="primary" :loading="loading" />
|
||||
</div>
|
||||
</UForm>
|
||||
</UCard>
|
||||
</template>
|
||||
</UModal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user