diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1be3d85..fe81a3c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,11 +3,10 @@
-
-
-
-
+
+
+
@@ -266,7 +265,7 @@
-
+
diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php
index 547e8aa..2a89190 100644
--- a/app/Http/Controllers/fireFightersController.php
+++ b/app/Http/Controllers/fireFightersController.php
@@ -34,11 +34,9 @@ class fireFightersController extends Controller
public function addForm(){
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$fireStation = fireStation::find(auth()->user()->fireStationID);
- if($fireStation-> creatorID == auth()->user()->id){ //if do usunięcia w pzyszłości
- $ranks = DB::table('ranks')->pluck("rank","id");
- $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id");
- return view('fireFightersAdd',compact('ranks'), compact('unitFunctions'));
- } else return fireFightersController::create(); // ???
+ $ranks = DB::table('ranks')->pluck("rank","id");
+ $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id");
+ return view('fireFightersAdd',compact('ranks'), compact('unitFunctions'));
} else return redirect()->to('/strazacy');
}
@@ -46,15 +44,12 @@ class fireFightersController extends Controller
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$userFireStation = auth()->user()->fireStationID;
$fireFighterFireStation = DB::table('users')->where("id", $id)->value('fireStationID');
- $fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID');
$fireFighter = DB::table('users')->where("id", $id)->first();
-// if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { // if do usunięcia w pzyszłości
- return view('fireFightersEdit', ["fireFighter" => $fireFighter]);
-// } else{
-// return "Brak dostepu";
-// }
- }else{
+ return view('fireFightersEdit', ["fireFighter" => $fireFighter]);
+ }
+ else
+ {
return redirect()->to('/strazacy');
}
}
@@ -115,6 +110,19 @@ class fireFightersController extends Controller
'surname' =>'required|min:2|max:45|regex:/^[A-Za-zżźćńółęąśŻŹĆĄŚĘŁÓŃ\040\x27-]+$/',
'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9',
+ 'secondName' => 'max:45',
+ 'fathersName' => 'max:45',
+ 'mothersName' => 'max:45',
+ 'homePhoneNumber' => 'max:20',
+ 'address' => 'max:45',
+ 'apartment'=> 'max:45',
+ 'placeOfBirth'=> 'max:45',
+ 'IDSeries'=> 'max:3',
+ 'IDNumber'=> 'max:6',
+ 'identityCardNumber'=> 'max:20',
+ 'driversLicense'=> 'max:20',
+ 'education'=> 'max:45',
+ 'profession'=> 'max:45',
],
[
'required' => ':attribute jest wymagany(e).',
@@ -133,6 +141,22 @@ class fireFightersController extends Controller
$fireFighter-> surname = $request->surname;
$fireFighter-> PESEL = $request->PESEL;
$fireFighter-> phoneNumber = $request->phoneNumber;
+ $fireFighter-> changingID = auth()->user()-> id;
+ $fireFighter-> secondName = $request->secondName;
+ $fireFighter-> fathersName = $request->fathersName;
+ $fireFighter-> mothersName = $request->mothersName;
+ $fireFighter-> homePhoneNumber = $request->homePhoneNumber;
+ $fireFighter-> address = $request->address;
+ $fireFighter-> apartment = $request->apartment;
+ $fireFighter-> placeOfBirth = $request->placeOfBirth;
+ $fireFighter-> joiningOSPDate = $request->joiningOSPDate;
+ $fireFighter-> IDSeries = $request->IDSeries;
+ $fireFighter-> IDNumber = $request->IDNumber;
+ $fireFighter-> IDValidUntil = $request->IDValidUntil;
+ $fireFighter-> identityCardNumber = $request->identityCardNumber;
+ $fireFighter-> driversLicense= $request->driversLicense;
+ $fireFighter-> education = $request->education;
+ $fireFighter-> profession = $request->profession;
$fireFighter->save();
return fireFightersController::create();
diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php
index 40e7d50..32d7c5e 100644
--- a/app/Http/Controllers/operationsController.php
+++ b/app/Http/Controllers/operationsController.php
@@ -240,7 +240,8 @@ class operationsController extends Controller
};
}
- return operationsController::create();
+ //return operationsController::create();
+ return redirect()->to('/wyjazdy');
}
public function update(){
@@ -321,6 +322,7 @@ class operationsController extends Controller
public function destroy($id)
{
operations::find($id)->delete($id);
+ //redirect()->to('/wyjazdy');
return response()->json([
'success' => 'Record deleted successfully!'
diff --git a/app/User.php b/app/User.php
index 2b62596..d1e6eed 100644
--- a/app/User.php
+++ b/app/User.php
@@ -18,7 +18,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
- 'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID', 'confirmation_code',
+ 'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID', 'confirmation_code','secondName','fathersName','mothersName','address','apartment','placeOfBirth','driversLicense','joiningOSPDate','IDSeries','IDNumber','IDValidUntil','identityCardNumber','homePhoneNumber','education','profession',
];
/**
diff --git a/resources/views/fireFightersEdit.blade.php b/resources/views/fireFightersEdit.blade.php
index f919d03..04f1c31 100644
--- a/resources/views/fireFightersEdit.blade.php
+++ b/resources/views/fireFightersEdit.blade.php
@@ -24,16 +24,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+