Profil użytkownika - wyświetlanie szkoleń

This commit is contained in:
Krzysztof Strzelecki 2019-12-28 15:08:25 +01:00
parent 1c9f20dd80
commit 0538c51db9
6 changed files with 57 additions and 1 deletions

View File

@ -69,4 +69,20 @@ class userProfileController extends Controller
return redirect()->to('/userprofile');;
}
public function userTrainings(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
$userTrainings = DB::table('trainingsfirefighters')->where("trainingsfirefighters.firefighterID", '=', auth()->user()->id)
->leftJoin('trainings', 'trainingsfirefighters.trainingID', '=', 'trainings.id')
->select('trainingsfirefighters.id','trainings.trainingName','trainingsfirefighters.dateOfComplete', 'trainingsfirefighters.dateOfExpiry')
->get();
//DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
//->whereNull('deleted_at')->get();
return view("userTrainings", ["userTrainings" => $userTrainings]);
}
else{
return redirect()->to('/login');;
}
}
}

View File

@ -5,6 +5,7 @@
<ul>
<a href="/userprofile"><li>Mój profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/edit"><li>Edytuj profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/szkolenia"><li>Moje szkolenia<img src="../img/left_menu_icon/more.png"></li></a>
</ul>
@stop

View File

@ -4,6 +4,7 @@
@parent
<ul>
<a href="/userprofile/edit"><li>Edytuj profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/szkolenia"><li>Moje szkolenia<img src="../img/left_menu_icon/more.png"></li></a>
<a href="/userprofile/passwordchange"><li>Zmiana hasła<img src="../img/left_menu_icon/edit.png"></li></a>
</ul>
@stop

View File

@ -4,6 +4,7 @@
@parent
<ul>
<a href="/userprofile"><li>Mój profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/szkolenia"><li>Moje szkolenia<img src="../img/left_menu_icon/more.png"></li></a>
<a href="/userprofile/passwordchange"><li>Zmiana hasła<img src="../img/left_menu_icon/edit.png"></li></a>
</ul>
@stop

View File

@ -0,0 +1,36 @@
@extends('layout.app')
@section('left-menu')
@parent
<ul>
<a href="/userprofile"><li>Mój profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/edit"><li>Edytuj profil<img src="../img/left_menu_icon/edit.png"></li></a>
<a href="/userprofile/passwordchange"><li>Zmiana hasła<img src="../img/left_menu_icon/edit.png"></li></a>
</ul>
@stop
@section('center-area')
@parent
@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>
</p>
@else
Brak autoryzacji
@endif
@stop

View File

@ -84,7 +84,8 @@ Route::get('/userprofile', 'userProfileController@create');
Route::get('/userprofile/edit', 'userProfileController@editForm');
Route::post('/userprofile/edit', 'userProfileController@update');
Route::get('/userprofile/passwordchange', 'ChangePasswordController@create');
Route::post('/userprofile/passwordchange', 'ChangePasswordController@update');;
Route::post('/userprofile/passwordchange', 'ChangePasswordController@update');
Route::get('/userprofile/szkolenia', 'userProfileController@userTrainings');
Route::get('register/verify/{confirmationCode}', [