@extends('layouts.app')
@section('title', __('Dentists'))

@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
    <h1 class="h4 fw-bold mb-0">{{ __('Dentists') }}</h1>
    @can('create', App\Models\Dentist::class)
        <a href="{{ route('tenant.dentists.create') }}" class="btn mb-btn-primary btn-sm">+ {{ __('Add dentist') }}</a>
    @endcan
</div>

<div class="mb-card p-3">
    <table class="table mb-table align-middle mb-0">
        <thead><tr>
            <th>{{ __('Name') }}</th><th>{{ __('Specialty') }}</th>
            <th>{{ __('Slot') }}</th><th>{{ __('Online booking') }}</th>
            <th>{{ __('Status') }}</th><th></th>
        </tr></thead>
        <tbody>
        @forelse($dentists as $dentist)
            <tr>
                <td>
                    <span class="status-chip" style="background: {{ $dentist->color }}">&nbsp;</span>
                    {{ $dentist->name }}
                </td>
                <td class="mb-muted">{{ $dentist->specialty }}</td>
                <td class="mb-muted">{{ $dentist->slot_duration_min }} {{ __('min') }}</td>
                <td>{{ $dentist->is_bookable_online ? '✓' : '—' }}</td>
                <td><span class="badge text-bg-{{ $dentist->status === 'active' ? 'success' : 'secondary' }}">{{ __(ucfirst($dentist->status)) }}</span></td>
                <td class="text-end">
                    @can('update', $dentist)
                        <a class="btn btn-sm mb-btn-ghost" href="{{ route('tenant.dentists.edit', $dentist) }}">{{ __('Edit') }}</a>
                    @endcan
                </td>
            </tr>
        @empty
            <tr><td colspan="6" class="mb-muted py-4 text-center">{{ __('No dentists yet. Add your first dentist to start booking.') }}</td></tr>
        @endforelse
        </tbody>
    </table>
</div>
{{ $dentists->links() }}
@endsection
