@extends('layout') @section('title', 'Gestion des couleurs') @section('content')
{{-- Flash / erreurs --}} @if(session('status'))
{{ session('status') }}
@endif @error('color')
{{ $message }}
@enderror {{-- Filtres API --}}
{{-- Colonne gauche : couleurs disponibles (API) --}}
Couleurs disponibles (API)
@forelse($available as $c) @php // Données API $hexRaw = $c['hex'] ?? null; // Normalisation: ajoute # si manquant, uppercase $hex = $hexRaw ? (str_starts_with($hexRaw, '#') ? $hexRaw : '#'.$hexRaw) : null; $hexLabel = $hex ? strtoupper($hex) : 'N/A'; $already = $c['already_selected'] ?? false; $valueDisplay = $c['value_display'] ?? ($c['value'] ?? ''); $idApi = $c['id'] ?? null; // Style puce $chipColor = $hex ?? '#ffffff'; $chipBorder = $hex ? '#ccc' : '#888'; @endphp
{{ $valueDisplay }}
{{ $c['type'] ?? '' }} — API #{{ $idApi }} HEX : {{ $hexLabel }}
@if($already || !$idApi) @else
@csrf
@endif
@empty
Aucune couleur trouvée.
@endforelse
{{-- Colonne droite : sélection (DB, enrichie par l'API) --}}
Couleurs sélectionnées
    @forelse($selected as $item) @php /** @var \App\Models\Couleur $row */ $row = $item['row']; $api = $item['api']; // array (API) $hexRaw = $api['hex'] ?? null; $hex = $hexRaw ? (str_starts_with($hexRaw, '#') ? $hexRaw : '#'.$hexRaw) : null; $hexLabel = $hex ? strtoupper($hex) : 'N/A'; $valueDisplay = $api['value_display'] ?? ($api['value'] ?? '(introuvable)'); $type = $api['type'] ?? null; $idApi = $api['id'] ?? $row->external_id; $chipColor = $hex ?? '#ffffff'; $chipBorder = $hex ? '#ccc' : '#888'; @endphp
  • {{ $valueDisplay }}
    {{ $type }} — API #{{ $idApi }} HEX : {{ $hexLabel }}
    @csrf @method('DELETE')
  • @empty
  • Aucune couleur sélectionnée.
  • @endforelse
@endsection