background_type === 'image' && $board->background_value)
style="background-image: url('{{ $board->background_value }}');"
@elseif($board->background_type === 'color' && $board->background_value)
style="background: linear-gradient(135deg, {{ $board->background_value }} 0%, {{ $board->background_value }}dd 100%);"
@endif>
@foreach($board->lists as $list)
@php
$labelColors = [
'green' => '#61bd4f',
'yellow' => '#f2d600',
'orange' => '#ff9f1a',
'red' => '#eb5a46',
'purple' => '#c377e0',
'blue' => '#0079bf',
];
@endphp
@foreach($list->cards as $card)
@php
$cover = $card->cover ?? '';
$hasCover = !empty($cover);
// Process cover style
$coverStyle = '';
if ($hasCover) {
$isColor = preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', $cover);
if ($isColor) {
$coverStyle = 'background: ' . e($cover) . ';';
} else {
// It's an image URL
$imageUrl = $cover;
// If it doesn't start with http or data:, it's a storage path
if (!str_starts_with($cover, 'http') && !str_starts_with($cover, 'data:')) {
// If already starts with /storage/ use as-is, otherwise prepend
$imageUrl = str_starts_with($cover, '/storage/') ? $cover : '/storage/' . ltrim($cover, '/');
}
$coverStyle = 'background-image: url(' . e($imageUrl) . '); background-size: cover; background-position: center;';
}
}
$cardLabels = $card->labels ?? [];
$cardLabels = is_array($cardLabels) ? $cardLabels : [];
@endphp
@if($hasCover)
@php
$isImageUrl = str_starts_with($cover, 'http') || str_starts_with($cover, 'data:') || str_starts_with($cover, '/storage/');
$isColor = preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', $cover);
@endphp
@if($isColor)
@else
@endif
@endif
@if(count($cardLabels) > 0)
@foreach($cardLabels as $lc)
@php
$labelColor = null;
$labelName = '';
// If it's an integer ID, find the label in board labels
if (is_numeric($lc)) {
$foundLabel = $board->labels->firstWhere('id', $lc);
if ($foundLabel) {
$labelColor = $foundLabel->color;
$labelName = $foundLabel->name;
}
}
// If it's a string color name
elseif (is_string($lc) && isset($labelColors[$lc])) {
$labelColor = $labelColors[$lc];
$labelName = ucfirst($lc);
}
// If it's an array with color
elseif (is_array($lc) && !empty($lc['color'])) {
$labelColor = $lc['color'];
$labelName = $lc['name'] ?? '';
}
@endphp
@if($labelColor)
@endif
@endforeach
@endif
{{ $card->title }}
@if($canEdit ?? false)
@endif
@endforeach
@endforeach