Wyswietlanie stopni i funkcji

This commit is contained in:
czup 2019-10-06 08:16:10 +02:00
parent 948337b10c
commit 72f21d4a94
7 changed files with 40 additions and 11 deletions

View File

@ -15,7 +15,11 @@ class fireFightersController extends Controller
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
// $users = user::where("fireStationID", auth()->user()->fireStationID)->get(); // $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)->get();
$users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
->get();
return view("fireFighters", ["users" => $users]); return view("fireFighters", ["users" => $users]);
} else{ } else{
return view('fireFighters'); return view('fireFighters');

View File

@ -10,6 +10,6 @@ class fireStation extends Model
protected $table = 'fireStations'; protected $table = 'fireStations';
protected $fillable = [ protected $fillable = [
'name', 'number', 'voivodeship', 'county', 'community', 'postOffice', 'zipCode', 'address', 'latitude', 'longitude', 'KRS', 'NIP', 'phoneNumber', 'email', 'deleted', 'creatorID', 'changingID', 'remember_token', 'created_at', 'updated_at' 'name', 'number', 'voivodeship', 'county', 'community', 'postOffice', 'zipCode', 'address', 'latitude', 'long itude', 'KRS', 'NIP', 'phoneNumber', 'email', 'deleted', 'creatorID', 'changingID', 'remember_token', 'created_at', 'updated_at'
]; ];
} }

13
app/ranks.php Normal file
View File

@ -0,0 +1,13 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ranks extends Model
{
//
protected $primaryKey = 'id';
protected $fillable = ['rank'];
}

12
app/unitFunctions.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class unitFunctions extends Model
{
//
protected $primaryKey = 'id';
protected $fillable = [ 'unitFunction' ];
}

View File

@ -84,8 +84,8 @@
<td id="userSurname{{ $user->id }}">{{ $user->surname }}</td> <td id="userSurname{{ $user->id }}">{{ $user->surname }}</td>
<td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td> <td id="userPESEL{{ $user->id }}">{{ $user->PESEL }}</td>
<td id="userEmail{{ $user->id }}">{{ $user->email }}</td> <td id="userEmail{{ $user->id }}">{{ $user->email }}</td>
<td id="userFunction{{ $user->id }}">Zast. Naczelnika</td> <td id="userFunction{{ $user->id }}">{{ $user->unitFunction }}</td>
<td id="userDegree{{ $user->id }}">Dowódca</td> <td id="userDegree{{ $user->id }}">{{$user->rank}}</td>
<td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td> <td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td>
<td><a href="{{ URL::asset('strazacy/edit/'.$user->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td> <td><a href="{{ URL::asset('strazacy/edit/'.$user->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
</tr> </tr>

View File

@ -1,11 +1,11 @@
@section('menu') @section('menu')
<div class="top-menu"> <div class="top-menu">
<ol> <ol>
<a href="/jednostka"><li name="jednostka"><img src="img/jednostka.png">Jednostka</li></a> <a href="/jednostka"><li name="jednostka"><img src="../img/jednostka.png">Jednostka</li></a>
<a href="/strazacy"><li name="strazacy"><img src="img/strazacy2.png">Strażacy</li></a> <a href="/strazacy"><li name="strazacy"><img src="../img/strazacy2.png">Strażacy</li></a>
<a href="/pojazdy"> <li name="pojazdy"><img src="img/car.png">Pojazdy</li></a> <a href="/pojazdy"> <li name="pojazdy"><img src="../img/car.png">Pojazdy</li></a>
<a href="/straznica"><li name="straznica"><img src="img/straznica.png">Strażnica</li></a> <a href="/straznica"><li name="straznica"><img src="../img/straznica.png">Strażnica</li></a>
<a href="/wyjazdy"><li name="wyjazdy"><img src="img/wyjazdy.png">Wyjazdy</li></a> <a href="/wyjazdy"><li name="wyjazdy"><img src="../img/wyjazdy.png">Wyjazdy</li></a>
<a href="/dokumentacja"><li name="dokumentacja"><img src="img/documents.png">Dokumentacja</li></a> <a href="/dokumentacja"><li name="dokumentacja"><img src="../img/documents.png">Dokumentacja</li></a>
</ol> </ol>
</div> </div>

View File

@ -17,7 +17,7 @@
<a href="/register">Register</a> <a href="/register">Register</a>
@endif @endif
<div id="header"> <div id="header">
<div class="logo"><a href="/register"><img src="img/logo.png"></a></div> <div class="logo"><a href="/register"><img src="../img/logo.png"></a></div>
@include('inc.menu') @include('inc.menu')
<div class="userInfo"> <div class="userInfo">
<?php <?php