From b9298ee626b5ebb1d3c4a0aa016140abe4e818cc Mon Sep 17 00:00:00 2001 From: czup Date: Thu, 30 Jan 2020 17:34:16 +0100 Subject: [PATCH] Poprawienie widokow i kilku bugow - pojazdy --- app/Http/Controllers/VehiclesController.php | 8 +- app/Http/Controllers/operationsController.php | 15 +++- ...65307_add_softDelete_to_vehicles_table.php | 33 +++++++++ resources/views/unit.blade.php | 73 +++++++++++++++---- resources/views/userDecorations.blade.php | 26 ++++--- resources/views/userProfile.blade.php | 16 ++-- resources/views/userTrainings.blade.php | 28 ++++--- resources/views/vehicles.blade.php | 71 ++++++++++-------- 8 files changed, 189 insertions(+), 81 deletions(-) create mode 100644 database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php diff --git a/app/Http/Controllers/VehiclesController.php b/app/Http/Controllers/VehiclesController.php index ae4099b..3ed083d 100644 --- a/app/Http/Controllers/VehiclesController.php +++ b/app/Http/Controllers/VehiclesController.php @@ -22,7 +22,7 @@ class VehiclesController extends Controller if(auth()->user() != null && auth()->user()->fireStationID != null ){ $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) - ->whereNull('deleted_at')->get(); + ->whereNull('deleted_at')->paginate(10); return view("vehicles", ["vehicles" => $vehicles]); } else{ return view('vehicles'); @@ -41,11 +41,11 @@ class VehiclesController extends Controller if(auth()->user() != null && auth()->user()->fireStationID != null ) { - $vehicle = DB::table('vehicles')->where("id", $id)->first(); + $vehicle = DB::table('vehicles')->where("id", $id)->first(); return view('vehiclesEdit', ["vehicle" => $vehicle]); - } + } else - return "Brak dostepu"; + return "Brak dostepu"; } public function store(){ diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php index f0c5e92..59ba67b 100644 --- a/app/Http/Controllers/operationsController.php +++ b/app/Http/Controllers/operationsController.php @@ -36,7 +36,9 @@ class operationsController extends Controller ->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport') ->get(); - $trucks[$id] = DB::table('vehicles')->where("vehicles.fireStationID", "=", auth()->user()->fireStationID ) + $trucks[$id] = DB::table('vehicles')->where([ + ["vehicles.fireStationID", "=", auth()->user()->fireStationID ], + ]) ->leftJoin('operationsTrucks', function ($join) use($id){ $join->on('vehicles.id', '=', 'operationsTrucks.truckID'); $join->where('operationsTrucks.operationID', '=', $id); @@ -58,7 +60,11 @@ class operationsController extends Controller public function addForm(){ if(auth()->user() != null && auth()->user()->fireStationID != null ){ $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); - $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) + $vehicles = DB::table('vehicles')->where([ + ["fireStationID", '=', auth()->user()->fireStationID], + ["vehicles.status", "=", 1], + ["vehicles.deleted_at", "=", null], + ]) ->get(); return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]); } else return view("unit"); @@ -70,7 +76,10 @@ class operationsController extends Controller if(auth()->user() != null && auth()->user()->fireStationID != null ){ // $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); - $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) + $vehicles = DB::table('vehicles')->where([ + ["fireStationID", '=', auth()->user()->fireStationID], + ["vehicles.deleted_at", "=", null] + ]) ->get(); $operation = DB::table('operations')->where('operations.id', '=', $id)->first(); $operationMembers = DB::table('operationsMembers')->where('operationID', '=', $id)->get(); 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 new file mode 100644 index 0000000..63837d4 --- /dev/null +++ b/database/migrations/2019_12_28_165307_add_softDelete_to_vehicles_table.php @@ -0,0 +1,33 @@ +softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('vehicles', function (Blueprint $table) { + // + }); + } +} diff --git a/resources/views/unit.blade.php b/resources/views/unit.blade.php index ff7aab7..6b17eef 100644 --- a/resources/views/unit.blade.php +++ b/resources/views/unit.blade.php @@ -17,19 +17,52 @@ @include('inc.addFireStation') @else
-

Nazwa: {{ $fireStation-> name }}

-

Województwo: {{ $fireStation-> voivodeship }}

-

Powiat: {{ $fireStation-> county }}

-

Gmina i numer ewidencyjny: {{ $fireStation-> community }} {{ $fireStation-> number }}

-

Kod pocztowy, Miejscowość: {{ $fireStation-> zipCode }} {{ $fireStation-> name }}

-

Ulica i numer: {{ $fireStation-> address }}

-

Szerokość i długość geograficzna: {{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}

-

KRS: {{ $fireStation-> KRS }}

-

NIP: {{ $fireStation-> NIP }}

-

Telefon: {{ $fireStation-> phoneNumber }}

-

E-mail: {{ $fireStation-> email }}

-
-

Liczba członków: {{$users}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nazwa{{ $fireStation-> name }}
Województwo{{ $fireStation-> voivodeship }}
Powiat{{ $fireStation-> county }}
Gmina i numer ewidencyjny{{ $fireStation-> community }} {{ $fireStation-> number }}
Kod pocztowy, Miejscowość{{ $fireStation-> zipCode }} {{ $fireStation-> name }}
Ulica i numer{{ $fireStation-> address }}
Szerokość i długość geograficzna{{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}
KRS{{ $fireStation-> KRS }}
NIP{{ $fireStation-> NIP }}
Telefon{{ $fireStation-> phoneNumber }}
E-mail{{ $fireStation-> email }}
@endif @@ -53,3 +86,17 @@ @endif
@stop + +{{--

Nazwa: {{ $fireStation-> name }}

--}} +{{--

Województwo: {{ $fireStation-> voivodeship }}

--}} +{{--

Powiat: {{ $fireStation-> county }}

--}} +{{--

Gmina i numer ewidencyjny: {{ $fireStation-> community }} {{ $fireStation-> number }}

--}} +{{--

Kod pocztowy, Miejscowość: {{ $fireStation-> zipCode }} {{ $fireStation-> name }}

--}} +{{--

Ulica i numer: {{ $fireStation-> address }}

--}} +{{--

Szerokość i długość geograficzna: {{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}

--}} +{{--

KRS: {{ $fireStation-> KRS }}

--}} +{{--

NIP: {{ $fireStation-> NIP }}

--}} +{{--

Telefon: {{ $fireStation-> phoneNumber }}

--}} +{{--

E-mail: {{ $fireStation-> email }}

--}} +{{--
--}} +{{--

Liczba członków: {{$users}}

--}} diff --git a/resources/views/userDecorations.blade.php b/resources/views/userDecorations.blade.php index d6f1b56..827f66f 100644 --- a/resources/views/userDecorations.blade.php +++ b/resources/views/userDecorations.blade.php @@ -18,16 +18,24 @@ @else @if(count($userDecorations) > 0)

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

@else diff --git a/resources/views/userProfile.blade.php b/resources/views/userProfile.blade.php index 76eef7e..eb05ba4 100644 --- a/resources/views/userProfile.blade.php +++ b/resources/views/userProfile.blade.php @@ -24,33 +24,33 @@ @endif

- +
- + - + - + - + - + - + - +
Imię i nazwisko:Imię i nazwisko: {{ $userData->name }} {{ $userData->surname }}
PESEL:PESEL: {{ $userData->PESEL}}
Nr telefonu:Nr telefonu: {{ $userData->phoneNumber}}
Adres e-mail:Adres e-mail: {{ $userData->email}}
Numer ewidencyjny:Numer ewidencyjny: {{ $userData->number}}
Stopień:Stopień: {{ $userData->rank}}
Funkcja:Funkcja: {{ $userData->unitFunction}}
diff --git a/resources/views/userTrainings.blade.php b/resources/views/userTrainings.blade.php index b8ddfa7..a1cb80d 100644 --- a/resources/views/userTrainings.blade.php +++ b/resources/views/userTrainings.blade.php @@ -16,18 +16,22 @@ @if( auth()->check())

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

@else diff --git a/resources/views/vehicles.blade.php b/resources/views/vehicles.blade.php index 9e95242..83451ba 100644 --- a/resources/views/vehicles.blade.php +++ b/resources/views/vehicles.blade.php @@ -14,24 +14,30 @@ Jednostka nie istnieje @else - - - - - - - - - - - +
LPTyp PojazduMarkaNr rej.KryptonimRok ProdukcjiRodzaj napęduPrzeglądOC
+ + + + + + + + + + + + + + + @php $lp=0 // liczba porządkowa - @endphp + @endphp @foreach($vehicles as $vehicle) @php $lp = $lp + 1 - @endphp + @endphp + @@ -43,30 +49,31 @@ - - {{ csrf_field() }} - @method('DELETE') - - - @if ($vehicle->status == 1) - - {{ csrf_field() }} - - - - @elseif ($vehicle->status == 0) - - {{ csrf_field() }} - - + @endforeach
#Typ PojazduMarkaNr rej.KryptonimRok ProdukcjiRodzaj napęduPrzeglądOCOperacja
{{ $lp }}{{ $vehicle->driveType }} {{ $vehicle->examExpirationDate }} {{ $vehicle->insuranceExpirationDate }}
+ Edytuj + {{ csrf_field() }} + @method('DELETE') + + @if ($vehicle->status == 1) +
+ {{ csrf_field() }} + + +
+ @elseif ($vehicle->status == 0) +
+ {{ csrf_field() }} + + +
- @endif - + @endif +
- + {{ $vehicles->links() }} @endif @else Brak autoryzacji