@extends('layouts.admin')

@section('title', 'Edit Car Make')
@section('page-title', 'Edit Car Make')

@section('content')
<div class="max-w-lg bg-white rounded-xl shadow-sm p-6">
    <form action="{{ route('admin.car-makes.update', $carMake->id) }}" method="POST" enctype="multipart/form-data">
        @csrf @method('PUT')
        <div class="space-y-4">
            <div>
                <label class="block text-sm font-medium text-gray-700 mb-1">Make Name *</label>
                <input type="text" name="name" value="{{ old('name', $carMake->name) }}" required class="w-full border border-gray-300 rounded-lg px-3 py-2">
            </div>
            <div>
                <label class="block text-sm font-medium text-gray-700 mb-1">Logo</label>
                @if($carMake->logo)
                <img src="{{ asset('storage/' . $carMake->logo) }}" class="w-16 h-16 object-contain mb-2">
                @endif
                <input type="file" name="logo" accept="image/*" class="w-full border border-gray-300 rounded-lg px-3 py-2">
            </div>
            <div class="flex items-center gap-2">
                <input type="checkbox" name="is_active" value="1" id="is_active" {{ $carMake->is_active ? 'checked' : '' }}>
                <label for="is_active" class="text-sm text-gray-700">Active</label>
            </div>
        </div>
        <div class="flex gap-4 mt-6">
            <button type="submit" class="bg-red-600 text-white px-6 py-2 rounded-lg hover:bg-red-700">Update</button>
            <a href="{{ route('admin.car-makes.index') }}" class="bg-gray-100 text-gray-700 px-6 py-2 rounded-lg hover:bg-gray-200">Cancel</a>
        </div>
    </form>
</div>
@endsection
