This commit is contained in:
ygbanzato 2024-09-11 18:19:12 +01:00
parent 476f31fe32
commit 461fc8328d
7 changed files with 297 additions and 217 deletions

View File

@ -42,11 +42,57 @@
class ProjectoDatacontroller extends Controller
{
public function completedEquipmentInProject(Request $request)
{
//Busca a ultima ocorrencia ou seja o ultima dado criado para deste equipamento para a obra atual.
$equipmentHistoryDetails = EquipmentWorkHistory::where('equipment_id', $request->equipment_id)
->where('company_projects_id', $request->company_projects_id)
->orderBy('equipmentWorkHistorys_id', 'desc') // Correct method for descending order
->first();
//Atualiza para o equipamento ir para os concluidos, mesmo sem fazer as tarefas.
$equipmentHistoryDetails->equipment_status_project = 1;
$equipmentHistoryDetails->justification_for_finalization = $request->reason;
$equipmentHistoryDetails->save();
//Recebe todas as tarefas ja feitas neste equipamento
$receiveTaskOfControl = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $equipmentHistoryDetails->equipmentWorkHistorys_id)
->whereNotNull('departure_date')
->where('status', '1')
->get();
//recebe todas as tarefas previamente associadas
$receiveAllTasksForEquipmentHistory = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $equipmentHistoryDetails->equipmentWorkHistorys_id)->get();
// Colete todos os 'elemental_tasks_id' da variável $receiveTaskOfControl
$taskControlIds = $receiveTaskOfControl->pluck('elemental_tasks_id')->toArray();
// Filtre as tarefas em $receiveAllTasksForEquipmentHistory que NÃO estão em $taskControlIds
$tasksToDelete = $receiveAllTasksForEquipmentHistory->filter(function ($task) use ($taskControlIds) {
return !in_array($task->elemental_tasks_id, $taskControlIds);
});
// Deleta as tarefas não correspondentes
if ($tasksToDelete->isNotEmpty()) {
OrderEquipmentTasks::whereIn('id', $tasksToDelete->pluck('id'))->delete();
}
// Voltar home da Obra em execussao
return redirect()->route('ExecutionProject', ['projectID' => $equipmentHistoryDetails->company_projects_id])
->with('success', 'Equipamento ' . $equipmentHistoryDetails->equipment->equipment_tag . 'foi alterado para "Concluido"');
}
public function createPDFforcompletedEquipment($equipmentId)
{
//Busca os detalhes do equipamento
$detailsEquipmentWorkHistory = EquipmentWorkHistory::where('equipment_id', $equipmentId)->first();
//Busca os detalhes do equipamento
$detailsEquipment = Equipment::where('equipment_id', $equipmentId)->first();
// Inicializa o array para armazenar os atributos específicos
$specificAttributesArray = [];
@ -73,8 +119,6 @@ public function createPDFforcompletedEquipment($equipmentId)
// Atribui o array de 'SpecificAttributes' ao modelo usando o método 'setAttribute'
$detailsEquipment->setAttribute('specificAttributes', $specificAttributesArray);
// dd($detailsEquipment);
// Recebe apenas as tarefas já feitas
$completedTasksHistory = ControlEquipmentWorkstation::with('workstationsTaskAnswers', 'receiveImages')
->where('equipmentWorkHistorys_id', $detailsEquipmentWorkHistory->equipmentWorkHistorys_id)
@ -103,8 +147,8 @@ public function createPDFforcompletedEquipment($equipmentId)
$latestDate = null;
}
// Apos receber todas as tarefas deve verificar qual o ambito atual e comparar em qual ambito foram feitas as tarefas, ai sim verificar oque foi feito no Ambito antigo e oque foi feito no atual.
// Apos receber todas as tarefas deve verificar qual o ambito atual e comparar em qual ambito foram feitas as tarefas, ai sim verificar oque foi feito no Ambito antigo e oque foi feito no atual.
// histórico de âmbitos por time_change_ambit do mais antigo ao mais recente
$receiveAmbitHistory = HistoryOfEquipmentAmbitsInTheProject::where('equipmentWorkHistorys_id', $detailsEquipmentWorkHistory->equipmentWorkHistorys_id)
->orderBy('time_change_ambit', 'desc')
@ -125,21 +169,27 @@ public function createPDFforcompletedEquipment($equipmentId)
// Contador para a ordem dos âmbitos
$ambitCounter = 1;
// Itera sobre cada âmbito anterior
foreach ($receiveAmbitHistory as $index => $ambitHistory) {
$ambitId = $ambitHistory->history_of_equipment_ambits_id;
// Verifica se há tarefas associadas a esse âmbito
if ($tasksByAmbit->has($ambitId)) {
$tasksForAmbit = $tasksByAmbit->get($ambitId);
foreach ($tasksForAmbit as $taskHistory) {
if ($ambitId == $latestAmbitHistory->history_of_equipment_ambits_id) {
// Se a tarefa pertence ao último âmbito (mais recente)
$taskHistory->cardTypeStyle = 'gray';
$taskHistory->typeStatusHistory = 'historic';
} else {
// Se a tarefa pertence a âmbitos anteriores
$taskHistory->cardTypeStyle = 'blue';
$taskHistory->AmbitHistoryTimeChange = $ambitHistory->time_change_ambit;
@ -154,8 +204,10 @@ public function createPDFforcompletedEquipment($equipmentId)
}
}
//
$workstationTaskAnswer = $taskHistory->workstationsTaskAnswers->first();
if ($workstationTaskAnswer && $workstationTaskAnswer->answer_json) {
$answersArray = json_decode($workstationTaskAnswer->answer_json, true);
$formattedAnswers = [];
@ -191,6 +243,7 @@ public function createPDFforcompletedEquipment($equipmentId)
return $group->sortByDesc('departure_date')->first();
});
// Define os caminhos das logos- Simbolo ISPT_4.0
$defaultLogoPath = '/img/ispt/4.0/Ispt4.0_Símbolo_Fundo_Azul-Marinho@2x-100.jpg';
@ -226,16 +279,13 @@ public function createPDFforcompletedEquipment($equipmentId)
]);
}
}
//Precisamos receber o Tipo de equipamento e detalhes da Obra, alem do atributos especificos de acordo com o tipo de equipamento.
// Converte as imagens para base64 usando o serviço PdfWrapper
$pdfWrapper = new PdfWrapper();
// Gera e retorna o PDF
return $pdfWrapper
// ->setIncludePath('$PATH:/usr/bin')
->loadView('projectsClients.pdf.testePdf', [

4
node_modules/.package-lock.json generated vendored
View File

@ -1,6 +1,6 @@
{
"name": "ispt4.0_erros (copy)",
"lockfileVersion": 2,
"name": "ispt4.0_Laravel",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@babel/code-frame": {

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "ispt4.0_erros (copy)",
"name": "ispt4.0_Laravel",
"lockfileVersion": 2,
"requires": true,
"packages": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -1,100 +1,9 @@
{{-- @php
$pageCounter = 1;
@endphp
<x-pdf-layout :tag="$tag" :numeroPanini="$numeroPanini" :nObra="$nObra" :ambito="$ambito" :projectLogoPath="$projectLogoPath"
:pageCounter="$pageCounter" :companyLogoPath="$companyLogoPath">
@foreach ($receiveAllTasksHistiory as $task_todo)
<div class="page-break"></div>
<div class="content">
@include('components.elemental-tasks', ['task_todo' => $task_todo])
<br>
<br>
<br>
@if (isset($taskImages[$task_todo->control_equipment_workstation_id]) && is_array($taskImages[$task_todo->control_equipment_workstation_id]))
<div class="row no-gutters">
@foreach ($taskImages[$task_todo->control_equipment_workstation_id] as $image)
<div class="col-4">
<img src="{{ public_path($image) }}" alt="Image" class="pdf-image"
style="border: 3px solid #00B0EA">
</div>
@endforeach
</div>
@endif
</div>
@php
$pageCounter++;
@endphp
@endforeach
</x-pdf-layout> --}}
{{-- <x-pdf-layout :tag="$tag" :numeroPanini="$numeroPanini" :nObra="$nObra" :ambito="$ambito" :projectLogoPath="$projectLogoPath"
:companyLogoPath="$companyLogoPath">
@php
$pageCounter = 1;
@endphp
@foreach ($receiveAllTasksHistiory as $task_todo)
<div class="page-break"></div>
<div class="container">
<header class="mb-3">
@include(
'projectsClients.pdf._header',
compact('tag', 'numeroPanini', 'nObra', 'ambito', 'projectLogoPath', 'companyLogoPath'))
</header>
<div class="content mr-4">
@include('components.elemental-tasks', ['task_todo' => $task_todo])
<br>
<br>
<br>
@if (isset($taskImages[$task_todo->control_equipment_workstation_id]) && is_array($taskImages[$task_todo->control_equipment_workstation_id]))
<div class="row no-gutters">
@foreach ($taskImages[$task_todo->control_equipment_workstation_id] as $image)
<div class="col-4">
<img src="{{ public_path($image) }}" alt="Image" class="pdf-image"
style="border: 3px solid #00B0EA">
</div>
@endforeach
</div>
@endif
</div>
<footer>
<div class="footer">
<div class="container">
<div class="row">
<div class="col-6 generated-at">
Generated at: {{ \Carbon\Carbon::now()->addHour()->format('Y-m-d H:i:s') }}
</div>
<div class="col-6 page-number">
Page: {{ $pageCounter }}
</div>
</div>
</div>
</div>
</footer>
</div>
@php
$pageCounter++;
@endphp
@endforeach
</x-pdf-layout> --}}
@extends('components.pdf-layout')
@php
$totalPages = count($receiveAllTasksHistiory) + 1; // Add 1 for the first page
@endphp
@section('firstPage')
<div class="container-frist-page">
@ -103,7 +12,7 @@
<!-- Header-frist-page -->
<div class="header-frist-page">
<img src="{{ public_path($isptLogoPath) }}" alt="Company Logo" class="img-fluid"
style="max-width: 150px; max-height: 150px; border:1px solid black">
style="max-width: 150px; max-height: 150px; padding: 5px;">
<div class="title">
<!-- PSV -->
@ -123,7 +32,7 @@
<div class="info">
<p> OBRA :<b>N/A</b>
<br>FICHA : {{ $detailsEquipmentWorkHistory->ispt_number }}
<br>FOLHA: 1 de 2
<br>PAGINA : 1 de {{ $totalPages }}
</p>
</div>
</div>
@ -141,60 +50,9 @@
</tr>
</table>
<!-- PSV -->
@if ($detailsEquipment->equipment_type_id == 3)
<!-- Specifications Table -->
{{-- <table class="spec-table">
<tr>
<th colspan="4" class="section-title">I - ESPECIFICAÇÕES TÉCNICAS PSV</th>
</tr>
<tr>
<td>TAG Válvula: <span>{{ $detailsEquipment->equipment_tag ?? 'N/A' }}</span></td>
<td>Descrição: <span>{{ $detailsEquipment->equipment_description ?? 'N/A' }}</span></td>
<td>N Série: <span>{{ $detailsEquipment->equipment_serial_number ?? 'N/A' }}</span></td>
<td>Marca: <span>{{ $detailsEquipment->equipment_brand ?? 'N/A' }}</span></td>
</tr>
<tr>
<td>Modelo: <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span></td>
<td>Dimensão: <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span></td>
<td>Rating: <span>{{ $detailsEquipment->specificAttributes[17]['value'] ?? 'N/A' }}</span></td>
<td>Dim Certa: <span>{{ $detailsEquipment->specificAttributes[10]['value'] ?? 'N/A' }}</span></td>
</tr>
<tr>
<td>Main Equipament: <span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td>P&ID: <span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span></td>
<td> SAP: <span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span></td>
<td>Manufacturer: <span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td>dn_ent: <span>{{ $detailsEquipment->specificAttributes[9]['value'] ?? 'N/A' }}</span></td>
<td>dn_sai: <span>{{ $detailsEquipment->specificAttributes[39]['value'] ?? 'N/A' }}</span></td>
<td>rating_flange_mount:
<span>{{ $detailsEquipment->specificAttributes[33]['value'] ?? 'N/A' }}</span>
</td>
<td>rating_flange_jusante:
<span>{{ $detailsEquipment->specificAttributes[34]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td>sp_bar_cold: <span>{{ $detailsEquipment->specificAttributes[19]['value'] ?? 'N/A' }}</span>
</td>
<td>back_presure_bar:
<span>{{ $detailsEquipment->specificAttributes[20]['value'] ?? 'N/A' }}</span>
</td>
<!-- Ainda falta criar no general_attributes_equipaments -->
<!-- <td colspan="2">decontamination:
<span>{{ $detailsEquipment->specificAttributes[34]['value'] ?? 'N/A' }}</span> </td> -->
</tr>
</table> --}}
<!-- PSV Specifications Table -->
<table class="spec-table">
<tr>
<th colspan="4" class="section-title">I - ESPECIFICAÇÕES TÉCNICAS PSV</th>
@ -213,17 +71,20 @@
<td><b>Rating:</b> <span>{{ $detailsEquipment->specificAttributes[17]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Dim Certa:</b>
<span>{{ $detailsEquipment->specificAttributes[10]['value'] ?? 'N/A' }}</span></td>
<span>{{ $detailsEquipment->specificAttributes[10]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>Main Equipament:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span></td>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>P&ID:</b> <span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b> SAP:</b> <span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Manufacturer:</b>
<span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span></td>
<span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>dn_ent:</b> <span>{{ $detailsEquipment->specificAttributes[9]['value'] ?? 'N/A' }}</span>
@ -231,75 +92,186 @@
<td><b>dn_sai:</b> <span>{{ $detailsEquipment->specificAttributes[39]['value'] ?? 'N/A' }}</span>
</td>
<td><b>rating_flange_mount:</b>
<span>{{ $detailsEquipment->specificAttributes[33]['value'] ?? 'N/A' }}</span></td>
<span>{{ $detailsEquipment->specificAttributes[33]['value'] ?? 'N/A' }}</span>
</td>
<td><b>rating_flange_jusante:</b>
<span>{{ $detailsEquipment->specificAttributes[34]['value'] ?? 'N/A' }}</span></td>
<span>{{ $detailsEquipment->specificAttributes[34]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>sp_bar_cold:</b>
<span>{{ $detailsEquipment->specificAttributes[19]['value'] ?? 'N/A' }}</span></td>
<td><b>back_presure_bar:</b>
<span>{{ $detailsEquipment->specificAttributes[20]['value'] ?? 'N/A' }}</span></td>
<td><b>Material:</b> <span>{{ $detailsEquipment->specificAttributes[9]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Isolamento:</b>
<span>{{ $detailsEquipment->specificAttributes[39]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Andaime:</b>
<span>{{ $detailsEquipment->specificAttributes[33]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Grua:</b>
<span>{{ $detailsEquipment->specificAttributes[34]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td colspan="2"><b>sp_bar_cold:</b>
<span>{{ $detailsEquipment->specificAttributes[19]['value'] ?? 'N/A' }}</span>
</td>
<td colspan="2"><b>back_presure_bar:</b>
<span>{{ $detailsEquipment->specificAttributes[20]['value'] ?? 'N/A' }}</span>
</td>
</tr>
</table>
<!-- CV -->
@elseif($detailsEquipment->equipment_type_id == 1)
<!-- Specifications Table -->
@elseif ($detailsEquipment->equipment_type_id == 1)
<!-- CV Specifications Table -->
<table class="spec-table">
<tr>
<th colspan="4" class="section-title">I - ESPECIFICAÇÕES TÉCNICAS CV</th>
</tr>
<tr>
<td>TAG Válvula: <span>PP.PCV-116</span></td>
<td>Tipo de Atuador: <span>Linear</span></td>
<td>Tipo de Válvula: <span>Controle</span></td>
<td>Atuador: <span>Rotativo</span></td>
<td><b>TAG Válvula:</b> <span>{{ $detailsEquipment->equipment_tag ?? 'N/A' }}</span></td>
<td><b>Descrição:</b> <span>{{ $detailsEquipment->equipment_description ?? 'N/A' }}</span></td>
<td><b>N Série:</b> <span>{{ $detailsEquipment->equipment_serial_number ?? 'N/A' }}</span></td>
<td><b>Marca:</b> <span>{{ $detailsEquipment->equipment_brand ?? 'N/A' }}</span></td>
</tr>
<tr>
<td>Fabricante da Válvula: <span>Fisher</span></td>
<td>Tipo de Atuador: <span>Eletro</span></td>
<td>Modelo da Válvula: <span>Globo Frontal</span></td>
<td>Atuador: <span>Pneumático</span></td>
<td><b>Modelo:</b> <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Dimensão:</b> <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Rating:</b> <span>{{ $detailsEquipment->specificAttributes[17]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Dim Certa:</b>
<span>{{ $detailsEquipment->specificAttributes[10]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td>Modelo de Atuador: <span>Fisher 1B</span></td>
<td colspan="3">Mais especificações aqui...</td>
<td><b>Main Equipament:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>P&ID:</b> <span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b> SAP:</b> <span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Material:</b> <span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>Fabricante:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Isolamento:</b>
<span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Fabricante do atuador:</b>
<span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Modelo do atuador:</b>
<span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>N. de série do atuador:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Fabricante do posicionador:</b>
<span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b>N. de série do posicionador:</b>
<span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Andaime:</b> <span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>Grua:</b> <span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
<td colspan="2"><b>sp_bar_cold:</b>
<span>{{ $detailsEquipment->specificAttributes[19]['value'] ?? 'N/A' }}</span>
</td>
<td colspan="2"><b>back_pressure_bar:</b>
<span>{{ $detailsEquipment->specificAttributes[20]['value'] ?? 'N/A' }}</span>
</td>
</tr>
</table>
<!-- ISV -->
@else
<!-- Specifications Table -->
@elseif($detailsEquipment->equipment_type_id == 2)
<!-- ISV Specifications Table -->
<table class="spec-table">
<tr>
<th colspan="4" class="section-title">I - ESPECIFICAÇÕES TÉCNICAS ISV</th>
</tr>
<tr>
<td>TAG Válvula: <span>PP.PCV-116</span></td>
<td>Tipo de Atuador: <span>Linear</span></td>
<td>Tipo de Válvula: <span>Controle</span></td>
<td>Atuador: <span>Rotativo</span></td>
<td><b>TAG Válvula:</b> <span>{{ $detailsEquipment->equipment_tag ?? 'N/A' }}</span></td>
<td><b>Descrição:</b> <span>{{ $detailsEquipment->equipment_description ?? 'N/A' }}</span></td>
<td><b>N Série:</b> <span>{{ $detailsEquipment->equipment_serial_number ?? 'N/A' }}</span></td>
<td><b>Marca:</b> <span>{{ $detailsEquipment->equipment_brand ?? 'N/A' }}</span></td>
</tr>
<tr>
<td>Fabricante da Válvula: <span>Fisher</span></td>
<td>Tipo de Atuador: <span>Eletro</span></td>
<td>Modelo da Válvula: <span>Globo Frontal</span></td>
<td>Atuador: <span>Pneumático</span></td>
<td><b>Modelo:</b> <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Dimensão:</b> <span>{{ $detailsEquipment->specificAttributes[8]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Rating:</b> <span>{{ $detailsEquipment->specificAttributes[17]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Dim Certa:</b>
<span>{{ $detailsEquipment->specificAttributes[10]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td>Modelo de Atuador: <span>Fisher 1B</span></td>
<td colspan="3">Mais especificações aqui...</td>
<td><b>Main Equipament:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>P&ID:</b> <span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b> SAP:</b> <span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Material:</b>
<span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
<tr>
<td><b>Fabricante:</b>
<span>{{ $detailsEquipment->specificAttributes[18]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Isolamento:</b>
<span>{{ $detailsEquipment->specificAttributes[11]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Andaime:</b> <span>{{ $detailsEquipment->specificAttributes[12]['value'] ?? 'N/A' }}</span>
</td>
<td><b>Grua:</b>
<span>{{ $detailsEquipment->specificAttributes[22]['value'] ?? 'N/A' }}</span>
</td>
</tr>
</table>
@endif
</div>
@if (!empty($detailsEquipmentWorkHistory->justification_for_finalization))
<!-- Caso o equipamento tenha sido concluido sem terminar as suas tarefas, deve aparecer a justificacao para tal acao -->
<div style="border: 1px solid black; margin-top:15%">
<div style="border: 1px solid black; background-color: #f9f9f9; padding: 5px;">
<p style="text-align: center;font-size: 15px; "><b style="color: red;">*</b>
Segue abaixo a justificação do motivo pelo qual o equipamento não foi finalizado em relação às
tarefas
previamente estabelecidas.</p>
<h4 style="text-align: center; font-weight: bold;">Justificação </h4>
</div>
<div>
<p style=" text-align: center; padding: 10px">
{{ $detailsEquipmentWorkHistory->justification_for_finalization }}</p>
</div>
</div>
@endif
</div>
<footer>
<div class="footer-container">
@if ($ambitHistories && $ambitHistories->isNotEmpty())
<h4>Lista de Históricos de Âmbitos</h4>
<ul>
@foreach ($ambitHistories as $history)
@ -308,13 +280,29 @@
</li>
@endforeach
</ul>
@endif
<div class="row">
<div class="col-sm generated-at">
Criado em: {{ \Carbon\Carbon::now()->addHour()->format('Y-m-d H:i:s') }}
</div>
<div class="col-sm generated-at" style=" text-align: right;">
Pagina : 1
</div>
</div>
</div>
</footer>
</div>
@endsection
@section('loopPages')
@php
$pageCounter = 2; // Start from page 2, assuming the first page is already handled
@endphp
@foreach ($receiveAllTasksHistiory as $task_todo)
<div class="page-break"></div>
@ -335,8 +323,7 @@
<div class="content-loop-pages">
@include('components.elemental-tasks', ['task_todo' => $task_todo])
@if (isset($taskImages[$task_todo->control_equipment_workstation_id]) &&
is_array($taskImages[$task_todo->control_equipment_workstation_id]))
@if (isset($taskImages[$task_todo->control_equipment_workstation_id]) && is_array($taskImages[$task_todo->control_equipment_workstation_id]))
<div class="row no-gutters">
@foreach ($taskImages[$task_todo->control_equipment_workstation_id] as $image)
<div class="col-4">
@ -352,15 +339,20 @@
<div class="footer-container">
<div class="row">
<div class="col-sm generated-at">
Generated at: {{ \Carbon\Carbon::now()->addHour()->format('Y-m-d H:i:s') }}
Criado em: {{ \Carbon\Carbon::now()->addHour()->format('Y-m-d H:i:s') }}
</div>
<div class="col-sm generated-at" style=" text-align: right;">
Page: 1234
<div class="col-sm generated-at" style="text-align: right;">
Pagina : {{ $pageCounter }}
</div>
</div>
</div>
</footer>
</div>
@php
$pageCounter++; // Increment the page counter for each iteration
@endphp
@endforeach
@endsection

View File

@ -24,10 +24,6 @@
<fieldset class="content">
<div class="container-fluid">
{{-- receiveComments --}}
<div class="card card-success collapsed-card">
<div class="card-header clickable">
<h3 class="card-title">Comentários sobre o Equipamento</h3>
@ -143,9 +139,9 @@ class="fas fa-plus"></i></button>
</div>
</div>
<div class="card-body">
@foreach ($receiveAllTasksHistiory as $elemental_tasks_id => $tasks)
@if (!empty($tasks['latest']))
@php
@ -153,10 +149,10 @@ class="fas fa-plus"></i></button>
@endphp
@include('components.elemental-tasks', ['task_todo' => $task_todo])
@endif
@endforeach
{{-- ESTA modal recebe corretamento os historicos para cada tarefa ja executada, porem a questao e que da forma que esta atualmente se tirar de comentario, os valores do tipo radio simplemente não aparecem --}}
<!-- Modal -->
{{-- <div class="modal fade" id="taskModal" tabindex="-1" role="dialog" aria-labelledby="taskModalLabel"
@ -191,22 +187,63 @@ class="fas fa-plus"></i></button>
</div>
</div>
</div> --}}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"
style="float: left;">
Concluir equipamento sem executar as tarefas
</button>
</div>
<!-- ./card-body -->
</div>
<!-- ./card card-primary -->
<!-- Modal Structure -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document"> <!-- Added modal-lg class to increase modal size -->
<div class="modal-content">
<form action="{{ route('completedEquipmentInProject') }}" method="POST">
@csrf
<input type="hidden" name="company_projects_id"
value="{{ $detailsProject->company_projects_id }}">
<input type="hidden" name="equipment_id" value="{{ $detalsEquipment->equipment_id }}">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Concluir equipamento sem executar as tarefas
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>
Ao selecionar a opção de concluir, o primeiro passo será indicar o motivo, que será
incluído no relatório.
As tarefas realizadas também serão apresentadas no relatório.
</p>
<!-- Full-width textarea using Bootstrap grid -->
<div class="form-group">
<label for="reason">Motivo</label>
<textarea name="reason" class="form-control" id="reason" rows="5" style="width: 100%"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
<button type="submit" class="btn btn-primary">Concluir equipamento</button>
</div>
</form>
</div>
</div>
</div>
</div>
</fieldset>

View File

@ -67,6 +67,7 @@
Route::get('showAllEquipmentsInProjectForQrCode/{projectId}', [PreparedProjectController::class, 'showAllEquipmentsInProjectForQrCode'])->name('showAllEquipmentsInProjectForQrCode');
Route::post('completedEquipmentInProject',[ProjectoDatacontroller::class,'completedEquipmentInProject'])->name('completedEquipmentInProject');
Route::get('testRelatorio', [ProjectoDatacontroller::class, 'testRelatorio'])->name('testRelatorio');