Updating the creation of projects
This commit is contained in:
parent
d7e3a725ac
commit
3b86212755
1525
app/Http/Controllers/CreateProjectController copy.php
Executable file
1525
app/Http/Controllers/CreateProjectController copy.php
Executable file
File diff suppressed because it is too large
Load Diff
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\EquipmentWorkHistory;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
@ -36,6 +37,106 @@
|
||||||
|
|
||||||
class CreateProjectController extends Controller
|
class CreateProjectController extends Controller
|
||||||
{
|
{
|
||||||
|
public function changeAmbitEquipment(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$receiveAmbitEquipmentId = $request->receveAmbit;
|
||||||
|
|
||||||
|
$equipmentId = $request->equipmentID;
|
||||||
|
|
||||||
|
// $receiveEquipment = Equipment::where('equipment_id', $equipmentId)->first();
|
||||||
|
|
||||||
|
// $receiveEquipmentWorkHistorys = EquipmentWorkHistory::where('equipment_id',$receiveEquipment->equipment_id)
|
||||||
|
// ->where('company_projects_id', $receiveEquipment->company_projects_id )
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// $receiveDataEquipmentAssociationAmbit = EquipmentAssociationAmbit::where('equipmentWorkHistorys_id',$receiveEquipmentWorkHistorys->equipmentWorkHistorys_id)->first();
|
||||||
|
|
||||||
|
// if($receiveDataEquipmentAssociationAmbit->ambits_id == $receiveAmbitEquipmentId){
|
||||||
|
|
||||||
|
// return back()->with('danger', 'Ambito selecionado, igual ao anterior!');
|
||||||
|
// } else {
|
||||||
|
// $receiveDataEquipmentAssociationAmbit->ambits_id = $receiveAmbitEquipmentId;
|
||||||
|
// $receiveDataEquipmentAssociationAmbit->save();
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
$receiveEquipment = Equipment::where('equipment_id', $equipmentId)->first();
|
||||||
|
|
||||||
|
$receiveEquipmentWorkHistorys = EquipmentWorkHistory::where('equipment_id', $receiveEquipment->equipment_id)
|
||||||
|
->where('company_projects_id', $receiveEquipment->company_projects_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$receiveDataEquipmentAssociationAmbit = EquipmentAssociationAmbit::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistorys->equipmentWorkHistorys_id)->first();
|
||||||
|
|
||||||
|
if ($receiveDataEquipmentAssociationAmbit->ambits_id == $receiveAmbitEquipmentId) {
|
||||||
|
return back()->with('danger', 'Âmbito selecionado é igual ao anterior!');
|
||||||
|
} else {
|
||||||
|
// Deleta as tarefas associadas ao equipamento no âmbito atual
|
||||||
|
OrderEquipmentTasks::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistorys->equipmentWorkHistorys_id)->delete();
|
||||||
|
|
||||||
|
// Atualiza o âmbito do equipamento
|
||||||
|
$receiveDataEquipmentAssociationAmbit->ambits_id = $receiveAmbitEquipmentId;
|
||||||
|
$receiveDataEquipmentAssociationAmbit->save();
|
||||||
|
|
||||||
|
// Insere as novas tarefas para o novo âmbito
|
||||||
|
$TasksAssociationAmbits = TasksAssociationAmbits::where('ambits_equipment_id', $receiveAmbitEquipmentId)->get();
|
||||||
|
$execution_order = 1;
|
||||||
|
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||||
|
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||||
|
$JoinsEquipmentsWithTasks->equipmentWorkHistorys_id = $receiveEquipmentWorkHistorys->equipmentWorkHistorys_id;
|
||||||
|
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||||
|
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
||||||
|
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
||||||
|
$JoinsEquipmentsWithTasks->inspection = 2; // ou outro valor conforme necessário
|
||||||
|
$JoinsEquipmentsWithTasks->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Equipamento: ' . $receiveEquipment->equipment_id . ' trocado de âmbito com sucesso!');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteEquipmentInProject(Request $request)
|
||||||
|
{
|
||||||
|
$receiveEquipmentId = $request->equipmentId;
|
||||||
|
$receiveEquipment = Equipment::where('equipment_id', $receiveEquipmentId)->first();
|
||||||
|
$receiveStatus = $request->deleteEquipmentProject;
|
||||||
|
|
||||||
|
if ($receiveStatus == 'complete') {
|
||||||
|
EquipmentWorkHistory::where('equipment_id', $receiveEquipment->equipment_id)
|
||||||
|
->where('company_projects_id', $receiveEquipment->company_projects_id)
|
||||||
|
->delete();
|
||||||
|
$receiveEquipment->delete();
|
||||||
|
|
||||||
|
return redirect()->back()
|
||||||
|
->with('success', 'Equipamento: ' . $receiveEquipment->equipment_id . ' excluído com sucesso!');
|
||||||
|
} else {
|
||||||
|
$receiveEquipment->company_projects_id = null;
|
||||||
|
$receiveEquipment->save();
|
||||||
|
|
||||||
|
return redirect()->back()
|
||||||
|
->with('success', 'Equipamento: ' . $receiveEquipment->equipment_id . ' retirado da obra com sucesso!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function deletePendingEquipments(Request $request)
|
||||||
|
{
|
||||||
|
$pendingEquipmentIds = $request->input('pendingEquipmentIds', []);
|
||||||
|
|
||||||
|
// Verifica se o array não está vazio
|
||||||
|
if (!empty($pendingEquipmentIds)) {
|
||||||
|
// Deleta todos os registros de PendingEquipment que correspondam aos IDs
|
||||||
|
PendingEquipment::whereIn('pending_equipment_id', $pendingEquipmentIds)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()
|
||||||
|
->with('success', 'Todos os equipamentos pendentes apagados com sucesso!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function receiveUnits($numberProject)
|
public function receiveUnits($numberProject)
|
||||||
{
|
{
|
||||||
|
|
@ -174,7 +275,7 @@ public function receiveUnitsForExcelTemplate($numberProject)
|
||||||
$receveCompanyProject = CompanyProject::where('company_projects_id', $numberProject)->first();
|
$receveCompanyProject = CompanyProject::where('company_projects_id', $numberProject)->first();
|
||||||
$recevePlant = Plant::where('plant_id', $receveCompanyProject->plant_id)->first();
|
$recevePlant = Plant::where('plant_id', $receveCompanyProject->plant_id)->first();
|
||||||
$receveUnits = Unit::where('plant_id', $recevePlant->plant_id)->get();
|
$receveUnits = Unit::where('plant_id', $recevePlant->plant_id)->get();
|
||||||
$filePath = public_path('templateExcel/TestTemplate.xlsx');
|
$filePath = public_path('templateExcel/Valves_Template.xlsx');
|
||||||
// Load the spreadsheet
|
// Load the spreadsheet
|
||||||
$spreadsheet = IOFactory::load($filePath);
|
$spreadsheet = IOFactory::load($filePath);
|
||||||
// Get the second sheet
|
// Get the second sheet
|
||||||
|
|
@ -185,8 +286,13 @@ public function receiveUnitsForExcelTemplate($numberProject)
|
||||||
$sheet->setCellValue('D' . $row, $unit->unit_name);
|
$sheet->setCellValue('D' . $row, $unit->unit_name);
|
||||||
$row++;
|
$row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$formattedDateTime = date('Y-m-d_H-i'); // Formato: Ano-Mês-Dia_Hora-Minuto
|
||||||
|
$fileName = "Valves_Template_{$numberProject}_{$formattedDateTime}.xlsx";
|
||||||
|
|
||||||
// Generate and return the download response
|
// Generate and return the download response
|
||||||
return $this->createDownloadResponse($spreadsheet, 'Valves_Template.xlsx');
|
// return $this->createDownloadResponse($spreadsheet, 'Valves_Template.xlsx');
|
||||||
|
return $this->createDownloadResponse($spreadsheet, $fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createDownloadResponse($spreadsheet, $filename)
|
protected function createDownloadResponse($spreadsheet, $filename)
|
||||||
|
|
@ -659,6 +765,7 @@ public function processStep1(Request $request)
|
||||||
|
|
||||||
public function showStep2($company_projects_id)
|
public function showStep2($company_projects_id)
|
||||||
{
|
{
|
||||||
|
$groupedArrayForPendingEquipments = session('groupedArrayForPendingEquipments');
|
||||||
// Verifique se a etapa 1 foi concluída
|
// Verifique se a etapa 1 foi concluída
|
||||||
|
|
||||||
// if (!session('form_data.step1')) {
|
// if (!session('form_data.step1')) {
|
||||||
|
|
@ -693,10 +800,11 @@ public function showStep2($company_projects_id)
|
||||||
// $listEquipmentsProjects = Equipment::with(['unit', 'equipmentType', 'equipmentAssociationAmbit.ambitsEquipment'])
|
// $listEquipmentsProjects = Equipment::with(['unit', 'equipmentType', 'equipmentAssociationAmbit.ambitsEquipment'])
|
||||||
// ->where('company_projects_id', $company_projects_id)
|
// ->where('company_projects_id', $company_projects_id)
|
||||||
// ->get();
|
// ->get();
|
||||||
|
|
||||||
$listEquipmentsProjects = Equipment::with([
|
$listEquipmentsProjects = Equipment::with([
|
||||||
'unit',
|
'unit',
|
||||||
'equipmentType',
|
'equipmentType',
|
||||||
'equipmentAssociationAmbit.ambitsEquipment',
|
// 'equipmentAssociationAmbit.ambitsEquipment',
|
||||||
'specificAttributes' => function ($query) {
|
'specificAttributes' => function ($query) {
|
||||||
$query->orderBy('specific_attributes_value', 'asc');
|
$query->orderBy('specific_attributes_value', 'asc');
|
||||||
}
|
}
|
||||||
|
|
@ -704,7 +812,6 @@ public function showStep2($company_projects_id)
|
||||||
->where('company_projects_id', $company_projects_id)
|
->where('company_projects_id', $company_projects_id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// dd($checkUnits);
|
|
||||||
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $numberProject)->get();
|
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $numberProject)->get();
|
||||||
|
|
||||||
if (!$pendingEquipments->isEmpty()) {
|
if (!$pendingEquipments->isEmpty()) {
|
||||||
|
|
@ -716,13 +823,15 @@ public function showStep2($company_projects_id)
|
||||||
->with('typeEquipments', $typeEquipments)
|
->with('typeEquipments', $typeEquipments)
|
||||||
->with('checkEquipments', $checkEquipments)
|
->with('checkEquipments', $checkEquipments)
|
||||||
->with('checkUnits', $checkUnits)
|
->with('checkUnits', $checkUnits)
|
||||||
->with('receiveNumberProject', $project);
|
->with('receiveNumberProject', $project)
|
||||||
|
->with('groupedArrayForPendingEquipments', $groupedArrayForPendingEquipments);
|
||||||
}
|
}
|
||||||
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||||
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
||||||
->with('typeEquipments', $typeEquipments)
|
->with('typeEquipments', $typeEquipments)
|
||||||
->with('checkEquipments', $checkEquipments)
|
->with('checkEquipments', $checkEquipments)
|
||||||
->with('checkUnits', $checkUnits)
|
->with('checkUnits', $checkUnits)
|
||||||
|
->with('groupedArrayForPendingEquipments', $groupedArrayForPendingEquipments)
|
||||||
->with('receiveNumberProject', $project);
|
->with('receiveNumberProject', $project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,6 +879,7 @@ public function createEquipmentManual(Request $request)
|
||||||
|
|
||||||
$newEquipmentProject->unit_id = $newUnit->unit_id;
|
$newEquipmentProject->unit_id = $newUnit->unit_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newEquipmentProject->equipment_type_id = $request->equipmentTypeId;
|
$newEquipmentProject->equipment_type_id = $request->equipmentTypeId;
|
||||||
$newEquipmentProject->equipment_tag = $request->tag;
|
$newEquipmentProject->equipment_tag = $request->tag;
|
||||||
$newEquipmentProject->equipment_description = $request->equipmentDescription;
|
$newEquipmentProject->equipment_description = $request->equipmentDescription;
|
||||||
|
|
@ -780,12 +890,21 @@ public function createEquipmentManual(Request $request)
|
||||||
$newEquipmentProject->equipment_model = $request->equipmentModel ?? NULL;
|
$newEquipmentProject->equipment_model = $request->equipmentModel ?? NULL;
|
||||||
|
|
||||||
$newEquipmentProject->company_projects_id = $request->numberProject;
|
$newEquipmentProject->company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
$newEquipmentProject->save();
|
$newEquipmentProject->save();
|
||||||
|
|
||||||
// ID do equipamento criado
|
// ID do equipamento criado
|
||||||
$equipmentID = $newEquipmentProject->equipment_id;
|
$equipmentID = $newEquipmentProject->equipment_id;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistorys = new EquipmentWorkHistory;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistorys->equipment_id = $equipmentID;
|
||||||
|
$newEquipmentWorkHistorys->ispt_number = 0;
|
||||||
|
$newEquipmentWorkHistorys->company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistorys->save();
|
||||||
|
|
||||||
|
$equipmentWorkHistorysID = $newEquipmentWorkHistorys->equipmentWorkHistorys_id;
|
||||||
|
|
||||||
// Verifica os campos do Card_do tipo de valvula selecionado (Ex: psv_card) e de acordo com os campos preenchidos se for de atributos especificos, ele compara o 'name' dos inputs com os 'general_attributes_equipment_description' da tabela : GeneralAttributesEquipment e associa
|
// Verifica os campos do Card_do tipo de valvula selecionado (Ex: psv_card) e de acordo com os campos preenchidos se for de atributos especificos, ele compara o 'name' dos inputs com os 'general_attributes_equipment_description' da tabela : GeneralAttributesEquipment e associa
|
||||||
$checkAtributs = GeneralAttributesEquipment::whereIn('general_attributes_equipment_description', array_keys($request->all()))
|
$checkAtributs = GeneralAttributesEquipment::whereIn('general_attributes_equipment_description', array_keys($request->all()))
|
||||||
|
|
@ -805,20 +924,22 @@ public function createEquipmentManual(Request $request)
|
||||||
}
|
}
|
||||||
// Para cada um dos Arrays criados acima, vai criar os novos dados na tabela 'SpecificAttributesEquipmentType'
|
// Para cada um dos Arrays criados acima, vai criar os novos dados na tabela 'SpecificAttributesEquipmentType'
|
||||||
foreach ($receivesAssociationAttributes as $receivesAssociationAttribute) {
|
foreach ($receivesAssociationAttributes as $receivesAssociationAttribute) {
|
||||||
|
|
||||||
$AddAtributsEquipments = new SpecificAttributesEquipmentType;
|
$AddAtributsEquipments = new SpecificAttributesEquipmentType;
|
||||||
$AddAtributsEquipments->equipment_id = $equipmentID;
|
$AddAtributsEquipments->equipment_id = $equipmentID;
|
||||||
$AddAtributsEquipments->equipment_type_id = $request->equipmentTypeId;
|
$AddAtributsEquipments->equipment_type_id = $request->equipmentTypeId;
|
||||||
$AddAtributsEquipments->general_attributes_equipment_id = $receivesAssociationAttribute['general_attributes_equipment_id'];
|
$AddAtributsEquipments->general_attributes_equipment_id = $receivesAssociationAttribute['general_attributes_equipment_id'];
|
||||||
$AddAtributsEquipments->specific_attributes_value = $receivesAssociationAttribute['value'];
|
$AddAtributsEquipments->specific_attributes_value = $receivesAssociationAttribute['value'];
|
||||||
|
|
||||||
$AddAtributsEquipments->save();
|
$AddAtributsEquipments->save();
|
||||||
}
|
}
|
||||||
//Criar associacao do equipamento ao Âmbito
|
//Criar associacao do equipamento ao Âmbito
|
||||||
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
||||||
$AssociationEquipmentAmbit->equipment_type_id = $request->equipmentTypeId;
|
$AssociationEquipmentAmbit->equipment_type_id = $request->equipmentTypeId;
|
||||||
$AssociationEquipmentAmbit->ambits_id = $request->EquipmentAmbit;
|
$AssociationEquipmentAmbit->ambits_id = $request->EquipmentAmbit;
|
||||||
$AssociationEquipmentAmbit->equipment_id = $equipmentID;
|
$AssociationEquipmentAmbit->equipmentWorkHistorys_id = $equipmentWorkHistorysID;
|
||||||
$AssociationEquipmentAmbit->save();
|
|
||||||
|
|
||||||
|
$AssociationEquipmentAmbit->save();
|
||||||
|
|
||||||
$execution_order = 1;
|
$execution_order = 1;
|
||||||
|
|
||||||
|
|
@ -827,7 +948,7 @@ public function createEquipmentManual(Request $request)
|
||||||
|
|
||||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||||
$JoinsEquipmentsWithTasks->equipment_id = $equipmentID;
|
$JoinsEquipmentsWithTasks->equipmentWorkHistorys_id = $equipmentWorkHistorysID;
|
||||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||||
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
||||||
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
||||||
|
|
@ -835,7 +956,6 @@ public function createEquipmentManual(Request $request)
|
||||||
$JoinsEquipmentsWithTasks->save();
|
$JoinsEquipmentsWithTasks->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// O $request->numberProject e sempre necessario retornar para indicar a obra que se esta modificando...
|
// O $request->numberProject e sempre necessario retornar para indicar a obra que se esta modificando...
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('success', 'Equipamento criado com sucesso')
|
->with('success', 'Equipamento criado com sucesso')
|
||||||
|
|
@ -849,58 +969,70 @@ public function receiveIdEquipment(Equipment $equipment)
|
||||||
|
|
||||||
public function processStep2(Request $request)
|
public function processStep2(Request $request)
|
||||||
{
|
{
|
||||||
// dd($request);
|
|
||||||
// Valide e processe os dados do formulário
|
// Valide e processe os dados do formulário
|
||||||
$file = $request->file('documento');
|
$file = $request->file('documento');
|
||||||
|
|
||||||
// Recebe a id do Projecto criado
|
// Recebe a id do Projecto criado
|
||||||
$company_projects_id = $request->numberProject;
|
$company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
// Inicializa o contador para ispt_number
|
// Inicializa o contador para ispt_number
|
||||||
$isptNumber = 1;
|
$isptNumber = 1;
|
||||||
|
|
||||||
// Certifique-se de que um arquivo foi enviado
|
// Certifique-se de que um arquivo foi enviado
|
||||||
if ($file) {
|
if ($file) {
|
||||||
|
//Busca o nome do arquivo xslx.
|
||||||
|
$originalFileName = $file->getClientOriginalName();
|
||||||
// Carregue o arquivo Excel
|
// Carregue o arquivo Excel
|
||||||
$spreadsheet = IOFactory::load($file->path());
|
$spreadsheet = IOFactory::load($file->path());
|
||||||
|
// Obtenha a primeira planilha, onde fica os nomes chaves para associar as tabelas : 'general_attributes_equipaments' ,'equipments' e 'equipmentWorkHistorys'
|
||||||
// Obtenha a primeira planilha, onde fica os nomes chaves para associar a tabela : general_attributes_equipaments
|
|
||||||
$worksheet = $spreadsheet->getSheet(0);
|
$worksheet = $spreadsheet->getSheet(0);
|
||||||
|
|
||||||
|
|
||||||
// Transforme os dados da planilha em um array
|
// Transforme os dados da planilha em um array
|
||||||
$data = $worksheet->toArray();
|
$data = $worksheet->toArray();
|
||||||
|
|
||||||
// Retorna um array com todos os names preenchidos na primeira linha do template de Excel
|
// Retorna um array com todos os names preenchidos na primeira linha do template de Excel
|
||||||
$nomesColunas = $data[0];
|
$columnNames = $data[0];
|
||||||
|
|
||||||
// dd($nomesColunas);
|
|
||||||
|
|
||||||
$countPendingEquipments = 0;
|
$countPendingEquipments = 0;
|
||||||
$countNewEquipment = 0;
|
$countNewEquipment = 0;
|
||||||
|
|
||||||
// Comece a partir da sexta linha
|
// Recebo os nomes das colunas do execel dependendo da linguagem selecionada
|
||||||
|
$columnRealNames = $data[5];
|
||||||
|
|
||||||
|
$equipmentPendingLogs = [];
|
||||||
|
$ignoredLines = [];
|
||||||
|
|
||||||
|
// Comece a partir da sexta linha do template os dados dos Equipamentos
|
||||||
for ($i = 6; $i < count($data); $i++) {
|
for ($i = 6; $i < count($data); $i++) {
|
||||||
|
|
||||||
$dadosLinha = $data[$i];
|
$dataLines = $data[$i];
|
||||||
|
|
||||||
// Verifica se os 5 primeiros campos essenciais estao preenchidos, um deles não estiver preenchido ele ignora e não cria o equipamento
|
// Verifica se a coluna 'fábrica' (primeiro campo) está vazia
|
||||||
$isEmpty = false;
|
if (empty($dataLines[0])) {
|
||||||
for ($j = 0; $j < 5; $j++) {
|
// Se a coluna 'fábrica' estiver vazia, pule para a próxima linha
|
||||||
if (empty($dadosLinha[$j])) {
|
|
||||||
$isEmpty = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($isEmpty) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$emptyFields = [];
|
||||||
|
|
||||||
|
// Verifica se os 5 primeiros campos essenciais estão preenchidos
|
||||||
|
for ($j = 0; $j < 5; $j++) {
|
||||||
|
if (empty($dataLines[$j])) {
|
||||||
|
// Adiciona o índice do campo vazio ao array $camposVazios
|
||||||
|
$emptyFields[] = $columnRealNames[$j]; // ou simplesmente $j se não tiver o nome da coluna
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($emptyFields)) {
|
||||||
|
// Se houver campos vazios, adicione a linha e os campos vazios às linhas ignoradas
|
||||||
|
$ignoredLines[] = [
|
||||||
|
'line' => $i + 1,
|
||||||
|
'emptyFields' => $emptyFields
|
||||||
|
];
|
||||||
|
continue; // Pula para a próxima linha
|
||||||
|
}
|
||||||
|
|
||||||
// Em cada um das linhas horizontais do excel, vai se guardar a 'key' vinculada ao valor do campo preenchido ou seja a 'key' vai ter o mesmo nome de um dos dados da tabela 'general_attributes_equipaments' na coluna : general_attributes_equipment_description, assim sendo mais facil implementar na tabela : specific_attributes_equipament_types
|
// Em cada um das linhas horizontais do excel, vai se guardar a 'key' vinculada ao valor do campo preenchido ou seja a 'key' vai ter o mesmo nome de um dos dados da tabela 'general_attributes_equipaments' na coluna : general_attributes_equipment_description, assim sendo mais facil implementar na tabela : specific_attributes_equipament_types
|
||||||
$juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
$joinArrays = array_combine($columnNames, $dataLines);
|
||||||
|
|
||||||
// vai guardar todos os campos de possiveis novos equipamentos, cada um em um array para multiplos inserts, na base de dados
|
// vai guardar todos os campos de possiveis novos equipamentos, cada um em um array para multiplos inserts, na base de dados
|
||||||
$datas = array_filter($juntarArrays, function ($chave) {
|
$datas = array_filter($joinArrays, function ($chave) {
|
||||||
return !empty($chave);
|
return !empty($chave);
|
||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
|
|
@ -917,22 +1049,46 @@ public function processStep2(Request $request)
|
||||||
|
|
||||||
if ($existingEquipment) {
|
if ($existingEquipment) {
|
||||||
|
|
||||||
|
$foundInExcel = false;
|
||||||
|
$rowExcelDuplicated = null;
|
||||||
|
|
||||||
|
// Verificar duplicatas no Excel
|
||||||
|
for ($j = 6; $j < $i; $j++) {
|
||||||
|
if ($data[$j][0] === $datas['unit'] && $data[$j][1] === $datas['equipment_tag'] && $data[$j][4] === $datas['equipment_description']) {
|
||||||
|
$foundInExcel = true;
|
||||||
|
$rowExcelDuplicated = $j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
// Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
||||||
$pendingEquipament = new PendingEquipment;
|
$pendingEquipament = new PendingEquipment;
|
||||||
|
|
||||||
// Defina os atributos do pendingEquipament conforme necessário.
|
// Defina os atributos do pendingEquipament conforme necessário.
|
||||||
$pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
$pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
||||||
$pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
$pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
$pendingEquipament->pending_equipment_tag = $datas['tag'];
|
$pendingEquipament->pending_equipment_tag = $datas['equipment_tag'];
|
||||||
$pendingEquipament->pending_equipment_description = $datas['equipment_Description'];
|
$pendingEquipament->pending_equipment_description = $datas['equipment_description'];
|
||||||
$pendingEquipament->pending_equipment_serial_number = $datas['n_serie'];
|
$pendingEquipament->pending_equipment_serial_number = $datas['serial_number'];
|
||||||
$pendingEquipament->pending_equipment_brand = $datas['modelo'];
|
$pendingEquipament->pending_equipment_brand = $datas['model'];
|
||||||
$pendingEquipament->pending_company_projects_id = $company_projects_id;
|
$pendingEquipament->pending_company_projects_id = $company_projects_id;
|
||||||
$pendingEquipament->save();
|
$pendingEquipament->save();
|
||||||
|
|
||||||
// Incremente o contador de PendingEquipments
|
// Incremente o contador de PendingEquipments
|
||||||
$countPendingEquipments++;
|
$countPendingEquipments++;
|
||||||
|
|
||||||
|
// A variavel $pendenteLogs, na 'linhaExcel' vai recebe a linha do execel onde encontrou a duplicata em Array, vinda do primeiro $data, onde transforma toda o execel em array
|
||||||
|
// 'existingEquipmentId' vai ver qual o id do equipament que esta sendo duplicado.
|
||||||
|
//'duplicadoNoExcel' vai ser um boolean indicando que este valor duplicado veio da base de dados ou se foi de uma coluna anterior.
|
||||||
|
// linhaExcelDuplicada se o valor de duplicadoNoExcel for 'true' quer dizer que existe uma linha anterior com o mesmos dados, e essa variavel busco a o numero do array desta linha com base na variavel primeiro $data
|
||||||
|
$equipmentPendingLogs[] = [
|
||||||
|
'rowExecel' => $i + 1,
|
||||||
|
'pendingEquipmentId' => $pendingEquipament->pending_equipment_id,
|
||||||
|
'existingEquipmentId' => $existingEquipment->equipment_id,
|
||||||
|
'foundInExcel' => $foundInExcel,
|
||||||
|
'rowExcelDuplicated' => $rowExcelDuplicated
|
||||||
|
];
|
||||||
|
|
||||||
// Continue com o próximo loop.
|
// Continue com o próximo loop.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -943,22 +1099,31 @@ public function processStep2(Request $request)
|
||||||
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
$newEquipament->equipment_Description = $datas['equipment_description'];
|
$newEquipament->equipment_Description = $datas['equipment_description'];
|
||||||
$newEquipament->equipment_tag = $datas['equipment_tag'];
|
$newEquipament->equipment_tag = $datas['equipment_tag'];
|
||||||
$newEquipament->equipment_serial_number = $datas['equipment_serial_number'];
|
$newEquipament->equipment_serial_number = $datas['serial_number'];
|
||||||
$newEquipament->equipment_brand = $datas['equipment_brand'];
|
$newEquipament->equipment_brand = $datas['brand'];
|
||||||
$newEquipament->equipment_model = $datas['equipment_model'];
|
$newEquipament->equipment_model = $datas['model'];
|
||||||
$newEquipament->ispt_number = $isptNumber;
|
|
||||||
$newEquipament->company_projects_id = $company_projects_id;
|
$newEquipament->company_projects_id = $company_projects_id;
|
||||||
|
|
||||||
$newEquipament->save();
|
$newEquipament->save();
|
||||||
|
|
||||||
$countNewEquipment++;
|
$countNewEquipment++;
|
||||||
|
|
||||||
$isptNumber++;
|
|
||||||
|
|
||||||
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
||||||
$receveEquipment_ID = $newEquipament->equipment_id;
|
$receveEquipment_ID = $newEquipament->equipment_id;
|
||||||
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistory = new EquipmentWorkHistory;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistory->equipment_id = $receveEquipment_ID;
|
||||||
|
$newEquipmentWorkHistory->ispt_number = $isptNumber;
|
||||||
|
$newEquipmentWorkHistory->company_projects_id = $company_projects_id;
|
||||||
|
|
||||||
|
$newEquipmentWorkHistory->save();
|
||||||
|
|
||||||
|
// Recebe o Id do 'EquipmentWorkHistory' criado.
|
||||||
|
$recebeNewEquipmentWorkHistoryID = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||||
|
|
||||||
|
$isptNumber++;
|
||||||
|
|
||||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
||||||
|
|
||||||
|
|
@ -968,9 +1133,10 @@ public function processStep2(Request $request)
|
||||||
|
|
||||||
//Criar associacao do equipamento ao Âmbito
|
//Criar associacao do equipamento ao Âmbito
|
||||||
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
||||||
|
|
||||||
$AssociationEquipmentAmbit->equipment_type_id = $receveEquipament_type_ID;
|
$AssociationEquipmentAmbit->equipment_type_id = $receveEquipament_type_ID;
|
||||||
$AssociationEquipmentAmbit->ambits_id = $ambit_id;
|
$AssociationEquipmentAmbit->ambits_id = $ambit_id;
|
||||||
$AssociationEquipmentAmbit->equipment_id = $receveEquipment_ID;
|
$AssociationEquipmentAmbit->equipmentWorkHistorys_id = $recebeNewEquipmentWorkHistoryID;
|
||||||
$AssociationEquipmentAmbit->save();
|
$AssociationEquipmentAmbit->save();
|
||||||
|
|
||||||
$execution_order = 1;
|
$execution_order = 1;
|
||||||
|
|
@ -980,7 +1146,8 @@ public function processStep2(Request $request)
|
||||||
|
|
||||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||||
$JoinsEquipmentsWithTasks->equipment_id = $receveEquipment_ID;
|
|
||||||
|
$JoinsEquipmentsWithTasks->equipmentWorkHistorys_id = $recebeNewEquipmentWorkHistoryID;
|
||||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||||
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
||||||
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
||||||
|
|
@ -992,7 +1159,6 @@ public function processStep2(Request $request)
|
||||||
|
|
||||||
$generalAttributes = GeneralAttributesEquipment::all();
|
$generalAttributes = GeneralAttributesEquipment::all();
|
||||||
|
|
||||||
|
|
||||||
foreach ($generalAttributes as $generalAttribute) {
|
foreach ($generalAttributes as $generalAttribute) {
|
||||||
// Verifica se a chave existe em $datas, comparando com os dados da tabela : GeneralAttributesEquipment assim adicionando todos diferentes de NULL relacionados com o equipamento acabado de cria
|
// Verifica se a chave existe em $datas, comparando com os dados da tabela : GeneralAttributesEquipment assim adicionando todos diferentes de NULL relacionados com o equipamento acabado de cria
|
||||||
if (isset($datas[$generalAttribute->general_attributes_equipment_description])) {
|
if (isset($datas[$generalAttribute->general_attributes_equipment_description])) {
|
||||||
|
|
@ -1009,18 +1175,43 @@ public function processStep2(Request $request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Separa o nome do arquivo para obter o tipo de documento e a data-hora
|
||||||
|
$parts = explode('_', $originalFileName);
|
||||||
|
$documentType = $parts[2]; // 98
|
||||||
|
$timestamp = $parts[3]; // 2024-01-14_14-33
|
||||||
|
|
||||||
|
// Cria um array agrupado
|
||||||
|
$groupedArrayForPendingEquipments = [$documentType, [$timestamp, $equipmentPendingLogs]];
|
||||||
|
|
||||||
|
// Armazenar $groupedArrayForPendingEquipments na sessão
|
||||||
|
session(['groupedArrayForPendingEquipments' => $groupedArrayForPendingEquipments]);
|
||||||
|
|
||||||
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
||||||
|
|
||||||
// $pendingEquipments = session('pendingEquipments');
|
// Verifica se foram criados equipamentos pendentes,e se nesses pendentes vieram do execel ou da base de dados, alem de indicar as linha nao preenchidas.
|
||||||
if ($countPendingEquipments != 0) {
|
// if ($countPendingEquipments != 0 && !empty($pendenteLogs) && !empty($linhasIgnoradas)) {
|
||||||
// return redirect()->route('test2')->with('Danger', 'Equipamentos Pendentes')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
// return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
// ->with('danger', 'Equipamentos Pendentes criados : ' . $countPendingEquipments)
|
||||||
|
// ->with('dangerPendenteLogs', ['linhasIgnoradas' => $linhasIgnoradas, 'pendenteLogs' => $pendenteLogs])
|
||||||
|
// ->with('pendingEquipments', $pendingEquipments);
|
||||||
|
// }
|
||||||
|
// return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
// ->with('success', 'Equipamentos Criados :' . $countNewEquipment);
|
||||||
|
|
||||||
|
if ($countPendingEquipments != 0 && !empty($equipmentPendingLogs)) {
|
||||||
|
// Se houver equipamentos pendentes, redirecione com essa informação e inclua os $linhasIgnoradas se não estiverem vazios
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('danger', 'Equipamentos Pendentes criados : ' . $countPendingEquipments)
|
->with('danger', 'Equipamentos Pendentes criados: ' . $countPendingEquipments)
|
||||||
|
->with('dangerLogs', $ignoredLines)
|
||||||
|
->with('equipmentPendingLogs', $equipmentPendingLogs)
|
||||||
->with('pendingEquipments', $pendingEquipments);
|
->with('pendingEquipments', $pendingEquipments);
|
||||||
// ->with('success', 'Equipamentos Criados :' . count($listValves))
|
} else {
|
||||||
}
|
// Se não houver equipamentos pendentes, redirecione com uma mensagem de sucesso e inclua os $linhasIgnoradas se não estiverem vazios
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('success', 'Equipamentos Criados :' . $countNewEquipment);
|
->with('success', 'Equipamentos Criados: ' . $countNewEquipment)
|
||||||
|
->with('dangerLogs', $ignoredLines);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Nao chega aqui ainda pois volta para a pagina com dados ja carregados.
|
//Nao chega aqui ainda pois volta para a pagina com dados ja carregados.
|
||||||
|
|
@ -1156,11 +1347,7 @@ public function processStep3(Request $request)
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
// $results = DB::table('equipaments')
|
|
||||||
// ->join('specific_attributes_equipament_types', 'equipaments.equipment_ID', '=', 'specific_attributes_equipament_types.tb_equipament_id')
|
|
||||||
// ->join('general_attributes_equipaments', 'specific_attributes_equipament_types.specific_Attributes_Equipment_Type_ID', '=', 'general_attributes_equipaments.general_Attributes_Equipment_ID')
|
|
||||||
// ->select('equipaments.tag', 'general_attributes_equipaments.description', 'specific_attributes_equipament_types.value')
|
|
||||||
// ->get();
|
|
||||||
|
|
||||||
$results = DB::table('equipments')
|
$results = DB::table('equipments')
|
||||||
->join('specific_attributes_equipament_types', 'equipments.equipment_id', '=', 'specific_attributes_equipament_types.equipment_id')
|
->join('specific_attributes_equipament_types', 'equipments.equipment_id', '=', 'specific_attributes_equipament_types.equipment_id')
|
||||||
|
|
@ -1284,205 +1471,4 @@ public function getAttributes($id)
|
||||||
$equipment = Equipment::with('specificAttributes')->find($id);
|
$equipment = Equipment::with('specificAttributes')->find($id);
|
||||||
return response()->json($equipment->specificAttributes);
|
return response()->json($equipment->specificAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function createEquipamentProject(Request $request)
|
|
||||||
// {
|
|
||||||
// $file = $request->file('documento');
|
|
||||||
|
|
||||||
// // Certifique-se de que um arquivo foi enviado
|
|
||||||
// if ($file) {
|
|
||||||
// // Carregue o arquivo Excel
|
|
||||||
// $spreadsheet = IOFactory::load($file->path());
|
|
||||||
|
|
||||||
// // Obtenha a primeira planilha
|
|
||||||
// $worksheet = $spreadsheet->getSheet(0);
|
|
||||||
|
|
||||||
// // Transforme os dados da planilha em um array
|
|
||||||
// $data = $worksheet->toArray();
|
|
||||||
|
|
||||||
// $nomesColunas = $data[0];
|
|
||||||
|
|
||||||
// $dadosLinha6 = $data[6];
|
|
||||||
|
|
||||||
// $juntarArrays = array_combine($nomesColunas, $dadosLinha6);
|
|
||||||
|
|
||||||
// $datas = array_filter($juntarArrays, function ($chave) {
|
|
||||||
// return !empty($chave);
|
|
||||||
// }, ARRAY_FILTER_USE_KEY);
|
|
||||||
|
|
||||||
// $equipamentType = equipament_type::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
|
||||||
// $checkFactory = factorie::where('factories_name', $datas['fabrica'])->first();
|
|
||||||
|
|
||||||
|
|
||||||
// $newEquipament = new equipament;
|
|
||||||
// //Primeiro tem de derificar se a fabrica existe, senão cria uma.
|
|
||||||
// $newEquipament->factory_id = $checkFactory->factories_id;
|
|
||||||
// $newEquipament->equipament_type_id = $equipamentType->equipament_type_id;
|
|
||||||
// $newEquipament->equipment_Description = $datas['equipment_Description'];
|
|
||||||
// $newEquipament->tag = $datas['tag'];
|
|
||||||
// $newEquipament->serial_number = $datas['n_serie'];
|
|
||||||
// $newEquipament->model = $datas['modelo'];
|
|
||||||
|
|
||||||
// $newEquipament->save();
|
|
||||||
|
|
||||||
|
|
||||||
// $receveEquipment_ID = $newEquipament->id;
|
|
||||||
// $receveEquipament_type_ID = $newEquipament->equipament_type_id;
|
|
||||||
|
|
||||||
|
|
||||||
// // Atributos que você quer buscar e inserir
|
|
||||||
// $attributes = ["dimension", "dn_ent", "p&id", "n_sap", "isolation", "scaffolding", "grua", "interlocks"];
|
|
||||||
|
|
||||||
// // $attributes = array_slice($data[0], 7);
|
|
||||||
|
|
||||||
// foreach ($attributes as $attribute) {
|
|
||||||
|
|
||||||
// // Buscar o atributo na tabela general_attributes_equipament
|
|
||||||
// $generalAttribute = general_attributes_equipament::where('description', $attribute)->first();
|
|
||||||
|
|
||||||
|
|
||||||
// // Se o atributo foi encontrado
|
|
||||||
// if (!is_null($generalAttribute)) {
|
|
||||||
// // Criar um novo registro em specific_attributes_equipament_Types
|
|
||||||
// $specificAttribute = new specific_attributes_equipament_type;
|
|
||||||
|
|
||||||
// $specificAttribute->tb_equipament_id = $receveEquipment_ID;
|
|
||||||
// $specificAttribute->equipament_Type_id = $receveEquipament_type_ID;
|
|
||||||
// $specificAttribute->specific_attributes_equipment_type_id = $generalAttribute->general_attributes_equipment_id;
|
|
||||||
// $specificAttribute->value = $datas[$attribute];
|
|
||||||
|
|
||||||
// $specificAttribute->save();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $listValves = equipament::all();
|
|
||||||
|
|
||||||
// return redirect()->route('testExcel')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public function createEquipamentProject(Request $request)
|
|
||||||
// {
|
|
||||||
// $file = $request->file('documento');
|
|
||||||
|
|
||||||
// // Certifique-se de que um arquivo foi enviado
|
|
||||||
// if ($file) {
|
|
||||||
// // Carregue o arquivo Excel
|
|
||||||
// $spreadsheet = IOFactory::load($file->path());
|
|
||||||
|
|
||||||
// // Obtenha a primeira planilha
|
|
||||||
// $worksheet = $spreadsheet->getSheet(0);
|
|
||||||
|
|
||||||
// // Transforme os dados da planilha em um array
|
|
||||||
// $data = $worksheet->toArray();
|
|
||||||
|
|
||||||
// $nomesColunas = $data[0];
|
|
||||||
|
|
||||||
// // Atributos que você quer buscar e inserir
|
|
||||||
// $attributes = ["dimension", "dn_ent", "p&id", "n_sap", "isolation", "scaffolding", "grua", "interlocks"];
|
|
||||||
|
|
||||||
// // Comece a partir da sexta linha
|
|
||||||
// for ($i = 6; $i < count($data); $i++) {
|
|
||||||
|
|
||||||
// $dadosLinha = $data[$i];
|
|
||||||
|
|
||||||
// //Se não preencher o campo $dadosLinha[0], não cria um novo equipamento
|
|
||||||
// //Trocar pelos 5 primeiros
|
|
||||||
// if (empty($dadosLinha[0])) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// $juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
|
||||||
|
|
||||||
// $datas = array_filter($juntarArrays, function ($chave) {
|
|
||||||
// return !empty($chave);
|
|
||||||
// }, ARRAY_FILTER_USE_KEY);
|
|
||||||
|
|
||||||
// $equipmentType = EquipmentType::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
|
||||||
|
|
||||||
// $checkFactory = Unit::where('unit_name', $datas['fabrica'])->first();
|
|
||||||
|
|
||||||
|
|
||||||
// // Antes de criar o novo equipamento, verifique se já existe um equipamento
|
|
||||||
// // com o mesmo factory_id e tag.
|
|
||||||
// $existingEquipment = Equipment::where('unit_id', $checkFactory->unit_id)
|
|
||||||
// ->where('equipment_tag', $datas['tag'])
|
|
||||||
// ->first();
|
|
||||||
|
|
||||||
// if ($existingEquipment) {
|
|
||||||
// // Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
|
||||||
// $pendingEquipament = new PendingEquipment;
|
|
||||||
// // Defina os atributos do pendingEquipament conforme necessário.
|
|
||||||
// $pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
|
||||||
// $pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
|
||||||
// $pendingEquipament->pending_equipment_tag = $datas['tag'];
|
|
||||||
// $pendingEquipament->pending_equipment_description = $datas['equipment_Description'];
|
|
||||||
// $pendingEquipament->pending_equipment_serial_number = $datas['n_serie'];
|
|
||||||
// $pendingEquipament->pending_equipment_brand = $datas['modelo'];
|
|
||||||
|
|
||||||
// $pendingEquipament->save();
|
|
||||||
|
|
||||||
// // Adicione uma variável de sessão para indicar que um equipamento pendente foi criado.
|
|
||||||
// session(['pendingEquipmentCreated' => true]);
|
|
||||||
|
|
||||||
// // Adicione uma variável de sessão para indicar que um equipamento pendente foi criado.
|
|
||||||
// session()->push('pendingEquipments', $pendingEquipament);
|
|
||||||
|
|
||||||
// // Continue com o próximo loop.
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $newEquipament = new Equipment;
|
|
||||||
|
|
||||||
// $newEquipament->unit_id = $checkFactory->unit_id;
|
|
||||||
// $newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
|
||||||
// $newEquipament->equipment_Description = $datas['equipment_Description'];
|
|
||||||
// $newEquipament->equipment_tag = $datas['tag'];
|
|
||||||
// $newEquipament->equipment_serial_number = $datas['n_serie'];
|
|
||||||
// $newEquipament->equipment_model = $datas['modelo'];
|
|
||||||
|
|
||||||
// $newEquipament->save();
|
|
||||||
|
|
||||||
// $receveEquipment_ID = $newEquipament->equipment_id;
|
|
||||||
|
|
||||||
// $receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
|
||||||
|
|
||||||
|
|
||||||
// foreach ($attributes as $attribute) {
|
|
||||||
|
|
||||||
// $generalAttribute = GeneralAttributesEquipment::where('general_attributes_equipment_description', $attribute)->first();
|
|
||||||
|
|
||||||
// if (!is_null($generalAttribute)) {
|
|
||||||
|
|
||||||
// $specificAttribute = new SpecificAttributesEquipmentType;
|
|
||||||
|
|
||||||
// $specificAttribute->equipment_id = $receveEquipment_ID;
|
|
||||||
// $specificAttribute->equipment_type_id = $receveEquipament_type_ID;
|
|
||||||
// $specificAttribute->specific_attributes_equipment_type_id = $generalAttribute->general_attributes_equipment_id;
|
|
||||||
// $specificAttribute->specific_attributes_value = $datas[$attribute];
|
|
||||||
|
|
||||||
// // $specificAttribute->save();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $listValves = Equipment::all();
|
|
||||||
// $pendingEquipments = PendingEquipment::all();
|
|
||||||
|
|
||||||
// // return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
|
||||||
|
|
||||||
// // return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
|
||||||
|
|
||||||
// $listValves = Equipment::all();
|
|
||||||
// $pendingEquipments = session('pendingEquipments');
|
|
||||||
// if ($pendingEquipments) {
|
|
||||||
// return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
|
||||||
// } else {
|
|
||||||
// return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ public function getDataEquipment(Request $request)
|
||||||
$receiveAllClients = $request->get('receiveAllClients');
|
$receiveAllClients = $request->get('receiveAllClients');
|
||||||
|
|
||||||
$receiveAllPlants = $request->get('receiveAllPlants');
|
$receiveAllPlants = $request->get('receiveAllPlants');
|
||||||
|
|
||||||
$receiveAllUnits = $request->get('receiveAllUnits');
|
$receiveAllUnits = $request->get('receiveAllUnits');
|
||||||
|
|
||||||
$receiveEquipmentsType = $request->get('receiveEquipmentsType');
|
$receiveEquipmentsType = $request->get('receiveEquipmentsType');
|
||||||
|
|
@ -107,14 +106,12 @@ public function getDataEquipment(Request $request)
|
||||||
|
|
||||||
$query = Equipment::with('equipmentType', 'unit')
|
$query = Equipment::with('equipmentType', 'unit')
|
||||||
->whereIn('unit_id', $unitsIds)
|
->whereIn('unit_id', $unitsIds)
|
||||||
->select(['equipment_id', 'ispt_number', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
->select(['equipment_id', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Query padrão que todas as dataTables recebem, a partir dele fazemos os filt
|
// Query padrão que todas as dataTables recebem, a partir dele fazemos os filt
|
||||||
$query = Equipment::with('equipmentType', 'unit')
|
$query = Equipment::with('equipmentType', 'unit')
|
||||||
->select(['equipment_id', 'ispt_number', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
->select(['equipment_id', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consultas para a Criacao da Obra, Ambas vao ser diferentes, pois na creacao, recebes os equipamentos por obra, porem no portifolio vamos buscar todos.
|
// Consultas para a Criacao da Obra, Ambas vao ser diferentes, pois na creacao, recebes os equipamentos por obra, porem no portifolio vamos buscar todos.
|
||||||
|
|
@ -171,17 +168,41 @@ public function getDataEquipment(Request $request)
|
||||||
})
|
})
|
||||||
|
|
||||||
->addColumn('action', function ($equipment) use ($numberProject) {
|
->addColumn('action', function ($equipment) use ($numberProject) {
|
||||||
// Verifica se $numberProject não é nulo
|
$dropdownHtml = '<div class="d-flex justify-content-center dropdown">
|
||||||
if (!is_null($numberProject)) {
|
<button data-toggle="dropdown" aria-expanded="false" class="actions-btn btn btn-light circle">
|
||||||
// Se não for nulo, usa a rota 'test11'
|
<i class="fa fa-ellipsis-v"></i>
|
||||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('test11', ['projectID' => $numberProject, 'equipmentID' => $equipment->equipment_id]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
</button>
|
||||||
} else {
|
<div class="dropdown-menu dropdown-menu-light">';
|
||||||
// Se for nulo, usa a rota 'test22'
|
|
||||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('test22', ['equipmentID' => $equipment->equipment_id]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
// Adiciona a primeira ação (Detalhes do equipamento)
|
||||||
}
|
$detailsUrl = !is_null($numberProject) ? route('test11', ['projectID' => $numberProject, 'equipmentID' => $equipment->equipment_id]) : route('test22', ['equipmentID' => $equipment->equipment_id]);
|
||||||
return $actionBtn;
|
$dropdownHtml .= '<a href="' . $detailsUrl . '" class="dropdown-item text-primary">
|
||||||
|
<i class="fa-solid fa-eye text-primary"></i>
|
||||||
|
Detalhes
|
||||||
|
</a>';
|
||||||
|
|
||||||
|
// Adiciona a ação para abrir a modal para Trocar de Ambito
|
||||||
|
$dropdownHtml .= '<button class="dropdown-item text-primary" data-toggle="modal" data-target="#modal-changeAmbitEquipment-' . $equipment->equipment_id . '">
|
||||||
|
<i class="fa-solid fa-pen text-primary"></i>
|
||||||
|
Trocar de Ambito
|
||||||
|
</button>';
|
||||||
|
|
||||||
|
// Adiciona a ação para abrir a modal para apagar
|
||||||
|
$dropdownHtml .= '<button class="dropdown-item text-primary" data-toggle="modal" data-target="#modal-confirmDeleteEquipmentInProject-' . $equipment->equipment_id . '">
|
||||||
|
<i class="fa-solid fa-trash text-primary"></i>
|
||||||
|
Apagar
|
||||||
|
</button>';
|
||||||
|
|
||||||
|
|
||||||
|
// Adicionar outras ações aqui, como editar e deletar, conforme necessário
|
||||||
|
//Adicionar o "Apagar" e "Trocar de Ambito"
|
||||||
|
|
||||||
|
$dropdownHtml .= '</div></div>'; // Fecha as tags do dropdown
|
||||||
|
|
||||||
|
return $dropdownHtml;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
->editColumn('unit_id', function ($equipment) {
|
->editColumn('unit_id', function ($equipment) {
|
||||||
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
||||||
return $equipment->unit->unit_name ?? 'N/A';
|
return $equipment->unit->unit_name ?? 'N/A';
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\AmbitsEquipment;
|
use App\Models\AmbitsEquipment;
|
||||||
|
use App\Models\EquipmentWorkHistory;
|
||||||
use App\Models\Unit;
|
use App\Models\Unit;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
@ -76,8 +77,12 @@ public function test11($projectID, $equipmentID)
|
||||||
|
|
||||||
$dataEquipment = Equipment::find($equipmentID);
|
$dataEquipment = Equipment::find($equipmentID);
|
||||||
|
|
||||||
|
$receiveEquipmentWorkHistorys = EquipmentWorkHistory::where('equipment_id', $equipmentID)
|
||||||
|
->where('company_projects_id', $projectID)
|
||||||
|
->first();
|
||||||
|
|
||||||
$attributes = SpecificAttributesEquipmentType::where('equipment_id', $equipmentID)->get(); // recebe todos os atributos espesificos do equipamento
|
$attributes = SpecificAttributesEquipmentType::where('equipment_id', $equipmentID)->get(); // recebe todos os atributos espesificos do equipamento
|
||||||
$OrdemTasks = OrderEquipmentTasks::where('equipment_id', $equipmentID)->get(); // Todas as tarefas que o equipamento vai realizar :
|
$OrdemTasks = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistorys->equipmentWorkHistorys_id)->get(); // Todas as tarefas que o equipamento vai realizar :
|
||||||
$OrdemTasksIds = $OrdemTasks->pluck('elemental_tasks_id')->all(); // Array de IDs
|
$OrdemTasksIds = $OrdemTasks->pluck('elemental_tasks_id')->all(); // Array de IDs
|
||||||
|
|
||||||
return view('projectsClients.articulated_2_ShowEquipment', compact('dataEquipment', 'OrdemTasks', 'OrdemTasksIds'));
|
return view('projectsClients.articulated_2_ShowEquipment', compact('dataEquipment', 'OrdemTasks', 'OrdemTasksIds'));
|
||||||
|
|
@ -119,18 +124,19 @@ public function getEquipmentDetails($receiveListEquipmentId)
|
||||||
return response()->json($equipments);
|
return response()->json($equipments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function receiveAllInstallationEquipment(Request $request)
|
||||||
public function receiveAllInstallationEquipment($receiveNumberProject)
|
|
||||||
{
|
{
|
||||||
|
$projectId = $request->get('receiveNumberProject');
|
||||||
|
|
||||||
$receveProject = CompanyProject::find($receiveNumberProject);
|
$receveProject = CompanyProject::find($projectId);
|
||||||
$receveEquipments = Equipment::whereHas('unit.plant', function ($query) use ($receveProject) {
|
$receveEquipments = Equipment::whereHas('unit.plant', function ($query) use ($receveProject) {
|
||||||
$query->where('plants.plant_id', '=', $receveProject->plant_id);
|
$query->where('plants.plant_id', '=', $receveProject->plant_id);
|
||||||
})
|
})
|
||||||
->where('company_projects_id', null) // Adiciona a condição aqui
|
|
||||||
->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment'])
|
|
||||||
->get();
|
|
||||||
|
|
||||||
|
->where('company_projects_id', null) // Adiciona a condição aqui
|
||||||
|
->with(['equipmentType', 'unit'])
|
||||||
|
// ->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment'])
|
||||||
|
->get();
|
||||||
|
|
||||||
return DataTables::of($receveEquipments)
|
return DataTables::of($receveEquipments)
|
||||||
->addColumn('equipment_type', function ($row) {
|
->addColumn('equipment_type', function ($row) {
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,25 @@ public function mount($workstation)
|
||||||
{
|
{
|
||||||
$this->workstation = $workstation;
|
$this->workstation = $workstation;
|
||||||
|
|
||||||
$this->receiveAllEquipments = Equipment::where('company_projects_id', $this->workstation->company_projects_id)
|
// $this->receiveAllEquipments = Equipment::where('company_projects_id', $this->workstation->company_projects_id)
|
||||||
->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
// ->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
||||||
|
// ->select('equipments.equipment_id', 'equipments.equipment_type_id', 'equipment_association_ambits.ambits_id')
|
||||||
|
// ->get()
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
$workstation = $this->workstation; // Atribuindo a uma variável local para uso na closure
|
||||||
|
|
||||||
|
$this->receiveAllEquipments = Equipment::join('equipment_work_historys', function ($join) use ($workstation) {
|
||||||
|
$join->on('equipments.equipment_id', '=', 'equipment_work_historys.equipment_id')
|
||||||
|
->where('equipment_work_historys.company_projects_id', '=', $workstation->company_projects_id);
|
||||||
|
})
|
||||||
|
->join('equipment_association_ambits', 'equipment_work_historys.equipmentWorkHistorys_id', '=', 'equipment_association_ambits.equipmentWorkHistorys_id')
|
||||||
->select('equipments.equipment_id', 'equipments.equipment_type_id', 'equipment_association_ambits.ambits_id')
|
->select('equipments.equipment_id', 'equipments.equipment_type_id', 'equipment_association_ambits.ambits_id')
|
||||||
->get()
|
->get()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->receiveAllFurtherTasks = FurtherTasks::where('company_projects_id', $this->workstation->company_projects_id)
|
$this->receiveAllFurtherTasks = FurtherTasks::where('company_projects_id', $this->workstation->company_projects_id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,8 @@ public function plant(){
|
||||||
public function user(){
|
public function user(){
|
||||||
return $this->hasOneThrough(User::class, Plant::class, 'plant_id', 'user_id');
|
return $this->hasOneThrough(User::class, Plant::class, 'plant_id', 'user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function EquipmentWorkHistory(){
|
||||||
|
return $this->hasMany(EquipmentWorkHistory::class, 'company_projects_id','company_projects_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public function specificAttributes()
|
||||||
->orderBy('general_attributes_equipaments.general_attributes_equipment_description', 'asc');
|
->orderBy('general_attributes_equipaments.general_attributes_equipment_description', 'asc');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Trocar para EquipmentWorkHistory
|
||||||
public function equipmentAssociationAmbit()
|
public function equipmentAssociationAmbit()
|
||||||
{
|
{
|
||||||
//Antiga hasMany , apenas colocado hasOne para funcionar o datatables
|
//Antiga hasMany , apenas colocado hasOne para funcionar o datatables
|
||||||
|
|
@ -57,14 +58,20 @@ public function controlEquipmentWorkstation()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ControlEquipmentWorkstation::class, 'equipment_id', 'equipment_id');
|
return $this->hasMany(ControlEquipmentWorkstation::class, 'equipment_id', 'equipment_id');
|
||||||
}
|
}
|
||||||
|
public function QrcodesAssociatedEquipment(){
|
||||||
|
return $this->hasMany(QrcodesAssociatedEquipment::class,'equipment_id','equipment_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function hasInspectionYes()
|
public function hasInspectionYes()
|
||||||
{
|
{
|
||||||
return $this->orderEquipmentTasks()->where('inspection', 'Sim')->exists();
|
return $this->orderEquipmentTasks()->where('inspection', 'Sim')->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function QrcodesAssociatedEquipment(){
|
|
||||||
return $this->hasMany(QrcodesAssociatedEquipment::class,'equipment_id','equipment_id');
|
|
||||||
|
|
||||||
|
public function EquipmentWorkHistory(){
|
||||||
|
return $this->hasMany(EquipmentWorkHistory::class, 'equipment_id','equipment_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,19 @@
|
||||||
class EquipmentWorkHistory extends Model
|
class EquipmentWorkHistory extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $table = 'equipment_work_historys';
|
||||||
|
|
||||||
|
protected $primaryKey = 'equipmentWorkHistorys_id';
|
||||||
|
|
||||||
|
public function equipment()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||||
|
}
|
||||||
|
public function companyProject()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Equipment::class, 'company_projects_id', 'company_projects_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
public/templateExcel/TestTemplate.xlsx → public/templateExcel/Valves_Template.xlsx
Executable file → Normal file
BIN
public/templateExcel/TestTemplate.xlsx → public/templateExcel/Valves_Template.xlsx
Executable file → Normal file
Binary file not shown.
|
|
@ -69,6 +69,29 @@
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.scrollable-list {
|
||||||
|
max-height: 200px;
|
||||||
|
/* Ajuste a altura máxima conforme necessário */
|
||||||
|
overflow-y: auto;
|
||||||
|
/* Permite a rolagem vertical se o conteúdo exceder a altura máxima */
|
||||||
|
}
|
||||||
|
.scrollable-list-xl {
|
||||||
|
max-height: 600px;
|
||||||
|
/* Ajuste a altura máxima conforme necessário */
|
||||||
|
overflow-y: auto;
|
||||||
|
/* Permite a rolagem vertical se o conteúdo exceder a altura máxima */
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-text {
|
||||||
|
margin-right: 10px;
|
||||||
|
/* ou o espaçamento que você preferir */
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-fields {
|
||||||
|
/* qualquer estilo adicional necessário */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#isptGroupLink:hover {
|
#isptGroupLink:hover {
|
||||||
color: #EAF3F6;
|
color: #EAF3F6;
|
||||||
}
|
}
|
||||||
|
|
@ -311,9 +334,8 @@ class="d-block">{{ Auth::user()->userType?->type_user }}</a>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{-- Menu para Cliente--}}
|
{{-- Menu para Cliente --}}
|
||||||
@elseif (Auth::user()->type_users == 3)
|
@elseif (Auth::user()->type_users == 3)
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ route('dashboardClient') }}" class="nav-link active">
|
<a href="{{ route('dashboardClient') }}" class="nav-link active">
|
||||||
<i class="nav-icon fas fa-tachometer-alt"></i>
|
<i class="nav-icon fas fa-tachometer-alt"></i>
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ class="brand-image img-circle elevation-3" style="opacity: .8">
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-treeview">
|
<ul class="nav nav-treeview">
|
||||||
@foreach ($equipmentsTodo as $equipmentTodo)
|
{{-- @foreach ($equipmentsTodo as $equipmentTodo)
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ route('getEquipmentData', $equipmentTodo->equipment_id) }}"
|
<a href="{{ route('getEquipmentData', $equipmentTodo->equipment_id) }}"
|
||||||
class="nav-link text-white">
|
class="nav-link text-white">
|
||||||
|
|
@ -158,7 +158,7 @@ class="nav-link text-white">
|
||||||
<p>{{ $equipmentTodo->equipment_tag }}</p>
|
<p>{{ $equipmentTodo->equipment_tag }}</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach --}}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
@ -170,14 +170,14 @@ class="nav-link text-white">
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-treeview">
|
<ul class="nav nav-treeview">
|
||||||
@foreach ($equipmentsReturned as $equipmentReturned)
|
{{-- @foreach ($equipmentsReturned as $equipmentReturned)
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#" class="nav-link text-white">
|
<a href="#" class="nav-link text-white">
|
||||||
<i class="fas fa-tag nav-icon"></i>
|
<i class="fas fa-tag nav-icon"></i>
|
||||||
<p>{{ $equipmentReturned->equipment_tag }}</p>
|
<p>{{ $equipmentReturned->equipment_tag }}</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach --}}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,12 @@
|
||||||
@section('Main-content')
|
@section('Main-content')
|
||||||
|
|
||||||
@if (session('success'))
|
@if (session('success'))
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
<div class="alert alert-success" role="alert" id="alert-message-success" style="transition: opacity 1s;">
|
<div class="alert alert-success" role="alert" id="alert-message-success" style="transition: opacity 1s;">
|
||||||
{{ session('success') }}
|
{{ session('success') }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('#alert-message-success').fadeOut('slow', function() {
|
$('#alert-message-success').fadeOut('slow', function() {
|
||||||
|
|
@ -16,9 +19,11 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (session('danger'))
|
@if (session('danger'))
|
||||||
|
<div class="content">
|
||||||
<div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
|
<div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
|
||||||
{{ session('danger') }}
|
{{ session('danger') }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('#alert-message-danger').fadeOut('slow', function() {
|
$('#alert-message-danger').fadeOut('slow', function() {
|
||||||
|
|
@ -29,11 +34,61 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@if (session('dangerLogs') && !empty(session('dangerLogs')))
|
||||||
|
<div class="content pt-3">
|
||||||
|
<div class="card card-danger collapsed-card">
|
||||||
|
|
||||||
|
<div class="card-header clickable">
|
||||||
|
<h3 class="card-title">Erros do Template</h3>
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-tool collapse-button" data-card-widget="collapse"><i
|
||||||
|
class="fas fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="card card-danger">
|
||||||
|
|
||||||
|
<div class="card-header clickable">
|
||||||
|
<h3 class="card-title">Linhas Ignoradas</h3>
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-tool collapse-button"
|
||||||
|
data-card-widget="collapse"><i class="fas fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card-body" style="padding: 0;margin-bottom: 0%">
|
||||||
|
<ul class="list-group scrollable-list">
|
||||||
|
@foreach (session('dangerLogs') as $ignoredLine)
|
||||||
|
<li class="list-group-item d-flex align-items-center" aria-current="true">
|
||||||
|
<span class="line-text">Linha: {{ $ignoredLine['line'] }}</span>
|
||||||
|
<span class="empty-fields"><b> - Campos Vazios:</b>
|
||||||
|
{{ implode(', ', $ignoredLine['emptyFields']) }}</span>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>{{-- ./card card-danger --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<input type="hidden" value="{{ $receiveNumberProject->company_projects_id }}" id="receiveNumberProject">
|
<input type="hidden" value="{{ $receiveNumberProject->company_projects_id }}" id="receiveNumberProject">
|
||||||
|
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- Progressbar -->
|
|
||||||
|
|
||||||
|
<!-- Progressbar -->
|
||||||
<ul id="progressbar" class="nav nav-pills d-flex flex-sm-row justify-content-center">
|
<ul id="progressbar" class="nav nav-pills d-flex flex-sm-row justify-content-center">
|
||||||
<li class="@if ($step == 2) active @endif "></li>
|
<li class="@if ($step == 2) active @endif "></li>
|
||||||
{{-- Project details --}}
|
{{-- Project details --}}
|
||||||
|
|
@ -78,7 +133,7 @@ class="fas fa-plus"></i></button>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- select -->
|
<!-- select -->
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm">
|
||||||
<label>Fabrica</label>
|
<label>Fabrica</label>
|
||||||
<select class="form-control" name="unit_id" id="unit_select" required>
|
<select class="form-control" name="unit_id" id="unit_select" required>
|
||||||
<option value='' hidden>Selecione Fabrica...</option>
|
<option value='' hidden>Selecione Fabrica...</option>
|
||||||
|
|
@ -91,7 +146,7 @@ class="fas fa-plus"></i></button>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-6" id="new_unit_div">
|
<div class="form-group col-sm" id="new_unit_div">
|
||||||
<label>Nova Fabrica :</label>
|
<label>Nova Fabrica :</label>
|
||||||
<input type="text" id="new_unit_name" class="form-control" name="new_unit_name"
|
<input type="text" id="new_unit_name" class="form-control" name="new_unit_name"
|
||||||
placeholder="Digite o nome da nova Fabrica" required>
|
placeholder="Digite o nome da nova Fabrica" required>
|
||||||
|
|
@ -146,7 +201,8 @@ class="form-control card_inputs" id="equipmentDescription"
|
||||||
placeholder="Descrição Equipamento..."
|
placeholder="Descrição Equipamento..."
|
||||||
aria-label="Tag Equipment"
|
aria-label="Tag Equipment"
|
||||||
aria-describedby="form-equipmentDescription" required>
|
aria-describedby="form-equipmentDescription" required>
|
||||||
<label>Descrição Equipamento <span class="required">*</span></label>
|
<label>Descrição Equipamento <span
|
||||||
|
class="required">*</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1073,7 +1129,7 @@ class="form-control card_inputs" id="PositionerSerialNumber"
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<div class="row text-center">
|
<div class="row text-center">
|
||||||
|
|
||||||
<div class="form-group col-sm-4">
|
<div class="form-group col-sm">
|
||||||
<label>Fabrica</label>
|
<label>Fabrica</label>
|
||||||
<select class="form-control" name="unit_id" id="unit_select2">
|
<select class="form-control" name="unit_id" id="unit_select2">
|
||||||
{{-- Antes era : 'unit_select' (caso de algum erro) --}}
|
{{-- Antes era : 'unit_select' (caso de algum erro) --}}
|
||||||
|
|
@ -1086,7 +1142,7 @@ class="form-control card_inputs" id="PositionerSerialNumber"
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-4">
|
<div class="form-group col-sm">
|
||||||
<label>Tipo de equipamento</label>
|
<label>Tipo de equipamento</label>
|
||||||
<select class="form-control" name="equipmentType_id" id="equipmentType_id_list">
|
<select class="form-control" name="equipmentType_id" id="equipmentType_id_list">
|
||||||
<option value='#' hidden>Selecionar Tipo de equipamento...
|
<option value='#' hidden>Selecionar Tipo de equipamento...
|
||||||
|
|
@ -1099,10 +1155,10 @@ class="form-control card_inputs" id="PositionerSerialNumber"
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-4">
|
{{-- <div class="form-group col-sm-4">
|
||||||
<label for="">Pesquisa</label>
|
<label for="">Pesquisa</label>
|
||||||
<input class="form-control" type="text">
|
<input class="form-control" type="text">
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<table id="tableSelectEquipements" class="table table-bordered table-striped">
|
<table id="tableSelectEquipements" class="table table-bordered table-striped">
|
||||||
|
|
@ -1220,7 +1276,6 @@ class="btn btn-info">Baixar Template</a>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Numero Ispt</th>
|
|
||||||
<th>Tag</th>
|
<th>Tag</th>
|
||||||
<th>Fabrica</th>
|
<th>Fabrica</th>
|
||||||
<th>Tipo</th>
|
<th>Tipo</th>
|
||||||
|
|
@ -1256,6 +1311,74 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{-- ./content --}}
|
{{-- ./content --}}
|
||||||
|
|
||||||
|
|
||||||
|
@foreach ($listEquipmentsProjects as $equipment)
|
||||||
|
<div class="modal fade" id="modal-confirmDeleteEquipmentInProject-{{ $equipment->equipment_id }}">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<!-- Conteúdo da modal -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-primary">
|
||||||
|
<h4 class="modal-title">Apagar Equipamento</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">x</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="{{ route('deleteEquipmentInProject') }}" method="post">
|
||||||
|
@csrf
|
||||||
|
Tem certeza de que deseja apagar o equipamento : {{ $equipment->equipment_tag }}?
|
||||||
|
<br><br>
|
||||||
|
<input type="hidden" name="equipmentId" value="{{ $equipment->equipment_id }}">
|
||||||
|
<select class="form-control" name="deleteEquipmentProject" id="">
|
||||||
|
<option value="complete">Apagar Por Completo</option>
|
||||||
|
<option value="onlyProject">Apagar da Obra</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<div class="modal-footer justify-content-between">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
|
||||||
|
<button type="submit" class="btn btn-success">Apagar</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="modal-changeAmbitEquipment-{{ $equipment->equipment_id }}">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<!-- Conteúdo da modal -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-primary">
|
||||||
|
<h4 class="modal-title">Trocar o Ambito, Equipamento : {{ $equipment->equipment_id }} </h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">x</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="{{route('changeAmbitEquipment')}}" method="post">
|
||||||
|
@csrf
|
||||||
|
<p>Seleciona o ambito para qual deseja ser trocado.</p>
|
||||||
|
<input type="hidden" class="equipmentType_id"
|
||||||
|
value="{{ $equipment->equipment_type_id }}">
|
||||||
|
<input type="hidden" name="equipmentID" value="{{ $equipment->equipment_id }}">
|
||||||
|
<select class="form-control ambitsEquipments_list" name="receveAmbit" id="receveAmbit">
|
||||||
|
</select>
|
||||||
|
<br>
|
||||||
|
<button data-dismiss="modal" class="btn btn-danger float-left ">Sair</button>
|
||||||
|
<button class="btn btn-primary float-right" type="submit">Trocar</button>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
<div class="modal fade" id="modal-addingEquipmentToProject">
|
<div class="modal fade" id="modal-addingEquipmentToProject">
|
||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -1274,33 +1397,56 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
||||||
<div class="table-responsive">
|
<!--Codigo Novo -->
|
||||||
<table class="table table-bordered table-striped">
|
<fieldset class="content">
|
||||||
<thead>
|
<div class="container-fluid">
|
||||||
<tr>
|
<h2 class="text-center">Equipamentos Pendentes de Criacao:</h2>
|
||||||
<th>Fabrica</th>
|
|
||||||
<th>Tipo de Equipamento</th>
|
|
||||||
<th>Tag</th>
|
|
||||||
<th>Descrição Equipamento</th>
|
|
||||||
<th>Número de Serie</th>
|
|
||||||
<th>Marca</th>
|
|
||||||
<th>Modelo</th>
|
|
||||||
<th>Açoẽs</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@isset($pendingEquipments)
|
@isset($pendingEquipments)
|
||||||
|
<ul class="list-group scrollable-list-xl">
|
||||||
@foreach ($pendingEquipments as $pendingEquipment)
|
@foreach ($pendingEquipments as $pendingEquipment)
|
||||||
<tr id="row-{{ $pendingEquipment->pending_equipment_id }}">
|
<li class="list-group-item align-items-center" aria-current="true">
|
||||||
<td>{{ $pendingEquipment->unit->unit_name ?? 'Sem Fabrica Associada!!!' }}</td>
|
<div class="card card-primary collapsed-card" style="padding: 0;margin:0;">
|
||||||
<td>{{ $pendingEquipment->equipmentType->equipment_type_name ?? 'Sem tipo de Equipamento Associado!!!' }}
|
<div class="card-header clickable">
|
||||||
</td>
|
<h3 class="card-title">Equipamento :
|
||||||
<td>{{ $pendingEquipment->pending_equipment_tag }}</td>
|
{{ $pendingEquipment->pending_equipment_tag }}</h3>
|
||||||
<td>{{ $pendingEquipment->pending_equipment_description }}</td>
|
<div class="card-tools">
|
||||||
<td>{{ $pendingEquipment->pending_equipment_serial_number }}</td>
|
<button type="button" class="btn btn-tool collapse-button"
|
||||||
<td>{{ $pendingEquipment->pending_equipment_brand }}</td>
|
data-card-widget="collapse"><i class="fas fa-plus"></i></button>
|
||||||
<td>{{ $pendingEquipment->pending_equipment_model }}</td>
|
</div>
|
||||||
<td class="text-center d-flex justify-content-around">
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<ul>
|
||||||
|
<li><b>Equipamento pendente (Tag): </b>
|
||||||
|
{{ $pendingEquipment->pending_equipment_tag }}</li>
|
||||||
|
<li><b>Equipamento pendente (Descrição):
|
||||||
|
</b>{{ $pendingEquipment->pending_equipment_description }}</li>
|
||||||
|
@if (isset($groupedArrayForPendingEquipments) && !empty($groupedArrayForPendingEquipments))
|
||||||
|
@foreach ($groupedArrayForPendingEquipments[1][1] as $equipmentLog)
|
||||||
|
@if ($equipmentLog['pendingEquipmentId'] == $pendingEquipment->pending_equipment_id)
|
||||||
|
<li> <b>Equipamento copiado de Execel:</b>
|
||||||
|
{{ $groupedArrayForPendingEquipments[0] }} -
|
||||||
|
{{ $groupedArrayForPendingEquipments[1][0] }}</li>
|
||||||
|
<li><b>Linha de
|
||||||
|
criação:{{ $equipmentLog['rowExecel'] }}</b>
|
||||||
|
</li>
|
||||||
|
@if ($equipmentLog['foundInExcel'])
|
||||||
|
<li> <b>Linha de cópia:
|
||||||
|
{{ $equipmentLog['rowExcelDuplicated'] ?? 'Não duplicado' }}
|
||||||
|
</b> </li>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<li>Sem dados Disponiveis sobre sua criacao!!!</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<ul class="text-center d-flex justify-content-around">
|
||||||
<a href="#" data-toggle="modal"
|
<a href="#" data-toggle="modal"
|
||||||
data-target="#modal-PendingEquipmentCreate-{{ $pendingEquipment->pending_equipment_id }}">
|
data-target="#modal-PendingEquipmentCreate-{{ $pendingEquipment->pending_equipment_id }}">
|
||||||
<i class="fa-solid fa-eye text-secondary"></i>
|
<i class="fa-solid fa-eye text-secondary"></i>
|
||||||
|
|
@ -1309,33 +1455,26 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
data-target="#modal-PendingEquipmentRemove-{{ $pendingEquipment->pending_equipment_id }}">
|
data-target="#modal-PendingEquipmentRemove-{{ $pendingEquipment->pending_equipment_id }}">
|
||||||
<i class="fa-solid fa-trash-alt text-danger"></i>
|
<i class="fa-solid fa-trash-alt text-danger"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</ul>
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr id="card-{{ $pendingEquipment->pending_equipment_id }}" style="display: none;">
|
|
||||||
<td colspan="9">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">
|
|
||||||
{{ $pendingEquipment->pending_equipment_description }}</h5>
|
|
||||||
<p class="card-text">Informações adicionais sobre o equipamento
|
|
||||||
aqui.
|
|
||||||
</p>
|
|
||||||
<!-- Aqui você pode adicionar a informação correspondente de listValves, se disponível -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</ul>
|
||||||
@else
|
@else
|
||||||
<tr>
|
<p colspan="9" class="text-center">Sem dados existentes !!!</p>
|
||||||
<td colspan="9" class="text-center">Sem dados existentes !!!</td>
|
|
||||||
</tr>
|
|
||||||
@endisset
|
@endisset
|
||||||
</tbody>
|
<footer class="m-3">
|
||||||
</table>
|
<button class="btn btn-danger" data-toggle="modal"
|
||||||
|
data-target="#modal-confirmToExcludeAllPententEquipment">
|
||||||
|
Excluir Todos
|
||||||
|
</button>
|
||||||
|
<button data-dismiss="modal" class="btn btn-primary float-right mb-3">Sair</button>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
{{-- ./table-responsive --}}
|
</fieldset>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{-- ./modal-content --}}
|
{{-- ./modal-content --}}
|
||||||
|
|
@ -1344,8 +1483,36 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
{{-- ./modal-pedingEquipments --}}
|
{{-- ./modal-pedingEquipments --}}
|
||||||
|
|
||||||
@if (isset($pendingEquipments))
|
@if (isset($pendingEquipments))
|
||||||
|
<!-- modal- confirmToExcludeAllPententEquipment -->
|
||||||
|
<div class="modal fade" id="modal-confirmToExcludeAllPententEquipment">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="card card-primary" style="padding: 0;margin:0;">
|
||||||
|
<div class="card-header ">
|
||||||
|
<h3 class="card-title">Confirmação de Exclusão Total</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<p>"Tem a certeza de que pretende eliminar todos os equipamentos pendentes desta obra? A ação é
|
||||||
|
irreversível."</p>
|
||||||
|
<form action="{{ route('deletePendingEquipments') }}" method="POST">
|
||||||
|
@csrf <!-- CSRF token para proteção -->
|
||||||
@foreach ($pendingEquipments as $pendingEquipment)
|
@foreach ($pendingEquipments as $pendingEquipment)
|
||||||
{{-- modal-PendingEquipmentCreate --}}
|
<input type="hidden" name="pendingEquipmentIds[]"
|
||||||
|
value="{{ $pendingEquipment->pending_equipment_id }}">
|
||||||
|
@endforeach
|
||||||
|
<button type="submit" class="btn btn-danger float-right mb-3">Excluir Todos</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@foreach ($pendingEquipments as $pendingEquipment)
|
||||||
|
<!-- modal-PendingEquipmentCreate -->
|
||||||
|
|
||||||
<div class="modal fade" id="modal-PendingEquipmentCreate-{{ $pendingEquipment->pending_equipment_id }}">
|
<div class="modal fade" id="modal-PendingEquipmentCreate-{{ $pendingEquipment->pending_equipment_id }}">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -1362,12 +1529,10 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
@csrf
|
@csrf
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>Criar equipamento ?</p>
|
<p>Criar equipamento ?</p>
|
||||||
<h4>{{ $pendingEquipment->pending_equipment_tag }} <strong>(Número da
|
<h4>{{ $pendingEquipment->pending_equipment_tag }} <strong>(Número da copia)</strong> </h4>
|
||||||
copia)</strong> </h4>
|
|
||||||
<h4>{{ $pendingEquipment->pending_equipment_description }} <strong>(Número da
|
<h4>{{ $pendingEquipment->pending_equipment_description }} <strong>(Número da
|
||||||
copia)</strong></h4>
|
copia)</strong></h4>
|
||||||
<h4>{{ $pendingEquipment->pending_equipment_type_id }}</h4>
|
<h4>{{ $pendingEquipment->pending_equipment_type_id }}(Tipo de Equipamento)</h4>
|
||||||
|
|
||||||
<select class="form-control" name="EquipmentAmbit"
|
<select class="form-control" name="EquipmentAmbit"
|
||||||
id="AmbitsEquipments_list-{{ $pendingEquipment->pending_equipment_id }}" required>
|
id="AmbitsEquipments_list-{{ $pendingEquipment->pending_equipment_id }}" required>
|
||||||
<option value='' hidden>Selecionar Âmbitos...</option>
|
<option value='' hidden>Selecionar Âmbitos...</option>
|
||||||
|
|
@ -1382,9 +1547,9 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
<!-- /.modal-content -->
|
<!-- /.modal-content -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{-- ./modal-PendingEquipmentCreate --}}
|
<!-- ./modal-PendingEquipmentCreate -->
|
||||||
|
|
||||||
{{-- modal-PendingEquipmentRemove --}}
|
<!-- modal-PendingEquipmentRemove -->
|
||||||
<div class="modal fade" id="modal-PendingEquipmentRemove-{{ $pendingEquipment->pending_equipment_id }}">
|
<div class="modal fade" id="modal-PendingEquipmentRemove-{{ $pendingEquipment->pending_equipment_id }}">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -1416,7 +1581,7 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.modal-dialog -->
|
<!-- /.modal-dialog -->
|
||||||
</div>
|
</div>
|
||||||
{{-- ./modal-PendingEquipmentRemove --}}
|
<!-- ./modal-PendingEquipmentRemove -->
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
@ -1442,10 +1607,10 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
data: 'equipment_id',
|
data: 'equipment_id',
|
||||||
name: 'equipment_id'
|
name: 'equipment_id'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
data: 'ispt_number',
|
// data: 'ispt_number',
|
||||||
name: 'ispt_number'
|
// name: 'ispt_number'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
data: 'equipment_tag',
|
data: 'equipment_tag',
|
||||||
name: 'equipment_tag'
|
name: 'equipment_tag'
|
||||||
|
|
@ -1471,7 +1636,6 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
$('#receiveUnitsClientRelated1, #receiveNumberProject, #tipo_valvulasList').on('change', function() {
|
$('#receiveUnitsClientRelated1, #receiveNumberProject, #tipo_valvulasList').on('change', function() {
|
||||||
dataTable.ajax.reload();
|
dataTable.ajax.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{-- <script type="text/javascript">
|
{{-- <script type="text/javascript">
|
||||||
|
|
@ -1568,6 +1732,38 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.equipmentType_id').each(function() {
|
||||||
|
var equipmentTypeInput = $(this);
|
||||||
|
var equipmentTypeID = equipmentTypeInput.val();
|
||||||
|
var ambitsSelect = equipmentTypeInput.closest('.modal-body').find('.ambitsEquipments_list');
|
||||||
|
|
||||||
|
if (equipmentTypeID) {
|
||||||
|
$.ajax({
|
||||||
|
url: '/api/ambits/' + equipmentTypeID,
|
||||||
|
type: 'GET',
|
||||||
|
success: function(data) {
|
||||||
|
ambitsSelect.empty();
|
||||||
|
ambitsSelect.append(
|
||||||
|
'<option value="" hidden>Selecionar Tipo de Âmbito...</option>'
|
||||||
|
);
|
||||||
|
$.each(data, function(key, value) {
|
||||||
|
ambitsSelect.append('<option value="' + value
|
||||||
|
.ambits_id + '">' + value.ambits_description +
|
||||||
|
'</option>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ambitsSelect.empty();
|
||||||
|
ambitsSelect.append('<option value="" hidden>Selecionar Tipo de Âmbito...</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#new_unit_div').hide(); // inicialmente ocultamos a div
|
$('#new_unit_div').hide(); // inicialmente ocultamos a div
|
||||||
|
|
@ -1832,8 +2028,14 @@ function(task) {
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
|
// Alterar esta parte para a nova forma.
|
||||||
ajax: {
|
ajax: {
|
||||||
url: '/api/receiveAllInstallationEquipment/' + $('#receiveNumberProject').val()
|
// url: '/api/receiveAllInstallationEquipment/' + $('#receiveNumberProject').val()
|
||||||
|
url: '{{ route('api_receiveAllInstallationEquipment') }}',
|
||||||
|
type: 'GET',
|
||||||
|
data: function(d) {
|
||||||
|
d.receiveNumberProject = $('#receiveNumberProject').val();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
columns: [{
|
columns: [{
|
||||||
data: 'equipment_tag',
|
data: 'equipment_tag',
|
||||||
|
|
@ -1978,42 +2180,6 @@ function(task) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/getEquipmentDetails/' + selectedEquipments, // Substitua por sua rota
|
url: '/api/getEquipmentDetails/' + selectedEquipments, // Substitua por sua rota
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
// success: function(response) {
|
|
||||||
|
|
||||||
// $('#modal-addingEquipmentToProject .table-responsive').empty();
|
|
||||||
// var table = $('<table class="table table-bordered table-striped"></table>').addClass('table');
|
|
||||||
// var thead = $(
|
|
||||||
// '<thead><tr><th>Tag</th><th>Description</th><th>Unit ID</th><th>Type ID</th><th>Ambits</th></tr></thead>'
|
|
||||||
// );
|
|
||||||
// table.append(thead);
|
|
||||||
|
|
||||||
// var tbody = $('<tbody></tbody>');
|
|
||||||
|
|
||||||
// response.forEach(function(equipment) {
|
|
||||||
// var row = $('<tr></tr>');
|
|
||||||
// row.append($('<td></td>').text(equipment.equipment_tag));
|
|
||||||
// row.append($('<td></td>').text(equipment
|
|
||||||
// .equipment_description));
|
|
||||||
// row.append($('<td></td>').text(equipment.unit_id));
|
|
||||||
// row.append($('<td></td>').text(equipment
|
|
||||||
// .equipment_type_id));
|
|
||||||
|
|
||||||
// // Adiciona um select para cada linha com os ambits do equipamento
|
|
||||||
// var select = $('<select class="form-control">');
|
|
||||||
// Object.values(equipment.ambits).forEach(function(ambit) {
|
|
||||||
// var option = new Option(ambit
|
|
||||||
// .ambits_description, ambit.ambits_id);
|
|
||||||
// select.append(option);
|
|
||||||
// });
|
|
||||||
// row.append($('<td></td>').append(select));
|
|
||||||
// tbody.append(row);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// table.append(tbody);
|
|
||||||
|
|
||||||
// $('#modal-addingEquipmentToProject .table-responsive').append(table);
|
|
||||||
// $('#modal-addingEquipmentToProject').modal('show');
|
|
||||||
// }
|
|
||||||
|
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@ class="form-control card_inputs"
|
||||||
</span>
|
</span>
|
||||||
<div class="has-float-label">
|
<div class="has-float-label">
|
||||||
<input type="text" name="tag"
|
<input type="text" name="tag"
|
||||||
value="{{ $listEquipmentsProject->equipment_tag }}"
|
{{-- value="{{ $listEquipmentsProject->equipment_tag }}" --}}
|
||||||
class="form-control card_inputs" id="equipmentTag"
|
class="form-control card_inputs" id="equipmentTag"
|
||||||
placeholder="Tag..." aria-label="Tag Equipment"
|
placeholder="Tag..." aria-label="Tag Equipment"
|
||||||
aria-describedby="form-tagEquipment">
|
aria-describedby="form-tagEquipment">
|
||||||
|
|
@ -1014,7 +1014,7 @@ class="form-control card_inputs" id="equipmentTag"
|
||||||
</span>
|
</span>
|
||||||
<div class="has-float-label">
|
<div class="has-float-label">
|
||||||
<input type="text" name="equipmentDescription"
|
<input type="text" name="equipmentDescription"
|
||||||
value="{{ $listEquipmentsProject->equipment_description }}"
|
{{-- value="{{ $listEquipmentsProject->equipment_description }}" --}}
|
||||||
class="form-control card_inputs"
|
class="form-control card_inputs"
|
||||||
id="equipmentDescription"
|
id="equipmentDescription"
|
||||||
placeholder="Descrição Equipamento..."
|
placeholder="Descrição Equipamento..."
|
||||||
|
|
@ -1037,7 +1037,7 @@ class="form-control card_inputs"
|
||||||
</span>
|
</span>
|
||||||
<div class="has-float-label">
|
<div class="has-float-label">
|
||||||
<input type="text" name="serialNumberEquipment"
|
<input type="text" name="serialNumberEquipment"
|
||||||
value="{{ $listEquipmentsProject->equipment_serial_number }}"
|
{{-- value="{{ $listEquipmentsProject->equipment_serial_number }}" --}}
|
||||||
class="form-control card_inputs"
|
class="form-control card_inputs"
|
||||||
id="equipmentSerialNumber"
|
id="equipmentSerialNumber"
|
||||||
placeholder="Número de série"
|
placeholder="Número de série"
|
||||||
|
|
@ -1056,7 +1056,7 @@ class="form-control card_inputs"
|
||||||
<div class="has-float-label">
|
<div class="has-float-label">
|
||||||
<input type="text" name="equipmentBrand"
|
<input type="text" name="equipmentBrand"
|
||||||
class="form-control card_inputs"
|
class="form-control card_inputs"
|
||||||
value="{{ $listEquipmentsProject->equipment_brand }}"
|
{{-- value="{{ $listEquipmentsProject->equipment_brand }}" --}}
|
||||||
id="equipmentBrand" placeholder="Modelo"
|
id="equipmentBrand" placeholder="Modelo"
|
||||||
aria-label="Marca Equipamento"
|
aria-label="Marca Equipamento"
|
||||||
aria-describedby="form-equipmentBrand">
|
aria-describedby="form-equipmentBrand">
|
||||||
|
|
@ -1072,7 +1072,7 @@ class="form-control card_inputs"
|
||||||
<div class="has-float-label">
|
<div class="has-float-label">
|
||||||
<input type="text" name="equipmentModel"
|
<input type="text" name="equipmentModel"
|
||||||
class="form-control card_inputs"
|
class="form-control card_inputs"
|
||||||
value="{{ $listEquipmentsProject->equipment_model }}"
|
{{-- value="{{ $listEquipmentsProject->equipment_model }}" --}}
|
||||||
id="equipmentModel" placeholder="Modelo"
|
id="equipmentModel" placeholder="Modelo"
|
||||||
aria-label="Modelo Equipamento"
|
aria-label="Modelo Equipamento"
|
||||||
aria-describedby="form-equipmentModel">
|
aria-describedby="form-equipmentModel">
|
||||||
|
|
@ -1330,7 +1330,7 @@ class="form-control card_inputs"
|
||||||
<div class="card card-info collapsed-card">
|
<div class="card card-info collapsed-card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Âmbito :
|
<h3 class="card-title">Âmbito :
|
||||||
{{ $listEquipmentsProject->equipmentAssociationAmbit->ambitsEquipment->ambits_description }}
|
{{-- {{ $listEquipmentsProject->equipmentAssociationAmbit->ambitsEquipment->ambits_description }} --}}
|
||||||
</h3>
|
</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-tool"
|
<button type="button" class="btn btn-tool"
|
||||||
|
|
@ -1343,7 +1343,7 @@ class="form-control card_inputs"
|
||||||
<div class="card ordemTasks-div">
|
<div class="card ordemTasks-div">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Lista de Tarefas Elementares :
|
<h3 class="card-title">Lista de Tarefas Elementares :
|
||||||
{{ $listEquipmentsProject->equipmentAssociationAmbit->ambitsEquipment->ambits_description }}
|
{{-- {{ $listEquipmentsProject->equipmentAssociationAmbit->ambitsEquipment->ambits_description }} --}}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-header -->
|
<!-- /.card-header -->
|
||||||
|
|
@ -1543,7 +1543,7 @@ class="form-control card_inputs"
|
||||||
</div>
|
</div>
|
||||||
</div> --}}
|
</div> --}}
|
||||||
|
|
||||||
@livewire('articulado.additonal-task', ['equipment' => $listEquipmentsProject], key($listEquipmentsProject->equipment_id))
|
{{-- @livewire('articulado.additonal-task', ['equipment' => $listEquipmentsProject], key($listEquipmentsProject->equipment_id)) --}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{-- <!-- general form elements disabled -->
|
{{-- <!-- general form elements disabled -->
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class="fas fa-minus"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body" style="padding: 0;margin-bottom: 0%">
|
<div class="card-body" style="padding: 0;margin-bottom: 0%">
|
||||||
|
|
||||||
<ul class="list-group scrollable-list">
|
<ul class="list-group scrollable-list">
|
||||||
@foreach ($allMissingTasks['workstation'] as $workstationId => $workstationDetails)
|
@foreach ($allMissingTasks['workstation'] as $workstationId => $workstationDetails)
|
||||||
<li class="list-group-item d-flex align-items-center" aria-current="true">
|
<li class="list-group-item d-flex align-items-center" aria-current="true">
|
||||||
|
|
@ -48,6 +49,7 @@ class="fas fa-minus"></i>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>{{-- ./card card-danger --}}
|
</div>{{-- ./card card-danger --}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('deletePendingEquipments', [CreateProjectController::class, 'deletePendingEquipments'])->name('deletePendingEquipments');
|
||||||
|
|
||||||
|
|
||||||
Route::get('testRelatorio', [ProjectoDatacontroller::class, 'testRelatorio'])->name('testRelatorio');
|
Route::get('testRelatorio', [ProjectoDatacontroller::class, 'testRelatorio'])->name('testRelatorio');
|
||||||
|
|
||||||
Route::get('cancelElementalTaskForEquipment/{equipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
Route::get('cancelElementalTaskForEquipment/{equipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
||||||
|
|
@ -49,6 +52,10 @@
|
||||||
|
|
||||||
|
|
||||||
Route::get('getDataEquipment', [ExecutionProjectController::class, 'getDataEquipment'])->name('getDataEquipment');
|
Route::get('getDataEquipment', [ExecutionProjectController::class, 'getDataEquipment'])->name('getDataEquipment');
|
||||||
|
|
||||||
|
Route::post('deleteEquipmentInProject',[CreateProjectController::class,'deleteEquipmentInProject'])->name('deleteEquipmentInProject');
|
||||||
|
Route::post('changeAmbitEquipment',[CreateProjectController::class,'changeAmbitEquipment'])->name('changeAmbitEquipment');
|
||||||
|
|
||||||
Route::get('getDataEquipmentClient', [ExecutionProjectController::class, 'getDataEquipmentClient'])->name('getDataEquipmentClient');
|
Route::get('getDataEquipmentClient', [ExecutionProjectController::class, 'getDataEquipmentClient'])->name('getDataEquipmentClient');
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -250,7 +257,9 @@
|
||||||
Route::get('/api/receiveEquipmentsProject/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveEquipmentsProject']);
|
Route::get('/api/receiveEquipmentsProject/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveEquipmentsProject']);
|
||||||
Route::get('/api/receiveWorkstationProject/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveWorkstationProject']);
|
Route::get('/api/receiveWorkstationProject/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveWorkstationProject']);
|
||||||
Route::get('/api/getEquipmentDetails/{receiveListEquipmentId}', [ProjectoDatacontroller::class, 'getEquipmentDetails']);
|
Route::get('/api/getEquipmentDetails/{receiveListEquipmentId}', [ProjectoDatacontroller::class, 'getEquipmentDetails']);
|
||||||
Route::get('/api/receiveAllInstallationEquipment/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveAllInstallationEquipment']);
|
// Route::get('/api/receiveAllInstallationEquipment/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveAllInstallationEquipment']);
|
||||||
|
Route::get('/api/receiveAllInstallationEquipment', [ProjectoDatacontroller::class, 'receiveAllInstallationEquipment'])->name('api_receiveAllInstallationEquipment');
|
||||||
|
|
||||||
Route::get('/api/receveTasksWorkstationPlanning/{WorkstationId}', [CreateProjectController::class, 'receveTasksWorkstationPlanning']);
|
Route::get('/api/receveTasksWorkstationPlanning/{WorkstationId}', [CreateProjectController::class, 'receveTasksWorkstationPlanning']);
|
||||||
Route::get('/api/ambits/prepared{equipmentType}', [PreparedProjectController::class, 'getAmbits']);
|
Route::get('/api/ambits/prepared{equipmentType}', [PreparedProjectController::class, 'getAmbits']);
|
||||||
Route::get('/api/equipment/{id}', [CreateProjectController::class, 'showJson']);
|
Route::get('/api/equipment/{id}', [CreateProjectController::class, 'showJson']);
|
||||||
|
|
@ -273,13 +282,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Rotas para o tipo de usuário 'Técnico'
|
// // Rotas para o tipo de usuário 'Técnico'
|
||||||
Route::middleware(['auth', 'checkUserType:enterWorkstation'])->group(function () {
|
// Route::middleware(['auth', 'checkUserType:enterWorkstation'])->group(function () {
|
||||||
Route::get('enterWorkstation', function () {
|
// Route::get('enterWorkstation', function () {
|
||||||
return view('workstations.start');
|
// return view('workstations.start');
|
||||||
})->name('enterWorkstation');
|
// })->name('enterWorkstation');
|
||||||
// Adicione outras rotas específicas para 'Técnico' aqui
|
// // Adicione outras rotas específicas para 'Técnico' aqui
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Rotas para o tipo de usuário 'Empresa'
|
// Rotas para o tipo de usuário 'Empresa'
|
||||||
Route::middleware(['auth', 'checkUserType:dashboardClient'])->group(function () {
|
Route::middleware(['auth', 'checkUserType:dashboardClient'])->group(function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user