This commit is contained in:
2021-09-22 23:47:38 +00:00
parent eaa9a3acdc
commit 853857dbb4

View File

@@ -342,7 +342,7 @@
<v-row justify="center"> <v-row justify="center">
<v-dialog max-width="600px" v-model="settingsDialog"> <v-dialog max-width="600px" v-model="settingsDialog">
<v-card> <v-card>
<v-card-title> </v-card-title> <v-card-title>{{ $ay.t("ScheduleOptions") }} </v-card-title>
<v-card-text> <v-card-text>
<v-row no-gutters> <v-row no-gutters>
<v-col cols="12"> <v-col cols="12">
@@ -355,6 +355,7 @@
<v-radio-group <v-radio-group
v-model="formUserOptions.wisuColorSource" v-model="formUserOptions.wisuColorSource"
:mandatory="true" :mandatory="true"
:label="$ay.t('ScheduleWOColorFrom')"
> >
<v-radio :label="$ay.t('None')" value="0"></v-radio> <v-radio :label="$ay.t('None')" value="0"></v-radio>
<v-radio <v-radio
@@ -383,6 +384,13 @@
:label="$ay.t('Reminder')" :label="$ay.t('Reminder')"
></v-checkbox> ></v-checkbox>
</v-col> </v-col>
<v-col cols="12">
<gz-time-picker
:label="$ay.t('ScheduleFirstHour')"
v-model="tempFirstTime"
></gz-time-picker>
</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@@ -425,13 +433,21 @@ Settings form
persist, imminentize persist, imminentize
Save / load from server (or locally only? as formSettings.saved)?? Save / load from server (or locally only? as formSettings.saved)??
saved with device or saved with account is the heart of it saved with device or saved with account is the heart of it
wo display section:
DISPLAY
Color: wostatus/woitemstatus/woitempriority/none
Weekdays: weekdays to display, copy from pm exclude days thingy
More info: checkbox beside each item below that can be shown in wo
todo: Needs a refresh button somewhere to refresh for new appts. Settings:
wo color choice
wo show
reminders show
reviews show
weekdays to show
start time
intervals
interval slices
todo: ### find all trans keys and make sure they are fetched in initform ### todo: ### find all trans keys and make sure they are fetched in initform ###
TESTING: TESTING:
@@ -528,7 +544,8 @@ export default {
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: {},
tempFirstTime: null
}; };
}, },
methods: { methods: {
@@ -931,7 +948,7 @@ export default {
nativeEvent.stopPropagation(); nativeEvent.stopPropagation();
}, },
async fetchEvents({ start, end }) { async fetchEvents({ start, end }) {
console.log("FetchEvents:", { start: start.date, end: end.date }); // console.log("FetchEvents:", { start: start.date, end: end.date });
try { try {
window.$gz.form.deleteAllErrorBoxErrors(this); window.$gz.form.deleteAllErrorBoxErrors(this);
let res = await window.$gz.api.post("schedule/personal", { let res = await window.$gz.api.post("schedule/personal", {
@@ -976,17 +993,11 @@ export default {
async saveUserOptions() { async saveUserOptions() {
this.settingsDialog = false; this.settingsDialog = false;
await saveFormUserOptions(this); await saveFormUserOptions(this);
//doesn't seem to be any reliable way to trigger refresh on the calendar itself
//trigger refresh in calendar event triggered format //and trying to load the events manually is not working out as the calendar reports a different
//expected: //start and end than it provides for the change event
let start = { date: this.$refs.calendar.start }; //this is brutal but works
let end = { date: this.$refs.calendar.end }; // window.location.reload();
if (!end.date) {
end.date = start.date;
}
await this.fetchEvents({ start, end });
} }
//eom //eom
} }
@@ -1161,12 +1172,32 @@ 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 saveFormUserOptions(vm) { async function saveFormUserOptions(vm) {
//translate tempFirstTime to local time
if (vm.tempFirstTime) {
//convert picker's utc time to local hour:MM
let localTime = window.$gz.DateTime.fromISO(vm.tempFirstTime).toLocal();
vm.formUserOptions.firstTime = `${localTime.hour}:${localTime.minute}`;
}
let res = await window.$gz.api.post("form-user-options", { let res = await window.$gz.api.post("form-user-options", {
formKey: FORM_KEY, formKey: FORM_KEY,
options: JSON.stringify(vm.formUserOptions) options: JSON.stringify(vm.formUserOptions)
@@ -1189,6 +1220,9 @@ async function fetchTranslatedText(vm) {
"ScheduleDay", "ScheduleDay",
"ScheduleWeek", "ScheduleWeek",
"Schedule4Day", "Schedule4Day",
"ScheduleFirstHour",
"ScheduleWOColorFrom",
"ScheduleOptions",
"WorkOrder", "WorkOrder",
"Reminder", "Reminder",
"Review", "Review",