feat: añadido icono info, que indica de que almacén se saca la información
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-02-07 13:40:39 +01:00
parent 4f76465246
commit 6cb3930be0
10 changed files with 84 additions and 37 deletions

View File

@ -1,6 +1,6 @@
<vn-portal slot="menu"> <vn-portal slot="menu">
<vn-item-descriptor <vn-item-descriptor
warehouse-fk="$ctrl.getWarehouseFk()" warehouse-fk="$ctrl.warehouseFk"
item="$ctrl.item" item="$ctrl.item"
card-reload="$ctrl.reload()"></vn-item-descriptor> card-reload="$ctrl.reload()"></vn-item-descriptor>
<vn-left-menu source="card"></vn-left-menu> <vn-left-menu source="card"></vn-left-menu>

View File

@ -2,16 +2,6 @@ import ngModule from '../module';
import ModuleCard from 'salix/components/module-card'; import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard { class Controller extends ModuleCard {
getWarehouseFk() {
if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary')
return this.$params.warehouseFk;
this.$http.get('ItemConfigs/findOne')
.then(res => {
return res.data.warehouseFk;
});
}
reload() { reload() {
this.$http.get(`Items/${this.$params.id}/getCard`) this.$http.get(`Items/${this.$params.id}/getCard`)
.then(res => this.item = res.data); .then(res => this.item = res.data);

View File

@ -36,6 +36,16 @@
<p translate>Available</p> <p translate>Available</p>
<p>{{$ctrl.available | dashIfEmpty}}</p> <p>{{$ctrl.available | dashIfEmpty}}</p>
</vn-one> </vn-one>
<vn-one>
<p>
<vn-icon
ng-if="$ctrl.showIcon"
icon="info_outline"
vn-tooltip="{{$ctrl.warehouseText}}"
pointer>
</vn-icon>
</p>
</vn-one>
</vn-horizontal> </vn-horizontal>
</slot-before> </slot-before>
<slot-body> <slot-body>

View File

@ -30,7 +30,10 @@ class Controller extends Descriptor {
set warehouseFk(value) { set warehouseFk(value) {
this._warehouseFk = value; this._warehouseFk = value;
if (value) this.updateStock(); if (value) {
this.updateStock();
this.getWarehouseName(value);
}
} }
loadData() { loadData() {
@ -89,6 +92,22 @@ class Controller extends Descriptor {
this.$.photo.setAttribute('src', newSrc); this.$.photo.setAttribute('src', newSrc);
this.$.photo.setAttribute('zoom-image', newZoomSrc); this.$.photo.setAttribute('zoom-image', newZoomSrc);
} }
getWarehouseName(warehouseFk) {
this.showIcon = false;
const filter = {
where: {id: warehouseFk}
};
this.$http.get('Warehouses/findOne', {filter})
.then(res => {
this.warehouseText = this.$t('WarehouseFk', {
warehouseName: res.data.name
});
this.showIcon = true;
});
}
} }
Controller.$inject = ['$element', '$scope', '$rootScope']; Controller.$inject = ['$element', '$scope', '$rootScope'];

View File

@ -37,6 +37,7 @@ class Controller extends Section {
set warehouseFk(value) { set warehouseFk(value) {
if (value && value != this._warehouseFk) { if (value && value != this._warehouseFk) {
this._warehouseFk = value; this._warehouseFk = value;
this.card.warehouseFk = value;
this.$state.go(this.$state.current.name, { this.$state.go(this.$state.current.name, {
warehouseFk: value warehouseFk: value
@ -76,5 +77,8 @@ ngModule.vnComponent('vnItemDiary', {
controller: Controller, controller: Controller,
bindings: { bindings: {
item: '<' item: '<'
},
require: {
card: '?^vnItemCard'
} }
}); });

View File

@ -20,17 +20,18 @@
</vn-one> </vn-one>
<vn-one> <vn-one>
<p translate>Available</p> <p translate>Available</p>
<p>{{$ctrl.summary.available}} <p>{{$ctrl.summary.available}}</p>
</vn-one>
<vn-one>
<p>
<vn-icon <vn-icon
ng-if="$ctrl.warehouseText != null"
icon="info_outline" icon="info_outline"
vn-tooltip="{{'WarehouseFk' | translate:$ctrl.passRequirements}}" vn-tooltip="{{$ctrl.warehouseText}}"
pointer> pointer>
</vn-icon> </vn-icon>
</p> </p>
<!-- <div </vn-one>
info="Search ACL by model name">
'test'
</div> -->
</vn-horizontal> </vn-horizontal>
</vn-one> </vn-one>
<vn-one name="basicData"> <vn-one name="basicData">

View File

@ -7,6 +7,24 @@ class Controller extends Summary {
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => { this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
this.summary = response.data; this.summary = response.data;
}); });
this.$http.get('ItemConfigs/findOne')
.then(res => {
this.card.warehouseFk = res.data.warehouseFk;
this.getWarehouseName(this.card.warehouseFk);
});
}
getWarehouseName(warehouseFk) {
const filter = {
where: {id: warehouseFk}
};
this.$http.get('Warehouses/findOne', {filter})
.then(res => {
this.warehouseText = this.$t('WarehouseFk', {
warehouseName: res.data.name
});
});
} }
$onChanges() { $onChanges() {
@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', {
bindings: { bindings: {
item: '<', item: '<',
}, },
require: {
card: '?^vnItemCard'
}
}); });

View File

@ -1,2 +1 @@
WarehouseFk: > WarehouseFk: Calculated on the warehouse of {{ warehouseName }}
Calculated on the warehouse of {{ name }}

View File

@ -1,5 +1,4 @@
Barcode: Códigos de barras Barcode: Códigos de barras
Other data: Otros datos Other data: Otros datos
Go to the item: Ir al artículo Go to the item: Ir al artículo
WarehouseFk: > WarehouseFk: Calculado sobre el almacén de {{ warehouseName }}
Calculado sobre el almacén de {{ name }}

View File

@ -31,5 +31,9 @@ vn-item-summary {
&:nth-child(1) { &:nth-child(1) {
border-right: 1px solid white; border-right: 1px solid white;
} }
&:nth-child(2) {
border-right: 1px solid white;
}
} }
} }