From f1c481de64f8cc915466539471d424a41ffd8126 Mon Sep 17 00:00:00 2001 From: jorgebl Date: Wed, 24 Feb 2021 14:49:58 +0100 Subject: [PATCH] QA refactor --- modules/item/back/methods/item/filter.js | 43 ++-- modules/item/front/basic-data/index.html | 3 +- modules/item/front/index/index.html | 249 ++++++++++++----------- modules/item/front/index/index.js | 6 +- 4 files changed, 152 insertions(+), 149 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 000d9bb8e2..eba0b0f918 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -84,20 +84,20 @@ module.exports = Self => { : {or: [{'i.name': {like: `%${value}%`}}, codeWhere]}; case 'id': return {'i.id': value}; - case 'category': - return {'ic.name': value}; - case 'salesPersonFk': - return {'t.workerFk': value}; - case 'type': - return {'i.typeFk': value}; case 'isActive': 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 {'itn.code': value}; + return {'ip.code': value}; case 'intrastat': return {'intr.description': value}; } @@ -108,7 +108,8 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL( - `SELECT i.id, + `SELECT + i.id, i.image, i.name, i.description, @@ -121,30 +122,30 @@ module.exports = Self => { i.tag10, i.value10, i.subName, i.isActive, - t.name type, - i.typeFk as type, - t.workerFk buyerFk, - u.name userName, - intr.description AS intrastat, i.stems, - ori.code AS origin, - ic.name AS category, i.density, 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.packing, - itn.code AS niche, @visibleCalc + ip.code AS niche, @visibleCalc FROM item i - LEFT JOIN itemType t ON t.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = t.categoryFk - LEFT JOIN worker w ON w.id = t.workerFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN worker w ON w.id = it.workerFk LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk 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 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) { diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 1fa9139400..cec7a063f8 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -117,8 +117,7 @@ vn-one min="0" label="Multiplier" - ng-model="$ctrl.item.stemMultiplier" - rule> + ng-model="$ctrl.item.stemMultiplier"> diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 21227ad959..590a6fdf37 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -5,107 +5,107 @@ model="model" class="vn-w-xl vn-mb-xl"> - - - - - Id - Grouping - Packing - Description - Stems - Size - Niche - Type - Category - Intrastat - Origin - Buyer - Density - Multiplier - Active - - - - - - - - - - - {{::item.id}} - - - {{::item.grouping | dashIfEmpty}} - {{::item.packing | dashIfEmpty}} - - {{::item.name}} - -

{{::item.subName}}

-
- - -
- {{::item.stems}} - {{::item.size}} - {{::item.niche}} - - {{::item.type}} - - - {{::item.category}} - - - {{::item.intrastat}} - - {{::item.origin}} - - - {{::item.userName}} - - - {{::item.density}} - {{::item.stemMultiplier}} - - - - - - - - - - - - -
-
-
+ + + + + Id + Grouping + Packing + Description + Stems + Size + Niche + Type + Category + Intrastat + Origin + Buyer + Density + Multiplier + Active + + + + + + + + + + + {{::item.id}} + + + {{::item.grouping | dashIfEmpty}} + {{::item.packing | dashIfEmpty}} + + {{::item.name}} + +

{{::item.subName}}

+
+ + +
+ {{::item.stems}} + {{::item.size}} + {{::item.niche}} + + {{::item.typeName}} + + + {{::item.category}} + + + {{::item.intrastat}} + + {{::item.origin}} + + + {{::item.userName}} + + + {{::item.density}} + {{::item.stemMultiplier}} + + + + + + + + + + + + +
+
+
@@ -128,27 +128,30 @@ item="$ctrl.itemSelected"> - - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - + + + Filter by selection + + + Exclude selection + + + Remove filter + + + Remove all filters + + \ No newline at end of file diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 8a510c3a18..175beb88a0 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -16,7 +16,7 @@ class Controller extends Section { case 'category': return {'ic.name': value}; case 'salesPersonFk': - return {'t.workerFk': value}; + return {'it.workerFk': value}; case 'grouping': return {'b.grouping': value}; case 'packing': @@ -24,8 +24,8 @@ class Controller extends Section { case 'origin': return {'ori.code': value}; case 'niche': - return {'itn.code': value}; - case 'type': + return {'ip.code': value}; + case 'typeFk': return {'i.typeFk': value}; case 'intrastat': return {'intr.description': value};