This commit is contained in:
2021-10-06 15:12:05 +00:00
parent 6f7a313580
commit 9d77c19723

View File

@@ -763,6 +763,10 @@ export default {
} }
}, },
async fetchEvents({ start, end }) { async fetchEvents({ start, end }) {
/*
{ items = r, users = Users }
*/
try { try {
window.$gz.form.deleteAllErrorBoxErrors(this); window.$gz.form.deleteAllErrorBoxErrors(this);
const res = await window.$gz.api.post("schedule/svc", { const res = await window.$gz.api.post("schedule/svc", {
@@ -787,11 +791,12 @@ export default {
this.formState.serverError = res.error; this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this); window.$gz.form.setErrorBoxErrors(this);
} else { } else {
this.availableUsers = res.data.users;
this.events.splice(0); this.events.splice(0);
const timeZoneName = this.timeZoneName; const timeZoneName = this.timeZoneName;
let i = res.data.length; let i = res.data.items.length;
while (i--) { while (i--) {
const x = res.data[i]; const x = res.data.items[i];
this.events.push({ this.events.push({
start: new Date( start: new Date(
new Date(x.start) new Date(x.start)
@@ -982,23 +987,23 @@ function generateMenu(vm) {
// //
async function initForm(vm) { async function initForm(vm) {
await fetchTranslatedText(vm); await fetchTranslatedText(vm);
await fetchAvailableUsers(vm); //await fetchAvailableUsers(vm);
getFormSettings(vm); getFormSettings(vm);
await getFormUserOptions(vm); await getFormUserOptions(vm);
} }
////////////////////// // //////////////////////
// // //
// // //
async function fetchAvailableUsers(vm) { // async function fetchAvailableUsers(vm) {
const res = await window.$gz.api.get("schedule/scheduleable-user-list"); // const res = await window.$gz.api.get("schedule/scheduleable-user-list");
if (res.error) { // if (res.error) {
vm.formState.serverError = res.error; // vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); // window.$gz.form.setErrorBoxErrors(vm);
} else { // } else {
vm.availableUsers = res.data; // vm.availableUsers = res.data;
} // }
} // }
function getFormSettings(vm) { function getFormSettings(vm) {
let formSettings = window.$gz.form.getFormSettings(FORM_KEY); let formSettings = window.$gz.form.getFormSettings(FORM_KEY);