From 9b5e9a617dd9cb9ac7a17984d3eae499596de94d Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Jan 2022 08:31:30 +0100 Subject: [PATCH] feat(entry_basic-data): add new filter in travels --- modules/entry/front/basic-data/index.html | 99 ++++++++++++++++++++++- modules/entry/front/basic-data/index.js | 62 +++++++++++++- modules/entry/front/basic-data/style.scss | 3 + 3 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 modules/entry/front/basic-data/style.scss diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index 4b7661a8f..f75834045 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -35,6 +35,13 @@ {{::agencyModeName}} - {{::warehouseInName}} ({{::shipped | date: 'dd/MM/yyyy'}}) → {{::warehouseOutName}} ({{::landed | date: 'dd/MM/yyyy'}}) + + + + @@ -121,4 +128,94 @@ ng-click="watcher.loadOriginalData()"> - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Agency + Warehouse Out + Warehouse In + Shipped + Landed + + + + + + + {{::travel.id}} + + + {{::travel.agency.name}} + {{::travel.warehouseOut.name}} + {{::travel.warehouseIn.name}} + {{::travel.shipped | date: 'dd/MM/yyyy'}} + {{::travel.landed | date: 'dd/MM/yyyy'}} + + + + + + + + \ No newline at end of file diff --git a/modules/entry/front/basic-data/index.js b/modules/entry/front/basic-data/index.js index 141a365fa..80870c3f3 100644 --- a/modules/entry/front/basic-data/index.js +++ b/modules/entry/front/basic-data/index.js @@ -1,10 +1,68 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import './style.scss'; +class Controller extends Section { + showFilterDialog(travel) { + this.activeTravel = travel; + this.travelFilterParams = {}; + this.travelFilter = { + include: [ + { + relation: 'agency', + scope: { + fields: ['name'] + } + }, + { + relation: 'warehouseIn', + scope: { + fields: ['name'] + } + }, + { + relation: 'warehouseOut', + scope: { + fields: ['name'] + } + } + ] + }; + + this.$.filterDialog.show(); + } + + selectTravel(id) { + this.entry.travelFk = id; + this.$.filterDialog.hide(); + } + + filter() { + const filter = this.travelFilter; + const params = this.travelFilterParams; + const where = {}; + for (let key in params) { + const value = params[key]; + if (!value) continue; + + switch (key) { + case 'agencyFk': + case 'warehouseInFk': + case 'warehouseOutFk': + case 'shipped': + case 'landed': + where[key] = value; + } + } + + filter.where = where; + this.$.travelsModel.applyFilter(filter); + } +} ngModule.vnComponent('vnEntryBasicData', { template: require('./index.html'), - controller: Section, bindings: { entry: '<' - } + }, + controller: Controller }); diff --git a/modules/entry/front/basic-data/style.scss b/modules/entry/front/basic-data/style.scss new file mode 100644 index 000000000..508aa9091 --- /dev/null +++ b/modules/entry/front/basic-data/style.scss @@ -0,0 +1,3 @@ +.travelFilter{ + width: 950px; +}