Merge branch 'dev' of http://git.verdnatura.es/salix into dev

This commit is contained in:
Carlos Jimenez 2018-02-20 12:26:29 +01:00
commit 4251ee20e4
7 changed files with 77 additions and 13 deletions

View File

@ -97,6 +97,13 @@
"description": "Barcode", "description": "Barcode",
"icon": "folder" "icon": "folder"
} }
},{
"url" : "/summary",
"state": "item.card.summary",
"component": "vn-item-summary",
"params": {
"item": "$ctrl.item"
}
} }
] ]
} }

View File

@ -3,7 +3,6 @@
<vn-vertical pad-large> <vn-vertical pad-large>
<vn-one margin-medium-top> <vn-one margin-medium-top>
<vn-title>Item Barcodes</vn-title> <vn-title>Item Barcodes</vn-title>
<mg-ajax path="/item/api/ItemBarcodes" options="mgIndex as barcodes"></mg-ajax>
<vn-horizontal ng-repeat="barcode in $ctrl.barcodes track by $index"> <vn-horizontal ng-repeat="barcode in $ctrl.barcodes track by $index">
<vn-textfield vn-three label="code" model="barcode.code" vn-acl="buyer, replenisher"></vn-textfield> <vn-textfield vn-three label="code" model="barcode.code" vn-acl="buyer, replenisher"></vn-textfield>
<vn-one pad-medium-top> <vn-one pad-medium-top>

View File

@ -1,5 +1,41 @@
<vn-card> <mg-ajax
<vn-vertical pad-large> path="/item/api/ItemBotanicals/{{patch.params.id}}"
<vn-title>Botanical</vn-title> options="vnPatch">
</vn-vertical> </mg-ajax>
</vn-card> <vn-watcher
vn-id="watcher"
data="$ctrl.item.botanical"
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="watcher.submit()" ng-cloak>
<vn-card>
<vn-vertical pad-large>
<vn-title>Botanical</vn-title>
<vn-horizontal>
<vn-textfield vn-one label="Botanical" model="$ctrl.item.botanical.botanical"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
initial-data="$ctrl.item.botanical.genus"
field="$ctrl.item.botanical.genusFk"
url="/item/api/genera"
show-field="latin_genus_name"
value-field="genus_id"
label="Genus">
</vn-autocomplete>
<vn-autocomplete vn-one
initial-data="$ctrl.item.botanical.specie"
field="$ctrl.item.botanical.specieFk"
url="/item/api/species"
show-field="latin_species_name"
value-field="specie_id"
label="Specie">
</vn-autocomplete>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

@ -1,5 +1,8 @@
import ngModule from '../module'; import ngModule from '../module';
ngModule.component('vnItemBotanical', { ngModule.component('vnItemBotanical', {
template: require('./item-botanical.html') template: require('./item-botanical.html'),
bindings: {
item: '<'
}
}); });

View File

@ -4,7 +4,21 @@ class ItemCard {
constructor($http, $state) { constructor($http, $state) {
this.$http = $http; this.$http = $http;
this.$state = $state; this.$state = $state;
this.item = {}; }
_getBotanical() {
let filter = {
where: {
itemFk: this.$state.params.id
},
include: [{relation: 'genus'}, {relation: 'specie'}]
};
this.$http.get(`/item/api/ItemBotanicals?filter=${JSON.stringify(filter)}`)
.then(res => {
if (res.data) {
this.item.botanical = res.data[0];
}
});
} }
$onInit() { $onInit() {
@ -19,10 +33,14 @@ class ItemCard {
{relation: "itemTag", scope: {order: "priority ASC", include: {relation: "tag"}}} {relation: "itemTag", scope: {order: "priority ASC", include: {relation: "tag"}}}
] ]
}; };
this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then( this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`)
res => { .then(
this.item = res.data; res => {
} if (res.data && res.data.id) {
this.item = res.data;
this._getBotanical();
}
}
); );
} }
} }

View File

@ -12,4 +12,5 @@ import './history/item-history';
import './niche/item-niche'; import './niche/item-niche';
import './botanical/item-botanical'; import './botanical/item-botanical';
import './barcode/item-barcode'; import './barcode/item-barcode';
import './summary/item-summary';

View File

@ -436,4 +436,4 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
VALUES VALUES
('1', '1', '1', 'insert', 'We made an change!'); ('1', '1', '1', 'insert', 'We made an change!');