From 1c9f20dd80292507059606a2f7ed0d3304ef402c Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Thu, 26 Dec 2019 16:04:17 +0100 Subject: [PATCH 1/9] =?UTF-8?q?dodanie=20opcji=20zmiany=20has=C5=82a=20prz?= =?UTF-8?q?ez=20u=C5=BCytkownika?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ChangePasswordController.php | 40 +++++++++++++ app/Rules/ComparePasswords.php | 41 +++++++++++++ resources/views/changePassword.blade.php | 60 +++++++++++++++++++ resources/views/userProfile.blade.php | 9 +++ resources/views/userProfileEdit.blade.php | 1 + routes/web.php | 2 + 6 files changed, 153 insertions(+) create mode 100644 app/Http/Controllers/ChangePasswordController.php create mode 100644 app/Rules/ComparePasswords.php create mode 100644 resources/views/changePassword.blade.php diff --git a/app/Http/Controllers/ChangePasswordController.php b/app/Http/Controllers/ChangePasswordController.php new file mode 100644 index 0000000..cee1153 --- /dev/null +++ b/app/Http/Controllers/ChangePasswordController.php @@ -0,0 +1,40 @@ +middleware('auth'); + } + + public function create() + { + return view('changePassword'); + } + + + public function update(Request $request) + { + $request->validate([ + 'current_password' => new ComparePasswords, + 'password' => 'required|confirmed|min:6|different:current_password', + ], + [ + 'required' => 'Podaj nowe hasło.', + 'confirmed' => 'Nowe hasło się nie zgadza.', + 'min' => ':attribute musi mieć przynajmniej :min znaków.', + 'different' => 'Stare i nowe hasło nie mogą być identyczne.' + ]); + + User::find(auth()->user()->id)->update(['password'=> $request-> password]); + + return redirect()->to('/userprofile')->with('success','Hasło zostało zmienione'); + } +} \ No newline at end of file diff --git a/app/Rules/ComparePasswords.php b/app/Rules/ComparePasswords.php new file mode 100644 index 0000000..b697935 --- /dev/null +++ b/app/Rules/ComparePasswords.php @@ -0,0 +1,41 @@ +user()->password); + } + + /** + * Get the validation error message. + * + * @return string + */ + public function message() + { + return 'Obecne hasło jest niepoprawne.'; + } +} diff --git a/resources/views/changePassword.blade.php b/resources/views/changePassword.blade.php new file mode 100644 index 0000000..7128616 --- /dev/null +++ b/resources/views/changePassword.blade.php @@ -0,0 +1,60 @@ +@extends('layout.app') + +@section('left-menu') + @parent + +@stop + +@section('center-area') +@parent +
+
+
+
+
Zmiana hasła
+ +
+
+ @csrf +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+ @include('inc.formerrors') +
+
+
+
+
+
+@stop \ No newline at end of file diff --git a/resources/views/userProfile.blade.php b/resources/views/userProfile.blade.php index b7c0688..b956bdb 100644 --- a/resources/views/userProfile.blade.php +++ b/resources/views/userProfile.blade.php @@ -12,6 +12,15 @@ @parent @if( auth()->check()) + + @if (\Session::has('success')) +
+ +
+ @endif +

