From c58d094a3ca94d5744211f55670229af22d955c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Thu, 31 Aug 2023 10:46:26 +0200
Subject: [PATCH] fix customFields not displayed in popup & map custom button
 above loader

---
 src/components/Map/Geocoder.vue    |  2 +-
 src/components/Map/Geolocation.vue |  2 +-
 src/services/map-service.js        | 18 ++++++------------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/components/Map/Geocoder.vue b/src/components/Map/Geocoder.vue
index 9a7c06d2..52e620ee 100644
--- a/src/components/Map/Geocoder.vue
+++ b/src/components/Map/Geocoder.vue
@@ -215,7 +215,7 @@ export default {
   // zoom buttons are 60px high, geolocation and full screen button is 34px high with borders
   top: calc(1.6em + 60px + 34px + 34px);
   pointer-events: auto;
-  z-index: 1000;
+  z-index: 999;
   border: 2px solid rgba(0,0,0,.2);
   background-clip: padding-box;
   padding: 0;
diff --git a/src/components/Map/Geolocation.vue b/src/components/Map/Geolocation.vue
index ada3189b..5f921709 100644
--- a/src/components/Map/Geolocation.vue
+++ b/src/components/Map/Geolocation.vue
@@ -36,7 +36,7 @@ export default {
 div.geolocation-container {
   position: absolute;
   right: 6px;
-  z-index: 1000;
+  z-index: 999;
   border: 2px solid rgba(0,0,0,.2);
   background-clip: padding-box;
   padding: 0;
diff --git a/src/services/map-service.js b/src/services/map-service.js
index 1d3c2e8a..3d8d4e7a 100644
--- a/src/services/map-service.js
+++ b/src/services/map-service.js
@@ -629,19 +629,13 @@ const mapService = {
 
   createCustomFiedsContent(featureType, feature) {
     const { customfield_set } = featureType;
-    // create an html row for a customField
-    const rowTemplate = (customfield) => {
-      const { label, name } = customfield;
-      const value = feature.getProperties()[name];
-      return label && value !== undefined ? `<div class="customField-row">${label} : ${value}</div>` : '';
-    };
-    // generate html for each customField set to be displayed from featureType display config
+    // generate html for each customField configured to be displayed
     let rows = '';
-    for (const customField of customfield_set) {
-      if (customField.value !== null && customField.value !== undefined
-        && featureType.displayed_fields.includes(customField.name))
-      {
-        rows += rowTemplate(customField);
+    for (const { label, name } of customfield_set) {
+      const value = feature.getProperties()[name];
+      // check if the value is not null nor undefined (to allow false value if boolean)
+      if (featureType.displayed_fields.includes(name) && value !== null && value !== undefined) {
+        rows += `<div class="customField-row">${label} : ${value}</div>`;
       }
     }
     // wrap all rows into customFields container
-- 
GitLab