This commit is contained in:
@@ -16,7 +16,7 @@ export default {
|
|||||||
{
|
{
|
||||||
id: "NextSchedItems",
|
id: "NextSchedItems",
|
||||||
roles: [role.Tech, role.TechRestricted],
|
roles: [role.Tech, role.TechRestricted],
|
||||||
title: "TEST sched user widget",
|
title: "DashboardScheduled",
|
||||||
type: "NextSchedItems",
|
type: "NextSchedItems",
|
||||||
scheduleableUserOnly: true
|
scheduleableUserOnly: true
|
||||||
},
|
},
|
||||||
@@ -74,5 +74,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
},
|
||||||
|
async cacheTranslationsForAvailableItems() {
|
||||||
|
const items = this.availableItems();
|
||||||
|
await window.$gz.translation.cacheTranslations(items.map(z => z.title));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -414,7 +414,12 @@ export default {
|
|||||||
//https://moment.github.io/luxon/api-docs/index.html#datetimeplus
|
//https://moment.github.io/luxon/api-docs/index.html#datetimeplus
|
||||||
//
|
//
|
||||||
addDurationToUTC8601String(val, duration) {
|
addDurationToUTC8601String(val, duration) {
|
||||||
if (!val || val == "" || duration == null || !this.isObject(duration)) {
|
if (
|
||||||
|
!val ||
|
||||||
|
val == "" ||
|
||||||
|
duration == null ||
|
||||||
|
!typeof duration === "object"
|
||||||
|
) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
//instantiate a luxon date object from val which is assumed to be an iso string
|
//instantiate a luxon date object from val which is assumed to be an iso string
|
||||||
|
|||||||
@@ -1,33 +1,48 @@
|
|||||||
<template>
|
<template>
|
||||||
<gz-dash
|
<gz-dash
|
||||||
icon="$ayiSplotch"
|
icon="$ayiUserClock"
|
||||||
:add-url="'widgets/0'"
|
:add-url="'svc-workorders/0'"
|
||||||
:show-more-button="true"
|
:show-more-button="false"
|
||||||
:update-frequency="60000"
|
:update-frequency="60000"
|
||||||
:error-message="errorMessage"
|
:error-message="errorMessage"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@dash-refresh="getDataFromApi()"
|
@dash-refresh="getDataFromApi()"
|
||||||
@dash-more-click="moreClick()"
|
|
||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
>
|
>
|
||||||
<template slot="main">
|
<template slot="main">
|
||||||
<div class="ml-4 mt-1">
|
<v-calendar
|
||||||
<template v-for="(item, i) in obj"
|
color="primary"
|
||||||
><span :key="i"
|
type="day"
|
||||||
>{{ localizedCurrency(item[1].v)
|
hide-header
|
||||||
}}<span class="ml-2"
|
interval-height="36"
|
||||||
><a :href="'/widgets/' + item[0].i"> {{ item[0].v }}</a>
|
:interval-count="intervalCount"
|
||||||
<br /></span></span
|
:first-time="startAt"
|
||||||
></template>
|
:events="events"
|
||||||
</div>
|
:event-color="getEventColor"
|
||||||
|
:locale="languageName"
|
||||||
|
@click:event="showEvent"
|
||||||
|
>
|
||||||
|
<template v-slot:event="{ event, eventSummary }">
|
||||||
|
<div>
|
||||||
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
|
<span
|
||||||
|
:class="event.textColor + '--text'"
|
||||||
|
v-html="eventSummary()"
|
||||||
|
/><v-icon
|
||||||
|
v-if="!event.editable"
|
||||||
|
x-small
|
||||||
|
:color="event.textColor"
|
||||||
|
class="ml-n3"
|
||||||
|
>
|
||||||
|
$ayiLock</v-icon
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</v-calendar>
|
||||||
</template>
|
</template>
|
||||||
</gz-dash>
|
</gz-dash>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
/*
|
|
||||||
TODO: LINK TO LIST FROM HERE, GRID VIEW PREFILTERED AND SORTED
|
|
||||||
|
|
||||||
*/
|
|
||||||
import GzDash from "../components/dash-base.vue";
|
import GzDash from "../components/dash-base.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -40,57 +55,58 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: [],
|
obj: [],
|
||||||
|
initialized: false,
|
||||||
|
events: [],
|
||||||
errorMessage: null,
|
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(),
|
||||||
formUserOptions: {}
|
formUserOptions: {},
|
||||||
|
startAt: "00:00",
|
||||||
|
intervalCount: 24
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
async created() {
|
|
||||||
await getFormUserOptions(this);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
moreClick() {
|
getEventColor(event) {
|
||||||
// const LIST_FORM_KEY = "widget-list";
|
return event.color;
|
||||||
// //get current settings for the form
|
|
||||||
// const formSettings = window.$gz.form.getFormSettings(LIST_FORM_KEY);
|
|
||||||
// //switch to an unsaved listview and substitute this dash widgets list view criteria
|
|
||||||
// formSettings.temp.page = 0;
|
|
||||||
// formSettings.saved.dataTable.listViewId = -1;
|
|
||||||
// formSettings.saved.dataTable.unsavedListView = LIST_VIEW.listView;
|
|
||||||
// //save back again
|
|
||||||
// window.$gz.form.setFormSettings(LIST_FORM_KEY, formSettings);
|
|
||||||
// //now navigate to the data table list view
|
|
||||||
// this.$router.push({
|
|
||||||
// name: "widget-list"
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
|
showEvent({ nativeEvent, event }) {
|
||||||
|
nativeEvent.stopPropagation();
|
||||||
|
|
||||||
|
window.$gz.eventBus.$emit("openobject", {
|
||||||
|
type: event.type,
|
||||||
|
id: event.id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
async getDataFromApi() {
|
async getDataFromApi() {
|
||||||
//http://localhost:7575/api/v8.0/schedule/personal
|
//because dash base calls refresh before created can fire here
|
||||||
//{"view":1,"dark":false,"start":"2022-02-21T08:00:00.000Z","end":"2022-02-22T07:59:59.000Z","wisuColorSource":"2","wisu":true,"reviews":true,"reminders":true}
|
//need to init this way instead
|
||||||
// const lv = LIST_VIEW;
|
if (!this.initialized) {
|
||||||
// lv.limit = this.maxListItems;
|
await initialize(this);
|
||||||
// const res = await window.$gz.api.post("data-list", lv);
|
}
|
||||||
// if (!res.error) {
|
let hour = new Date().getHours() - 1;
|
||||||
// this.obj = res.data;
|
if (hour < 0) {
|
||||||
// } else {
|
hour = 0;
|
||||||
// this.obj = [];
|
}
|
||||||
// }
|
|
||||||
//========================= commented out for release temporarily =====================
|
this.startAt = `${hour}:00`;
|
||||||
|
this.intervalCount = 24 - hour;
|
||||||
try {
|
try {
|
||||||
this.errorMessage = null;
|
this.errorMessage = null;
|
||||||
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
||||||
const res = await window.$gz.api.post("schedule/personal", {
|
const res = await window.$gz.api.post("schedule/personal", {
|
||||||
view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
|
view: 1,
|
||||||
dark: this.$store.state.darkMode,
|
dark: this.$store.state.darkMode,
|
||||||
start: now,
|
start: window.$gz.locale.addDurationToUTC8601String(now, {
|
||||||
|
hours: -24
|
||||||
|
}),
|
||||||
end: window.$gz.locale.addDurationToUTC8601String(now, { hours: 24 }),
|
end: window.$gz.locale.addDurationToUTC8601String(now, { hours: 24 }),
|
||||||
wisuColorSource: this.formUserOptions.wisuColorSource,
|
wisuColorSource: this.formUserOptions.wisuColorSource,
|
||||||
wisu: this.formUserOptions.wisu, //workorder item scheduled user records
|
wisu: true, //workorder item scheduled user records
|
||||||
reviews: this.formUserOptions.reviews,
|
reviews: false,
|
||||||
reminders: this.formUserOptions.reminders
|
reminders: false
|
||||||
});
|
});
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
this.errorMessage = res.error;
|
this.errorMessage = res.error;
|
||||||
@@ -128,13 +144,17 @@ export default {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.errorMessage = error.toString();
|
this.errorMessage = error.toString();
|
||||||
|
|
||||||
//window.$gz.errorHandler.handleFormError(error, this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function initialize(vm) {
|
||||||
|
await fetchTranslatedText();
|
||||||
|
await getFormUserOptions(vm);
|
||||||
|
vm.initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
async function getFormUserOptions(vm) {
|
async function getFormUserOptions(vm) {
|
||||||
const res = await window.$gz.api.get(`form-user-options/home-schedule`);
|
const res = await window.$gz.api.get(`form-user-options/home-schedule`);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
@@ -154,19 +174,10 @@ async function getFormUserOptions(vm) {
|
|||||||
} else {
|
} else {
|
||||||
vm.formUserOptions = JSON.parse(res.data.options);
|
vm.formUserOptions = JSON.parse(res.data.options);
|
||||||
}
|
}
|
||||||
//takes local time in "HH:MM" format and converts to ISO UTC format for picker consumption
|
|
||||||
const d = new Date();
|
|
||||||
const temp = new Date(
|
|
||||||
d.getFullYear(),
|
|
||||||
d.getMonth(),
|
|
||||||
d.getDate(),
|
|
||||||
vm.formUserOptions.firstTime.split(":")[0],
|
|
||||||
vm.formUserOptions.firstTime.split(":")[1]
|
|
||||||
);
|
|
||||||
vm.tempFirstTime = window.$gz.locale.localTimeDateStringToUTC8601String(
|
|
||||||
temp.toISOString(),
|
|
||||||
vm.timeZoneName
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchTranslatedText() {
|
||||||
|
await window.$gz.translation.cacheTranslations(["DashboardScheduled"]);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
:key="item.id"
|
:key="item.id"
|
||||||
@click="addItem(item)"
|
@click="addItem(item)"
|
||||||
>
|
>
|
||||||
<v-list-item-title>{{ item.title }}</v-list-item-title>
|
<v-list-item-title>{{ $ay.t(item.title) }}</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
@@ -114,27 +114,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
//------------------
|
|
||||||
//Test ui feedback mechanisms here:
|
|
||||||
//this.formState.errorBoxMessage = "This is a test crlf\r\nOnly a test lf\nEot";
|
|
||||||
|
|
||||||
// await window.$gz.dialog.displayLTModalNotificationMessage(
|
|
||||||
// "ViewServerConfiguration",
|
|
||||||
// "Dashboard",
|
|
||||||
// "success",
|
|
||||||
// "https://www.ayanova.com/subscriptionexpired.htm"
|
|
||||||
// );
|
|
||||||
|
|
||||||
// window.$gz.eventBus.$emit(
|
|
||||||
// "notify-error",
|
|
||||||
// "This is a test crlf\r\nOnly a test lf\nEot",
|
|
||||||
// "https://www.ayanova.com/subscriptionexpired.htm"
|
|
||||||
// );
|
|
||||||
//------------------------
|
|
||||||
try {
|
try {
|
||||||
//keeping in case need later for some localized text or something
|
console.log("abouty to cache");
|
||||||
// await initForm(vm);
|
await DashRegistry.cacheTranslationsForAvailableItems();
|
||||||
|
|
||||||
//users have full rights to their dashboard config
|
//users have full rights to their dashboard config
|
||||||
vm.rights = window.$gz.role.fullRightsObject();
|
vm.rights = window.$gz.role.fullRightsObject();
|
||||||
vm.formState.readOnly = false;
|
vm.formState.readOnly = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user