<x-app-layout>
    <x-slot name="title">Edit Vendor Pre-Qualification</x-slot>
    
    <div class="mb-6">
        <a href="{{ route('vendors.index') }}" class="text-primary-600 hover:text-primary-900 text-sm font-medium">&larr; Back to Vendors</a>
    </div>

    <div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
        <div class="px-6 py-5 border-b border-gray-100 bg-gray-50 flex justify-between items-center">
            <div>
                <h3 class="text-lg font-bold text-gray-900">Review Vendor Pre-Qualification</h3>
                <p class="text-sm text-gray-500">App No: {{ $vendor->application_no }}</p>
            </div>
        </div>

        <form action="{{ route('vendors.update', $vendor) }}" method="POST" class="p-6 space-y-8">
            @csrf
            @method('PUT')

            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Status *</label>
                    <select name="status" required class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                        <option value="Pending" {{ $vendor->status === 'Pending' ? 'selected' : '' }}>Pending</option>
                        <option value="Approved" {{ $vendor->status === 'Approved' ? 'selected' : '' }}>Approved</option>
                        <option value="Rejected" {{ $vendor->status === 'Rejected' ? 'selected' : '' }}>Rejected</option>
                    </select>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Registration Type *</label>
                    <select name="registration_type" required class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                        <option value="Consultant" {{ $vendor->registration_type === 'Consultant' ? 'selected' : '' }}>Consultant</option>
                        <option value="Contractor" {{ $vendor->registration_type === 'Contractor' ? 'selected' : '' }}>Contractor</option>
                        <option value="Supplier" {{ $vendor->registration_type === 'Supplier' ? 'selected' : '' }}>Supplier</option>
                        <option value="Service Provider" {{ $vendor->registration_type === 'Service Provider' ? 'selected' : '' }}>Service Provider</option>
                    </select>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Category *</label>
                    <select name="category" required class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                        <option value="Design & Engineering" {{ $vendor->category === 'Design & Engineering' ? 'selected' : '' }}>Design & Engineering</option>
                        <option value="Building Contractor" {{ $vendor->category === 'Building Contractor' ? 'selected' : '' }}>Building Contractor</option>
                        <option value="Infrastructure Contractor" {{ $vendor->category === 'Infrastructure Contractor' ? 'selected' : '' }}>Infrastructure Contractor</option>
                        <option value="Material Supplier" {{ $vendor->category === 'Material Supplier' ? 'selected' : '' }}>Material Supplier</option>
                        <option value="Specialized Contractor" {{ $vendor->category === 'Specialized Contractor' ? 'selected' : '' }}>Specialized Contractor</option>
                    </select>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Vendor/Company Name *</label>
                    <input type="text" name="vendor_name" value="{{ $vendor->vendor_name }}" required class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Phone No. *</label>
                    <input type="text" name="phone" value="{{ $vendor->phone }}" required class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                </div>
                <div class="md:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Remarks</label>
                    <textarea name="remarks" rows="3" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm">{{ $vendor->remarks }}</textarea>
                </div>
            </div>
            
            <div class="pt-5 border-t border-gray-200 flex justify-end gap-3">
                <a href="{{ route('vendors.index') }}" class="px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">Cancel</a>
                <button type="submit" class="px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700">Update Profile</button>
            </div>
        </form>
    </div>
</x-app-layout>
