1
0
forked from s421507/eOSP2

Dodatkowe dane strażaków potrzebne do generowania karty ewidencyjnej - dodanie do bazy danych, wyświetlanie i edycja w profilu użytkownika.

This commit is contained in:
Krzysztof Strzelecki 2020-07-20 04:26:18 +02:00
parent aa6ef74832
commit 8dc91e233e
5 changed files with 217 additions and 20 deletions

View File

@ -14,7 +14,7 @@ class userProfileController extends Controller
$userData = DB::table('users')->where("users.id", '=', auth()->user()->id)
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
->select('users.id','users.name', 'users.surname', 'users.PESEL','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number')
->select('users.id','users.name', 'users.surname', 'users.PESEL','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number', 'users.secondName', 'users.fathersName', 'users.mothersName', 'users.address', 'users.apartment', 'users.placeOfBirth', 'users.driversLicense', 'users.joiningOSPDate', 'users.IDSeries', 'users.IDNumber', 'users.IDValidUntil', 'users.identityCardNumber', 'users.homePhoneNumber', 'users.education', 'users.profession',)
->first();
return view("userProfile", ["userData" => $userData]);
} else{
@ -44,6 +44,19 @@ class userProfileController extends Controller
'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:users,email,'.auth()->user()->id, //wymagaj unikalnego adresu email ale pozwól na zachowanie starego adresu
'secondName' => 'max:45',
'fathersName' => 'max:45',
'mothersName' => 'max:45',
'homePhoneNumber' => 'max:20',
'address' => 'max:45',
'apartment'=> 'max:45',
'placeOfBirth'=> 'max:45',
'IDSeries'=> 'max:3',
'IDNumber'=> 'max:6',
'identityCardNumber'=> 'max:20',
'driversLicense'=> 'max:20',
'education'=> 'max:45',
'profession'=> 'max:45',
],
[
'required' => ':attribute jest wymagany(e).',
@ -64,6 +77,21 @@ class userProfileController extends Controller
$user-> phoneNumber = $request->phoneNumber;
$user-> email = $request->email;
$user-> changingID = auth()->user()-> id;
$user-> secondName = $request->secondName;
$user-> fathersName = $request->fathersName;
$user-> mothersName = $request->mothersName;
$user-> homePhoneNumber = $request->homePhoneNumber;
$user-> address = $request->address;
$user-> apartment = $request->apartment;
$user-> placeOfBirth = $request->placeOfBirth;
$user-> joiningOSPDate = $request->joiningOSPDate;
$user-> IDSeries = $request->IDSeries;
$user-> IDNumber = $request->IDNumber;
$user-> IDValidUntil = $request->IDValidUntil;
$user-> identityCardNumber = $request->identityCardNumber;
$user-> driversLicense= $request->driversLicense;
$user-> education = $request->education;
$user-> profession = $request->profession;
$user->save();
return redirect()->to('/userprofile');;

View File

@ -0,0 +1,47 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdditionalDataAboutFirefighters extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
//
$table->string('secondName', 45)->nullable()->default(null);
$table->string('fathersName', 45)->nullable()->default(null);
$table->string('mothersName', 45)->nullable()->default(null);
$table->string('address', 45)->nullable()->default(null);
$table->string('apartment', 45)->nullable()->default(null); //nr domu
$table->string('placeOfBirth', 45)->nullable()->default(null);
$table->string('driversLicense', 20)->nullable()->default(null);
$table->date('joiningOSPDate', 20)->nullable()->default(null);
$table->string('IDSeries', 3)->nullable()->default(null);
$table->string('IDNumber', 6)->nullable()->default(null); //nr dowodu osobistego
$table->date('IDValidUntil', 20)->nullable()->default(null);
$table->string('identityCardNumber', 20)->nullable()->default(null); //nr legitymacji strażackiej
$table->string('homePhoneNumber', 20)->nullable()->default(null);
$table->string('education', 45)->nullable()->default(null);
$table->string('profession', 45)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,13 +1,7 @@
@extends('layout.app')
@section('left-menu')
@parent
<ul>
<li>Wnioski</li>
<li>Sprawozdania</li>
<li>Karta Jednostki</li>
</ul>
@stop
@section('center-area')

View File

@ -29,22 +29,18 @@
<th>Imię i nazwisko:</th>
<td>{{ $userData->name }} {{ $userData->surname }}</td>
</tr>
<tr>
<th>Drugie imię:</th>
<td>{{ $userData->secondName}}</td>
</tr>
<tr>
<th>Imię ojca i matki:</th>
<td>{{ $userData->fathersName}} {{ $userData->mothersName}}</td>
</tr>
<tr>
<th>PESEL:</th>
<td>{{ $userData->PESEL}}</td>
</tr>
<tr>
<th>Nr telefonu:</th>
<td>{{ $userData->phoneNumber}}</td>
</tr>
<tr>
<th>Adres e-mail:</th>
<td>{{ $userData->email}}</td>
</tr>
{{-- <tr> --}}
{{-- <th>Numer ewidencyjny:</th> --}}
{{-- <td>{{ $userData->number}}</td> --}}
{{-- </tr> --}}
<tr>
<th>Stopień:</th>
<td>{{ $userData->rank}}</td>
@ -53,6 +49,62 @@
<th>Funkcja:</th>
<td>{{ $userData->unitFunction}}</td>
</tr>
<tr>
<th>Nr telefonu komórkowego:</th>
<td>{{ $userData->phoneNumber}}</td>
</tr>
<tr>
<th>Telefon domowy:</th>
<td>{{ $userData->homePhoneNumber}}</td>
</tr>
<tr>
<th>Adres e-mail:</th>
<td>{{ $userData->email}}</td>
</tr>
<tr>
<th>Adres zamieszkania:</th>
<td>{{ $userData->address}}</td>
</tr>
<tr>
<th>Numer domu:</th>
<td>{{ $userData->apartment}}</td>
</tr>
{{-- <tr> --}}
{{-- <th>Numer ewidencyjny:</th> --}}
{{-- <td>{{ $userData->number}}</td> --}}
{{-- </tr> --}}
<tr>
<th>Miejsce urodzenia:</th>
<td>{{ $userData->placeOfBirth}}</td>
</tr>
<tr>
<th>Data wstąpienia do OSP:</th>
<td>{{ $userData->joiningOSPDate}}</td>
</tr>
<tr>
<th>Seria i numer dowodu osobistego:</th>
<td>{{ $userData->IDSeries}} {{ $userData->IDNumber}}</td>
</tr>
<tr>
<th>Dowód osobisty ważny do:</th>
<td>{{ $userData->IDValidUntil}}</td>
</tr>
<tr>
<th>Numer legitymacji członkowskiej:</th>
<td>{{ $userData->identityCardNumber}}</td>
</tr>
<tr>
<th>Prawo jazdy (kategorie):</th>
<td>{{ $userData->driversLicense}}</td>
</tr>
<tr>
<th>Wykształcenie:</th>
<td>{{ $userData->education}}</td>
</tr>
<tr>
<th>Zawód wyuczony:</th>
<td>{{ $userData->profession}}</td>
</tr>
</table>
</p>
@else

View File

@ -26,20 +26,96 @@
<input type="text" class="form-control" id="surname" name="surname" value="{{ $userData->surname }}">
</div>
<div class="form-group">
<label for="parameter">Drugie imię:</label>
<input type="text" class="form-control" id="secondName" name="secondName" value="{{ $userData->secondName }}">
</div>
<div class="form-group">
<label for="parameter">Imię ojca:</label>
<input type="text" class="form-control" id="fathersName" name="fathersName" value="{{ $userData->fathersName }}">
</div>
<div class="form-group">
<label for="parameter">Imię matki:</label>
<input type="text" class="form-control" id="mothersName" name="mothersName" value="{{ $userData->mothersName }}">
</div>
<div class="form-group">
<label for="parameter">PESEL:</label>
<input type="text" class="form-control" id="PESEL" name="PESEL" value="{{ $userData->PESEL }}">
</div>
<div class="form-group">
<label for="parameter">Numer telefonu:</label>
<label for="parameter">Numer telefonu komórkowego:</label>
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber" value="{{ $userData->phoneNumber }}">
</div>
<div class="form-group">
<label for="parameter">Telefon domowy:</label>
<input type="text" class="form-control" id="homePhoneNumber" name="homePhoneNumber" value="{{ $userData->homePhoneNumber }}">
</div>
<div class="form-group">
<label for="parameter">Adres e-mail:</label>
<input type="email" class="form-control" id="email" name="email" value="{{ $userData->email }}">
</div>
<div class="form-group">
<label for="parameter">Adres zamieszkania:</label>
<input type="text" class="form-control" id="address" name="address" value="{{ $userData->address }}">
</div>
<div class="form-group">
<label for="parameter">Numer domu:</label>
<input type="text" class="form-control" id="apartment" name="apartment" value="{{ $userData->apartment }}">
</div>
<div class="form-group">
<label for="parameter">Miejsce urodzenia:</label>
<input type="text" class="form-control" id="placeOfBirth" name="placeOfBirth" value="{{ $userData->placeOfBirth }}">
</div>
<div class="form-group">
<label for="parameter">Data wstąpienia do OSP:</label>
<input type="date" class="form-control" id="joiningOSPDate" name="joiningOSPDate" value="{{ $userData->joiningOSPDate }}">
</div>
<div class="form-group">
<label for="parameter">Seria dowodu osobistego:</label>
<input type="text" class="form-control" id="IDSeries" name="IDSeries" value="{{ $userData->IDSeries }}">
</div>
<div class="form-group">
<label for="parameter">Numer dowodu osobistego:</label>
<input type="text" class="form-control" id="IDNumber" name="IDNumber" value="{{ $userData->IDNumber }}">
</div>
<div class="form-group">
<label for="parameter">Dowód osobisty ważny do:</label>
<input type="date" class="form-control" id="IDValidUntil" name="IDValidUntil" value="{{ $userData->IDValidUntil }}">
</div>
<div class="form-group">
<label for="parameter">Numer legitymacji członkowskiej:</label>
<input type="text" class="form-control" id="identityCardNumber" name="identityCardNumber" value="{{ $userData->identityCardNumber }}">
</div>
<div class="form-group">
<label for="parameter">Prawo jazdy (kategorie):</label>
<input type="text" class="form-control" id="driversLicense" name="driversLicense" value="{{ $userData->driversLicense }}">
</div>
<div class="form-group">
<label for="parameter">Wykształcenie:</label>
<input type="text" class="form-control" id="education" name="education" value="{{ $userData->education }}">
</div>
<div class="form-group">
<label for="parameter">Zawód wyuczony:</label>
<input type="text" class="form-control" id="profession" name="profession" value="{{ $userData->profession }}">
</div>
<div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div>