Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2776-add_boss_summary
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
jorgebl 2021-02-24 16:14:41 +01:00
commit c9730929e8
6 changed files with 203 additions and 124 deletions

View File

@ -44,6 +44,10 @@ module.exports = Self => {
arg: 'description', arg: 'description',
type: 'String', type: 'String',
description: 'The item description', description: 'The item description',
}, {
arg: 'stemMultiplier',
type: 'Integer',
description: 'The item multiplier',
} }
], ],
returns: { returns: {
@ -80,16 +84,22 @@ module.exports = Self => {
: {or: [{'i.name': {like: `%${value}%`}}, codeWhere]}; : {or: [{'i.name': {like: `%${value}%`}}, codeWhere]};
case 'id': case 'id':
return {'i.id': value}; return {'i.id': value};
case 'description':
return {'i.description': {like: `%${value}%`}};
case 'categoryFk':
return {'ic.id': value};
case 'salesPersonFk':
return {'t.workerFk': value};
case 'typeFk':
return {'i.typeFk': value};
case 'isActive': case 'isActive':
return {'i.isActive': value}; return {'i.isActive': value};
case 'multiplier':
return {'i.stemMultiplier': value};
case 'typeFk':
return {'i.typeFk': value};
case 'category':
return {'ic.name': value};
case 'salesPersonFk':
return {'it.workerFk': value};
case 'origin':
return {'ori.code': value};
case 'niche':
return {'ip.code': value};
case 'intrastat':
return {'intr.description': value};
} }
}); });
filter = mergeFilters(filter, {where}); filter = mergeFilters(filter, {where});
@ -98,7 +108,8 @@ module.exports = Self => {
let stmt; let stmt;
stmt = new ParameterizedSQL( stmt = new ParameterizedSQL(
`SELECT i.id, `SELECT
i.id,
i.image, i.image,
i.name, i.name,
i.description, i.description,
@ -111,29 +122,30 @@ module.exports = Self => {
i.tag10, i.value10, i.tag10, i.value10,
i.subName, i.subName,
i.isActive, i.isActive,
t.name type,
t.workerFk buyerFk,
u.name userName,
intr.description AS intrastat,
i.stems, i.stems,
ori.code AS origin,
ic.name AS category,
i.density, i.density,
i.stemMultiplier, i.stemMultiplier,
i.typeFk,
it.name AS typeName,
it.workerFk AS buyerFk,
u.name AS userName,
ori.code AS origin,
ic.name AS category,
intr.description AS intrastat,
b.grouping, b.grouping,
b.packing, b.packing,
itn.code AS niche, @visibleCalc ip.code AS niche, @visibleCalc
FROM item i FROM item i
LEFT JOIN itemType t ON t.id = i.typeFk LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = t.categoryFk LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN worker w ON w.id = t.workerFk LEFT JOIN worker w ON w.id = it.workerFk
LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN account.user u ON u.id = w.userFk
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN producer pr ON pr.id = i.producerFk
LEFT JOIN origin ori ON ori.id = i.originFk LEFT JOIN origin ori ON ori.id = i.originFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk` LEFT JOIN itemPlacement ip ON ip.itemFk = i.id AND ip.warehouseFk = it.warehouseFk`
); );
if (ctx.args.tags) { if (ctx.args.tags) {

View File

@ -113,6 +113,12 @@
ng-model="$ctrl.item.stems" ng-model="$ctrl.item.stems"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number
vn-one
min="0"
label="Multiplier"
ng-model="$ctrl.item.stemMultiplier">
</vn-input-number>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-input-number <vn-input-number

View File

@ -10,3 +10,4 @@ New intrastat: Nuevo intrastat
Identifier: Identificador Identifier: Identificador
Fragile: Frágil Fragile: Frágil
Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...) Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...)
Multiplier: Multiplicador

View File

@ -15,11 +15,11 @@
<vn-th field="id" shrink>Id</vn-th> <vn-th field="id" shrink>Id</vn-th>
<vn-th field="grouping" shrink>Grouping</vn-th> <vn-th field="grouping" shrink>Grouping</vn-th>
<vn-th field="packing" shrink>Packing</vn-th> <vn-th field="packing" shrink>Packing</vn-th>
<vn-th field="description">Description</vn-th> <vn-th field="name">Description</vn-th>
<vn-th field="stems" shrink>Stems</vn-th> <vn-th field="stems" shrink>Stems</vn-th>
<vn-th field="size" shrink>Size</vn-th> <vn-th field="size" shrink>Size</vn-th>
<vn-th field="niche" shrink>Niche</vn-th> <vn-th field="niche" shrink>Niche</vn-th>
<vn-th field="type" shrink>Type</vn-th> <vn-th field="typeFk" shrink>Type</vn-th>
<vn-th field="category" shrink>Category</vn-th> <vn-th field="category" shrink>Category</vn-th>
<vn-th field="intrastat" shrink>Intrastat</vn-th> <vn-th field="intrastat" shrink>Intrastat</vn-th>
<vn-th field="origin" shrink>Origin</vn-th> <vn-th field="origin" shrink>Origin</vn-th>
@ -64,8 +64,8 @@
<vn-td shrink>{{::item.stems}}</vn-td> <vn-td shrink>{{::item.stems}}</vn-td>
<vn-td shrink>{{::item.size}}</vn-td> <vn-td shrink>{{::item.size}}</vn-td>
<vn-td shrink>{{::item.niche}}</vn-td> <vn-td shrink>{{::item.niche}}</vn-td>
<vn-td shrink title="{{::item.type}}"> <vn-td shrink title="{{::item.typeName}}">
{{::item.type}} {{::item.typeName}}
</vn-td> </vn-td>
<vn-td shrink title="{{::item.category}}"> <vn-td shrink title="{{::item.category}}">
{{::item.category}} {{::item.category}}
@ -128,3 +128,30 @@
item="$ctrl.itemSelected"> item="$ctrl.itemSelected">
</vn-item-summary> </vn-item-summary>
</vn-popup> </vn-popup>
<vn-contextmenu
vn-id="contextmenu"
targets="['vn-data-viewer']"
model="model"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-menu>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.filterBySelection()">
Filter by selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.excludeSelection()">
Exclude selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.removeFilter()">
Remove filter
</vn-item>
<vn-item translate
ng-click="contextmenu.removeAllFilters()">
Remove all filters
</vn-item>
</slot-menu>
</vn-contextmenu>

View File

@ -11,6 +11,36 @@ class Controller extends Section {
}; };
} }
exprBuilder(param, value) {
switch (param) {
case 'category':
return {'ic.name': value};
case 'salesPersonFk':
return {'it.workerFk': value};
case 'grouping':
return {'b.grouping': value};
case 'packing':
return {'b.packing': value};
case 'origin':
return {'ori.code': value};
case 'niche':
return {'ip.code': value};
case 'typeFk':
return {'i.typeFk': value};
case 'intrastat':
return {'intr.description': value};
case 'id':
case 'size':
case 'name':
case 'subname':
case 'isActive':
case 'density':
case 'stemMultiplier':
case 'stems':
return {[`i.${param}`]: value};
}
}
onCloneAccept(itemFk) { onCloneAccept(itemFk) {
return this.$http.post(`Items/${itemFk}/clone`) return this.$http.post(`Items/${itemFk}/clone`)
.then(res => { .then(res => {

View File

@ -55,6 +55,9 @@
<vn-label-value label="stems" <vn-label-value label="stems"
value="{{$ctrl.summary.item.stems}}"> value="{{$ctrl.summary.item.stems}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Multiplier"
value="{{$ctrl.summary.item.stemMultiplier}}">
</vn-label-value>
<vn-label-value label="Buyer"> <vn-label-value label="Buyer">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"