Commit 96a9096d authored by PedroLopesUPE's avatar PedroLopesUPE
Browse files

Adição de dados do usuário na geração de PDF e re-estilização do PDF gerado

Incompatibilidade da biblioteca encontrado: Algum processo dificulta a geração de imagens e textos em mesma linha ao carregar HTML.
parent 42f3737c
......@@ -111,6 +111,11 @@ class UserPadController extends Controller
public function generatePDF($user_pad_id)
{
$user_id = UserPad::wherePadId($user_pad_id)->first()->{'id'};
$user_data = [
'nome' => User::whereId($user_id)->first()->{'name'},
'email' => User::whereId($user_id)->first()->{'email'}
];
$ensinoTotalHoras =
EnsinoAtendimentoDiscente::whereUserPadId($user_pad_id)->sum('ch_semanal')
+ EnsinoAula::whereUserPadId($user_pad_id)->sum('ch_semanal')
......@@ -183,7 +188,6 @@ class UserPadController extends Controller
PadTables::tablesPesquisa($user_pad_id)[2]['name'] => $userPad->pesquisaOrientacoes->toArray(),
PadTables::tablesPesquisa($user_pad_id)[3]['name'] => $userPad->pesquisaOutros->toArray()
];
$dateTime = now()->format('d-m-Y (H:i:s)');
// Geração de array tratado a partir do modelo
$treated_model = [];
......@@ -373,21 +377,29 @@ class UserPadController extends Controller
}
}
date_default_timezone_set("America/Recife");
$dateTime = now()->format('d/m/Y (H:i:s)');
$data = array(
'model' =>$treated_model,
'date' => $dateTime,
'user' => $user_data,
'model' => $treated_model,
'horas' => $horas
);
// $treated_model = Arr::add($treated_model, '1.2.4. Ensino', "Abc");
// dd(
// // $userPad->pesquisaCoordenacoes->toArray(),
// // ($model['extensao']['1. EXTENSÃO (COORDENAÇÃO DE ATIVIDADES DE EXTENSÃO HOMOLOGADA NA PROEC)']),
// public_path('images\estado_pe_logo.png'),
// // public_path('\images\estado_pe_logo.png'),
// // url('images\estado_pe_logo.png'),
// // asset('images\estado_pe_logo.png'),
// $user_data,
// $treated_model,
// // array_values($model['ensino'])[0],
// // array_values($model['ensino'])[0][0],
// // array_values($model['ensino'])[0][0]['cod_atividade'],
// // $ensinoTotalHoras,
// $model,
// // $model,
// // $horas,
// // $data,
// // $model['ensino']['8. ENSINO (COORDENAÇÃO OU MEMBRO DE NÚCLEO DOCENTE ESTRUTURANTE OU NÚCLEO DOCENTE ESTRUTURANTE ASSISTENCIAL)'] == null,
......
<header style="display: flex; direction: rtl">
</header>
<div style="display: flex; flex-direction: column; gap: 2.5rem">
@foreach ($data['model'] as $nome_dimensao=>$dimensao)
<h1 style="font-size: 16px; font-weight: bold">
{{$nome_dimensao}}
</h1>
<div>
@foreach ($dimensao as $nome_categoria=>$categoria)
<h4 style="font-size: 14px">
{{$nome_categoria}}
</h4>
@foreach ($categoria as $nome_item=>$item)
<ul style="font-size: 14px">
@foreach ($item as $nome_tarefa=>$tarefa)
<li style="font-weight: bold">
{{$nome_tarefa}}
</li>
<ul style="font-size: 13px">
@foreach ($tarefa as $nome_valor=>$valor)
<li>
{{$nome_valor}}: {{$valor}}
</li>
@endforeach
<body style="width: 210mm; display: flex; flex-direction: column; max-width: 190mm">
<header style="display: flex; flex-direction: row; padding: 3mm 4mm 0mm 4mm">
<img style="width: 300px; height: max-content; align-self: center" src="{{public_path('images\estado_pe_logo.png')}}" alt="Logo Pernambuco">
<div style="display: flex; flex-direction: column; max-width: 100mm">
<p style="margin: 1.1mm"><span>Autor do PAD: {{$data['user']['nome']}}</span></p>
<p style="margin: 1.1mm"><span>E-mail do Autor: {{$data['user']['email']}}</span></p>
<p style="margin: 1.1mm"><span>PDF gerado em: {{$data['date']}}</span></p>
</div>
</header>
<div style="display: flex; flex-direction: column; padding-left:5mm; gap: 10mm">
@foreach ($data['model'] as $nome_dimensao=>$dimensao)
<h1 style="font-size: 16px; font-weight: bold">
{{$nome_dimensao}}
</h1>
@foreach ($dimensao as $nome_categoria=>$categoria)
<h4 style="font-size: 14px">
{{$nome_categoria}}
</h4>
@foreach ($categoria as $nome_item=>$item)
<ul style="font-size: 14px">
@foreach ($item as $nome_tarefa=>$tarefa)
<li style="font-weight: bold">
{{$nome_tarefa}}
</li>
<ul style="font-size: 13px">
@foreach ($tarefa as $nome_valor=>$valor)
<li>
{{$nome_valor}}: {{$valor}}
</li>
@endforeach
</ul>
@endforeach
</ul>
@endforeach
</ul>
<div style="height: 1.5rem"></div>
<div style="height: 6mm"></div>
@endforeach
<div style="height: 4.5mm"></div>
@endforeach
<div style="height: 1rem"></div>
<ul style="font-size: 14px; list-style-type: square">
<li>TOTAL DE HORAS: {{ $data['horas'][$nome_dimensao] }}</li>
</ul>
</div>
@endforeach
<ul style="font-size: 14px; list-style-type: square">
<li>TOTAL DE HORAS: {{ $data['horas'][$nome_dimensao] }}</li>
</ul>
</div>
@endforeach
</div>
\ No newline at end of file
<footer style="padding-top: 4mm; margin-top: 4mm; border-top: 1px solid #000; text-align: center;">
<u>
Copyright &copy;2022. Universidade de Pernambuco - Todos os direitos reservados
</u>
</footer>
</body>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment