|
|
@ -79,14 +79,6 @@ const saveCalendarRanges = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// To add new calendar range |
|
|
|
|
|
|
|
const addCalendarRange = async () => { |
|
|
|
|
|
|
|
_calendar_ranges.value.push({ |
|
|
|
|
|
|
|
fk_from_column_id: '', |
|
|
|
|
|
|
|
fk_to_column_id: undefined, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dateFieldOptions = computed<SelectProps['options']>(() => { |
|
|
|
const dateFieldOptions = computed<SelectProps['options']>(() => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
meta.value?.columns |
|
|
|
meta.value?.columns |
|
|
@ -98,6 +90,20 @@ const dateFieldOptions = computed<SelectProps['options']>(() => { |
|
|
|
})) ?? [] |
|
|
|
})) ?? [] |
|
|
|
) |
|
|
|
) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// To add new calendar range |
|
|
|
|
|
|
|
const addCalendarRange = async () => { |
|
|
|
|
|
|
|
_calendar_ranges.value.push({ |
|
|
|
|
|
|
|
fk_from_column_id: dateFieldOptions.value[0], |
|
|
|
|
|
|
|
fk_to_column_id: null, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const removeRange = async (id: number) => { |
|
|
|
|
|
|
|
_calendar_ranges.value = _calendar_ranges.value.filter((_, i) => i !== id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await saveCalendarRanges() |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -113,8 +119,8 @@ const dateFieldOptions = computed<SelectProps['options']>(() => { |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template #overlay> |
|
|
|
<template #overlay> |
|
|
|
<div v-if="calendarRangeDropdown" class="flex flex-col w-full p-6 w-[35rem]" @click.stop> |
|
|
|
<div v-if="calendarRangeDropdown" class="w-full p-6 w-[35rem]" @click.stop> |
|
|
|
<div v-for="(range, id) in _calendar_ranges" :key="id" class="flex w-full gap-2 items-center"> |
|
|
|
<div v-for="(range, id) in _calendar_ranges" :key="id" class="flex w-full gap-2 mb-2 items-center"> |
|
|
|
<span> |
|
|
|
<span> |
|
|
|
{{ $t('labels.organiseBy') }} |
|
|
|
{{ $t('labels.organiseBy') }} |
|
|
|
</span> |
|
|
|
</span> |
|
|
@ -184,7 +190,14 @@ const dateFieldOptions = computed<SelectProps['options']>(() => { |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
<NcButton v-if="id !== 0" size="small" type="secondary" @click="removeRange(id)"> |
|
|
|
|
|
|
|
<component :is="iconMap.close" /> |
|
|
|
|
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<NcButton class="mt-2" size="small" type="secondary" @click="addCalendarRange"> |
|
|
|
|
|
|
|
<component :is="iconMap.plus" /> |
|
|
|
|
|
|
|
Add another date field |
|
|
|
|
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</NcDropdown> |
|
|
|
</NcDropdown> |
|
|
|