This commit is contained in:
@@ -1213,7 +1213,7 @@ export default {
|
||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
|
||||
}
|
||||
|
||||
if (!val.dirty && val.valid && !val.readOnly) {
|
||||
if (!val.dirty && val.valid) {
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-enable-item",
|
||||
FORM_KEY + ":duplicate"
|
||||
@@ -1254,9 +1254,15 @@ export default {
|
||||
this.obj = this.$route.params.obj;
|
||||
this.obj.concurrency = undefined;
|
||||
this.obj.id = 0;
|
||||
this.obj.name = `${this.obj.name} - ${window.$gz.translation.get(
|
||||
"Copy"
|
||||
)}`;
|
||||
this.obj.key = null;
|
||||
this.obj.active=false;
|
||||
this.obj.fetchedOn=null;
|
||||
this.obj.fetchCode=null;
|
||||
this.obj.created=window.$gz.locale.nowUTC8601String();
|
||||
this.obj.notificationSent=false;
|
||||
// this.obj.name = `${this.obj.name} - ${window.$gz.translation.get(
|
||||
// "Copy"
|
||||
// )}`;
|
||||
setDirty = true;
|
||||
}
|
||||
}
|
||||
@@ -1322,8 +1328,26 @@ export default {
|
||||
window.$gz.form.fieldValueChanged(this, ref);
|
||||
}
|
||||
},
|
||||
customerChanged(newName) {
|
||||
this.obj.regTo = newName;
|
||||
async customerChanged() {
|
||||
const id = this.obj.customerId;
|
||||
if (!id || id == 0) {
|
||||
return;
|
||||
}
|
||||
const res = await window.$gz.api.get(`customer/${id}`);
|
||||
if (res.error) {
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
window.$gz.errorHandler.errorToString(res, this)
|
||||
);
|
||||
} else {
|
||||
//Use customer record to update stuff here
|
||||
this.obj.fetchEmail = res.data.emailAddress;
|
||||
this.obj.regTo = res.data.name;
|
||||
if (this.pGroup > 1) {
|
||||
//NOT V7 OR MISC PRODUCT (so raven basically for now anyway)
|
||||
this.obj.dbId = res.data.dbId;
|
||||
}
|
||||
}
|
||||
},
|
||||
dtAddOneWeek: function(propName) {
|
||||
addToDate(this, propName, {
|
||||
@@ -1395,6 +1419,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async getDataFromApi(recordId) {
|
||||
const vm = this;
|
||||
window.$gz.form.setFormState({
|
||||
@@ -1460,7 +1485,9 @@ export default {
|
||||
});
|
||||
} else {
|
||||
//PUT
|
||||
vm.obj.concurrency = res.data.concurrency;
|
||||
vm.obj = res.data;
|
||||
// vm.obj.concurrency = res.data.concurrency;
|
||||
// vm.obj.key=res.data.key;
|
||||
}
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
@@ -1555,6 +1582,19 @@ async function clickHandler(menuItem) {
|
||||
window.$gz.form.setLastReportMenuItem(FORM_KEY, res, m.vm);
|
||||
}
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
m.vm.remove();
|
||||
break;
|
||||
case "new":
|
||||
m.vm.$router.push({
|
||||
name: "license-edit",
|
||||
params: { recordid: 0 }
|
||||
});
|
||||
break;
|
||||
case "duplicate":
|
||||
m.vm.duplicate();
|
||||
break;
|
||||
case "plus-one-week":
|
||||
{
|
||||
m.vm.dtAddToAll({ days: 7 });
|
||||
@@ -1626,6 +1666,33 @@ function generateMenu(vm) {
|
||||
});
|
||||
}
|
||||
|
||||
if (vm.rights.change) {
|
||||
menuOptions.menuItems.push({
|
||||
title: "New",
|
||||
icon: "$sockiPlus",
|
||||
key: FORM_KEY + ":new",
|
||||
vm: vm
|
||||
});
|
||||
}
|
||||
|
||||
if (vm.rights.change && vm.$route.params.recordid != 0) {
|
||||
menuOptions.menuItems.push({
|
||||
title: "Duplicate",
|
||||
icon: "$sockiClone",
|
||||
key: FORM_KEY + ":duplicate",
|
||||
vm: vm
|
||||
});
|
||||
}
|
||||
if (vm.rights.delete && vm.$route.params.recordid != 0) {
|
||||
menuOptions.menuItems.push({
|
||||
title: "Delete",
|
||||
icon: "$sockiTrashAlt",
|
||||
surface: false,
|
||||
key: FORM_KEY + ":delete",
|
||||
vm: vm
|
||||
});
|
||||
}
|
||||
|
||||
menuOptions.menuItems.push({ divider: true, inset: false });
|
||||
|
||||
menuOptions.menuItems.push({
|
||||
|
||||
Reference in New Issue
Block a user