This commit is contained in:
@@ -58,7 +58,7 @@ import chartBarHorizontalControl from "./components/chart-bar-horizontal-control
|
||||
//DEVELOPMENT MODE
|
||||
//THIS SHOULD BE FALSE IN RELEASE
|
||||
//************************************************************
|
||||
const DEV_MODE = true;
|
||||
const DEV_MODE = false;
|
||||
//************************************************************
|
||||
//**************************************************************
|
||||
//**************************************************************
|
||||
|
||||
@@ -132,8 +132,6 @@ export default {
|
||||
vm.formState.loading = false;
|
||||
vm.formState.ready = true;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
|
||||
// vm.getDataFromApi();
|
||||
})
|
||||
.catch(err => {
|
||||
vm.formState.ready = true;
|
||||
@@ -270,6 +268,10 @@ export default {
|
||||
|
||||
//send request
|
||||
r = await window.$gz.api.upsertEx("license/trialRequest", vm.request);
|
||||
//a string is returned and will start with E1 if it's an error
|
||||
if (r.data.startsWith("E1")) {
|
||||
throw r;
|
||||
}
|
||||
|
||||
console.log(r);
|
||||
//then another message box saying watch your email to verify
|
||||
@@ -289,122 +291,6 @@ export default {
|
||||
if (!this.formState.loading && !this.formState.readOnly) {
|
||||
window.$gz.form.fieldValueChanged(this, ref);
|
||||
}
|
||||
},
|
||||
getDataFromApi() {
|
||||
let vm = this;
|
||||
//------------
|
||||
//TODO: for now just return
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
});
|
||||
return;
|
||||
|
||||
//--------------
|
||||
|
||||
vm.formState.loading = true;
|
||||
//always fetch on this form for the current logged in user id
|
||||
let url = API_BASE_URL;
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
|
||||
window.$gz.api
|
||||
.get(url)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
//Not found?
|
||||
if (res.error.code == "2010") {
|
||||
//notify not found error then navigate backwards
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-error",
|
||||
vm.$ay.t("ErrorAPI2010")
|
||||
);
|
||||
// navigate backwards
|
||||
window.$gz._.delay(function() {
|
||||
vm.$router.go(-1);
|
||||
}, 2000);
|
||||
}
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
});
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
});
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
let vm = this;
|
||||
if (vm.canSave) {
|
||||
vm.formState.loading = true;
|
||||
|
||||
//always submit from this form for the current logged in user id
|
||||
let url = API_BASE_URL + vm.$store.state.userId;
|
||||
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
window.$gz.api
|
||||
.upsert(url, vm.obj)
|
||||
.then(res => {
|
||||
vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//UserOptions is never a POST as it always exists and can't be deleted so always a PUT
|
||||
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
vm.obj.concurrency = res.data.concurrency;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false
|
||||
});
|
||||
|
||||
//Set values in store so they are updated immediately for user
|
||||
let l = vm.$store.state.locale;
|
||||
|
||||
if (vm.obj.languageOverride) {
|
||||
l.languageOverride = vm.obj.languageOverride;
|
||||
}
|
||||
|
||||
if (vm.obj.timeZoneOverride) {
|
||||
l.timeZoneOverride = vm.obj.timeZoneOverride;
|
||||
}
|
||||
|
||||
if (vm.obj.currencyName) {
|
||||
l.currencyName = vm.obj.currencyName;
|
||||
}
|
||||
|
||||
if (vm.obj.hour12) {
|
||||
l.hour12 = vm.obj.hour12;
|
||||
}
|
||||
|
||||
window.$gz.store.commit("setLocale", l);
|
||||
}
|
||||
})
|
||||
.catch(function handleSubmitError(error) {
|
||||
vm.formState.loading = false;
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user