diff --git a/app/Http/Controllers/EquipmentController.php b/app/Http/Controllers/EquipmentController.php
index 871e02e..d95868b 100644
--- a/app/Http/Controllers/EquipmentController.php
+++ b/app/Http/Controllers/EquipmentController.php
@@ -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!'
+ ]);
}
}
diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php
index b009925..1677613 100644
--- a/app/Http/Controllers/fireFightersController.php
+++ b/app/Http/Controllers/fireFightersController.php
@@ -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');
diff --git a/app/Http/Controllers/trainingsController.php b/app/Http/Controllers/trainingsController.php
index 62354a1..1d90a81 100644
--- a/app/Http/Controllers/trainingsController.php
+++ b/app/Http/Controllers/trainingsController.php
@@ -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){
diff --git a/database/migrations/x/2020_01_22_004052_add_soft_deletes_to_operations_table.php b/database/migrations/2020_01_22_004052_add_soft_deletes_to_operations_table.php
similarity index 100%
rename from database/migrations/x/2020_01_22_004052_add_soft_deletes_to_operations_table.php
rename to database/migrations/2020_01_22_004052_add_soft_deletes_to_operations_table.php
diff --git a/resources/views/decorations.blade.php b/resources/views/decorations.blade.php
index 00921d8..2b553d2 100644
--- a/resources/views/decorations.blade.php
+++ b/resources/views/decorations.blade.php
@@ -15,27 +15,32 @@
@else
@if(count($awardedDecorations) > 0)
-
-
-
-
+
+
+
+ {{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia |
- @endforeach
-
+
+
+
+ Odznaczenie |
+ Data przyznania |
+ Operacja |
+ @foreach($awardedDecorations as $awardedDecoration)
+
+
+
+ @endforeach
+
+
@else
{{ $firefighter->name }} {{ $firefighter->surname }} nie posiada żadnych odznaczeń.
diff --git a/resources/views/equipment.blade.php b/resources/views/equipment.blade.php
index 794563a..758b9ff 100644
--- a/resources/views/equipment.blade.php
+++ b/resources/views/equipment.blade.php
@@ -1,5 +1,6 @@
@extends('layout.app')
+
@section('left-menu')
@parent
@@ -10,6 +11,7 @@
@stop
@section('center-area')
+
@parent
@if( auth()->check())
@@ -17,26 +19,38 @@
Jednostka nie istnieje
@else
-