@php
$dataTab = null;
$dateFormats = [];
@endphp
@foreach ($fields as $key => $field)
@if (isset($field->tab))
@php $active = ($field->tab == 'membership') ? 'show active' : '';
$dataTab = $field->tab; @endphp
@endif
@if (isset($field->dataset))
@php $field->dataset->tab = $dataTab; @endphp
@else
@php $dataset = (object) ['tab' => $dataTab];
$field->dataset = $dataset; @endphp
@endif
@php $value = (isset($membership) || str_starts_with($field->name, 'alias_extra_field_')) ? old($field->name, $field->value) : old($field->name); @endphp
@if ($field->name == 'image')
@php $path = (isset($membership) && $membership->image) ? url('/').$membership->image->getThumbnailUrl() : asset('/images/camera.png'); @endphp
@endif
@if ($field->type == 'date' && isset($field->format))
@php $dateFormats[$field->name] = $field->format; @endphp
@endif
@if (!next($fields) || isset($fields[$key + 1]->tab))
@if ($field->name == 'why_expertij')
@if ($membership->professionalAttestation)
@include('themes.'.$theme.'.partials.membership.edit.document-file-button', ['fileUrl' => $membership->professionalAttestation->getUrl(), 'fileName' => $membership->professionalAttestation->file_name, 'label' => 'attestation'])
@else
@include('themes.'.$theme.'.partials.membership.edit.missing-document-button', ['label' => 'attestation'])
@endif
@if ($membership->resume)
@include('themes.'.$theme.'.partials.membership.edit.document-file-button', ['fileUrl' => $membership->resume->getUrl(), 'fileName' => $membership->resume->file_name, 'label' => 'resume'])
@else
@include('themes.'.$theme.'.partials.membership.edit.missing-document-button', ['label' => 'resume'])
@endif
@endif
@endif
@endforeach
@foreach ($membership->licences as $i => $licence)
@include('admin.partials.membership.licence', ['licence' => $licence, 'i' => $i])
@endforeach
@include('admin.partials.membership.profile', ['user' => $membership->user])
@include('admin.partials.membership.votes', ['user' => $membership->user])
@include('admin.partials.membership.payments', ['payments' => $membership->payments->sortDesc()])
@include('admin.partials.membership.insurance', ['insurance' => $membership->insurance])