style >
.shadow - custom {
box - shadow: 0 10 px 15 px - 3 px rgba(0, 0, 0, 0.1), 0 4 px 6 px - 2 px rgba(0, 0, 0, 0.05);
} <
/style> < /
head >
<
body class = "bg-purple-100" >
<
nav class = "bg-white p-1 shadow-md" >
<
div class = "container mx-auto flex justify-between items-center" >
<
span style = "color: rgb(103,58,183)"
class = "text-3xl font-bold font-sans" > < a href = "{{ url('/') }}"
style = "color: rgb(103,58,183)"
class = "text-3xl font-bold font-sans" > LaraForms < /a> - Edit
<
div class = "relative dropdown" >
<
button id = "profileMenuButton"
class = "flex items-center focus:outline-none" >
<
img src = "{{ asset('images/user.png') }}"
alt = "Profile"
class = "w-10 h-10 rounded-full border-2 border-white" >
<
/button> <
div id = "profileMenu"
class = "dropdown-menu hidden absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-2" >
<
form method = "POST"
action = "{{ route('logout') }}" >
@csrf <
button type = "submit"
class = "block px-4 py-2 text-gray-700 hover:bg-gray-200 w-full text-left" > Logout < /button> < /
form > <
/div> < /
div > <
/div> < /
nav >
<
div style = "max-width: 700px"
class = "container" >
<
form id = "edit-form"
method = "POST"
action = "{{ route('forms.update', $form) }}"
class = "bg-white p-4 rounded shadow-sm" >
@csrf
@method('PUT')
<
div class = "form-group" >
<
input type = "text"
id = "form-title"
name = "title"
class = "form-control form-control-lg text-black"
placeholder = "Untitled Form"
value = "{{ $form->title }}" / >
<
/div> <
div class = "form-group" >
<
input type = "text"
name = "description"
id = "form-description"
class = "form-control form-control-sm text-black"
placeholder = "Form Description"
value = "{{ $form->description }}" / >
<
/div> <
div id = "questions-section" >
@foreach ($questions as $index => $question)
<
div class = "question mb-4 p-3 border rounded bg-light"
data - index = "{{ $index }}" >
<
div class = "form-group" >
<
select class = "form-control question-type"
id = "question-type-{{ $index }}"
name = "questions[{{ $index }}][type]" >
<
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> <
option value = "text"
{{ $question->type === 'text' ? 'selected' : '' }} > Text < /option> < /
select > <
/div> <
div class = "form-group" >
<
input type = "text"
id = "question-text-{{ $index }}"
name = "questions[{{ $index }}][text]"
class = "form-control question-input"
value = "{{ $question->question_text }}"
required >
<
/div> <
div class = "form-group form-check" >
<
input type = "checkbox"
id = "question-required-{{ $index }}"
name = "questions[{{ $index }}][required]"
class = "form-check-input"
{{ $question->required ? 'checked' : '' }} >
<
label
for = "question-required-{{ $index }}"
class = "form-check-label" > Required < /label> < /
div > <
div class = "form-group options-container"
style = "{{ $question->type === 'text' ? 'display:none;' : '' }}" >
<
label > Options < /label>
@if (is_array($question->options))
@foreach ($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"
value = "{{ $option }}" >
<
span class = "delete-option ml-2 text-danger"
onclick = "deleteOption(this)"
style = "cursor: pointer;" > & #10005;
@endforeach
@endif