From 1e587be2ed3e70fd990482a62e683908115849c2 Mon Sep 17 00:00:00 2001
From: vicent <vicent@verdnatura.es>
Date: Mon, 28 Mar 2022 11:57:19 +0200
Subject: [PATCH] (fix): filter repaired

---
 .../travel/back/methods/travel/extraCommunityFilter.js    | 1 +
 modules/travel/front/extra-community/index.html           | 2 +-
 modules/travel/front/extra-community/index.js             | 4 +++-
 modules/travel/front/extra-community/style.scss           | 4 ++--
 .../templates/reports/extra-community/extra-community.js  | 8 ++++++--
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js
index dfefec8774..af6e1ec0a5 100644
--- a/modules/travel/back/methods/travel/extraCommunityFilter.js
+++ b/modules/travel/back/methods/travel/extraCommunityFilter.js
@@ -148,6 +148,7 @@ module.exports = Self => {
 
         stmt.merge(conn.makeWhere(filter.where));
         stmt.merge(conn.makeGroupBy('t.id'));
+        stmt.merge(conn.makeOrderBy(filter.order));
         stmt.merge(conn.makeLimit(filter));
         stmts.push(stmt);
 
diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html
index 6c56e7424d..0b94c6c1e6 100644
--- a/modules/travel/front/extra-community/index.html
+++ b/modules/travel/front/extra-community/index.html
@@ -2,7 +2,7 @@
     vn-id="model"
     url="Travels/extraCommunityFilter"
     data="travels"
-    order="landed ASC, shipped ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
+    order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
     limit="20"
     auto-load="true">
 </vn-crud-model>
diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js
index 44527d45ee..d78561ddf6 100644
--- a/modules/travel/front/extra-community/index.js
+++ b/modules/travel/front/extra-community/index.js
@@ -36,8 +36,10 @@ class Controller extends Section {
         const userParams = this.$.model.userParams;
         const hasLanded = userParams.landedFrom || userParams.landedTo;
         const hasShipped = userParams.shippedFrom || userParams.shippedTo;
+        const hasContinent = userParams.continent;
+        const hasWarehouseOut = userParams.warehouseOutFk;
 
-        return hasLanded || hasShipped;
+        return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
     }
 
     findDraggable($event) {
diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss
index 41544242d3..f903f94eac 100644
--- a/modules/travel/front/extra-community/style.scss
+++ b/modules/travel/front/extra-community/style.scss
@@ -9,8 +9,8 @@ vn-travel-extra-community {
         padding-bottom: 7px;
         padding-bottom: 4px;
         font-weight: lighter;
-        background-color: #fde6ca;
-        color: $color-font-light;
+        background-color: $color-bg;
+        color: white;
         border-bottom: 1px solid #f7931e;
         white-space: nowrap;
         overflow: hidden;
diff --git a/print/templates/reports/extra-community/extra-community.js b/print/templates/reports/extra-community/extra-community.js
index c9d2fb2f3a..5c8960c12d 100755
--- a/print/templates/reports/extra-community/extra-community.js
+++ b/print/templates/reports/extra-community/extra-community.js
@@ -12,7 +12,8 @@ module.exports = {
             landedTo: this.landedEnd,
             shippedFrom: this.shippedStart,
             shippedTo: this.shippedEnd,
-            continent: this.continent
+            continent: this.continent,
+            warehouseOutFk: this.warehouseOutFk
         };
 
         const travels = await this.fetchTravels(args);
@@ -73,6 +74,8 @@ module.exports = {
                     return `t.landed <= ${value}`;
                 case 'continent':
                     return `cnt.code = ${value}`;
+                case 'warehouseOutFk':
+                    return `wo.id = ${value}`;
                 }
             });
 
@@ -96,6 +99,7 @@ module.exports = {
         'landedTo',
         'shippedFrom',
         'shippedTo',
-        'continent'
+        'continent',
+        'warehouseOutFk'
     ]
 };