Added acl action for logistic boss and show the recent data added on species and genus in their fields in item botanical
This commit is contained in:
parent
32ea2dbda6
commit
6e08a66343
|
@ -17,7 +17,8 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New genus"
|
vn-tooltip="New genus"
|
||||||
ng-click="$ctrl.showGenus($event)"
|
ng-click="$ctrl.showGenus($event)"
|
||||||
vn-acl="logisticBoss">
|
vn-acl="logisticBoss"
|
||||||
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -38,7 +39,8 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New species"
|
vn-tooltip="New species"
|
||||||
ng-click="$ctrl.showSpecies($event)"
|
ng-click="$ctrl.showSpecies($event)"
|
||||||
vn-acl="logisticBoss">
|
vn-acl="logisticBoss"
|
||||||
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -61,6 +63,7 @@
|
||||||
<!-- Create new genus dialog -->
|
<!-- Create new genus dialog -->
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="genus"
|
vn-id="genus"
|
||||||
|
on-response="$ctrl.onGenusResponse($response)"
|
||||||
on-accept="$ctrl.onGenusAccept()"
|
on-accept="$ctrl.onGenusAccept()"
|
||||||
message="New genus">
|
message="New genus">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
|
@ -80,6 +83,7 @@
|
||||||
<!-- Create new species dialog -->
|
<!-- Create new species dialog -->
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="species"
|
vn-id="species"
|
||||||
|
on-response="$ctrl.onSpeciesResponse($response)"
|
||||||
on-accept="$ctrl.onSpeciesAccept()"
|
on-accept="$ctrl.onSpeciesAccept()"
|
||||||
message="New species">
|
message="New species">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Controller extends Section {
|
||||||
this.$http.post(`genera`, this.data).then(res => {
|
this.$http.post(`genera`, this.data).then(res => {
|
||||||
this.vnApp.showMessage(this.$t('The genus has been created'));
|
this.vnApp.showMessage(this.$t('The genus has been created'));
|
||||||
this.emit('response', {$response: res.data});
|
this.emit('response', {$response: res.data});
|
||||||
|
this.onGenusResponse(res.data);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.vnApp.showError(this.$t(e.message));
|
this.vnApp.showError(this.$t(e.message));
|
||||||
|
@ -44,11 +45,12 @@ class Controller extends Section {
|
||||||
onSpeciesAccept() {
|
onSpeciesAccept() {
|
||||||
try {
|
try {
|
||||||
if (!this.data.name)
|
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.$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.emit('response', {$response: res.data});
|
||||||
|
this.onSpeciesResponse(res.data);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.vnApp.showError(this.$t(e.message));
|
this.vnApp.showError(this.$t(e.message));
|
||||||
|
@ -78,6 +80,14 @@ class Controller extends Section {
|
||||||
this.$.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onGenusResponse(response) {
|
||||||
|
this.botanical.genusFk = response.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSpeciesResponse(response) {
|
||||||
|
this.botanical.specieFk = response.id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnItemBotanical', {
|
ngModule.vnComponent('vnItemBotanical', {
|
||||||
|
|
Loading…
Reference in New Issue