From 9c2e7dbc5fb58c7b55cc6f0551a9149c38d1d5b7 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 20 Jul 2020 15:20:35 +0200 Subject: [PATCH] =?UTF-8?q?Dodanie=20mo=C5=BCliwo=C5=9Bci=20edycji=20nowyc?= =?UTF-8?q?h=20danych=20stra=C5=BCaka=20przez=20prezesa=20i=20naczelnika?= =?UTF-8?q?=20jednostki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/fireFightersController.php | 38 +++++++-- resources/views/fireFightersEdit.blade.php | 77 ++++++++++++++++++- 2 files changed, 108 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index 6d907ee..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,7 +44,6 @@ 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(); return view('fireFightersEdit', ["fireFighter" => $fireFighter]); @@ -113,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).', @@ -131,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/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 @@ +
+ + +
+ +
+ + +
+ +
+ + +
+
- +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+