Uzupełnienie reszty pól przy Karcie ewidencji oraz nadaniu użytkownika

This commit is contained in:
s421507 2020-07-20 18:13:56 +02:00
commit b147a42d9f
5 changed files with 120 additions and 20 deletions

View File

@ -3,11 +3,10 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment=""> <list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentApplicationController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentApplicationController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/fireFightersController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/fireFightersController.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/fireFightersController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/fireFightersController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/userProfileController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/userProfileController.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/operationsController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/operationsController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/User.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/User.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/fireFightersEdit.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/fireFightersEdit.blade.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -266,7 +265,7 @@
<workItem from="1592276510207" duration="28000" /> <workItem from="1592276510207" duration="28000" />
<workItem from="1592478779386" duration="40397000" /> <workItem from="1592478779386" duration="40397000" />
<workItem from="1593829053562" duration="35796000" /> <workItem from="1593829053562" duration="35796000" />
<workItem from="1595090372365" duration="28007000" /> <workItem from="1595090372365" duration="28404000" />
</task> </task>
<servers /> <servers />
</component> </component>

View File

@ -34,11 +34,9 @@ class fireFightersController extends Controller
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$fireStation = fireStation::find(auth()->user()->fireStationID); $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");
$ranks = DB::table('ranks')->pluck("rank","id"); $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id");
$unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id"); return view('fireFightersAdd',compact('ranks'), compact('unitFunctions'));
return view('fireFightersAdd',compact('ranks'), compact('unitFunctions'));
} else return fireFightersController::create(); // ???
} else return redirect()->to('/strazacy'); } else return redirect()->to('/strazacy');
} }
@ -46,15 +44,12 @@ class fireFightersController extends Controller
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$userFireStation = auth()->user()->fireStationID; $userFireStation = auth()->user()->fireStationID;
$fireFighterFireStation = DB::table('users')->where("id", $id)->value('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(); $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]);
return view('fireFightersEdit', ["fireFighter" => $fireFighter]); }
// } else{ else
// return "Brak dostepu"; {
// }
}else{
return redirect()->to('/strazacy'); return redirect()->to('/strazacy');
} }
} }
@ -115,6 +110,19 @@ class fireFightersController extends Controller
'surname' =>'required|min:2|max:45|regex:/^[A-Za-zżźćńółęąśŻŹĆĄŚĘŁÓŃ\040\x27-]+$/', 'surname' =>'required|min:2|max:45|regex:/^[A-Za-zżźćńółęąśŻŹĆĄŚĘŁÓŃ\040\x27-]+$/',
'PESEL' => new Pesel, 'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9', '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).', 'required' => ':attribute jest wymagany(e).',
@ -133,6 +141,22 @@ class fireFightersController extends Controller
$fireFighter-> surname = $request->surname; $fireFighter-> surname = $request->surname;
$fireFighter-> PESEL = $request->PESEL; $fireFighter-> PESEL = $request->PESEL;
$fireFighter-> phoneNumber = $request->phoneNumber; $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(); $fireFighter->save();
return fireFightersController::create(); return fireFightersController::create();

View File