diff --git a/resources/views/userProfileEdit.blade.php b/resources/views/userProfileEdit.blade.php index 2d8e1af..013c0ba 100644 --- a/resources/views/userProfileEdit.blade.php +++ b/resources/views/userProfileEdit.blade.php @@ -3,6 +3,7 @@ @section('left-menu') @parent @stop diff --git a/routes/web.php b/routes/web.php index 81fd1ce..75444b4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -83,6 +83,8 @@ Route::post('/szkolenia/addTrainingsFireFighters/', 'trainingsController@ajaxReq Route::get('/userprofile', 'userProfileController@create'); Route::get('/userprofile/edit', 'userProfileController@editForm'); Route::post('/userprofile/edit', 'userProfileController@update'); +Route::get('/userprofile/passwordchange', 'ChangePasswordController@create'); +Route::post('/userprofile/passwordchange', 'ChangePasswordController@update');; Route::get('register/verify/{confirmationCode}', [ From 0538c51db95713dda913504991a35b036fb8d45f Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Sat, 28 Dec 2019 15:08:25 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Profil=20u=C5=BCytkownika=20-=20wy=C5=9Bwie?= =?UTF-8?q?tlanie=20szkole=C5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/userProfileController.php | 16 +++++++++ resources/views/changePassword.blade.php | 1 + resources/views/userProfile.blade.php | 1 + resources/views/userProfileEdit.blade.php | 1 + resources/views/userTrainings.blade.php | 36 +++++++++++++++++++ routes/web.php | 3 +- 6 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 resources/views/userTrainings.blade.php diff --git a/app/Http/Controllers/userProfileController.php b/app/Http/Controllers/userProfileController.php index 03209cc..f894f1a 100644 --- a/app/Http/Controllers/userProfileController.php +++ b/app/Http/Controllers/userProfileController.php @@ -69,4 +69,20 @@ class userProfileController extends Controller return redirect()->to('/userprofile');; } + + public function userTrainings(){ + + if(auth()->user() != null && auth()->user()->fireStationID != null ){ + $userTrainings = DB::table('trainingsfirefighters')->where("trainingsfirefighters.firefighterID", '=', auth()->user()->id) + ->leftJoin('trainings', 'trainingsfirefighters.trainingID', '=', 'trainings.id') + ->select('trainingsfirefighters.id','trainings.trainingName','trainingsfirefighters.dateOfComplete', 'trainingsfirefighters.dateOfExpiry') + ->get(); + //DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID) + //->whereNull('deleted_at')->get(); + return view("userTrainings", ["userTrainings" => $userTrainings]); + } + else{ + return redirect()->to('/login');; + } + } } diff --git a/resources/views/changePassword.blade.php b/resources/views/changePassword.blade.php index 7128616..474fc9c 100644 --- a/resources/views/changePassword.blade.php +++ b/resources/views/changePassword.blade.php @@ -5,6 +5,7 @@ @stop diff --git a/resources/views/userProfile.blade.php b/resources/views/userProfile.blade.php index b956bdb..a8f3b14 100644 --- a/resources/views/userProfile.blade.php +++ b/resources/views/userProfile.blade.php @@ -4,6 +4,7 @@ @parent @stop diff --git a/resources/views/userProfileEdit.blade.php b/resources/views/userProfileEdit.blade.php index 013c0ba..54edf17 100644 --- a/resources/views/userProfileEdit.blade.php +++ b/resources/views/userProfileEdit.blade.php @@ -4,6 +4,7 @@ @parent @stop diff --git a/resources/views/userTrainings.blade.php b/resources/views/userTrainings.blade.php new file mode 100644 index 0000000..ef4a943 --- /dev/null +++ b/resources/views/userTrainings.blade.php @@ -0,0 +1,36 @@ +@extends('layout.app') + +@section('left-menu') + @parent + +@stop + +@section('center-area') + @parent + + @if( auth()->check()) + +

+

+ + + + + @foreach($userTrainings as $userTraining) + + + + + + @endforeach +
SzkolenieData ukończeniaData ważności
{{ $userTraining->trainingName }}{{ $userTraining->dateOfComplete }}{{ $userTraining->dateOfExpiry }}
+

+ @else + Brak autoryzacji + @endif + +@stop \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 75444b4..d630725 100644 --- a/routes/web.php +++ b/routes/web.php @@ -84,7 +84,8 @@ Route::get('/userprofile', 'userProfileController@create'); Route::get('/userprofile/edit', 'userProfileController@editForm'); Route::post('/userprofile/edit', 'userProfileController@update'); Route::get('/userprofile/passwordchange', 'ChangePasswordController@create'); -Route::post('/userprofile/passwordchange', 'ChangePasswordController@update');; +Route::post('/userprofile/passwordchange', 'ChangePasswordController@update'); +Route::get('/userprofile/szkolenia', 'userProfileController@userTrainings'); Route::get('register/verify/{confirmationCode}', [ From 5f139cd4252ef060bef8caeb659a5680ee0eecb3 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Sat, 28 Dec 2019 19:01:42 +0100 Subject: [PATCH 3/9] =?UTF-8?q?zawieszanie=20i=20odwieszanie=20pojazd?= =?UTF-8?q?=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/VehiclesController.php | 20 +++++++++++ app/vehicle.php | 2 +- ...28_165307_add_status_to_vehicles_table.php | 33 +++++++++++++++++++ resources/views/vehicles.blade.php | 25 ++++++++++---- resources/views/vehiclesAdd.blade.php | 13 +++++--- resources/views/vehiclesEdit.blade.php | 8 +++++ routes/web.php | 2 ++ 7 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php diff --git a/app/Http/Controllers/VehiclesController.php b/app/Http/Controllers/VehiclesController.php index 276a5c8..ae4099b 100644 --- a/app/Http/Controllers/VehiclesController.php +++ b/app/Http/Controllers/VehiclesController.php @@ -90,6 +90,7 @@ class VehiclesController extends Controller 'chassisPoductionYear' => $request-> chassisPoductionYear, 'entryIntoServiceDate' => formatDate($request-> entryIntoServiceDate), 'fireEnginePumpDescription' => $request-> fireEnginePumpDescription, + 'status' => $request-> status ]); return redirect()->to('/pojazdy'); @@ -137,6 +138,7 @@ class VehiclesController extends Controller $vehicle-> chassisPoductionYear = $request-> chassisPoductionYear; $vehicle-> entryIntoServiceDate = formatDate($request-> entryIntoServiceDate); $vehicle-> fireEnginePumpDescription = $request-> fireEnginePumpDescription; + $vehicle-> status = $request-> status; $vehicle->save(); return redirect()->to('/pojazdy');; @@ -147,4 +149,22 @@ class VehiclesController extends Controller vehicle::where('id',$id)->delete(); return redirect()->to('/pojazdy'); } + + public function activate() + { + $request = request(); + $vehicle = vehicle::find( $request-> vehicleID); + $vehicle-> status = 1; + $vehicle->save(); + return redirect()->to('/pojazdy'); + } + + public function deactivate() + { + $request = request(); + $vehicle = vehicle::find( $request-> vehicleID); + $vehicle-> status = 0; + $vehicle->save(); + return redirect()->to('/pojazdy'); + } } diff --git a/app/vehicle.php b/app/vehicle.php index 3c3fb6b..27d26af 100644 --- a/app/vehicle.php +++ b/app/vehicle.php @@ -12,7 +12,7 @@ class vehicle extends Model protected $table = 'vehicles'; protected $fillable = [ - 'fireStationID','name', 'codename', 'brand', 'registrationNumber', 'productionYear', 'examExpirationDate', 'insuranceExpirationDate', 'driveType', 'chassisType', 'bodyProducer', 'crewNumber', 'foamAgent', 'enginePower', 'mass', 'chassisNumber', 'engineNumber', 'fuelType', 'chassisPoductionYear', 'entryIntoServiceDate', 'fireEnginePumpDescription', 'created_at', 'updated_at' + 'fireStationID','name', 'codename', 'brand', 'registrationNumber', 'productionYear', 'examExpirationDate', 'insuranceExpirationDate', 'driveType', 'chassisType', 'bodyProducer', 'crewNumber', 'foamAgent', 'enginePower', 'mass', 'chassisNumber', 'engineNumber', 'fuelType', 'chassisPoductionYear', 'entryIntoServiceDate', 'fireEnginePumpDescription', 'created_at', 'updated_at', 'status' ]; } \ No newline at end of file diff --git a/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php b/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php new file mode 100644 index 0000000..2c4b226 --- /dev/null +++ b/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php @@ -0,0 +1,33 @@ +integer('status')->default('0'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('vehicles', function (Blueprint $table) { + // + }); + } +} diff --git a/resources/views/vehicles.blade.php b/resources/views/vehicles.blade.php index e8743a7..9e95242 100644 --- a/resources/views/vehicles.blade.php +++ b/resources/views/vehicles.blade.php @@ -4,9 +4,6 @@ @parent @stop @@ -46,12 +43,26 @@ {{ $vehicle->driveType }} {{ $vehicle->examExpirationDate }} {{ $vehicle->insuranceExpirationDate }} - - + {{ csrf_field() }} @method('DELETE') - - + + + @if ($vehicle->status == 1) +
+ {{ csrf_field() }} + + +
+ @elseif ($vehicle->status == 0) +
+ {{ csrf_field() }} + + +
+ + @endif + @endforeach diff --git a/resources/views/vehiclesAdd.blade.php b/resources/views/vehiclesAdd.blade.php index 4cb9a99..bba2f95 100644 --- a/resources/views/vehiclesAdd.blade.php +++ b/resources/views/vehiclesAdd.blade.php @@ -3,10 +3,7 @@ @section('left-menu') @parent @stop @@ -114,6 +111,14 @@ +
+ + +
+
diff --git a/resources/views/vehiclesEdit.blade.php b/resources/views/vehiclesEdit.blade.php index 2b3fdfb..ab17b3a 100644 --- a/resources/views/vehiclesEdit.blade.php +++ b/resources/views/vehiclesEdit.blade.php @@ -116,6 +116,14 @@ +
+ + +
+
diff --git a/routes/web.php b/routes/web.php index d630725..5291834 100644 --- a/routes/web.php +++ b/routes/web.php @@ -66,6 +66,8 @@ Route::post('/pojazdy', 'VehiclesController@store'); Route::get('/pojazdy/edit/{id}', 'VehiclesController@editForm'); Route::post('/pojazdy/edit', 'VehiclesController@update'); Route::resource('vehicles', 'VehiclesController'); +Route::post('pojazdy/activate', 'VehiclesController@activate'); +Route::post('pojazdy/deactivate', 'VehiclesController@deactivate'); Route::get('/sprzet', 'EquipmentController@create'); Route::get('/sprzet/add', 'EquipmentController@addForm'); From 30b0880f93d31f56f71b6120067e7f60f4934b9b Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 30 Dec 2019 16:00:01 +0100 Subject: [PATCH 4/9] =?UTF-8?q?fireStations=20-=20fix=20z=C5=82o=C5=9Bliwe?= =?UTF-8?q?j=20liter=C3=B3wki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/fireStationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/fireStationController.php b/app/Http/Controllers/fireStationController.php index cc5b8d2..817bd6a 100644 --- a/app/Http/Controllers/fireStationController.php +++ b/app/Http/Controllers/fireStationController.php @@ -24,7 +24,7 @@ class fireStationController extends Controller if(auth()->user() != null && auth()->user()->fireStationID != null ) { $id = auth()->user()->fireStationID; - $fireStation = DB::table('firestations')->where("id", $id)->first(); + $fireStation = DB::table('fireStations')->where("id", $id)->first(); $voivodeships = DB::table('wojewodztwa')->pluck("name","id"); return view('fireStationEdit', ["fireStation" => $fireStation], compact('voivodeships')); } From 0943faf26373d870a956c7af602803e99c96bcd3 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Wed, 1 Jan 2020 03:18:06 +0100 Subject: [PATCH 5/9] =?UTF-8?q?Dodanie=20odznacze=C5=84=20do=20bazy.=20Prz?= =?UTF-8?q?yznawanie,=20wy=C5=9Bwietlanie=20i=20usuwanie=20odznacze=C5=84?= =?UTF-8?q?=20poszczeg=C3=B3lnych=20stra=C5=BCak=C3=B3w.=20Wy=C5=9Bwietlan?= =?UTF-8?q?ie=20odznacze=C5=84=20w=20profilu=20u=C5=BCytkownika.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DecorationsController.php | 72 +++++++++++++++++++ app/decorationsFirefighters.php | 15 ++++ ..._12_31_001536_create_decorations_table.php | 42 +++++++++++ ...6_create_decorationsFirefighters_table.php | 35 +++++++++ resources/lang/en/validation.php | 4 +- resources/views/changePassword.blade.php | 3 +- resources/views/decorations.blade.php | 70 ++++++++++++++++++ resources/views/fireFighters.blade.php | 3 +- resources/views/userDecorations.blade.php | 41 +++++++++++ resources/views/userProfile.blade.php | 5 +- resources/views/userProfileEdit.blade.php | 3 +- resources/views/userTrainings.blade.php | 1 + routes/web.php | 5 ++ 13 files changed, 293 insertions(+), 6 deletions(-) create mode 100644 app/Http/Controllers/DecorationsController.php create mode 100644 app/decorationsFirefighters.php create mode 100644 database/migrations/2019_12_31_001536_create_decorations_table.php create mode 100644 database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php create mode 100644 resources/views/decorations.blade.php create mode 100644 resources/views/userDecorations.blade.php diff --git a/app/Http/Controllers/DecorationsController.php b/app/Http/Controllers/DecorationsController.php new file mode 100644 index 0000000..fb4ece1 --- /dev/null +++ b/app/Http/Controllers/DecorationsController.php @@ -0,0 +1,72 @@ +user() != null && auth()->user()->fireStationID != null ){ + $awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id) + ->whereNull('decorationsFirefighters.deleted_at') + ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') + ->select('decorationName', 'dateOfAward', 'firefighterID', 'decorations.id AS decorationsId', 'decorationsFirefighters.id AS decorationsFirefightersID') + ->get(); + $alreadyAwarded = $awardedDecorations->pluck('decorationsId')->toArray(); // tablica id wszystkich wyróżnień już posiadanych + $firefighter = User::find($id, ['id', 'name', 'surname']); + $decoration = DB::table('decorations') + ->whereNotIn('id', $alreadyAwarded) //ograniczenie wyboru do wyróżnień jeszcze nie posiadanych + ->pluck('decorationName', 'id'); + + return View::make("decorations") + ->with(compact('firefighter')) + ->with(compact('awardedDecorations')) + ->with(compact('decoration')); + + } else{ + return "Brak dostepu"; + } + } + + public function store() + { + $this->validate(request(),[ + 'decoration' => 'required', + 'dateOfAward' => 'required', + ], + [ + 'required' => ':attribute jest wymagany(e).', + ]); + + $request = request(); + $decoration = decorationsFirefighters::create([ + 'firefighterID' => $request-> firefighterID, + 'decorationID' => $request-> decoration, + 'dateOfAward' => formatDate($request-> dateOfAward), + ]); + + return back(); + } + + public function destroy($id) + { + decorationsFirefighters::where('id',$id)->delete(); + + return back(); + } +} diff --git a/app/decorationsFirefighters.php b/app/decorationsFirefighters.php new file mode 100644 index 0000000..e98da75 --- /dev/null +++ b/app/decorationsFirefighters.php @@ -0,0 +1,15 @@ +integer('id'); + $table->string('decorationName'); + }); + + DB::table('decorations')->insert([ 'id' => '1', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - brązowa' ]); + DB::table('decorations')->insert([ 'id' => '2', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - srebrna' ]); + DB::table('decorations')->insert([ 'id' => '3', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - złota' ]); + DB::table('decorations')->insert([ 'id' => '4', 'decorationName' => 'Odznaka "Za wysługę lat"' ]); + DB::table('decorations')->insert([ 'id' => '5', 'decorationName' => 'Odznaka "Strażak Wzorowy"' ]); + DB::table('decorations')->insert([ 'id' => '6', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - brązowy' ]); + DB::table('decorations')->insert([ 'id' => '7', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - srebrny' ]); + DB::table('decorations')->insert([ 'id' => '8', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - złoty' ]); + DB::table('decorations')->insert([ 'id' => '9', 'decorationName' => 'Medal Honorowy im. Bolesława Chomicza' ]); + DB::table('decorations')->insert([ 'id' => '10', 'decorationName' => 'Złoty Znak Związku Ochotniczych Straży Pożarnych Rzeczypospolitej Polskiej' ]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('decorations'); + } +} diff --git a/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php b/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php new file mode 100644 index 0000000..1ea2e5c --- /dev/null +++ b/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->integer('firefighterID'); + $table->integer('decorationID'); + $table->date('dateOfAward'); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('decorationsFirefighters'); + } +} diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 63ecebe..4315724 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -161,7 +161,9 @@ return [ 'unitName' => 'nazwa jednostki', 'longitude' => 'długość geograficzna', 'latitude' => 'szerokość geograficzna', - 'amount' => 'ilość' + 'amount' => 'ilość', + 'decoration' => 'odznaczenie', + 'dateOfAward' => 'data przyznania' ], diff --git a/resources/views/changePassword.blade.php b/resources/views/changePassword.blade.php index 474fc9c..842de51 100644 --- a/resources/views/changePassword.blade.php +++ b/resources/views/changePassword.blade.php @@ -5,7 +5,8 @@ @stop diff --git a/resources/views/decorations.blade.php b/resources/views/decorations.blade.php new file mode 100644 index 0000000..791e107 --- /dev/null +++ b/resources/views/decorations.blade.php @@ -0,0 +1,70 @@ +@extends('layout.app') + +@section('left-menu') + @parent + + @stop +@section('center-area') + @parent + + @if( auth()->check()) + @if( auth()->user()->fireStationID == NULL) + Jednostka nie istnieje + @else + @if(count($awardedDecorations) > 0) +

+ + + + + + + + @foreach($awardedDecorations as $awardedDecoration) + + + + + + + + @endforeach +
{{ $firefighter->name }} {{ $firefighter->surname }} - odznaczenia
OdznaczenieData przyznania
{{ $awardedDecoration->decorationName }}{{ $awardedDecoration->dateOfAward }} + {{ csrf_field() }} + @method('DELETE') + +
+

+ @else + {{ $firefighter->name }} {{ $firefighter->surname }} nie posiada żadnych odznaczeń. + @endif + +
+ {{ csrf_field() }} + +
+ + +
+
+ + +
+
+ +
+ @include('inc.formerrors') +
+ @endif + @else + Brak autoryzacji + @endif + +@stop \ No newline at end of file diff --git a/resources/views/fireFighters.blade.php b/resources/views/fireFighters.blade.php index a1b7975..a638fd6 100644 --- a/resources/views/fireFighters.blade.php +++ b/resources/views/fireFighters.blade.php @@ -4,7 +4,6 @@ @parent
  • Dodaj
  • -
  • Edytuj
  • Wyklucz
  • Zawieś
  • Więcej
  • @@ -88,6 +87,8 @@ {{$user->rank}} @if( $user->statusID == 0) Czynny @else Wyłączony @endif + + {{-- --}} {{--
    --}} diff --git a/resources/views/userDecorations.blade.php b/resources/views/userDecorations.blade.php new file mode 100644 index 0000000..cb976da --- /dev/null +++ b/resources/views/userDecorations.blade.php @@ -0,0 +1,41 @@ +@extends('layout.app') + +@section('left-menu') + @parent + + @stop +@section('center-area') + @parent + + @if( auth()->check()) + @if( auth()->user()->fireStationID == NULL) + Jednostka nie istnieje + @else + @if(count($userDecorations) > 0) +

    + + + + + @foreach($userDecorations as $userDecoration) + + + + + @endforeach +
    OdznaczenieData przyznania
    {{ $userDecoration->decorationName }}{{ $userDecoration->dateOfAward }}
    +

    + @else + Nie posiadasz jeszcze żadnych odznaczeń. + @endif + @endif + @else + Brak autoryzacji + @endif + +@stop \ No newline at end of file diff --git a/resources/views/userProfile.blade.php b/resources/views/userProfile.blade.php index a8f3b14..e10c404 100644 --- a/resources/views/userProfile.blade.php +++ b/resources/views/userProfile.blade.php @@ -4,8 +4,9 @@ @parent @stop diff --git a/resources/views/userProfileEdit.blade.php b/resources/views/userProfileEdit.blade.php index 54edf17..af5b6be 100644 --- a/resources/views/userProfileEdit.blade.php +++ b/resources/views/userProfileEdit.blade.php @@ -4,7 +4,8 @@ @parent @stop diff --git a/resources/views/userTrainings.blade.php b/resources/views/userTrainings.blade.php index ef4a943..451ff00 100644 --- a/resources/views/userTrainings.blade.php +++ b/resources/views/userTrainings.blade.php @@ -5,6 +5,7 @@ @stop diff --git a/routes/web.php b/routes/web.php index 5291834..fde553e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -52,6 +52,10 @@ Route::post('/strazacy', 'fireFightersController@store'); Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm'); Route::post('/strazacy/edit', 'fireFightersController@update'); +Route::get('/strazacy/odznaczenia/{id}', 'decorationsController@create'); +Route::post('/strazacy/odznaczenia/{id}', 'decorationsController@store'); +Route::resource('decorations', 'DecorationsController'); + Route::get('/jednostka', 'fireStationController@create'); Route::post('/jednostka', 'fireStationController@store'); Route::get('/jednostka/edit', 'fireStationController@editForm'); @@ -88,6 +92,7 @@ Route::post('/userprofile/edit', 'userProfileController@update'); Route::get('/userprofile/passwordchange', 'ChangePasswordController@create'); Route::post('/userprofile/passwordchange', 'ChangePasswordController@update'); Route::get('/userprofile/szkolenia', 'userProfileController@userTrainings'); +Route::get('/userprofile/odznaczenia', 'userProfileController@userDecorations'); Route::get('register/verify/{confirmationCode}', [ From ef95f03fa2ce2e576778dcf0028135f85fa12817 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Thu, 2 Jan 2020 14:20:35 +0100 Subject: [PATCH 6/9] Odznaczenia - drobne poprawki --- .../Controllers/userProfileController.php | 20 ++++++++++++++----- routes/web.php | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/userProfileController.php b/app/Http/Controllers/userProfileController.php index f894f1a..60d87dd 100644 --- a/app/Http/Controllers/userProfileController.php +++ b/app/Http/Controllers/userProfileController.php @@ -73,16 +73,26 @@ class userProfileController extends Controller public function userTrainings(){ if(auth()->user() != null && auth()->user()->fireStationID != null ){ - $userTrainings = DB::table('trainingsfirefighters')->where("trainingsfirefighters.firefighterID", '=', auth()->user()->id) - ->leftJoin('trainings', 'trainingsfirefighters.trainingID', '=', 'trainings.id') - ->select('trainingsfirefighters.id','trainings.trainingName','trainingsfirefighters.dateOfComplete', 'trainingsfirefighters.dateOfExpiry') + $userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', auth()->user()->id) + ->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id') + ->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry') ->get(); - //DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID) - //->whereNull('deleted_at')->get(); return view("userTrainings", ["userTrainings" => $userTrainings]); } else{ return redirect()->to('/login');; } } + + public function userDecorations(){ + if(auth()->user() != null && auth()->user()->fireStationID != null ){ + $userDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', auth()->user()->id) + ->whereNull('decorationsFirefighters.deleted_at') + ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') + ->get(); + return view("userDecorations", ["userDecorations" => $userDecorations]); + } else{ + return "Brak dostepu"; + } + } } diff --git a/routes/web.php b/routes/web.php index fde553e..6821115 100644 --- a/routes/web.php +++ b/routes/web.php @@ -52,8 +52,8 @@ Route::post('/strazacy', 'fireFightersController@store'); Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm'); Route::post('/strazacy/edit', 'fireFightersController@update'); -Route::get('/strazacy/odznaczenia/{id}', 'decorationsController@create'); -Route::post('/strazacy/odznaczenia/{id}', 'decorationsController@store'); +Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create'); +Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store'); Route::resource('decorations', 'DecorationsController'); Route::get('/jednostka', 'fireStationController@create'); From b531ba3e49600f945703f3ab7379606ac9a378d1 Mon Sep 17 00:00:00 2001 From: Marcin Kuskiewicz Date: Fri, 3 Jan 2020 00:55:29 +0000 Subject: [PATCH 7/9] Dodaj 'update.sh' --- update.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 update.sh diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..7306c15 --- /dev/null +++ b/update.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +php artisan down +git reset --hard FETCH_HEAD +git clean -df +git pull -f https://git.wmi.amu.edu.pl/s421507/eOSP2.git master +url=$(basename "$PWD") +chown -R www-data:www-data ../$url +chmod -R 755 ../$url +php artisan migrate +php artisan db:seed +php artisan queue:restart +php artisan cache:clear +php artisan up \ No newline at end of file From 5db37567edc1d5c73eb50a56884811399cf09d01 Mon Sep 17 00:00:00 2001 From: Marcin Kuskiewicz Date: Fri, 3 Jan 2020 00:57:32 +0000 Subject: [PATCH 8/9] Zaktualizuj 'update.sh' --- update.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/update.sh b/update.sh index 7306c15..f462b29 100644 --- a/update.sh +++ b/update.sh @@ -1,8 +1,6 @@ #!/bin/bash php artisan down -git reset --hard FETCH_HEAD -git clean -df git pull -f https://git.wmi.amu.edu.pl/s421507/eOSP2.git master url=$(basename "$PWD") chown -R www-data:www-data ../$url From ba18b79848bbbbc1d3d5d7bbc7ca0f0927c52b47 Mon Sep 17 00:00:00 2001 From: Marcin Kuskiewicz Date: Fri, 3 Jan 2020 01:01:10 +0000 Subject: [PATCH 9/9] zakomentowanie twardego update'u GITa --- update.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update.sh b/update.sh index f462b29..a74d004 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,8 @@ #!/bin/bash php artisan down +#git reset --hard FETCH_HEAD +#git clean -df git pull -f https://git.wmi.amu.edu.pl/s421507/eOSP2.git master url=$(basename "$PWD") chown -R www-data:www-data ../$url