Fix #144
This commit is contained in:
@@ -141,8 +141,21 @@ const getCalendarValue = (value) => {
|
||||
return formatted ? parseDate(formatted) : undefined
|
||||
}
|
||||
|
||||
const syncDeliveryDateEndWithStart = () => {
|
||||
if (!['Lieferzeitraum', 'Leistungszeitraum'].includes(itemInfo.value.deliveryDateType)) return
|
||||
if (!itemInfo.value.deliveryDate) return
|
||||
|
||||
if (!itemInfo.value.deliveryDateEnd || dayjs(itemInfo.value.deliveryDateEnd).isBefore(dayjs(itemInfo.value.deliveryDate), 'day')) {
|
||||
itemInfo.value.deliveryDateEnd = dayjs(itemInfo.value.deliveryDate).toDate()
|
||||
}
|
||||
}
|
||||
|
||||
const setCalendarField = (field, value) => {
|
||||
itemInfo.value[field] = value ? dayjs(value.toString()).toDate() : null
|
||||
|
||||
if (field === 'deliveryDate') {
|
||||
syncDeliveryDateEndWithStart()
|
||||
}
|
||||
}
|
||||
|
||||
const setSerialCalendarField = (field, value) => {
|
||||
@@ -152,12 +165,20 @@ const setSerialCalendarField = (field, value) => {
|
||||
const getDateButtonLabel = (value) => value ? dayjs(value).format('DD.MM.YYYY') : 'Datum auswählen'
|
||||
const setCalendarFieldToToday = (field) => {
|
||||
itemInfo.value[field] = dayjs().toDate()
|
||||
|
||||
if (field === 'deliveryDate') {
|
||||
syncDeliveryDateEndWithStart()
|
||||
}
|
||||
}
|
||||
|
||||
const setSerialCalendarFieldToToday = (field) => {
|
||||
itemInfo.value.serialConfig[field] = dayjs().toDate()
|
||||
}
|
||||
|
||||
watch(() => itemInfo.value.deliveryDateType, () => {
|
||||
syncDeliveryDateEndWithStart()
|
||||
})
|
||||
|
||||
const setupData = async () => {
|
||||
letterheads.value = (await useEntities("letterheads").select("*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
||||
createddocuments.value = await useEntities("createddocuments").select("*")
|
||||
|
||||
Reference in New Issue
Block a user