[fix] set start date to midnight
This commit is contained in:
parent
8f8eef1784
commit
661685c57a
|
@ -1,3 +1,4 @@
|
|||
node_modules
|
||||
node_modules/
|
||||
yarn-error.log
|
||||
# No need, this is done by user
|
||||
|
|
|
@ -180,9 +180,15 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
async function save(template = false) {
|
||||
if (!event.value.is_template && template) event.value.id = NaN;
|
||||
|
||||
event.value.is_template = template;
|
||||
try {
|
||||
if (!isNaN(event.value.id)) {
|
||||
//fix
|
||||
}
|
||||
await store.addEvent(event.value);
|
||||
|
||||
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
||||
let count = 0;
|
||||
const options: ModifyDateOptions = {};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<q-card>
|
||||
<div class="column">
|
||||
<div class="col" align="right" style="position: sticky; top: 0; z-index: 999">
|
||||
<q-btn round color="negative" icon="close" dense rounded @click="editDone(false)" />
|
||||
<q-btn round color="negative" icon="mdi-close" dense rounded @click="editDone(false)" />
|
||||
</div>
|
||||
<div class="col" style="margin: 0; padding: 0; margin-top: -2.4em">
|
||||
<edit-event v-model="editor" @done="editDone" />
|
||||
|
@ -158,7 +158,7 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
async function loadAgendas() {
|
||||
const selected = date.adjustDate(new Date(selectedDate.value), {milliseconds: 0, seconds: 0, minutes: 0, hours: 0});
|
||||
const selected = date.adjustDate(selectedDate.value, {milliseconds: 0, seconds: 0, minutes: 0, hours: 0});
|
||||
const start = calendarRealView.value === 'day' ? selected : startOfWeek(selected);
|
||||
const end = date.addToDate(start, { days: calendarDays.value });
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
import { defineComponent, computed, PropType } from 'vue';
|
||||
import { hasPermission } from '@flaschengeist/api';
|
||||
import { PERMISSIONS } from '../../../permissions';
|
||||
import { date } from 'quasar';
|
||||
import JobSlot from './JobSlot.vue';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -72,8 +73,10 @@ export default defineComponent({
|
|||
const canEdit = computed(
|
||||
() =>
|
||||
hasPermission(PERMISSIONS.EDIT) &&
|
||||
(props.modelValue?.end || props.modelValue.start) > new Date()
|
||||
(props.modelValue?.end || props.modelValue.start) >=
|
||||
date.buildDate({ hours: 0, minutes: 0, seconds: 0, milliseconds: 0 })
|
||||
);
|
||||
|
||||
const event = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (v) => emit('update:modelValue', v),
|
||||
|
|
|
@ -151,9 +151,17 @@ export const useScheduleStore = defineStore({
|
|||
},
|
||||
|
||||
async addEvent(event: FG.Event) {
|
||||
if (isNaN(event.id)) {
|
||||
const { data } = await api.post<FG.Event>('/events', event);
|
||||
if (data.is_template) this.templates.push(data);
|
||||
return data;
|
||||
} else {
|
||||
if (typeof event.type === 'object') event.type = event.type.id;
|
||||
|
||||
const { data } = await api.put<FG.Event>(`/events/${event.id}`, Object.assign(event, {jobs: undefined}));
|
||||
if (data.is_template) this.templates.push(data);
|
||||
return data;
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue