diff --git a/modules/item/front/botanical/index.html b/modules/item/front/botanical/index.html index 3d1beefd7..2388f4e8f 100644 --- a/modules/item/front/botanical/index.html +++ b/modules/item/front/botanical/index.html @@ -17,7 +17,8 @@ icon="add_circle" vn-tooltip="New genus" ng-click="$ctrl.showGenus($event)" - vn-acl="logisticBoss"> + vn-acl="logisticBoss" + vn-acl-action="remove"> @@ -38,7 +39,8 @@ icon="add_circle" vn-tooltip="New species" ng-click="$ctrl.showSpecies($event)" - vn-acl="logisticBoss"> + vn-acl="logisticBoss" + vn-acl-action="remove"> @@ -61,6 +63,7 @@ @@ -80,6 +83,7 @@ diff --git a/modules/item/front/botanical/index.js b/modules/item/front/botanical/index.js index d0ff3f466..8ade0fd9d 100644 --- a/modules/item/front/botanical/index.js +++ b/modules/item/front/botanical/index.js @@ -33,6 +33,7 @@ class Controller extends Section { this.$http.post(`genera`, this.data).then(res => { this.vnApp.showMessage(this.$t('The genus has been created')); this.emit('response', {$response: res.data}); + this.onGenusResponse(res.data); }); } catch (e) { this.vnApp.showError(this.$t(e.message)); @@ -44,11 +45,12 @@ class Controller extends Section { onSpeciesAccept() { try { if (!this.data.name) - throw new Error(`The name of the specie can't be empty`); + throw new Error(`The name of the species can't be empty`); this.$http.post(`species`, this.data).then(res => { - this.vnApp.showMessage(this.$t('The specie has been created')); + this.vnApp.showMessage(this.$t('The species has been created')); this.emit('response', {$response: res.data}); + this.onSpeciesResponse(res.data); }); } catch (e) { this.vnApp.showError(this.$t(e.message)); @@ -78,6 +80,14 @@ class Controller extends Section { this.$.watcher.updateOriginalData(); }); } + + onGenusResponse(response) { + this.botanical.genusFk = response.id; + } + + onSpeciesResponse(response) { + this.botanical.specieFk = response.id; + } } ngModule.vnComponent('vnItemBotanical', {