bug fix in clients show view
This commit is contained in:
@@ -247,10 +247,26 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<!-- JSON Emails/Phones -->
|
<!-- JSON Emails/Phones -->
|
||||||
|
|
||||||
|
|
||||||
@php
|
@php
|
||||||
function renderBadges($items, $type = 'email') {
|
function renderBadges($items, $type = 'email') {
|
||||||
if(gettype($items) == 'string') return '<span class="text-muted small">'.$items.'</span>';
|
// If it's a JSON string, decode it into an array first
|
||||||
elseif(count($items) === 0) return '<span class="text-muted small">N/A</span>';
|
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 '<span class="text-muted small">'.$items.'</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now safely check if it's an array and has elements
|
||||||
|
if (!is_array($items) || count($items) === 0) {
|
||||||
|
return '<span class="text-muted small">N/A</span>';
|
||||||
|
}
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
$icon = $type == 'email' ? 'bi-envelope' : 'bi-telephone';
|
$icon = $type == 'email' ? 'bi-envelope' : 'bi-telephone';
|
||||||
|
|||||||
16
scratch.md
16
scratch.md
@@ -85,3 +85,19 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@php
|
||||||
|
function renderBadges($items, $type = 'email') {
|
||||||
|
if(gettype($items) == 'string') return '<span class="text-muted small">'.$items.'</span>';
|
||||||
|
elseif(count($items) === 0) return '<span class="text-muted small">N/A</span>';
|
||||||
|
$html = '';
|
||||||
|
foreach($items as $item) {
|
||||||
|
$icon = $type == 'email' ? 'bi-envelope' : 'bi-telephone';
|
||||||
|
$html .= '<span class="badge bg-light text-dark border me-1 mb-1"><i class="bi '.$icon.' text-secondary me-1"></i>'.$item.'</span>';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
2544
storage/laravel-2026-08-27.log
Normal file
2544
storage/laravel-2026-08-27.log
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user