1
0
forked from s421507/eOSP2

Poprawienie widokow i kilku bugow - pojazdy

This commit is contained in:
czup 2020-01-30 17:34:16 +01:00
parent c69bdaf053
commit b9298ee626
8 changed files with 189 additions and 81 deletions

View File

@ -22,7 +22,7 @@ class VehiclesController extends Controller
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
$vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID)
->whereNull('deleted_at')->get(); ->whereNull('deleted_at')->paginate(10);
return view("vehicles", ["vehicles" => $vehicles]); return view("vehicles", ["vehicles" => $vehicles]);
} else{ } else{
return view('vehicles'); return view('vehicles');
@ -41,11 +41,11 @@ class VehiclesController extends Controller
if(auth()->user() != null && auth()->user()->fireStationID != null ) 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]); return view('vehiclesEdit', ["vehicle" => $vehicle]);
} }
else else
return "Brak dostepu"; return "Brak dostepu";
} }
public function store(){ public function store(){

View File

@ -36,7 +36,9 @@ class operationsController extends Controller
->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport') ->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport')
->get(); ->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){ ->leftJoin('operationsTrucks', function ($join) use($id){
$join->on('vehicles.id', '=', 'operationsTrucks.truckID'); $join->on('vehicles.id', '=', 'operationsTrucks.truckID');
$join->where('operationsTrucks.operationID', '=', $id); $join->where('operationsTrucks.operationID', '=', $id);
@ -58,7 +60,11 @@ class operationsController extends Controller
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $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(); ->get();
return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]); return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]);
} else return view("unit"); } else return view("unit");
@ -70,7 +76,10 @@ class operationsController extends Controller
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
// $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); // $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(); ->get();
$operation = DB::table('operations')->where('operations.id', '=', $id)->first(); $operation = DB::table('operations')->where('operations.id', '=', $id)->first();
$operationMembers = DB::table('operationsMembers')->where('operationID', '=', $id)->get(); $operationMembers = DB::table('operationsMembers')->where('operationID', '=', $id)->get();

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteToVehiclesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vehicles', function (Blueprint $table) {
//
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vehicles', function (Blueprint $table) {
//
});
}
}

View File

