diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php
index 623b74c..9f64ab7 100644
--- a/resources/views/clients/show.blade.php
+++ b/resources/views/clients/show.blade.php
@@ -247,10 +247,26 @@
+
+
@php
function renderBadges($items, $type = 'email') {
- if(gettype($items) == 'string') return '
'.$items.'';
- elseif(count($items) === 0) return '
N/A';
+ // If it's a JSON string, decode it into an array first
+ if (is_string($items)) {
+ $decoded = json_decode($items, true);
+ if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
+ $items = $decoded;
+ } else {
+ // If it's just a plain text string, return it directly
+ return '
'.$items.'';
+ }
+ }
+
+ // Now safely check if it's an array and has elements
+ if (!is_array($items) || count($items) === 0) {
+ return '
N/A';
+ }
+
$html = '';
foreach($items as $item) {
$icon = $type == 'email' ? 'bi-envelope' : 'bi-telephone';
diff --git a/scratch.md b/scratch.md
index 865e0c5..e3e753e 100644
--- a/scratch.md
+++ b/scratch.md
@@ -84,4 +84,20 @@
{!! renderBadges($showclient->support_phones, 'phone') !!}
@endif
+
+
+
+
+ @php
+ function renderBadges($items, $type = 'email') {
+ if(gettype($items) == 'string') return '