From 3d64ba9bc6f2a89e0d0ee6d7f56f9d98ca57c537 Mon Sep 17 00:00:00 2001 From: ygbanzato Date: Thu, 27 Jul 2023 19:59:44 +0100 Subject: [PATCH] creation and implementation of the table of selectable equipment to enter the indicated work according to its unit --- .../Controllers/CreateProjectController.php | 7 +- .../Controllers/ProjectoDatacontroller.php | 20 +++ app/Models/Unit.php | 7 + .../projectsClients/articulated_2.blade.php | 156 ++++++++++++------ routes/web.php | 2 + 5 files changed, 143 insertions(+), 49 deletions(-) diff --git a/app/Http/Controllers/CreateProjectController.php b/app/Http/Controllers/CreateProjectController.php index 701d1456..3ba65867 100644 --- a/app/Http/Controllers/CreateProjectController.php +++ b/app/Http/Controllers/CreateProjectController.php @@ -530,13 +530,16 @@ public function showStep2($company_projects_id) ->with('listEquipmentsProjects', $listEquipmentsProjects) ->with('typeEquipments', $typeEquipments) ->with('checkEquipments', $checkEquipments) - ->with('checkUnits', $checkUnits); + ->with('checkUnits', $checkUnits) + ->with('receiveNumberProject',$project); + } return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject]) ->with('listEquipmentsProjects', $listEquipmentsProjects) ->with('typeEquipments', $typeEquipments) ->with('checkEquipments', $checkEquipments) - ->with('checkUnits', $checkUnits); + ->with('checkUnits', $checkUnits) + ->with('receiveNumberProject',$project); } public function createEquipmentManual(Request $request) diff --git a/app/Http/Controllers/ProjectoDatacontroller.php b/app/Http/Controllers/ProjectoDatacontroller.php index 028b373f..10cb25a8 100644 --- a/app/Http/Controllers/ProjectoDatacontroller.php +++ b/app/Http/Controllers/ProjectoDatacontroller.php @@ -21,6 +21,26 @@ class ProjectoDatacontroller extends Controller { + public function receiveAllInstallationEquipment($receiveNumberProject) + { + + $receveProject = CompanyProject::find($receiveNumberProject); + $receveEquipments = Equipment::whereHas('unit.plant', function ($query) use ($receveProject) { + $query->where('plants.plant_id', '=', $receveProject->plant_id); + }) + ->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']) + ->get(); + + return DataTables::of($receveEquipments) + ->addColumn('equipment_type', function ($row) { + return $row->equipmentType->equipment_type_name; + }) + ->addColumn('unit', function ($row) { + return $row->unit->unit_name; + }) + ->toJson(); + } + public function HomePage() { diff --git a/app/Models/Unit.php b/app/Models/Unit.php index 61476dfc..326dc327 100644 --- a/app/Models/Unit.php +++ b/app/Models/Unit.php @@ -21,4 +21,11 @@ public function equipments(){ public function pendingEquipments(){ return $this->hasMany(PendingEquipment::class, 'pending_equipment_unit_id', 'unit_id'); } + + public function plant() + { + return $this->belongsTo(Plant::class, 'plant_id'); + } + + } diff --git a/resources/views/projectsClients/articulated_2.blade.php b/resources/views/projectsClients/articulated_2.blade.php index d5aa1994..94a8f26b 100644 --- a/resources/views/projectsClients/articulated_2.blade.php +++ b/resources/views/projectsClients/articulated_2.blade.php @@ -28,6 +28,9 @@ @endif + + +
@@ -1103,56 +1106,17 @@ class="fas fa-plus">
- - {{-- --}} + Selecionar todos
- - - - - - + + - - - {{-- @if (Session::has('listValves')) - @foreach (Session::get('listValves') as $valve) --}} - @foreach ($listEquipmentsProjects as $listEquipmentsProject) - - - - - - - - - {{-- --}} - - - - @endforeach - - - - - -
IDFabricaTipo de Equipamento Tag Descricao EquipamentoNumero de SerieMarcaTipo de EquipamentoFabrica Selecionar EquipamentosEditar
{{ $listEquipmentsProject->equipment_id }}{{ $listEquipmentsProject->unit->unit_name ?? 'Sem Fabrica Associada!!!' }} - {{ $listEquipmentsProject->equipmentType->equipment_type_name ?? 'Sem tipo de Equipamento Associado!!!' }} - {{ $listEquipmentsProject->equipment_tag }}{{ $listEquipmentsProject->equipment_description }}{{ $listEquipmentsProject->equipment_serial_number }}{{ $listEquipmentsProject->equipment_brand }}{{ $vallistEquipmentsProjectve->equipment_model }} -
- - -
-
Selecionar tudo :
{{-- ./table-responsive --}} @@ -1165,9 +1129,10 @@ class="fas fa-plus">
- + TE15 Empancar (ISV) @@ -2940,7 +2905,7 @@ class="form-control card_inputs" - + TE13 Teste final @@ -3688,7 +3653,104 @@ function(task) { diff --git a/routes/web.php b/routes/web.php index d2b1df10..bd72c81b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -38,6 +38,8 @@ Route::get('/api/receiveEquipmentsProject/{receiveNumberProject}',[ProjectoDatacontroller::class,'receiveEquipmentsProject']); Route::get('/api/receiveWorkstationProject/{receiveNumberProject}',[ProjectoDatacontroller::class,'receiveWorkstationProject' ]); +Route::get('/api/receiveAllInstallationEquipment/{receiveNumberProject}',[ProjectoDatacontroller::class,'receiveAllInstallationEquipment']); + Route::get('api/receveTasksWorkstationPlanning/{WorkstationId}',[CreateProjectController::class,'receveTasksWorkstationPlanning']);