@ -17,19 +17,52 @@
@include('inc.addFireStation') @include('inc.addFireStation')
@else @else
<div> <div>
<p><b>Nazwa:</b> {{ $fireStation-> name }}</p> <table class="table">
<p><b>Województwo:</b> {{ $fireStation-> voivodeship }}</p> <tr>
<p><b>Powiat:</b> {{ $fireStation-> county }}</p> <th>Nazwa</th>
<p><b>Gmina i numer ewidencyjny:</b> {{ $fireStation-> community }} {{ $fireStation-> number }}</p> <td>{{ $fireStation-> name }}</td>
<p><b>Kod pocztowy, Miejscowość:</b> {{ $fireStation-> zipCode }} {{ $fireStation-> name }}</p> </tr>
<p><b>Ulica i numer:</b> {{ $fireStation-> address }}</p> <tr>
<p><b>Szerokość i długość geograficzna:</b> {{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}</p> <th>Województwo</th>
<p><b>KRS:</b> {{ $fireStation-> KRS }}</p> <td>{{ $fireStation-> voivodeship }}</td>
<p><b>NIP:</b> {{ $fireStation-> NIP }} </p> </tr>
<p><b>Telefon:</b> {{ $fireStation-> phoneNumber }}</p> <tr>
<p><b>E-mail:</b> {{ $fireStation-> email }}</p> <th>Powiat</th>
<hr> <td>{{ $fireStation-> county }}</td>
<p><b>Liczba członków:</b> {{$users}}</p> </tr>
<tr>
<th>Gmina i numer ewidencyjny</th>
<td>{{ $fireStation-> community }} {{ $fireStation-> number }}</td>
</tr>
<tr>
<th>Kod pocztowy, Miejscowość</th>
<td>{{ $fireStation-> zipCode }} {{ $fireStation-> name }}</td>
</tr>
<tr>
<th>Ulica i numer</th>
<td>{{ $fireStation-> address }}</td>
</tr>
<tr>
<th>Szerokość i długość geograficzna</th>
<td>{{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}</td>
</tr>
<tr>
<th>KRS</th>
<td>{{ $fireStation-> KRS }}</td>
</tr>
<tr>
<th>NIP</th>
<td>{{ $fireStation-> NIP }}</td>
</tr>
<tr>
<th>Telefon</th>
<td>{{ $fireStation-> phoneNumber }}</td>
</tr>
<tr>
<th>E-mail</th>
<td>{{ $fireStation-> email }}</td>
</tr>
</table>
</div> </div>
<div> <div>
@endif @endif
@ -53,3 +86,17 @@
@endif @endif
</div> </div>
@stop @stop
{{-- <p><b>Nazwa:</b> {{ $fireStation-> name }}</p>--}}
{{-- <p><b>Województwo:</b> {{ $fireStation-> voivodeship }}</p>--}}
{{-- <p><b>Powiat:</b> {{ $fireStation-> county }}</p>--}}
{{-- <p><b>Gmina i numer ewidencyjny:</b> {{ $fireStation-> community }} {{ $fireStation-> number }}</p>--}}
{{-- <p><b>Kod pocztowy, Miejscowość:</b> {{ $fireStation-> zipCode }} {{ $fireStation-> name }}</p>--}}
{{-- <p><b>Ulica i numer:</b> {{ $fireStation-> address }}</p>--}}
{{-- <p><b>Szerokość i długość geograficzna:</b> {{ $fireStation-> latitude }} | {{ $fireStation-> longitude }}</p>--}}
{{-- <p><b>KRS:</b> {{ $fireStation-> KRS }}</p>--}}
{{-- <p><b>NIP:</b> {{ $fireStation-> NIP }} </p>--}}
{{-- <p><b>Telefon:</b> {{ $fireStation-> phoneNumber }}</p>--}}
{{-- <p><b>E-mail:</b> {{ $fireStation-> email }}</p>--}}
{{-- <hr>--}}
{{-- <p><b>Liczba członków:</b> {{$users}}</p>--}}

View File

@ -18,16 +18,24 @@
@else @else
@if(count($userDecorations) > 0) @if(count($userDecorations) > 0)
<p align='center'> <p align='center'>
<table class='firefighterViewTable'> <table class='table'>
<tr class='table-header'> <thead>
<td>Odznaczenie</td> <tr>
<td>Data przyznania</td> <th colspan="2"><center>Odznaczenia</center></th>
@foreach($userDecorations as $userDecoration)
<tr>
<td id="decorationName{{ $userDecoration->id }}">{{ $userDecoration->decorationName }}</td>
<td id="amount{{ $userDecoration->id }}">{{ $userDecoration->dateOfAward }}</td>
</tr> </tr>
@endforeach </thead>
<tbody>
<tr>
<th>Odznaczenie</th>
<th>Data przyznania</th>
</tr>
@foreach($userDecorations as $userDecoration)
<tr>
<td id="decorationName{{ $userDecoration->id }}">{{ $userDecoration->decorationName }}</td>
<td id="amount{{ $userDecoration->id }}">{{ $userDecoration->dateOfAward }}</td>
</tr>
@endforeach
</tbody>
</table> </table>
</p> </p>
@else @else

View File

@ -24,33 +24,33 @@
@endif @endif
<p align='center'> <p align='center'>
<table class='firefighterViewTable'> <table class='table'>
<tr> <tr>
<td>Imię i nazwisko:</td> <th>Imię i nazwisko:</th>
<td>{{ $userData->name }} {{ $userData->surname }}</td> <td>{{ $userData->name }} {{ $userData->surname }}</td>
</tr> </tr>
<tr> <tr>
<td>PESEL:</td> <th>PESEL:</th>
<td>{{ $userData->PESEL}}</td> <td>{{ $userData->PESEL}}</td>
</tr> </tr>
<tr> <tr>
<td>Nr telefonu:</td> <th>Nr telefonu:</th>
<td>{{ $userData->phoneNumber}}</td> <td>{{ $userData->phoneNumber}}</td>
</tr> </tr>
<tr> <tr>
<td>Adres e-mail:</td> <th>Adres e-mail:</th>
<td>{{ $userData->email}}</td> <td>{{ $userData->email}}</td>
</tr> </tr>
<tr> <tr>
<td>Numer ewidencyjny:</td> <th>Numer ewidencyjny:</th>
<td>{{ $userData->number}}</td> <td>{{ $userData->number}}</td>
</tr> </tr>
<tr> <tr>
<td>Stopień:</td> <th>Stopień:</th>
<td>{{ $userData->rank}}</td> <td>{{ $userData->rank}}</td>
</tr> </tr>
<tr> <tr>
<td>Funkcja:</td> <th>Funkcja:</th>
<td>{{ $userData->unitFunction}}</td> <td>{{ $userData->unitFunction}}</td>
</tr> </tr>
</table> </table>

View File

@ -16,18 +16,22 @@
@if( auth()->check()) @if( auth()->check())
<p align='center'> <p align='center'>
<table class='firefighterViewTable'> <table class='table'>
<tr class='table-header'> <thead>
<td>Szkolenie</td> <th>Szkolenie</th>
<td>Data ukończenia</td> <th>Data ukończenia</th>
<td>Data ważności</td> <th>Data ważności</th>
@foreach($userTrainings as $userTraining) </thead>
<tr>
<td id="trainingName{{ $userTraining->id }}">{{ $userTraining->trainingName }}</td> <tbody>
<td id="dateOfComplete{{ $userTraining->id }}">{{ $userTraining->dateOfComplete }}</td> @foreach($userTrainings as $userTraining)
<td id="dateOfExpiry{{ $userTraining->id }}">{{ $userTraining->dateOfExpiry }}</td> <tr>
</tr> <td id="trainingName{{ $userTraining->id }}">{{ $userTraining->trainingName }}</td>
@endforeach <td id="dateOfComplete{{ $userTraining->id }}">{{ $userTraining->dateOfComplete }}</td>
<td id="dateOfExpiry{{ $userTraining->id }}">{{ $userTraining->dateOfExpiry }}</td>
</tr>
@endforeach
</tbody>
</table> </table>
</p> </p>
@else @else

View File

@ -14,24 +14,30 @@
Jednostka nie istnieje Jednostka nie istnieje
@else @else
<table class='firefighterViewTable'> <table class='table'>
<tr class='table-header'> <thead>
<td>LP</td> <tr>
<td>Typ Pojazdu</td> <th>#</th>
<td>Marka</td> <th>Typ Pojazdu</th>
<td>Nr rej.</td> <th>Marka</th>
<td>Kryptonim</td> <th>Nr rej.</th>
<td>Rok Produkcji</td> <th>Kryptonim</th>
<td>Rodzaj napędu</td> <th>Rok Produkcji</th>
<td>Przegląd</td> <th>Rodzaj napędu</th>
<td>OC</td> <th>Przegląd</th>
<th>OC</th>
<th>Operacja</th>
</tr>
</thead>
@php @php
$lp=0 // liczba porządkowa $lp=0 // liczba porządkowa
@endphp @endphp
@foreach($vehicles as $vehicle) @foreach($vehicles as $vehicle)
@php @php
$lp = $lp + 1 $lp = $lp + 1
@endphp @endphp
<tr> <tr>
<form action="{{ route('vehicles.destroy', $vehicle->id)}}" method="post"> <form action="{{ route('vehicles.destroy', $vehicle->id)}}" method="post">
<td>{{ $lp }}</td> <td>{{ $lp }}</td>
@ -43,30 +49,31 @@
<td id="driveType{{ $vehicle->id }}">{{ $vehicle->driveType }}</td> <td id="driveType{{ $vehicle->id }}">{{ $vehicle->driveType }}</td>
<td id="examExpirationDate{{ $vehicle->id }}">{{ $vehicle->examExpirationDate }}</td> <td id="examExpirationDate{{ $vehicle->id }}">{{ $vehicle->examExpirationDate }}</td>
<td id="insuranceExpirationDate{{ $vehicle->id }}">{{ $vehicle->insuranceExpirationDate }}</td> <td id="insuranceExpirationDate{{ $vehicle->id }}">{{ $vehicle->insuranceExpirationDate }}</td>
<td><a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td> <td style="display:inline;">
{{ csrf_field() }} <a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
@method('DELETE') {{ csrf_field() }}
<td><button class="btn btn-danger" type="submit">Usuń</button></td> @method('DELETE')
</form> <button class="btn btn-danger" type="submit">Usuń</button>
@if ($vehicle->status == 1)
<form method="POST" action="/pojazdy/deactivate">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}">
<td><button style="cursor:pointer" type="submit" class="btn btn-primary">Zawieś</button></td>
</form>
@elseif ($vehicle->status == 0)
<form method="POST" action="/pojazdy/activate">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}">
<td><button style="cursor:pointer" type="submit" class="btn btn-primary">Przywróć do służby</button></td>
</form> </form>
@if ($vehicle->status == 1)
<form method="POST" action="/pojazdy/deactivate" style="display:inline;">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zawieś</button>
</form>
@elseif ($vehicle->status == 0)
<form method="POST" action="/pojazdy/activate" style="display:inline;" >
{{ csrf_field() }}
<input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Przywróć do służby</button>
</form>
@endif @endif
</td>
</tr> </tr>
@endforeach @endforeach
</table> </table>
{{ $vehicles->links() }}
@endif @endif
@else @else
Brak autoryzacji Brak autoryzacji