Dodanie dokumentu pdf z overlay
This commit is contained in:
parent
4e3e3eecc1
commit
7715fb96fb
@ -2,20 +2,10 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment="">
|
<list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/.gitignore" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/app/Http/Controllers/wniosek_o_nadanie_odznaczenia.pdf" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/resources/views/documentApplicationForm.blade.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/RegistrationController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/RegistrationController.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentApplicationController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentApplicationController.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/resources/views/documentApplicationForm.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/documentApplicationForm.blade.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/database/seeds/DatabaseSeeder.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/seeds/DatabaseSeeder.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/documents.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/documents.blade.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/resources/views/inc/menu.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/inc/menu.blade.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -262,7 +252,12 @@
|
|||||||
<workItem from="1583814153373" duration="3685000" />
|
<workItem from="1583814153373" duration="3685000" />
|
||||||
<workItem from="1583818172415" duration="297000" />
|
<workItem from="1583818172415" duration="297000" />
|
||||||
<workItem from="1584513032559" duration="4015000" />
|
<workItem from="1584513032559" duration="4015000" />
|
||||||
<workItem from="1585008405211" duration="1264000" />
|
<workItem from="1585008405211" duration="2237000" />
|
||||||
|
<workItem from="1585202168173" duration="6752000" />
|
||||||
|
<workItem from="1586389118250" duration="3243000" />
|
||||||
|
<workItem from="1587752993410" duration="614000" />
|
||||||
|
<workItem from="1591804585624" duration="4930000" />
|
||||||
|
<workItem from="1591847981434" duration="9628000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@ -286,16 +281,10 @@
|
|||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
<state x="527" y="258" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1536.824@0.0.1536.824" timestamp="1583256847898" />
|
<state x="527" y="258" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1536.824@0.0.1536.824" timestamp="1583256847898" />
|
||||||
<state x="703" y="357" width="559" height="390" key="#com.intellij.fileTypes.FileTypeChooser/67.27.1853.1053@67.27.1853.1053" timestamp="1578547861249" />
|
|
||||||
<state x="546" y="221" width="524" height="484" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1583817494217">
|
<state x="546" y="221" width="524" height="484" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1583817494217">
|
||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
<state x="546" y="221" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1536.824@0.0.1536.824" timestamp="1583817494217" />
|
<state x="546" y="221" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1536.824@0.0.1536.824" timestamp="1583817494217" />
|
||||||
<state x="726" y="310" width="524" height="484" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/67.27.1853.1053@67.27.1853.1053" timestamp="1579901649290" />
|
|
||||||
<state x="167" y="125" width="1653" height="855" key="DiffContextDialog" timestamp="1579394466035">
|
|
||||||
<screen x="67" y="27" width="1853" height="1053" />
|
|
||||||
</state>
|
|
||||||
<state x="167" y="125" width="1653" height="855" key="DiffContextDialog/67.27.1853.1053@67.27.1853.1053" timestamp="1579394466035" />
|
|
||||||
<state x="607" y="301" key="DockerComposeFileDialog" timestamp="1583254880063">
|
<state x="607" y="301" key="DockerComposeFileDialog" timestamp="1583254880063">
|
||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
@ -304,7 +293,6 @@
|
|||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
<state x="912" y="146" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1583254878286" />
|
<state x="912" y="146" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1583254878286" />
|
||||||
<state x="776" y="310" width="424" height="484" key="FileChooserDialogImpl/67.27.1853.1053@67.27.1853.1053" timestamp="1578547803408" />
|
|
||||||
<state x="604" y="336" key="NewPhpFileDialog" timestamp="1583816251531">
|
<state x="604" y="336" key="NewPhpFileDialog" timestamp="1583816251531">
|
||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
@ -313,18 +301,13 @@
|
|||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
<state x="277" y="55" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1583262148541" />
|
<state x="277" y="55" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1583262148541" />
|
||||||
<state x="482" y="276" key="com.intellij.ide.util.TipDialog" timestamp="1585008421135">
|
<state x="482" y="276" key="com.intellij.ide.util.TipDialog" timestamp="1591848060220">
|
||||||
<screen x="0" y="0" width="1536" height="824" />
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
</state>
|
</state>
|
||||||
<state x="482" y="276" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1585008421135" />
|
<state x="482" y="276" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1591848060220" />
|
||||||
<state x="649" y="380" key="com.intellij.ide.util.TipDialog/67.27.1853.1053@67.27.1853.1053" timestamp="1579902711879" />
|
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1586390166241">
|
||||||
<state x="647" y="170" width="683" height="764" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1579395082597">
|
<screen x="0" y="0" width="1536" height="824" />
|
||||||
<screen x="67" y="27" width="1853" height="1053" />
|
|
||||||
</state>
|
</state>
|
||||||
<state x="647" y="170" width="683" height="764" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/67.27.1853.1053@67.27.1853.1053" timestamp="1579395082597" />
|
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1586390166241" />
|
||||||
<state x="657" y="253" key="run.anything.popup" timestamp="1580393897949">
|
|
||||||
<screen x="67" y="27" width="1853" height="1053" />
|
|
||||||
</state>
|
|
||||||
<state x="657" y="253" key="run.anything.popup/67.27.1853.1053@67.27.1853.1053" timestamp="1580393897949" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -11,7 +11,11 @@ class documentApplicationController extends Controller
|
|||||||
|
|
||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||||
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get();
|
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get();
|
||||||
return view("documentApplicationForm", ["fireFighters" => $fireFighters]);
|
$decoration = DB::table('decorations')->pluck('decorationName', 'id');
|
||||||
|
return view("documentApplicationForm")
|
||||||
|
->with(compact('decoration'))
|
||||||
|
->with(compact('fireFighters'));
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
return view('home');
|
return view('home');
|
||||||
}
|
}
|
||||||
@ -22,7 +26,16 @@ class documentApplicationController extends Controller
|
|||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ) {
|
if(auth()->user() != null && auth()->user()->fireStationID != null ) {
|
||||||
$request = request();
|
$request = request();
|
||||||
$test = new documentOverlayController();
|
$test = new documentOverlayController();
|
||||||
$test->testPdf($request->fireFighterID);
|
|
||||||
|
$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')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$fireStation = DB::table('firestations')->where("id", '=', $userData->fireStationID)->first();
|
||||||
|
|
||||||
|
$test->testPdf($userData, $request->decoration, $fireStation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,38 @@ use setasign\Fpdi\Fpdi;
|
|||||||
class documentOverlayController extends Controller
|
class documentOverlayController extends Controller
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public function testPdf($fireFighterID){
|
|
||||||
|
|
||||||
|
public function peselBirthDay($pesel){
|
||||||
|
$pesel = (String) $pesel;
|
||||||
|
$output = $pesel[2];
|
||||||
|
$output = (int)$output;
|
||||||
|
if( $output == 0 || $output == 1){
|
||||||
|
$year = '19'."".(String)$pesel[0]."".(String)$pesel[1];
|
||||||
|
}elseif( $output == 2 || $output == 3){
|
||||||
|
$year = '20'."".(String)$pesel[0]."".(String)$pesel[1];
|
||||||
|
}elseif( $output == 4 || $output == 5){
|
||||||
|
$year = '21'."".(String)$pesel[0]."".(String)$pesel[1];
|
||||||
|
}elseif( $output == 6 || $output == 7){
|
||||||
|
$year = '22'."".(String)$pesel[0]."".(String)$pesel[1];
|
||||||
|
}elseif( $output == 8 || $output == 9){
|
||||||
|
$year = '18'."".(String)$pesel[0]."".(String)$pesel[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($output % 2 == 0 ){
|
||||||
|
$month = '0'."".(String)$pesel[3];
|
||||||
|
}else{
|
||||||
|
$month = '1'."".(String)$pesel[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
$day = (String)$pesel[4]."".(String)$pesel[5];
|
||||||
|
|
||||||
|
return $day.".".$month.".".$year;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function testPdf($userData, $decoration, $fireStation){
|
||||||
// initiate FPDI
|
// initiate FPDI
|
||||||
$pdf = new Fpdi();
|
$pdf = new Fpdi();
|
||||||
// set the source file
|
// set the source file
|
||||||
@ -32,12 +63,43 @@ class documentOverlayController extends Controller
|
|||||||
|
|
||||||
if($pageNo == 1){
|
if($pageNo == 1){
|
||||||
$str = iconv('UTF-8', 'cp1250', 'zazółcić gęślą jaźń');
|
$str = iconv('UTF-8', 'cp1250', 'zazółcić gęślą jaźń');
|
||||||
$xyz = iconv('UTF-8', 'cp1250', $fireFighterID);
|
// $xyz = iconv('UTF-8', 'cp1250', $fireFighterID);
|
||||||
|
$dec = iconv('UTF-8', 'cp1250', $decoration);
|
||||||
// now write some text above the imported page
|
// now write some text above the imported page
|
||||||
$pdf->SetFont('times');
|
$pdf->SetFont('times');
|
||||||
$pdf->SetTextColor(255, 0, 0);
|
$pdf->SetTextColor(128, 128, 128);
|
||||||
|
|
||||||
|
#Pieczęć
|
||||||
$pdf->SetXY(30, 30);
|
$pdf->SetXY(30, 30);
|
||||||
$pdf->Write(0, $xyz);
|
// $pdf->Write(0, $decoration);
|
||||||
|
|
||||||
|
#Nazwa odznaczenia
|
||||||
|
$pdf->SetXY(120, 50);
|
||||||
|
//$pdf->Write(0, $decoration);
|
||||||
|
$pdf->Cell(20,10, $decoration, 1, 0, 'C');
|
||||||
|
|
||||||
|
#Imie
|
||||||
|
$pdf->SetXY(35, 74);
|
||||||
|
//$pdf->Write(0, $decoration);
|
||||||
|
$pdf->Cell(20,10, $userData->name, 1, 0, 'C');
|
||||||
|
|
||||||
|
#Nazwisko
|
||||||
|
$pdf->SetXY(95, 74);
|
||||||
|
//$pdf->Write(0, $decoration);
|
||||||
|
$pdf->Cell(20,10, $userData->surname, 1, 0, 'C');
|
||||||
|
|
||||||
|
#Data Urodzenia
|
||||||
|
$pdf->SetXY(35, 93);
|
||||||
|
//$pdf->Write(0, $decoration);
|
||||||
|
$pdf->Cell(20,10, $this->peselBirthDay($userData->PESEL), 1, 0, 'C');
|
||||||
|
|
||||||
|
#Funkcja
|
||||||
|
$pdf->SetXY(124, 113);
|
||||||
|
$pdf->Cell(20,10, $userData->unitFunction, 1, 0, 'C');
|
||||||
|
|
||||||
|
#Funkcja
|
||||||
|
$pdf->SetXY(35, 113);
|
||||||
|
$pdf->Cell(20,10, $fireStation->postOffice, 1, 0, 'C');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="decoration">Wybierz odznaczenie:</label>
|
||||||
|
<select name="decoration" class="form-control" style="width:300px">
|
||||||
|
<option value="">--- Wybierz odznaczenie ---</option>
|
||||||
|
@foreach ($decoration as $key => $value)
|
||||||
|
@if(Illuminate\Support\Facades\Input::old('decoration') == $key)
|
||||||
|
<option value="{{ $value }}" selected >{{ $value }}</option>
|
||||||
|
@else
|
||||||
|
<option value="{{ $value }}">{{ $value }}</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button style="cursor:pointer" type="submit" class="btn btn-primary">Drukuj</button>
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Drukuj</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user