forked from s421507/eOSP2
1
0
Fork 0

Wyswietlanie strazakow + edycja - in progress

This commit is contained in:
czup 2019-10-02 15:26:30 +02:00
commit cd9b54d42b
7 changed files with 2960 additions and 129 deletions

View File

@ -7,11 +7,13 @@ use DB;
class DataController extends Controller
{
/*
public function getVoivodeships()
{
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('unit',compact('voivodeships'));
}
*/
public function getCounties($id)
{

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

@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\fireStation;
use DB;
class fireStationController extends Controller
{
@ -14,7 +14,9 @@ class fireStationController extends Controller
$fireStation = fireStation::find(auth()->user()->fireStationID);
return view('unit', ["fireStation" => $fireStation]);
} else{
return view('unit');
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('unit',compact('voivodeships'));
//return view('unit');
}
}
public function store()

View File

@ -14,121 +14,25 @@ class JednostkiTerytorialne extends Migration
public function up()
{
Schema::create('wojewodztwa', function (Blueprint $table) {
$table->increments('id');
// $table->increments('id');
$table->integer('id');
$table->string('name');
});
Schema::create('powiaty', function (Blueprint $table) {
$table->increments('id');
$table->integer('id');
$table->integer('wojewodztwo_id');
$table->string('name');
});
Schema::create('gminy', function (Blueprint $table) {
$table->increments('id');
$table->integer('id');
$table->integer('wojewodztwo_id');
$table->integer('powiat_id');
$table->string('name');
});
// dane testowe
DB::table('wojewodztwa')->insert(
array(
'name' => 'wielkopolskie'
)
);
DB::table('wojewodztwa')->insert(
array(
'name' => 'pomorskie'
)
);
DB::table('powiaty')->insert(
array(
'wojewodztwo_id' => '1',
'name' => 'poznański'
)
);
DB::table('powiaty')->insert(
array(
'wojewodztwo_id' => '1',
'name' => 'koniński'
)
);
DB::table('powiaty')->insert(
array(
'wojewodztwo_id' => '2',
'name' => 'kartuski'
)
);
DB::table('powiaty')->insert(
array(
'wojewodztwo_id' => '2',
'name' => 'kwidzyński'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '1',
'powiat_id' => '1',
'name' => 'Dopiewo'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '1',
'powiat_id' => '1',
'name' => 'Suchy Las'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '1',
'powiat_id' => '2',
'name' => 'Skulsk'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '1',
'powiat_id' => '2',
'name' => 'Wilczyn'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '2',
'powiat_id' => '3',
'name' => 'Sierakowice'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '2',
'powiat_id' => '3',
'name' => 'Chmielno'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '2',
'powiat_id' => '4',
'name' => 'Gardeja'
)
);
DB::table('gminy')->insert(
array(
'wojewodztwo_id' => '2',
'powiat_id' => '4',
'name' => 'Sadlinki'
)
);
}
/**

File diff suppressed because it is too large Load Diff

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,16 +43,14 @@ 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','DataController@getVoivodeships');
Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');