Tour.show: Only offer rooms with free slots in modal

This commit is contained in:
Torsten 2022-06-23 08:05:32 +02:00
parent 0bc14bb7c6
commit c69e13c446

View file

@ -74,7 +74,6 @@
<a href="/tour" type="submit" class="btn btn-success col-3 mb-2 float-right mr-2">Ok</a>
@if(!App\Tour::has_participant($tour->id, Auth::user()->id))
<!-- Connected to Modal -->
<button id="myBtn" class="btn btn-danger float-left">Teilnehmen</button>
@else
@ -85,7 +84,7 @@
<!-- Modal Anzeige start -->
@ -103,7 +102,7 @@
<!-- Intentional Assignment ! -->
@if ($room_id="") @endif
@foreach($rooms as $room)
@if( $room->room_id != 0) <!-- Dont show "Ungebucht", room_id=0 -->
@if( $room->room_id != 0 and $room->free_slots >0) <!-- Dont show "Ungebucht", room_id=0 and only with available slots -->
@if ($room_id != $room->room_id)
@if(strlen($room_id))
<hr/>
@ -182,17 +181,20 @@
var span = document.getElementsByClassName("close")[0];
// When the user clicks on the button, open the modal
btn.onclick = function() {
btn.onclick = function(e) {
e.preventDefault();
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
span.onclick = function(e) {
e.preventDefault();
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
event.preventDefault();
if (event.target == modal) {
modal.style.display = "none";
}