@extends('backend.layouts.app') @section('title', __('labels.backend.questions.title').' | '.app_name()) @section('content') {!! Form::model($question, ['method' => 'PUT', 'route' => ['admin.questions.update', $question->id], 'files' => true,]) !!}

@lang('labels.backend.questions.edit')

{!! Form::label('question', trans('labels.backend.questions.fields.question').'*', ['class' => 'control-label']) !!} {!! Form::textarea('question', old('question'), ['class' => 'form-control ', 'placeholder' => '', 'required' => '']) !!}

@if($errors->has('question'))

{{ $errors->first('question') }}

@endif
@if ($question->question_image)
{!! Form::label('question_image', trans('labels.backend.questions.fields.question_image'), ['class' => 'control-label']) !!} {!! Form::file('question_image', ['class' => 'form-control', 'style' => 'margin-top: 4px;']) !!} {!! Form::hidden('question_image_max_size', 8) !!} {!! Form::hidden('question_image_max_width', 4000) !!} {!! Form::hidden('question_image_max_height', 4000) !!}

@if($errors->has('question_image'))

{{ $errors->first('question_image') }}

@endif
@else
{!! Form::label('question_image', trans('labels.backend.questions.fields.question_image'), ['class' => 'control-label']) !!} {!! Form::file('question_image', ['class' => 'form-control', 'style' => 'margin-top: 4px;']) !!} {!! Form::hidden('question_image_max_size', 8) !!} {!! Form::hidden('question_image_max_width', 4000) !!} {!! Form::hidden('question_image_max_height', 4000) !!}

@if($errors->has('question_image'))

{{ $errors->first('question_image') }}

@endif
@endif
{!! Form::label('score', trans('labels.backend.questions.fields.score').'*', ['class' => 'control-label']) !!} {!! Form::number('score', old('score'), ['class' => 'form-control', 'placeholder' => '', 'required' => '']) !!}

@if($errors->has('score'))

{{ $errors->first('score') }}

@endif
{!! Form::label('tests', trans('labels.backend.questions.fields.tests'), ['class' => 'control-label']) !!} {!! Form::select('tests[]', $tests, old('tests') ? old('tests') : $question->tests->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple']) !!}

@if($errors->has('tests'))

{{ $errors->first('tests') }}

@endif
@foreach ($question->options as $key=>$option) @php $key++ @endphp
{!! Form::label('option_text_' . $option->id, trans('labels.backend.questions.fields.option_text').'*', ['class' => 'control-label']) !!} {!! Form::textarea('option_text_' . $key, $option->option_text, ['class' => 'form-control ', 'rows' => 3]) !!}

@if($errors->has('option_text_' . $option->id))

{{ $errors->first('option_text_' . $option->id) }}

@endif
{!! Form::label('explanation_' . $option->id, trans('labels.backend.questions.fields.option_explanation').'*', ['class' => 'control-label']) !!} {!! Form::textarea('explanation_' . $key, $option->explanation, ['class' => 'form-control ', 'rows' => 3]) !!}

@if($errors->has('explanation_' . $option->id))

{{ $errors->first('explanation_' . $option->id) }}

@endif
{!! Form::label('correct_' . $key, trans('labels.backend.questions.fields.correct'), ['class' => 'control-label']) !!} {!! Form::hidden('correct_' . $option->id, 0) !!} {!! Form::hidden('option_id_'.$key, $option->id ) !!} {!! Form::checkbox('correct_' . $key, 1, ($option->correct == 1) ? true : false, []) !!}

@if($errors->has('correct_' . $question))

{{ $errors->first('correct_' . $question) }}

@endif
@endforeach
{!! Form::submit(trans('strings.backend.general.app_update'), ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!} @stop