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

{{ __('admin/survey.question_detail') }}

@foreach(config('translatable.locales') as $index => $locale) @php $translation = $question->translations->where('locale', $locale)->first(); @endphp
@if($translation)
{{ __('admin/survey.question_text') }}

{{ $translation->question_text }}

@if(in_array($question->questionType->type_code, ['radio', 'checkbox', 'yesno']))
{{ __('admin/survey.answer_options') }}
@php $options = $question->getOptions($locale); @endphp @if(!empty($options))
@foreach($options as $index => $option)
{{ $index + 1 }} {{ $option }}
@endforeach
@else

{{ __('admin/survey.no_options_defined') }}

@endif
@endif
@else
{{ __('admin/survey.no_translation_available', ['locale' => strtoupper($locale)]) }}
@endif
@endforeach
{{ __('admin/survey.question_preview') }}
@php $questionText = $question->getTranslatedQuestionText() ?? __('admin/survey.question_not_translated'); $typeCode = $question->questionType->type_code; @endphp {{ $questionText }} @if($question->is_required) * @endif

@switch($typeCode) @case('text') @break @case('textarea') @break @case('radio') @case('yesno') @php $options = $question->getOptions(); @endphp @if(!empty($options)) @foreach($options as $index => $option)
@endforeach @endif @break @case('checkbox') @php $options = $question->getOptions(); @endphp @if(!empty($options)) @foreach($options as $index => $option)
@endforeach @endif @break @case('scale5')
@for($i = 1; $i <= 5; $i++)
@endfor
{{ __('admin/survey.scale_5_help') }} @break @case('scale10')
@for($i = 1; $i <= 10; $i++)
@endfor
{{ __('admin/survey.scale_10_help') }} @break @default

{{ __('admin/survey.preview_not_available') }}

@endswitch
{{ __('admin/survey.configuration') }}
{{ $question->questionType->type_name }} {{ $question->questionType->type_description }}
@if($question->is_active) {{ __('admin/survey.active') }} @else {{ __('admin/survey.inactive') }} @endif
@if($question->is_required) {{ __('admin/survey.required') }} {{ __('admin/survey.user_must_answer') }} @else {{ __('admin/survey.optional') }} @endif
{{ $question->order_position }}
{{ $question->created_at->format('d/m/Y à H:i') }}
{{ $question->updated_at->format('d/m/Y à H:i') }}
{{ __('admin/survey.response_statistics') }}
@php $responsesCount = $question->responses()->count(); @endphp
@if($responsesCount > 0) {{ $responsesCount }} @else {{ __('admin/survey.no_responses_yet') }} @endif
@if($responsesCount > 0)
@php $lastResponse = $question->responses()->latest()->first(); @endphp {{ $lastResponse ? $lastResponse->created_at->format('d/m/Y à H:i') : '-' }}
@endif
{{ __('admin/survey.actions') }}
{{ __('admin/survey.edit_this_question') }}
{{ __('admin/survey.available_translations') }}
@foreach(config('translatable.locales') as $locale)
@if($question->translate($locale)) {{ strtoupper($locale) }} - {{ __('admin/survey.translated') }} @else {{ strtoupper($locale) }} - {{ __('admin/survey.not_translated') }} @endif
@endforeach
@endsection