@extends('dashboard.admin.layouts.master')
@php($money = fn ($amount) => number_format((float) $amount, 2))
@section('toolbar')
@include('dashboard.admin.clinic.reports.partials.header', ['title' => trans('clinic.reports_center.clinic_profit')])
@endsection
@section('content')
@include('dashboard.admin.clinic.reports.partials.filters', ['fields' => ['branch', 'clinic'], 'csv' => true])
@include('dashboard.admin.clinic.reports.partials.unsplit', ['count' => $report['unsplit']])
@foreach ([
['bi-calendar-check', 'primary', $report['totals']['bookings'], trans('clinic.doctors.earning_bookings'), false],
['bi-receipt', 'info', $report['totals']['revenue'], trans('clinic.doctors.total_price'), true],
['bi-person-badge', 'warning', $report['totals']['doctor_share'], trans('clinic.reports_center.doctors_shares'), true],
['bi-graph-up-arrow', 'success', $report['totals']['center_share'], trans('clinic.reports_center.profit'), true],
] as [$icon, $color, $value, $label, $isMoney])
{{ $isMoney ? $money($value) : $value }}
{{ $label }}
@endforeach
@include('dashboard.admin.clinic.reports.partials.profit-table', ['rows' => $report['clinics'], 'kind' => 'clinic', 'totals' => $report['totals']])
@include('dashboard.admin.clinic.reports.partials.profit-table', ['rows' => $report['doctors'], 'kind' => 'doctor', 'totals' => $report['totals']])
@endsection