Fix #138
This commit is contained in:
@@ -27,6 +27,11 @@ const date = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const selectToday = () => {
|
||||
emit('update:model-value', new Date())
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const attrs = [{
|
||||
key: 'today',
|
||||
highlight: {
|
||||
@@ -37,18 +42,31 @@ const attrs = [{
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCalendarDatePicker
|
||||
show-weeknumbers
|
||||
v-model="date"
|
||||
:mode="props.mode"
|
||||
is24hr
|
||||
transparent
|
||||
borderless
|
||||
color="green"
|
||||
:attributes="attrs"
|
||||
:is-dark="isDark"
|
||||
title-position="left"
|
||||
trim-weeks
|
||||
:first-day-of-week="2"
|
||||
/>
|
||||
</template>
|
||||
<div class="space-y-3">
|
||||
<VCalendarDatePicker
|
||||
show-weeknumbers
|
||||
v-model="date"
|
||||
:mode="props.mode"
|
||||
is24hr
|
||||
transparent
|
||||
borderless
|
||||
color="green"
|
||||
:attributes="attrs"
|
||||
:is-dark="isDark"
|
||||
title-position="left"
|
||||
trim-weeks
|
||||
:first-day-of-week="2"
|
||||
/>
|
||||
|
||||
<div class="flex justify-end px-2 pb-2">
|
||||
<UButton
|
||||
size="xs"
|
||||
color="gray"
|
||||
variant="soft"
|
||||
icon="i-heroicons-calendar-days"
|
||||
label="Heute"
|
||||
@click="selectToday"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -102,6 +102,10 @@ const currentUnit = computed(() => {
|
||||
const selectedService = data.value.services?.find(s => s.id === form.value.service)
|
||||
return selectedService?.unitSymbol || data.value?.units?.[0]?.symbol || 'h'
|
||||
})
|
||||
|
||||
const setDeliveryDateToToday = () => {
|
||||
form.value.deliveryDate = dayjs().format('YYYY-MM-DD')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -120,12 +124,16 @@ const currentUnit = computed(() => {
|
||||
:error="errors.deliveryDate"
|
||||
required
|
||||
>
|
||||
<UInput
|
||||
v-model="form.deliveryDate"
|
||||
type="date"
|
||||
size="lg"
|
||||
icon="i-heroicons-calendar-days"
|
||||
/>
|
||||
<div class="flex items-center gap-2">
|
||||
<UInput
|
||||
v-model="form.deliveryDate"
|
||||
type="date"
|
||||
size="lg"
|
||||
icon="i-heroicons-calendar-days"
|
||||
class="flex-1"
|
||||
/>
|
||||
<UButton color="gray" variant="soft" size="lg" label="Heute" @click="setDeliveryDateToToday" />
|
||||
</div>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
@@ -226,4 +234,4 @@ const currentUnit = computed(() => {
|
||||
/>
|
||||
</template>
|
||||
</UCard>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -50,6 +50,9 @@ const isOpen = computed({
|
||||
|
||||
const toDateStr = (dateStr: string) => dateStr ? $dayjs(dateStr).format('YYYY-MM-DD') : ''
|
||||
const toTimeStr = (dateStr: string) => dateStr ? $dayjs(dateStr).format('HH:mm') : ''
|
||||
const setDateFieldToToday = (field: 'start_date' | 'end_date') => {
|
||||
state[field] = $dayjs().format('YYYY-MM-DD')
|
||||
}
|
||||
|
||||
watch(() => props.entry, (newVal) => {
|
||||
if (newVal) {
|
||||
@@ -140,7 +143,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormGroup label="Start Datum" name="start_date">
|
||||
<UInput type="date" v-model="state.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" />
|
||||
@@ -149,7 +155,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<UFormGroup label="Ende Datum" name="end_date">
|
||||
<UInput type="date" v-model="state.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" />
|
||||
@@ -168,4 +177,4 @@ async function onSubmit(event: FormSubmitEvent<any>) {
|
||||
</UForm>
|
||||
</UCard>
|
||||
</UModal>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user