{{ $colors->count() }}
Total colores
{{ $colors->filter(fn($c) => $c->labFormulas->isNotEmpty())->count() }}
Con fórmulas
{{ $colors->filter(fn($c) => $c->labFormulas->where('status','Approved_in_Lab')->isNotEmpty())->count() }}
Aprobados lab
{{ $colors->filter(fn($c) => $c->labFormulas->where('status','Draft')->isNotEmpty() && $c->labFormulas->where('status','Approved_in_Lab')->isEmpty())->count() }}
Solo borrador
@if($viewMode === 'list')
| Color |
Cód. Interno |
TCX / LAB |
Artículo |
Cliente |
Temporada |
Fórmulas |
|
@forelse($colors as $color)
@php $ref = $color->reference_data ?? []; @endphp
{{ $color->code }}
{{ $color->name }}
|
{{ $color->internal_color_code ?: '—' }} |
@if(!empty($ref['tcx_code'])) TCX: {{ $ref['tcx_code'] }} @endif
@if(!empty($ref['l_star']))L*{{ number_format($ref['l_star'],1) }} a*{{ number_format($ref['a_star'] ?? 0,1) }} b*{{ number_format($ref['b_star'] ?? 0,1) }} @endif
@if(empty($ref['tcx_code']) && empty($ref['l_star']))—@endif
|
{{ $color->articulo_id ?: '—' }} |
{{ $color->client ?: '—' }} |
@if($color->season)
{{ $color->season }}
@else
—
@endif
|
@if($color->labFormulas->isEmpty())
Sin fórmulas
@else
@foreach($color->labFormulas as $f)
{{ $f->version_name }}
@endforeach
@endif
|
|
@empty
| No se encontraron colores con estos filtros. |
@endforelse
@else
@if($colors->isEmpty())
No se encontraron colores con estos filtros.
@else
@foreach($colors as $color)
@php
$hex = $color->fallback_hex ?? $color->color_hex ?? '#6B7280';
$ref = $color->reference_data ?? [];
// Determine if the swatch is light to choose text contrast
$hexClean = ltrim($hex, '#');
$r = strlen($hexClean) >= 6 ? hexdec(substr($hexClean,0,2)) : 107;
$g = strlen($hexClean) >= 6 ? hexdec(substr($hexClean,2,2)) : 114;
$b = strlen($hexClean) >= 6 ? hexdec(substr($hexClean,4,2)) : 128;
$brightness = (0.299 * $r + 0.587 * $g + 0.114 * $b) / 255;
$swatchText = $brightness > 0.55 ? 'rgba(0,0,0,.7)' : 'rgba(255,255,255,.85)';
$hasApproved = $color->labFormulas->where('status','Approved_in_Lab')->isNotEmpty();
@endphp
@if(!empty($ref['tcx_code']))
{{ $ref['tcx_code'] }}
@endif
{{ $color->code }}
{{ $color->name }}
@if($color->season)
{{ $color->season }}
@else
@endif
@if($hasApproved)
✓ Lab
@elseif($color->labFormulas->isNotEmpty())
Borrador
@else
Sin fórmula
@endif
@if($color->client)
{{ $color->client }}
@endif
@endforeach
@endif
@endif
@if($selectedColor)
@php $ref = $selectedColor->reference_data ?? []; @endphp
{{ $selectedColor->code }}
{{ $selectedColor->name }}
@if(!empty($ref['tcx_code']) || !empty($ref['l_star']))
@if(!empty($ref['tcx_code']))
TCX {{ $ref['tcx_code'] }}
@endif
@if(!empty($ref['l_star']))
L*{{ number_format($ref['l_star'],1) }}
a*{{ number_format($ref['a_star'] ?? 0,1) }}
b*{{ number_format($ref['b_star'] ?? 0,1) }}
@endif
@endif
Cliente{{ $selectedColor->client ?: '—' }}
Temporada{{ $selectedColor->season ?: '—' }}
Artículo{{ $selectedColor->articulo_id ?: '—' }}
Cód. Interno{{ $selectedColor->internal_color_code ?: '—' }}
@if($selectedColor->labFormulas->isEmpty())
No hay fórmulas de laboratorio.
@else
@foreach($selectedColor->labFormulas as $formula)
{{ $formula->version_name }}
{{ $formula->status === 'Approved_in_Lab' ? 'Aprobado Lab' : 'Borrador' }}
@if($formula->productionFormulas->isNotEmpty())
PRODUCCIÓN
@foreach($formula->productionFormulas as $pf)
Partida: {{ $pf->partida }}
V.{{ $pf->version_number }}
{{ $pf->is_approved_for_production ? 'Aprobada' : 'No Aprobada' }}
@endforeach
@else
Sin fórmulas de producción.
@endif
@endforeach
@endif
@endif
@if($showColorModal)
{{ $colorForm['id'] ? 'Editar Color' : 'Nuevo Color' }}
Identificación
Referencia de Color
@endif