37 lines
1.7 KiB
PHP
37 lines
1.7 KiB
PHP
<x-app-layout>
|
|
<div class="max-w-2xl mx-auto p-4 sm:p-6 lg:p-8">
|
|
<form method="POST" action="{{ route('take_tests.store') }}">
|
|
@csrf
|
|
<input type="hidden" value="{{ $test_id }}" name="test_id">
|
|
<div class="flex flex-col gap-5 mb-10">
|
|
@foreach ($questions as $idx => $question)
|
|
<div class="rounded overflow-hidden shadow-lg bg-slate-200 p-5">
|
|
<div class="mb-2">
|
|
{{ __("Question:") }}
|
|
{{ $question["question"] }}
|
|
</div>
|
|
{{ __("Answer:") }}
|
|
@if ($question["answer_type"] == "single_answer")
|
|
<x-text-input name="answer[]" placeholder="{{ __('Answer') }}" />
|
|
@elseif ($question["answer_type"] == "single_choice")
|
|
<x-select name="answer[]">
|
|
@foreach ($question["answers"] as $answer)
|
|
<option value="{{ $answer }}">{{ $answer }}</option>
|
|
@endforeach
|
|
</x-select>
|
|
@elseif ($question["answer_type"] == "multiple_choice")
|
|
@foreach ($question["answers"] as $answer)
|
|
<div>
|
|
<x-bool-input name="answer[{{$idx}}][]" value="{{$answer}}" />
|
|
{{ $answer }}
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
<x-primary-button>{{ __("End test") }}</x-primary-button>
|
|
</form>
|
|
</div>
|
|
</x-app-layout>
|