2019-11-28 01:49:21 +01:00
|
|
|
@extends('layout.app')
|
|
|
|
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
|
|
|
@section('left-menu')
|
|
|
|
@parent<ul>
|
2020-01-30 21:19:05 +01:00
|
|
|
<a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
|
|
|
<a href="/wyjazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
|
2019-11-28 01:49:21 +01:00
|
|
|
</ul>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('center-area')
|
|
|
|
@parent
|
2020-01-22 00:54:08 +01:00
|
|
|
<form method="POST" action="/wyjazdy/edit" id="dynamic_form" >
|
2019-11-28 01:49:21 +01:00
|
|
|
{{ csrf_field() }}
|
2019-12-07 14:44:28 +01:00
|
|
|
|
|
|
|
<input type="hidden" class="form-control" name="operationID" value="{{ $operation->id }}">
|
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" value="{{ \Carbon\Carbon::parse($operation->operationDate)->format('Y-m-d\TH:i') }}" class="form-control">
|
|
|
|
</div>
|
2019-11-28 01:49:21 +01:00
|
|
|
</div>
|
|
|
|
|
2020-01-22 00:54:08 +01:00
|
|
|
|
2019-11-28 01:49:21 +01:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Miejsce akcji:</label>
|
2020-01-29 01:57:19 +01:00
|
|
|
<input type="text" class="form-control is-valid" id="operationLocation" name="operationLocation" value="{{ $operation->location}}">
|
2019-11-28 01:49:21 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2020-01-22 00:54:08 +01:00
|
|
|
<label for="location" >Cel wyjazdu:</label>
|
2019-12-07 14:44:28 +01:00
|
|
|
<input type="text" class="form-control" id="operationTarget" name="operationTarget" value="{{ $operation->target }}">
|
2019-11-28 01:49:21 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Rodzaj zagrożenia:</label>
|
2020-01-29 01:57:19 +01:00
|
|
|
<input type="text" class="form-control is-valid" id="operationDangerType" name="operationDangerType" value="{{ $operation->dangerType }}">
|
2019-11-28 01:49:21 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Opis akcji:</label>
|
2019-12-07 14:44:28 +01:00
|
|
|
<textarea class="form-control" id="'operationDescription" name="operationDescription">{{ $operation->description }}</textarea>
|
2019-11-28 01:49:21 +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>
|
2020-02-27 14:33:21 +01:00
|
|
|
@foreach ($leaders as $leader)
|
|
|
|
<option value="{{$leader->id}}" {{$leader->id == $operation->commanderID ? 'selected' : ''}}>{{ $leader->name }} {{$leader->surname }}</option>
|
2020-01-22 00:54:08 +01:00
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-12-07 14:50:37 +01:00
|
|
|
</div>
|
2019-11-28 01:49:21 +01:00
|
|
|
|
|
|
|
<div class=form-group">
|
|
|
|
<div id="drivers">
|
2020-01-15 11:47:40 +01:00
|
|
|
@foreach($operationsTrucks as $operationTruck)
|
|
|
|
<div id="singleDriver">
|
2020-01-22 00:54:08 +01:00
|
|
|
<div class="row align-items-end">
|
|
|
|
<div class="col-auto">
|
|
|
|
<label for="location">Kierowca:</label>
|
|
|
|
<select name="operationDriver[]" class="form-control">
|
|
|
|
<option value="">--- Wybierz kierowcę ---</option>
|
2020-02-27 14:33:21 +01:00
|
|
|
@foreach ($drivers as $driver)
|
|
|
|
<option {{$driver->id == $operationTruck->driverID ? 'selected' : ''}} value="{{$driver->id}}">{{ $driver->name }} {{$driver->surname }}</option>
|
2020-01-22 00:54:08 +01:00
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<label for="location">Pojazd:</label>
|
|
|
|
<select name="operationVehicle[]" class="form-control">
|
|
|
|
<option value="">--- Wybierz pojazd ---</option>
|
|
|
|
@foreach ($vehicles as $vehicle)
|
2020-02-27 14:33:21 +01:00
|
|
|
<option {{$vehicle->id == $operationTruck->truckID ? 'selected' : ''}} value="{{$vehicle->id}}">{{ $vehicle->name }} {{$vehicle->codename }} {{$vehicle->registrationNumber }}
|
|
|
|
@if ($vehicle->deleted_at)
|
|
|
|
(USUNIĘTY {{$vehicle->deleted_at }})
|
|
|
|
@elseif ($vehicle->status == 0)
|
|
|
|
(zawieszony)
|
|
|
|
@endif
|
|
|
|
</option>
|
2020-01-22 00:54:08 +01:00
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<button type="button" name="remove" id="" class="btn btn-danger remove form-control">Usuń</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-15 11:47:40 +01:00
|
|
|
</div>
|
|
|
|
@endforeach
|
2020-01-22 00:54:08 +01:00
|
|
|
|
2019-11-28 01:49:21 +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-28 01:49:21 +01:00
|
|
|
</div>
|
|
|
|
|
2020-01-22 00:54:08 +01:00
|
|
|
</br>
|
|
|
|
|
2019-12-07 14:50:37 +01:00
|
|
|
<div class="form-group">
|
2020-01-22 00:54:08 +01:00
|
|
|
<table class="table table-hover">
|
|
|
|
<thead>
|
2019-12-07 14:50:37 +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:50:37 +01:00
|
|
|
</tr>
|
2020-01-22 00:54:08 +01:00
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
2019-12-07 14:50:37 +01:00
|
|
|
@php
|
2020-01-22 00:54:08 +01:00
|
|
|
$i = 0;
|
2019-12-07 14:50:37 +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}}" {{$fireFighterChecklist->memberID != null ? 'checked' : ''}} ></td>
|
|
|
|
<td><input type="checkbox" name="transport[{{$i}}]" value="{{$i}}" {{$fireFighterChecklist->privateTransport == 1 ? 'checked' : ''}}></td>
|
|
|
|
</tr>
|
|
|
|
@php
|
|
|
|
$i++;
|
|
|
|
@endphp
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
2019-12-07 14:50:37 +01:00
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2019-11-28 01:49:21 +01:00
|
|
|
<div class="form-group">
|
|
|
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@include('inc.formerrors')
|
|
|
|
</form>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
2020-01-13 04:34:20 +01:00
|
|
|
|
2019-11-28 01:49:21 +01:00
|
|
|
var count = 1;
|
|
|
|
|
|
|
|
|
|
|
|
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-12-07 14:50:37 +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-12-07 14:50:37 +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-28 01:49:21 +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-28 01:49:21 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|