Flash message and UI changes

This commit is contained in:
yash 2024-07-24 17:24:47 +05:30
parent 9f113236c5
commit 93916d6cde
6 changed files with 22 additions and 14 deletions

View File

@ -118,13 +118,13 @@ class ResponseController extends Controller
$validatedData = $request->validate([
'answers' => 'required|array',
'answers.*' => 'required',
'answers' => 'array',
'answers.*' => '',
]);
foreach ($requiredQuestionIds as $requiredQuestionId) {
if (!array_key_exists($requiredQuestionId, $validatedData['answers'])) {
if (!isset($validatedData['answers'][$requiredQuestionId]) || empty($validatedData['answers'][$requiredQuestionId])) {
return redirect()->back()
->withErrors(['errors' => 'Please answer all required questions.'])
->withInput();

View File

@ -62,7 +62,7 @@
<option value="dropdown">Dropdown</option>
<option value="text">Text</option>
</select>
<input style="border:none; border-bottom: 2px solid rgb(103,58,183); border-radius:0" type="text" name="question" class="form-control question-input mb-3" placeholder="Type your question here" />
<input style="border:none; border-bottom: 2px solid rgb(103,58,183); border-radius:0; color:black" type="text" name="question" class="form-control question-input mb-3" placeholder="Type your question here" />
<div class="options-container mb-3">
</div>

View File

@ -21,7 +21,7 @@
</head>
<body class="bg-purple-100">
<nav class="bg-white p-1 shadow-md">
<nav class="bg-white p-0.5 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</span>

View File

@ -35,6 +35,16 @@
</div>
</div>
</nav>
@if (session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-2 rounded relative mt-4" role="alert">
<span class="block sm:inline">{{ session('success') }}</span>
</div>
@endif
@if (session('delete'))
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-2 rounded relative mt-4" role="alert">
<span class="block sm:inline">{{ session('delete') }}</span>
</div>
@endif
<div class="question_form bg-gray-100 p-4 rounded shadow-sm">
<div class="section">
<div class="question_title_section mb-4">

View File

@ -75,9 +75,9 @@
});
} else {
Swal.fire({
title: 'Success!',
text: 'Form submitted successfully.',
icon: 'success',
title: 'Error!',
text: 'Error submitting. Answer all required questions',
icon: 'error',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {

View File

@ -12,10 +12,8 @@ export default defineConfig({
}),
],
server: {
host: '0.0.0.0',
port: 3000,
hmr: {
host: '192.168.2.179',
},
},
// host: '192.168.29.229',
host: '192.168.2.179',
port: 5173
},
});