diff options
author | Mateja <mail@matejamaric.com> | 2021-03-21 23:11:56 +0100 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-03-21 23:11:56 +0100 |
commit | 4826b8d444db4f95baeead504fb816e7322ff026 (patch) | |
tree | c3856d60d14885257da782017f1f7438925c6f87 /resources | |
parent | 3d4617bac822b54c04eb2f19509aa77e8c7a3bfd (diff) | |
download | yota-laravel-4826b8d444db4f95baeead504fb816e7322ff026.tar.gz yota-laravel-4826b8d444db4f95baeead504fb816e7322ff026.zip |
Add error handling to `call-sign-description.vue` component.
Diffstat (limited to 'resources')
-rw-r--r-- | resources/js/components/call-sign-description.vue | 10 | ||||
-rw-r--r-- | resources/views/pages/reserve.blade.php | 23 |
2 files changed, 11 insertions, 22 deletions
diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue index 30cd37d..7ab8b64 100644 --- a/resources/js/components/call-sign-description.vue +++ b/resources/js/components/call-sign-description.vue @@ -2,7 +2,7 @@ <div> <div class="form-group"> <label for="special-call">Special Callsign:</label> - <select class="form-control" id="special-call" v-model="selected" name="scall" required> + <select class="form-control" :class="{ 'is-invalid': isInvalid }" id="special-call" v-model="selected" :name="name" required> <option v-for="option in options" :key="option.id" :value="option.sign" v-text="option.sign"></option> </select> </div> @@ -17,10 +17,16 @@ <script> export default { + props: [ 'name', 'old', 'isInvalid' ], mounted() { this.$store.dispatch('pullSigns').then(() => { try { - this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign); + if (this.old) { + this.$store.dispatch('setSelectedSign', this.old); + } + else { + this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign); + } } catch { console.log('No call signs!'); diff --git a/resources/views/pages/reserve.blade.php b/resources/views/pages/reserve.blade.php index d0253df..17cab9a 100644 --- a/resources/views/pages/reserve.blade.php +++ b/resources/views/pages/reserve.blade.php @@ -18,29 +18,13 @@ <form action="{{ route('reserve') }}" method="POST"> @csrf - <call-sign-description></call-sign-description> + <!-- SPECIAL CALL --> + <call-sign-description name="scall" old="{{ old('scall') }}" @error('scall') is-invalid="true" @enderror > + </call-sign-description> @error('scall') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror - {{--<!-- SPECIAL CALL -->--}} -{{--<div class="form-group">--}} - {{--<label for="special-call">Special Callsign:</label>--}} - {{--<select class="form-control @error('scall') is-invalid @enderror" id="special-call" name="scall" required>--}} - {{--@foreach ($signs as $sign)--}} - {{--<option value="{{ $sign->sign }}" {{ old('scall') == $sign->sign ? 'selected' : '' }}>{{ $sign->sign }}</option>--}} - {{--@endforeach--}} - {{--</select> --}} - {{--@error('scall')--}} - {{--<div class="alert alert-danger mt-2">{{ $message }}</div>--}} - {{--@enderror--}} -{{--</div>--}} - -{{--<div class="card mb-3">--}} - {{--<div class="card-body pb-1">--}} - {{--<div class="card-text" id="call-desc"></div>--}} - {{--</div>--}} -{{--</div>--}} @error('time') <div class="alert alert-danger mt-2">{{ $message }}</div> @@ -169,5 +153,4 @@ format: 'H:i' }); </script> - {{--<script src="{{ asset('js/reserve.js') }}"></script>--}} @endsection |