From cdb5f98f291b85dc548e7b785fe2869617c4f5a4 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Thu, 30 Jan 2020 21:19:05 +0100 Subject: [PATCH 01/10] widoki - drobne poprawki --- resources/views/decorations.blade.php | 6 +++++- resources/views/depot.blade.php | 6 +----- resources/views/equipment.blade.php | 2 -- resources/views/equipmentAdd.blade.php | 4 +--- resources/views/equipmentEdit.blade.php | 3 +-- resources/views/fireFighters.blade.php | 8 +++----- resources/views/fireFightersAdd.blade.php | 7 ++----- resources/views/fireFightersEdit.blade.php | 7 ++----- resources/views/operationAdd.blade.php | 12 +++++++----- resources/views/operationEdit.blade.php | 3 ++- resources/views/trainings.blade.php | 8 +++----- resources/views/trainingsAddFireFighters.blade.php | 5 ++--- resources/views/vehiclesAdd.blade.php | 2 +- resources/views/vehiclesEdit.blade.php | 6 ++---- 14 files changed, 32 insertions(+), 47 deletions(-) diff --git a/resources/views/decorations.blade.php b/resources/views/decorations.blade.php index 2b553d2..db432d9 100644 --- a/resources/views/decorations.blade.php +++ b/resources/views/decorations.blade.php @@ -54,7 +54,11 @@ diff --git a/resources/views/depot.blade.php b/resources/views/depot.blade.php index 7b28e75..089aa75 100644 --- a/resources/views/depot.blade.php +++ b/resources/views/depot.blade.php @@ -4,16 +4,12 @@ @parent @stop @section('center-area') @parent Strona w budowie -

Zawarte będą tutaj informacje o umundurowaniu oraz sprzęcie jaki jest na wyposażeniu strażnicy oraz informacje gdzie umundurowanie się znajduje(druhowie mundury koszarowe oraz galowe mają w w domach, informacja ta pozwoli na sprawdzenie np jakie są braki w umundurowaniu).

- +

Zawarte są tutaj informacje o sprzęcie jaki jest na wyposażeniu strażnicy. W przyszłej wersji eOSP do strażnicy dodane zostaną informacje o posiadanym umundurowaniu oraz gdzie umundurowanie się znajduje(druhowie mundury koszarowe oraz galowe miewają w domach, informacja ta pozwoli na sprawdzenie np jakie są braki w umundurowaniu).

