Merge branch 'dev' into test
gitea/salix/test This commit looks good Details

This commit is contained in:
Gerard 2019-02-20 11:42:23 +01:00
commit 53891336a6
7 changed files with 7 additions and 121 deletions

View File

@ -23,11 +23,11 @@ module.exports = Self => {
}
});
Self.getVisibleAvailable = async(itemFk, warehouseFk) => {
Self.getVisibleAvailable = async(id, warehouseFk) => {
let query = `
CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`;
let options = [itemFk, warehouseFk, false];
let options = [id, warehouseFk, false];
[res] = await Self.rawSql(query, options);
return {

View File

@ -34,20 +34,21 @@ class Controller {
set item(value) {
this._item = value;
this.updateStock();
if (value && value.itemType && value.itemType.warehouseFk)
this.updateStock(value.itemType.warehouseFk);
}
get item() {
return this._item;
}
updateStock() {
updateStock(warehouseFk) {
this.available = null;
this.visible = null;
if (this._item && this._item.id) {
let options = {
params: {
warehouseFk: this._warehouseFk
warehouseFk: warehouseFk
}
};
this.$http.get(`/item/api/Items/${this._item.id}/getVisibleAvailable`, options).then(response => {
@ -81,7 +82,7 @@ class Controller {
warehouseFk: this.warehouseFk
}).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.updateStock();
this.updateStock(this.item.itemType.warehouseFk);
});
}
}

View File

@ -72,7 +72,6 @@
{{::item.userNickname}}
</span>
</vn-td>
<vn-td>{{::item.density}}</vn-td>
<vn-td number>{{::item.density}}</vn-td>
<vn-td>{{::item.taxClass}}</vn-td>
<vn-td>

View File

@ -1,5 +1,4 @@
import ngModule from '../module';
import './product';
import './style.scss';
class Controller {

View File

@ -1,38 +0,0 @@
<a
ui-sref="item.card.summary({id: $ctrl.item.id})"
translate-attr="{title: 'View item'}"
class="vn-list-item">
<vn-horizontal ng-click="$ctrl.onClick($event)">
<vn-auto margin-medium-right>
<vn-one>
<img
class="image"
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{::$ctrl.item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{::$ctrl.item.image}}" on-error-src/>
</vn-one>
</vn-auto>
<vn-one>
<h6>{{::$ctrl.item.id}} - {{::$ctrl.item.name}}</h6>
<vn-label-value label="Type"
value="{{::$ctrl.item.type}}">
</vn-label-value>
<vn-label-value label="Buyer"
value="{{::$ctrl.item.userNickname}}">
</vn-label-value>
<vn-fetched-tags max-length="4" item="$ctrl.item" class="noTitle"/>
</vn-one>
<vn-horizontal class="buttons">
<vn-icon
ng-click="$ctrl.clone($event)"
vn-tooltip="Clone"
icon="icon-clone">
</vn-icon>
<vn-icon
ng-click="$ctrl.preview($event)"
vn-tooltip="Preview"
icon="desktop_windows">
</vn-icon>
</vn-horizontal>
</vn-horizontal>
</a>

View File

@ -1,49 +0,0 @@
import ngModule from '../module';
class ItemProduct {
onClick(event) {
if (event.defaultPrevented)
event.stopImmediatePropagation();
}
set item(value) {
if (value) {
let tags = [];
for (let i = 5; i < 9; i++) {
if (value['tag' + i]) {
let tagValue = value['value' + i];
let tagKey = value['tag' + i];
tags.push({tag: {name: tagKey}, value: tagValue});
}
}
value.tags = tags;
}
this._item = value;
}
get item() {
return this._item;
}
clone(event) {
event.preventDefault();
this.index.cloneItem(this.item);
}
preview(event) {
event.preventDefault();
this.index.showItemPreview(this.item);
}
}
ngModule.component('vnItemProduct', {
template: require('./product.html'),
bindings: {
item: '<'
},
controller: ItemProduct,
require: {
index: '^vnItemIndex'
}
});

View File

@ -1,31 +1,5 @@
@import "variables";
vn-item-product {
display: block;
.id {
background-color: $color-main;
color: $color-font-dark;
margin-bottom: 0em;
}
.image {
height: 7em;
width: 7em;
& > img {
max-height: 100%;
max-width: 100%;
border-radius: .2em;
}
}
vn-label-value:first-of-type section{
margin-top: 0.6em;
}
vn-fetched-tags vn-horizontal{
margin-top: 0.9em;
}
}
vn-table {
img {
border-radius: 50%;