@extends('layouts.app') @section('content')
@if(!isset($validated)) ความคืบหน้าการกรอกข้อมูลผลิตภัณฑ์ @else ความคืบหน้าการประเมินคู่มือ @endif
0/5
@if(!isset($validated)) กรุณากรอกข้อมูลผลิตภัณฑ์ให้ครบถ้วน @else กรุณาตอบคำถามการประเมินให้ครบถ้วน @endif
@if(!isset($validated))

{{ __('เพิ่มผลิตภัณฑ์') }}

@csrf @if (strtolower(Auth::user()->Level) === 'consult') @endif
@error('name')
{{ $message }}
@enderror
@error('model')
{{ $message }}
@enderror
@error('log_receive_method')
{{ $message }}
@enderror
@error('product_type')
{{ $message }}
@enderror
{{ __('รองรับไฟล์: JPEG, PNG, JPG, GIF, SVG ขนาดไม่เกิน 2MB') }}
@error('image')
{{ $message }}
@enderror
@error('description')
{{ $message }}
@enderror
{{ __('ยกเลิก') }}
@else

{{ __('แบบประเมินคู่มือ') }}

ข้อมูลผลิตภัณฑ์ที่กรอกไว้

ชื่อ: {{ $validated['name'] }}

รุ่น: {{ $validated['model'] ?? 'ไม่ระบุ' }}

ประเภท: {{ $validated['product_type'] == 'hw_sw_log_server' ? 'Hardware + Software Log Server' : 'Software Log Server' }}

คำแนะนำในการประเมิน

กรุณาอ่านคำถามอย่างละเอียดและตอบตามความจริง เพื่อให้ได้ผลการประเมินที่แม่นยำ

@csrf @if (strtolower(Auth::user()->Level) === 'consult') @endif
@php $globalQuestionNumber = 1; @endphp @foreach($questionGroups as $groupIndex => $group)
@php $allQuestions = \App\Models\Question::all(); $groupQuestions = $allQuestions->where('question_group_id', $group->id); @endphp @foreach($groupQuestions as $questionIndex => $question) @if($question->use_in_evaluation && !$question->parent_id && $question->question_type !== null)
{{ $globalQuestionNumber }}
{{ $question->question_text }}
@if($question->question_type == 'yes_no')
@elseif($question->question_type == 'multiple_choice')
@php $choices = $question->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ @if(config('app.debug'))
Debug: choices = {{ json_encode($question->choices) }} @endif
@endif
@elseif($question->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif($question->question_type === null && !$question->parent_id)

@foreach($group->questions->where('parent_id', $question->id) as $childIndex => $child) @if($child->use_in_evaluation && $child->question_type !== null)
{{ $child->question_text }}
@if($child->question_type == 'yes_no')
@elseif($child->question_type == 'multiple_choice')
@php $choices = $child->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ @if(config('app.debug'))
Debug: choices = {{ json_encode($child->choices) }} @endif
@endif
@elseif($child->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif(!$child->use_in_evaluation && $child->question_type !== null)
{{ $child->question_text }}
@if($child->question_type == 'multiple_choice')
@php $choices = $child->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ @if(config('app.debug'))
Debug: choices = {{ json_encode($child->choices) }} @endif
@endif
@elseif($child->question_type == 'text')
@endif
@elseif( $child->question_type === null)

@foreach($group->questions->where('parent_id', $child->id) as $grandChildIndex => $grandChild) @if($grandChild->use_in_evaluation && $grandChild->question_type !== null)
{{ $grandChild->question_text }}
@if($grandChild->question_type == 'yes_no')
@elseif($grandChild->question_type == 'multiple_choice')
@php $choices = $grandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ @if(config('app.debug'))
Debug: choices = {{ json_encode($grandChild->choices) }} @endif
@endif
@elseif($grandChild->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif(!$grandChild->use_in_evaluation && $grandChild->question_type !== null)
{{ $grandChild->question_text }}
@if($grandChild->question_type == 'multiple_choice')
@php $choices = $grandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ @if(config('app.debug'))
Debug: choices = {{ json_encode($grandChild->choices) }} @endif
@endif
@elseif($grandChild->question_type == 'text')
@endif
@elseif( $grandChild->question_type === null)

@foreach($group->questions->where('parent_id', $grandChild->id) as $greatGrandChildIndex => $greatGrandChild) @if($greatGrandChild->use_in_evaluation && $greatGrandChild->question_type !== null)
{{ $greatGrandChild->question_text }}
@if($greatGrandChild->question_type == 'yes_no')
@elseif($greatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGrandChild->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif(!$greatGrandChild->use_in_evaluation && $greatGrandChild->question_type !== null)
{{ $greatGrandChild->question_text }}
@if($greatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGrandChild->question_type == 'text')
@endif
@elseif($greatGrandChild->question_type === null)

@foreach($group->questions->where('parent_id', $greatGrandChild->id) as $greatGreatGrandChildIndex => $greatGreatGrandChild) @if($greatGreatGrandChild->use_in_evaluation && $greatGreatGrandChild->question_type !== null)
{{ $greatGreatGrandChild->question_text }}
@if($greatGreatGrandChild->question_type == 'yes_no')
@elseif($greatGreatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGreatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGreatGrandChild->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif(!$greatGreatGrandChild->use_in_evaluation && $greatGreatGrandChild->question_type !== null)
{{ $greatGreatGrandChild->question_text }}
@if($greatGreatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGreatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGreatGrandChild->question_type == 'text')
@endif
@elseif(!$greatGreatGrandChild->question_type === null)

@foreach($group->questions->where('parent_id', $greatGreatGrandChild->id) as $greatGreatGreatGrandChildIndex => $greatGreatGreatGrandChild) @if($greatGreatGreatGrandChild->use_in_evaluation && $greatGreatGreatGrandChild->question_type !== null)
{{ $greatGreatGreatGrandChild->question_text }}
@if($greatGreatGreatGrandChild->question_type == 'yes_no')
@elseif($greatGreatGreatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGreatGreatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGreatGreatGrandChild->question_type == 'text')
@endif
@php $globalQuestionNumber++; @endphp @elseif(!$greatGreatGreatGrandChild->use_in_evaluation && $greatGreatGreatGrandChild->question_type !== null)
{{ $greatGreatGreatGrandChild->question_text }}
@if($greatGreatGreatGrandChild->question_type == 'multiple_choice')
@php $choices = $greatGreatGreatGrandChild->choices; if (is_string($choices)) { $choices = json_decode($choices, true); } @endphp @if($choices && is_array($choices) && count($choices) > 0) @foreach($choices as $choiceIndex => $choice)
@endforeach @else
ไม่มีตัวเลือกให้เลือก กรุณาติดต่อผู้ดูแลระบบ
@endif
@elseif($greatGreatGreatGrandChild->question_type == 'text')
@endif
@endif @endforeach
@endif @endforeach
@endif @endforeach
@endif @endforeach
@endif @endforeach
@endif @endforeach
@endforeach
@endif
@endsection