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");
return json_encode($counties);
}
public function getCommunities($id)
public function getCommunities($id)
{
$communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id");
return json_encode($communities);
}
}
}

View File

@ -7,11 +7,20 @@ use Illuminate\Http\Request;
use App\User;
use App\fireStation;
use App\Rules\Pesel;
use Illuminate\Support\Facades\DB;
class fireFightersController extends Controller
{
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(){
@ -63,5 +72,9 @@ class fireFightersController extends Controller
return view('fireFighters');
}
public function editFireFighter(){
}
}

View File

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

View File

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

View File

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