forked from s421507/eOSP2
dokończenie poziomów dostępu i przekierowań
This commit is contained in:
parent
079343fe1d
commit
0713cd5a68
@ -21,7 +21,7 @@ function formatDate($date)
|
|||||||
class DecorationsController extends Controller
|
class DecorationsController extends Controller
|
||||||
{
|
{
|
||||||
public function create($id){
|
public function create($id){
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
$awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id)
|
$awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id)
|
||||||
->whereNull('decorationsFirefighters.deleted_at')
|
->whereNull('decorationsFirefighters.deleted_at')
|
||||||
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
|
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
|
||||||
@ -39,7 +39,7 @@ class DecorationsController extends Controller
|
|||||||
->with(compact('decoration'));
|
->with(compact('decoration'));
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
return "Brak dostepu";
|
return redirect()->to('/strazacy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,15 +21,15 @@ class EquipmentController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addForm(){
|
public function addForm(){
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
return view('equipmentAdd');
|
return view('equipmentAdd');
|
||||||
|
|
||||||
} else return view("login");
|
} else return redirect()->to('/sprzet');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editForm($id)
|
public function editForm($id)
|
||||||
{
|
{
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null )
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik
|
||||||
{
|
{
|
||||||
|
|
||||||
$equipment = DB::table('equipment')->where("id", $id)->first();
|
$equipment = DB::table('equipment')->where("id", $id)->first();
|
||||||
@ -37,7 +37,7 @@ class EquipmentController extends Controller
|
|||||||
return view('equipmentEdit', ["equipment" => $equipment]);
|
return view('equipmentEdit', ["equipment" => $equipment]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return view("login");
|
return redirect()->to('/sprzet');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,21 +31,21 @@ class VehiclesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addForm(){
|
public function addForm(){
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
return view('vehiclesAdd');
|
return view('vehiclesAdd');
|
||||||
} else return view("login");
|
} else return redirect()->to('/pojazdy');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editForm($id)
|
public function editForm($id)
|
||||||
{
|
{
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null )
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik
|
||||||
{
|
{
|
||||||
|
|
||||||
$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";
|
redirect()->to('/pojazdy');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(){
|
public function store(){
|
||||||
|
@ -58,7 +58,7 @@ class operationsController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addForm(){
|
public function addForm(){
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
$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([
|
$vehicles = DB::table('vehicles')->where([
|
||||||
["fireStationID", '=', auth()->user()->fireStationID],
|
["fireStationID", '=', auth()->user()->fireStationID],
|
||||||
@ -67,13 +67,13 @@ class operationsController extends Controller
|
|||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]);
|
return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]);
|
||||||
} else return view("unit");
|
} else return redirect()->to('/wyjazdy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function editForm($id){
|
public function editForm($id){
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
|
|
||||||
// $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([
|
$vehicles = DB::table('vehicles')->where([
|
||||||
@ -118,7 +118,7 @@ class operationsController extends Controller
|
|||||||
// return "Brak dostepu";
|
// return "Brak dostepu";
|
||||||
// }
|
// }
|
||||||
} else{
|
} else{
|
||||||
return view('unit');
|
return redirect()->to('/wyjazdy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class trainingsController extends Controller
|
|||||||
{
|
{
|
||||||
public function create(){
|
public function create(){
|
||||||
|
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
|
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->paginate(10);
|
->paginate(10);
|
||||||
@ -32,7 +32,7 @@ class trainingsController extends Controller
|
|||||||
}
|
}
|
||||||
return View::make("trainings")->with(compact( "trainings", "fireFighters"));
|
return View::make("trainings")->with(compact( "trainings", "fireFighters"));
|
||||||
} else{
|
} else{
|
||||||
return view('trainings');
|
return redirect()->to('/strazacy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class trainingsController extends Controller
|
|||||||
|
|
||||||
public function addTrainingsFireFighters($id){
|
public function addTrainingsFireFighters($id){
|
||||||
|
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
|
||||||
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
|
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
|
||||||
->leftJoin('trainingsFirefighters', function ($join) use($id){
|
->leftJoin('trainingsFirefighters', function ($join) use($id){
|
||||||
$join->on('users.id', '=', 'trainingsFirefighters.firefighterID');
|
$join->on('users.id', '=', 'trainingsFirefighters.firefighterID');
|
||||||
@ -74,7 +74,7 @@ class trainingsController extends Controller
|
|||||||
->whereNull('deleted_at')->first();
|
->whereNull('deleted_at')->first();
|
||||||
return View::make("trainingsAddFireFighters")->with(compact( "training", "fireFighters"));
|
return View::make("trainingsAddFireFighters")->with(compact( "training", "fireFighters"));
|
||||||
} else{
|
} else{
|
||||||
return view('trainings');
|
return redirect()->to('/strazacy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,15 @@
|
|||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
||||||
@section('left-menu')
|
@section('left-menu')
|
||||||
@parent
|
@parent
|
||||||
|
@if( auth()->check() )
|
||||||
|
@if( auth()->user()->fireStationID != NULL)
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<ul>
|
<ul>
|
||||||
<a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
<a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
||||||
</ul>
|
</ul>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('center-area')
|
@section('center-area')
|
||||||
@ -25,7 +31,9 @@
|
|||||||
<th>Nazwa</th>
|
<th>Nazwa</th>
|
||||||
<th>Ilość</th>
|
<th>Ilość</th>
|
||||||
<th>Param. charakterystyczny</th>
|
<th>Param. charakterystyczny</th>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<th>Operacja</th>
|
<th>Operacja</th>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -38,10 +46,12 @@
|
|||||||
<td id="name{{ $item->id }}">{{ $item->name }}</td>
|
<td id="name{{ $item->id }}">{{ $item->name }}</td>
|
||||||
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
|
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
|
||||||
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</td>
|
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</td>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
<a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
<button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button>
|
<button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button>
|
||||||
</td>
|
</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
|
@ -3,9 +3,16 @@
|
|||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
||||||
@section('left-menu')
|
@section('left-menu')
|
||||||
@parent<ul>
|
@parent
|
||||||
|
@if( auth()->check() )
|
||||||
|
@if( auth()->user()->fireStationID != NULL)
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
|
<ul>
|
||||||
<a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
<a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
|
||||||
</ul>
|
</ul>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('center-area')
|
@section('center-area')
|
||||||
@ -24,7 +31,9 @@
|
|||||||
<th>Cel</th>
|
<th>Cel</th>
|
||||||
<th>Rodzaj zagrożenia</th>
|
<th>Rodzaj zagrożenia</th>
|
||||||
<th>Dowódca</th>
|
<th>Dowódca</th>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<th>Operacja</th>
|
<th>Operacja</th>
|
||||||
|
@endif
|
||||||
<th>Szczegóły</th> <tbody>
|
<th>Szczegóły</th> <tbody>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@ -41,10 +50,12 @@
|
|||||||
<td id="operationTarget{{ $operation->id }}">{{ $operation->target }}</td>
|
<td id="operationTarget{{ $operation->id }}">{{ $operation->target }}</td>
|
||||||
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
|
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
|
||||||
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
|
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
||||||
</td>
|
</td>
|
||||||
|
@endif
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button>
|
<button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -4,9 +4,15 @@
|
|||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
||||||
@section('left-menu')
|
@section('left-menu')
|
||||||
@parent
|
@parent
|
||||||
|
@if( auth()->check() )
|
||||||
|
@if( auth()->user()->fireStationID != NULL)
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<ul>
|
<ul>
|
||||||
<a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a>
|
<a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a>
|
||||||
</ul>
|
</ul>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('center-area')
|
@section('center-area')
|
||||||
@ -29,7 +35,9 @@
|
|||||||
<th>Rodzaj napędu</th>
|
<th>Rodzaj napędu</th>
|
||||||
<th>Przegląd</th>
|
<th>Przegląd</th>
|
||||||
<th>OC</th>
|
<th>OC</th>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<th>Operacja</th>
|
<th>Operacja</th>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -51,6 +59,7 @@
|
|||||||
<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>
|
||||||
|
@if(auth()->user()->accessLevel() == 50)
|
||||||
<td style="display:inline;">
|
<td style="display:inline;">
|
||||||
<a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
<a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
<button class="btn btn-danger" type="submit" id="{{$vehicle->id}}" onclick="deleteButton('{{$vehicle->id}}')">Usuń</button>
|
<button class="btn btn-danger" type="submit" id="{{$vehicle->id}}" onclick="deleteButton('{{$vehicle->id}}')">Usuń</button>
|
||||||
@ -69,6 +78,7 @@
|
|||||||
|
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user