This commit is contained in:
2021-09-14 22:23:59 +00:00
parent 9d145ce833
commit a09da8e139
2 changed files with 66 additions and 22 deletions

View File

@@ -71,6 +71,9 @@ TO BE DETERMINED:
//..........
Data Table filter, now impossible to remove a filter because save is blanked out, maybe needs a clear button that does it all? Delete should trigger save too I guess
so maybe save should expose on change, not on presence of filter
Dashboard / widgets
Installer INNO
version with postgres included, version without postgres included

View File

@@ -1,5 +1,6 @@
<template>
<div v-resize="onResize" class="my-n8">
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<v-sheet height="64">
<v-toolbar flat>
<v-btn outlined class="mr-4" color="grey darken-2" @click="setToday">
@@ -222,7 +223,9 @@ export default {
},
rights: window.$gz.role.defaultRightsObject(),
calendarHeight: 600,
settingsDialog: false
settingsDialog: false,
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName()
};
},
mounted() {
@@ -266,37 +269,75 @@ export default {
nativeEvent.stopPropagation();
},
fetchEvents({ start, end }) {
async fetchEvents({ start, end }) {
//NOTE: Need to add six days at least on either side due to calendar potentially showing up to six days of end and start of adjacent months
//maybe easier if server does it and this just sticks to the
console.log(
"UPDATE RANGE:",
JSON.stringify({ start: start.date, end: end.date })
);
const events = [];
/*
public enum PersonalScheduleWorkOrderColorSource : int
{
None = 0,
WorkOrderStatus = 2,
WorkOrderItemStatus = 3,
WorkOrderItemPriority = 4
}
*/
try {
window.$gz.form.deleteAllErrorBoxErrors(this);
const min = new Date(`${start.date}T00:00:00`);
const max = new Date(`${end.date}T23:59:59`);
const days = (max.getTime() - min.getTime()) / 86400000;
const eventCount = this.rnd(days, days + 20);
for (let i = 0; i < eventCount; i++) {
const allDay = this.rnd(0, 3) === 0;
const firstTimestamp = this.rnd(min.getTime(), max.getTime());
const first = new Date(firstTimestamp - (firstTimestamp % 900000));
const secondTimestamp = this.rnd(2, allDay ? 288 : 8) * 900000;
const second = new Date(first.getTime() + secondTimestamp);
events.push({
name: this.names[this.rnd(0, this.names.length - 1)],
start: first,
end: second,
color: this.colors[this.rnd(0, this.colors.length - 1)],
timed: !allDay
let res = await window.$gz.api.post("schedule/personal", {
start: window.$gz.locale.localTimeDateStringToUTC8601String(
`${start.date}T00:00:00`,
this.timeZoneName
),
end: window.$gz.locale.localTimeDateStringToUTC8601String(
`${end.date}T23:59:59`,
this.timeZoneName
),
colorSource: 2,
workOrders: true,
reviews: true,
reminders: true
});
if (res.error) {
this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this);
} else {
this.events = res.data;
}
} catch (error) {
window.$gz.errorHandler.handleFormError(error, this);
}
this.events = events;
// const events = [];
// const min = new Date(`${start.date}T00:00:00`);
// const max = new Date(`${end.date}T23:59:59`);
// const days = (max.getTime() - min.getTime()) / 86400000;
// const eventCount = this.rnd(days, days + 20);
// for (let i = 0; i < eventCount; i++) {
// const allDay = this.rnd(0, 3) === 0;
// const firstTimestamp = this.rnd(min.getTime(), max.getTime());
// const first = new Date(firstTimestamp - (firstTimestamp % 900000));
// const secondTimestamp = this.rnd(2, allDay ? 288 : 8) * 900000;
// const second = new Date(first.getTime() + secondTimestamp);
// events.push({
// name: this.names[this.rnd(0, this.names.length - 1)],
// start: first,
// end: second,
// color: this.colors[this.rnd(0, this.colors.length - 1)],
// timed: !allDay
// });
//}
//this.events = events;
},
rnd(a, b) {
return Math.floor((b - a + 1) * Math.random()) + a;