@extends('web_site.account.layout')
@section('account_title', trans('site.account.menu.files'))
@section('account_content')
@php
$groups = [
['doctors', 'fa-user-md', $doctorFiles],
['clinic', 'fa-hospital', $clinicFiles],
['mine', 'fa-upload', $myFiles],
];
@endphp
@if ($doctorFiles->isEmpty() && $clinicFiles->isEmpty() && $myFiles->isEmpty())
{{ trans('site.files.empty') }}
@endif
@foreach ($groups as [$group, $icon, $files])
@continue($files->isEmpty())
{{ trans('site.files.groups.'.$group) }}
{{ $files->count() }}
@foreach ($files as $file)
@php
$path = $group === 'doctors' ? $file->attachment_path : $file->file_path;
$isImage = ($group === 'doctors' ? $file->attachment_type : $file->file_type) === 'image';
$title = match ($group) {
'doctors' => trans('site.files.report_file', ['name' => $file->doctor?->name]),
'clinic' => $file->category?->name ?: ($file->label ?: trans('clinic.attachments.file')),
default => $file->label ?: trans('clinic.attachments.file'),
};
$note = match ($group) {
'doctors' => null,
'clinic' => $file->category ? $file->label : null,
default => $file->booking?->doctor?->name,
};
$date = $group === 'doctors' ? $file->published_at : $file->created_at;
@endphp
-
{{ $title }}
@if ($note){{ $note }}@endif
{{ $date?->translatedFormat('j F Y') }}
@if ($group === 'doctors')
{{ trans('site.dashboard.view') }}
@elseif ($group === 'mine' && $file->booking)
{{ trans('site.files.booking') }}
@endif
@endforeach
@endforeach
@endsection