forked from s421507/eOSP2
Dodanie paginacji oraz poprawienie widoków większości tabel
This commit is contained in:
parent
406605de39
commit
c69bdaf053
@ -12,7 +12,7 @@ class EquipmentController extends Controller
|
||||
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
$equipment = DB::table('equipment')->where("fireStationID", '=', auth()->user()->fireStationID)
|
||||
->whereNull('deleted_at')->get();
|
||||
->whereNull('deleted_at')->paginate(10);
|
||||
return view("equipment", ["equipment" => $equipment]);
|
||||
} else{
|
||||
return view('equipment');
|
||||
@ -21,9 +21,9 @@ class EquipmentController extends Controller
|
||||
}
|
||||
|
||||
public function addForm(){
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
return view('equipmentAdd');
|
||||
|
||||
|
||||
} else return view("login");
|
||||
}
|
||||
|
||||
@ -33,12 +33,12 @@ class EquipmentController extends Controller
|
||||
{
|
||||
|
||||
$equipment = DB::table('equipment')->where("id", $id)->first();
|
||||
|
||||
|
||||
return view('equipmentEdit', ["equipment" => $equipment]);
|
||||
}
|
||||
}
|
||||
else
|
||||
return view("login");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function store(){
|
||||
@ -57,7 +57,7 @@ class EquipmentController extends Controller
|
||||
$equipment = equipment::create([
|
||||
'fireStationID' => auth()->user()->fireStationID,
|
||||
'name' => $request-> name,
|
||||
'amount' => $request-> amount,
|
||||
'amount' => $request-> amount,
|
||||
'parameter' => $request-> parameter,
|
||||
]);
|
||||
|
||||
@ -79,7 +79,7 @@ class EquipmentController extends Controller
|
||||
$request = request();
|
||||
$equipment = equipment::find( $request->equipmentID);
|
||||
$equipment-> name = $request-> name;
|
||||
$equipment-> amount = $request-> amount;
|
||||
$equipment-> amount = $request-> amount;
|
||||
$equipment-> parameter = $request-> parameter;
|
||||
$equipment->save();
|
||||
|
||||
@ -89,7 +89,9 @@ class EquipmentController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
equipment::where('id',$id)->delete();
|
||||
|
||||
return redirect()->to('/sprzet');
|
||||
|
||||
return response()->json([
|
||||
'success' => 'Record deleted successfully!'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class fireFightersController extends Controller
|
||||
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
|
||||
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
|
||||
->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
|
||||
->get();
|
||||
->paginate(10);
|
||||
return view("fireFighters", ["users" => $users]);
|
||||
} else{
|
||||
return view('fireFighters');
|
||||
|
@ -16,7 +16,8 @@ class trainingsController extends Controller
|
||||
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
|
||||
->whereNull('deleted_at')->get();
|
||||
->whereNull('deleted_at')
|
||||
->paginate(10);
|
||||
|
||||
$fireFighters = array();
|
||||
foreach($trainings as $training) {
|
||||
@ -66,7 +67,7 @@ class trainingsController extends Controller
|
||||
$join->where('trainingsFirefighters.trainingID', '=', $id);
|
||||
})
|
||||
->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID')
|
||||
->get();
|
||||
->paginate(10);
|
||||
|
||||
$training = DB::table('trainings')->where("id", '=', $id)
|
||||
->whereNull('deleted_at')->first();
|
||||
@ -158,9 +159,11 @@ class trainingsController extends Controller
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
trainings::where('id',$id)->delete();
|
||||
trainings::find($id)->delete($id);
|
||||
|
||||
return redirect()->to('/szkolenia');
|
||||
return response()->json([
|
||||
'success' => 'Record deleted successfully!'
|
||||
]);
|
||||
}
|
||||
|
||||
public function trainingsRename(Request $request){
|
||||
|
@ -15,27 +15,32 @@
|
||||
@else
|
||||
@if(count($awardedDecorations) > 0)
|
||||
<p align='center'>
|
||||
<table class='firefighterViewTable'>
|
||||
<tr class='table-header'>
|
||||
<th colspan="2" scope="colgroup" style="text-align:center">{{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia</th>
|
||||
</tr>
|
||||
<tr class='table-header'>
|
||||
<td>Odznaczenie</td>
|
||||
<td>Data przyznania</td>
|
||||
@foreach($awardedDecorations as $awardedDecoration)
|
||||
<tr>
|
||||
<form action="{{ route('decorations.destroy', $awardedDecoration->decorationsFirefightersID)}}" method="post">
|
||||
<td id="decorationName{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->decorationName }}</td>
|
||||
<td id="dateOfAward{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->dateOfAward }}</td>
|
||||
<td>
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
||||
</td>
|
||||
</form>
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="colgroup" style="text-align:center">{{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<th>Odznaczenie</th>
|
||||
<th>Data przyznania</th>
|
||||
<th>Operacja</th>
|
||||
@foreach($awardedDecorations as $awardedDecoration)
|
||||
<tr>
|
||||
<form action="{{ route('decorations.destroy', $awardedDecoration->decorationsFirefightersID)}}" method="post">
|
||||
<td id="decorationName{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->decorationName }}</td>
|
||||
<td id="dateOfAward{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->dateOfAward }}</td>
|
||||
<td>
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
@else
|
||||
{{ $firefighter->name }} {{ $firefighter->surname }} nie posiada żadnych odznaczeń.
|
||||
|
@ -1,5 +1,6 @@
|
||||
@extends('layout.app')
|
||||
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@section('left-menu')
|
||||
@parent
|
||||
<ul>
|
||||
@ -10,6 +11,7 @@
|
||||
@stop
|
||||
|
||||
@section('center-area')
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@parent
|
||||
|
||||
@if( auth()->check())
|
||||
@ -17,26 +19,38 @@
|
||||
Jednostka nie istnieje
|
||||
@else
|
||||
<p align='center'>
|
||||
<table class='firefighterViewTable'>
|
||||
<tr class='table-header'>
|
||||
<td>Nazwa</td>
|
||||
<td>Ilość</td>
|
||||
<td>Param. charakterystyczny</td>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Ilość</th>
|
||||
<th>Param. charakterystyczny</th>
|
||||
<th>Operacja</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@php
|
||||
$i=1;
|
||||
@endphp
|
||||
@foreach($equipment as $item)
|
||||
<tr>
|
||||
<form action="{{ route('equipment.destroy', $item->id)}}" method="post">
|
||||
<th>{{$i}}</th>
|
||||
<td id="name{{ $item->id }}">{{ $item->name }}</td>
|
||||
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
|
||||
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</td>
|
||||
<td><a href="{{ URL::asset('sprzet/edit/'.$item->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
|
||||
<td>
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
||||
</form></td>
|
||||
<a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||
<button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$i++;
|
||||
@endphp
|
||||
@endforeach
|
||||
</table>
|
||||
{{ $equipment->links() }}
|
||||
</p>
|
||||
|
||||
@endif
|
||||
@ -45,3 +59,39 @@
|
||||
@endif
|
||||
|
||||
@stop
|
||||
|
||||
<script>
|
||||
|
||||
function deleteButton(itemID){
|
||||
swal.fire({
|
||||
title: "Czy chcesz usunąć sprzęt?",
|
||||
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: "sprzet/"+itemID,
|
||||
type: 'DELETE',
|
||||
data: {
|
||||
"id": itemID,
|
||||
},
|
||||
success: function (){
|
||||
console.log("it Works");
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -19,8 +19,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">Ilość:</label>
|
||||
<input type="text" class="form-control" id="amount" name="amount" value="{{ old('amount') }}">
|
||||
<label for="amount">Ilość:</label>
|
||||
<input type="text" class="form-control" id="amount" name="amount" value="{{ old('amount') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -66,42 +66,56 @@
|
||||
Jednostka nie istnieje
|
||||
@else
|
||||
|
||||
<table class='firefighterViewTable'>
|
||||
<tr class='table-header'>
|
||||
<td>Imie</td>
|
||||
<td>Nazwisko</td>
|
||||
<td>PESEL</td>
|
||||
<td>E-mail</td>
|
||||
<td>Funkcja</td>
|
||||
<td>Stopień</td>
|
||||
<td>Status</td>
|
||||
</tr>
|
||||
|
||||
@foreach($users as $user)
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<td id="userName{{ $user->id }}">{{ $user->name }}</td>
|
||||
<td id="userSurname{{ $user->id }}">{{ $user->surname }}</td>
|
||||
<td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td>
|
||||
<td id="userEmail{{ $user->id }}">{{ $user->email }}</td>
|
||||
<td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td>
|
||||
<td id="userDegree{{ $user->id }}"> {{$user->rank}}</td>
|
||||
<td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td>
|
||||
<td><a href="{{ URL::asset('strazacy/edit/'.$user->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
|
||||
<td><a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}"><input type="button" onclick="" value="Odznaczenia"> </a></td>
|
||||
|
||||
<th>#</th>
|
||||
<th>Imie</th>
|
||||
<th>Nazwisko</th>
|
||||
<th>PESEL</th>
|
||||
<th>E-mail</th>
|
||||
<th>Funkcja</th>
|
||||
<th>Stopień</th>
|
||||
<th>Status</th>
|
||||
<th>Operacje</th>
|
||||
</tr>
|
||||
{{-- <tr>--}}
|
||||
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
|
||||
{{-- {{ csrf_field() }}--}}
|
||||
{{-- <div class="form-group">--}}
|
||||
{{-- <label for="name">Imię:</label>--}}
|
||||
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </form>--}}
|
||||
{{-- </tr>--}}
|
||||
@endforeach
|
||||
</table>"
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<th>{{$i}}</th>
|
||||
<td id="userName{{ $user->id }}">{{ $user->name }}</td>
|
||||
<td id="userSurname{{ $user->id }}">{{ $user->surname }}</td>
|
||||
<td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td>
|
||||
<td id="userEmail{{ $user->id }}">{{ $user->email }}</td>
|
||||
<td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td>
|
||||
<td id="userDegree{{ $user->id }}"> {{$user->rank}}</td>
|
||||
<td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td>
|
||||
<td>
|
||||
<a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||
<a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- <tr>--}}
|
||||
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
|
||||
{{-- {{ csrf_field() }}--}}
|
||||
{{-- <div class="form-group">--}}
|
||||
{{-- <label for="name">Imię:</label>--}}
|
||||
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </form>--}}
|
||||
{{-- </tr>--}}
|
||||
@php
|
||||
$i++;
|
||||
@endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $users->links() }}
|
||||
@endif
|
||||
@else
|
||||
Brak autoryzacji
|
||||
@ -112,4 +126,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Edycja jednostki straży pożarnej</title>
|
||||
<link rel="stylesheet" href="{{asset('css/app.css')}}">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
|
||||
</head>
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<label for="name">Numer Jednostki:</label>
|
||||
<input type="text" class="form-control" id="number" name="number" value="{{ $fireStation->number }}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="voivodeship">Województwo:</label>
|
||||
<select name="voivodeship" class="form-control" style="width:250px">
|
||||
@ -92,7 +92,7 @@
|
||||
<input type="email" class="form-control" id="email" name="email" value="{{ $fireStation->email }}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button>
|
||||
@ -116,11 +116,11 @@
|
||||
//console.log(data);
|
||||
jQuery('select[name="county"]').empty();
|
||||
jQuery('select[name="county"]').append(new Option('--Wybierz powiat--', ''));
|
||||
jQuery('select[name="community"]').empty();
|
||||
jQuery('select[name="community"]').empty();
|
||||
jQuery.each(data, function(key,value){
|
||||
$('select[name="county"]').append('<option value="'+ key +'">'+ value +'</option>');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -128,7 +128,7 @@
|
||||
{
|
||||
$('select[name="county"]').empty();
|
||||
$('select[name="community"]').empty();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -156,7 +156,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
@ -25,11 +25,11 @@
|
||||
<th>Rodzaj zagrożenia</th>
|
||||
<th>Dowódca</th>
|
||||
<th>Operacja</th>
|
||||
<th>Szczegóły</th>
|
||||
</tr>
|
||||
<th>Szczegóły</th> <tbody>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@php
|
||||
$i=1;
|
||||
@endphp
|
||||
@ -42,11 +42,11 @@
|
||||
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
|
||||
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
|
||||
<td>
|
||||
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}"><input type="button" onclick="" value="Edytuj"> </a>
|
||||
<button class="btn btn-danger btn-delete" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
||||
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
||||
</td>
|
||||
<td>
|
||||
<input type="button" onclick="showMoreInformation('{{$operation->id}}')" id="more{{$operation->id}}" value="Więcej">
|
||||
<button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="moreInformation{{$operation->id}}" style="visibility:collapse;">
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="location">Miejsce akcji:</label>
|
||||
<input type="text" class="form-control" id="operationLocation" name="operationLocation" value="{{ $operation->location}}">
|
||||
<input type="text" class="form-control is-valid" id="operationLocation" name="operationLocation" value="{{ $operation->location}}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="location">Rodzaj zagrożenia:</label>
|
||||
<input type="text" class="form-control" id="operationDangerType" name="operationDangerType" value="{{ $operation->dangerType }}">
|
||||
<input type="text" class="form-control is-valid" id="operationDangerType" name="operationDangerType" value="{{ $operation->dangerType }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -15,8 +15,8 @@
|
||||
@stop
|
||||
|
||||
@section('center-area')
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@parent
|
||||
|
||||
@if( auth()->check())
|
||||
@if( auth()->user()->fireStationID == NULL)
|
||||
Jednostka nie istnieje
|
||||
@ -34,55 +34,68 @@
|
||||
</div>
|
||||
@include('inc.formerrors')
|
||||
</form>
|
||||
<table class='firefighterViewTable'>
|
||||
<table class='table'>
|
||||
<tr class='table-header'>
|
||||
<td>Nazwa Szkolenia</td>
|
||||
<td>Ilość z ukończonym</td>
|
||||
<td>Akcje</td>
|
||||
@foreach($trainings as $training)
|
||||
<tr id="{{$training->id}}">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>Nazwa Szkolenia</th>
|
||||
<th>Ilość z ukończonym</th>
|
||||
<th>Operacja</th>
|
||||
<th>Szczegóły</th>
|
||||
</thead>
|
||||
|
||||
<td id="name{{ $training->id }}">{{ $training->trainingName }}</td>
|
||||
<td id="amount{{ $training->id }}">5</td>
|
||||
<td><input type="button" onclick="showMoreInformation('{{$training->id}}')" id="more{{$training->id}}" value="Więcej">
|
||||
<button class="btn btn-info" type="submit" onclick="renameTraining('{{$training->id}}')" id="{{$training->id}}">Zmień nazwę</button>
|
||||
<a href="{{ URL::asset('szkolenia/addTrainingsFireFighters/'.$training->id) }}"><input type="button" onclick="" value="Zarządzaj"></a>
|
||||
</td>
|
||||
<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>
|
||||
<form action="{{ route('trainings.destroy', $training->id)}}" method="post">
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
||||
</form>
|
||||
</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>
|
||||
<td>
|
||||
<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;" bgcolor="#C0C0C0">
|
||||
<td colspan="3">
|
||||
<table>
|
||||
|
||||
<thead>
|
||||
<td>Imię i Nazwisko</td>
|
||||
<td>Ważne od:</td>
|
||||
<td>Ważne do:</td>
|
||||
</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>
|
||||
<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>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</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>
|
||||
</table>
|
||||
{{ $trainings->links() }}
|
||||
</p>
|
||||
|
||||
@endif
|
||||
@ -141,4 +154,36 @@
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function deleteButton(trainingID){
|
||||
swal.fire({
|
||||
title: "Czy chcesz usunąć wyjazd?",
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -22,13 +22,13 @@
|
||||
Jednostka nie istnieje
|
||||
@else
|
||||
<center><h1>{{$training->trainingName}}</h1></center>
|
||||
<table id="editableTable" class='table table-bordered'>
|
||||
<table id="editableTable" class='table'>
|
||||
|
||||
<thead>
|
||||
<td>Imię i Nazwisko</td>
|
||||
<td>Ważne od:</td>
|
||||
<td>Ważne do:</td>
|
||||
<td>Akcje</td>
|
||||
<th>Imię i Nazwisko</th>
|
||||
<th>Ważne od:</th>
|
||||
<th>Ważne do:</th>
|
||||
<th>Akcje</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@ -37,12 +37,16 @@
|
||||
<td>{{$fireFighter->name}} {{$fireFighter->surname}}</td>
|
||||
<td>{{$fireFighter->dateOfComplete}}</td>
|
||||
<td>{{$fireFighter->dateOfExpiry}}</td>
|
||||
<td><button class="btn btn-warning" type="submit" style="display:none" id="{{$fireFighter->userID}}" onclick="cancelButton('{{$fireFighter->userID}}', '{{$fireFighter->dateOfComplete}}', '{{$fireFighter->dateOfExpiry}}')">Anuluj</button> <button class="btn btn-success" type="submit" style="display:none" id="{{$fireFighter->userID}}" onclick="updateButton('{{$fireFighter->userID}}', '{{$fireFighter->dateOfComplete}}', '{{$fireFighter->dateOfExpiry}}')">Zapisz</button> <button class="btn btn-info" type="submit" id="{{$fireFighter->userID}}" onclick="editButton('{{$fireFighter->userID}}')">Edytuj</button> <button class="btn btn-danger btn-delete" type="submit" id="{{$fireFighter->userID}}" onclick="deleteButton('{{$fireFighter->userID}}')">Usuń</button></td>
|
||||
<td>
|
||||
<button class="btn btn-warning" type="submit" style="display:none" id="{{$fireFighter->userID}}" onclick="cancelButton('{{$fireFighter->userID}}', '{{$fireFighter->dateOfComplete}}', '{{$fireFighter->dateOfExpiry}}')">Anuluj</button>
|
||||
<button class="btn btn-success" type="submit" style="display:none" id="{{$fireFighter->userID}}" onclick="updateButton('{{$fireFighter->userID}}', '{{$fireFighter->dateOfComplete}}', '{{$fireFighter->dateOfExpiry}}')">Zapisz</button>
|
||||
<button class="btn btn-secondary" type="submit" id="{{$fireFighter->userID}}" onclick="editButton('{{$fireFighter->userID}}')">Edytuj</button>
|
||||
<button class="btn btn-danger btn-delete" type="submit" id="{{$fireFighter->userID}}" onclick="deleteButton('{{$fireFighter->userID}}')">Usuń</button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ $fireFighters->links() }}
|
||||
|
||||
@endif
|
||||
@else
|
||||
@ -54,21 +58,21 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
function editButton(firefighterID){
|
||||
$('.btn-info', '#'+firefighterID).css('display', 'none');
|
||||
$('.btn-secondary', '#'+firefighterID).css('display', 'none');
|
||||
$('.btn-warning', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-success', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html('<input type="date" name="dateOfComplete">');
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(2)").html('<input type="date" name="dateOfExpiry">');
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(1)").html('<input type="date" name="dateOfComplete">');
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(2)").html('<input type="date" name="dateOfExpiry">');
|
||||
}
|
||||
|
||||
|
||||
function cancelButton(firefighterID, dateOfComplete, dateOfExpiry){
|
||||
$('.btn-info', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-secondary', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-warning', '#'+firefighterID).css('display', 'none');
|
||||
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
||||
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html(dateOfComplete);
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(2)").html(dateOfExpiry);
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(1)").html(dateOfComplete);
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(2)").html(dateOfExpiry);
|
||||
}
|
||||
|
||||
function updateButton(firefighterID, dateOfComplete, dateOfExpiry){
|
||||
@ -89,10 +93,10 @@
|
||||
'dateOfExpiry': $('input[name=dateOfExpiry]').val()
|
||||
},
|
||||
success: function(data) {
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html($('input[name=dateOfComplete]').val());
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(2)").html($('input[name=dateOfExpiry]').val());
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(1)").html($('input[name=dateOfComplete]').val());
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(2)").html($('input[name=dateOfExpiry]').val());
|
||||
|
||||
$('.btn-info', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-secondary', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-warning', '#'+firefighterID).css('display', 'none');
|
||||
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
||||
console.log('sukces')
|
||||
@ -151,8 +155,13 @@
|
||||
'trainingID': '{{$training->id}}',
|
||||
},
|
||||
success: function(data) {
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html('');
|
||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(2)").html('');
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(1)").html('');
|
||||
$('.btn-secondary', '#'+firefighterID).parents("tr").find("td:eq(2)").html('');
|
||||
$('.btn-secondary', '#'+firefighterID).css('display', 'inline');
|
||||
$('.btn-warning', '#'+firefighterID).css('display', 'none');
|
||||
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ Route::post('/sprzet', 'EquipmentController@store');
|
||||
Route::get('/sprzet/edit/{id}', 'EquipmentController@editForm');
|
||||
Route::post('/sprzet/edit', 'EquipmentController@update');
|
||||
Route::resource('equipment', 'EquipmentController');
|
||||
|
||||
Route::delete('sprzet/{id}', 'EquipmentController@destroy')->name('EquipmentController.destroy');
|
||||
|
||||
Route::get('/szkolenia', 'trainingsController@create');
|
||||
Route::post('/szkolenia', 'trainingsController@store');
|
||||
@ -90,6 +90,7 @@ Route::post('/szkolenia/rename', 'trainingsController@trainingsRename');
|
||||
Route::get('/szkolenia/addTrainingsFireFighters/{id}', 'trainingsController@addTrainingsFireFighters');
|
||||
Route::post('/szkolenia/addTrainingsFireFighters/', 'trainingsController@ajaxRequest');
|
||||
Route::post('/szkolenia/addTrainingsFireFighters/delete', 'trainingsController@deleteFireFighterTrainings');
|
||||
Route::delete('szkolenia/{id}', 'trainingsController@destroy')->name('trainingsController.destroy');
|
||||
Route::resource('trainings', 'trainingsController');
|
||||
|
||||
Route::get('/userprofile', 'userProfileController@create');
|
||||
|
Loading…
Reference in New Issue
Block a user