@php
$showBool = function($v){
if ($v === null || $v === '') return '—';
if ((string)$v === '1') return '
';
return e($v);
};
// compute existing selected types for violence (strings)
$existingTypes = $violence ? $violence->types->pluck('tp_type_violence_id')->map(function($v){ return (string)$v; })->toArray() : [];
$selectedTypes = old('type_violence', $existingTypes);
@endphp
{{-- Presentational CSS for consult / show mode (overrides inputs and aligns label+value inline) --}}
@php
// helper to render yes/no nicely
$showBool = function($v){
if ($v === null || $v === '') return '—';
if ((string)$v === '1') return '
نعم';
if ((string)$v === '0') return '
لا';
return e($v);
};
// Normalize children as in your original snippet
$rawChildren = old('children') ?? ($children->isNotEmpty() ? $children->toArray() : []);
$initialChildren = collect($rawChildren)->map(function($c) {
$sex = null;
if (is_array($c)) {
$sex = $c['sex'] ?? $c['gender'] ?? null;
$id_age = $c['id_age_enf'] ?? $c['id_age_enf'] ?? null;
$id_niv = $c['id_niveau_edu_enf'] ?? $c['id_niveau_edu_enf'] ?? null;
$decroche = $c['decroche_scolaire'] ?? $c['decroche_scolaire'] ?? null;
$porteur = $c['porteur_handicap'] ?? $c['porteur_handicap'] ?? null;
$lien = $c['lien_parente'] ?? $c['lien_parente'] ?? null;
} else {
$sex = $c->sex ?? $c->gender ?? null;
$id_age = $c->id_age_enf ?? null;
$id_niv = $c->id_niveau_edu_enf ?? null;
$decroche = $c->decroche_scolaire ?? null;
$porteur = $c->porteur_handicap ?? null;
$lien = $c->lien_parente ?? null;
}
return [
'gender' => $sex,
'id_age_enf' => $id_age,
'id_niveau_edu_enf' => $id_niv,
'decroche_scolaire' => $decroche,
'porteur_handicap' => $porteur,
'lien_parente' => $lien,
];
})->toArray();
$initialCount = count($initialChildren);
// risks normalization (from your snippet)
$dbRv = isset($violence) && $violence && $violence->risquesVictime ? $violence->risquesVictime->pluck('id')->map(fn($i)=>(string)$i)->toArray() : [];
$dbRa = isset($violence) && $violence && $violence->risquesAgresseur ? $violence->risquesAgresseur->pluck('id')->map(fn($i)=>(string)$i)->toArray() : [];
$dbRvv = isset($violence) && $violence && $violence->risquesViolence ? $violence->risquesViolence->pluck('id')->map(fn($i)=>(string)$i)->toArray() : [];
$oldRvRaw = old('risques_victime', $dbRv); $oldRaRaw = old('risques_agresseur', $dbRa); $oldRvvRaw = old('risques_violence', $dbRvv);
$oldRv = is_array($oldRvRaw) ? array_map('strval', $oldRvRaw) : [];
$oldRa = is_array($oldRaRaw) ? array_map('strval', $oldRaRaw) : [];
$oldRvv = is_array($oldRvvRaw) ? array_map('strval', $oldRvvRaw) : [];
@endphp
عدد الأطفال
{{ old('children_count', optional($victime ?? null)->nombre_enfants) ?? '—' }}
{{-- --}}
{{-- عرض تفاصيل الأطفال (عرض فقط) --}}
| # |
الجنس |
العمر (فئة) |
المستوى التعليمي |
منقطع عن الدراسة |
حامل لإعاقة |
صلة القرابة / ملاحظة |
@if($initialCount > 0)
@foreach($initialChildren as $idx => $c)
| {{ $idx + 1 }} |
@php
$genderLabel = (isset($c['gender']) && $c['gender'] === 'female') ? 'أنثى' : ((isset($c['gender']) && $c['gender'] === 'male') ? 'ذكر' : '—');
@endphp
{{ $genderLabel }}
|
@php
$ageLabel = $c['id_age_enf'] ? (optional($agesEnf->firstWhere('id', $c['id_age_enf']))->age_ar ?? optional($agesEnf->firstWhere('id', $c['id_age_enf']))->age_fr) : null;
@endphp
{{ $ageLabel ?? '—' }}
|
@php
$nivLabel = $c['id_niveau_edu_enf'] ? (optional($niveauxEduEnf->firstWhere('id', $c['id_niveau_edu_enf']))->niveau_ar ?? optional($niveauxEduEnf->firstWhere('id', $c['id_niveau_edu_enf']))->niveau_fr) : null;
@endphp
{{ $nivLabel ?? '—' }}
|
@php $dec = isset($c['decroche_scolaire']) && ($c['decroche_scolaire'] == 1 || $c['decroche_scolaire'] === true); @endphp
{!! $dec ? 'نعم' : 'لا' !!}
|
@php $ph = isset($c['porteur_handicap']) && ($c['porteur_handicap'] == 1 || $c['porteur_handicap'] === true); @endphp
{!! $ph ? 'نعم' : 'لا' !!}
|
{{ $c['lien_parente'] ?? '—' }}
|
@endforeach
@else
| لا يوجد أطفال مدخلين |
@endif
تفاصيل عرض فقط — لا يوجد تعديل في وضع الاستعراض
{{-- expose arrays for potential JS read-only features (kept for compatibility) --}}
القائم بالعنف
@php
$selected_relation_victime = old('agresseur_id_relation_victime', optional($agresseur ?? null)->id_relation_victime);
$relLabel = $selected_relation_victime ? (optional($relationsVictime->firstWhere('id', $selected_relation_victime))->relation_ar ?? optional($relationsVictime->firstWhere('id', $selected_relation_victime))->relation_fr) : null;
@endphp
{{ $relLabel ?? '—' }}
علاقة الشريك الحميمي بالضحية
@php
$selPart = old('agresseur_id_relation_part_intime', optional($agresseur ?? null)->id_relation_part_intime);
$partLabel = $selPart ? (optional($relationsPartIntime->firstWhere('id', $selPart))->relation_int_ar ?? optional($relationsPartIntime->firstWhere('id', $selPart))->relation_int_fr) : null;
@endphp
{{ $partLabel ?? '—' }}
السن
@php $sel_age = old('agresseur_id_age', optional($agresseur)->id_age); $ageLabel = $sel_age ? (optional($ages->firstWhere('id',$sel_age))->age_ar ?? optional($ages->firstWhere('id',$sel_age))->age_fr) : null; @endphp
{{ $ageLabel ?? '—' }}
المستوى التعليمي
@php $sel_niv = old('agresseur_id_niveau_edu', optional($agresseur)->id_niveau_edu); $nivLabel = $sel_niv ? (optional($niveauxEdu->firstWhere('id',$sel_niv))->niveau_ar ?? optional($niveauxEdu->firstWhere('id',$sel_niv))->niveau_fr) : null; @endphp
{{ $nivLabel ?? '—' }}
الوضعية المهنية
@php $sel_sit_pro = old('agresseur_id_sit_pro', optional($agresseur)->id_sit_pro); $sitProLabel = $sel_sit_pro ? (optional($sitProList->firstWhere('id',$sel_sit_pro))->sit_pro_ar ?? optional($sitProList->firstWhere('id',$sel_sit_pro))->sit_pro_fr) : null; @endphp
{{ $sitProLabel ?? '—' }}
غير مباشر للعمل
@php $sel_inactif = old('agresseur_id_sit_pro_inactif', optional($agresseur)->id_sit_pro_inactif); $inactifLabel = $sel_inactif ? (optional($sitProInactif->firstWhere('id',$sel_inactif))->raison_inactif_ar ?? optional($sitProInactif->firstWhere('id',$sel_inactif))->raison_inactif_fr) : null; @endphp
{{ $inactifLabel ?? '—' }}
المهنة في حالة مباشرة
@php $sel_domaine = old('agresseur_id_domaine_pro', optional($agresseur)->id_domaine_pro); $domLabel = $sel_domaine ? (optional($domaineProList->firstWhere('id',$sel_domaine))->domaine_ar ?? optional($domaineProList->firstWhere('id',$sel_domaine))->domaine_fr) : null; @endphp
{{ $domLabel ?? '—' }}
مؤشرات الخطورة حسب نوعية الهشاشة الضحية
@php
$labelsRv = [];
foreach($risquesVictime as $rv){
if(in_array((string)$rv->id, $oldRv)) $labelsRv[] = $rv->risque_ar ?? $rv->risque_fr;
}
@endphp
@if(count($labelsRv))
@foreach($labelsRv as $l){{ $l }}@endforeach
@else
—
@endif
مؤشرات الخطورة حسب القائم بالعنف
@php
$labelsRa = [];
foreach($risquesAgresseur as $ra){
if(in_array((string)$ra->id, $oldRa)) $labelsRa[] = $ra->risque_ar ?? $ra->risque_fr;
}
@endphp
@if(count($labelsRa))
@foreach($labelsRa as $l){{ $l }}@endforeach
@else
—
@endif
مؤشرات الخطورة حسب خصوصية حالة العنف
@php
$labelsRvv = [];
foreach($risquesViolence as $rvv){
if(in_array((string)$rvv->id, $oldRvv)) $labelsRvv[] = $rvv->risque_viol_ar ?? $rvv->risque_viol_fr;
}
@endphp
@if(count($labelsRvv))
@foreach($labelsRvv as $l){{ $l }}@endforeach
@else
—
@endif
@php
$parcoursObj = $parcours ?? null;
$selectedParcoursDest = old('parcours_destinations', $parcoursDestIds ?? []);
if (!is_array($selectedParcoursDest)) $selectedParcoursDest = $selectedParcoursDest ? (array)$selectedParcoursDest : [];
$selectedParcoursDest = array_map('strval', $selectedParcoursDest);
$selDecisionPoursuite = (string) (old('id_decision_poursuite_anterieur', $parcoursObj->id_decision_poursuite_anterieur ?? '') ?? '');
$requisition = (string) old('requisition_medicale', isset($parcoursObj) ? (string)($parcoursObj->requisition_medicale ?? '') : '');
$selTypeRequisition = (string) old('id_type_requisition', $parcoursObj->id_type_requisition ?? '');
$eng_san = (string) old('engagement_sanitaire', isset($parcoursObj) ? (string)($parcoursObj->engagement_sanitaire ?? '') : '');
$selTypeServiceSante = (string) old('id_type_service_sante', $parcoursObj->id_type_service_sante ?? '');
$cert48 = (string) old('cert_med_48h', isset($parcoursObj) ? (string)($parcoursObj->cert_med_48h ?? '') : '');
$certFree = (string) old('cert_med_gratuite', isset($parcoursObj) ? (string)($parcoursObj->cert_med_gratuite ?? '') : '');
$certReq = (string) old('cert_med_par_requisition', isset($parcoursObj) ? (string)($parcoursObj->cert_med_par_requisition ?? '') : '');
$autres_services = (string) old('autres_services_sante', isset($parcoursObj) ? (string)($parcoursObj->autres_services_sante ?? '') : '');
$selEngagementJud = (string) old('engagement_judiciaire', isset($parcoursObj) ? (string)($parcoursObj->engagement_judiciaire ?? '') : '');
$selTypeServiceJud = (string) old('id_type_service_judiciare', $parcoursObj->id_type_service_judiciare ?? '');
$selConseilJuridique = (string) (old('conseil_juridique', $signalement->conseil_juridique ?? '') ?? '');
$selServicesOrientation = (string) (old('services_orientation', $signalement->services_orientation ?? '') ?? '');
$selInstitutionOrientation = (string) (old('id_institution_orientation', $signalement->id_institution_orientation ?? '') ?? '');
$remarquesParcoursValue = old('remarques_parcours', $signalement->remarques ?? $parcoursObj->autres_services_sante ?? '');
@endphp
المؤسسة التي تم توجيه الضحية والأطفال المرافقون إليها
@php
$labelsPd = [];
foreach($parcoursDestinations as $pd){
if(in_array((string)$pd->id, $selectedParcoursDest)) $labelsPd[] = $pd->destination_ar ?? $pd->destination_fr;
}
@endphp
@if(count($labelsPd))
@foreach($labelsPd as $l){{ $l }}@endforeach
@else
—
@endif
موقف الضحية من التتبع
@php $selDec = $selDecisionPoursuite ? (optional($decisionsPoursuite->firstWhere('id',$selDecisionPoursuite))->decision_ar ?? optional($decisionsPoursuite->firstWhere('id',$selDecisionPoursuite))->decision_fr) : null; @endphp
{{ $selDec ?? '—' }}
تحصلت على تسخير طبي
{!! $showBool($requisition) !!}
نوع التسخير (إن وُجد)
@php $selTR = $selTypeRequisition ? (optional($typeRequisitions->firstWhere('id',$selTypeRequisition))->requisition_ar ?? optional($typeRequisitions->firstWhere('id',$selTypeRequisition))->requisition_fr) : null; @endphp
{{ $selTR ?? '—' }}
التعهد الصحي
{!! $showBool($eng_san) !!}
شهادة طبية أولية خلال 48 ساعة
{!! $showBool($cert48) !!}
الشهادة الطبية الأولية مجانية
{!! $showBool($certFree) !!}
شهادة طبية في إطار تسخير
{!! $showBool($certReq) !!}
تمتعت بخدمات صحية أخرى
{!! $showBool($autres_services) !!}
نوع خدمات صحية (إن وُجد)
@php $selTS = $selTypeServiceSante ? (optional($typeServicesSante->firstWhere('id',$selTypeServiceSante))->service_ar ?? optional($typeServicesSante->firstWhere('id',$selTypeServiceSante))->service_fr) : null; @endphp
{{ $selTS ?? '—' }}
التعهد القضائي
{!! $showBool($selEngagementJud) !!}
نوع خدمات إرشاد/قضائية
@php $selTSJ = $selTypeServiceJud ? (optional($typeServicesJudiciare->firstWhere('id',$selTypeServiceJud))->service_ar ?? optional($typeServicesJudiciare->firstWhere('id',$selTypeServiceJud))->service_fr) : null; @endphp
{{ $selTSJ ?? '—' }}
خدمات الإرشاد القانوني
{!! $showBool($selConseilJuridique) !!}
خدمات التوجيه
{!! $showBool($selServicesOrientation) !!}
الجهة التي تم التوجيه إليها
@php $selIns = $selInstitutionOrientation ? (optional($institutionsOrient->firstWhere('id',$selInstitutionOrientation))->institut_ar ?? optional($institutionsOrient->firstWhere('id',$selInstitutionOrientation))->institut_fr) : null; @endphp
{{ $selIns ?? '—' }}
ملاحظات المكلفة بالإنصات
{{ $remarquesParcoursValue ? e($remarquesParcoursValue) : '—' }}
{{-- small client-side helper to show label of parcours selection if needed (read-only) --}}