From 262e46d7c9e9d77927c3ec08948cdbac77a80ad2 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 8 Nov 2021 17:46:40 +0100 Subject: [PATCH] added autocompletes to item index --- front/core/components/smart-table/index.html | 2 +- .../core/components/smart-table/locale/es.yml | 2 +- modules/item/back/methods/item/filter.js | 2 +- modules/item/back/models/intrastat.json | 4 +-- modules/item/back/models/origin.json | 6 ++-- modules/item/front/index/index.html | 2 +- modules/item/front/index/index.js | 33 ++++++++++++++++--- modules/item/front/search-panel/index.html | 2 +- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/front/core/components/smart-table/index.html b/front/core/components/smart-table/index.html index a4c26459f..9cfcf7849 100644 --- a/front/core/components/smart-table/index.html +++ b/front/core/components/smart-table/index.html @@ -11,7 +11,7 @@ < Showing {{model.data.length}} - rows + results > diff --git a/front/core/components/smart-table/locale/es.yml b/front/core/components/smart-table/locale/es.yml index b5cc554ee..f65df07b7 100644 --- a/front/core/components/smart-table/locale/es.yml +++ b/front/core/components/smart-table/locale/es.yml @@ -5,4 +5,4 @@ Save data: Guardar datos Shown columns: Columnas visibles Check the columns you want to see: Marca las columnas que quieres ver Showing: Mostrando -rows: filas \ No newline at end of file +results: resultados \ No newline at end of file diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index cff36a223..8cfefac9f 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -113,7 +113,7 @@ module.exports = Self => { return {'i.typeFk': value}; case 'categoryFk': return {'ic.id': value}; - case 'salesPersonFk': + case 'buyerFk': return {'it.workerFk': value}; case 'origin': return {'ori.code': value}; diff --git a/modules/item/back/models/intrastat.json b/modules/item/back/models/intrastat.json index e536e2581..18a964e7b 100644 --- a/modules/item/back/models/intrastat.json +++ b/modules/item/back/models/intrastat.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/item/back/models/origin.json b/modules/item/back/models/origin.json index c381600bf..d2fe3fdf0 100644 --- a/modules/item/back/models/origin.json +++ b/modules/item/back/models/origin.json @@ -8,15 +8,15 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "code": { - "type": "String" + "type": "string" }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 9fa03eabb..6fa3ae8c2 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -42,7 +42,7 @@ Origin - + Buyer diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 86e67f919..3b2b71af8 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -5,10 +5,6 @@ import './style.scss'; class Controller extends Section { constructor($element, $) { super($element, $); - /* this.showFields = { - id: false, - actions: false - }; */ this.smartTableOptions = { activeButtons: { @@ -20,12 +16,39 @@ class Controller extends Section { field: 'category', autocomplete: { url: 'ItemCategories', + valueField: 'name', } }, { field: 'origin', autocomplete: { url: 'Origins', + showField: 'name', + valueField: 'code' + } + }, + { + field: 'typeFk', + autocomplete: { + url: 'ItemTypes', + } + }, + { + field: 'intrastat', + autocomplete: { + url: 'Intrastats', + showField: 'description', + valueField: 'description' + } + }, + { + field: 'buyerFk', + autocomplete: { + url: 'Workers/activeWithRole', + where: `{role: {inq: ['logistic', 'buyer']}}`, + searchFunction: '{firstName: $search}', + showField: 'nickname', + valueField: 'id', } }, ] @@ -36,7 +59,7 @@ class Controller extends Section { switch (param) { case 'category': return {'ic.name': value}; - case 'salesPersonFk': + case 'buyerFk': return {'it.workerFk': value}; case 'grouping': return {'b.grouping': value}; diff --git a/modules/item/front/search-panel/index.html b/modules/item/front/search-panel/index.html index 518062eba..94e4b6d07 100644 --- a/modules/item/front/search-panel/index.html +++ b/modules/item/front/search-panel/index.html @@ -41,7 +41,7 @@