1
0
forked from s421507/eOSP2
# Conflicts:
#	routes/web.php
This commit is contained in:
Krzysztof Strzelecki 2019-10-02 18:59:57 +02:00
commit 23262247e5
5 changed files with 53 additions and 33 deletions

View File

@ -7,13 +7,22 @@ use Illuminate\Http\Request;
use App\User; use App\User;
use App\fireStation; use App\fireStation;
use App\Rules\Pesel; use App\Rules\Pesel;
use Illuminate\Support\Facades\DB;
class fireFightersController extends Controller class fireFightersController extends Controller
{ {
public function create(){ public function create(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
// $users = DB::table('Users')->where("fireStationID", auth()->user()->fireStationID);
$users = user::where("fireStationID", auth()->user()->fireStationID);
return view("fireFighters", ["users" => $users]);
} else{
return view('fireFighters'); return view('fireFighters');
} }
}
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
$fireStation = fireStation::find(auth()->user()->fireStationID); $fireStation = fireStation::find(auth()->user()->fireStationID);
@ -63,5 +72,9 @@ class fireFightersController extends Controller
return view('fireFighters'); return view('fireFighters');
} }
public function editFireFighter(){
}
} }

View File

@ -35,7 +35,7 @@ class fireStationController extends Controller
'KRS' => 'required|digits:10', 'KRS' => 'required|digits:10',
'NIP' => 'required|digits:10', 'NIP' => 'required|digits:10',
'phoneNumber' => 'required|digits:9', 'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:firestations', 'email' => 'required|email|unique:fireStations',
], ],
[ [
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',

View File

@ -13,8 +13,12 @@
@section('center-area') @section('center-area')
@parent @parent
<?php @if( auth()->check())
echo "<table class='firefighterViewTable'> @if( auth()->user()->fireStationID == NULL)
Jednostka nie istnieje
@else
<table class='firefighterViewTable'>
<tr class='table-header'> <tr class='table-header'>
<td>Imie i nazwisko</td> <td>Imie i nazwisko</td>
<td>PESEL</td> <td>PESEL</td>
@ -22,17 +26,24 @@
<td>Funkcja</td> <td>Funkcja</td>
<td>Stopień</td> <td>Stopień</td>
<td>Status</td> <td>Status</td>
</tr>"; </tr>
for ($i = 1; $i <= 25; $i++){
echo "<tr> <tr>
<td>name surname</td> @foreach($users as $user)
<td>{{ $user->name }} surname</td>
<td>???????????</td> <td>???????????</td>
<td>przykladowymail@domena.com</td> <td>przykladowymail@domena.com</td>
<td>Zast. Naczelnika</td> <td>Zast. Naczelnika</td>
<td>Dowódca</td> <td>Dowódca</td>
<td>Czynny</td> <td>Czynny</td>
</tr>"; @endforeach
} </tr>"
echo "</table>"; </table>"
?>
@endif
@else
Brak autoryzacji
@endif
@stop @stop

View File

@ -43,21 +43,17 @@ Route::get('/login', 'SessionsController@create');
Route::post('/login', 'SessionsController@store'); Route::post('/login', 'SessionsController@store');
Route::get('/logout', 'SessionsController@destroy'); Route::get('/logout', 'SessionsController@destroy');
Route::get('/jednostka', 'fireStationController@create');
Route::post('/jednostka', 'fireStationController@store');
Route::get('/strazacy', 'fireFightersController@create'); Route::get('/strazacy', 'fireFightersController@create');
Route::get('/strazacy/add', 'fireFightersController@addForm'); Route::get('/strazacy/add', 'fireFightersController@addForm');
Route::post('/strazacy', 'fireFightersController@store'); Route::post('/strazacy', 'fireFightersController@store');
Route::get('/jednostka', 'fireStationController@create');
Route::post('/jednostka', 'fireStationController@store');
Route::get('/jednostka/getcounties/{id}','DataController@getCounties'); Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities'); Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
Route::get('register/verify/{confirmationCode}', [
'as' => 'confirmation_path',
'uses' => 'RegistrationController@confirm'
]);
//Auth::routes(); //Auth::routes();
// //
//Route::get('/home', 'HomeController@index')->name('home'); //Route::get('/home', 'HomeController@index')->name('home');