@extends('admin.layouts.app')
@section('title', 'Vendor Types')
@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">Vendor Types</h2></div>

        </div>
    </div>
</div>
<div class="page-body">
    <div class="card">
        <div class="table-responsive">
            <table class="table table-vcenter card-table">
                <thead>
                    <tr><th>Name</th><th>Slug</th><th>Icon</th><th>Vendors</th><th>Status</th><th>Actions</th></tr>
                </thead>
                <tbody>
                    @forelse($vendorTypes as $type)
                    <tr>
                        <td class="fw-medium">{{ $type->name }}</td>
                        <td><code>{{ $type->slug }}</code></td>
                        <td>{{ $type->icon ?? '—' }}</td>
                        <td>{{ $type->vendors_count }}</td>
                        <td>
                            <span class="badge bg-{{ $type->is_active ? 'success' : 'secondary' }}-lt">
                                {{ $type->is_active ? 'Active' : 'Disabled' }}
                            </span>
                        </td>
                        <td>
                            <div class="d-flex gap-1">
                                <a href="{{ route('admin.vendor-types.edit', $type) }}" class="btn btn-sm btn-outline-secondary">Edit</a>
                                <form action="{{ route('admin.vendor-types.toggle', $type) }}" method="POST">
                                    @csrf
                                    <button class="btn btn-sm btn-{{ $type->is_active ? 'warning' : 'success' }}">
                                        {{ $type->is_active ? 'Disable' : 'Enable' }}
                                    </button>
                                </form>
                            </div>
                        </td>
                    </tr>
                    @empty
                    <tr><td colspan="6" class="text-center text-muted py-4">No vendor types found</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</div>
@endsection
