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 ){
$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(){

View File

@ -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();

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')
@else
<div>
<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>
<table class="table">
<tr>
<th>Nazwa</th>
<td>{{ $fireStation-> name }}</td>
</tr>
<tr>
<th>Województwo</th>
<td>{{ $fireStation-> voivodeship }}</td>
</tr>
<tr>
<th>Powiat</th>
<td>{{ $fireStation-> county }}</td>
</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>
@endif
@ -53,3 +86,17 @@
@endif
</div>
@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
@if(count($userDecorations) > 0)
<p align='center'>
<table class='firefighterViewTable'>
<tr class='table-header'>
<td>Odznaczenie</td>
<td>Data przyznania</td>
@foreach($userDecorations as $userDecoration)
<tr>
<td id="decorationName{{ $userDecoration->id }}">{{ $userDecoration->decorationName }}</td>
<td id="amount{{ $userDecoration->id }}">{{ $userDecoration->dateOfAward }}</td>
<table class='table'>
<thead>
<tr>
<th colspan="2"><center>Odznaczenia</center></th>
</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>
</p>
@else

View File

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

View File

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

View File

@ -14,24 +14,30 @@
Jednostka nie istnieje
@else
<table class='firefighterViewTable'>
<tr class='table-header'>
<td>LP</td>
<td>Typ Pojazdu</td>
<td>Marka</td>
<td>Nr rej.</td>
<td>Kryptonim</td>
<td>Rok Produkcji</td>
<td>Rodzaj napędu</td>
<td>Przegląd</td>
<td>OC</td>
<table class='table'>
<thead>
<tr>
<th>#</th>
<th>Typ Pojazdu</th>
<th>Marka</th>
<th>Nr rej.</th>
<th>Kryptonim</th>
<th>Rok Produkcji</th>
<th>Rodzaj napędu</th>
<th>Przegląd</th>
<th>OC</th>
<th>Operacja</th>
</tr>
</thead>
@php
$lp=0 // liczba porządkowa
@endphp
@endphp
@foreach($vehicles as $vehicle)
@php
$lp = $lp + 1
@endphp
@endphp
<tr>
<form action="{{ route('vehicles.destroy', $vehicle->id)}}" method="post">
<td>{{ $lp }}</td>
@ -43,30 +49,31 @@
<td id="driveType{{ $vehicle->id }}">{{ $vehicle->driveType }}</td>
<td id="examExpirationDate{{ $vehicle->id }}">{{ $vehicle->examExpirationDate }}</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>
{{ csrf_field() }}
@method('DELETE')
<td><button class="btn btn-danger" type="submit">Usuń</button></td>
</form>
@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>
<td style="display:inline;">
<a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
{{ csrf_field() }}
@method('DELETE')
<button class="btn btn-danger" type="submit">Usuń</button>
</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>
@endforeach
</table>
{{ $vehicles->links() }}
@endif
@else
Brak autoryzacji