Skip to content

Commit

Permalink
Διόρθωση μηνύματος που εμφανίζεται όταν δεν επιλέγεις τιμή σε υποχρεω…
Browse files Browse the repository at this point in the history
…τικό combobox (#121)

* Ενεργοποίηση paste

* Διόρθωση μηνύματος που εμφανίζεται όταν δεν επιλέγεις τιμή σε υποχρεωτικό combobox
Fixes #115

* Αφαίρεση περιττής γραμμής
  • Loading branch information
parapente authored Oct 2, 2024
1 parent 52a723d commit a4fec05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/Http/Requests/UpdateReportRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\FormField;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\File;
Expand Down Expand Up @@ -121,6 +122,12 @@ public function rules(): array
}, json_decode($field->listvalues));
if (! $field->required) {
$accepted_values[] = '-1';
} else {
if (Request::input("f{$field->id}") === '-1') {
throw ValidationException::withMessages([
"f{$field->id}" => ['Πρέπει να επιλέξετε κάτι από τη λίστα'],
]);
}
}
$field_rules[] = Rule::in($accepted_values);
} elseif ($field->type === FormField::TYPE_TELEPHONE) {
Expand Down
8 changes: 5 additions & 3 deletions resources/views/report/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
<hr />
<div class="card">
<div class="card-header">
Συμπληρωμένη φόρμα - <span class="h5 fw-bold">{{ $school?->name }} {{ $teacher?->surname }} {{ $teacher?->name }} {{ $other_teacher?->name }}</span>
Συμπληρωμένη φόρμα - <span class="h5 fw-bold">{{ $school?->name }} {{ $teacher?->surname }}
{{ $teacher?->name }} {{ $other_teacher?->name }}</span>
</div>
<div class="card-body">
@php
Expand All @@ -44,7 +45,7 @@
->data()
->where('school_id', $school->id)
->max('record');
} else if ($teacher !== null) {
} elseif ($teacher !== null) {
$total_records = $form
->data()
->where('teacher_id', $teacher->id)
Expand All @@ -70,7 +71,8 @@
$options = json_decode($field->options);
@endphp
<field-group :field="{{ $field }}" :data="{{ $data }}" :disabled="false" error="{{ $errors->first("f{$field->id}") }}"></field-group>
<field-group :field="{{ $field }}" :disabled="false"
errors="{{ $errors->first("f{$field->id}") ?? [] }}"></field-group>
@endforeach
@if ($form->multiple)
{{-- Αν επιτρέπονται πολλαπλές εγγραφές --}}
Expand Down

0 comments on commit a4fec05

Please sign in to comment.