@php
    $profileUser = $user ?? null;
    $modalSuffix = $profileUser?->id ?? 'sem-usuario';
    $fotoPadrao = 'pmar/assets/img/icons/usuario.png';
    $fotoSrc = asset(optional($profileUser)->photo ?? $fotoPadrao);
    $nomeExibicao = $profileUser?->name ?: __('Não informado');
    $lotacao = $profileUser?->pertence
        ? "{$profileUser->pertence->name} ({$profileUser->pertence->abbreviation})"
        : __('Não informada');
@endphp

<div class="row">

    <div class="col-sm-12 col-md-6 d-flex align-items-start d-flex align-items-center">

        <div class="mb-3">

            <img src="{{ $fotoSrc }}"
                 alt="{{ __('Foto de :nome', ['nome' => $nomeExibicao]) }}" class="img-fluid rounded-5"
                 style="width: 200px; object-fit: cover; cursor: pointer;"
                 @if($profileUser)
                 data-bs-toggle="modal" data-bs-target="#modalFotoPaciente{{ $modalSuffix }}"
                 @endif />

            @if($profileUser)
            <div class="modal fade" id="modalFotoPaciente{{ $modalSuffix }}" tabindex="-1"
                 aria-hidden="true">
                <div class="modal-dialog modal-fullscreen">
                    <div class="modal-content bg-dark">
                        <div class="modal-header border-0">
                            <button type="button" class="btn-close btn-close-white ms-auto"
                                    data-bs-dismiss="modal" aria-label="{{ __('Fechar') }}"></button>
                        </div>
                        <div class="modal-body d-flex justify-content-center align-items-center">
                            <img src="{{ $fotoSrc }}"
                                 alt="{{ __('Foto de :nome', ['nome' => $nomeExibicao]) }}"
                                 class="img-fluid rounded" style="max-height: 90vh;" />
                        </div>
                    </div>
                </div>
            </div>
            @endif

        </div>


    </div>
    <div class="col-sm-12 col-md-6 d-flex align-items-start d-flex align-items-center">
        <div>
            @if(!$profileUser)
            <p class="text-muted mb-0">{{ __('* Este cadastro não possui usuário vinculado.') }}</p>
            @else
            @include('components.inputs._label',[
            'for' => 'labelNomeCompleto',
            'label' => 'Nome',
            'text' => $nomeExibicao,
            ])

            @include('components.inputs._label',[
            'for' => 'LabelLotacao',
            'label' => 'Lotação',
            'text' => $lotacao,
            ])

            @include('components.inputs._label',[
            'for' => 'labelCPF',
            'label' => 'CPF',
            'text' => $profileUser->cpf ?: __('Não informado'),
            ])

            @if(!empty($profileUser->matriculation))
            @include('components.inputs._label',[
            'for' => 'labelMatricula',
            'label' => 'Matrícula',
            'text' => $profileUser->matriculation,
            ])
            @endif
            @endif
        </div>
    </div>
</div>