@ -240,7 +240,8 @@ class operationsController extends Controller
}; };
} }
return operationsController::create(); //return operationsController::create();
return redirect()->to('/wyjazdy');
} }
public function update(){ public function update(){
@ -321,6 +322,7 @@ class operationsController extends Controller
public function destroy($id) public function destroy($id)
{ {
operations::find($id)->delete($id); operations::find($id)->delete($id);
//redirect()->to('/wyjazdy');
return response()->json([ return response()->json([
'success' => 'Record deleted successfully!' 'success' => 'Record deleted successfully!'

View File

@ -18,7 +18,7 @@ class User extends Authenticatable
* @var array * @var array
*/ */
protected $fillable = [ 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',
]; ];
/** /**

View File

@ -24,16 +24,91 @@
<input type="text" class="form-control" id="surname" name="surname" value="{{ $fireFighter->surname }}"> <input type="text" class="form-control" id="surname" name="surname" value="{{ $fireFighter->surname }}">
</div> </div>
<div class="form-group">
<label for="parameter">Drugie imię:</label>
<input type="text" class="form-control" id="secondName" name="secondName" value="{{ $fireFighter->secondName }}">
</div>
<div class="form-group">
<label for="parameter">Imię ojca:</label>
<input type="text" class="form-control" id="fathersName" name="fathersName" value="{{ $fireFighter->fathersName }}">
</div>
<div class="form-group">
<label for="parameter">Imię matki:</label>
<input type="text" class="form-control" id="mothersName" name="mothersName" value="{{ $fireFighter->mothersName }}">
</div>
<div class="form-group"> <div class="form-group">
<label for="name">Pesel:</label> <label for="name">Pesel:</label>
<input type="text" class="form-control" id="PESEL" name="PESEL" value="{{ $fireFighter->PESEL }}"> <input type="text" class="form-control" id="PESEL" name="PESEL" value="{{ $fireFighter->PESEL }}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">Numer telefonu:</label> <label for="name">Numer telefonu komórkowego:</label>
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber" value="{{ $fireFighter->phoneNumber }}"> <input type="text" class="form-control" id="phoneNumber" name="phoneNumber" value="{{ $fireFighter->phoneNumber }}">
</div> </div>
<div class="form-group">
<label for="parameter">Telefon domowy:</label>
<input type="text" class="form-control" id="homePhoneNumber" name="homePhoneNumber" value="{{ $fireFighter->homePhoneNumber }}">
</div>
<div class="form-group">
<label for="parameter">Adres zamieszkania:</label>
<input type="text" class="form-control" id="address" name="address" value="{{ $fireFighter->address }}">
</div>
<div class="form-group">
<label for="parameter">Numer domu:</label>
<input type="text" class="form-control" id="apartment" name="apartment" value="{{ $fireFighter->apartment }}">
</div>
<div class="form-group">
<label for="parameter">Miejsce urodzenia:</label>
<input type="text" class="form-control" id="placeOfBirth" name="placeOfBirth" value="{{ $fireFighter->placeOfBirth }}">
</div>
<div class="form-group">
<label for="parameter">Data wstąpienia do OSP:</label>
<input type="date" class="form-control" id="joiningOSPDate" name="joiningOSPDate" value="{{ $fireFighter->joiningOSPDate }}">
</div>
<div class="form-group">
<label for="parameter">Seria dowodu osobistego:</label>
<input type="text" class="form-control" id="IDSeries" name="IDSeries" value="{{ $fireFighter->IDSeries }}">
</div>
<div class="form-group">
<label for="parameter">Numer dowodu osobistego:</label>
<input type="text" class="form-control" id="IDNumber" name="IDNumber" value="{{ $fireFighter->IDNumber }}">
</div>
<div class="form-group">
<label for="parameter">Dowód osobisty ważny do:</label>
<input type="date" class="form-control" id="IDValidUntil" name="IDValidUntil" value="{{ $fireFighter->IDValidUntil }}">
</div>
<div class="form-group">
<label for="parameter">Numer legitymacji członkowskiej:</label>
<input type="text" class="form-control" id="identityCardNumber" name="identityCardNumber" value="{{ $fireFighter->identityCardNumber }}">
</div>
<div class="form-group">
<label for="parameter">Prawo jazdy (kategorie):</label>
<input type="text" class="form-control" id="driversLicense" name="driversLicense" value="{{ $fireFighter->driversLicense }}">
</div>
<div class="form-group">
<label for="parameter">Wykształcenie:</label>
<input type="text" class="form-control" id="education" name="education" value="{{ $fireFighter->education }}">
</div>
<div class="form-group">
<label for="parameter">Zawód wyuczony:</label>
<input type="text" class="form-control" id="profession" name="profession" value="{{ $fireFighter->profession }}">
</div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>