[fix] set start date to midnight
This commit is contained in:
parent
8f8eef1784
commit
661685c57a
|
@ -1,3 +1,4 @@
|
||||||
|
node_modules
|
||||||
node_modules/
|
node_modules/
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
# No need, this is done by user
|
# No need, this is done by user
|
||||||
|
|
|
@ -180,9 +180,15 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(template = false) {
|
async function save(template = false) {
|
||||||
|
if (!event.value.is_template && template) event.value.id = NaN;
|
||||||
|
|
||||||
event.value.is_template = template;
|
event.value.is_template = template;
|
||||||
try {
|
try {
|
||||||
|
if (!isNaN(event.value.id)) {
|
||||||
|
//fix
|
||||||
|
}
|
||||||
await store.addEvent(event.value);
|
await store.addEvent(event.value);
|
||||||
|
|
||||||
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const options: ModifyDateOptions = {};
|
const options: ModifyDateOptions = {};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<q-card>
|
<q-card>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="col" align="right" style="position: sticky; top: 0; z-index: 999">
|
<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>
|
||||||
<div class="col" style="margin: 0; padding: 0; margin-top: -2.4em">
|
<div class="col" style="margin: 0; padding: 0; margin-top: -2.4em">
|
||||||
<edit-event v-model="editor" @done="editDone" />
|
<edit-event v-model="editor" @done="editDone" />
|
||||||
|
@ -158,7 +158,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadAgendas() {
|
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 start = calendarRealView.value === 'day' ? selected : startOfWeek(selected);
|
||||||
const end = date.addToDate(start, { days: calendarDays.value });
|
const end = date.addToDate(start, { days: calendarDays.value });
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
import { defineComponent, computed, PropType } from 'vue';
|
import { defineComponent, computed, PropType } from 'vue';
|
||||||
import { hasPermission } from '@flaschengeist/api';
|
import { hasPermission } from '@flaschengeist/api';
|
||||||
import { PERMISSIONS } from '../../../permissions';
|
import { PERMISSIONS } from '../../../permissions';
|
||||||
|
import { date } from 'quasar';
|
||||||
import JobSlot from './JobSlot.vue';
|
import JobSlot from './JobSlot.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -72,8 +73,10 @@ export default defineComponent({
|
||||||
const canEdit = computed(
|
const canEdit = computed(
|
||||||
() =>
|
() =>
|
||||||
hasPermission(PERMISSIONS.EDIT) &&
|
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({
|
const event = computed({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (v) => emit('update:modelValue', v),
|
set: (v) => emit('update:modelValue', v),
|
||||||
|
|
14
src/store.ts
14
src/store.ts
|
@ -151,9 +151,17 @@ export const useScheduleStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async addEvent(event: FG.Event) {
|
async addEvent(event: FG.Event) {
|
||||||
const { data } = await api.post<FG.Event>('/events', event);
|
if (isNaN(event.id)) {
|
||||||
if (data.is_template) this.templates.push(data);
|
const { data } = await api.post<FG.Event>('/events', event);
|
||||||
return data;
|
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