Merge pull request '2920-item_descriptor_user_warehouse' (#630) from 2920-item_descriptor_user_warehouse into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #630
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2021-05-24 09:23:33 +00:00
commit ec7cc169f5
32 changed files with 161 additions and 94 deletions

View File

@ -892,7 +892,7 @@ export default {
penultimateMondayOfJanuary: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(22) > div',
lastMondayOfMarch: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
fistMondayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
secondFridayOfJun: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div',
secondFridayOfJun: 'vn-worker-calendar vn-calendar:nth-child(7) section:nth-child(12) > div',
secondTuesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
secondWednesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
secondThursdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',

View File

@ -71,7 +71,7 @@
vn-repeat-last on-last="$ctrl.focusLastInput()">
<vn-td number>
<span
ng-click="descriptor.show($event, saleClaimed.sale.itemFk)"
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk)"
class="link">
{{::saleClaimed.sale.itemFk | zeroFill:6}}
</span>
@ -154,10 +154,11 @@
</div>
</vn-popover>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover>
<vn-confirm
vn-id="update-greuge"

View File

@ -129,7 +129,8 @@
</tpl-body>
</vn-dialog>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-popover
class="edit"

View File

@ -220,11 +220,12 @@
</vn-horizontal>
</vn-card>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover>

View File

@ -82,7 +82,8 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="item-descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticket-descriptor">

View File

@ -202,7 +202,8 @@
</vn-vertical>
</div>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-confirm

View File

@ -195,8 +195,9 @@
</tpl-buttons>
</vn-dialog>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-entry-descriptor-popover
vn-id="entryDescriptor">
vn-id="entry-descriptor">
</vn-entry-descriptor-popover>

View File

@ -160,9 +160,10 @@
</vn-horizontal>
</vn-card>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-travel-descriptor-popover
vn-id="travelDescriptor">
vn-id="travel-descriptor">
</vn-travel-descriptor-popover>

View File

@ -1,5 +1,5 @@
module.exports = Self => {
Self.remoteMethod('getSummary', {
Self.remoteMethodCtx('getSummary', {
description: 'return the item information',
accessType: 'READ',
accepts: [{
@ -19,7 +19,7 @@ module.exports = Self => {
}
});
Self.getSummary = async id => {
Self.getSummary = async(ctx, id) => {
let promises = [];
let summary = {};
const models = Self.app.models;
@ -102,7 +102,9 @@ module.exports = Self => {
[summary.botanical] = res[2];
summary.niches = res[3];
res = await models.Item.getVisibleAvailable(summary.item.id, summary.item.itemType().warehouseFk);
const userConfig = await models.UserConfig.getUserConfig(ctx);
res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk);
summary.available = res.available;
summary.visible = res.visible;

View File

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

View File

@ -21,7 +21,16 @@ class Controller extends Descriptor {
set entity(value) {
super.entity = value;
this.updateStock();
if (this.warehouseFk) this.updateStock();
}
get warehouseFk() {
return this._warehouseFk;
}
set warehouseFk(value) {
this._warehouseFk = value;
if (value) this.updateStock();
}
loadData() {
@ -35,7 +44,7 @@ class Controller extends Descriptor {
if (!this.item) return;
const params = {
warehouseFk: this.item.itemType.warehouseFk,
warehouseFk: this.warehouseFk,
dated: this.dated
};
@ -90,6 +99,7 @@ ngModule.vnComponent('vnItemDescriptor', {
bindings: {
item: '<',
dated: '<',
cardReload: '&'
cardReload: '&',
warehouseFk: '<?'
}
});

View File

@ -155,5 +155,6 @@
</vn-card>
</div>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -112,10 +112,11 @@
<vn-float-button icon="add"></vn-float-button>
</a>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>
<vn-confirm
vn-id="clone"

View File

@ -107,13 +107,14 @@
</vn-card>
</vn-data-viewer>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-dialog
vn-id="denyDialog"

View File

@ -23,7 +23,7 @@
<vn-tr ng-repeat="waste in detail.lines">
<vn-td shrink>
<span
ng-click="descriptor.show($event, waste.itemFk)"
ng-click="itemDescriptor.show($event, waste.itemFk)"
class="link">
{{::waste.itemFk}}
</span>
@ -38,5 +38,6 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -63,9 +63,10 @@
</vn-horizontal>
</vn-data-viewer>
<vn-order-prices-popover
vn-id="pricesPopover"
vn-id="prices-popover"
order="$ctrl.order">
</vn-order-prices-popover>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -37,7 +37,7 @@
on-error-src/>
</vn-td>
<vn-td number>
<span ng-click="descriptor.show($event, row.itemFk)"
<span ng-click="itemDescriptor.show($event, row.itemFk)"
class="link">
{{::row.itemFk | zeroFill:6}}
</span>
@ -83,7 +83,8 @@
fixed-bottom-right>
</vn-float-button>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-confirm
vn-id="delete-row"

View File

@ -93,7 +93,7 @@
</vn-td>
<vn-td shrink>
<span
ng-click="descriptor.show($event, row.itemFk)"
ng-click="itemDescriptor.show($event, row.itemFk)"
class="link">
{{::row.itemFk | zeroFill:6}}
</span>
@ -119,8 +119,9 @@
</vn-horizontal>
</vn-card>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-client-descriptor-popover
vn-id="clientDescriptor">
vn-id="client-descriptor">
</vn-client-descriptor-popover>

View File

@ -34,7 +34,7 @@
<vn-tr ng-repeat="row in rows">
<vn-td shrink number>
<span
ng-click="descriptor.show($event, row.itemFk)"
ng-click="itemDescriptor.show($event, row.itemFk)"
class="link">
{{::row.itemFk}}
</span>
@ -58,6 +58,7 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -24,7 +24,7 @@
<tr class="initial">
<td rowspan="{{::sale.components.length + 1}}" number>
<span
ng-click="descriptor.show($event, sale.itemFk, sale.id)"
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link">
{{sale.itemFk | zeroFill:6}}
</span>
@ -103,11 +103,11 @@
</div>
</vn-side-menu>
<vn-item-descriptor-popover
vn-id="descriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
<vn-zone-descriptor-popover
vn-id="zoneDescriptor">
vn-id="zone-descriptor">
</vn-zone-descriptor-popover>

View File

@ -57,15 +57,15 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="itemDescriptor"
warehouse-fk="this.ticket.warehouseFk",
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk",
ticket-fk="$ctrl.ticket.id">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>
<vn-confirm
vn-id="deleteExpedition"
vn-id="delete-expedition"
on-accept="$ctrl.onDialogAccept($data)"
question="Delete expedition"
message="Are you sure you want to delete this expedition?">

View File

@ -25,7 +25,7 @@
</div>
<div class="description">
<h3>
<span class="link" ng-click="descriptor.show($event, sale.item.id)">
<span class="link" ng-click="itemDescriptor.show($event, sale.item.id)">
{{::sale.item.name}}
</span>
</h3>
@ -63,5 +63,6 @@
<vn-pagination model="model"></vn-pagination>
</vn-vertical>
<vn-item-descriptor-popover
vn-id="descriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -17,5 +17,8 @@ class Controller extends Section {
ngModule.vnComponent('vnTicketPicture', {
template: require('./index.html'),
controller: Controller
controller: Controller,
bindings: {
ticket: '<'
}
});

View File

@ -24,7 +24,7 @@
<vn-th>Atender</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Sale id</vn-th>
<vn-th number>Item id</vn-th>
<vn-th number>Ok</vn-th>
</vn-tr>
</vn-thead>
@ -101,10 +101,11 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>
<a ui-sref="ticket.card.request.create"
vn-tooltip="New request"

View File

@ -70,5 +70,8 @@ class Controller extends Section {
ngModule.vnComponent('vnTicketRequestIndex', {
template: require('./index.html'),
controller: Controller
controller: Controller,
bindings: {
ticket: '<'
}
});

View File

@ -37,17 +37,20 @@
"abstract": true,
"component": "vn-ticket",
"description": "Tickets"
}, {
},
{
"url": "/index?q",
"state": "ticket.index",
"component": "vn-ticket-index",
"description": "Tickets"
}, {
},
{
"url": "/:id?sendSMS&phone&message",
"state": "ticket.card",
"abstract": true,
"component": "vn-ticket-card"
}, {
},
{
"url": "/summary",
"state": "ticket.card.summary",
"component": "vn-ticket-summary",
@ -55,7 +58,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/basic-data",
"state": "ticket.card.basicData",
"component": "vn-ticket-basic-data",
@ -63,7 +67,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/step-one",
"state": "ticket.card.basicData.stepOne",
"component": "vn-ticket-basic-data-step-one",
@ -71,7 +76,8 @@
"params": {
"ticket": "$ctrl.data"
}
}, {
},
{
"url" : "/step-two",
"state": "ticket.card.basicData.stepTwo",
"component": "vn-ticket-basic-data-step-two",
@ -79,7 +85,8 @@
"params": {
"ticket": "$ctrl.data"
}
}, {
},
{
"url" : "/sale",
"state": "ticket.card.sale",
"component": "vn-ticket-sale",
@ -87,7 +94,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url": "/observation",
"state": "ticket.card.observation",
"component": "vn-ticket-observation",
@ -95,7 +103,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url": "/volume",
"state": "ticket.card.volume",
"component": "vn-ticket-volume",
@ -103,7 +112,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url": "/expedition",
"state": "ticket.card.expedition",
"component": "vn-ticket-expedition",
@ -111,7 +121,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/package",
"state": "ticket.card.package",
"component": "vn-ticket-package",
@ -119,12 +130,14 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url": "/tracking",
"state": "ticket.card.tracking",
"abstract": true,
"component": "ui-view"
}, {
},
{
"url" : "/index",
"state": "ticket.card.tracking.index",
"component": "vn-ticket-tracking-index",
@ -132,7 +145,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url": "/edit",
"state": "ticket.card.tracking.edit",
"component": "vn-ticket-tracking-edit",
@ -141,7 +155,8 @@
"ticket": "$ctrl.ticket"
},
"acl": ["production", "administrative", "salesPerson"]
}, {
},
{
"url" : "/sale-checked",
"state": "ticket.card.saleChecked",
"component": "vn-ticket-sale-checked",
@ -149,7 +164,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/components",
"state": "ticket.card.components",
"component": "vn-ticket-components",
@ -157,7 +173,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/sale-tracking",
"state": "ticket.card.saleTracking",
"component": "vn-ticket-sale-tracking",
@ -165,7 +182,8 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/picture",
"state": "ticket.card.picture",
"component": "vn-ticket-picture",
@ -173,43 +191,54 @@
"params": {
"ticket": "$ctrl.ticket"
}
}, {
},
{
"url" : "/log",
"state": "ticket.card.log",
"component": "vn-ticket-log",
"description": "Log"
}, {
},
{
"url": "/weekly",
"state": "ticket.weekly",
"abstract": true,
"component": "ui-view",
"description": "Weekly"
}, {
},
{
"url": "/index?q",
"state": "ticket.weekly.index",
"component": "vn-ticket-weekly-index",
"description": "Weekly tickets"
}, {
},
{
"url": "/service",
"state": "ticket.card.service",
"component": "vn-ticket-service",
"description": "Service"
}, {
},
{
"url": "/request",
"state": "ticket.card.request",
"abstract": true,
"component": "ui-view"
}, {
},
{
"url" : "/index",
"state": "ticket.card.request.index",
"component": "vn-ticket-request-index",
"description": "Purchase request"
}, {
"description": "Purchase request",
"params": {
"ticket": "$ctrl.ticket"
}
},
{
"url" : "/create",
"state": "ticket.card.request.create",
"component": "vn-ticket-request-create",
"description": "New purchase request"
}, {
},
{
"url": "/create?clientFk",
"state": "ticket.create",
"component": "vn-ticket-create",

View File

@ -29,7 +29,7 @@
</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showDescriptor($event, sale)"
ng-click="$ctrl.showItemDescriptor($event, sale)"
class="link">
{{::sale.itemFk | zeroFill:6}}
</span>
@ -52,7 +52,7 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="descriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk"
ticket-fk="$ctrl.ticket.id">
</vn-item-descriptor-popover>

View File

@ -17,7 +17,7 @@ class Controller extends Section {
]
};
}
showDescriptor(event, sale) {
showItemDescriptor(event, sale) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
@ -29,7 +29,7 @@ class Controller extends Section {
tooltip: 'Item diary'
}
};
this.$.descriptor.show(event.target, sale.itemFk);
this.$.itemDescriptor.show(event.target, sale.itemFk);
}
}

View File

@ -67,9 +67,9 @@
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="itemDescriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
vn-id="worker-descriptor">
</vn-worker-descriptor-popover>

View File

@ -100,7 +100,7 @@
</vn-td>
<vn-td shrink>
<span class="link" ng-if="sale.id"
ng-click="descriptor.show($event, sale.itemFk, sale.id)">
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)">
{{sale.itemFk}}
</span>
<vn-autocomplete ng-if="!sale.id" class="dense"
@ -190,7 +190,7 @@
fixed-bottom-right>
</vn-float-button>
<vn-item-descriptor-popover
vn-id="descriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk",
ticket-fk="$ctrl.ticket.id">
</vn-item-descriptor-popover>

View File

@ -142,7 +142,7 @@
</vn-td>
<vn-td number shrink>
<span
ng-click="descriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
class="link">
{{sale.itemFk | zeroFill:6}}
</span>
@ -258,7 +258,7 @@
<vn-td number>
<span
ng-show="::request.saleFk"
ng-click="descriptor.show($event, request.sale.itemFk, request.sale.id)"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link">
{{request.sale.itemFk | zeroFill:6}}
</span>
@ -278,10 +278,10 @@
</vn-horizontal>
</vn-card>
<vn-route-descriptor-popover
vn-id="routeDescriptor">
vn-id="route-descriptor">
</vn-route-descriptor-popover>
<vn-item-descriptor-popover
vn-id="descriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk",
ticket-fk="$ctrl.ticket.id">
</vn-item-descriptor-popover>

View File

@ -37,7 +37,7 @@
<vn-tr ng-repeat="sale in $ctrl.sales">
<vn-td number>
<span
ng-click="descriptor.show($event, sale.itemFk, sale.id)"
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link">
{{sale.itemFk | zeroFill:6}}
</span>
@ -63,7 +63,7 @@
</vn-card>
</vn-vertical>
<vn-item-descriptor-popover
vn-id="descriptor"
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>