@extends('dashboard.admin.layouts.master') @php $dayKeys = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; $money = fn ($amount) => number_format((float) $amount, 2); @endphp @section('toolbar')

{{ trans('clinic.doctors.details') }}

{{ trans('clinic.common.back') }} @can('clinic.schedules.view') {{ trans('clinic.doctors.schedule') }} @endcan @can('clinic.doctors.edit') {{ trans('core.common.edit') }} @endcan
@endsection @section('content')
{{-- Header card --}}
{{ $doctor->name }}
{{ $doctor->name }} {{ trans('core.common.status_' . ($doctor->status === 'active' ? 'active' : 'inactive')) }}
{{ $doctor->specialty?->name ?? '—' }} @if ($doctor->phone){{ $doctor->phone }}@endif {{ $doctor->email }} @if ($doctor->years_experience){{ trans('clinic.doctors.years_count', ['count' => $doctor->years_experience]) }}@endif
@foreach (array_filter([ ['bi-calendar-check', 'primary', $summary['total'], trans('clinic.doctors.stat_bookings')], ['bi-hourglass-split', 'warning', $summary['upcoming'], trans('clinic.doctors.stat_upcoming')], ['bi-camera-video', 'info', $summary['online'], trans('clinic.doctors.stat_online')], ['bi-star-fill', 'warning', $summary['rating'] !== null ? $summary['rating'] . ' / 5' : '—', trans('clinic.doctors.stat_rating', ['count' => $summary['reviews_count']])], $canSeeMoney ? ['bi-cash-coin', 'success', $money($summary['doctor_share']), trans('clinic.doctors.stat_doctor_share')] : null, ]) as [$icon, $color, $value, $label])
{{ $value }}
{{ $label }}
@endforeach
{{-- Main data --}}

{{ trans('clinic.doctors.professional_info') }}

@foreach ([ [trans('clinic.doctors.specialty'), $doctor->specialty?->name], [trans('clinic.doctors.years_experience'), $doctor->years_experience], [trans('clinic.doctors.phone'), $doctor->phone], [trans('clinic.doctors.email'), $doctor->email], [trans('clinic.doctors.joined'), $doctor->created_at?->format('Y-m-d')], ] as [$label, $value])
{{ $label }} {{ $value ?: '—' }}
@endforeach @foreach ([[trans('clinic.doctors.bio'), $doctor->bio], [trans('clinic.doctors.qualifications'), $doctor->qualifications]] as [$label, $value]) @if ($value)
{{ $label }}
{!! nl2br(e($value)) !!}
@endif @endforeach

{{ trans('clinic.doctors.clinics_and_schedule') }}

@forelse ($clinics as $pivot)
{{ $pivot->clinicProfile?->name }}
{{ $pivot->clinicProfile?->branch?->name }}
{{ trans('core.common.status_' . ($pivot->is_active ? 'active' : 'inactive')) }}
@foreach (\App\Services\Clinic\DoctorProfileService::TYPES as $type) {{ trans('clinic.bookings.' . $type) }}: {{ isset($pivot->prices[$type]) ? $money($pivot->prices[$type]->total_price) : '—' }} @endforeach
@if ($pivot->schedules->isEmpty())
{{ trans('clinic.doctors.no_schedule') }}
@else
@foreach ($pivot->schedules->groupBy('day_of_week') as $day => $periods) @endforeach
{{ trans('clinic.doctors.days.' . ($dayKeys[$day] ?? 'sunday')) }} @foreach ($periods as $period) {{ substr($period->start_time, 0, 5) }} - {{ substr($period->end_time, 0, 5) }} @endforeach
@endif
@empty
{{ trans('clinic.doctors.no_clinics') }}
@endforelse
{{-- Ratings --}}
{{ $summary['rating'] ?? '—' }}
@include('dashboard.admin.Site.feedback.partials.stars', ['rating' => (int) round($summary['rating'] ?? 0)])
{{ trans('clinic.doctors.reviews_count', ['count' => $summary['reviews_count']]) }}
@foreach ($distribution as $stars => $count)
{{ $stars }}
{{ $count }}
@endforeach
@forelse ($reviews as $review)
{{ mb_substr((string) $review->booking?->patient?->name, 0, 1) }}
{{ $review->booking?->patient?->name ?? '—' }} {{ $review->created_at?->format('Y-m-d') }}
@include('dashboard.admin.Site.feedback.partials.stars', ['rating' => (int) $review->doctor_rating]) @if ($review->doctor_comment)

{{ $review->doctor_comment }}

@endif
@empty
{{ trans('clinic.doctors.no_reviews') }}
@endforelse
{{-- Bookings (all types) and online bookings: same server-side table --}} @foreach (['all' => 'doctor_bookings', 'online' => 'doctor_online'] as $scope => $paneId)
@if ($scope === 'all') @endif
{{ trans('clinic.bookings.date') }} {{ trans('clinic.bookings.patient') }} {{ trans('clinic.doctors.clinic') }} {{ trans('clinic.bookings.type') }} {{ trans('clinic.doctors.price') }} {{ trans('clinic.doctors.doctor_share') }} {{ trans('clinic.bookings.status') }}
@endforeach {{-- Account --}} @if ($canSeeMoney)
@endif
@endsection @section('js') @endsection