2019-11-23 15:01:59 +01:00
|
|
|
@extends('layout.app')
|
|
|
|
|
2019-11-25 01:10:46 +01:00
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
2019-11-23 15:01:59 +01:00
|
|
|
@section('left-menu')
|
|
|
|
@parent<ul>
|
2020-01-30 21:19:05 +01:00
|
|
|
<a href="/wyjazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
|
2019-11-23 15:01:59 +01:00
|
|
|
</ul>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('center-area')
|
|
|
|
@parent
|
2019-11-25 01:10:46 +01:00
|
|
|
<form method="POST" action="/wyjazdy" id="dynamic_form">
|
2019-11-23 15:01:59 +01:00
|
|
|
{{ csrf_field() }}
|
2020-01-22 00:54:08 +01:00
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-auto">
|
|
|
|
<label for="date">Data wyjazdu: </label>
|
|
|
|
<input type="datetime-local" id="operationDate" name="operationDate" class="form-control">
|
|
|
|
</div>
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Miejsce akcji:</label>
|
|
|
|
<input type="text" class="form-control" id="operationLocation" name="operationLocation">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Cel wyjazdu:</label>
|
|
|
|
<input type="text" class="form-control" id="operationTarget" name="operationTarget">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Rodzaj zagrożenia:</label>
|
|
|
|
<input type="text" class="form-control" id="operationDangerType" name="operationDangerType">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Opis akcji:</label>
|
2020-01-13 04:34:20 +01:00
|
|
|
<textarea class="form-control" id="'operationDescription" name="operationDescription" placeholder="Opis akcji..."></textarea>
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
|
|
|
|
2020-01-22 00:54:08 +01:00
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-auto">
|
|
|
|
<label for="location">Dowodzący:</label>
|
|
|
|
<select name="operationLeader" class="form-control">
|
|
|
|
<option value="">--- Wybierz dowódcę ---</option>
|
|
|
|
@foreach ($fireFighters as $fireFighter)
|
2020-01-30 21:19:05 +01:00
|
|
|
@if(Illuminate\Support\Facades\Input::old('operationLeader') == $fireFighter->id)
|
|
|
|
<option value="{{$fireFighter->id}}" selected>{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
|
|
|
|
@else
|
|
|
|
<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
|
|
|
|
@endif
|
2020-01-22 00:54:08 +01:00
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2019-11-25 01:10:46 +01:00
|
|
|
<div class=form-group">
|
|
|
|
<div id="drivers">
|
2020-01-24 23:05:55 +01:00
|
|
|
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
2020-01-22 00:54:08 +01:00
|
|
|
</br>
|
|
|
|
<button type="button" name="add" id="add" class="btn btn-success">Dodaj Pojazd</button>
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
2019-11-25 01:10:46 +01:00
|
|
|
|
2020-01-22 00:54:08 +01:00
|
|
|
</br>
|
|
|
|
|
2019-12-07 14:44:28 +01:00
|
|
|
<div class="form-group">
|
2020-01-22 00:54:08 +01:00
|
|
|
<table class="table table-hover">
|
|
|
|
<thead>
|
2019-12-07 14:44:28 +01:00
|
|
|
<tr>
|
2020-01-22 00:54:08 +01:00
|
|
|
<th scope="col">#</th>
|
|
|
|
<th scope="col">Imię i Nazwisko</th>
|
|
|
|
<th scope="col">Obecność</th>
|
|
|
|
<th scope="col">Transport własny</th>
|
2019-12-07 14:44:28 +01:00
|
|
|
</tr>
|
2020-01-22 00:54:08 +01:00
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
2019-12-07 14:44:28 +01:00
|
|
|
@php
|
2020-01-22 00:54:08 +01:00
|
|
|
$i = 0;
|
2019-12-07 14:44:28 +01:00
|
|
|
@endphp
|
2020-01-22 00:54:08 +01:00
|
|
|
@foreach($fireFighters as $fireFighterChecklist)
|
|
|
|
<tr>
|
|
|
|
<th scope="row">{{$i+1}}</th>
|
|
|
|
<td>{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}</td>
|
|
|
|
<td><input type="checkbox" name="attendance[{{$i}}]" value="{{$fireFighterChecklist->id}}"></td>
|
|
|
|
<td><input type="checkbox" name="transport[{{$i}}]" value="{{$i}}"></td>
|
|
|
|
</tr>
|
|
|
|
@php
|
|
|
|
$i++;
|
|
|
|
@endphp
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
2019-12-07 14:44:28 +01:00
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2019-11-25 01:10:46 +01:00
|
|
|
<div class="form-group">
|
|
|
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
|
|
|
|
</div>
|
|
|
|
|
2019-11-23 15:01:59 +01:00
|
|
|
@include('inc.formerrors')
|
|
|
|
</form>
|
|
|
|
@stop
|
2019-11-25 01:10:46 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
var count = 1;
|
|
|
|
|
|
|
|
dynamic_field(count);
|
|
|
|
|
|
|
|
function dynamic_field(number)
|
|
|
|
{
|
|
|
|
|
2020-01-22 00:54:08 +01:00
|
|
|
html = '<div id="singleDriver">';
|
|
|
|
html += '<div class="row align-items-end">';
|
|
|
|
html += '<div class="col-auto">';
|
|
|
|
html += '<label for="location">Kierowca:</label>';
|
2019-11-25 01:10:46 +01:00
|
|
|
html += '<select name="operationDriver[]" class="form-control">';
|
|
|
|
html += '<option value="">--- Wybierz kierowcę ---</option>';
|
|
|
|
html += '@foreach ($fireFighters as $fireFighter)';
|
|
|
|
html += '<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>';
|
|
|
|
html += '@endforeach';
|
|
|
|
html += '</select>';
|
2020-01-22 00:54:08 +01:00
|
|
|
html += '</div>';
|
|
|
|
html += '<div class="col-auto">';
|
2019-11-25 01:10:46 +01:00
|
|
|
html += '<label for="location">Pojazd:</label>';
|
|
|
|
html += '<select name="operationVehicle[]" class="form-control">';
|
|
|
|
html += '<option value="">--- Wybierz pojazd ---</option>';
|
|
|
|
html += '@foreach ($vehicles as $vehicle)';
|
|
|
|
html += '<option value="{{$vehicle->id}}">{{ $vehicle->name }} {{$vehicle->codename }} {{$vehicle->registrationNumber }}</option>';
|
|
|
|
html += '@endforeach';
|
|
|
|
html += '</select>';
|
2020-01-22 00:54:08 +01:00
|
|
|
html += '</div>';
|
|
|
|
html += '<div class="col-auto">';
|
|
|
|
html += '<button type="button" name="remove" id="" class="btn btn-danger remove form-control">Usuń</button>';
|
|
|
|
html += '</div>';
|
|
|
|
html += '</div>';
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
$('#drivers').append(html);
|
2019-11-25 01:10:46 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).on('click', '#add', function(){
|
|
|
|
count++;
|
|
|
|
dynamic_field(count);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '.remove', function(){
|
|
|
|
count--;
|
2020-01-22 00:54:08 +01:00
|
|
|
|
|
|
|
swal.fire({
|
|
|
|
html: "Czy na pewno chcesz usunąć pojazd?",// this will output "Error 422: Unprocessable Entity"
|
|
|
|
width: 'auto',
|
|
|
|
confirmButtonText: 'Tak',
|
|
|
|
cancelButtonText: 'Nie',
|
|
|
|
showCancelButton: true,
|
|
|
|
}).then((result) => {
|
|
|
|
if (result.value) {
|
|
|
|
$(this).closest("#singleDriver").remove();
|
|
|
|
}
|
|
|
|
});
|
2019-11-25 01:10:46 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
2020-01-30 21:19:05 +01:00
|
|
|
</script>
|