@extends('admin.layouts.app')
@section('title', 'Edit Vendor Type')
@section('content')
<div class="page-header d-print-none">
    <div class="container-xl">
        <div class="row g-2 align-items-center">
            <div class="col"><h2 class="page-title">Edit Vendor Type: {{ $vendorType->name }}</h2></div>
            <div class="col-auto"><a href="{{ route('admin.vendor-types.index') }}" class="btn btn-outline-secondary">← Back</a></div>
        </div>
    </div>
</div>
<div class="page-body">
    <div class="card">
        <div class="card-body">
            <form action="{{ route('admin.vendor-types.update', $vendorType) }}" method="POST">
                @csrf @method('PUT')
                <div class="mb-3">
                    <label class="form-label">Name <span class="text-danger">*</span></label>
                    <input type="text" name="name" class="form-control @error('name') is-invalid @enderror" value="{{ old('name', $vendorType->name) }}">
                    @error('name')<div class="invalid-feedback">{{ $message }}</div>@enderror
                </div>
                <div class="mb-3">
                    <label class="form-label">Slug <span class="text-muted">(read-only)</span></label>
                    <input type="text" class="form-control bg-light" value="{{ $vendorType->slug }}" readonly>
                </div>
                <div class="mb-3">
                    <label class="form-label">Icon (emoji)</label>
                    <input type="text" name="icon" class="form-control" value="{{ old('icon', $vendorType->icon) }}">
                </div>
                <div class="mb-3">
                    <label class="form-check form-switch">
                        <input class="form-check-input" type="checkbox" name="is_active" value="1" {{ $vendorType->is_active ? 'checked' : '' }}>
                        <span class="form-check-label">Active</span>
                    </label>
                </div>
                <button type="submit" class="btn btn-primary">Update</button>
            </form>
        </div>
    </div>
</div>
@endsection
