From 8b0f6426013c590a33d93399b887bd6ce1937f48 Mon Sep 17 00:00:00 2001 From: s421507 Date: Mon, 20 Jul 2020 18:07:27 +0200 Subject: [PATCH] =?UTF-8?q?Uzupe=C5=82nienie=20reszty=20p=C3=B3l=20przy=20?= =?UTF-8?q?Karcie=20ewidencji=20oraz=20nadaniu=20u=C5=BCytkownika?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 9 +- .../documentApplicationController.php | 4 +- app/Http/Controllers/documentCreators.php | 2 +- .../Controllers/documentOverlayController.php | 87 ++++++++++++++++++- .../Controllers/fireFightersController.php | 8 +- .../Controllers/userProfileController.php | 2 +- 6 files changed, 99 insertions(+), 13 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 88ccede..1be3d85 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,11 @@ + + + @@ -263,7 +266,7 @@ - + diff --git a/app/Http/Controllers/documentApplicationController.php b/app/Http/Controllers/documentApplicationController.php index 0e730cb..0002821 100644 --- a/app/Http/Controllers/documentApplicationController.php +++ b/app/Http/Controllers/documentApplicationController.php @@ -41,7 +41,7 @@ class documentApplicationController extends Controller $userData = DB::table('users')->where("users.id", '=', $request->fireFighterID) ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') - ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number') + ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number', 'users.fathersName', 'users.apartment', 'users.address') ->first(); $awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $request->fireFighterID) @@ -65,7 +65,7 @@ class documentApplicationController extends Controller $userData = DB::table('users')->where("users.id", '=', $request->fireFighterID) ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') - ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number') + ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number', 'users.secondName', 'users.fathersName', 'users.mothersName', 'users.placeOfBirth', 'users.joiningOSPDate', 'users.driversLicense', 'users.address', 'users.apartment', 'users.homePhoneNumber', 'users.identityCardNumber', 'users.education', 'users.profession', 'users.IDSeries', 'users.IDNumber', 'users.IDValidUntil') ->first(); $userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', $request->fireFighterID) diff --git a/app/Http/Controllers/documentCreators.php b/app/Http/Controllers/documentCreators.php index 5afb79d..1b02d4e 100644 --- a/app/Http/Controllers/documentCreators.php +++ b/app/Http/Controllers/documentCreators.php @@ -143,7 +143,7 @@ class documentCreators extends Controller } $pdf->Ln(); - + ob_end_clean(); // $this->setWatermark($pdf); $pdf->Ln(); $pdf->Output(); diff --git a/app/Http/Controllers/documentOverlayController.php b/app/Http/Controllers/documentOverlayController.php index 9c8db52..948101d 100644 --- a/app/Http/Controllers/documentOverlayController.php +++ b/app/Http/Controllers/documentOverlayController.php @@ -56,16 +56,27 @@ class documentOverlayController extends Controller //$pdf->Write(0, $decoration); $pdf->Cell(20,10, Helpers::textConvert($userData->name), 0, 0, 'C'); + #Nazwisko $pdf->SetXY(95, 74); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, Helpers::textConvert($userData->surname), 0, 0, 'C'); + #Imie Ojca + $pdf->SetXY(153.5, 74); + //$pdf->Write(0, $decoration); + $pdf->Cell(20,10, Helpers::textConvert($userData->fathersName), 0, 0, 'C'); + #Data Urodzenia $pdf->SetXY(35, 93); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, Helpers::textConvert(Helpers::peselBirthdayDate($userData->PESEL)), 0, 0, 'C'); + #Data Urodzenia + $pdf->SetXY(124, 93); + //$pdf->Write(0, $decoration); + $pdf->Cell(20,10, Helpers::textConvert($userData->address.' '.$userData->apartment), 0, 0, 'C'); + #Funkcja $pdf->SetXY(124, 113); @@ -120,9 +131,21 @@ class documentOverlayController extends Controller $pdf->SetTextColor(128, 128, 128); # Imie i nazwisko - $pdf->SetXY(84, 31.5); + $pdf->SetXY(85.5, 31.5); $pdf->Cell(0, 10, Helpers::textConvert($userData->surname . ' ' . $userData->name), 0, 0, 'l'); + # Drugie Imie + $pdf->SetXY(85.5, 39.0); + $pdf->Cell(0, 10, Helpers::textConvert($userData->secondName), 0, 0, 'l'); + + # Imie Ojca + $pdf->SetXY(85.5, 46.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->fathersName), 0, 0, 'l'); + + # Imie Mama + $pdf->SetXY(137.5, 46.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->mothersName), 0, 0, 'l'); + # PESEL $peselArray = str_split($userData->PESEL); $x = 116; @@ -133,7 +156,7 @@ class documentOverlayController extends Controller } # Numer Telefonu - $pdf->SetXY(102, 103); + $pdf->SetXY(102, 102.5); $pdf->Cell(0, 10, $userData->phoneNumber, 0, 0, 'l'); # Data urodzenia @@ -148,6 +171,66 @@ class documentOverlayController extends Controller $pdf->SetXY(37.5, 62.5); $pdf->Cell(0, 10, $birthdayArray[2], 0, 0, 'l'); + + # Miejsce Urodzenia + $pdf->SetXY(54, 62.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->placeOfBirth), 0, 0, 'l'); + + # Data wstąpienia do OSP + $pdf->SetXY(16, 84.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->joiningOSPDate), 0, 0, 'l'); + + # Kategorie prawa jazdy + $pdf->SetXY(55, 84.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->driversLicense), 0, 0, 'l'); + + + # Adres zamieszkania + $pdf->SetXY(48, 95.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->address), 0, 0, 'l'); + + # Numer mieszkania + $pdf->SetXY(136, 95.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->apartment), 0, 0, 'l'); + + # Numer telefonu + $pdf->SetXY(37, 102.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->homePhoneNumber), 0, 0, 'l'); + + # Numer identyfikacji członskowkiej + $pdf->SetXY(158, 102.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->identityCardNumber), 0, 0, 'l'); + + + # Wykształcenie + $pdf->SetXY(39, 112.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->education), 0, 0, 'l'); + + # Zawód wyuczony + $pdf->SetXY(123, 112.5); + $pdf->Cell(0, 10, Helpers::textConvert($userData->profession), 0, 0, 'l'); + + # Seria i numer dowodu osobistego oraz data + $seria_x = 96.3; + $seria = $userData->IDSeries; + for ($i=0; $i<3; $i++) { + $pdf->SetXY($seria_x, 81.3); + $pdf->Cell(0, 10, Helpers::textConvert($seria[$i]), 0, 0, 'l'); + $seria_x = $seria_x + 6.65; + } + + $numer_x = 123.4; + $numer = $userData->IDNumber; + for ($i=0; $i<6; $i++) { + $pdf->SetXY($numer_x, 81.3); + $pdf->Cell(0, 10, Helpers::textConvert($numer[$i]), 0, 0, 'l'); + $numer_x = $numer_x + 6.65; + } + + $pdf->SetXY(169.8, 81.3); + $pdf->Cell(0, 10, Helpers::textConvert($userData->IDValidUntil), 0, 0, 'l'); + + $y = 182; $lp = 1; foreach($userTrainings as $userTraining){ diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index cdb2ea8..547e8aa 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -49,11 +49,11 @@ class fireFightersController extends Controller $fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID'); $fireFighter = DB::table('users')->where("id", $id)->first(); - if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { // if do usunięcia w pzyszłości +// if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { // if do usunięcia w pzyszłości return view('fireFightersEdit', ["fireFighter" => $fireFighter]); - } else{ - return "Brak dostepu"; - } +// } else{ +// return "Brak dostepu"; +// } }else{ return redirect()->to('/strazacy'); } diff --git a/app/Http/Controllers/userProfileController.php b/app/Http/Controllers/userProfileController.php index a38ad4d..520ab62 100644 --- a/app/Http/Controllers/userProfileController.php +++ b/app/Http/Controllers/userProfileController.php @@ -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', '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',) + ->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{