@extends('layouts.app') @section('title', 'Manage Products for ' . $campaign->title) @section('content') {{-- Back Navigation & Title --}}
← Back to Campaign: {{ $campaign->title }}

Manage Associated Products

Select the products to associate with this campaign.

{{-- Form Container --}}
@csrf @method('PUT') {{-- Use PUT for updating the relationship --}} {{-- List of Available Products with Checkboxes --}}
Products {{-- Consider adding search/filter for products if list is long --}} @if ($allProducts->count() > 0) {{-- Responsive grid for product selection items --}}
@foreach ($allProducts as $product) {{-- Container for each product item --}}
{{-- Checkbox --}}
{{-- Added right margin --}} id, $associatedProductIds ?? [])) class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
{{-- Image Thumbnail --}}
{{-- Added right margin --}} @if ($product->image_url) {{-- Assuming $product->image_url is a direct URL. Use asset() if needed. --}} @else {{-- Placeholder --}}
@endif
{{-- Text Content --}}
{{-- Allow text to wrap/truncate --}}

{{-- Truncate long ASIN/Type --}} ASIN: {{ $product->asin ?? 'N/A' }} | Type: {{ $product->type ?? 'N/A' }}

@endforeach
@else

No products available in the system to associate.

{{-- Ensure products.create route exists if using this link --}} Add a product first?
@endif {{-- Validation Errors --}} @error('product_ids')

{{ $message }}

{{-- Adjusted margin --}} @enderror @error('product_ids.*')

{{ $message }}

@enderror
{{-- Submit Button --}}
{{-- End Form Container --}} @endsection