This commit is contained in:
@@ -589,14 +589,16 @@ async function initForm(vm) {
|
||||
let res = await window.$gz.api.get("license");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw new Error(res);
|
||||
return Promise.reject(res);
|
||||
//throw new Error(res);
|
||||
}
|
||||
vm.currentLicenseInfo = res.data.license;
|
||||
|
||||
res = await window.$gz.api.get("license/database-empty");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw new Error(res);
|
||||
return Promise.reject(res);
|
||||
//throw new Error(res);
|
||||
}
|
||||
vm.dbIsEmpty = res.data;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,8 @@ async function getServerInfo(vm) {
|
||||
let res = await window.$gz.api.get("server-info");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw new Error(res);
|
||||
//throw new Error(res);
|
||||
return Promise.reject(res);
|
||||
} else {
|
||||
vm.serverInfo = res.data;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,8 @@ export default {
|
||||
let res = await window.$gz.api.get("license/database-empty");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw new Error(res);
|
||||
return Promise.reject(res);
|
||||
//throw new Error(res);
|
||||
}
|
||||
if (res.data != true) {
|
||||
let dialogResult = await window.$gz.dialog.confirmGeneric(
|
||||
|
||||
@@ -1186,7 +1186,8 @@ async function fetchReportData(vm) {
|
||||
let res = await window.$gz.api.upsert("report/data", reportDataOptions);
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw new Error(res);
|
||||
return Promise.reject(res);
|
||||
//throw new Error(res);
|
||||
} else {
|
||||
vm.reportData = res.data;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<v-row>
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
<v-col cols="12" v-if="customername">
|
||||
{{ customername }}
|
||||
<v-btn @click="goToCustomer"> {{ customername }}</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-textarea
|
||||
@@ -93,6 +93,11 @@ export default {
|
||||
});
|
||||
} else {
|
||||
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
||||
if (!vm.customername) {
|
||||
await fetchCustomerName(vm).catch(err => {
|
||||
window.$gz.errorHandler.handleFormError(err, vm);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vm.obj.customerId = this.$route.params.customerid;
|
||||
@@ -188,6 +193,15 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goToCustomer() {
|
||||
this.$router.push({
|
||||
name: "customer-edit",
|
||||
params: {
|
||||
recordid: this.obj.customerId
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
canSave: function() {
|
||||
return this.formState.valid && this.formState.dirty;
|
||||
},
|
||||
@@ -233,6 +247,7 @@ export default {
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm);
|
||||
//Update the form status
|
||||
@@ -502,8 +517,29 @@ async function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
async function fetchTranslatedText(vm) {
|
||||
await window.$gz.translation.cacheTranslations(["CustomerNoteNotes"]);
|
||||
await window.$gz.translation.cacheTranslations([
|
||||
"CustomerNoteNotes",
|
||||
"CustomerNoteNoteDate"
|
||||
]);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
async function fetchCustomerName(vm) {
|
||||
//If customer name is missing then fetch it here to display
|
||||
//this will happen when this form is directly opened from a search
|
||||
//or record history etc
|
||||
|
||||
let res = await window.$gz.api.get(
|
||||
`name/${window.$gz.type.Customer}/${vm.obj.customerId}`
|
||||
);
|
||||
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
return Promise.reject(res);
|
||||
} else {
|
||||
vm.customername = res.data;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
||||
Reference in New Issue
Block a user