From 7c7d148e3662ae4f4ef0e19dc2d484626d171733 Mon Sep 17 00:00:00 2001
From: antoine37120 <ant.dupre@gmail.com>
Date: Sat, 23 Sep 2023 14:03:22 +0200
Subject: [PATCH] fix: null on territory contacts ebe phon and mail

---
 src/widjets-display-user-tzcld.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/widjets-display-user-tzcld.js b/src/widjets-display-user-tzcld.js
index 36bd491..f021831 100644
--- a/src/widjets-display-user-tzcld.js
+++ b/src/widjets-display-user-tzcld.js
@@ -61,7 +61,13 @@ import("./utils.js").then((utils) => {
               }
               let render = ``;
               for(let phone of tzcldprofile.phones) {
-                render +=  `<div class="phone margin-bottom-xxsmall">${await phone.phone} ${await phone.phone_type}</div>`;
+                let phoneType = '' ;
+                if (await phone.phone_type != null) {
+                  phoneType = await phone.phone_type;
+                }
+                if (await phone.phone != null) {
+                  render +=  `<div class="phone margin-bottom-xxsmall">${await phone.phone} ${await phoneType}</div>`;
+                }
               }
              
               this.element.innerHTML = render;
@@ -94,7 +100,14 @@ import("./utils.js").then((utils) => {
               }
               let render = ``;
               for(let email of tzcldprofile.emails) {
-                render +=  `<div class="email margin-bottom-xxsmall"><a class="link" href="mailto:${await email.email}">${await email.email}</a> ${await email.email_type}</div>`;
+                let emailType = '' ;
+                if (await email.email_type != null) {
+                  emailType = await email.email_type;
+                }
+                if (await email.email != null) {
+                  render +=  `<div class="email margin-bottom-xxsmall"><a class="link" href="mailto:${await email.email}">${await email.email}</a> ${emailType}</div>`;
+                }
+                
               }
              
               this.element.innerHTML = render;
-- 
GitLab