2024-07-18 21:12:07 +00:00
|
|
|
<!DOCTYPE html>
|
2024-07-15 06:24:05 +00:00
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
|
|
<title>Show Form - {{ $form->title }}</title>
|
|
|
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
2024-07-18 21:15:28 +00:00
|
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
|
|
|
2024-07-15 06:24:05 +00:00
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
|
|
|
|
</head>
|
2024-07-19 11:08:05 +00:00
|
|
|
<body class="bg-gray-100">
|
|
|
|
<nav class="bg-white p-2 shadow-gray-lg">
|
2024-07-18 21:15:28 +00:00
|
|
|
<div class="mx-auto flex justify-between items-center">
|
|
|
|
<a href="{{ url('/') }}" style="color: rgb(103,58,183)"
|
|
|
|
class="text-3xl font-bold font-sans">LaraForms</a>
|
2024-07-19 11:08:05 +00:00
|
|
|
|
2024-07-18 21:15:28 +00:00
|
|
|
<div class="relative dropdown">
|
2024-07-19 11:08:05 +00:00
|
|
|
<div class="btnsub text-center mt-4">
|
|
|
|
<form action="{{ route('forms.publish', $form->id) }}" method="POST">
|
2024-07-18 21:15:28 +00:00
|
|
|
@csrf
|
2024-07-19 11:08:05 +00:00
|
|
|
@method('PATCH')
|
|
|
|
<span><button type="submit" name="publish" value="publish" class="btnsave btn btn-secondary">
|
|
|
|
{{ $form->is_published ? 'Unpublish' : 'Publish' }}
|
|
|
|
</button></span>
|
2024-07-18 21:15:28 +00:00
|
|
|
</form>
|
2024-07-19 11:08:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
<div><button type="submit" name="publish" value="publish" class="btnsave btn btn-secondary">Edit</button></div>
|
2024-07-18 21:15:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-15 06:24:05 +00:00
|
|
|
</div>
|
2024-07-18 21:15:28 +00:00
|
|
|
</nav>
|
2024-07-19 11:08:05 +00:00
|
|
|
<div class="question_form bg-gray-100 p-4 rounded shadow-sm">
|
2024-07-16 19:58:18 +00:00
|
|
|
<div class="section">
|
|
|
|
<div class="question_title_section mb-4">
|
|
|
|
<div class="question_form_top">
|
|
|
|
<input type="text" id="form-title" name="title" class="form-control form-control-lg mb-2" style="color: black" placeholder="Untitled Form" value="{{ $form->title }}" readonly />
|
|
|
|
<input type="text" name="description" id="form-description" class="form-control form-control-sm" style="color: black" placeholder="Form Description" value="{{ $form->description }}" readonly />
|
2024-07-15 06:24:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-16 19:58:18 +00:00
|
|
|
<div class="section" id="questions_section">
|
|
|
|
@foreach ($form->questions as $index => $question)
|
2024-07-19 11:08:05 +00:00
|
|
|
<div class="question mb-4 p-4 border rounded bg-white">
|
2024-07-16 19:58:18 +00:00
|
|
|
<select class="form-control question_type mb-3" name="questions[{{ $index }}][type]" onchange="changeQuestionType(this)" disabled>
|
|
|
|
<option value="multiple_choice" {{ $question->type === 'multiple_choice' ? 'selected' : '' }}>Multiple Choice</option>
|
|
|
|
<option value="checkbox" {{ $question->type === 'checkbox' ? 'selected' : '' }}>Checkbox</option>
|
|
|
|
<option value="dropdown" {{ $question->type === 'dropdown' ? 'selected' : '' }}>Dropdown</option>
|
2024-07-18 21:12:07 +00:00
|
|
|
<option value="text" {{ $question->type === 'text' ? 'selected' : '' }}>Text</option>
|
2024-07-16 19:58:18 +00:00
|
|
|
</select>
|
|
|
|
<input type="text" name="questions[{{ $index }}][text]" class="form-control question-input mb-3" placeholder="Type your question here" value="{{ $question->question_text }}" readonly />
|
|
|
|
@if ($question->options)
|
|
|
|
<div class="options-container mb-3">
|
|
|
|
@foreach (json_decode($question->options) as $optionIndex => $option)
|
|
|
|
<div class="option d-flex align-items-center mb-2">
|
|
|
|
<input type="text" name="questions[{{ $index }}][options][{{ $optionIndex }}]" class="form-control option-input" placeholder="Option" value="{{ $option }}" readonly />
|
|
|
|
</div>
|
|
|
|
@endforeach
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
@endforeach
|
2024-07-15 06:24:05 +00:00
|
|
|
</div>
|
2024-07-16 19:58:18 +00:00
|
|
|
</div>
|
|
|
|
<div class="btnsub text-center mt-4">
|
2024-07-18 21:12:07 +00:00
|
|
|
<form action="{{ route('forms.publish', $form->id) }}" method="POST">
|
|
|
|
@csrf
|
|
|
|
@method('PATCH')
|
|
|
|
<span><button type="submit" name="publish" value="publish" class="btnsave btn btn-secondary">
|
|
|
|
{{ $form->is_published ? 'Unpublish' : 'Publish' }}
|
|
|
|
</button></span>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
<span><a href="{{ route('forms.index') }}" class="btnsave btn btn-secondary">Return to Forms</a></span>
|
2024-07-16 19:58:18 +00:00
|
|
|
</div>
|
2024-07-15 06:24:05 +00:00
|
|
|
<script src="{{ asset('js/script.js') }}"></script>
|
|
|
|
</body>
|
|
|
|
</html>
|