@foreach($item_leave->pertanyaans->where('prodeskel_categorie_id', '17') as $pertanyaan)
@php
$data = $pertanyaan->lansia()->wherePivot('laporan_lansia_id', $laporanLansia->id)->first();
$jawaban = null;
$default = null;
$multiple = null;
if(empty($data) || is_null($data)){
$empty = true;
}else{
$empty = false;
$data = $data->pivot;
$multiple = \App\Models\LansiaHasAnswer::where('laporan_lansia_id', $laporanLansia->id)
->where('prodeskel_question_id', $pertanyaan->id)->get();
$default = \App\Models\LansiaHasDefault::where('laporan_lansia_id', $laporanLansia->id)
->where('prodeskel_question_id', $pertanyaan->id)->get();
}
@endphp
-
{{ $pertanyaan->urutan }}. {{ $pertanyaan->isi }}
@if(!$empty)
@if($pertanyaan->prodeskel_type_id === 4)
@if( !is_null($multiple) && $multiple->count() > 0 )
@foreach($multiple as $item_multiple)
@if( !is_null($default) && $default->count() > 0 )
{{ $item_multiple->prodeskelAnswerChoice->isi }}
@foreach($default as $item_default)
@if($item_multiple->id == $item_default->lansia_has_answer_id)
-
{{ $item_default->prodeskelDefaultChoice->isi }}
@if($pertanyaan->prodeskel_type_id === 4)
: {{ $item_default->jawaban }} {{ $pertanyaan->default_jawaban }}
@endif
@endif
@endforeach
@endif
@endforeach
@endif
@elseif($pertanyaan->prodeskel_type_id === 5)
@if( !is_null($multiple) && $multiple->count() > 0 )
@foreach($multiple as $item_multiple)
-
{{ $item_multiple->prodeskelAnswerChoice->isi ?? null }} : {{ $item_multiple->jawaban }} {{ $pertanyaan->default_jawaban }}
@endforeach
@endif
@else
@endif
@else
Tidak ada jawaban.
@endif
@endforeach