This commit is contained in:
@@ -14,10 +14,10 @@ export default {
|
|||||||
// type: "GzDashTestListWidgetsPriciest"
|
// type: "GzDashTestListWidgetsPriciest"
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
id: "TestScheduleableOnly",
|
id: "NextSchedItems",
|
||||||
roles: [role.Tech, role.TechRestricted],
|
roles: [role.Tech, role.TechRestricted],
|
||||||
title: "TEST sched user widget",
|
title: "TEST sched user widget",
|
||||||
type: "NextSchedItem",
|
type: "NextSchedItems",
|
||||||
scheduleableUserOnly: true
|
scheduleableUserOnly: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -408,6 +408,29 @@ export default {
|
|||||||
return dt.toUTC().toString();
|
return dt.toUTC().toString();
|
||||||
},
|
},
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
// UTC ISO 8601 string add arbitrary value based
|
||||||
|
// on luxon duration format
|
||||||
|
// and return as UTC ISO 8601 string
|
||||||
|
//https://moment.github.io/luxon/api-docs/index.html#datetimeplus
|
||||||
|
//
|
||||||
|
addDurationToUTC8601String(val, duration) {
|
||||||
|
if (!val || val == "" || duration == null || !this.isObject(duration)) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
//instantiate a luxon date object from val which is assumed to be an iso string
|
||||||
|
let dt = window.$gz.DateTime.fromISO(val);
|
||||||
|
if (!dt.isValid) {
|
||||||
|
console.error("locale::addDurationToUTC8601String, input not valid:", {
|
||||||
|
val: val,
|
||||||
|
dt: dt
|
||||||
|
});
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
//add minutes
|
||||||
|
dt = dt.plus(duration);
|
||||||
|
return dt.toUTC().toString();
|
||||||
|
},
|
||||||
|
///////////////////////////////////////////////
|
||||||
// parse UTC ISO 8601 strings, diff, return hours
|
// parse UTC ISO 8601 strings, diff, return hours
|
||||||
//
|
//
|
||||||
diffHoursFromUTC8601String(start, stop) {
|
diffHoursFromUTC8601String(start, stop) {
|
||||||
|
|||||||
@@ -120,7 +120,17 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="main"
|
<div v-if="hasError" class="mx-2 mt-4 d-flex align-center">
|
||||||
|
<v-alert
|
||||||
|
data-cy="dash-error"
|
||||||
|
color="error"
|
||||||
|
icon="$ayiExclamationTriangle"
|
||||||
|
class="multi-line"
|
||||||
|
outlined
|
||||||
|
>{{ errorMessage }}</v-alert
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<slot v-if="!hasError" name="main"
|
||||||
><div class="ml-4 mt-1 d-flex align-center">
|
><div class="ml-4 mt-1 d-flex align-center">
|
||||||
<div>
|
<div>
|
||||||
<span class="grey--text"
|
<span class="grey--text"
|
||||||
@@ -151,7 +161,8 @@ export default {
|
|||||||
count: { type: Number, default: 0 },
|
count: { type: Number, default: 0 },
|
||||||
updateFrequency: { type: Number, default: 60000 },
|
updateFrequency: { type: Number, default: 60000 },
|
||||||
maxListItems: { type: Number, default: 10 },
|
maxListItems: { type: Number, default: 10 },
|
||||||
icon: { type: String, default: "$ayiTachometer" }
|
icon: { type: String, default: "$ayiTachometer" },
|
||||||
|
errorMessage: { type: String, default: null }
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -164,6 +175,9 @@ export default {
|
|||||||
},
|
},
|
||||||
translatedTitle() {
|
translatedTitle() {
|
||||||
return this.$ay.t(this.title);
|
return this.$ay.t(this.title);
|
||||||
|
},
|
||||||
|
hasError() {
|
||||||
|
return this.errorMessage != null && this.errorMessage.length > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
:add-url="'widgets/0'"
|
:add-url="'widgets/0'"
|
||||||
:show-more-button="true"
|
:show-more-button="true"
|
||||||
:update-frequency="60000"
|
:update-frequency="60000"
|
||||||
|
:error-message="errorMessage"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@dash-refresh="getDataFromApi()"
|
@dash-refresh="getDataFromApi()"
|
||||||
@dash-more-click="moreClick()"
|
@dash-more-click="moreClick()"
|
||||||
@@ -39,7 +40,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: [],
|
obj: [],
|
||||||
|
errorMessage: null,
|
||||||
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
||||||
languageName: window.$gz.locale.getResolvedLanguage(),
|
languageName: window.$gz.locale.getResolvedLanguage(),
|
||||||
hour12: window.$gz.locale.getHour12(),
|
hour12: window.$gz.locale.getHour12(),
|
||||||
@@ -78,62 +79,58 @@ export default {
|
|||||||
// this.obj = [];
|
// this.obj = [];
|
||||||
// }
|
// }
|
||||||
//========================= commented out for release temporarily =====================
|
//========================= commented out for release temporarily =====================
|
||||||
// try {
|
try {
|
||||||
// window.$gz.form.deleteAllErrorBoxErrors(this);
|
this.errorMessage = null;
|
||||||
// const res = await window.$gz.api.post("schedule/personal", {
|
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
||||||
// view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
|
const res = await window.$gz.api.post("schedule/personal", {
|
||||||
// dark: this.$store.state.darkMode,
|
view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
|
||||||
// start: window.$gz.locale.localTimeDateStringToUTC8601String(
|
dark: this.$store.state.darkMode,
|
||||||
// `${start.date}T00:00:00`,
|
start: now,
|
||||||
// this.timeZoneName
|
end: window.$gz.locale.addDurationToUTC8601String(now, { hours: 24 }),
|
||||||
// ),
|
wisuColorSource: this.formUserOptions.wisuColorSource,
|
||||||
// end: window.$gz.locale.localTimeDateStringToUTC8601String(
|
wisu: this.formUserOptions.wisu, //workorder item scheduled user records
|
||||||
// `${end.date}T23:59:59`,
|
reviews: this.formUserOptions.reviews,
|
||||||
// this.timeZoneName
|
reminders: this.formUserOptions.reminders
|
||||||
// ),
|
});
|
||||||
// wisuColorSource: this.formUserOptions.wisuColorSource,
|
if (res.error) {
|
||||||
// wisu: this.formUserOptions.wisu, //workorder item scheduled user records
|
this.errorMessage = res.error;
|
||||||
// reviews: this.formUserOptions.reviews,
|
} else {
|
||||||
// reminders: this.formUserOptions.reminders
|
this.events.splice(0);
|
||||||
// });
|
const timeZoneName = this.timeZoneName;
|
||||||
// if (res.error) {
|
let i = res.data.length;
|
||||||
// this.formState.serverError = res.error;
|
while (i--) {
|
||||||
// window.$gz.form.setErrorBoxErrors(this);
|
const x = res.data[i];
|
||||||
// } else {
|
this.events.push({
|
||||||
// this.events.splice(0);
|
start: new Date(
|
||||||
// const timeZoneName = this.timeZoneName;
|
new Date(x.start)
|
||||||
// let i = res.data.length;
|
.toLocaleString("sv-SE", {
|
||||||
// while (i--) {
|
timeZone: timeZoneName
|
||||||
// const x = res.data[i];
|
})
|
||||||
// this.events.push({
|
.replace(" ", "T")
|
||||||
// start: new Date(
|
).getTime(),
|
||||||
// new Date(x.start)
|
end: new Date(
|
||||||
// .toLocaleString("sv-SE", {
|
new Date(x.end)
|
||||||
// timeZone: timeZoneName
|
.toLocaleString("sv-SE", {
|
||||||
// })
|
timeZone: timeZoneName
|
||||||
// .replace(" ", "T")
|
})
|
||||||
// ).getTime(),
|
.replace(" ", "T")
|
||||||
// end: new Date(
|
).getTime(),
|
||||||
// new Date(x.end)
|
timed: true,
|
||||||
// .toLocaleString("sv-SE", {
|
name: x.name,
|
||||||
// timeZone: timeZoneName
|
color: x.color,
|
||||||
// })
|
textColor: x.textColor,
|
||||||
// .replace(" ", "T")
|
type: x.type,
|
||||||
// ).getTime(),
|
id: x.id,
|
||||||
// timed: true,
|
editable: x.editable,
|
||||||
// name: x.name,
|
userId: x.userId
|
||||||
// color: x.color,
|
});
|
||||||
// textColor: x.textColor,
|
}
|
||||||
// type: x.type,
|
}
|
||||||
// id: x.id,
|
} catch (error) {
|
||||||
// editable: x.editable,
|
this.errorMessage = error.toString();
|
||||||
// userId: x.userId
|
|
||||||
// });
|
//window.$gz.errorHandler.handleFormError(error, this);
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// window.$gz.errorHandler.handleFormError(error, this);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ import DashRegistry from "../api/dash-registry";
|
|||||||
import GzDashTestBarWidgetCountByUserType from "../components/dash-test-bar-widget-count-by-usertype.vue";
|
import GzDashTestBarWidgetCountByUserType from "../components/dash-test-bar-widget-count-by-usertype.vue";
|
||||||
import GzDashTestLineWidgetMonthlyTotalPrice from "../components/dash-test-line-widget-monthly-total-price.vue";
|
import GzDashTestLineWidgetMonthlyTotalPrice from "../components/dash-test-line-widget-monthly-total-price.vue";
|
||||||
import GzDashTestDayCalendarWidget from "../components/dash-test-day-calendar-widget.vue";
|
import GzDashTestDayCalendarWidget from "../components/dash-test-day-calendar-widget.vue";
|
||||||
import NextSchedItem from "../components/dash-test-day-calendar-widget.vue";
|
import NextSchedItems from "../components/dash-scheduser-next-wo.vue";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
//GzDashTestListWidgetsPriciest,
|
//GzDashTestListWidgetsPriciest,
|
||||||
GzDashTestBarWidgetCountByUserType,
|
GzDashTestBarWidgetCountByUserType,
|
||||||
GzDashTestLineWidgetMonthlyTotalPrice,
|
GzDashTestLineWidgetMonthlyTotalPrice,
|
||||||
GzDashTestDayCalendarWidget,
|
GzDashTestDayCalendarWidget,
|
||||||
NextSchedItem
|
NextSchedItems
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user