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-05 14:48:15 +01:00
|
|
|
<a href="?addOperation"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
|
|
|
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li>
|
|
|
|
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
|
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() }}
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="date">Data wyjazdu: </label>
|
2019-12-07 14:50:37 +01:00
|
|
|
<input type="datetime-local" id="operationDate" name="operationDate" value="2017-06-01 08:30">
|
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>
|
|
|
|
<textarea class="form-control" id="'operationDescription" name="operationDescription">Enter text here...</textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class=form-group">
|
|
|
|
<label for="location">Dowodzący:</label>
|
|
|
|
<select name="operationLeader" class="form-control">
|
|
|
|
<option value="">--- Wybierz dowódcę ---</option>
|
|
|
|
@foreach ($fireFighters as $fireFighter)
|
|
|
|
<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2019-11-25 01:10:46 +01:00
|
|
|
<div class=form-group">
|
|
|
|
<div id="drivers">
|
2019-12-07 14:44:28 +01:00
|
|
|
{{-- <label for="location">Kierowca:</label>--}}
|
|
|
|
{{-- <select name="operationDriver" class="form-control">--}}
|
|
|
|
{{-- <option value="">--- Wybierz kierowcę ---</option>--}}
|
|
|
|
{{-- @foreach ($fireFighters as $fireFighter)--}}
|
|
|
|
{{-- <option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>--}}
|
|
|
|
{{-- @endforeach--}}
|
|
|
|
{{-- </select>--}}
|
|
|
|
{{-- <label for="location">Pojazd:</label>--}}
|
|
|
|
{{-- <select name="operationVehicle" class="form-control">--}}
|
|
|
|
{{-- <option value="">--- Wybierz pojazd ---</option>--}}
|
|
|
|
{{-- @foreach ($vehicles as $vehicle)--}}
|
|
|
|
{{-- <option value="{{$vehicle->id}}">{{ $vehicle->name }} {{$vehicle->codename }} {{$vehicle->registrationNumber }}</option>--}}
|
|
|
|
{{-- @endforeach--}}
|
|
|
|
{{-- </select>--}}
|
2019-11-23 15:01:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-25 01:10:46 +01:00
|
|
|
|
2019-12-07 14:44:28 +01:00
|
|
|
<div class="form-group">
|
|
|
|
<table>
|
|
|
|
<tr>
|
2019-12-07 14:50:37 +01:00
|
|
|
<td>Imię i nazwisko: </td><td></td><td>Obecność:</td><td></td><td>Transport własny:</td>
|
2019-12-07 14:44:28 +01:00
|
|
|
</tr>
|
|
|
|
@php
|
|
|
|
$i = 0;
|
|
|
|
@endphp
|
|
|
|
@foreach($fireFighters as $fireFighterChecklist)
|
|
|
|
<tr>
|
2019-12-07 14:50:37 +01:00
|
|
|
<td>{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}</td><td></td><td><center><input type="checkbox" name="attendance[{{$i}}]" value="{{$fireFighterChecklist->id}}"></center></td> <td></td> <td><center><input type="checkbox" name="transport[{{$i}}]" value="{{$i}}"></center></td>
|
2019-12-07 14:44:28 +01:00
|
|
|
</tr>
|
|
|
|
@php
|
|
|
|
$i++;
|
|
|
|
@endphp
|
|
|
|
@endforeach
|
|
|
|
</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)
|
|
|
|
{
|
|
|
|
|
|
|
|
html = '<div id="singleDriver"><label for="location">Kierowca:</label>';
|
|
|
|
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>';
|
|
|
|
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>';
|
|
|
|
|
|
|
|
if(number > 1)
|
|
|
|
{
|
|
|
|
html += '<button type="button" name="remove" id="" class="btn btn-danger remove">Usuń</button></br></div>';
|
|
|
|
$('#drivers').append(html);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
html += '<button type="button" name="add" id="add" class="btn btn-success">Dodaj</button></br></div>';
|
|
|
|
$('#drivers').html(html);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).on('click', '#add', function(){
|
|
|
|
count++;
|
|
|
|
dynamic_field(count);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '.remove', function(){
|
|
|
|
count--;
|
|
|
|
$(this).closest("#singleDriver").remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
{{--$('#dynamic_form').on('submit', function(event){--}}
|
|
|
|
{{-- event.preventDefault();--}}
|
|
|
|
{{-- $.ajax({--}}
|
|
|
|
{{-- url:'{{ route("operationController.store") }}',--}}
|
|
|
|
{{-- method:'post',--}}
|
|
|
|
{{-- data:$(this).serialize(),--}}
|
|
|
|
{{-- dataType:'json',--}}
|
|
|
|
{{-- beforeSend:function(){--}}
|
|
|
|
{{-- $('#save').attr('disabled','disabled');--}}
|
|
|
|
{{-- },--}}
|
|
|
|
{{-- success:function(data)--}}
|
|
|
|
{{-- {--}}
|
|
|
|
{{-- if(data.error)--}}
|
|
|
|
{{-- {--}}
|
|
|
|
{{-- var error_html = '';--}}
|
|
|
|
{{-- for(var count = 0; count < data.error.length; count++)--}}
|
|
|
|
{{-- {--}}
|
|
|
|
{{-- error_html += '<p>'+data.error[count]+'</p>';--}}
|
|
|
|
{{-- }--}}
|
|
|
|
{{-- $('#result').html('<div class="alert alert-danger">'+error_html+'</div>');--}}
|
|
|
|
{{-- }--}}
|
|
|
|
{{-- else--}}
|
|
|
|
{{-- {--}}
|
|
|
|
{{-- dynamic_field(1);--}}
|
|
|
|
{{-- $('#result').html('<div class="alert alert-success">'+data.success+'</div>');--}}
|
|
|
|
{{-- }--}}
|
|
|
|
{{-- $('#save').attr('disabled', false);--}}
|
|
|
|
{{-- }--}}
|
|
|
|
{{-- })--}}
|
|
|
|
{{--});--}}
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|