@extends('layouts.app') @section('content')

Submittion Form

Left Logo
BORANG PERMOHONAN MYGAP 1-1
APPLICATION

(SILA RUJUK PANDUAN MENGISI BORANG)

Right Logo

{{ $submittedForm->form->title }}

{{ $submittedForm->created_by }}

{{ $submittedForm->id_form }}

{{ $submittedForm->form_status->title ?? 'N/A' }}

Download PDF @foreach ($sections as $section)
{{ $section->title }}
@foreach ($section->form_question as $question)
@php $answers = $submittedForm->form_answer->where( 'id_form_question', $question->id, ); @endphp @switch($question->answer_type) @case('text') @case('textarea') @case('number') @case('date')

{{ $answers->first()->value ?? 'No answer provided' }}

@break @case('select') @case('radio') @case('dropdown')

{{ $answers->first()->value ?? 'No answer provided' }}

@break @case('checkbox') @if ($answers->isNotEmpty())
    @foreach ($answers as $answer)
  • {{ $answer->value }}
  • @endforeach
@else

No answer provided

@endif @break @case('file') @if ($answers->first()) @php $fileData = json_decode($answers->first()->value, true); $originalFilePath = $fileData['original'] ?? null; @endphp @if ($originalFilePath) @else

No original file uploaded

@endif @else

No file uploaded

@endif @break @case('custom_ui') @php $crops = [ 'Fruits' => 24, 'Vegetables' => 25, 'Paddy' => 26, 'Others' => 27, ]; @endphp @foreach ($crops as $crop => $questionId) @endforeach
Commodity Crop Type Planted Area (ha)
{{ $crop }} {{ $submittedForm->form_answer->where('id_form_question', $questionId)->pluck('value')->first() ?? 'No answer provided' }} {{ $submittedForm->form_answer->where('id_form_question', $questionId)->pluck('value')->skip(1)->first() ?? 'No answer provided' }}

Total Planted Area: @php // Sum the values for the area $areaAnswers = $submittedForm->form_answer->where( 'id_form_question', 28, ); $totalArea = $areaAnswers->sum(function ($answer) { return (float) $answer->value; }); @endphp {{ $totalArea > 0 ? $totalArea : 'Not provided' }} ha

@break @default

Unknown question type

@endswitch
@endforeach
@endforeach
@endsection