Dodanie drukowania widoków
This commit is contained in:
parent
710a719170
commit
72a651ebab
73
app/Http/Controllers/AlphaPDF.php
Normal file
73
app/Http/Controllers/AlphaPDF.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Codedge\Fpdf\Fpdf\Fpdf;
|
||||
|
||||
class AlphaPDF extends FPDF
|
||||
{
|
||||
protected $extgstates = array();
|
||||
|
||||
// alpha: real value from 0 (transparent) to 1 (opaque)
|
||||
// bm: blend mode, one of the following:
|
||||
// Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn,
|
||||
// HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
|
||||
function SetAlpha($alpha, $bm='Normal')
|
||||
{
|
||||
// set alpha for stroking (CA) and non-stroking (ca) operations
|
||||
$gs = $this->AddExtGState(array('ca'=>$alpha, 'CA'=>$alpha, 'BM'=>'/'.$bm));
|
||||
$this->SetExtGState($gs);
|
||||
}
|
||||
|
||||
function AddExtGState($parms)
|
||||
{
|
||||
$n = count($this->extgstates)+1;
|
||||
$this->extgstates[$n]['parms'] = $parms;
|
||||
return $n;
|
||||
}
|
||||
|
||||
function SetExtGState($gs)
|
||||
{
|
||||
$this->_out(sprintf('/GS%d gs', $gs));
|
||||
}
|
||||
|
||||
function _enddoc()
|
||||
{
|
||||
if(!empty($this->extgstates) && $this->PDFVersion<'1.4')
|
||||
$this->PDFVersion='1.4';
|
||||
parent::_enddoc();
|
||||
}
|
||||
|
||||
function _putextgstates()
|
||||
{
|
||||
for ($i = 1; $i <= count($this->extgstates); $i++)
|
||||
{
|
||||
$this->_newobj();
|
||||
$this->extgstates[$i]['n'] = $this->n;
|
||||
$this->_put('<</Type /ExtGState');
|
||||
$parms = $this->extgstates[$i]['parms'];
|
||||
$this->_put(sprintf('/ca %.3F', $parms['ca']));
|
||||
$this->_put(sprintf('/CA %.3F', $parms['CA']));
|
||||
$this->_put('/BM '.$parms['BM']);
|
||||
$this->_put('>>');
|
||||
$this->_put('endobj');
|
||||
}
|
||||
}
|
||||
|
||||
function _putresourcedict()
|
||||
{
|
||||
parent::_putresourcedict();
|
||||
$this->_put('/ExtGState <<');
|
||||
foreach($this->extgstates as $k=>$extgstate)
|
||||
$this->_put('/GS'.$k.' '.$extgstate['n'].' 0 R');
|
||||
$this->_put('>>');
|
||||
}
|
||||
|
||||
function _putresources()
|
||||
{
|
||||
$this->_putextgstates();
|
||||
parent::_putresources();
|
||||
}
|
||||
}
|
||||
?>
|
BIN
app/Http/Controllers/Auth/logo.jpg
Normal file
BIN
app/Http/Controllers/Auth/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
389
app/Http/Controllers/documentCreators.php
Normal file
389
app/Http/Controllers/documentCreators.php
Normal file
@ -0,0 +1,389 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use Codedge\Fpdf\Fpdf\Fpdf;
|
||||
use DB;
|
||||
use App\fireStation;
|
||||
use Carbon;
|
||||
use Illuminate\Routing\Controller;
|
||||
use App\Http\Controllers\AlphaPDF;
|
||||
|
||||
class documentCreators extends Fpdf
|
||||
{
|
||||
public function textConvert($text){
|
||||
return iconv('utf-8','iso-8859-2',$text);
|
||||
}
|
||||
|
||||
public function setWatermark($pdf){
|
||||
$pdf->SetAlpha(0.5);
|
||||
$pdf->Image('/home/czup/PhpstormProjects/untitled7/eOSP2/app/Http/Controllers/logo.jpg',120,30,100);
|
||||
$pdf->SetAlpha(1);
|
||||
}
|
||||
|
||||
public function createSingleOperationPDF2($operationID){
|
||||
|
||||
$operation = DB::table('operations')->where([
|
||||
['operations.fireStationID', "=", auth()->user()->fireStationID],
|
||||
['operations.id', '=', $operationID],
|
||||
])
|
||||
->whereNull('deleted_at')
|
||||
->leftJoin('users', 'operations.commanderID', '=', 'users.id')
|
||||
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
|
||||
->first();
|
||||
|
||||
$fireFighters = array();
|
||||
$trucks = array();
|
||||
|
||||
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
|
||||
->Join('operationsMembers', function ($join) use($operationID){
|
||||
$join->on('users.id', '=', 'operationsMembers.memberID');
|
||||
$join->where('operationsMembers.operationID', '=', $operationID);
|
||||
})
|
||||
->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport')
|
||||
->get();
|
||||
|
||||
$trucks = DB::table('vehicles')->where([
|
||||
["vehicles.fireStationID", "=", auth()->user()->fireStationID ],
|
||||
])
|
||||
->Join('operationsTrucks', function ($join) use($operationID){
|
||||
$join->on('vehicles.id', '=', 'operationsTrucks.truckID');
|
||||
$join->where('operationsTrucks.operationID', '=', $operationID);
|
||||
})
|
||||
->leftJoin('users', 'operationsTrucks.driverID', '=', 'users.id')
|
||||
->select('vehicles.*', 'operationsTrucks.truckID', 'operationsTrucks.driverID', 'users.name as driverName', 'users.surname as driverSurname')
|
||||
->get();
|
||||
|
||||
|
||||
|
||||
$pdf = new AlphaPDF();
|
||||
$fill = false;
|
||||
$pdf->AddPage();
|
||||
$pdf->AddFont('arialpl', '', 'arialpl.php');
|
||||
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(40,10, $this->textConvert("Data wyjazdu:"));
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(60,10,$this->textConvert($operation->operationDate), 0, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Miejsce:"));
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(40,10,$this->textConvert($operation->location), 0, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(15,10, $this->textConvert("Cel:"));
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(80,10,$this->textConvert($operation->target), 0, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(55,10, $this->textConvert("Rodzaj zagrożenia:"));
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(60,10,$this->textConvert($operation->dangerType), 0, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(35,10, $this->textConvert("Dowodzący:"));
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(60,10,$this->textConvert($operation->name.' '.$operation->surname), 0, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(0,10, $this->textConvert("Opis Wyjazdu"),0,1,'C');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Write(8,$this->textConvert($operation->description));
|
||||
$pdf->Ln();
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(28,10, $this->textConvert("Członkowie wyjazdu:"));
|
||||
$pdf->Ln();
|
||||
$pdf->SetFillColor(152,152,152);
|
||||
$pdf->Cell(135,10, $this->textConvert("Członkowie akcji"), 1, 0, 'C', true);
|
||||
$pdf->Cell(55,10, $this->textConvert("Transport własny"), 1, 0, 'C', true);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$fill = false;
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
foreach( $fireFighters as $fireFighter){
|
||||
$text = $fireFighter->name." ".$fireFighter->surname;
|
||||
$pdf->Cell(135,10,$this->textConvert($text), 1, 0, '', $fill);
|
||||
if($fireFighter->privateTransport == 1){
|
||||
$privateTransport = 'Tak';
|
||||
}else{
|
||||
$privateTransport = 'Nie';
|
||||
}
|
||||
$pdf->Cell(55,10,$this->textConvert($privateTransport), 1, 0, 'C', $fill);
|
||||
$pdf->Ln();
|
||||
|
||||
$fill = !$fill;
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(28,10, $this->textConvert("Pojazdy biorące udział w akcji:"));
|
||||
$pdf->Ln();
|
||||
$pdf->SetFillColor(152,152,152);
|
||||
$pdf->Cell(115,10, $this->textConvert("Pojazd"), 1, 0, 'C', true);
|
||||
$pdf->Cell(75,10, $this->textConvert("Kierowca"), 1, 0, 'C', true);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$fill = false;
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
foreach( $trucks as $truck){
|
||||
$pdf->Cell(115,10,$this->textConvert($truck->name.' '.$truck->brand.' '.$truck->registrationNumber), 1, 0, '', $fill);
|
||||
$pdf->Cell(75,10,$this->textConvert($truck->driverName.' '.$truck->driverSurname), 1, 0, 'C', $fill);
|
||||
$pdf->Ln();
|
||||
$fill = !$fill;
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
|
||||
// $this->setWatermark($pdf);
|
||||
$pdf->Ln();
|
||||
$pdf->Output();
|
||||
exit;
|
||||
}
|
||||
|
||||
public function createAllOperationsPDF($fireSationID){
|
||||
|
||||
$operations = DB::table('operations')->where('operations.fireStationID', "=", $fireSationID)
|
||||
->whereNull('deleted_at')
|
||||
->leftJoin('users', 'operations.commanderID', '=', 'users.id')
|
||||
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
|
||||
->get();
|
||||
|
||||
$pdf = new AlphaPDF();
|
||||
$fill = false;
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->AddFont('arialpl', '', 'arialpl.php');
|
||||
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
|
||||
|
||||
$pdf->SetFont('arialpl','B',20);
|
||||
$pdf->Cell(190,10, $this->textConvert("Lista wyjazdów:"),0,0,'C');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',14);
|
||||
$pdf->SetFillColor(152,152,152);
|
||||
$pdf->Cell(10,10, $this->textConvert("#"), 1, 0, 'C', true);
|
||||
$pdf->Cell(50,10, $this->textConvert("Data"), 1, 0, 'C', true);
|
||||
$pdf->Cell(50,10, $this->textConvert("Miejsce"), 1, 0, 'C', true);
|
||||
$pdf->Cell(60,10, $this->textConvert("Cel"), 1, 0, 'C', true);
|
||||
$pdf->Cell(40,10, $this->textConvert("Rodzaj zagrożenia"), 1, 0, 'C', true);
|
||||
$pdf->Cell(60,10, $this->textConvert("Dowódca"), 1, 0, 'C', true);
|
||||
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$fill = false;
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$i=1;
|
||||
foreach( $operations as $operation){
|
||||
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
|
||||
$pdf->Cell(50,10,$this->textConvert($operation->operationDate), 1, 0, '', $fill);
|
||||
$pdf->Cell(50,10,$this->textConvert($operation->location), 1, 0, '', $fill);
|
||||
$pdf->Cell(50,10,$this->textConvert($operation->target), 1, 0, '', $fill);
|
||||
$pdf->Ln();
|
||||
$fill = !$fill;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->Output();
|
||||
exit;
|
||||
}
|
||||
|
||||
public function createSingleUnitPDF(){
|
||||
$fireStation = fireStation::find(auth()->user()->fireStationID);
|
||||
$pdf = new AlphaPDF();
|
||||
$fill = false;
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->AddFont('arialpl', '', 'arialpl.php');
|
||||
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
|
||||
|
||||
$pdf->SetFont('arialpl','B',20);
|
||||
$pdf->Cell(190,10, $this->textConvert($fireStation->name),0,0,'C');
|
||||
$pdf->Ln();
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(45,10, $this->textConvert("Województwo:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(40,10, $this->textConvert($fireStation->voivodeship),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Powiat:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->county),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(85,10, $this->textConvert("Gmina i numer Ewidencyjny:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->community.' '.$fireStation->number),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(85 ,10, $this->textConvert("Kod pocztowy, Miejscowość:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->zipCode.' '.$fireStation->name),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(45,10, $this->textConvert("Ulica i Numer:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->address),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(100,10, $this->textConvert("Szerokość i długość geograficzna:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(0,10, $this->textConvert($fireStation->latitude.'° | '.$fireStation->longitude.'°'),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(20,10, $this->textConvert("KRS:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->KRS),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(20,10, $this->textConvert("NIP:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->NIP),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(30,10, $this->textConvert("Telefon:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->phoneNumber),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Email:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($fireStation->email),0,0,'');
|
||||
$pdf->Ln();
|
||||
$pdf->Output();
|
||||
exit;
|
||||
}
|
||||
|
||||
public function createSingleFireFighterPDF($userID){
|
||||
|
||||
$user = DB::table('users')->where("users.id", '=', $userID)
|
||||
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
|
||||
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
|
||||
->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email','users.phoneNumber', 'users.number', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
|
||||
->first();
|
||||
|
||||
$userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', $userID)
|
||||
->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id')
|
||||
->whereNull('deleted_at')
|
||||
->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry')
|
||||
->get();
|
||||
|
||||
$userDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $userID)
|
||||
->whereNull('decorationsFirefighters.deleted_at')
|
||||
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
|
||||
->get();
|
||||
|
||||
$pdf = new AlphaPDF();
|
||||
$fill = false;
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->AddFont('arialpl', '', 'arialpl.php');
|
||||
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
|
||||
|
||||
|
||||
$pdf->SetFont('arialpl','B',20);
|
||||
$pdf->Cell(190,10, $this->textConvert($user->name.' '.$user->surname),0,0,'C');
|
||||
$pdf->Ln();
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Pesel:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->PESEL),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Telefon:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->phoneNumber),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(25,10, $this->textConvert("Email:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->email ),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(60,10, $this->textConvert("Numer ewidencyjny:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->number ),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(30,10, $this->textConvert("Stopień:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->rank ),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(30,10, $this->textConvert("Funkcja:"),0,0,'');
|
||||
$pdf->SetFont('arialpl','',16);
|
||||
$pdf->Cell(30,10, $this->textConvert($user->unitFunction ),0,0,'');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(190,10, $this->textConvert("Ukończone szkolenia:"),0,0,'C');
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',14);
|
||||
$pdf->SetFillColor(152,152,152);
|
||||
$pdf->Cell(10,10, $this->textConvert("#"), 1, 0, 'C', true);
|
||||
$pdf->Cell(100,10, $this->textConvert("Szkolenie"), 1, 0, 'C', true);
|
||||
$pdf->Cell(40,10, $this->textConvert("Data ukończenia"), 1, 0, 'C', true);
|
||||
$pdf->Cell(40,10, $this->textConvert("Data ważności"), 1, 0, 'C', true);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$fill = false;
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$i=1;
|
||||
foreach( $userTrainings as $userTraining){
|
||||
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
|
||||
$pdf->Cell(100,10,$this->textConvert($userTraining->trainingName), 1, 0, '', $fill);
|
||||
$pdf->Cell(40,10,$this->textConvert($userTraining->dateOfComplete), 1, 0, 'C', $fill);
|
||||
$pdf->Cell(40,10,$this->textConvert($userTraining->dateOfExpiry), 1, 0, 'C', $fill);
|
||||
$pdf->Ln();
|
||||
$fill = !$fill;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',16);
|
||||
$pdf->Cell(190,10, $this->textConvert("Nadane odznaczenia:"),0,0,'C');
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont('arialpl','B',14);
|
||||
$pdf->SetFillColor(152,152,152);
|
||||
$pdf->Cell(10,10, $this->textConvert("#"), 1, 0, 'C', true);
|
||||
$pdf->Cell(140,10, $this->textConvert("Odznaczenie"), 1, 0, 'C', true);
|
||||
$pdf->Cell(40,10, $this->textConvert("Data przyznania"), 1, 0, 'C', true);;
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$fill = false;
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$i=1;
|
||||
foreach( $userDecorations as $userDecoration){
|
||||
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
|
||||
$pdf->Cell(140,10,$this->textConvert($userDecoration->decorationName), 1, 0, '', $fill);
|
||||
$pdf->Cell(40,10,$this->textConvert($userDecoration->dateOfAward), 1, 0, 'C', $fill);
|
||||
$pdf->Ln();
|
||||
$fill = !$fill;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->Output();
|
||||
exit;
|
||||
}
|
||||
}
|
@ -140,5 +140,21 @@ class fireFightersController extends Controller
|
||||
return fireFightersController::create();
|
||||
}
|
||||
|
||||
public function createSingleFireFighterPDF(){
|
||||
if (auth()->user() != null && auth()->user()->fireStationID != null) {
|
||||
$request = request();
|
||||
$test = new documentCreators();
|
||||
$test->createSingleFireFighterPDF($request->userID);
|
||||
}
|
||||
}
|
||||
|
||||
public function CreateAllFireFightersPDF(){
|
||||
if (auth()->user() != null && auth()->user()->fireStationID != null) {
|
||||
$request = request();
|
||||
$test = new documentCreators();
|
||||
$test->createSingleFireFighterPDF($request->userID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -155,4 +155,12 @@ class fireStationController extends Controller
|
||||
|
||||
return redirect()->to('/jednostka');;
|
||||
}
|
||||
|
||||
public function createSingleUnitPDF(){
|
||||
if (auth()->user() != null && auth()->user()->fireStationID != null) {
|
||||
$request = request();
|
||||
$test = new documentCreators();
|
||||
$test->createSingleUnitPDF($request->fireStationID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
app/Http/Controllers/logo.jpg
Normal file
BIN
app/Http/Controllers/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@ -9,6 +9,8 @@ use App\operationsMembers;
|
||||
use App\vehicle;
|
||||
use App\operationsDrivers;
|
||||
use App\operationsTrucks;
|
||||
use App\Http\Controllers\documentCreators;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
@ -275,4 +277,20 @@ class operationsController extends Controller
|
||||
'success' => 'Record deleted successfully!'
|
||||
]);
|
||||
}
|
||||
|
||||
public function createSingleOperationPDF(){
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ) {
|
||||
$request = request();
|
||||
$test = new documentCreators();
|
||||
$test->createSingleOperationPDF2($request->operationID );
|
||||
}
|
||||
}
|
||||
|
||||
public function createAllOperationsPDF(){
|
||||
if (auth()->user() != null && auth()->user()->fireStationID != null) {
|
||||
$request = request();
|
||||
$test = new documentCreators();
|
||||
$test->createAllOperationsPDF($request->fireStationID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ class userProfileController extends Controller
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
$userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', auth()->user()->id)
|
||||
->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id')
|
||||
->whereNull('deleted_at')
|
||||
->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry')
|
||||
->get();
|
||||
return view("userTrainings", ["userTrainings" => $userTrainings]);
|
||||
|
@ -19,7 +19,7 @@ class CreateOperationsTable extends Migration
|
||||
$table->string('location', 100);
|
||||
$table->string('target', 100);
|
||||
$table->string('dangerType', 100);
|
||||
$table->string('description');
|
||||
$table->longtext('description');
|
||||
$table->integer('commanderID');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
@ -98,6 +98,11 @@
|
||||
<td>
|
||||
<a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||
<a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a>
|
||||
<form action="strazacy/pdf/single/" method="post" style="display:inline;">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" class="form-control" name="userID" value="{{$user->id}}">
|
||||
<button class="btn btn-dark" type="submit">Drukuj</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- <tr>--}}
|
||||
|
@ -15,6 +15,15 @@
|
||||
@if( auth()->user()->fireStationID == NULL)
|
||||
Jednostka nie istnieje
|
||||
@else
|
||||
|
||||
<form action="wyjazdy/pdf/all/" method="post" style="display:inline;">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" class="form-control" name="fireStationID" value="{{auth()->user()->fireStationID}}">
|
||||
<button class="btn btn-dark" type="submit">Drukuj wszystkie</button>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -25,7 +34,7 @@
|
||||
<th>Rodzaj zagrożenia</th>
|
||||
<th>Dowódca</th>
|
||||
<th>Operacja</th>
|
||||
<th>Szczegóły</th> <tbody>
|
||||
<th>Szczegóły</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@ -44,6 +53,11 @@
|
||||
<td>
|
||||
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
|
||||
<form action="wyjazdy/pdf/single/" method="post" style="display:inline;">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" class="form-control" name="operationID" value="{{$operation->id}}">
|
||||
<button class="btn btn-dark" type="submit">Drukuj</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button>
|
||||
|
@ -17,6 +17,13 @@
|
||||
@include('inc.addFireStation')
|
||||
@else
|
||||
<div>
|
||||
|
||||
<form action="jednostka/pdf/single/" method="post" style="display:inline;">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" class="form-control" name="fireStationID" value="{{auth()->user()->fireStationID}}">
|
||||
<button class="btn btn-dark" type="submit">Drukuj informacje</button>
|
||||
</form>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
@ -63,6 +70,7 @@
|
||||
<td>{{ $fireStation-> email }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
@endif
|
||||
|
@ -38,6 +38,8 @@ Route::post('/wyjazdy', 'operationsController@store')->name('operationController
|
||||
Route::post('/wyjazdy/edit/', 'operationsController@update')->name('operationController.update');
|
||||
Route::get('/wyjazdy/edit/{id}', 'operationsController@editForm');
|
||||
Route::delete('wyjazdy/{id}', 'operationsController@destroy')->name('operationController.destroy');
|
||||
Route::post('wyjazdy/pdf/single/', 'operationsController@createSingleOperationPDF');
|
||||
Route::post('wyjazdy/pdf/all/', 'operationsController@createAllOperationsPDF');
|
||||
|
||||
Route::get('/register', 'RegistrationController@create');
|
||||
Route::post('/register', 'RegistrationController@store');
|
||||
@ -54,6 +56,7 @@ Route::get('/strazacy/add', 'fireFightersController@addForm');
|
||||
Route::post('/strazacy', 'fireFightersController@store');
|
||||
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
|
||||
Route::post('/strazacy/edit', 'fireFightersController@update');
|
||||
Route::post('/strazacy/pdf/single/', 'fireFightersController@createSingleFireFighterPDF');
|
||||
|
||||
Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
|
||||
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
|
||||
@ -63,6 +66,7 @@ Route::get('/jednostka', 'fireStationController@create');
|
||||
Route::post('/jednostka', 'fireStationController@store');
|
||||
Route::get('/jednostka/edit', 'fireStationController@editForm');
|
||||
Route::post('/jednostka/edit', 'fireStationController@update');
|
||||
Route::post('jednostka/pdf/single/', 'fireStationController@createSingleUnitPDF');
|
||||
|
||||
Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
|
||||
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
|
||||
|
Loading…
Reference in New Issue
Block a user