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 ){
|
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||||
$equipment = DB::table('equipment')->where("fireStationID", '=', auth()->user()->fireStationID)
|
$equipment = DB::table('equipment')->where("fireStationID", '=', auth()->user()->fireStationID)
|
||||||
->whereNull('deleted_at')->get();
|
->whereNull('deleted_at')->paginate(10);
|
||||||
return view("equipment", ["equipment" => $equipment]);
|
return view("equipment", ["equipment" => $equipment]);
|
||||||
} else{
|
} else{
|
||||||
return view('equipment');
|
return view('equipment');
|
||||||
@ -90,6 +90,8 @@ class EquipmentController extends Controller
|
|||||||
{
|
{
|
||||||
equipment::where('id',$id)->delete();
|
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('ranks', 'users.degreeID', '=', 'ranks.id')
|
||||||
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
|
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
|
||||||
->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
|
->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]);
|
return view("fireFighters", ["users" => $users]);
|
||||||
} else{
|
} else{
|
||||||
return view('fireFighters');
|
return view('fireFighters');
|
||||||
|
@ -16,7 +16,8 @@ class trainingsController extends Controller
|
|||||||
|
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||||
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
|
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
|
||||||
->whereNull('deleted_at')->get();
|
->whereNull('deleted_at')
|
||||||
|
->paginate(10);
|
||||||
|
|
||||||
$fireFighters = array();
|
$fireFighters = array();
|
||||||
foreach($trainings as $training) {
|
foreach($trainings as $training) {
|
||||||
@ -66,7 +67,7 @@ class trainingsController extends Controller
|
|||||||
$join->where('trainingsFirefighters.trainingID', '=', $id);
|
$join->where('trainingsFirefighters.trainingID', '=', $id);
|
||||||
})
|
})
|
||||||
->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID')
|
->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID')
|
||||||
->get();
|
->paginate(10);
|
||||||
|
|
||||||
$training = DB::table('trainings')->where("id", '=', $id)
|
$training = DB::table('trainings')->where("id", '=', $id)
|
||||||
->whereNull('deleted_at')->first();
|
->whereNull('deleted_at')->first();
|
||||||
@ -158,9 +159,11 @@ class trainingsController extends Controller
|
|||||||
|
|
||||||
public function destroy($id)
|
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){
|
public function trainingsRename(Request $request){
|
||||||
|
@ -15,13 +15,17 @@
|
|||||||
@else
|
@else
|
||||||
@if(count($awardedDecorations) > 0)
|
@if(count($awardedDecorations) > 0)
|
||||||
<p align='center'>
|
<p align='center'>
|
||||||
<table class='firefighterViewTable'>
|
<table class='table'>
|
||||||
<tr class='table-header'>
|
<thead>
|
||||||
<th colspan="2" scope="colgroup" style="text-align:center">{{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia</th>
|
<tr>
|
||||||
|
<th colspan="3" scope="colgroup" style="text-align:center">{{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='table-header'>
|
|
||||||
<td>Odznaczenie</td>
|
</thead>
|
||||||
<td>Data przyznania</td>
|
<tbody>
|
||||||
|
<th>Odznaczenie</th>
|
||||||
|
<th>Data przyznania</th>
|
||||||
|
<th>Operacja</th>
|
||||||
@foreach($awardedDecorations as $awardedDecoration)
|
@foreach($awardedDecorations as $awardedDecoration)
|
||||||
<tr>
|
<tr>
|
||||||
<form action="{{ route('decorations.destroy', $awardedDecoration->decorationsFirefightersID)}}" method="post">
|
<form action="{{ route('decorations.destroy', $awardedDecoration->decorationsFirefightersID)}}" method="post">
|
||||||
@ -35,6 +39,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
@else
|
@else
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
@extends('layout.app')
|
@extends('layout.app')
|
||||||
|
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
@section('left-menu')
|
@section('left-menu')
|
||||||
@parent
|
@parent
|
||||||
<ul>
|
<ul>
|
||||||
@ -10,6 +11,7 @@
|
|||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('center-area')
|
@section('center-area')
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
@parent
|
@parent
|
||||||
|
|
||||||
@if( auth()->check())
|
@if( auth()->check())
|
||||||
@ -17,26 +19,38 @@
|
|||||||
Jednostka nie istnieje
|
Jednostka nie istnieje
|
||||||
@else
|
@else
|
||||||
<p align='center'>
|
<p align='center'>
|
||||||
<table class='firefighterViewTable'>
|
<table class="table">
|
||||||
<tr class='table-header'>
|
<thead>
|
||||||
<td>Nazwa</td>
|
<tr>
|
||||||
<td>Ilość</td>
|
<th>#</th>
|
||||||
<td>Param. charakterystyczny</td>
|
<th>Nazwa</th>
|
||||||
|
<th>Ilość</th>
|
||||||
|
<th>Param. charakterystyczny</th>
|
||||||
|
<th>Operacja</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$i=1;
|
||||||
|
@endphp
|
||||||
@foreach($equipment as $item)
|
@foreach($equipment as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<form action="{{ route('equipment.destroy', $item->id)}}" method="post">
|
<th>{{$i}}</th>
|
||||||
<td id="name{{ $item->id }}">{{ $item->name }}</td>
|
<td id="name{{ $item->id }}">{{ $item->name }}</td>
|
||||||
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
|
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
|
||||||
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</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>
|
<td>
|
||||||
{{ csrf_field() }}
|
<a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
@method('DELETE')
|
<button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button>
|
||||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
</td>
|
||||||
</form></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
{{ $equipment->links() }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
@ -45,3 +59,39 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@stop
|
@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>
|
||||||
|
@ -66,19 +66,28 @@
|
|||||||
Jednostka nie istnieje
|
Jednostka nie istnieje
|
||||||
@else
|
@else
|
||||||
|
|
||||||
<table class='firefighterViewTable'>
|
<table class='table'>
|
||||||
<tr class='table-header'>
|
<thead>
|
||||||
<td>Imie</td>
|
<tr>
|
||||||
<td>Nazwisko</td>
|
<th>#</th>
|
||||||
<td>PESEL</td>
|
<th>Imie</th>
|
||||||
<td>E-mail</td>
|
<th>Nazwisko</th>
|
||||||
<td>Funkcja</td>
|
<th>PESEL</th>
|
||||||
<td>Stopień</td>
|
<th>E-mail</th>
|
||||||
<td>Status</td>
|
<th>Funkcja</th>
|
||||||
|
<th>Stopień</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Operacje</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@php
|
||||||
|
$i = 1;
|
||||||
|
@endphp
|
||||||
@foreach($users as $user)
|
@foreach($users as $user)
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>{{$i}}</th>
|
||||||
<td id="userName{{ $user->id }}">{{ $user->name }}</td>
|
<td id="userName{{ $user->id }}">{{ $user->name }}</td>
|
||||||
<td id="userSurname{{ $user->id }}">{{ $user->surname }}</td>
|
<td id="userSurname{{ $user->id }}">{{ $user->surname }}</td>
|
||||||
<td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td>
|
<td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td>
|
||||||
@ -86,22 +95,27 @@
|
|||||||
<td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td>
|
<td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td>
|
||||||
<td id="userDegree{{ $user->id }}"> {{$user->rank}}</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 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>
|
||||||
<td><a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}"><input type="button" onclick="" value="Odznaczenia"> </a></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>
|
||||||
{{-- <tr>--}}
|
{{-- <tr>--}}
|
||||||
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
|
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
|
||||||
{{-- {{ csrf_field() }}--}}
|
{{-- {{ csrf_field() }}--}}
|
||||||
{{-- <div class="form-group">--}}
|
{{-- <div class="form-group">--}}
|
||||||
{{-- <label for="name">Imię:</label>--}}
|
{{-- <label for="name">Imię:</label>--}}
|
||||||
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
|
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
|
||||||
{{-- </div>--}}
|
{{-- </div>--}}
|
||||||
{{-- </form>--}}
|
{{-- </form>--}}
|
||||||
{{-- </tr>--}}
|
{{-- </tr>--}}
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>"
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ $users->links() }}
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
Brak autoryzacji
|
Brak autoryzacji
|
||||||
@ -112,4 +126,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
<th>Rodzaj zagrożenia</th>
|
<th>Rodzaj zagrożenia</th>
|
||||||
<th>Dowódca</th>
|
<th>Dowódca</th>
|
||||||
<th>Operacja</th>
|
<th>Operacja</th>
|
||||||
<th>Szczegóły</th>
|
<th>Szczegóły</th> <tbody>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@php
|
@php
|
||||||
$i=1;
|
$i=1;
|
||||||
@endphp
|
@endphp
|
||||||
@ -42,11 +42,11 @@
|
|||||||
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
|
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
|
||||||
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
|
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}"><input type="button" onclick="" value="Edytuj"> </a>
|
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
<button class="btn btn-danger btn-delete" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="moreInformation{{$operation->id}}" style="visibility:collapse;">
|
<tr id="moreInformation{{$operation->id}}" style="visibility:collapse;">
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="location">Miejsce akcji:</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="location">Rodzaj zagrożenia:</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('center-area')
|
@section('center-area')
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
@parent
|
@parent
|
||||||
|
|
||||||
@if( auth()->check())
|
@if( auth()->check())
|
||||||
@if( auth()->user()->fireStationID == NULL)
|
@if( auth()->user()->fireStationID == NULL)
|
||||||
Jednostka nie istnieje
|
Jednostka nie istnieje
|
||||||
@ -34,37 +34,45 @@
|
|||||||
</div>
|
</div>
|
||||||
@include('inc.formerrors')
|
@include('inc.formerrors')
|
||||||
</form>
|
</form>
|
||||||
<table class='firefighterViewTable'>
|
<table class='table'>
|
||||||
<tr class='table-header'>
|
<tr class='table-header'>
|
||||||
<td>Nazwa Szkolenia</td>
|
<thead>
|
||||||
<td>Ilość z ukończonym</td>
|
<th>#</th>
|
||||||
<td>Akcje</td>
|
<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)
|
@foreach($trainings as $training)
|
||||||
<tr id="{{$training->id}}">
|
<tr id="{{$training->id}}">
|
||||||
|
|
||||||
|
<th>{{$i}}</th>
|
||||||
<td id="name{{ $training->id }}">{{ $training->trainingName }}</td>
|
<td id="name{{ $training->id }}">{{ $training->trainingName }}</td>
|
||||||
<td id="amount{{ $training->id }}">5</td>
|
<td id="amount{{ $training->id }}">5</td>
|
||||||
<td><input type="button" onclick="showMoreInformation('{{$training->id}}')" id="more{{$training->id}}" value="Więcej">
|
<td>
|
||||||
<button class="btn btn-info" type="submit" onclick="renameTraining('{{$training->id}}')" id="{{$training->id}}">Zmień nazwę</button>
|
<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) }}"><input type="button" onclick="" value="Zarządzaj"></a>
|
<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>
|
||||||
<td>
|
<td>
|
||||||
<form action="{{ route('trainings.destroy', $training->id)}}" method="post">
|
<button class="btn btn-info" onclick="showMoreInformation('{{$training->id}}')" id="more{{$training->id}}">Więcej</button>
|
||||||
{{ csrf_field() }}
|
|
||||||
@method('DELETE')
|
|
||||||
<button class="btn btn-danger" type="submit">Usuń</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="moreInformation{{$training->id}}" style="visibility:collapse;" bgcolor="#C0C0C0">
|
<tr id="moreInformation{{$training->id}}" style="visibility:collapse;" >
|
||||||
<td colspan="3">
|
<td colspan="5">
|
||||||
<table>
|
<table class="table table-dark">
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<td>Imię i Nazwisko</td>
|
<tr>
|
||||||
<td>Ważne od:</td>
|
<th>Imię i Nazwisko</th>
|
||||||
<td>Ważne do:</td>
|
<th>Ważne od:</th>
|
||||||
|
<th>Ważne do:</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -81,8 +89,13 @@
|
|||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{{ $trainings->links() }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@endif
|
@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>
|
</script>
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
Jednostka nie istnieje
|
Jednostka nie istnieje
|
||||||
@else
|
@else
|
||||||
<center><h1>{{$training->trainingName}}</h1></center>
|
<center><h1>{{$training->trainingName}}</h1></center>
|
||||||
<table id="editableTable" class='table table-bordered'>
|
<table id="editableTable" class='table'>
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<td>Imię i Nazwisko</td>
|
<th>Imię i Nazwisko</th>
|
||||||
<td>Ważne od:</td>
|
<th>Ważne od:</th>
|
||||||
<td>Ważne do:</td>
|
<th>Ważne do:</th>
|
||||||
<td>Akcje</td>
|
<th>Akcje</th>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -37,12 +37,16 @@
|
|||||||
<td>{{$fireFighter->name}} {{$fireFighter->surname}}</td>
|
<td>{{$fireFighter->name}} {{$fireFighter->surname}}</td>
|
||||||
<td>{{$fireFighter->dateOfComplete}}</td>
|
<td>{{$fireFighter->dateOfComplete}}</td>
|
||||||
<td>{{$fireFighter->dateOfExpiry}}</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>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{{ $fireFighters->links() }}
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
@ -54,21 +58,21 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function editButton(firefighterID){
|
function editButton(firefighterID){
|
||||||
$('.btn-info', '#'+firefighterID).css('display', 'none');
|
$('.btn-secondary', '#'+firefighterID).css('display', 'none');
|
||||||
$('.btn-warning', '#'+firefighterID).css('display', 'inline');
|
$('.btn-warning', '#'+firefighterID).css('display', 'inline');
|
||||||
$('.btn-success', '#'+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-secondary', '#'+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(2)").html('<input type="date" name="dateOfExpiry">');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function cancelButton(firefighterID, dateOfComplete, 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-warning', '#'+firefighterID).css('display', 'none');
|
||||||
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
||||||
|
|
||||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html(dateOfComplete);
|
$('.btn-secondary', '#'+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(2)").html(dateOfExpiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateButton(firefighterID, dateOfComplete, dateOfExpiry){
|
function updateButton(firefighterID, dateOfComplete, dateOfExpiry){
|
||||||
@ -89,10 +93,10 @@
|
|||||||
'dateOfExpiry': $('input[name=dateOfExpiry]').val()
|
'dateOfExpiry': $('input[name=dateOfExpiry]').val()
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html($('input[name=dateOfComplete]').val());
|
$('.btn-secondary', '#'+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(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-warning', '#'+firefighterID).css('display', 'none');
|
||||||
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
$('.btn-success', '#'+firefighterID).css('display', 'none');
|
||||||
console.log('sukces')
|
console.log('sukces')
|
||||||
@ -151,8 +155,13 @@
|
|||||||
'trainingID': '{{$training->id}}',
|
'trainingID': '{{$training->id}}',
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('.btn-info', '#'+firefighterID).parents("tr").find("td:eq(1)").html('');
|
$('.btn-secondary', '#'+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(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::get('/sprzet/edit/{id}', 'EquipmentController@editForm');
|
||||||
Route::post('/sprzet/edit', 'EquipmentController@update');
|
Route::post('/sprzet/edit', 'EquipmentController@update');
|
||||||
Route::resource('equipment', 'EquipmentController');
|
Route::resource('equipment', 'EquipmentController');
|
||||||
|
Route::delete('sprzet/{id}', 'EquipmentController@destroy')->name('EquipmentController.destroy');
|
||||||
|
|
||||||
Route::get('/szkolenia', 'trainingsController@create');
|
Route::get('/szkolenia', 'trainingsController@create');
|
||||||
Route::post('/szkolenia', 'trainingsController@store');
|
Route::post('/szkolenia', 'trainingsController@store');
|
||||||
@ -90,6 +90,7 @@ Route::post('/szkolenia/rename', 'trainingsController@trainingsRename');
|
|||||||
Route::get('/szkolenia/addTrainingsFireFighters/{id}', 'trainingsController@addTrainingsFireFighters');
|
Route::get('/szkolenia/addTrainingsFireFighters/{id}', 'trainingsController@addTrainingsFireFighters');
|
||||||
Route::post('/szkolenia/addTrainingsFireFighters/', 'trainingsController@ajaxRequest');
|
Route::post('/szkolenia/addTrainingsFireFighters/', 'trainingsController@ajaxRequest');
|
||||||
Route::post('/szkolenia/addTrainingsFireFighters/delete', 'trainingsController@deleteFireFighterTrainings');
|
Route::post('/szkolenia/addTrainingsFireFighters/delete', 'trainingsController@deleteFireFighterTrainings');
|
||||||
|
Route::delete('szkolenia/{id}', 'trainingsController@destroy')->name('trainingsController.destroy');
|
||||||
Route::resource('trainings', 'trainingsController');
|
Route::resource('trainings', 'trainingsController');
|
||||||
|
|
||||||
Route::get('/userprofile', 'userProfileController@create');
|
Route::get('/userprofile', 'userProfileController@create');
|
||||||
|
Loading…
Reference in New Issue
Block a user