From fcae78f4277c865cb636d4cadedfb3fd79c83142 Mon Sep 17 00:00:00 2001 From: lesion Date: Tue, 30 Aug 2022 11:51:58 +0200 Subject: [PATCH] fix due hour selection when event ends on next day --- components/DateInput.vue | 93 ++++++++++++++++++++++------------------ pages/add/_edit.vue | 34 +++++++-------- 2 files changed, 68 insertions(+), 59 deletions(-) diff --git a/components/DateInput.vue b/components/DateInput.vue index 2373a3cb..f03279ba 100644 --- a/components/DateInput.vue +++ b/components/DateInput.vue @@ -2,19 +2,18 @@ v-col(cols=12) .text-center v-btn-toggle.v-col-6.flex-column.flex-sm-row(v-model='type' color='primary' @change='type => change("type", type)') - v-btn(value='normal' label="normal") {{$t('event.normal')}} - v-btn(value='multidate' label='multidate') {{$t('event.multidate')}} - v-btn(v-if='settings.allow_recurrent_event' value='recurrent' label="recurrent") {{$t('event.recurrent')}} + v-btn(value='normal' label="normal") {{ $t('event.normal') }} + v-btn(value='multidate' label='multidate') {{ $t('event.multidate') }} + v-btn(v-if='settings.allow_recurrent_event' value='recurrent' label="recurrent") {{ $t('event.recurrent') }} - p {{$t(`event.${type}_description`)}} + p {{ $t(`event.${type}_description`) }} v-btn-toggle.v-col-6.flex-column.flex-sm-row(v-if='type === "recurrent"' color='primary' :value='value.recurrent.frequency' @change='fq => change("frequency", fq)') - v-btn(v-for='f in frequencies' :key='f.value' :value='f.value') {{f.text}} + v-btn(v-for='f in frequencies' :key='f.value' :value='f.value') {{ f.text }} client-only .datePicker.mt-3 - v-input(:value='fromDate' - :rules="[$validators.required('common.when')]") + v-input(:value='fromDate' :rules="[$validators.required('common.when')]") vc-date-picker( v-model='fromDate' :is-range='type === "multidate"' @@ -28,9 +27,9 @@ v-col(cols=12) :min-date='type !== "recurrent" && new Date()') div.text-center.mb-2(v-if='type === "recurrent"') - span(v-if='value.recurrent.frequency !== "1m" && value.recurrent.frequency !== "2m"') {{whenPatterns}} + span(v-if='value.recurrent.frequency !== "1m" && value.recurrent.frequency !== "2m"') {{ whenPatterns }} v-btn-toggle.mt-1.flex-column.flex-sm-row(v-else :value='value.recurrent.type' color='primary' @change='fq => change("recurrentType", fq)') - v-btn(v-for='whenPattern in whenPatterns' :value='whenPattern.key' :key='whenPatterns.key' small) {{whenPattern.label}} + v-btn(v-for='whenPattern in whenPatterns' :value='whenPattern.key' :key='whenPatterns.key' small) {{ whenPattern.label }} v-row.mt-3.col-md-6.mx-auto v-col.col-12.col-sm-6 @@ -42,6 +41,9 @@ v-col(cols=12) transition="scale-transition") template(v-slot:activator="{ on, attrs }") v-text-field( + clearable + :clear-icon='mdiClose' + @click:clear='() => change("fromHour")' :label="$t('event.from')" :value="fromHour" :disabled='!value.from' @@ -55,7 +57,7 @@ v-col(cols=12) v-model="fromHour" :allowedMinutes='allowedMinutes' format='24hr' - @click:minute='menuFromHour=false' + @click:minute='menuFromHour = false' @change='hr => change("fromHour", hr)') @@ -68,6 +70,9 @@ v-col(cols=12) transition="scale-transition") template(v-slot:activator="{ on, attrs }") v-text-field( + clearable + :clear-icon='mdiClose' + @click:clear='() => change("dueHour")' :label="$t('event.due')" :value="dueHour" :disabled='!fromHour' @@ -80,10 +85,10 @@ v-col(cols=12) v-model="dueHour" :allowedMinutes='allowedMinutes' format='24hr' - @click:minute='menuDueHour=false' + @click:minute='menuDueHour = false' @change='hr => change("dueHour", hr)') - List(v-if='type==="normal" && todayEvents.length' :events='todayEvents' :title='$t("event.same_day")') + List(v-if='type === "normal" && todayEvents.length' :events='todayEvents' :title='$t("event.same_day")')