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}`; },