eOSP2/resources/views/vehicles.blade.php

82 lines
3.6 KiB
PHP

@extends('layout.app')
@section('left-menu')
@parent
<ul>
<a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a>
</ul>
@stop
@section('center-area')
@parent
@if( auth()->check())
@if( auth()->user()->fireStationID == NULL)
Jednostka nie istnieje
@else
<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
@foreach($vehicles as $vehicle)
@php
$lp = $lp + 1
@endphp
<tr>
<form action="{{ route('vehicles.destroy', $vehicle->id)}}" method="post">
<td>{{ $lp }}</td>
<td id="name{{ $vehicle->id }}">{{ $vehicle->name }}</td>
<td id="brand{{ $vehicle->id }}">{{ $vehicle->brand }}</td>
<td id="registrationNumber{{ $vehicle->id }}">{{ $vehicle->registrationNumber }}</td>
<td id="codename{{ $vehicle->id }}">{{ $vehicle->codename }}</td>
<td id="productionYear{{ $vehicle->id }}">{{ $vehicle->productionYear }}</td>
<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 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
</td>
</tr>
@endforeach
</table>
{{ $vehicles->links() }}
@endif
@else
Brak autoryzacji
@endif
@stop