This commit is contained in:
2021-09-22 18:02:44 +00:00
parent 33d2359c21
commit c51df5119e

View File

@@ -70,7 +70,7 @@
:type="viewType"
:locale="languageName"
:event-more-text="$ay.t('More')"
:first-time="formSetting.firstTime"
:first-time="formUserOptions.firstTime"
@click:event="showMoreInfo"
@click:more="viewDay"
@click:date="viewDay"
@@ -460,7 +460,6 @@ export default {
//formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
focus: "",
viewType: "month",
firstTime: "8:00",
selectedEvent: {},
selectedElement: null,
moreInfoDialog: false,
@@ -490,7 +489,7 @@ export default {
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12(),
formSetting: { firstTime: "8:00" }
formUserOptions: {}
};
},
methods: {
@@ -893,6 +892,7 @@ export default {
nativeEvent.stopPropagation();
},
async fetchEvents({ start, end }) {
console.log("Fetching events");
try {
window.$gz.form.deleteAllErrorBoxErrors(this);
let res = await window.$gz.api.post("schedule/personal", {
@@ -906,10 +906,10 @@ export default {
`${end.date}T23:59:59`,
this.timeZoneName
),
colorSource: 4,
workOrders: true,
reviews: true,
reminders: true
wisuColorSource: this.formUserOptions.wisuColorSource,
wisu: this.formUserOptions.wisu, //workorder item scheduled user records
reviews: this.formUserOptions.reviews,
reminders: this.formUserOptions.reminders
});
if (res.error) {
@@ -1063,7 +1063,7 @@ function generateMenu(vm) {
async function initForm(vm) {
await fetchTranslatedText(vm);
getFormSettings(vm);
getFormUserOptions(vm);
await getFormUserOptions(vm);
}
function getFormSettings(vm) {
@@ -1089,18 +1089,39 @@ function saveFormSettings(vm) {
////////////////////
//
async function getFormUserOptions(vm) {
let res = await window.$gz.api.get(
`form-user-options/list?formKey=${FORM_KEY}`
);
console.log("getuseroptions:", res);
// if (res.error) {
// console.log("getuseroptions:",res)
// } else {
let res = await window.$gz.api.get(`form-user-options/${FORM_KEY}`);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
if (res.data == null) {
console.log("getFormUserOptions null setting default");
//make a default
vm.formUserOptions = {
firstTime: "00:00",
wisuColorSource: 4,
wisu: true,
reviews: true,
reminders: true
};
} else {
vm.formUserOptions = res.data;
}
}
}
// vm.selectLists.savedFilters = res.data;
// //confirm we still have the current active filter id
// setActiveFilter(vm, vm.activeFilterId);
// }
////////////////////
//
async function saveFormUserOptions(vm) {
let res = await window.$gz.api.upsert(
"form-user-options",
vm.formUserOptions
);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
}
}
//////////////////////////////////////////////////////////