aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Http/Controllers/ReservationsController.php36
-rw-r--r--resources/views/pages/reserve.blade.php133
2 files changed, 56 insertions, 113 deletions
diff --git a/app/Http/Controllers/ReservationsController.php b/app/Http/Controllers/ReservationsController.php
index a11ea39..ae130fc 100644
--- a/app/Http/Controllers/ReservationsController.php
+++ b/app/Http/Controllers/ReservationsController.php
@@ -64,7 +64,41 @@ class ReservationsController extends Controller
public function create(Request $request)
{
$signs = SpecialCall::all();
- return view('pages.reserve', compact('signs'));
+
+ $freq_list = [
+ '1.8 MHz',
+ '3.5 MHz',
+ '7 MHz',
+ '10 MHz',
+ '14 MHz',
+ '18 MHz',
+ '21 MHz',
+ '24 MHz',
+ '28 MHz',
+ '50 MHz',
+ '144 MHz',
+ '432 MHz',
+ '1.2 GHz',
+ '2.3 GHz'
+ ];
+
+ $mode_list = [
+ 'CW' => 'CW',
+ 'SSB' => 'SSB',
+ 'FM' => 'FM',
+ 'RTTY' => 'RTTY',
+ 'MFSK' => 'MFSK (JT65, FT8...)',
+ 'IMAGING' => 'IMAGING (ATV, SSTV...)',
+ 'OTHER DIGITAL' => 'OTHER DIGITAL'
+ ];
+
+ $data = [
+ 'signs' => $signs,
+ 'freq_list' => $freq_list,
+ 'mode_list' => $mode_list
+ ];
+
+ return view('pages.reserve', $data);
}
public function store(Request $request)
diff --git a/resources/views/pages/reserve.blade.php b/resources/views/pages/reserve.blade.php
index 244d70a..0395f8a 100644
--- a/resources/views/pages/reserve.blade.php
+++ b/resources/views/pages/reserve.blade.php
@@ -12,7 +12,7 @@
@endif
@if ($errors->any())
<div class="alert alert-danger">
- All fields must be filled!
+ All fields must be filled and conditions satisfied!
</div>
@endif
<form action="{{ route('reserve') }}" method="POST">
@@ -74,127 +74,36 @@
@enderror
</div>
- <!-- BANDS -->
- <fieldset class="form-group">
- <legend>I will be active on bands:</legend>
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb1" name="freqs[]" value="1.8 MHz">
- <label class="form-check-label" for="cb1">1.8 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb2" name="freqs[]" value="3.5 MHz">
- <label class="form-check-label" for="cb2">3.5 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb3" name="freqs[]" value="7 MHz">
- <label class="form-check-label" for="cb3">7 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb4" name="freqs[]" value="10 MHz">
- <label class="form-check-label" for="cb4">10 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb5" name="freqs[]" value="14 MHz">
- <label class="form-check-label" for="cb5">14 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb6" name="freqs[]" value="18 MHz">
- <label class="form-check-label" for="cb6">18 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb7" name="freqs[]" value="21 MHz">
- <label class="form-check-label" for="cb7">21 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb8" name="freqs[]" value="24 MHz">
- <label class="form-check-label" for="cb8">24 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb9" name="freqs[]" value="28 MHz">
- <label class="form-check-label" for="cb9">28 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb10" name="freqs[]" value="50 MHz">
- <label class="form-check-label" for="cb10">50 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb11" name="freqs[]" value="144 MHz">
- <label class="form-check-label" for="cb11">144 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb12" name="freqs[]" value="432 MHz">
- <label class="form-check-label" for="cb12">432 MHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb13" name="freqs[]" value="1.2 GHz">
- <label class="form-check-label" for="cb13">1.2 GHz</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="cb14" name="freqs[]" value="2.3 GHz">
- <label class="form-check-label" for="cb14">2.3 GHz</label>
-</div>
+<!-- BANDS -->
+<fieldset class="form-group">
+ <legend>I will be active on bands:</legend>
+@foreach ($freq_list as $freq)
+ <div class="form-check">
+ <input class="form-check-input" type="checkbox" id="fcb{{ $loop->index }}" name="freqs[]" value="{{ $freq }}" @if(is_array(old('freqs')) && in_array($freq, old('freqs'))) checked @endif>
+ <label class="form-check-label" for="fcb{{ $loop->index }}">{{ $freq }}</label>
+ </div>
+@endforeach
@error('freqs')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
- </fieldset>
-
- <!-- MODES -->
- <fieldset class="form-group">
- <legend>I will use modes:</legend>
+</fieldset>
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="CW" name="modes[]" value="CW">
- <label class="form-check-label" for="CW">CW</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="SSB" name="modes[]" value="SSB">
- <label class="form-check-label" for="SSB">SSB</label>
-</div>
+<!-- MODES -->
+<fieldset class="form-group">
+ <legend>I will use modes:</legend>
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="FM" name="modes[]" value="FM">
- <label class="form-check-label" for="FM">FM</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="RTTY" name="modes[]" value="RTTY">
- <label class="form-check-label" for="RTTY">RTTY</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="MFSK" name="modes[]" value="MFSK">
- <label class="form-check-label" for="MFSK">MFSK (JT65, FT8...)</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="IMAGING" name="modes[]" value="IMAGING">
- <label class="form-check-label" for="IMAGING">IMAGING (ATV, SSTV...)</label>
-</div>
-
-<div class="form-check">
- <input class="form-check-input" type="checkbox" id="OTHER DIGITAL" name="modes[]" value="OTHER DIGITAL">
- <label class="form-check-label" for="OTHER DIGITAL">OTHER DIGITAL</label>
-</div>
+@foreach ($mode_list as $key => $value)
+ <div class="form-check">
+ <input class="form-check-input" type="checkbox" id="mcb{{ $loop->index }}" name="modes[]" value="{{ $key }}" @if(is_array(old('modes')) && in_array($key, old('modes'))) checked @endif>
+ <label class="form-check-label" for="mcb{{ $loop->index }}">{{ $value }}</label>
+ </div>
+@endforeach
@error('modes')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
- </fieldset>
+</fieldset>
<!-- OPERATOR CALL -->
<div class="form-group">