update show and edits portifolio equipments
This commit is contained in:
parent
81cb1ff1b4
commit
84b2e0c4c3
|
|
@ -303,6 +303,11 @@ public function getDetailsEquipmentQrcode(Request $request)
|
|||
|
||||
return DataTables::of($query)
|
||||
|
||||
->addColumn('ispt_number', function ($query) {
|
||||
// Assumindo que você quer o 'ispt_number' do primeiro 'EquipmentWorkHistory' que corresponde ao 'company_projects_id'
|
||||
$equipmentWorkHistory = $query->equipmentWorkHistory->first();
|
||||
return $equipmentWorkHistory ? $equipmentWorkHistory->ispt_number : 'N/A';
|
||||
})
|
||||
->addColumn('equipment_type_name', function ($query) {
|
||||
// Retorna 'equipment_type_name' do relacionamento 'equipmentType'
|
||||
return $query->equipmentType ? $query->equipmentType->equipment_type_name : 'N/A';
|
||||
|
|
@ -316,16 +321,51 @@ public function getDetailsEquipmentQrcode(Request $request)
|
|||
return $firstEquipmentWorkHistory->equipmentAssociationAmbit->ambitsEquipment->ambits_description;
|
||||
})
|
||||
|
||||
->addColumn('action', function ($equipment) use ($receiveNumberProject) {
|
||||
$pdfUrl = route('showDetailsEquipmentForQrCode', ['equipmentId' => $equipment->equipment_id, 'projectId' => $receiveNumberProject]);
|
||||
// ->addColumn('action', function ($equipment) use ($receiveNumberProject) {
|
||||
// $pdfUrl = route('showDetailsEquipmentForQrCode', ['equipmentId' => $equipment->equipment_id, 'projectId' => $receiveNumberProject]);
|
||||
|
||||
// Retorna apenas a ação para visualizar o PDF
|
||||
$dropdownHtml = ' <a href="' . $pdfUrl . '" class="dropdown-item text-primary">
|
||||
<i class="fa-solid fa-file-pdf"></i>
|
||||
QR Code
|
||||
// // Retorna apenas a ação para visualizar o PDF
|
||||
// $dropdownHtml = ' <a href="' . $pdfUrl . '" class="dropdown-item text-primary">
|
||||
// <i class="fa-solid fa-file-pdf"></i>
|
||||
// QR Code
|
||||
// </a>';
|
||||
// return $dropdownHtml;
|
||||
// })
|
||||
|
||||
->addColumn('action', function ($equipment) use ($receiveNumberProject) {
|
||||
$pdfUrl = route('showDetailsEquipmentForQrCode', [
|
||||
'equipmentId' => $equipment->equipment_id,
|
||||
'projectId' => $receiveNumberProject
|
||||
]);
|
||||
|
||||
$detailsUrl = !is_null($receiveNumberProject)
|
||||
? route('projectDetails_11', ['projectID' => $receiveNumberProject, 'equipmentID' => $equipment->equipment_id])
|
||||
: route('articulated_22', ['equipmentID' => $equipment->equipment_id]);
|
||||
|
||||
// Criando dropdown com botões
|
||||
$dropdownHtml = '<div class="d-flex justify-content-center dropdown">
|
||||
<button data-toggle="dropdown" aria-expanded="false" class="actions-btn btn btn-light circle">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-light">';
|
||||
|
||||
// 🔹 Adiciona ação para visualizar o PDF (QR Code)
|
||||
$dropdownHtml .= '<a href="' . $pdfUrl . '" class="dropdown-item text-primary">
|
||||
<i class="fa-solid fa-file-pdf text-primary"></i> QR Code
|
||||
</a>';
|
||||
|
||||
// 🔹 Adiciona ação para visualizar detalhes do equipamento
|
||||
$dropdownHtml .= '<a href="' . $detailsUrl . '" class="dropdown-item text-primary">
|
||||
<i class="fa-solid fa-eye text-primary"></i> Detalhes
|
||||
</a>';
|
||||
|
||||
$dropdownHtml .= '</div></div>'; // Fecha as tags do dropdown
|
||||
|
||||
return $dropdownHtml;
|
||||
})
|
||||
|
||||
|
||||
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -967,9 +967,10 @@ public function receivePlants($receiveAllClients)
|
|||
//Funcao que recebe a Acoes do dataTables das obrar em Planeamento.
|
||||
public function projectDetails_11($projectID, $equipmentID)
|
||||
{
|
||||
|
||||
$detailsProject = CompanyProject::find($projectID);
|
||||
|
||||
$dataEquipment = Equipment::find($equipmentID);
|
||||
$detalsEquipment = Equipment::find($equipmentID);
|
||||
|
||||
$receiveEquipmentWorkHistorys = EquipmentWorkHistory::where('equipment_id', $equipmentID)
|
||||
->where('company_projects_id', $projectID)
|
||||
|
|
@ -1049,7 +1050,7 @@ public function projectDetails_11($projectID, $equipmentID)
|
|||
return [$task->elemental_tasks_id => 'on'];
|
||||
})->all();
|
||||
|
||||
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $dataEquipment->equipment_id)->get();
|
||||
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $detalsEquipment->equipment_id)->get();
|
||||
|
||||
$specificAttributesArray = [];
|
||||
|
||||
|
|
@ -1057,17 +1058,26 @@ public function projectDetails_11($projectID, $equipmentID)
|
|||
$specificAttributesArray[$attribute->general_attributes_equipment_id] = $attribute->specific_attributes_value;
|
||||
}
|
||||
|
||||
// talvez apenas ciar um if ja resolva, se vir da obra em status 1 ou 3 receve 3 para editar e ver, se viar da obra status 2, deve ser apenas 1
|
||||
if ($detailsProject->order_project == 1 || $detailsProject->order_project == 3) {
|
||||
// Cria um sistema de 1 a 3 , onde 1 e apenas 'ler', 2 apenas editar e 3 as 2 opcoes
|
||||
$portfolioOnlyreadOrEditToo = 3;
|
||||
|
||||
} elseif ($detailsProject->order_project == 2) {
|
||||
//Caso seja o 2 sera a obra preparada e nela, nao se deve fazer alteracoes por isso vai visualizar
|
||||
$portfolioOnlyreadOrEditToo = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//filteredTasks', 'OrdemTasks', 'DetailsTasks' campos vazios para ISV.
|
||||
return view('projectsClients.articulated_2_ShowEquipment', compact('detailsProject', 'dataEquipment', 'filteredTasks', 'OrdemTasks', 'DetailsTasks', 'specificAttributesArray', 'receiveEquipmentWorkHistorys', 'portfolioOnlyreadOrEditToo'));
|
||||
return view('projectsClients.articulated_2_ShowEquipment', compact('detailsProject', 'detalsEquipment', 'filteredTasks', 'OrdemTasks', 'DetailsTasks', 'specificAttributesArray', 'receiveEquipmentWorkHistorys', 'portfolioOnlyreadOrEditToo'));
|
||||
}
|
||||
|
||||
//Funcao que recebe a Acoes do dataTables do portifolio.
|
||||
public function articulated_22($equipmentID)
|
||||
{
|
||||
//Nao esta recebendo os selects
|
||||
|
||||
//(Nao esta recebendo os selects
|
||||
|
||||
// $dataEquipment = Equipment::find($equipmentID);
|
||||
// $detailsEquipmentWorkHistory = EquipmentWorkHistory::where('equipment_id',$equipmentID)->first();
|
||||
|
|
@ -1107,6 +1117,7 @@ public function articulated_22($equipmentID)
|
|||
// Cria um sistema de 1 a 3 , onde 1 e apenas 'ler', 2 apenas editar e 3 as 2 opcoes
|
||||
$portfolioOnlyreadOrEditToo = 3;
|
||||
|
||||
|
||||
return view('projectsClients.testRoute', compact('dataEquipment', 'receiveAlldetailsEquipmentWorkHistory', 'specificAttributesArray', 'portfolioOnlyreadOrEditToo'));
|
||||
|
||||
}
|
||||
|
|
@ -1277,7 +1288,7 @@ public function receiveAllEquipments()
|
|||
->toJson();
|
||||
}
|
||||
|
||||
public function receiveWorkstationProject($receiveNumberProject,Request $request)
|
||||
public function receiveWorkstationProject($receiveNumberProject, Request $request)
|
||||
{
|
||||
|
||||
// Captura o valor de 'typePage' vindo da requisição
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<!-- 'portfolioOnlyreadOrEditToo', cria um sistema de 1 a 3 , onde 1 e apenas 'ler', 2 apenas editar e 3 as 2 opcoes -->
|
||||
@if ($portfolioOnlyreadOrEditToo == 1 || $portfolioOnlyreadOrEditToo == 3)
|
||||
{{-- Visualizar --}}
|
||||
<div class="tab-pane fade show active " id="show-Equipment">
|
||||
<div class="tab-pane fade show active" id="show-Equipment">
|
||||
|
||||
<div id="cv_card" class="card card-info specificAttributes-div">
|
||||
<div class="card-header">
|
||||
|
|
@ -733,12 +733,13 @@ class="form-control card_inputs" id="positionerSerialNumber"
|
|||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<!-- ISV -->
|
||||
@elseif ($detalsEquipment->equipment_type_id == 2)
|
||||
<!-- 'portfolioOnlyreadOrEditToo', cria um sistema de 1 a 3 , onde 1 e apenas 'ler', 2 apenas editar e 3 as 2 opcoes -->
|
||||
@if ($portfolioOnlyreadOrEditToo == 1 || $portfolioOnlyreadOrEditToo == 3)
|
||||
{{-- Visualizar --}}
|
||||
<div class="tab-pane fade show active " id="show-Equipment">
|
||||
<div class="tab-pane fade show active" id="show-Equipment">
|
||||
|
||||
{{-- ISV-card-visualizar --}}
|
||||
<div id="isv_card" class="card card-primary specificAttributes-div">
|
||||
|
|
@ -1690,12 +1691,14 @@ class="fas fa-plus"></i></button>
|
|||
{{-- Editar --}}
|
||||
@endif
|
||||
|
||||
|
||||
<!-- PSV -->
|
||||
@elseif ($detalsEquipment->equipment_type_id == 3)
|
||||
|
||||
<!-- 'portfolioOnlyreadOrEditToo', cria um sistema de 1 a 3 , onde 1 e apenas 'ler', 2 apenas editar e 3 as 2 opcoes -->
|
||||
@if ($portfolioOnlyreadOrEditToo == 1 || $portfolioOnlyreadOrEditToo == 3)
|
||||
{{-- Visualizar --}}
|
||||
<div class="tab-pane fade show active equipment-type-3" id="show-Equipment">
|
||||
<div class="tab-pane fade show active" id="show-Equipment">
|
||||
{{-- ./PSV-card --}}
|
||||
<div id="psv_card" class="card card-secondary specificAttributes-div">
|
||||
<div class="card-header">
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class="fas fa-plus"></i></button>
|
|||
<a href="{{ route('viewProjectsList', ['orderProjectID' => 1]) }}">Em Planeamento</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">{{ $receiveNumberProject->company_project_description }}</li>
|
||||
<li class="breadcrumb-item active">2 - Criar Articulado`</li>
|
||||
<li class="breadcrumb-item active">2 - Criar Articulado</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1229,7 +1229,7 @@ class="input-group-text border rounded-left"
|
|||
<table id="showProjectEquipment" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NªIspt</th>
|
||||
<th>N.Ispt</th>
|
||||
<th>Tag</th>
|
||||
<th>Descrição</th>
|
||||
<th>Âmbito</th>
|
||||
|
|
@ -1243,7 +1243,6 @@ class="input-group-text border rounded-left"
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="float-right">
|
||||
{{-- <button type="submit" class="btn btn-primary">Guardar</button> --}}
|
||||
|
|
@ -1611,9 +1610,7 @@ class="badge badge-info">(Número da copia)</span></h4>
|
|||
|
||||
@section('scriptsTemplateAdmin')
|
||||
<script>
|
||||
var dataTable;
|
||||
$(document).ready(function() {
|
||||
|
||||
dataTable = $('#showProjectEquipment').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
|
|
@ -1625,42 +1622,30 @@ class="badge badge-info">(Número da copia)</span></h4>
|
|||
d.numberProject = $('#receiveNumberProject').val();
|
||||
d.checkUnits = $('#receiveUnitsClientRelated1').val();
|
||||
d.tipo_valvulasList = $('#tipo_valvulasList').val();
|
||||
//O typePage vai referenciar qual a pagina de 'Planeamento' Normal ou Extra.
|
||||
d.typePage = 1;
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ispt_number',
|
||||
name: 'ispt_number'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
{
|
||||
data: 'equipment_description',
|
||||
name: 'equipment_description'
|
||||
},
|
||||
{
|
||||
data: 'ambit',
|
||||
name: 'ambit'
|
||||
},
|
||||
{
|
||||
data: 'unit_name',
|
||||
name: 'unit_name'
|
||||
},
|
||||
{
|
||||
data: 'equipment_type_name',
|
||||
name: 'equipment_type_name'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
columns: [
|
||||
{ data: 'ispt_number', name: 'ispt_number' },
|
||||
{ data: 'equipment_tag', name: 'equipment_tag' },
|
||||
{ data: 'equipment_description', name: 'equipment_description' },
|
||||
{ data: 'ambit', name: 'ambit' },
|
||||
{ data: 'unit_name', name: 'unit_name' },
|
||||
{ data: 'equipment_type_name', name: 'equipment_type_name' },
|
||||
{ data: 'action', name: 'action', orderable: false, searchable: false }
|
||||
],
|
||||
});
|
||||
|
||||
// Delegação de evento para os botões dentro da tabela DataTables
|
||||
$('#showProjectEquipment tbody').on('click', '.change-ambit-btn', function() {
|
||||
let targetModal = $(this).data('target');
|
||||
$(targetModal).modal('show');
|
||||
});
|
||||
|
||||
$('#showProjectEquipment tbody').on('click', '.delete-equipment-btn', function() {
|
||||
let targetModal = $(this).data('target');
|
||||
$(targetModal).modal('show');
|
||||
});
|
||||
});
|
||||
|
||||
$('#receiveUnitsClientRelated1, #receiveNumberProject, #tipo_valvulasList').on('change', function() {
|
||||
|
|
|
|||
8285
resources/views/projectsClients/articulated_2_ShowEquipment.blade copy.php
Executable file
8285
resources/views/projectsClients/articulated_2_ShowEquipment.blade copy.php
Executable file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -155,6 +155,7 @@ class="form-control">
|
|||
<table id="tableEquipmentWithQrcode" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N.Ispt</th>
|
||||
<th>Tag</th>
|
||||
<th>Descrição</th>
|
||||
<th>Tipo Equipamento</th>
|
||||
|
|
@ -620,6 +621,10 @@ class="btn btn-primary float-right">Avançar para Execução</a>
|
|||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ispt_number',
|
||||
name: 'ispt_number'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
{{-- ./PSV-card --}}
|
||||
@if ($dataEquipment->equipment_type_id == 3)
|
||||
<x-portfolio.portfolioAttributesForEquipments :dataEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
<x-portfolio.portfolioAttributesForEquipments :detalsEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
:portfolioOnlyreadOrEditToo="$portfolioOnlyreadOrEditToo" />
|
||||
|
||||
{{-- Historico - Sera unicamente para a pagina do portofolio. --}}
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
{{-- ISV --}}
|
||||
@if ($dataEquipment->equipment_type_id == 2)
|
||||
<x-portfolio.portfolioAttributesForEquipments :dataEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
<x-portfolio.portfolioAttributesForEquipments :detalsEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
:portfolioOnlyreadOrEditToo="$portfolioOnlyreadOrEditToo" />
|
||||
|
||||
{{-- Historico --}}
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
|
||||
{{-- CV --}}
|
||||
@if ($dataEquipment->equipment_type_id == 1)
|
||||
<x-portfolio.portfolioAttributesForEquipments :dataEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
<x-portfolio.portfolioAttributesForEquipments :detalsEquipment="$dataEquipment" :specificAttributesArray="$specificAttributesArray"
|
||||
:portfolioOnlyreadOrEditToo="$portfolioOnlyreadOrEditToo" />
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
Route::get('cancelElementalTaskForEquipment/{controlEquipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
||||
|
||||
// Nao gosto que esteja neste controller, verificar mais tarde
|
||||
Route::get('articulated_2/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'projectDetails_11'])->name('projectDetails_11');
|
||||
Route::get('projectEquipmentShow/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'projectDetails_11'])->name('projectDetails_11');
|
||||
Route::get('manageAssets/{equipmentID}', action: [ProjectoDatacontroller::class, 'articulated_22'])->name('articulated_22');
|
||||
|
||||
Route::get('showAmbitDetailsProjectHistory/{equipmentStatus}/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'showAmbitDetailsProjectHistory'])->name('showAmbitDetailsProjectHistory');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user