@stop diff --git a/resources/views/equipment.blade.php b/resources/views/equipment.blade.php index 758b9ff..2500972 100644 --- a/resources/views/equipment.blade.php +++ b/resources/views/equipment.blade.php @@ -5,8 +5,6 @@ @parent @stop diff --git a/resources/views/equipmentAdd.blade.php b/resources/views/equipmentAdd.blade.php index b49ad36..5f3535e 100644 --- a/resources/views/equipmentAdd.blade.php +++ b/resources/views/equipmentAdd.blade.php @@ -3,9 +3,7 @@ @section('left-menu') @parent @stop diff --git a/resources/views/equipmentEdit.blade.php b/resources/views/equipmentEdit.blade.php index 18657d4..d798c61 100644 --- a/resources/views/equipmentEdit.blade.php +++ b/resources/views/equipmentEdit.blade.php @@ -4,8 +4,7 @@ @parent @stop diff --git a/resources/views/fireFighters.blade.php b/resources/views/fireFighters.blade.php index 80c1eb1..1de1fba 100644 --- a/resources/views/fireFighters.blade.php +++ b/resources/views/fireFighters.blade.php @@ -4,9 +4,7 @@ @parent @stop @@ -70,14 +68,14 @@ # - Imie + Imię Nazwisko PESEL E-mail Funkcja Stopień Status - Operacje + Operacja diff --git a/resources/views/fireFightersAdd.blade.php b/resources/views/fireFightersAdd.blade.php index 6450962..1dfb004 100644 --- a/resources/views/fireFightersAdd.blade.php +++ b/resources/views/fireFightersAdd.blade.php @@ -3,11 +3,8 @@ @section('left-menu') @parent @stop diff --git a/resources/views/fireFightersEdit.blade.php b/resources/views/fireFightersEdit.blade.php index 66a2815..743fc41 100644 --- a/resources/views/fireFightersEdit.blade.php +++ b/resources/views/fireFightersEdit.blade.php @@ -3,11 +3,8 @@ @section('left-menu') @parent @stop diff --git a/resources/views/operationAdd.blade.php b/resources/views/operationAdd.blade.php index 12b01e2..6d9d622 100644 --- a/resources/views/operationAdd.blade.php +++ b/resources/views/operationAdd.blade.php @@ -3,7 +3,7 @@ @section('left-menu') @parent @stop @@ -44,7 +44,11 @@ @@ -162,6 +166,4 @@ }); - - - + \ No newline at end of file diff --git a/resources/views/operationEdit.blade.php b/resources/views/operationEdit.blade.php index 2f183c1..1e089fe 100644 --- a/resources/views/operationEdit.blade.php +++ b/resources/views/operationEdit.blade.php @@ -3,7 +3,8 @@ @section('left-menu') @parent @stop diff --git a/resources/views/trainings.blade.php b/resources/views/trainings.blade.php index e13733d..d8a3cc9 100644 --- a/resources/views/trainings.blade.php +++ b/resources/views/trainings.blade.php @@ -8,9 +8,7 @@ @section('left-menu') @parent @stop @@ -25,7 +23,7 @@
{{ csrf_field() }}
- +
@@ -157,7 +155,7 @@ function deleteButton(trainingID){ swal.fire({ - title: "Czy chcesz usunąć wyjazd?", + title: "Czy chcesz usunąć badanie/szkolenie?", width: 'auto', confirmButtonText: 'Tak', cancelButtonText: 'Nie', diff --git a/resources/views/trainingsAddFireFighters.blade.php b/resources/views/trainingsAddFireFighters.blade.php index fc10f11..9e0055b 100644 --- a/resources/views/trainingsAddFireFighters.blade.php +++ b/resources/views/trainingsAddFireFighters.blade.php @@ -7,9 +7,8 @@ @section('left-menu') @parent @stop diff --git a/resources/views/vehiclesAdd.blade.php b/resources/views/vehiclesAdd.blade.php index bba2f95..e10fa12 100644 --- a/resources/views/vehiclesAdd.blade.php +++ b/resources/views/vehiclesAdd.blade.php @@ -3,7 +3,7 @@ @section('left-menu') @parent @stop diff --git a/resources/views/vehiclesEdit.blade.php b/resources/views/vehiclesEdit.blade.php index ab17b3a..eb9082d 100644 --- a/resources/views/vehiclesEdit.blade.php +++ b/resources/views/vehiclesEdit.blade.php @@ -3,10 +3,8 @@ @section('left-menu') @parent @stop From c29852fa09cc9a60e316b3490d41825dfe0de5ad Mon Sep 17 00:00:00 2001 From: Marcin Kuskiewicz Date: Fri, 31 Jan 2020 01:12:14 +0000 Subject: [PATCH 02/10] =?UTF-8?q?dodanie=20przyk=C5=82adowych=20jednostek?= =?UTF-8?q?=20i=20u=C5=BCytkownik=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/seeds/DatabaseSeeder.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 291a037..e634290 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -2913,5 +2913,19 @@ class DatabaseSeeder extends Seeder DB::table('gminy')->insert([ 'id' => '1326101', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326100', 'name' => 'm. Koszalin' ]); DB::table('gminy')->insert([ 'id' => '1326201', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326200', 'name' => 'm. Szczecin' ]); DB::table('gminy')->insert([ 'id' => '1326301', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326300', 'name' => 'm. Świnoujście' ]); + //jednostki + DB::table('fireStations')->insert(['id'=>'1100','name'=>'Kębłowo','number'=>'1100','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Kębłowo','zipCode'=>'64223','address'=>'ul. Nowa 8a','latitude'=>'52.0485042','longitude'=>'16.1052983','KRS'=>'0000232331','NIP'=>'9231571641','phoneNumber'=>'501234567','email'=>'straz@keblowo.pl','deleted'=>'0','creatorID'=>'1101','changingID'=>'1101','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('fireStations')->insert(['id'=>'1200','name'=>'Obra','number'=>'1200','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Obra','zipCode'=>'64211','address'=>'ul. Cmentarna 5a','latitude'=>'52.0768963','longitude'=>'16.0427013','KRS'=>'0000096776','NIP'=>'9231571629','phoneNumber'=>'501234567','email'=>'osp.obra@wp.pl','deleted'=>'0','creatorID'=>'1201','changingID'=>'1201','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + //użytkownicy + DB::table('users')->insert(['id'=>'1101','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Szymon','surname'=>'Tomys','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'szymon.tomys@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1102','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Hanna Nowacka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'hanna.nowacka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1103','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Dominik Klupsz','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'dominik.klupsz@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1104','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Kamila Prządka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'kamila.przadka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1105','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Rafał Smerdka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'rafal.smerdka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1201','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Damian Kotlarski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'damian.kotlarski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1202','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Artur Orwat','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'artur.orwat@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1203','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Rogozinski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.rogozinski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1204','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Lidia Kaczmarek','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'lidia.kaczmarek@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1205','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Nowak','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.nowak@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); } } From cea8fbc7dc008cef8874a05af9dd40f90b6e32b8 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 02:01:44 +0000 Subject: [PATCH 03/10] =?UTF-8?q?Usu=C5=84=20'database/migrations/2019=5F1?= =?UTF-8?q?2=5F28=5F165307=5Fadd=5FsoftDelete=5Fto=5Fvehicles=5Ftable.php'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...65307_add_softDelete_to_vehicles_table.php | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php diff --git a/database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php b/database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php deleted file mode 100644 index 63837d4..0000000 --- a/database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php +++ /dev/null @@ -1,33 +0,0 @@ -softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('vehicles', function (Blueprint $table) { - // - }); - } -} From 247f0b0ba657b03948cd0c7b254a43c31ee48a64 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 03:13:13 +0100 Subject: [PATCH 04/10] Dopracowanie walidacji formularzy --- app/Http/Controllers/EquipmentController.php | 20 ++++-- .../Controllers/RegistrationController.php | 10 ++- app/Http/Controllers/VehiclesController.php | 64 +++++++++++++------ .../Controllers/fireFightersController.php | 14 ++-- app/Http/Controllers/operationsController.php | 21 +++--- .../Controllers/resetPasswordController.php | 4 +- app/Http/Controllers/trainingsController.php | 5 +- .../Controllers/userProfileController.php | 7 +- resources/lang/en/validation.php | 27 +++++++- resources/views/vehiclesAdd.blade.php | 4 +- resources/views/vehiclesEdit.blade.php | 4 +- 11 files changed, 118 insertions(+), 62 deletions(-) diff --git a/app/Http/Controllers/EquipmentController.php b/app/Http/Controllers/EquipmentController.php index d95868b..87563f0 100644 --- a/app/Http/Controllers/EquipmentController.php +++ b/app/Http/Controllers/EquipmentController.php @@ -44,12 +44,17 @@ class EquipmentController extends Controller public function store(){ $this->validate(request(), [ - 'name' => 'required', - 'amount' => 'required|numeric', + 'name' => 'required|max:45', + 'amount' => 'required|numeric|digits_between:1,10', + 'parameter' => 'max:45|nullable', ], [ 'required' => ':attribute jest wymagany(a).', + 'name.required' => 'nazwa jest wymagany(a).', + 'name.max' => 'nazwa musi mieć nie więcej niż :max znaków.', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.', 'numeric' => ':attribute powinna zawierać tylko cyfry.', + 'digits_between' => ':attribute jest za duży(a)' ]); @@ -67,12 +72,17 @@ class EquipmentController extends Controller public function update(){ $this->validate(request(), [ - 'name' => 'required', - 'amount' => 'required|numeric', + 'name' => 'required|max:45', + 'amount' => 'required|numeric|digits_between:1,10', + 'parameter' => 'max:45|nullable', ], [ 'required' => ':attribute jest wymagany(a).', - 'numeric' => ':attribute powinna zawierać tylko cyfry.' + 'name.required' => 'nazwa jest wymagany(a).', + 'name.max' => 'nazwa musi mieć nie więcej niż :max znaków.', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.', + 'numeric' => ':attribute powinna zawierać tylko cyfry.', + 'digits_between' => ':attribute jest za duży(a)' ]); diff --git a/app/Http/Controllers/RegistrationController.php b/app/Http/Controllers/RegistrationController.php index f1ddd62..0402efc 100644 --- a/app/Http/Controllers/RegistrationController.php +++ b/app/Http/Controllers/RegistrationController.php @@ -8,7 +8,6 @@ use App\User; use Mail; use App\Rules\Pesel; -/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */ class RegistrationController extends Controller { public function create() @@ -20,19 +19,18 @@ class RegistrationController extends Controller { $this->validate(request(), [ - 'name' => 'required|alpha|min:3|max:45', - 'surname' => 'required|alpha|min:3|max:45', + 'name' => 'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', + 'surname' => 'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', 'PESEL' => new Pesel, 'phoneNumber' => 'required|digits:9', 'email' => 'required|email|unique:users', - 'password' => 'required|confirmed|min:6', + 'password' => 'required|confirmed|min:6|max:45', ], [ 'required' => ':attribute jest wymagany(e).', 'min' => ':attribute musi mieć przynajmniej :min znaki.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.', - 'alpha' => ':attribute może zawierać tylko litery.', - 'alpha_num' => ':attribute może zawierać tylko litery i cyfry.', + 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy', 'digits' => ':attribute musi składać się z :digits cyfr.', 'unique' =>':attribute jest już zajęty.', 'confirmed' =>':attribute się nie zgadza.', diff --git a/app/Http/Controllers/VehiclesController.php b/app/Http/Controllers/VehiclesController.php index 3ed083d..17deb49 100644 --- a/app/Http/Controllers/VehiclesController.php +++ b/app/Http/Controllers/VehiclesController.php @@ -51,26 +51,40 @@ class VehiclesController extends Controller public function store(){ $this->validate(request(), [ - 'name' => 'required', - 'codename' => 'required', + 'vehicleName' => 'required|max:45', + 'codename' => 'required|max:45', + 'brand' => 'max:45', + 'registrationNumber' => 'max:15', 'productionYear' => 'digits:4|nullable', - 'foamAgent' => 'numeric|nullable', - 'enginePower' => 'numeric|nullable', - 'crewNumber' => 'numeric|nullable', - 'mass' => 'numeric|nullable', - 'chassisPoductionYear' => 'numeric|nullable', + 'driveType' => 'max:45', + 'chassisType' => 'max:45', + 'bodyProducer' => 'max:45', + 'crewNumber' => 'numeric|nullable|digits_between:1,2', + 'foamAgent' => 'numeric|nullable|digits_between:1,10', + 'enginePower' => 'numeric|nullable|digits_between:1,10', + 'mass' => 'numeric|nullable|digits_between:1,10', + 'chassisNumber' => 'max:45', + 'engineNumber' => 'max:45', + 'fuelType' => 'max:45', + 'chassisPoductionYear' => 'digits:4|nullable', + 'fireEnginePumpDescription' => 'max:250', ], [ + + 'name' => 'nazwa', 'required' => ':attribute jest wymagany(e).', - 'numeric' => ':attribute zawiera tylko cyfry.', + 'numeric' => ':attribute może zawierać tylko cyfry.', 'digits' => ':attribute musi składać się z :digits cyfr.', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.', + 'digits_between' => ':attribute jest za duży(a)' + ]); $request = request(); $vehicle = vehicle::create([ 'fireStationID' => auth()->user()->fireStationID, - 'name' => $request-> name, + 'name' => $request-> vehicleName, 'codename' => $request-> codename, 'brand' => $request-> brand, 'registrationNumber' => $request-> registrationNumber, @@ -100,25 +114,39 @@ class VehiclesController extends Controller public function update(){ $this->validate(request(), [ - 'name' => 'required', - 'codename' => 'required', + 'vehicleName' => 'required|max:45', + 'codename' => 'required|max:45', + 'brand' => 'max:45', + 'registrationNumber' => 'max:15', 'productionYear' => 'digits:4|nullable', - 'foamAgent' => 'numeric|nullable', - 'enginePower' => 'numeric|nullable', - 'crewNumber' => 'numeric|nullable', - 'mass' => 'numeric|nullable', - 'chassisPoductionYear' => 'numeric|nullable', + 'driveType' => 'max:45', + 'chassisType' => 'max:45', + 'bodyProducer' => 'max:45', + 'crewNumber' => 'numeric|nullable|digits_between:1,2', + 'foamAgent' => 'numeric|nullable|digits_between:1,10', + 'enginePower' => 'numeric|nullable|digits_between:1,10', + 'mass' => 'numeric|nullable|digits_between:1,10', + 'chassisNumber' => 'max:45', + 'engineNumber' => 'max:45', + 'fuelType' => 'max:45', + 'chassisPoductionYear' => 'digits:4|nullable', + 'fireEnginePumpDescription' => 'max:250', ], [ + + 'name' => 'nazwa', 'required' => ':attribute jest wymagany(e).', - 'numeric' => ':attribute zawiera tylko cyfry.', + 'numeric' => ':attribute może zawierać tylko cyfry.', 'digits' => ':attribute musi składać się z :digits cyfr.', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.', + 'digits_between' => ':attribute jest za duży(a)' + ]); $request = request(); $vehicle = vehicle::find( $request->vehicleID); - $vehicle-> name = $request-> name; + $vehicle-> name = $request-> vehicleName; $vehicle-> codename = $request-> codename; $vehicle-> brand = $request-> brand; $vehicle-> registrationNumber = $request-> registrationNumber; diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index 10d34f6..716e1e8 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -62,8 +62,8 @@ class fireFightersController extends Controller public function store(){ $this->validate(request(), [ - 'name' => 'required|alpha|min:3|max:45', - 'surname' => 'required|alpha|min:3|max:45', + 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', + 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', 'PESEL' => new Pesel, 'phoneNumber' => 'required|digits:9', 'email' => 'required|email|unique:users', @@ -74,8 +74,7 @@ class fireFightersController extends Controller 'required' => ':attribute jest wymagany(e).', 'min' => ':attribute musi mieć przynajmniej :min znaki.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.', - 'alpha' => ':attribute może zawierać tylko litery.', - 'alpha_num' => ':attribute może zawierać tylko litery i cyfry.', + 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy', 'digits' => ':attribute musi składać się z :digits cyfr.', 'unique' =>':attribute jest już zajęty.', 'confirmed' =>':attribute się nie zgadza.', @@ -112,8 +111,8 @@ class fireFightersController extends Controller public function update(){ $this->validate(request(), [ - 'name' => 'required|alpha|min:3|max:45', - 'surname' => 'required|alpha|min:3|max:45', + 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', + 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', 'PESEL' => new Pesel, 'phoneNumber' => 'required|digits:9', ], @@ -121,8 +120,7 @@ class fireFightersController extends Controller 'required' => ':attribute jest wymagany(e).', 'min' => ':attribute musi mieć przynajmniej :min znaki.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.', - 'alpha' => ':attribute może zawierać tylko litery.', - 'alpha_num' => ':attribute może zawierać tylko litery i cyfry.', + 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy', 'digits' => ':attribute musi składać się z :digits cyfr.', 'unique' =>':attribute jest już zajęty.', 'confirmed' =>':attribute się nie zgadza.', diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php index 59ba67b..0401e8c 100644 --- a/app/Http/Controllers/operationsController.php +++ b/app/Http/Controllers/operationsController.php @@ -125,10 +125,10 @@ class operationsController extends Controller public function store(){ $this->validate(request(),[ 'operationDate' => 'required', - 'operationLocation' => 'required', - 'operationTarget' => 'required', - 'operationDangerType' => 'required', - 'operationDescription' => 'required', + 'operationLocation' => 'required|max:100', + 'operationTarget' => 'required|max:100', + 'operationDangerType' => 'required|max:100', + 'operationDescription' => 'required|max:250', 'operationLeader' => 'required', 'operationDriver.*' => 'required', 'operationVehicle.*' => 'required', @@ -136,7 +136,8 @@ class operationsController extends Controller 'transport.*' => 'required', ], [ - 'required' => ':attribute jest wymagany(e)' + 'required' => ':attribute jest wymagany(e)', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.' ]); // @@ -195,10 +196,10 @@ class operationsController extends Controller public function update(){ $this->validate(request(),[ 'operationDate' => 'required', - 'operationLocation' => 'required', - 'operationTarget' => 'required', - 'operationDangerType' => 'required', - 'operationDescription' => 'required', + 'operationLocation' => 'required|max:100', + 'operationTarget' => 'required|max:100', + 'operationDangerType' => 'required|max:100', + 'operationDescription' => 'required|max:250', 'operationLeader' => 'required', 'operationDriver.*' => 'required', 'operationVehicle.*' => 'required', @@ -207,7 +208,7 @@ class operationsController extends Controller ], [ 'required' => ':attribute jest wymagany(e)', - 'operationTarget.required' => 'Cel jest wyma gany' + 'max' => ':attribute musi mieć nie więcej niż :max znaków.' ]); diff --git a/app/Http/Controllers/resetPasswordController.php b/app/Http/Controllers/resetPasswordController.php index c4b8d53..7cbfed4 100644 --- a/app/Http/Controllers/resetPasswordController.php +++ b/app/Http/Controllers/resetPasswordController.php @@ -34,9 +34,7 @@ class resetPasswordController extends Controller if($user){ $password = str_random(10); User::where('email', '=', $request->email) - ->update(['password' => Hash::make($password)]); // this will also update the record - //$user->password = $password; - //$user->save(); + ->update(['password' => Hash::make($password)]); Mail::send('emails.passwordReset', compact('password'), function($message) { $message->to(Input::get('email'))->subject('Zmiana hasła'); }); diff --git a/app/Http/Controllers/trainingsController.php b/app/Http/Controllers/trainingsController.php index 1d90a81..ae8e571 100644 --- a/app/Http/Controllers/trainingsController.php +++ b/app/Http/Controllers/trainingsController.php @@ -38,10 +38,11 @@ class trainingsController extends Controller public function store(){ $this->validate(request(), [ - 'name' => 'required', + 'name' => 'required|max:45', ], [ - 'required' => ':attribute jest wymagany(a).', + 'required' => 'Nazwa jest wymagana.', + 'max' => 'Nazwa musi mieć nie więcej niż :max znaków.', ]); diff --git a/app/Http/Controllers/userProfileController.php b/app/Http/Controllers/userProfileController.php index 60d87dd..084ff8f 100644 --- a/app/Http/Controllers/userProfileController.php +++ b/app/Http/Controllers/userProfileController.php @@ -39,8 +39,8 @@ class userProfileController extends Controller public function update(){ $this->validate(request(), [ - 'name' => 'required|alpha|min:3|max:45', - 'surname' => 'required|alpha|min:3|max:45', + 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', + 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/', 'PESEL' => new Pesel, 'phoneNumber' => 'required|digits:9', 'email' => 'required|email|unique:users,email,'.auth()->user()->id, //wymagaj unikalnego adresu email ale pozwól na zachowanie starego adresu @@ -49,8 +49,7 @@ class userProfileController extends Controller 'required' => ':attribute jest wymagany(e).', 'min' => ':attribute musi mieć przynajmniej :min znaki.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.', - 'alpha' => ':attribute może zawierać tylko litery.', - 'alpha_num' => ':attribute może zawierać tylko litery i cyfry.', + 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy', 'digits' => ':attribute musi składać się z :digits cyfr.', 'unique' =>':attribute jest już zajęty.', 'confirmed' =>':attribute się nie zgadza.', diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 4315724..ac50647 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -163,9 +163,32 @@ return [ 'latitude' => 'szerokość geograficzna', 'amount' => 'ilość', 'decoration' => 'odznaczenie', - 'dateOfAward' => 'data przyznania' + 'dateOfAward' => 'data przyznania', + 'brand' => 'marka', + 'vehicleName' => 'nazwa pojazdu', + 'registrationNumber' => 'numer rejestracyjny', + 'productionYear' => 'rok produkcji', + 'driveType' => 'układ napędowy', + 'chassisType' => 'typ podwozia', + 'bodyProducer' => 'producent nadwozia', + 'crewNumber' => 'ilość osób w załodze', + 'mass' => 'masa', + 'chassisNumber' => 'numer podwozia', + 'engineNumber' => 'numer silnika', + 'fuelType' => 'rodzaj paliwa', + 'chassisPoductionYear' => 'rok produkcji podwozia', + 'fireEnginePumpDescription' => 'opis autopompy', + 'operationDate' =>'data wyjazdu', + 'operationLocation' =>'miejsce akcji', + 'operationTarget' =>'cel wyjazdu', + 'operationDangerType' =>'rodzaj zagrożenia', + 'operationDescription' =>'opis akcji', + 'operationLeader' =>'dowodzący', + 'operationDriver.*' =>'kierowca', + 'operationVehicle.*' =>'pojazd', + 'parameter' =>'parametr charakterystyczny', + ], - ]; diff --git a/resources/views/vehiclesAdd.blade.php b/resources/views/vehiclesAdd.blade.php index e10fa12..c2832fe 100644 --- a/resources/views/vehiclesAdd.blade.php +++ b/resources/views/vehiclesAdd.blade.php @@ -12,8 +12,8 @@ {{ csrf_field() }}
- - + +
diff --git a/resources/views/vehiclesEdit.blade.php b/resources/views/vehiclesEdit.blade.php index eb9082d..fd01112 100644 --- a/resources/views/vehiclesEdit.blade.php +++ b/resources/views/vehiclesEdit.blade.php @@ -15,8 +15,8 @@
- - + +
From 9b3d39ed7fc4bf17b6fb08deb88295a84410d00d Mon Sep 17 00:00:00 2001 From: Marcin Kuskiewicz Date: Fri, 31 Jan 2020 02:36:56 +0000 Subject: [PATCH 05/10] =?UTF-8?q?poprawa=20przyk=C5=82adowych=20jednostek?= =?UTF-8?q?=20i=20u=C5=BCytkownik=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/seeds/DatabaseSeeder.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index e634290..f11cea9 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -2914,18 +2914,18 @@ class DatabaseSeeder extends Seeder DB::table('gminy')->insert([ 'id' => '1326201', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326200', 'name' => 'm. Szczecin' ]); DB::table('gminy')->insert([ 'id' => '1326301', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326300', 'name' => 'm. Świnoujście' ]); //jednostki - DB::table('fireStations')->insert(['id'=>'1100','name'=>'Kębłowo','number'=>'1100','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Kębłowo','zipCode'=>'64223','address'=>'ul. Nowa 8a','latitude'=>'52.0485042','longitude'=>'16.1052983','KRS'=>'0000232331','NIP'=>'9231571641','phoneNumber'=>'501234567','email'=>'straz@keblowo.pl','deleted'=>'0','creatorID'=>'1101','changingID'=>'1101','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('fireStations')->insert(['id'=>'1200','name'=>'Obra','number'=>'1200','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Obra','zipCode'=>'64211','address'=>'ul. Cmentarna 5a','latitude'=>'52.0768963','longitude'=>'16.0427013','KRS'=>'0000096776','NIP'=>'9231571629','phoneNumber'=>'501234567','email'=>'osp.obra@wp.pl','deleted'=>'0','creatorID'=>'1201','changingID'=>'1201','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('fireStations')->insert(['id'=>'1100','name'=>'Kębłowo','number'=>'1100','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Kębłowo','zipCode'=>'64223','address'=>'ul. Nowa 8a','latitude'=>'52.0485042','longitude'=>'16.1052983','KRS'=>'0000232331','NIP'=>'9231571641','phoneNumber'=>'501234567','email'=>'straz@keblowo.pl','deleted'=>'0','creatorID'=>'1101','changingID'=>'1101','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('fireStations')->insert(['id'=>'1200','name'=>'Obra','number'=>'1200','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Obra','zipCode'=>'64211','address'=>'ul. Cmentarna 5a','latitude'=>'52.0768963','longitude'=>'16.0427013','KRS'=>'0000096776','NIP'=>'9231571629','phoneNumber'=>'501234567','email'=>'osp.obra@wp.pl','deleted'=>'0','creatorID'=>'1201','changingID'=>'1201','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); //użytkownicy - DB::table('users')->insert(['id'=>'1101','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Szymon','surname'=>'Tomys','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'szymon.tomys@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1102','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Hanna Nowacka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'hanna.nowacka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1103','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Dominik Klupsz','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'dominik.klupsz@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1104','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Kamila Prządka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'kamila.przadka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1105','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Rafał Smerdka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'rafal.smerdka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1201','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Damian Kotlarski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'damian.kotlarski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1202','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Artur Orwat','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'artur.orwat@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1203','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Rogozinski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.rogozinski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1204','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Lidia Kaczmarek','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'lidia.kaczmarek@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); - DB::table('users')->insert(['id'=>'1205','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Nowak','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.nowak@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now(),]); + DB::table('users')->insert(['id'=>'1101','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Szymon','surname'=>'Tomys','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'szymon.tomys@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1102','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Hanna Nowacka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'hanna.nowacka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1103','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Dominik Klupsz','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'dominik.klupsz@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1104','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Kamila Prządka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'kamila.przadka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1105','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Rafał Smerdka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'rafal.smerdka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1201','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Damian Kotlarski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'damian.kotlarski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1202','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Artur Orwat','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'artur.orwat@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1203','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Rogozinski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.rogozinski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1204','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Lidia Kaczmarek','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'lidia.kaczmarek@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); + DB::table('users')->insert(['id'=>'1205','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Nowak','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.nowak@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]); } } From 91e58e21876971ad77b8bd3ca3254ba6902da516 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 14:16:11 +0100 Subject: [PATCH 06/10] =?UTF-8?q?poprawki=20widok=C3=B3w,=20ujednolicenie?= =?UTF-8?q?=20etykiet=20przycisk=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/equipmentAdd.blade.php | 2 +- resources/views/equipmentEdit.blade.php | 2 +- resources/views/fireFightersAdd.blade.php | 2 +- resources/views/fireFightersEdit.blade.php | 2 +- resources/views/fireStationEdit.blade.php | 2 +- resources/views/inc/addFireStation.blade.php | 2 +- resources/views/login.blade.php | 7 +++++-- resources/views/register.blade.php | 4 ++-- resources/views/trainings.blade.php | 2 +- resources/views/userProfileEdit.blade.php | 2 +- resources/views/vehiclesAdd.blade.php | 2 +- resources/views/vehiclesEdit.blade.php | 2 +- 12 files changed, 17 insertions(+), 14 deletions(-) diff --git a/resources/views/equipmentAdd.blade.php b/resources/views/equipmentAdd.blade.php index 5f3535e..e2cadd3 100644 --- a/resources/views/equipmentAdd.blade.php +++ b/resources/views/equipmentAdd.blade.php @@ -27,7 +27,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/equipmentEdit.blade.php b/resources/views/equipmentEdit.blade.php index d798c61..85bbd25 100644 --- a/resources/views/equipmentEdit.blade.php +++ b/resources/views/equipmentEdit.blade.php @@ -30,7 +30,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/fireFightersAdd.blade.php b/resources/views/fireFightersAdd.blade.php index 1dfb004..08a0185 100644 --- a/resources/views/fireFightersAdd.blade.php +++ b/resources/views/fireFightersAdd.blade.php @@ -59,7 +59,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/fireFightersEdit.blade.php b/resources/views/fireFightersEdit.blade.php index 743fc41..f919d03 100644 --- a/resources/views/fireFightersEdit.blade.php +++ b/resources/views/fireFightersEdit.blade.php @@ -36,7 +36,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/fireStationEdit.blade.php b/resources/views/fireStationEdit.blade.php index 67f48ac..a50b992 100644 --- a/resources/views/fireStationEdit.blade.php +++ b/resources/views/fireStationEdit.blade.php @@ -95,7 +95,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/inc/addFireStation.blade.php b/resources/views/inc/addFireStation.blade.php index 1d04f60..39fc31e 100644 --- a/resources/views/inc/addFireStation.blade.php +++ b/resources/views/inc/addFireStation.blade.php @@ -94,7 +94,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/login.blade.php b/resources/views/login.blade.php index 8e1301d..281d3a4 100644 --- a/resources/views/login.blade.php +++ b/resources/views/login.blade.php @@ -11,6 +11,9 @@ @endif + @if( auth()->check()) + Jesteś już zalogowany. + @else

Zaloguj się

@@ -21,7 +24,7 @@
- +
@@ -32,5 +35,5 @@
Nie pamiętam hasła - + @endif @endsection diff --git a/resources/views/register.blade.php b/resources/views/register.blade.php index b210e45..7b6a5fd 100644 --- a/resources/views/register.blade.php +++ b/resources/views/register.blade.php @@ -3,7 +3,7 @@ @section('center-area') @parent -

Register

+

Rejestracja

{{ csrf_field() }}
@@ -45,7 +45,7 @@
- +
@include('inc.formerrors')
diff --git a/resources/views/trainings.blade.php b/resources/views/trainings.blade.php index d8a3cc9..ae79309 100644 --- a/resources/views/trainings.blade.php +++ b/resources/views/trainings.blade.php @@ -120,7 +120,7 @@ title: "Podaj nową nazwę", width: 'auto', input: 'text', - confirmButtonText: 'Tak', + confirmButtonText: 'Zapisz', cancelButtonText: 'Anuluj', showCancelButton: true, inputValidator: (value) => { diff --git a/resources/views/userProfileEdit.blade.php b/resources/views/userProfileEdit.blade.php index d949ce2..24c8290 100644 --- a/resources/views/userProfileEdit.blade.php +++ b/resources/views/userProfileEdit.blade.php @@ -41,7 +41,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/vehiclesAdd.blade.php b/resources/views/vehiclesAdd.blade.php index c2832fe..b425ced 100644 --- a/resources/views/vehiclesAdd.blade.php +++ b/resources/views/vehiclesAdd.blade.php @@ -120,7 +120,7 @@
- +
@include('inc.formerrors') diff --git a/resources/views/vehiclesEdit.blade.php b/resources/views/vehiclesEdit.blade.php index fd01112..41341ed 100644 --- a/resources/views/vehiclesEdit.blade.php +++ b/resources/views/vehiclesEdit.blade.php @@ -123,7 +123,7 @@
- +
@include('inc.formerrors') From 2c025bb5351a84a297a62a58a1263da968905f54 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 16:45:01 +0100 Subject: [PATCH 07/10] =?UTF-8?q?pojazdy,=20odznaczenia=20-=20=C5=BC=C4=85?= =?UTF-8?q?danie=20potwiedzenie=20usuni=C4=99cia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DecorationsController.php | 4 +- app/Http/Controllers/VehiclesController.php | 4 +- resources/views/decorations.blade.php | 44 +++++++++++++++--- resources/views/equipment.blade.php | 1 + resources/views/vehicles.blade.php | 45 ++++++++++++++++--- routes/web.php | 2 + 6 files changed, 88 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/DecorationsController.php b/app/Http/Controllers/DecorationsController.php index fb4ece1..65dbdf0 100644 --- a/app/Http/Controllers/DecorationsController.php +++ b/app/Http/Controllers/DecorationsController.php @@ -67,6 +67,8 @@ class DecorationsController extends Controller { decorationsFirefighters::where('id',$id)->delete(); - return back(); + return response()->json([ + 'success' => 'Record deleted successfully!' + ]); } } diff --git a/app/Http/Controllers/VehiclesController.php b/app/Http/Controllers/VehiclesController.php index 17deb49..ee9889f 100644 --- a/app/Http/Controllers/VehiclesController.php +++ b/app/Http/Controllers/VehiclesController.php @@ -175,7 +175,9 @@ class VehiclesController extends Controller public function destroy($id) { vehicle::where('id',$id)->delete(); - return redirect()->to('/pojazdy'); + return response()->json([ + 'success' => 'Record deleted successfully!' + ]); } public function activate() diff --git a/resources/views/decorations.blade.php b/resources/views/decorations.blade.php index db432d9..a5a1448 100644 --- a/resources/views/decorations.blade.php +++ b/resources/views/decorations.blade.php @@ -1,5 +1,7 @@ @extends('layout.app') + + @section('left-menu') @parent
    @@ -7,6 +9,7 @@
@stop @section('center-area') + @parent @if( auth()->check()) @@ -28,15 +31,11 @@ Operacja @foreach($awardedDecorations as $awardedDecoration) -
{{ $awardedDecoration->decorationName }} {{ $awardedDecoration->dateOfAward }} - {{ csrf_field() }} - @method('DELETE') - + -
@endforeach @@ -77,3 +76,38 @@ @endif @stop + + \ No newline at end of file diff --git a/resources/views/equipment.blade.php b/resources/views/equipment.blade.php index 2500972..d83af61 100644 --- a/resources/views/equipment.blade.php +++ b/resources/views/equipment.blade.php @@ -1,6 +1,7 @@ @extends('layout.app') + @section('left-menu') @parent
    diff --git a/resources/views/vehicles.blade.php b/resources/views/vehicles.blade.php index 83451ba..aebd58f 100644 --- a/resources/views/vehicles.blade.php +++ b/resources/views/vehicles.blade.php @@ -1,5 +1,7 @@ @extends('layout.app') + + @section('left-menu') @parent
      @@ -8,6 +10,7 @@ @stop @section('center-area') + @parent @if( auth()->check()) @if( auth()->user()->fireStationID == NULL) @@ -39,7 +42,6 @@ @endphp -
      {{ $lp }} {{ $vehicle->name }} {{ $vehicle->brand }} @@ -51,10 +53,7 @@ {{ $vehicle->insuranceExpirationDate }} Edytuj - {{ csrf_field() }} - @method('DELETE') - -
      + @if ($vehicle->status == 1)
      {{ csrf_field() }} @@ -79,3 +78,39 @@ Brak autoryzacji @endif @stop + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 001ca16..efb6fd7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -58,6 +58,7 @@ 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::delete('/strazacy/odznaczenia/delete/{id}', 'DecorationsController@destroy')->name('DecorationsController.destroy'); Route::get('/jednostka', 'fireStationController@create'); Route::post('/jednostka', 'fireStationController@store'); @@ -75,6 +76,7 @@ Route::post('/pojazdy/edit', 'VehiclesController@update'); Route::resource('vehicles', 'VehiclesController'); Route::post('pojazdy/activate', 'VehiclesController@activate'); Route::post('pojazdy/deactivate', 'VehiclesController@deactivate'); +Route::delete('pojazdy/{id}', 'VehiclesController@destroy')->name('VehiclesController.destroy'); Route::get('/sprzet', 'EquipmentController@create'); Route::get('/sprzet/add', 'EquipmentController@addForm'); From 3f9424f6b58d70fa9445f2a61e1879432fb410b1 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 19:07:55 +0100 Subject: [PATCH 08/10] =?UTF-8?q?Zawieszanie=20u=C5=BCytkownika?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/SessionsController.php | 9 ++++++- .../Controllers/fireFightersController.php | 18 +++++++++++++ resources/views/fireFighters.blade.php | 26 ++++++++++++------- resources/views/userProfile.blade.php | 8 +++--- routes/web.php | 2 ++ 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/SessionsController.php b/app/Http/Controllers/SessionsController.php index 5d25142..e04c395 100644 --- a/app/Http/Controllers/SessionsController.php +++ b/app/Http/Controllers/SessionsController.php @@ -15,9 +15,16 @@ class SessionsController extends Controller { if (auth()->attempt(request(['email', 'password'])) == false) { return back()->withErrors([ - 'message' => 'The email or password is incorrect, please try again' + 'message' => 'Podany adres email lub hasło jest nieprawidłowe, proszę spróbować ponownie.' ]); } + elseif(auth()->user()->statusID == 1) + { + auth()->logout(); + return back()->withErrors([ + 'message' => 'Twoje konto zostało zawieszone.' + ]); + } return redirect()->to('/jednostka'); } diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index 716e1e8..c7c1e55 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -138,5 +138,23 @@ class fireFightersController extends Controller return fireFightersController::create(); } + public function activate() + { + $request = request(); + $user = User::find( $request-> userID); + $user-> statusID = 0; + $user->save(); + return redirect()->to('/strazacy'); + } + + public function deactivate() + { + $request = request(); + $user = User::find( $request-> userID); + $user-> statusID = 1; + $user->save(); + return redirect()->to('/strazacy'); + } + } diff --git a/resources/views/fireFighters.blade.php b/resources/views/fireFighters.blade.php index 1de1fba..de7cbc9 100644 --- a/resources/views/fireFighters.blade.php +++ b/resources/views/fireFighters.blade.php @@ -96,17 +96,23 @@ Edytuj Odznaczenia + @if( auth()->user()->id != $user->id) + @if ($user->statusID == 0) + + {{ csrf_field() }} + + + + @elseif ($user->statusID == 1) +
      + {{ csrf_field() }} + + +
      + @endif + @endif - - {{-- --}} - {{--
      --}} - {{-- {{ csrf_field() }}--}} - {{--
      --}} - {{-- --}} - {{-- --}} - {{--
      --}} - {{--
      --}} - {{-- --}} + @php $i++; @endphp diff --git a/resources/views/userProfile.blade.php b/resources/views/userProfile.blade.php index eb05ba4..6e17770 100644 --- a/resources/views/userProfile.blade.php +++ b/resources/views/userProfile.blade.php @@ -41,10 +41,10 @@ Adres e-mail: {{ $userData->email}} - - Numer ewidencyjny: - {{ $userData->number}} - + {{-- --}} + {{-- Numer ewidencyjny: --}} + {{-- {{ $userData->number}} --}} + {{-- --}} Stopień: {{ $userData->rank}} diff --git a/routes/web.php b/routes/web.php index efb6fd7..64026e8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -54,6 +54,8 @@ Route::get('/strazacy/add', 'fireFightersController@addForm'); Route::post('/strazacy', 'fireFightersController@store'); Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm'); Route::post('/strazacy/edit', 'fireFightersController@update'); +Route::post('strazacy/activate', 'fireFightersController@activate'); +Route::post('strazacy/deactivate', 'fireFightersController@deactivate'); Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create'); Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store'); From 079343fe1ddd041947c8c19dfe6b6edc0d41566d Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Fri, 31 Jan 2020 23:38:24 +0100 Subject: [PATCH 09/10] =?UTF-8?q?Dodanie=20poziomow=20dostepu.=20Poprawki?= =?UTF-8?q?=20dostepu=20i=20przekierowan=20w:=20Jednostka,=20Stra=C5=BCacy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/fireFightersController.php | 24 ++++++++++--------- .../Controllers/fireStationController.php | 4 ++-- app/User.php | 16 +++++++++++++ resources/views/fireFighters.blade.php | 10 ++++++++ resources/views/unit.blade.php | 24 ++++++------------- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index c7c1e55..c602836 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -15,7 +15,8 @@ class fireFightersController extends Controller { public function create(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() >= 20) //prezes,naczelnik,sekretarz + { // $users = user::where("fireStationID", auth()->user()->fireStationID)->get(); // $users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)->get(); $users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID) @@ -24,38 +25,39 @@ class fireFightersController extends Controller ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction') ->paginate(10); return view("fireFighters", ["users" => $users]); - } else{ - return view('fireFighters'); + } + else + { + return redirect()->to('/userprofile'); } } public function addForm(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $fireStation = fireStation::find(auth()->user()->fireStationID); - if($fireStation-> creatorID == auth()->user()->id){ - //return view('fireFightersAdd'); + 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(); - } else return view("unit"); + } else return fireFightersController::create(); // ??? + } else return redirect()->to('/strazacy'); } public function editForm($id){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + 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($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('unit'); + return redirect()->to('/strazacy'); } } diff --git a/app/Http/Controllers/fireStationController.php b/app/Http/Controllers/fireStationController.php index 4942067..5bd4e51 100644 --- a/app/Http/Controllers/fireStationController.php +++ b/app/Http/Controllers/fireStationController.php @@ -26,7 +26,7 @@ class fireStationController extends Controller public function editForm() { - if(auth()->user() != null && auth()->user()->fireStationID != null ) + if(auth()->user() != null && auth()->user()->accessLevel() == 50) //prezes/naczelnik { $id = auth()->user()->fireStationID; $fireStation = DB::table('fireStations')->where("id", $id)->first(); @@ -34,7 +34,7 @@ class fireStationController extends Controller return view('fireStationEdit', ["fireStation" => $fireStation], compact('voivodeships')); } else - return "Brak dostępu"; + return redirect()->to('/jednostka'); } public function store() diff --git a/app/User.php b/app/User.php index 9bf1995..2b62596 100644 --- a/app/User.php +++ b/app/User.php @@ -43,4 +43,20 @@ class User extends Authenticatable { $this->attributes['password'] = bcrypt($password); } + + public function accessLevel() + { + if (auth()->user() != null && auth()->user()->fireStationID != null) + if ($this->functionID == 1 or $this->functionID == 5) //prezes lub naczelnik + return 50; + elseif ($this->functionID == 3) //skarbnik + return 30; + elseif($this->functionID == 4) //sekretarz + return 20; + else + return 0; //brak specjalnych uprawnień + else + return -1; //jednostka nie istnieje + + } } diff --git a/resources/views/fireFighters.blade.php b/resources/views/fireFighters.blade.php index de7cbc9..8af8a56 100644 --- a/resources/views/fireFighters.blade.php +++ b/resources/views/fireFighters.blade.php @@ -2,10 +2,16 @@ @section('left-menu') @parent + @if( auth()->check() ) + @if( auth()->user()->fireStationID != NULL) + @if(auth()->user()->accessLevel() == 50) + @endif + @endif + @endif @stop @@ -75,7 +81,9 @@ Funkcja Stopień Status + @if(auth()->user()->accessLevel() == 50) Operacja + @endif @@ -93,6 +101,7 @@ {{$user->unitFunction}} {{$user->rank}} @if( $user->statusID == 0) Czynny @else Wyłączony @endif + @if(auth()->user()->accessLevel() == 50) Edytuj Odznaczenia @@ -112,6 +121,7 @@ @endif @endif + @endif @php $i++; diff --git a/resources/views/unit.blade.php b/resources/views/unit.blade.php index 6b17eef..076f106 100644 --- a/resources/views/unit.blade.php +++ b/resources/views/unit.blade.php @@ -2,11 +2,15 @@ @section('left-menu') @parent + @if( auth()->check() ) + @if( auth()->user()->fireStationID != NULL) + @if(auth()->user()->accessLevel() == 50) + @endif + @endif + @endif @stop @section('center-area') @@ -67,21 +71,7 @@
      @endif @else -
      -

      Nazwa: Ochotnicza Straż Pożarna w Łuszczewie

      -

      Województwo: Wielkopolskie

      -

      Powiat: Koniński

      -

      Gmina i numer ewidencyjny: Skulsk 3010092

      -

      Kod pocztowy, Miejscowość: 62-560 Skulsk

      -

      Ulica i numer: Łuszczewo 81

      -

      Szerokość i długość geograficzna: 523113.08 | 182155.88

      -

      KRS: 0000003716

      -

      NIP: 665 524 497 69

      -

      Telefon: ??? - ??? - ???

      -

      E-mail: twojanazwa@domena.com

      -
      -

      Liczba członków: 40

      -
      + Witamy na stronie eOSP! Zaloguj się lub Zarejestruj nową jednostkę.
      @endif
      From 0713cd5a686fad590e275461f33244c3a1f67de7 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Sat, 1 Feb 2020 01:01:26 +0100 Subject: [PATCH 10/10] =?UTF-8?q?doko=C5=84czenie=20poziom=C3=B3w=20dost?= =?UTF-8?q?=C4=99pu=20i=20przekierowa=C5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/DecorationsController.php | 4 ++-- app/Http/Controllers/EquipmentController.php | 8 ++++---- app/Http/Controllers/VehiclesController.php | 8 ++++---- app/Http/Controllers/operationsController.php | 8 ++++---- app/Http/Controllers/trainingsController.php | 8 ++++---- resources/views/equipment.blade.php | 10 ++++++++++ resources/views/operation.blade.php | 13 ++++++++++++- resources/views/vehicles.blade.php | 10 ++++++++++ 8 files changed, 50 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/DecorationsController.php b/app/Http/Controllers/DecorationsController.php index 65dbdf0..6e79290 100644 --- a/app/Http/Controllers/DecorationsController.php +++ b/app/Http/Controllers/DecorationsController.php @@ -21,7 +21,7 @@ function formatDate($date) class DecorationsController extends Controller { public function create($id){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id) ->whereNull('decorationsFirefighters.deleted_at') ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') @@ -39,7 +39,7 @@ class DecorationsController extends Controller ->with(compact('decoration')); } else{ - return "Brak dostepu"; + return redirect()->to('/strazacy'); } } diff --git a/app/Http/Controllers/EquipmentController.php b/app/Http/Controllers/EquipmentController.php index 87563f0..69d5cb1 100644 --- a/app/Http/Controllers/EquipmentController.php +++ b/app/Http/Controllers/EquipmentController.php @@ -21,15 +21,15 @@ class EquipmentController extends Controller } public function addForm(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik return view('equipmentAdd'); - } else return view("login"); + } else return redirect()->to('/sprzet'); } public function editForm($id) { - if(auth()->user() != null && auth()->user()->fireStationID != null ) + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik { $equipment = DB::table('equipment')->where("id", $id)->first(); @@ -37,7 +37,7 @@ class EquipmentController extends Controller return view('equipmentEdit', ["equipment" => $equipment]); } else - return view("login"); + return redirect()->to('/sprzet'); } diff --git a/app/Http/Controllers/VehiclesController.php b/app/Http/Controllers/VehiclesController.php index ee9889f..fe6f52d 100644 --- a/app/Http/Controllers/VehiclesController.php +++ b/app/Http/Controllers/VehiclesController.php @@ -31,21 +31,21 @@ class VehiclesController extends Controller } public function addForm(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik return view('vehiclesAdd'); - } else return view("login"); + } else return redirect()->to('/pojazdy'); } public function editForm($id) { - if(auth()->user() != null && auth()->user()->fireStationID != null ) + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik { $vehicle = DB::table('vehicles')->where("id", $id)->first(); return view('vehiclesEdit', ["vehicle" => $vehicle]); } else - return "Brak dostepu"; + redirect()->to('/pojazdy'); } public function store(){ diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php index 0401e8c..1b05dab 100644 --- a/app/Http/Controllers/operationsController.php +++ b/app/Http/Controllers/operationsController.php @@ -58,7 +58,7 @@ class operationsController extends Controller } public function addForm(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $vehicles = DB::table('vehicles')->where([ ["fireStationID", '=', auth()->user()->fireStationID], @@ -67,13 +67,13 @@ class operationsController extends Controller ]) ->get(); return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]); - } else return view("unit"); + } else return redirect()->to('/wyjazdy'); } public function editForm($id){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik // $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $vehicles = DB::table('vehicles')->where([ @@ -118,7 +118,7 @@ class operationsController extends Controller // return "Brak dostepu"; // } } else{ - return view('unit'); + return redirect()->to('/wyjazdy'); } } diff --git a/app/Http/Controllers/trainingsController.php b/app/Http/Controllers/trainingsController.php index ae8e571..5f7ccbd 100644 --- a/app/Http/Controllers/trainingsController.php +++ b/app/Http/Controllers/trainingsController.php @@ -14,7 +14,7 @@ class trainingsController extends Controller { public function create(){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID) ->whereNull('deleted_at') ->paginate(10); @@ -32,7 +32,7 @@ class trainingsController extends Controller } return View::make("trainings")->with(compact( "trainings", "fireFighters")); } else{ - return view('trainings'); + return redirect()->to('/strazacy'); } } @@ -61,7 +61,7 @@ class trainingsController extends Controller public function addTrainingsFireFighters($id){ - if(auth()->user() != null && auth()->user()->fireStationID != null ){ + if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID ) ->leftJoin('trainingsFirefighters', function ($join) use($id){ $join->on('users.id', '=', 'trainingsFirefighters.firefighterID'); @@ -74,7 +74,7 @@ class trainingsController extends Controller ->whereNull('deleted_at')->first(); return View::make("trainingsAddFireFighters")->with(compact( "training", "fireFighters")); } else{ - return view('trainings'); + return redirect()->to('/strazacy'); } } diff --git a/resources/views/equipment.blade.php b/resources/views/equipment.blade.php index d83af61..0f18619 100644 --- a/resources/views/equipment.blade.php +++ b/resources/views/equipment.blade.php @@ -4,9 +4,15 @@ @section('left-menu') @parent + @if( auth()->check() ) + @if( auth()->user()->fireStationID != NULL) + @if(auth()->user()->accessLevel() == 50) + @endif + @endif + @endif @stop @section('center-area') @@ -25,7 +31,9 @@ Nazwa Ilość Param. charakterystyczny + @if(auth()->user()->accessLevel() == 50) Operacja + @endif @@ -38,10 +46,12 @@ {{ $item->name }} {{ $item->amount }} {{ $item->parameter }} + @if(auth()->user()->accessLevel() == 50) Edytuj + @endif @php diff --git a/resources/views/operation.blade.php b/resources/views/operation.blade.php index 1795bcc..5460103 100644 --- a/resources/views/operation.blade.php +++ b/resources/views/operation.blade.php @@ -3,9 +3,16 @@ @section('left-menu') - @parent
        + @parent + @if( auth()->check() ) + @if( auth()->user()->fireStationID != NULL) + @if(auth()->user()->accessLevel() == 50) + + @endif + @endif + @endif @stop @section('center-area') @@ -24,7 +31,9 @@ Cel Rodzaj zagrożenia Dowódca + @if(auth()->user()->accessLevel() == 50) Operacja + @endif Szczegóły @@ -41,10 +50,12 @@ {{ $operation->target }} {{ $operation->dangerType }} {{$operation->name}} {{$operation->surname}} + @if(auth()->user()->accessLevel() == 50) Edytuj + @endif diff --git a/resources/views/vehicles.blade.php b/resources/views/vehicles.blade.php index aebd58f..bf0d6b5 100644 --- a/resources/views/vehicles.blade.php +++ b/resources/views/vehicles.blade.php @@ -4,9 +4,15 @@ @section('left-menu') @parent + @if( auth()->check() ) + @if( auth()->user()->fireStationID != NULL) + @if(auth()->user()->accessLevel() == 50) + @endif + @endif + @endif @stop @section('center-area') @@ -29,7 +35,9 @@ Rodzaj napędu Przegląd OC + @if(auth()->user()->accessLevel() == 50) Operacja + @endif @@ -51,6 +59,7 @@ {{ $vehicle->driveType }} {{ $vehicle->examExpirationDate }} {{ $vehicle->insuranceExpirationDate }} + @if(auth()->user()->accessLevel() == 50) Edytuj @@ -69,6 +78,7 @@ @endif + @endif @endforeach