{{-- Account tab content for a period. Param: $doctor, $account (DoctorProfileService::account). --}} @php($money = fn ($amount) => number_format((float) $amount, 2))

{{ trans('clinic.doctors.account_for', ['name' => $doctor->name]) }}

{{ $account['from']->format('Y-m-d') }} → {{ $account['to']->format('Y-m-d') }}
@foreach ([ ['bi-calendar-check', 'primary', $account['totals']['bookings'], trans('clinic.doctors.earning_bookings'), false], ['bi-receipt', 'info', $account['totals']['price'], trans('clinic.doctors.total_price'), true], ['bi-person-badge', 'success', $account['totals']['doctor_share'], trans('clinic.doctors.doctor_share'), true], ['bi-building', 'warning', $account['totals']['center_share'], trans('clinic.doctors.center_share'), true], ] as [$icon, $color, $value, $label, $isMoney])
{{ $isMoney ? $money($value) : $value }}
{{ $label }}
@endforeach

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

@foreach ($account['by_type'] as $type => $row) @endforeach
{{ trans('clinic.bookings.type') }} {{ trans('clinic.doctors.earning_bookings') }} {{ trans('clinic.doctors.total_price') }} {{ trans('clinic.doctors.doctor_share') }} {{ trans('clinic.doctors.center_share') }}
{{ trans('clinic.bookings.' . $type) }} {{ $row['bookings'] }} {{ $money($row['price']) }} {{ $money($row['doctor_share']) }} {{ $money($row['center_share']) }}
{{ trans('clinic.doctors.total') }} {{ $account['totals']['bookings'] }} {{ $money($account['totals']['price']) }} {{ $money($account['totals']['doctor_share']) }} {{ $money($account['totals']['center_share']) }}
@if ($account['not_earning'])
{{ trans('clinic.doctors.not_earning') }}: @foreach ($account['not_earning'] as $status => $count) {{ trans('clinic.bookings.statuses.' . $status) }} {{ $count }} @endforeach
@endif

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

@if ($account['bookings']->isEmpty())
{{ trans('clinic.doctors.no_bookings_period') }}
@else
@foreach ($account['bookings'] as $booking) @endforeach
{{ trans('clinic.bookings.date') }} {{ trans('clinic.bookings.patient') }} {{ trans('clinic.doctors.clinic') }} {{ trans('clinic.bookings.type') }} {{ trans('clinic.doctors.total_price') }} {{ trans('clinic.doctors.doctor_share') }} {{ trans('clinic.doctors.center_share') }}
{{ $booking->scheduled_at?->format('Y-m-d H:i') }} {{ $booking->patient?->name ?? '—' }} {{ $booking->clinicProfile?->name ?? '—' }} {{ trans('clinic.bookings.' . $booking->type) }} {{ $money($booking->price) }} {{ $money($booking->doctor_share_amount) }} {{ $money($booking->center_share_amount) }}
@endif