Skip to content
Snippets Groups Projects
Commit daa9cf4d authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Reformat

parent b89ec95e
No related branches found
No related tags found
1 merge request!1304Refactor calendar overview in more different components
Pipeline #142022 failed
......@@ -132,7 +132,9 @@ export default {
};
},
mergedFetchedDateRanges() {
let sortedRanges = this.fetchedDateRanges.slice().sort((a, b) => new Date(a.start) - new Date(b.start));
let sortedRanges = this.fetchedDateRanges
.slice()
.sort((a, b) => new Date(a.start) - new Date(b.start));
let mergedRanges = [];
......@@ -143,10 +145,15 @@ export default {
let lastMergedRange = mergedRanges[mergedRanges.length - 1];
let currentStartDate = new Date(range.start);
let currentEndDate = new Date(range.end);
let lastMergedEndDate = new Date(new Date(lastMergedRange.end).getTime() + 24 * 60 * 60 * 1000);
let lastMergedEndDate = new Date(
new Date(lastMergedRange.end).getTime() + 24 * 60 * 60 * 1000
);
if (currentStartDate <= lastMergedEndDate) {
lastMergedRange.end = currentEndDate > lastMergedEndDate ? currentEndDate.toISOString().split('T')[0] : lastMergedRange.end;
lastMergedRange.end =
currentEndDate > lastMergedEndDate
? currentEndDate.toISOString().split("T")[0]
: lastMergedRange.end;
} else {
mergedRanges.push(range);
}
......@@ -250,7 +257,10 @@ export default {
const existingStartDate = new Date(existingRange.start);
const existingEndDate = new Date(existingRange.end);
if (newStartDate >= existingStartDate && newEndDate <= existingEndDate) {
if (
newStartDate >= existingStartDate &&
newEndDate <= existingEndDate
) {
return true;
}
}
......@@ -267,14 +277,16 @@ export default {
previousCalendarFeeds.forEach((calendarFeed, i, calendarFeeds) => {
// Get all events except those that are updated
let keepEvents = calendarFeed.events.filter(
(event) => new Date(event.end) < new Date(start) || new Date(event.start) > new Date(end)
(event) =>
new Date(event.end) < new Date(start) ||
new Date(event.start) > new Date(end)
);
/// Update the events of the calendar feed
calendarFeeds[i].events = [
...keepEvents,
...newCalendarFeeds[i].events,
];
];
});
return {
calendar: {
......
<script>
import {defineComponent} from 'vue'
import { defineComponent } from "vue";
import CancelButton from "../buttons/CancelButton.vue";
import PrimaryActionButton from "../buttons/PrimaryActionButton.vue";
export default defineComponent({
name: "ConfirmDialog",
components: {PrimaryActionButton, CancelButton},
components: { PrimaryActionButton, CancelButton },
props: {
value: {
type: Boolean,
......@@ -24,7 +24,7 @@ export default defineComponent({
this.$emit("input", false);
},
},
})
});
</script>
<template>
......@@ -51,6 +51,4 @@ export default defineComponent({
</v-dialog>
</template>
<style scoped>
</style>
<style scoped></style>
......@@ -16,7 +16,12 @@
<v-form v-model="valid">
<v-container>
<v-row>
<v-col cols="12" :sm="field.cols || 6" v-for="field in fields" :key="field.value">
<v-col
cols="12"
:sm="field.cols || 6"
v-for="field in fields"
:key="field.value"
>
<slot
:label="field.text"
:name="field.value + '.field'"
......@@ -230,7 +235,7 @@ export default {
},
resetModel() {
this.itemModel = JSON.parse(
JSON.stringify(this.isCreate ? this.defaultItem : this.editItem)
JSON.stringify(this.isCreate ? this.defaultItem : this.editItem)
);
},
updateModel() {
......
......@@ -39,8 +39,8 @@ export default {
type: String | Number,
required: false,
default: "600px",
}
}
},
},
};
</script>
......
......@@ -27,25 +27,17 @@ const aleksisMixin = {
});
},
$toastError(messageKey, timeout) {
this.$toast(
messageKey || "generic_messages.error",
"error",
timeout,
);
this.$toast(messageKey || "generic_messages.error", "error", timeout);
},
$toastSuccess(messageKey, timeout) {
this.$toast(
messageKey || "generic_messages.success",
"success",
timeout,
)
this.$toast(messageKey || "generic_messages.success", "success", timeout);
},
$toastInfo(messageKey, timeout) {
this.$toast(messageKey, "info", timeout);
},
$toastWarning(messageKey, timeout) {
this.$toast(messageKey, "warning", timeout);
}
},
},
mounted() {
this.$emit("mounted");
......
......@@ -75,7 +75,9 @@ AleksisVue.install = function (Vue) {
import("../components/generic/ButtonMenu.vue")
);
Vue.component("ErrorPage", () => import("../components/app/ErrorPage.vue"));
Vue.component("CalendarWithControls", () => import("../components/calendar/CalendarWithControls.vue"));
Vue.component("CalendarWithControls", () =>
import("../components/calendar/CalendarWithControls.vue")
);
};
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment