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

@ -15,15 +15,15 @@ class DataController extends Controller
} }
*/ */
public function getCounties($id) public function getCounties($id)
{ {
$counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id"); $counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id");
return json_encode($counties); return json_encode($counties);
} }
public function getCommunities($id) public function getCommunities($id)
{ {
$communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id"); $communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id");
return json_encode($communities); return json_encode($communities);
} }
} }

View File

@ -7,11 +7,20 @@ 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(){
return view('fireFighters');
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');
}
} }
public function addForm(){ public function addForm(){
@ -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,26 +13,37 @@
@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>
<td>E-mail</td> <td>E-mail</td>
<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>???????????</td> <td>{{ $user->name }} surname</td>
<td>przykladowymail@domena.com</td> <td>???????????</td>
<td>Zast. Naczelnika</td> <td>przykladowymail@domena.com</td>
<td>Dowódca</td> <td>Zast. Naczelnika</td>
<td>Czynny</td> <td>Dowódca</td>
</tr>"; <td>Czynny</td>
} @endforeach
echo "</table>"; </tr>"
?> </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');