feat: el descriptor coge el warehouseFk dependiendo de la sección
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-01-31 09:28:28 +01:00
parent 366748a136
commit 19120ef102
3 changed files with 10 additions and 4 deletions

View File

@ -101,8 +101,8 @@ module.exports = Self => {
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
console.log(userConfig.warehouseFk); console.log(userConfig.warehouseFk);
const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions); const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions);
console.log(company.warehouseFk);
res = await models.Item.getVisibleAvailable(summary.item.id, company.warehouseFk, undefined, myOptions); res = await models.Item.getVisibleAvailable(summary.item.id, 1, undefined, myOptions);
summary.available = res.available; summary.available = res.available;
summary.visible = res.visible; summary.visible = res.visible;

View File

@ -1,6 +1,6 @@
<vn-portal slot="menu"> <vn-portal slot="menu">
<vn-item-descriptor <vn-item-descriptor
warehouse-fk="$ctrl.vnConfig.warehouseFk" warehouse-fk="$ctrl.getWarehouseFk()"
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,6 +2,12 @@ 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;
return this.vnConfig.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);