2019-12-25 22:35:20 +01:00
|
|
|
|
@extends('layout.app')
|
|
|
|
|
|
2020-01-24 23:05:55 +01:00
|
|
|
|
|
2020-01-04 22:04:28 +01:00
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
|
|
|
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
|
|
|
|
2019-12-25 22:35:20 +01:00
|
|
|
|
@section('left-menu')
|
|
|
|
|
@parent
|
|
|
|
|
<ul>
|
2020-01-30 21:19:05 +01:00
|
|
|
|
<a href="/strazacy"><li>Strażacy<img src="/img/left_menu_icon/more.png"></li></a>
|
2019-12-25 22:35:20 +01:00
|
|
|
|
</ul>
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
|
|
@section('center-area')
|
2020-01-29 01:57:19 +01:00
|
|
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
2019-12-25 22:35:20 +01:00
|
|
|
|
@parent
|
|
|
|
|
@if( auth()->check())
|
|
|
|
|
@if( auth()->user()->fireStationID == NULL)
|
|
|
|
|
Jednostka nie istnieje
|
|
|
|
|
@else
|
|
|
|
|
<p align='center'>
|
|
|
|
|
<form method="POST" action="/szkolenia">
|
|
|
|
|
{{ csrf_field() }}
|
|
|
|
|
<div class="form-group">
|
2020-01-30 21:19:05 +01:00
|
|
|
|
<label for="name">Nazwa nowego szkolenia/badania:</label>
|
2019-12-25 22:35:20 +01:00
|
|
|
|
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Dodaj</button>
|
|
|
|
|
</div>
|
|
|
|
|
@include('inc.formerrors')
|
|
|
|
|
</form>
|
2020-01-29 01:57:19 +01:00
|
|
|
|
<table class='table'>
|
2019-12-25 22:35:20 +01:00
|
|
|
|
<tr class='table-header'>
|
2020-01-29 01:57:19 +01:00
|
|
|
|
<thead>
|
|
|
|
|
<th>#</th>
|
|
|
|
|
<th>Nazwa Szkolenia</th>
|
|
|
|
|
<th>Ilość z ukończonym</th>
|
|
|
|
|
<th>Operacja</th>
|
|
|
|
|
<th>Szczegóły</th>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
|
@php
|
|
|
|
|
$i=1;
|
|
|
|
|
@endphp
|
|
|
|
|
@foreach($trainings as $training)
|
|
|
|
|
<tr id="{{$training->id}}">
|
|
|
|
|
|
|
|
|
|
<th>{{$i}}</th>
|
|
|
|
|
<td id="name{{ $training->id }}">{{ $training->trainingName }}</td>
|
|
|
|
|
<td id="amount{{ $training->id }}">5</td>
|
|
|
|
|
<td>
|
|
|
|
|
<button class="btn btn-success " type="submit" onclick="renameTraining('{{$training->id}}')" id="{{$training->id}}">Zmień nazwę</button>
|
|
|
|
|
<a href="{{ URL::asset('szkolenia/addTrainingsFireFighters/'.$training->id) }}" class="btn btn-secondary" role="button">Zarządzaj</a>
|
|
|
|
|
<button class="btn btn-danger" type="submit" id="{{$training->id}}" onclick="deleteButton('{{$training->id}}')">Usuń</button>
|
|
|
|
|
</td>
|
2020-01-04 22:04:28 +01:00
|
|
|
|
<td>
|
2020-01-29 01:57:19 +01:00
|
|
|
|
<button class="btn btn-info" onclick="showMoreInformation('{{$training->id}}')" id="more{{$training->id}}">Więcej</button>
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr id="moreInformation{{$training->id}}" style="visibility:collapse;" >
|
|
|
|
|
<td colspan="5">
|
|
|
|
|
<table class="table table-dark">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Imię i Nazwisko</th>
|
|
|
|
|
<th>Ważne od:</th>
|
|
|
|
|
<th>Ważne do:</th>
|
2019-12-25 22:35:20 +01:00
|
|
|
|
</tr>
|
2020-01-29 01:57:19 +01:00
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
|
@foreach($fireFighters[$training->id] as $fireFighter)
|
|
|
|
|
@if($fireFighter->dateOfComplete != null and $fireFighter->dateOfExpiry != null)
|
|
|
|
|
<tr id="{{$fireFighter->userID}}">
|
|
|
|
|
<td>{{$fireFighter->name}} {{$fireFighter->surname}}</td>
|
|
|
|
|
<td>{{$fireFighter->dateOfComplete}}</td>
|
|
|
|
|
<td>{{$fireFighter->dateOfExpiry}}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@endif
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@php
|
|
|
|
|
$i++;
|
|
|
|
|
@endphp
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
2019-12-25 22:35:20 +01:00
|
|
|
|
</table>
|
2020-01-29 01:57:19 +01:00
|
|
|
|
{{ $trainings->links() }}
|
2019-12-25 22:35:20 +01:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
|
|
@else
|
|
|
|
|
Brak autoryzacji
|
|
|
|
|
@endif
|
|
|
|
|
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
function showMoreInformation(operationID){
|
|
|
|
|
if( $('#more'+operationID).val() == "Więcej"){
|
|
|
|
|
$('#more'+operationID).val("Ukryj");
|
|
|
|
|
$("#moreInformation"+operationID).css('visibility', 'visible');
|
|
|
|
|
} else{
|
|
|
|
|
$('#more'+operationID).val("Więcej");
|
|
|
|
|
$("#moreInformation"+operationID).css('visibility', 'collapse');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2020-01-04 22:04:28 +01:00
|
|
|
|
|
|
|
|
|
function renameTraining(trainingID){
|
|
|
|
|
swal.fire({
|
|
|
|
|
title: "Podaj nową nazwę",
|
|
|
|
|
width: 'auto',
|
|
|
|
|
input: 'text',
|
2020-01-31 14:16:11 +01:00
|
|
|
|
confirmButtonText: 'Zapisz',
|
2020-01-04 22:04:28 +01:00
|
|
|
|
cancelButtonText: 'Anuluj',
|
|
|
|
|
showCancelButton: true,
|
|
|
|
|
inputValidator: (value) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return 'To pole nie może zostać puste'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
if(result.value){
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
|
headers: {
|
|
|
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'post',
|
|
|
|
|
url: '/szkolenia/rename',
|
|
|
|
|
data: {
|
|
|
|
|
'trainingID': trainingID,
|
|
|
|
|
'trainingName': result.value,
|
|
|
|
|
},
|
|
|
|
|
success: function(data) {
|
|
|
|
|
$('.btn-info', '#'+trainingID).parents("tr").find("td:eq(0)").html(result.value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-01-29 01:57:19 +01:00
|
|
|
|
|
|
|
|
|
function deleteButton(trainingID){
|
|
|
|
|
swal.fire({
|
2020-01-30 21:19:05 +01:00
|
|
|
|
title: "Czy chcesz usunąć badanie/szkolenie?",
|
2020-01-29 01:57:19 +01:00
|
|
|
|
width: 'auto',
|
|
|
|
|
confirmButtonText: 'Tak',
|
|
|
|
|
cancelButtonText: 'Nie',
|
|
|
|
|
showCancelButton: true,
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
if(result.value){
|
|
|
|
|
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
|
headers: {
|
|
|
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "szkolenia/"+trainingID,
|
|
|
|
|
type: 'DELETE',
|
|
|
|
|
data: {
|
|
|
|
|
"id": trainingID,
|
|
|
|
|
},
|
|
|
|
|
success: function (){
|
|
|
|
|
console.log("it Works");
|
|
|
|
|
location.reload();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
2019-12-25 22:35:20 +01:00
|
|
|
|
</script>
|