@extends('layouts.yellow') @section('content')
@if(session('error'))
{{ session('error') }}
@endif
@if (session('success'))
{{ session('success') }}
@endif


@foreach($model->getSectionHistory() as $index => $section) @php $tabId = 'form-history-'.Str::slug($section->title); $entries = collect(); // Entrada principal $entries->push([ 'type' => 'main', 'user' => $model->user()->first(), 'date' => $model->created_at, 'content' => $section->summary ]); // Controles relacionados foreach($controlHistories as $control) { foreach($control->getControlSectionHistory() as $controlSection) { if($section->section_type_id === $controlSection->section_type_id) { $entries->push([ 'type' => 'control', 'user' => $control->user()->first(), 'date' => $control->created_at, 'content' => $controlSection->summary, 'control_data' => $control ]); } } } @endphp
@foreach($entries as $entryIndex => $entry) @php $subTabId = Str::slug($section->title).'-'.Str::slug($entry['user']->name).'-'.$entryIndex; @endphp
{{ __("detail-history.doctor") }} {{ $entry['user']->name }} @if($entry['type'] === 'control') {{ $especialities[$entry['control_data']->especiality] }} @endif
@if($entry['type'] === 'control') {{ __("com-form-history.idControl") }} {{ substr($entry['control_data']->id, -4) }} @endif

{{ $entry['content'] }}

@endforeach
@endforeach
@foreach($model->getPhyscalExam() as $key => $value) @php $mainTabId = 'physcal-exam-'.Str::slug($key); $entries = collect(); // Entrada principal $entries->push([ 'type' => 'main', 'user' => $model->user()->first(), 'date' => $model->created_at, 'content' => $value ]); // Controles relacionados foreach($controlHistories as $control) { $controlExam = $control->getControlPhyscalExam(); if($controlExam && isset($controlExam[$key])) { $entries->push([ 'type' => 'control', 'user' => $control->user()->first(), 'date' => $control->created_at, 'content' => $controlExam[$key], 'control_data' => $control ]); } } @endphp
@foreach($entries as $entryIndex => $entry) @php $subTabId = Str::slug($key).'-'.Str::slug($entry['user']->name).'-'.$entryIndex; @endphp
{{ __("detail-history.doctor") }} {{ $entry['user']->name }} @if($entry['type'] === 'control') {{ $especialities[$entry['control_data']->especiality] }} @endif
@if($entry['type'] === 'control') {{ __("com-form-history.idControl") }} {{ substr($entry['control_data']->id, -4) }} {{ $entry['date']->format('d/m/Y H:i') }} @endif

{{ $entry['content'] }}

@endforeach
@endforeach
@endsection @section('javascript') @endsection