Update of elemental tasks cards and bug fixes for them

This commit is contained in:
ygbanzato 2024-06-26 10:54:36 +01:00
parent 215452f58f
commit e9165fd5d3
24 changed files with 6230 additions and 2719 deletions

View File

@ -12,10 +12,10 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule): void protected function schedule(Schedule $schedule): void
{ {
//Para atualizar a Obra para execussao quando chegar na hora estipulada. // Para atualizar a Obra para execução quando chegar na hora estipulada.
$schedule->call(function () { $schedule->call(function () {
\App\Models\CompanyProject::where('order_project', 2) \App\Models\CompanyProject::where('order_project', 2)
->where('date_started', '>=', now()) ->where('date_started', '<=', now())
->update(['order_project' => 3]); ->update(['order_project' => 3]);
})->everyMinute(); // Ou ajuste para a frequência desejada })->everyMinute(); // Ou ajuste para a frequência desejada
@ -24,7 +24,7 @@ protected function schedule(Schedule $schedule): void
$schedule->call(function () { $schedule->call(function () {
// Define o limite de inatividade, por exemplo, sessões não atualizadas nos últimos 1 minutos // Define o limite de inatividade, por exemplo, sessões não atualizadas nos últimos 1 minutos
$inactiveLimit = now()->subMinutes(1); $inactiveLimit = now()->subMinutes(1);
// Atualiza sessões inativas // Atualiza sessões inativas
\App\Models\ControlEquipmentWorkstation::where('status', 1) \App\Models\ControlEquipmentWorkstation::where('status', 1)
->whereNull('departure_date') ->whereNull('departure_date')
@ -35,7 +35,7 @@ protected function schedule(Schedule $schedule): void
'elemental_tasks_id' => null, 'elemental_tasks_id' => null,
'entry_date' => null, 'entry_date' => null,
]); ]);
})->everyMinute(); })->everyMinute();
} }
@ -44,7 +44,7 @@ protected function schedule(Schedule $schedule): void
*/ */
protected function commands(): void protected function commands(): void
{ {
$this->load(__DIR__.'/Commands'); $this->load(__DIR__ . '/Commands');
require base_path('routes/console.php'); require base_path('routes/console.php');
} }

View File

@ -131,6 +131,8 @@ public function createPDFforcompletedEquipment($equipmentId)
// Gera e retorna o PDF // Gera e retorna o PDF
return $pdfWrapper return $pdfWrapper
// ->setIncludePath('$PATH:/usr/bin')
->loadView('projectsClients.pdf.testePdf', [ ->loadView('projectsClients.pdf.testePdf', [
'tag' => $detailsEquipment->equipment_tag, 'tag' => $detailsEquipment->equipment_tag,
'numeroPanini' => $detailsEquipmentWorkHistory->ispt_number, 'numeroPanini' => $detailsEquipmentWorkHistory->ispt_number,
@ -141,6 +143,7 @@ public function createPDFforcompletedEquipment($equipmentId)
'projectLogoPath' => $projectLogoPath, 'projectLogoPath' => $projectLogoPath,
'companyLogoPath' => $companyLogoPath 'companyLogoPath' => $companyLogoPath
]) ])
->stream('ispt40.pdf'); ->stream('ispt40.pdf');
} }

View File

