From 1844e70dc9a406a6dc55af9a8f9cc903e50e1a9e Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 24 Nov 2021 23:22:29 +0000 Subject: [PATCH] case 1690 --- ayanova/src/api/initialize.js | 5 ----- ayanova/src/views/customer-csr-edit.vue | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 96d8bae0..6a490ae9 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -69,11 +69,6 @@ function initNavPanel() { } //WORKORDERS subitem - console.log( - "Can open workorder role:", - window.$gz.role.canOpen(window.$gz.type.WorkOrder) - ); - if (window.$gz.store.state.customerRights.wo == true) { sub.push({ title: "WorkOrderList", diff --git a/ayanova/src/views/customer-csr-edit.vue b/ayanova/src/views/customer-csr-edit.vue index 095da81d..38fe72bc 100644 --- a/ayanova/src/views/customer-csr-edit.vue +++ b/ayanova/src/views/customer-csr-edit.vue @@ -401,7 +401,25 @@ export default { showAddUnitDialog: function() { this.addUnitDialog = true; }, - addUnit: function() {}, + async addUnit() { + const vm = this; + try { + const res = await window.$gz.api.upsert( + "unit/customerunit/", + vm.unitObj + ); + if (res.error) { + window.$gz.errorHandler.handleFormError(res.error); //no vm passed here so that it displays as a dialog rather than in the form + } else { + if (res.data.id) { + //SUCCESS + this.addUnitDialog = false; + } + } + } catch (ex) { + window.$gz.errorHandler.handleFormError(ex); //no vm passed here so that it displays as a dialog rather than in the form + } + }, unitListVariant: function() { return `customerid: ${this.obj.customerId}`; },