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-dialog max-width="600px" v-model="settingsDialog">
<v-card>
<v-card-title> </v-card-title>
<v-card-title>{{ $ay.t("ScheduleOptions") }} </v-card-title>
<v-card-text>
<v-row no-gutters>
<v-col cols="12">
@@ -355,6 +355,7 @@
<v-radio-group
v-model="formUserOptions.wisuColorSource"
:mandatory="true"
:label="$ay.t('ScheduleWOColorFrom')"
>
<v-radio :label="$ay.t('None')" value="0"></v-radio>
<v-radio
@@ -383,6 +384,13 @@
:label="$ay.t('Reminder')"
></v-checkbox>
</v-col>
<v-col cols="12">
<gz-time-picker
:label="$ay.t('ScheduleFirstHour')"
v-model="tempFirstTime"
></gz-time-picker>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
@@ -425,13 +433,21 @@ Settings form
persist, imminentize
Save / load from server (or locally only? as formSettings.saved)??
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 ###
TESTING:
@@ -528,7 +544,8 @@ export default {
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12(),
formUserOptions: {}
formUserOptions: {},
tempFirstTime: null
};
},
methods: {
@@ -931,7 +948,7 @@ export default {
nativeEvent.stopPropagation();
},
async fetchEvents({ start, end }) {
console.log("FetchEvents:", { start: start.date, end: end.date });
// console.log("FetchEvents:", { start: start.date, end: end.date });
try {
window.$gz.form.deleteAllErrorBoxErrors(this);
let res = await window.$gz.api.post("schedule/personal", {
@@ -976,17 +993,11 @@ export default {
async saveUserOptions() {
this.settingsDialog = false;
await saveFormUserOptions(this);
//trigger refresh in calendar event triggered format
//expected:
let start = { date: this.$refs.calendar.start };
let end = { date: this.$refs.calendar.end };
if (!end.date) {
end.date = start.date;
}
await this.fetchEvents({ start, end });
//doesn't seem to be any reliable way to trigger refresh on the calendar itself
//and trying to load the events manually is not working out as the calendar reports a different
//start and end than it provides for the change event
//this is brutal but works
// window.location.reload();
}
//eom
}
@@ -1161,12 +1172,32 @@ async function getFormUserOptions(vm) {
} else {
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) {
//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", {
formKey: FORM_KEY,
options: JSON.stringify(vm.formUserOptions)
@@ -1189,6 +1220,9 @@ async function fetchTranslatedText(vm) {
"ScheduleDay",
"ScheduleWeek",
"Schedule4Day",
"ScheduleFirstHour",
"ScheduleWOColorFrom",
"ScheduleOptions",
"WorkOrder",
"Reminder",
"Review",