@ -85,7 +85,7 @@ public function receiveQuestionsEquipment($equipmentID)
public function receiveAnswersEquipment(Request $request, $control_equipment_workstation_id) public function receiveAnswersEquipment(Request $request, $control_equipment_workstation_id)
{ {
// dd($request);
//No request recebemos ID(NUmero da tarela elementar) , esta variavel vai receber este ID apos selerar o id da string //No request recebemos ID(NUmero da tarela elementar) , esta variavel vai receber este ID apos selerar o id da string
// $elementalTaskID = 0; // $elementalTaskID = 0;
// Deve receber as perguntas e respostas para a tarefa selecionada // Deve receber as perguntas e respostas para a tarefa selecionada

View File

@ -198,7 +198,6 @@ public function compose(View $view)
$allTasksCompleted = $taskIds->every(function ($taskId) use ($taskCountsInControlRecords) { $allTasksCompleted = $taskIds->every(function ($taskId) use ($taskCountsInControlRecords) {
return isset($taskCountsInControlRecords[$taskId]) && $taskCountsInControlRecords[$taskId] > 0; return isset($taskCountsInControlRecords[$taskId]) && $taskCountsInControlRecords[$taskId] > 0;
}); });
// $allTasksCompleted vai ter TRUE, apenas quando se verificar todos as tarefas foram feitas no equipamento. // $allTasksCompleted vai ter TRUE, apenas quando se verificar todos as tarefas foram feitas no equipamento.
if ($allTasksCompleted) { if ($allTasksCompleted) {
$changeEquipmentStatus = EquipmentWorkHistory::where('equipmentWorkHistorys_id', $equipment->equipmentWorkHistoryId)->first(); $changeEquipmentStatus = EquipmentWorkHistory::where('equipmentWorkHistorys_id', $equipment->equipmentWorkHistoryId)->first();

View File

@ -1,243 +1,5 @@
<?php <?php
// namespace App\Services;
// use Spatie\Browsershot\Browsershot;
// use Illuminate\Http\Response;
// class PdfWrapper
// {
// protected Browsershot $pdfGenerator;
// protected string $html;
// protected string $headerHtml;
// protected string $footerHtml;
// public function __construct()
// {
// $this->pdfGenerator = new Browsershot();
// $this->headerHtml = view('projectsClients.pdf._header')->render();
// $this->footerHtml = view('projectsClients.pdf._footer')->render();
// }
// // Load view and render HTML
// public function loadView(string $bladeFile, array $data = []): self
// {
// $this->html = view($bladeFile, $data)->render();
// return $this;
// }
// // Load raw HTML
// public function loadHtml(string $html): self
// {
// $this->html = $html;
// return $this;
// }
// // Load HTML from a URL
// public function loadUrl(string $url): self
// {
// $this->html = file_get_contents(url($url));
// return $this;
// }
// // Generate the PDF using Browsershot
// public function generate(): Browsershot
// {
// return $this->pdfGenerator
// ->html($this->html)
// ->format('A4')
// ->margins(10, 20, 10, 20)
// ->showBrowserHeaderAndFooter()
// ->headerHtml($this->headerHtml)
// ->footerHtml($this->footerHtml)
// ->waitUntilNetworkIdle();
// }
// // Save the PDF to the server in the public folder
// public function save(string $path): void
// {
// $this->generate()->savePdf($path);
// }
// // Download the PDF with a specified filename
// public function download(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
// 'Content-Length' => strlen($pdf)
// ]);
// }
// // Stream the PDF in the browser
// public function stream(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'inline; filename="'.$filename.'"'
// ]);
// }
// }
// namespace App\Services;
// use Spatie\Browsershot\Browsershot;
// use Illuminate\Http\Response;
// class PdfWrapper
// {
// protected Browsershot $pdfGenerator;
// protected string $html;
// public function __construct()
// {
// $this->pdfGenerator = new Browsershot();
// }
// // Load view and render HTML
// public function loadView(string $bladeFile, array $data = []): self
// {
// $this->html = view($bladeFile, $data)->render();
// return $this;
// }
// // Load raw HTML
// public function loadHtml(string $html): self
// {
// $this->html = $html;
// return $this;
// }
// // Load HTML from a URL
// public function loadUrl(string $url): self
// {
// $this->html = file_get_contents(url($url));
// return $this;
// }
// // Generate the PDF using Browsershot
// public function generate(): Browsershot
// {
// return $this->pdfGenerator
// ->html($this->html)
// ->format('A4')
// // ->margins(10, 10, 10, 10)
// ->scale(0.7)
// ->fullPage()
// ->setOption('printBackground',true)
// ->waitUntilNetworkIdle();
// }
// // Save the PDF to the server in the public folder
// public function save(string $path): void
// {
// $this->generate()->savePdf($path);
// }
// // Download the PDF with a specified filename
// public function download(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
// 'Content-Length' => strlen($pdf)
// ]);
// }
// // Stream the PDF in the browser
// public function stream(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'inline; filename="'.$filename.'"'
// ]);
// }
// }
// namespace App\Services;
// use Spatie\Browsershot\Browsershot;
// use Illuminate\Http\Response;
// use Illuminate\Support\Facades\File;
// class PdfWrapper
// {
// protected Browsershot $pdfGenerator;
// protected string $html;
// public function __construct()
// {
// $this->pdfGenerator = new Browsershot();
// }
// // Load view and render HTML
// public function loadView(string $bladeFile, array $data = []): self
// {
// // Convert image paths to base64
// if (isset($data['imagePaths']) && is_array($data['imagePaths'])) {
// $data['imagesBase64'] = array_map(function($path) {
// return $this->getImageBase64($path);
// }, $data['imagePaths']);
// }
// $this->html = view($bladeFile, $data)->render();
// return $this;
// }
// // Load raw HTML
// public function loadHtml(string $html): self
// {
// $this->html = $html;
// return $this;
// }
// // Load HTML from a URL
// public function loadUrl(string $url): self
// {
// $this->html = file_get_contents(url($url));
// return $this;
// }
// // Generate the PDF using Browsershot
// public function generate(): Browsershot
// {
// return $this->pdfGenerator
// ->html($this->html)
// ->format('A4')
// ->scale(0.7)
// ->fullPage()
// ->setOption('printBackground', true)
// ->waitUntilNetworkIdle();
// }
// // Save the PDF to the server in the public folder
// public function save(string $path): void
// {
// $this->generate()->savePdf($path);
// }
// // Download the PDF with a specified filename
// public function download(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
// 'Content-Length' => strlen($pdf)
// ]);
// }
// // Stream the PDF in the browser
// public function stream(string $filename)
// {
// $pdf = $this->generate()->pdf();
// return new Response($pdf, 200, [
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'inline; filename="'.$filename.'"'
// ]);
// }
// // Function to convert image to base64
// protected function getImageBase64($imagePath)
// {
// $path = public_path($imagePath);
// $type = pathinfo($path, PATHINFO_EXTENSION);
// $data = File::get($path);
// $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
// return $base64;
// }
// }
namespace App\Services; namespace App\Services;
use Spatie\Browsershot\Browsershot; use Spatie\Browsershot\Browsershot;

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +1,3 @@
{{-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
@page {
size: A4;
margin-top: 10px;
margin-bottom: 50px;
/* Ajuste conforme necessário */
}
body {
font-family: Arial, sans-serif;
font-size: 14px;
margin: 0;
padding: 0;
}
.page-break {
page-break-before: always;
}
header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
text-align: center;
margin-bottom: 100px;
}
footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 50px;
text-align: center;
}
.content {
margin-top: 170px;
/* Aumente para dar mais espaço para o cabeçalho */
margin-bottom: 50px;
/* Espaço para o rodapé */
padding: 0 20px;
}
</style>
</head>
<body>
<div class="container">
<header class="mb-3">
@include('projectsClients.pdf._header', compact('tag', 'numeroPanini', 'nObra', 'ambito', 'projectLogoPath', 'companyLogoPath'))
</header>
<div class="content">
{{ $slot }}
</div>
<footer>
@include('projectsClients.pdf._footer', ['pageCounter' => $pageCounter])
</footer>
</div>
</body>
</html> --}}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">

View File

@ -46,13 +46,13 @@
.col-1 { .col-1 {
margin-top: 2mm; margin-top: 2mm;
color: aqua; color: #09255C;
padding-left: 2mm; padding-left: 2mm;
} }
.col-2 { .col-2 {
color: aqua; color: #09255C;
margin-left: 10mm; margin-left: 10mm;
padding-left: 6mm; padding-left: 6mm;
} }

File diff suppressed because it is too large Load Diff

View File

@ -90,19 +90,12 @@
Route::get('getDetailsEquipmentQrcode', [ExecutionProjectController::class, 'getDetailsEquipmentQrcode'])->name('getDetailsEquipmentQrcode'); Route::get('getDetailsEquipmentQrcode', [ExecutionProjectController::class, 'getDetailsEquipmentQrcode'])->name('getDetailsEquipmentQrcode');
// Route::get('teste1', function () { Route::get('teste1', function () {
// return (new PdfWrapper) return (new PdfWrapper)
// ->loadView('projectsClients.pdf.testePdf', [ ->loadUrl('https://www.google.pt')
// 'card1' => 'Teste cartão 1' ->download('ispt40.pdf');
// ]) });
// ->download('ispt40.pdf');
// // return (new PdfWrapper)
// // ->loadUrl('https://www.google.pt')
// // ->download('ispt40.pdf');
// });
// Route::get('teste1', function () { // Route::get('teste1', function () {
// return (new App\Services\PdfWrapper) // return (new App\Services\PdfWrapper)
@ -136,25 +129,25 @@
// ->stream('ispt40.pdf'); // ->stream('ispt40.pdf');
// }); // });
Route::get('teste1', function () { // Route::get('teste1', function () {
$imagePaths = [ // $imagePaths = [
'receiveImagesControlEquipmentWorkstation/1926_3781/img1.png', // 'receiveImagesControlEquipmentWorkstation/1926_3781/img1.png',
'receiveImagesControlEquipmentWorkstation/1926_3781/img2.png', // 'receiveImagesControlEquipmentWorkstation/1926_3781/img2.png',
'receiveImagesControlEquipmentWorkstation/1926_3781/img3.png', // 'receiveImagesControlEquipmentWorkstation/1926_3781/img3.png',
]; // ];
return (new PdfWrapper) // return (new PdfWrapper)
->loadView('projectsClients.pdf.testePdf', [ // ->loadView('projectsClients.pdf.testePdf', [
'card1' => 'Teste cartão 1', // 'card1' => 'Teste cartão 1',
'tag' => 'TAG123', // 'tag' => 'TAG123',
'numeroPanini' => 'PANINI456', // 'numeroPanini' => 'PANINI456',
'nObra' => 'OBRA789', // 'nObra' => 'OBRA789',
'ambito' => 'Some Ambito', // 'ambito' => 'Some Ambito',
'imagePaths' => $imagePaths // Passa os caminhos das imagens para a view // 'imagePaths' => $imagePaths // Passa os caminhos das imagens para a view
]) // ])
->stream('ispt40.pdf'); // ->stream('ispt40.pdf');
}); // });