Updating filter methods in tables with yajra and structure, as well as adding responsiveness to tables
This commit is contained in:
parent
9112766a74
commit
5dca96d473
|
|
@ -34,10 +34,30 @@
|
||||||
// use DataTables;
|
// use DataTables;
|
||||||
|
|
||||||
|
|
||||||
class CreateProjectController extends Controller
|
class CreateProjectController extends Controller {
|
||||||
{
|
|
||||||
public function deleteFurtherTasks(Request $request)
|
public function receiveUnits($numberProject) {
|
||||||
{
|
$PlantData = CompanyProject::where('company_projects_id', $numberProject)->first();
|
||||||
|
|
||||||
|
if(!$PlantData) {
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$receiveUnits = Unit::where('plant_id', $PlantData->plant_id)->get();
|
||||||
|
|
||||||
|
// Formatar a resposta para o formato esperado pelo JavaScript
|
||||||
|
$formattedUnits = $receiveUnits->map(function ($unit) {
|
||||||
|
return [
|
||||||
|
'id' => $unit->receiveUnits, // Ajuste para o nome da sua coluna correta
|
||||||
|
'name' => $unit->unit_name // Ajuste para o nome da sua coluna correta
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($formattedUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function deleteFurtherTasks(Request $request) {
|
||||||
$receiveDataEquipment = Equipment::where('equipment_id', $request->equipmentID)->first();
|
$receiveDataEquipment = Equipment::where('equipment_id', $request->equipmentID)->first();
|
||||||
// Buscar os registros que correspondem ao equipmentID e que têm further_tasks_id nos selectedTasks
|
// Buscar os registros que correspondem ao equipmentID e que têm further_tasks_id nos selectedTasks
|
||||||
$tasksToDelete = OrderEquipmentTasks::where('equipment_id', $request->equipmentID)
|
$tasksToDelete = OrderEquipmentTasks::where('equipment_id', $request->equipmentID)
|
||||||
|
|
@ -45,12 +65,12 @@ public function deleteFurtherTasks(Request $request)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// Excluir esses registros
|
// Excluir esses registros
|
||||||
foreach ($tasksToDelete as $task) {
|
foreach($tasksToDelete as $task) {
|
||||||
$task->delete();
|
$task->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se o treatmentFurtherTask for "DeleteFurtherTask", exclua os registros da tabela principal FurtherTasks
|
// Se o treatmentFurtherTask for "DeleteFurtherTask", exclua os registros da tabela principal FurtherTasks
|
||||||
if ($request->treatmentFurtherTask == "DeleteFurtherTask") {
|
if($request->treatmentFurtherTask == "DeleteFurtherTask") {
|
||||||
FurtherTasks::whereIn('further_tasks_id', $request->selectedTasks)->delete();
|
FurtherTasks::whereIn('further_tasks_id', $request->selectedTasks)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,16 +80,15 @@ public function deleteFurtherTasks(Request $request)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$executionOrder = 1;
|
$executionOrder = 1;
|
||||||
foreach ($remainingTasks as $task) {
|
foreach($remainingTasks as $task) {
|
||||||
$task->execution_order = $executionOrder;
|
$task->execution_order = $executionOrder;
|
||||||
$task->save();
|
$task->save();
|
||||||
$executionOrder++;
|
$executionOrder++;
|
||||||
}
|
}
|
||||||
return redirect()->back()->with('success', 'Ordem de execução do equipamento: ' . $receiveDataEquipment->equipment_tag . ' Atulizada!');
|
return redirect()->back()->with('success', 'Ordem de execução do equipamento: '.$receiveDataEquipment->equipment_tag.' Atulizada!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addFurtherTasks(Request $request)
|
public function addFurtherTasks(Request $request) {
|
||||||
{
|
|
||||||
// Recebe e organiza os dados do equipameto recebido : ($request->equipmentID) e organiza em asc de acordo com a Ordem de execução
|
// Recebe e organiza os dados do equipameto recebido : ($request->equipmentID) e organiza em asc de acordo com a Ordem de execução
|
||||||
$equipmentId = $request->equipmentID;
|
$equipmentId = $request->equipmentID;
|
||||||
$tasksToReorder = OrderEquipmentTasks::where('equipment_id', $equipmentId)
|
$tasksToReorder = OrderEquipmentTasks::where('equipment_id', $equipmentId)
|
||||||
|
|
@ -88,15 +107,15 @@ public function addFurtherTasks(Request $request)
|
||||||
$newFurtherTaskId = $elementalTasksCount + $furtherTasksCount + 1;
|
$newFurtherTaskId = $elementalTasksCount + $furtherTasksCount + 1;
|
||||||
|
|
||||||
// Calcule o valor de further_tasks_name
|
// Calcule o valor de further_tasks_name
|
||||||
$newFurtherTaskName = 'TC' . ($furtherTasksCount + 1);
|
$newFurtherTaskName = 'TC'.($furtherTasksCount + 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$insertPosition = $request->ArrayListElementsTasks + 1;
|
$insertPosition = $request->ArrayListElementsTasks + 1;
|
||||||
|
|
||||||
// Incrementar a execution_order das tarefas após a posição de inserção
|
// Incrementar a execution_order das tarefas após a posição de inserção
|
||||||
foreach ($tasksToReorder as $task) {
|
foreach($tasksToReorder as $task) {
|
||||||
if ($task->execution_order >= $insertPosition) {
|
if($task->execution_order >= $insertPosition) {
|
||||||
$task->execution_order += 1;
|
$task->execution_order += 1;
|
||||||
$task->save();
|
$task->save();
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +128,7 @@ public function addFurtherTasks(Request $request)
|
||||||
$newOrderEquipmentTask->elemental_tasks_id = null;
|
$newOrderEquipmentTask->elemental_tasks_id = null;
|
||||||
|
|
||||||
// Se o selectedFurtherTaskExisting for null quer dizer que e uma TC complementar criada e nova se nao for null quer dizer que vamos criar uma TC existente.
|
// Se o selectedFurtherTaskExisting for null quer dizer que e uma TC complementar criada e nova se nao for null quer dizer que vamos criar uma TC existente.
|
||||||
if ($request->selectedFurtherTaskExisting == 'null') {
|
if($request->selectedFurtherTaskExisting == 'null') {
|
||||||
|
|
||||||
// Cria uma nova tarefa Complementar
|
// Cria uma nova tarefa Complementar
|
||||||
$newFurtherTask = new FurtherTasks;
|
$newFurtherTask = new FurtherTasks;
|
||||||
|
|
@ -127,25 +146,17 @@ public function addFurtherTasks(Request $request)
|
||||||
$newOrderEquipmentTask->inspection = 2;
|
$newOrderEquipmentTask->inspection = 2;
|
||||||
$newOrderEquipmentTask->save();
|
$newOrderEquipmentTask->save();
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Ordem de execução do equipamento: '.$receiveDataEquipment->equipment_tag.' Atulizada!');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Ordem de execução do equipamento: ' . $receiveDataEquipment->equipment_tag . ' Atulizada!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function receiveEquipmentToAssociateTasks(Request $request)
|
public function receiveEquipmentToAssociateTasks(Request $request) {
|
||||||
{
|
|
||||||
// dd($request);
|
// dd($request);
|
||||||
|
|
||||||
foreach ($request->equipment as $equipment) {
|
foreach($request->equipment as $equipment) {
|
||||||
$equipmentModel = Equipment::where('equipment_id', $equipment['equipment_id'])->first();
|
$equipmentModel = Equipment::where('equipment_id', $equipment['equipment_id'])->first();
|
||||||
|
|
||||||
if ($equipmentModel) {
|
if($equipmentModel) {
|
||||||
$equipmentModel->company_projects_id = $request->receiveNumberProject;
|
$equipmentModel->company_projects_id = $request->receiveNumberProject;
|
||||||
$equipmentModel->save();
|
$equipmentModel->save();
|
||||||
}
|
}
|
||||||
|
|
@ -153,8 +164,7 @@ public function receiveEquipmentToAssociateTasks(Request $request)
|
||||||
return redirect()->back()->with('success', 'Equipametos associados a Obra com Sucesso !');
|
return redirect()->back()->with('success', 'Equipametos associados a Obra com Sucesso !');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function receiveUnitsForExcelTemplate($numberProject)
|
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();
|
||||||
|
|
@ -164,17 +174,16 @@ public function receiveUnitsForExcelTemplate($numberProject)
|
||||||
// Get the second sheet
|
// Get the second sheet
|
||||||
$sheet = $spreadsheet->getSheet(1); // Sheet index starts from 0
|
$sheet = $spreadsheet->getSheet(1); // Sheet index starts from 0
|
||||||
$row = 1; // Row number where you want to start inserting data
|
$row = 1; // Row number where you want to start inserting data
|
||||||
foreach ($receveUnits as $unit) {
|
foreach($receveUnits as $unit) {
|
||||||
// Set value for column D
|
// Set value for column D
|
||||||
$sheet->setCellValue('D' . $row, $unit->unit_name);
|
$sheet->setCellValue('D'.$row, $unit->unit_name);
|
||||||
$row++;
|
$row++;
|
||||||
}
|
}
|
||||||
// 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');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createDownloadResponse($spreadsheet, $filename)
|
protected function createDownloadResponse($spreadsheet, $filename) {
|
||||||
{
|
|
||||||
// Create a writer object
|
// Create a writer object
|
||||||
$writer = new Xlsx($spreadsheet);
|
$writer = new Xlsx($spreadsheet);
|
||||||
// Create a StreamedResponse with a callback
|
// Create a StreamedResponse with a callback
|
||||||
|
|
@ -185,14 +194,13 @@ function () use ($writer) {
|
||||||
);
|
);
|
||||||
// Set headers to indicate we're sending an Excel file
|
// Set headers to indicate we're sending an Excel file
|
||||||
$response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
$response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
$response->headers->set('Content-Disposition', 'attachment;filename="' . $filename . '"');
|
$response->headers->set('Content-Disposition', 'attachment;filename="'.$filename.'"');
|
||||||
$response->headers->set('Cache-Control', 'max-age=0');
|
$response->headers->set('Cache-Control', 'max-age=0');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function finishCreatingProject($numberProject)
|
public function finishCreatingProject($numberProject) {
|
||||||
{
|
|
||||||
// recebe atraves de sessao toda a vez quem entra no componente 'SelectElementalTasksInWonkstation' para selecionar as tarefas de cada Workstation
|
// recebe atraves de sessao toda a vez quem entra no componente 'SelectElementalTasksInWonkstation' para selecionar as tarefas de cada Workstation
|
||||||
$receiveAllFurtherTasks = session('receiveAllFurtherTasks');
|
$receiveAllFurtherTasks = session('receiveAllFurtherTasks');
|
||||||
$receiveElementalTasks = session('receiveElementalTasks');
|
$receiveElementalTasks = session('receiveElementalTasks');
|
||||||
|
|
@ -205,12 +213,12 @@ public function finishCreatingProject($numberProject)
|
||||||
// Recebe todos os dados dos postos de Trabalho
|
// Recebe todos os dados dos postos de Trabalho
|
||||||
$receiveWorkstaions = ConstructionWorkstation::where('company_projects_id', $numberProject)->get();
|
$receiveWorkstaions = ConstructionWorkstation::where('company_projects_id', $numberProject)->get();
|
||||||
|
|
||||||
foreach ($receiveWorkstaions as $workstation) {
|
foreach($receiveWorkstaions as $workstation) {
|
||||||
// Verifica se o ID da workstation está presente na tabela WorkstationsAssociationTasks
|
// Verifica se o ID da workstation está presente na tabela WorkstationsAssociationTasks
|
||||||
$exists = WorkstationsAssociationTasks::where('id_workstations', $workstation->id_workstations)->exists();
|
$exists = WorkstationsAssociationTasks::where('id_workstations', $workstation->id_workstations)->exists();
|
||||||
|
|
||||||
// Se não existe na tabela, adiciona à lista das workstations onde nao tem tarefas atribuidas ainda.
|
// Se não existe na tabela, adiciona à lista das workstations onde nao tem tarefas atribuidas ainda.
|
||||||
if (!$exists) {
|
if(!$exists) {
|
||||||
$missingWorkstations[$workstation->id_workstations] = [
|
$missingWorkstations[$workstation->id_workstations] = [
|
||||||
'name_workstations' => $workstation->name_workstations,
|
'name_workstations' => $workstation->name_workstations,
|
||||||
'nomenclature_workstation' => $workstation->nomenclature_workstation
|
'nomenclature_workstation' => $workstation->nomenclature_workstation
|
||||||
|
|
@ -222,22 +230,22 @@ public function finishCreatingProject($numberProject)
|
||||||
$workstationIds = $receiveWorkstaions->pluck('id_workstations')->toArray();
|
$workstationIds = $receiveWorkstaions->pluck('id_workstations')->toArray();
|
||||||
|
|
||||||
// Iterar sobre cada tarefa em $receiveElementalTasks
|
// Iterar sobre cada tarefa em $receiveElementalTasks
|
||||||
foreach ($receiveElementalTasks as $taskGroup) {
|
foreach($receiveElementalTasks as $taskGroup) {
|
||||||
foreach ($taskGroup as $taskId => $taskDetails) {
|
foreach($taskGroup as $taskId => $taskDetails) {
|
||||||
// Verificar se a tarefa está associada a algum id_workstations
|
// Verificar se a tarefa está associada a algum id_workstations
|
||||||
$exists = WorkstationsAssociationTasks::whereIn('id_workstations', $workstationIds)
|
$exists = WorkstationsAssociationTasks::whereIn('id_workstations', $workstationIds)
|
||||||
->where('elemental_tasks_id', $taskId)
|
->where('elemental_tasks_id', $taskId)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
// Se não existe, adicionar à lista de tarefas faltantes
|
// Se não existe, adicionar à lista de tarefas faltantes
|
||||||
if (!$exists) {
|
if(!$exists) {
|
||||||
$missingElementalTasks[$taskId] = $taskDetails;
|
$missingElementalTasks[$taskId] = $taskDetails;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterar sobre cada tarefa em $receiveAllFurtherTasks
|
// Iterar sobre cada tarefa em $receiveAllFurtherTasks
|
||||||
foreach ($receiveAllFurtherTasks as $furtherTask) {
|
foreach($receiveAllFurtherTasks as $furtherTask) {
|
||||||
// Obter o ID da tarefa
|
// Obter o ID da tarefa
|
||||||
$taskId = $furtherTask->further_tasks_id;
|
$taskId = $furtherTask->further_tasks_id;
|
||||||
|
|
||||||
|
|
@ -247,7 +255,7 @@ public function finishCreatingProject($numberProject)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
// Se não existe, adicionar à lista de tarefas faltantes
|
// Se não existe, adicionar à lista de tarefas faltantes
|
||||||
if (!$exists) {
|
if(!$exists) {
|
||||||
$missingFurtherTasksDetails[$taskId] = [
|
$missingFurtherTasksDetails[$taskId] = [
|
||||||
'name' => $furtherTask->further_tasks_name,
|
'name' => $furtherTask->further_tasks_name,
|
||||||
'description' => $furtherTask->further_tasks_description
|
'description' => $furtherTask->further_tasks_description
|
||||||
|
|
@ -264,7 +272,7 @@ public function finishCreatingProject($numberProject)
|
||||||
// Verificar se todos os arrays internos estão vazios
|
// Verificar se todos os arrays internos estão vazios
|
||||||
$isEmpty = empty($allMissingTasks['elemental']) && empty($allMissingTasks['further']) && empty($allMissingTasks['workstation']);
|
$isEmpty = empty($allMissingTasks['elemental']) && empty($allMissingTasks['further']) && empty($allMissingTasks['workstation']);
|
||||||
|
|
||||||
if (!$isEmpty) {
|
if(!$isEmpty) {
|
||||||
return redirect()->back()->with('errors', $allMissingTasks);
|
return redirect()->back()->with('errors', $allMissingTasks);
|
||||||
} else {
|
} else {
|
||||||
$project = CompanyProject::find($numberProject);
|
$project = CompanyProject::find($numberProject);
|
||||||
|
|
@ -275,12 +283,11 @@ public function finishCreatingProject($numberProject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteWorkstation($name)
|
public function deleteWorkstation($name) {
|
||||||
{
|
|
||||||
$workstation = ConstructionWorkstation::where('name_workstations', $name)->first();
|
$workstation = ConstructionWorkstation::where('name_workstations', $name)->first();
|
||||||
$removeAcountUserWorkstation = User::where('user_name', $workstation->name_workstations)->first();
|
$removeAcountUserWorkstation = User::where('user_name', $workstation->name_workstations)->first();
|
||||||
|
|
||||||
if ($workstation && $removeAcountUserWorkstation) {
|
if($workstation && $removeAcountUserWorkstation) {
|
||||||
$workstation->delete();
|
$workstation->delete();
|
||||||
$removeAcountUserWorkstation->delete();
|
$removeAcountUserWorkstation->delete();
|
||||||
|
|
||||||
|
|
@ -298,19 +305,19 @@ public function deleteWorkstation($name)
|
||||||
->orderByRaw("CAST(SUBSTRING(SUBSTRING_INDEX(name_workstations, '-', 1), 12) AS UNSIGNED) DESC")
|
->orderByRaw("CAST(SUBSTRING(SUBSTRING_INDEX(name_workstations, '-', 1), 12) AS UNSIGNED) DESC")
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($workstationsToUpdate as $workstationToUpdate) {
|
foreach($workstationsToUpdate as $workstationToUpdate) {
|
||||||
// pegar o número da estação de trabalho atual
|
// pegar o número da estação de trabalho atual
|
||||||
preg_match('/workstation(\d+)-/', $workstationToUpdate->name_workstations, $matches);
|
preg_match('/workstation(\d+)-/', $workstationToUpdate->name_workstations, $matches);
|
||||||
$currentWorkstationNumber = $matches[1];
|
$currentWorkstationNumber = $matches[1];
|
||||||
|
|
||||||
// atualizar nome da estação de trabalho
|
// atualizar nome da estação de trabalho
|
||||||
$workstationToUpdate->name_workstations = 'workstation' . ($currentWorkstationNumber - 1) . '-' . $projectNumber;
|
$workstationToUpdate->name_workstations = 'workstation'.($currentWorkstationNumber - 1).'-'.$projectNumber;
|
||||||
$workstationToUpdate->save();
|
$workstationToUpdate->save();
|
||||||
|
|
||||||
// atualizar Utilizador associado
|
// atualizar Utilizador associado
|
||||||
$userToUpdate = User::where('user_name', 'workstation' . $currentWorkstationNumber . '-' . $projectNumber)->first();
|
$userToUpdate = User::where('user_name', 'workstation'.$currentWorkstationNumber.'-'.$projectNumber)->first();
|
||||||
if ($userToUpdate) {
|
if($userToUpdate) {
|
||||||
$userToUpdate->user_name = 'workstation' . ($currentWorkstationNumber - 1) . '-' . $projectNumber;
|
$userToUpdate->user_name = 'workstation'.($currentWorkstationNumber - 1).'-'.$projectNumber;
|
||||||
$userToUpdate->save();
|
$userToUpdate->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,12 +327,11 @@ public function deleteWorkstation($name)
|
||||||
return back()->with('danger', 'Posto de Trabalho não encontrado!');
|
return back()->with('danger', 'Posto de Trabalho não encontrado!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeProjectEquipment(Request $request)
|
public function removeProjectEquipment(Request $request) {
|
||||||
{
|
|
||||||
|
|
||||||
$equipment = Equipment::find($request->EquipmentID);
|
$equipment = Equipment::find($request->EquipmentID);
|
||||||
|
|
||||||
if ($request->removalType == 'total') {
|
if($request->removalType == 'total') {
|
||||||
$equipment->delete();
|
$equipment->delete();
|
||||||
|
|
||||||
return back()->with('success', 'Equipamento Excluido com sucesso!');
|
return back()->with('success', 'Equipamento Excluido com sucesso!');
|
||||||
|
|
@ -335,8 +341,7 @@ public function removeProjectEquipment(Request $request)
|
||||||
|
|
||||||
return back()->with('success', 'Equipamento retirado da obra !');
|
return back()->with('success', 'Equipamento retirado da obra !');
|
||||||
}
|
}
|
||||||
public function EditEquipmentsProjects(Request $request)
|
public function EditEquipmentsProjects(Request $request) {
|
||||||
{
|
|
||||||
// dd($request);
|
// dd($request);
|
||||||
// Localiza o equipment pelo numberProject
|
// Localiza o equipment pelo numberProject
|
||||||
$equipment = Equipment::find($request->equipmentId);
|
$equipment = Equipment::find($request->equipmentId);
|
||||||
|
|
@ -350,22 +355,22 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
|
|
||||||
$equipment->save();
|
$equipment->save();
|
||||||
|
|
||||||
if ($request->input('attributes')) {
|
if($request->input('attributes')) {
|
||||||
foreach ($request->input('attributes') as $key => $value) {
|
foreach($request->input('attributes') as $key => $value) {
|
||||||
// Verifica se o valor é null e a chave é um número (correspondendo aos general_attributes_equipment_id)
|
// Verifica se o valor é null e a chave é um número (correspondendo aos general_attributes_equipment_id)
|
||||||
if ($value == null && is_numeric($key)) {
|
if($value == null && is_numeric($key)) {
|
||||||
// Procura o registro relevante em SpecificAttributesEquipmentType
|
// Procura o registro relevante em SpecificAttributesEquipmentType
|
||||||
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $request->equipmentId)
|
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $request->equipmentId)
|
||||||
->where('general_attributes_equipment_id', $key)
|
->where('general_attributes_equipment_id', $key)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// Se o registro existir, o deleta
|
// Se o registro existir, o deleta
|
||||||
if ($specificAttributes) {
|
if($specificAttributes) {
|
||||||
$specificAttributes->delete();
|
$specificAttributes->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se o valor não for null, atualiza ou cria um novo registro
|
// Se o valor não for null, atualiza ou cria um novo registro
|
||||||
elseif ($value !== null && is_numeric($key)) {
|
elseif($value !== null && is_numeric($key)) {
|
||||||
|
|
||||||
// Procura o registro relevante em SpecificAttributesEquipmentType
|
// Procura o registro relevante em SpecificAttributesEquipmentType
|
||||||
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $request->equipmentId)
|
$specificAttributes = SpecificAttributesEquipmentType::where('equipment_id', $request->equipmentId)
|
||||||
|
|
@ -373,7 +378,7 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// Se o registro existir, atualiza o valor
|
// Se o registro existir, atualiza o valor
|
||||||
if ($specificAttributes) {
|
if($specificAttributes) {
|
||||||
$specificAttributes->specific_attributes_value = $value;
|
$specificAttributes->specific_attributes_value = $value;
|
||||||
$specificAttributes->save();
|
$specificAttributes->save();
|
||||||
}
|
}
|
||||||
|
|
@ -393,18 +398,18 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
|
|
||||||
|
|
||||||
// Se não selecionar nenhuma tarefas ele devolve um erro , pois e necessario pelo menos uma
|
// Se não selecionar nenhuma tarefas ele devolve um erro , pois e necessario pelo menos uma
|
||||||
if (!in_array('on', $request->input('ordemTasks'))) {
|
if(!in_array('on', $request->input('ordemTasks'))) {
|
||||||
return redirect()->back()->with('danger', 'É necessário selecionar pelo menos uma tarefa, Para o Equipamento : ' . $equipment->equipment_tag);
|
return redirect()->back()->with('danger', 'É necessário selecionar pelo menos uma tarefa, Para o Equipamento : '.$equipment->equipment_tag);
|
||||||
}
|
}
|
||||||
$executionOrder = 1;
|
$executionOrder = 1;
|
||||||
|
|
||||||
foreach ($request->input('ordemTasks') as $key => $value) {
|
foreach($request->input('ordemTasks') as $key => $value) {
|
||||||
$orderEquipmentTask = OrderEquipmentTasks::where('equipment_id', $request->equipmentId)
|
$orderEquipmentTask = OrderEquipmentTasks::where('equipment_id', $request->equipmentId)
|
||||||
->where('elemental_tasks_id', $key)
|
->where('elemental_tasks_id', $key)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($value == "on") {
|
if($value == "on") {
|
||||||
if (!$orderEquipmentTask) {
|
if(!$orderEquipmentTask) {
|
||||||
$orderEquipmentTask = new OrderEquipmentTasks();
|
$orderEquipmentTask = new OrderEquipmentTasks();
|
||||||
$orderEquipmentTask->equipment_id = $request->equipmentId;
|
$orderEquipmentTask->equipment_id = $request->equipmentId;
|
||||||
$orderEquipmentTask->elemental_tasks_id = $key;
|
$orderEquipmentTask->elemental_tasks_id = $key;
|
||||||
|
|
@ -413,7 +418,7 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
$orderEquipmentTask->save();
|
$orderEquipmentTask->save();
|
||||||
|
|
||||||
$executionOrder++;
|
$executionOrder++;
|
||||||
} elseif ($value == "off" && $orderEquipmentTask) {
|
} elseif($value == "off" && $orderEquipmentTask) {
|
||||||
$orderEquipmentTask->delete();
|
$orderEquipmentTask->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -424,7 +429,7 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
->orderBy('execution_order', 'asc')
|
->orderBy('execution_order', 'asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($remainingOrderEquipmentTasks as $orderEquipmentTask) {
|
foreach($remainingOrderEquipmentTasks as $orderEquipmentTask) {
|
||||||
$orderEquipmentTask->execution_order = $executionOrder;
|
$orderEquipmentTask->execution_order = $executionOrder;
|
||||||
$orderEquipmentTask->save();
|
$orderEquipmentTask->save();
|
||||||
$executionOrder++;
|
$executionOrder++;
|
||||||
|
|
@ -435,18 +440,17 @@ public function EditEquipmentsProjects(Request $request)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$taskExecutionOrders = [];
|
$taskExecutionOrders = [];
|
||||||
foreach ($orderTasks as $task) {
|
foreach($orderTasks as $task) {
|
||||||
$taskExecutionOrders[$task->elemental_tasks_id] = $task->execution_order;
|
$taskExecutionOrders[$task->elemental_tasks_id] = $task->execution_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retorna uma resposta
|
// Retorna uma resposta
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('success', 'Equipamento ' . $equipment->equipment_tag . ' Editado com Sucesso!!!')
|
->with('success', 'Equipamento '.$equipment->equipment_tag.' Editado com Sucesso!!!')
|
||||||
->with('taskExecutionOrders', $taskExecutionOrders);
|
->with('taskExecutionOrders', $taskExecutionOrders);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showJson($id)
|
public function showJson($id) {
|
||||||
{
|
|
||||||
$attributes = SpecificAttributesEquipmentType::where('equipment_id', $id)->get();
|
$attributes = SpecificAttributesEquipmentType::where('equipment_id', $id)->get();
|
||||||
$OrdemTasks = OrderEquipmentTasks::where('equipment_id', $id)->get();
|
$OrdemTasks = OrderEquipmentTasks::where('equipment_id', $id)->get();
|
||||||
$allElementalTasks = ElementalTasks::all();
|
$allElementalTasks = ElementalTasks::all();
|
||||||
|
|
@ -458,8 +462,7 @@ public function showJson($id)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function receveTasksWorkstationPlanning($WorkstationId)
|
public function receveTasksWorkstationPlanning($WorkstationId) {
|
||||||
{
|
|
||||||
$workstationsAssociationTasks = WorkstationsAssociationTasks::where('id_workstations', $WorkstationId)->get();
|
$workstationsAssociationTasks = WorkstationsAssociationTasks::where('id_workstations', $WorkstationId)->get();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|
@ -468,8 +471,7 @@ public function receveTasksWorkstationPlanning($WorkstationId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function createWorkStations(Request $request)
|
public function createWorkStations(Request $request) {
|
||||||
{
|
|
||||||
// Pega o número de estações de trabalho do request
|
// Pega o número de estações de trabalho do request
|
||||||
$numberWorkstations = $request->numberWorkstations;
|
$numberWorkstations = $request->numberWorkstations;
|
||||||
|
|
||||||
|
|
@ -485,15 +487,15 @@ public function createWorkStations(Request $request)
|
||||||
|
|
||||||
// Se houver uma estação de trabalho anterior, extrai o número dela
|
// Se houver uma estação de trabalho anterior, extrai o número dela
|
||||||
$startNumber = 1;
|
$startNumber = 1;
|
||||||
if ($lastWorkstation) {
|
if($lastWorkstation) {
|
||||||
$parts = explode('-', $lastWorkstation->name_workstations);
|
$parts = explode('-', $lastWorkstation->name_workstations);
|
||||||
$startNumber = intval(str_replace('workstation', '', $parts[0])) + 1;
|
$startNumber = intval(str_replace('workstation', '', $parts[0])) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop para criar as estações de trabalho e seus logins
|
// Loop para criar as estações de trabalho e seus logins
|
||||||
for ($i = $startNumber; $i < $startNumber + $numberWorkstations; $i++) {
|
for($i = $startNumber; $i < $startNumber + $numberWorkstations; $i++) {
|
||||||
$workstation = new ConstructionWorkstation();
|
$workstation = new ConstructionWorkstation();
|
||||||
$workstation->name_workstations = 'workstation' . $i . '-' . $numberProject;
|
$workstation->name_workstations = 'workstation'.$i.'-'.$numberProject;
|
||||||
$workstation->company_projects_id = $numberProject;
|
$workstation->company_projects_id = $numberProject;
|
||||||
$workstation->save();
|
$workstation->save();
|
||||||
|
|
||||||
|
|
@ -503,32 +505,30 @@ public function createWorkStations(Request $request)
|
||||||
//Apos criar a Workstation vamos criar um login para pode aceder os postos de trabalho na obra
|
//Apos criar a Workstation vamos criar um login para pode aceder os postos de trabalho na obra
|
||||||
$loginWorkStation = new User;
|
$loginWorkStation = new User;
|
||||||
$loginWorkStation->user_name = $workstation->name_workstations;
|
$loginWorkStation->user_name = $workstation->name_workstations;
|
||||||
$loginWorkStation->email = $receveProjectCompanyNumber->project_company_number . '-' . $receiveNumberWorkstation . '@isptgroup.com';
|
$loginWorkStation->email = $receveProjectCompanyNumber->project_company_number.'-'.$receiveNumberWorkstation.'@isptgroup.com';
|
||||||
$loginWorkStation->password = bcrypt($receveProjectCompanyNumber->project_company_number . '-' . $receiveNumberWorkstation);
|
$loginWorkStation->password = bcrypt($receveProjectCompanyNumber->project_company_number.'-'.$receiveNumberWorkstation);
|
||||||
$loginWorkStation->type_users = 5;
|
$loginWorkStation->type_users = 5;
|
||||||
$loginWorkStation->user_nif = $receveProjectCompanyNumber->project_company_number . '-' . $receiveNumberWorkstation;
|
$loginWorkStation->user_nif = $receveProjectCompanyNumber->project_company_number.'-'.$receiveNumberWorkstation;
|
||||||
$loginWorkStation->save();
|
$loginWorkStation->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redireciona para onde você quiser após a criação das workstations
|
// Redireciona para onde você quiser após a criação das workstations
|
||||||
return redirect()->route('test3', ['id' => $request->numberProject])
|
return redirect()->route('test3', ['id' => $request->numberProject])
|
||||||
->with('success', $numberWorkstations . ' Postos de Trabalho criados !!!')
|
->with('success', $numberWorkstations.' Postos de Trabalho criados !!!')
|
||||||
->with('listWorkstations', $listWorkstations);
|
->with('listWorkstations', $listWorkstations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Funcao apenas para retornar os dados necessarios para a view criar uma Obra.
|
// Funcao apenas para retornar os dados necessarios para a view criar uma Obra.
|
||||||
public function createProjectForStep1()
|
public function createProjectForStep1() {
|
||||||
{
|
|
||||||
$companies = User::where('type_users', 3)->get();
|
$companies = User::where('type_users', 3)->get();
|
||||||
// Apos terminar não vai ficar step 1
|
// Apos terminar não vai ficar step 1
|
||||||
return view('projectsClients/createProject', ['step' => 1], ['companies' => $companies]);
|
return view('projectsClients/createProject', ['step' => 1], ['companies' => $companies]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress Bar
|
// Progress Bar
|
||||||
//Devolve para a primeira para na Descrição do projecto apenas user com ID 3, quer dizer que apenas as "empresas"
|
//Devolve para a primeira para na Descrição do projecto apenas user com ID 3, quer dizer que apenas as "empresas"
|
||||||
public function showStep1($company_projects_id)
|
public function showStep1($company_projects_id) {
|
||||||
{
|
|
||||||
// $projects = CompanyProject::find($company_projects_id);
|
// $projects = CompanyProject::find($company_projects_id);
|
||||||
|
|
||||||
$projects = CompanyProject::with('user')->find($company_projects_id);
|
$projects = CompanyProject::with('user')->find($company_projects_id);
|
||||||
|
|
@ -541,19 +541,16 @@ public function showStep1($company_projects_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se forem alterados dados dos Detalhes da Obra, vai ser alterado
|
// Se forem alterados dados dos Detalhes da Obra, vai ser alterado
|
||||||
public function EditprocessStep1(Request $request)
|
public function EditprocessStep1(Request $request) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removePendingEquipment($id)
|
public function removePendingEquipment($id) {
|
||||||
{
|
|
||||||
$equipment = PendingEquipment::findOrFail($id);
|
$equipment = PendingEquipment::findOrFail($id);
|
||||||
$equipment->delete();
|
$equipment->delete();
|
||||||
return back()->with('success', 'Equipamento pendente removido com sucesso!');
|
return back()->with('success', 'Equipamento pendente removido com sucesso!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CreateNewEquipmentFromPendingEquipment(Request $request, $id)
|
public function CreateNewEquipmentFromPendingEquipment(Request $request, $id) {
|
||||||
{
|
|
||||||
$checkPendingEquipment = PendingEquipment::findOrFail($id);
|
$checkPendingEquipment = PendingEquipment::findOrFail($id);
|
||||||
|
|
||||||
$counter = 2;
|
$counter = 2;
|
||||||
|
|
@ -561,15 +558,15 @@ public function CreateNewEquipmentFromPendingEquipment(Request $request, $id)
|
||||||
$baseDescription = $checkPendingEquipment->pending_equipment_description;
|
$baseDescription = $checkPendingEquipment->pending_equipment_description;
|
||||||
|
|
||||||
// Ciclo para verificar se ja existe um equipamento com o mesmo nome se existir vai criando com o contador iniciado a partir de (2)
|
// Ciclo para verificar se ja existe um equipamento com o mesmo nome se existir vai criando com o contador iniciado a partir de (2)
|
||||||
while (Equipment::where('equipment_tag', $baseTag . "({$counter})")->orWhere('equipment_description', $baseDescription . "({$counter})")->exists()) {
|
while(Equipment::where('equipment_tag', $baseTag."({$counter})")->orWhere('equipment_description', $baseDescription."({$counter})")->exists()) {
|
||||||
$counter++;
|
$counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newEquipment = new Equipment;
|
$newEquipment = new Equipment;
|
||||||
$newEquipment->unit_id = $checkPendingEquipment->pending_equipment_unit_id;
|
$newEquipment->unit_id = $checkPendingEquipment->pending_equipment_unit_id;
|
||||||
$newEquipment->equipment_type_id = $checkPendingEquipment->pending_equipment_type_id;
|
$newEquipment->equipment_type_id = $checkPendingEquipment->pending_equipment_type_id;
|
||||||
$newEquipment->equipment_tag = $baseTag . "({$counter})";
|
$newEquipment->equipment_tag = $baseTag."({$counter})";
|
||||||
$newEquipment->equipment_description = $baseDescription . "({$counter})";
|
$newEquipment->equipment_description = $baseDescription."({$counter})";
|
||||||
$newEquipment->equipment_serial_number = $checkPendingEquipment->pending_equipment_serial_number;
|
$newEquipment->equipment_serial_number = $checkPendingEquipment->pending_equipment_serial_number;
|
||||||
$newEquipment->equipment_brand = $checkPendingEquipment->pending_equipment_brand;
|
$newEquipment->equipment_brand = $checkPendingEquipment->pending_equipment_brand;
|
||||||
$newEquipment->equipment_model = $checkPendingEquipment->pending_equipment_model;
|
$newEquipment->equipment_model = $checkPendingEquipment->pending_equipment_model;
|
||||||
|
|
@ -588,16 +585,15 @@ public function CreateNewEquipmentFromPendingEquipment(Request $request, $id)
|
||||||
|
|
||||||
$checkPendingEquipment->delete();
|
$checkPendingEquipment->delete();
|
||||||
|
|
||||||
return back()->with('success', 'Equipamento ' . $newEquipment->equipment_tag . ' criado com sucesso');
|
return back()->with('success', 'Equipamento '.$newEquipment->equipment_tag.' criado com sucesso');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function processStep1(Request $request)
|
public function processStep1(Request $request) {
|
||||||
{
|
|
||||||
// Validação...
|
// Validação...
|
||||||
$installationId = $request->input('installation_id');
|
$installationId = $request->input('installation_id');
|
||||||
|
|
||||||
if ($installationId == 'new_install') {
|
if($installationId == 'new_install') {
|
||||||
|
|
||||||
// Criar uma nova instalação...
|
// Criar uma nova instalação...
|
||||||
$newInstallation = new Plant;
|
$newInstallation = new Plant;
|
||||||
|
|
@ -621,7 +617,7 @@ public function processStep1(Request $request)
|
||||||
$project->project_company_responsible = $request->input('responsible_project_company');
|
$project->project_company_responsible = $request->input('responsible_project_company');
|
||||||
|
|
||||||
// Verifica se e igual a nulo , se for usa a data ja existente
|
// Verifica se e igual a nulo , se for usa a data ja existente
|
||||||
if ($request->date_started === null) {
|
if($request->date_started === null) {
|
||||||
$project->date_started = $request->input('date_started_present');
|
$project->date_started = $request->input('date_started_present');
|
||||||
} else
|
} else
|
||||||
$project->date_started = $request->input('date_started');
|
$project->date_started = $request->input('date_started');
|
||||||
|
|
@ -641,8 +637,7 @@ public function processStep1(Request $request)
|
||||||
->with('success', 'Detalhes, Projecto criado com sucesso');
|
->with('success', 'Detalhes, Projecto criado com sucesso');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showStep2($company_projects_id)
|
public function showStep2($company_projects_id) {
|
||||||
{
|
|
||||||
// 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')) {
|
||||||
|
|
@ -677,19 +672,24 @@ 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(['unit', 'equipmentType', 'equipmentAssociationAmbit.ambitsEquipment', 'specificAttributes' => function ($query) {
|
$listEquipmentsProjects = Equipment::with([
|
||||||
$query->orderBy('specific_attributes_value', 'asc');
|
'unit',
|
||||||
}])
|
'equipmentType',
|
||||||
|
'equipmentAssociationAmbit.ambitsEquipment',
|
||||||
|
'specificAttributes' => function ($query) {
|
||||||
|
$query->orderBy('specific_attributes_value', 'asc');
|
||||||
|
}
|
||||||
|
])
|
||||||
->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()) {
|
||||||
// Retornamos para a view 'step' => 2 indicando conclusao da primeira parte, $numberProject para associacao de equipamentos a esta obra, alem de todos os equipamentos e fabricao ja existente com base na Instalação que se iniciou a obra.
|
// Retornamos para a view 'step' => 2 indicando conclusao da primeira parte, $numberProject para associacao de equipamentos a esta obra, alem de todos os equipamentos e fabricao ja existente com base na Instalação que se iniciou a obra.
|
||||||
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||||
->with('danger', 'Equipamentos Pendentes: ' . count($pendingEquipments))
|
->with('danger', 'Equipamentos Pendentes: '.count($pendingEquipments))
|
||||||
->with('pendingEquipments', $pendingEquipments)
|
->with('pendingEquipments', $pendingEquipments)
|
||||||
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
||||||
->with('typeEquipments', $typeEquipments)
|
->with('typeEquipments', $typeEquipments)
|
||||||
|
|
@ -705,8 +705,7 @@ public function showStep2($company_projects_id)
|
||||||
->with('receiveNumberProject', $project);
|
->with('receiveNumberProject', $project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createEquipmentManual(Request $request)
|
public function createEquipmentManual(Request $request) {
|
||||||
{
|
|
||||||
// EquipmentAmbit
|
// EquipmentAmbit
|
||||||
// *** Recebe a Instalação(Plant), com base no número da Obra Criada
|
// *** Recebe a Instalação(Plant), com base no número da Obra Criada
|
||||||
$receivePlant = DB::table('plants')
|
$receivePlant = DB::table('plants')
|
||||||
|
|
@ -727,7 +726,7 @@ public function createEquipmentManual(Request $request)
|
||||||
'unit_id' => $request->unit_id
|
'unit_id' => $request->unit_id
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($existingEquipment) {
|
if($existingEquipment) {
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('danger', 'Equipamento ja Existe !!')
|
->with('danger', 'Equipamento ja Existe !!')
|
||||||
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||||
|
|
@ -737,7 +736,7 @@ public function createEquipmentManual(Request $request)
|
||||||
$newEquipmentProject = new Equipment;
|
$newEquipmentProject = new Equipment;
|
||||||
|
|
||||||
// Se for uma fabrica(Unit) existente
|
// Se for uma fabrica(Unit) existente
|
||||||
if ($request->new_unit_name == null) {
|
if($request->new_unit_name == null) {
|
||||||
$newEquipmentProject->unit_id = $request->unit_id;
|
$newEquipmentProject->unit_id = $request->unit_id;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -773,8 +772,8 @@ public function createEquipmentManual(Request $request)
|
||||||
|
|
||||||
// Recebe esta associacao, e cria um array para cada 'name'(inputs) igual ao 'general_attributes_equipment_description', contanto que seu valor(input) seja diferente de *NULL, assim o "$receivesAssociationAttributes" recebe o id de acordo com a tabela , o nome de acordo com a tabela e o valor do $request recebido associado ao campo
|
// Recebe esta associacao, e cria um array para cada 'name'(inputs) igual ao 'general_attributes_equipment_description', contanto que seu valor(input) seja diferente de *NULL, assim o "$receivesAssociationAttributes" recebe o id de acordo com a tabela , o nome de acordo com a tabela e o valor do $request recebido associado ao campo
|
||||||
$receivesAssociationAttributes = [];
|
$receivesAssociationAttributes = [];
|
||||||
foreach ($checkAtributs as $description => $id) {
|
foreach($checkAtributs as $description => $id) {
|
||||||
if ($request[$description] !== null) {
|
if($request[$description] !== null) {
|
||||||
$receivesAssociationAttributes[] = [
|
$receivesAssociationAttributes[] = [
|
||||||
'general_attributes_equipment_id' => $id,
|
'general_attributes_equipment_id' => $id,
|
||||||
'general_attributes_equipment_description' => $description,
|
'general_attributes_equipment_description' => $description,
|
||||||
|
|
@ -783,7 +782,7 @@ 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;
|
||||||
|
|
@ -804,7 +803,7 @@ public function createEquipmentManual(Request $request)
|
||||||
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
||||||
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
||||||
|
|
||||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
foreach($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||||
$JoinsEquipmentsWithTasks->equipment_id = $equipmentID;
|
$JoinsEquipmentsWithTasks->equipment_id = $equipmentID;
|
||||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||||
|
|
@ -820,14 +819,12 @@ public function createEquipmentManual(Request $request)
|
||||||
->with('success', 'Equipamento criado com sucesso')
|
->with('success', 'Equipamento criado com sucesso')
|
||||||
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||||
}
|
}
|
||||||
public function receiveIdEquipment(Equipment $equipment)
|
public function receiveIdEquipment(Equipment $equipment) {
|
||||||
{
|
|
||||||
// return response()->json($equipment);
|
// return response()->json($equipment);
|
||||||
return view('projectsClients/articulated_2', ['equipment' => $equipment]);
|
return view('projectsClients/articulated_2', ['equipment' => $equipment]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processStep2(Request $request)
|
public function processStep2(Request $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');
|
||||||
|
|
||||||
|
|
@ -835,7 +832,7 @@ public function processStep2(Request $request)
|
||||||
$company_projects_id = $request->numberProject;
|
$company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
// Certifique-se de que um arquivo foi enviado
|
// Certifique-se de que um arquivo foi enviado
|
||||||
if ($file) {
|
if($file) {
|
||||||
// Carregue o arquivo Excel
|
// Carregue o arquivo Excel
|
||||||
$spreadsheet = IOFactory::load($file->path());
|
$spreadsheet = IOFactory::load($file->path());
|
||||||
|
|
||||||
|
|
@ -852,19 +849,19 @@ public function processStep2(Request $request)
|
||||||
$countNewEquipment = 0;
|
$countNewEquipment = 0;
|
||||||
|
|
||||||
// Comece a partir da sexta linha
|
// Comece a partir da sexta linha
|
||||||
for ($i = 6; $i < count($data); $i++) {
|
for($i = 6; $i < count($data); $i++) {
|
||||||
|
|
||||||
$dadosLinha = $data[$i];
|
$dadosLinha = $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 os 5 primeiros campos essenciais estao preenchidos, um deles não estiver preenchido ele ignora e não cria o equipamento
|
||||||
$isEmpty = false;
|
$isEmpty = false;
|
||||||
for ($j = 0; $j < 5; $j++) {
|
for($j = 0; $j < 5; $j++) {
|
||||||
if (empty($dadosLinha[$j])) {
|
if(empty($dadosLinha[$j])) {
|
||||||
$isEmpty = true;
|
$isEmpty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($isEmpty) {
|
if($isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -887,7 +884,7 @@ public function processStep2(Request $request)
|
||||||
->where('equipment_tag', $datas['tag'])
|
->where('equipment_tag', $datas['tag'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($existingEquipment) {
|
if($existingEquipment) {
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
@ -930,7 +927,7 @@ public function processStep2(Request $request)
|
||||||
|
|
||||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambito'])->first();
|
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambito'])->first();
|
||||||
|
|
||||||
if ($ambit) {
|
if($ambit) {
|
||||||
$ambit_id = $ambit->ambits_id;
|
$ambit_id = $ambit->ambits_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -946,7 +943,7 @@ public function processStep2(Request $request)
|
||||||
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
||||||
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
||||||
|
|
||||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
foreach($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||||
$JoinsEquipmentsWithTasks->equipment_id = $receveEquipment_ID;
|
$JoinsEquipmentsWithTasks->equipment_id = $receveEquipment_ID;
|
||||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||||
|
|
@ -960,9 +957,9 @@ 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])) {
|
||||||
$specificAttribute = new SpecificAttributesEquipmentType;
|
$specificAttribute = new SpecificAttributesEquipmentType;
|
||||||
|
|
||||||
$specificAttribute->equipment_id = $receveEquipment_ID;
|
$specificAttribute->equipment_id = $receveEquipment_ID;
|
||||||
|
|
@ -979,15 +976,15 @@ public function processStep2(Request $request)
|
||||||
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
||||||
|
|
||||||
// $pendingEquipments = session('pendingEquipments');
|
// $pendingEquipments = session('pendingEquipments');
|
||||||
if ($countPendingEquipments != 0) {
|
if($countPendingEquipments != 0) {
|
||||||
// return redirect()->route('test2')->with('Danger', 'Equipamentos Pendentes')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
// return redirect()->route('test2')->with('Danger', 'Equipamentos Pendentes')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
||||||
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('pendingEquipments', $pendingEquipments);
|
->with('pendingEquipments', $pendingEquipments);
|
||||||
// ->with('success', 'Equipamentos Criados :' . count($listValves))
|
// ->with('success', 'Equipamentos Criados :' . count($listValves))
|
||||||
}
|
}
|
||||||
return redirect()->route('test2', ['id' => $request->numberProject])
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
->with('success', 'Equipamentos Criados :' . $countNewEquipment);
|
->with('success', 'Equipamentos Criados :'.$countNewEquipment);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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.
|
||||||
|
|
@ -998,34 +995,33 @@ public function processStep2(Request $request)
|
||||||
return redirect('/test3');
|
return redirect('/test3');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showStep3($company_projects_id)
|
public function showStep3($company_projects_id) {
|
||||||
{
|
|
||||||
$equipments = Equipment::where('company_projects_id', $company_projects_id)
|
$equipments = Equipment::where('company_projects_id', $company_projects_id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($equipments as $equipment) {
|
foreach($equipments as $equipment) {
|
||||||
$tags = [];
|
$tags = [];
|
||||||
if ($equipment->equipment_type_id == 3) {
|
if($equipment->equipment_type_id == 3) {
|
||||||
$tags = ['@Corpo', '@Flange', '@Obturador'];
|
$tags = ['@Corpo', '@Flange', '@Obturador'];
|
||||||
} elseif ($equipment->equipment_type_id == 1) {
|
} elseif($equipment->equipment_type_id == 1) {
|
||||||
$tags = ['@Corpo', '@Flange'];
|
$tags = ['@Corpo', '@Flange'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach($tags as $tag) {
|
||||||
$associatedEquipment = QrcodesAssociatedEquipment::where('equipment_id', $equipment->equipment_id)
|
$associatedEquipment = QrcodesAssociatedEquipment::where('equipment_id', $equipment->equipment_id)
|
||||||
->where('component_tag', 'LIKE', '%' . $tag)
|
->where('component_tag', 'LIKE', '%'.$tag)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($associatedEquipment) {
|
if($associatedEquipment) {
|
||||||
// Atualizar a coluna component_tag para ser igual à equipment_tag, mantendo a parte após o "@"
|
// Atualizar a coluna component_tag para ser igual à equipment_tag, mantendo a parte após o "@"
|
||||||
$newComponentTag = $equipment->equipment_tag . $tag;
|
$newComponentTag = $equipment->equipment_tag.$tag;
|
||||||
$associatedEquipment->component_tag = $newComponentTag;
|
$associatedEquipment->component_tag = $newComponentTag;
|
||||||
$associatedEquipment->save();
|
$associatedEquipment->save();
|
||||||
} else {
|
} else {
|
||||||
// Criar uma nova entrada
|
// Criar uma nova entrada
|
||||||
QrcodesAssociatedEquipment::create([
|
QrcodesAssociatedEquipment::create([
|
||||||
'equipment_id' => $equipment->equipment_id,
|
'equipment_id' => $equipment->equipment_id,
|
||||||
'component_tag' => $equipment->equipment_tag . $tag
|
'component_tag' => $equipment->equipment_tag.$tag
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1035,7 +1031,7 @@ public function showStep3($company_projects_id)
|
||||||
$allEquipmentIds = Equipment::where('company_projects_id', $company_projects_id)->pluck('equipment_id')->toArray();
|
$allEquipmentIds = Equipment::where('company_projects_id', $company_projects_id)->pluck('equipment_id')->toArray();
|
||||||
$orphanedEntries = QrcodesAssociatedEquipment::whereNotIn('equipment_id', $allEquipmentIds)->get();
|
$orphanedEntries = QrcodesAssociatedEquipment::whereNotIn('equipment_id', $allEquipmentIds)->get();
|
||||||
|
|
||||||
foreach ($orphanedEntries as $orphanedEntry) {
|
foreach($orphanedEntries as $orphanedEntry) {
|
||||||
$orphanedEntry->delete();
|
$orphanedEntry->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1053,14 +1049,13 @@ public function showStep3($company_projects_id)
|
||||||
->with('futherTasks', $futherTasks);
|
->with('futherTasks', $futherTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function workstationsAssociationTasks(Request $request)
|
public function workstationsAssociationTasks(Request $request) {
|
||||||
{
|
|
||||||
// dd($request);
|
// dd($request);
|
||||||
|
|
||||||
$workStation = ConstructionWorkstation::where('id_workstations', $request->idWorkStation)->first();
|
$workStation = ConstructionWorkstation::where('id_workstations', $request->idWorkStation)->first();
|
||||||
|
|
||||||
// Trocar o nome se for diferente do recebido
|
// Trocar o nome se for diferente do recebido
|
||||||
if ($workStation) {
|
if($workStation) {
|
||||||
$workStation->nomenclature_workstation = $request->nameWorkstation;
|
$workStation->nomenclature_workstation = $request->nameWorkstation;
|
||||||
$workStation->save();
|
$workStation->save();
|
||||||
}
|
}
|
||||||
|
|
@ -1068,11 +1063,11 @@ public function workstationsAssociationTasks(Request $request)
|
||||||
// Atualizar a lista de tipos de tarefas para incluir os novos grupos
|
// Atualizar a lista de tipos de tarefas para incluir os novos grupos
|
||||||
$taskTypes = ['generalTasks', '1', '2', '3', 'FurtherTasks'];
|
$taskTypes = ['generalTasks', '1', '2', '3', 'FurtherTasks'];
|
||||||
|
|
||||||
foreach ($taskTypes as $groupTasks) {
|
foreach($taskTypes as $groupTasks) {
|
||||||
if (isset($request[$groupTasks])) { // Checar se esse grupo de tarefas existe no request
|
if(isset($request[$groupTasks])) { // Checar se esse grupo de tarefas existe no request
|
||||||
foreach ($request[$groupTasks] as $taskID => $check) {
|
foreach($request[$groupTasks] as $taskID => $check) {
|
||||||
|
|
||||||
if ($groupTasks == 'FurtherTasks') {
|
if($groupTasks == 'FurtherTasks') {
|
||||||
// Encontra a tarefa existente, se houver, para FurtherTasks
|
// Encontra a tarefa existente, se houver, para FurtherTasks
|
||||||
$taskAssociation = WorkstationsAssociationTasks::where('id_workstations', $workStation->id_workstations)
|
$taskAssociation = WorkstationsAssociationTasks::where('id_workstations', $workStation->id_workstations)
|
||||||
->where('further_tasks_id', $taskID)
|
->where('further_tasks_id', $taskID)
|
||||||
|
|
@ -1086,11 +1081,11 @@ public function workstationsAssociationTasks(Request $request)
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($check == 'on') {
|
if($check == 'on') {
|
||||||
if (!$taskAssociation) {
|
if(!$taskAssociation) {
|
||||||
$taskAssociation = new WorkstationsAssociationTasks;
|
$taskAssociation = new WorkstationsAssociationTasks;
|
||||||
$taskAssociation->id_workstations = $workStation->id_workstations;
|
$taskAssociation->id_workstations = $workStation->id_workstations;
|
||||||
if ($groupTasks == 'FurtherTasks') {
|
if($groupTasks == 'FurtherTasks') {
|
||||||
$taskAssociation->further_tasks_id = $taskID; // Usando $taskID, que é a key
|
$taskAssociation->further_tasks_id = $taskID; // Usando $taskID, que é a key
|
||||||
} else {
|
} else {
|
||||||
$taskAssociation->elemental_tasks_id = $taskID; // Usando $taskID, que é a key
|
$taskAssociation->elemental_tasks_id = $taskID; // Usando $taskID, que é a key
|
||||||
|
|
@ -1098,7 +1093,7 @@ public function workstationsAssociationTasks(Request $request)
|
||||||
$taskAssociation->company_projects_id = $workStation->company_projects_id;
|
$taskAssociation->company_projects_id = $workStation->company_projects_id;
|
||||||
}
|
}
|
||||||
$taskAssociation->save();
|
$taskAssociation->save();
|
||||||
} elseif ($check == 'off' && $taskAssociation) {
|
} elseif($check == 'off' && $taskAssociation) {
|
||||||
$taskAssociation->delete();
|
$taskAssociation->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1107,11 +1102,10 @@ public function workstationsAssociationTasks(Request $request)
|
||||||
|
|
||||||
|
|
||||||
// Redirecionar de volta com uma mensagem de sucesso
|
// Redirecionar de volta com uma mensagem de sucesso
|
||||||
return back()->with('success', 'Posto de trabalho : ' . $workStation->name_workstations . ' atualizado com sucesso!');
|
return back()->with('success', 'Posto de trabalho : '.$workStation->name_workstations.' atualizado com sucesso!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processStep3(Request $request)
|
public function processStep3(Request $request) {
|
||||||
{
|
|
||||||
// Valide e processe os dados do formulário
|
// Valide e processe os dados do formulário
|
||||||
// ...
|
// ...
|
||||||
session(['form_data.step3' => $request->all()]);
|
session(['form_data.step3' => $request->all()]);
|
||||||
|
|
@ -1121,8 +1115,7 @@ public function processStep3(Request $request)
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
|
||||||
// $results = DB::table('equipaments')
|
// $results = DB::table('equipaments')
|
||||||
// ->join('specific_attributes_equipament_types', 'equipaments.equipment_ID', '=', 'specific_attributes_equipament_types.tb_equipament_id')
|
// ->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')
|
// ->join('general_attributes_equipaments', 'specific_attributes_equipament_types.specific_Attributes_Equipment_Type_ID', '=', 'general_attributes_equipaments.general_Attributes_Equipment_ID')
|
||||||
|
|
@ -1140,8 +1133,8 @@ public function index()
|
||||||
|
|
||||||
$groupedEquipments = [];
|
$groupedEquipments = [];
|
||||||
|
|
||||||
foreach ($results as $result) {
|
foreach($results as $result) {
|
||||||
if (!isset($groupedEquipments[$result->tag])) {
|
if(!isset($groupedEquipments[$result->tag])) {
|
||||||
$groupedEquipments[$result->tag] = [];
|
$groupedEquipments[$result->tag] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1153,8 +1146,8 @@ public function index()
|
||||||
|
|
||||||
$equipments = DB::table('equipments')->get();
|
$equipments = DB::table('equipments')->get();
|
||||||
|
|
||||||
foreach ($equipments as $equipment) {
|
foreach($equipments as $equipment) {
|
||||||
if (isset($groupedEquipments[$equipment->tag])) {
|
if(isset($groupedEquipments[$equipment->tag])) {
|
||||||
$equipment->specific_attributes = $groupedEquipments[$equipment->tag];
|
$equipment->specific_attributes = $groupedEquipments[$equipment->tag];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1166,20 +1159,18 @@ public function index()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function listCompanies()
|
public function listCompanies() {
|
||||||
{
|
|
||||||
$companies = User::where('type_users', 3)->get();
|
$companies = User::where('type_users', 3)->get();
|
||||||
return view('projectsClients/createProject', ['companies' => $companies]);
|
return view('projectsClients/createProject', ['companies' => $companies]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function createProject(Request $request)
|
public function createProject(Request $request) {
|
||||||
{
|
|
||||||
|
|
||||||
// Validação...
|
// Validação...
|
||||||
$installationId = $request->input('installation_id');
|
$installationId = $request->input('installation_id');
|
||||||
|
|
||||||
if ($installationId == 'new_install') {
|
if($installationId == 'new_install') {
|
||||||
// Criar uma nova instalação...
|
// Criar uma nova instalação...
|
||||||
$newInstallation = new Unit;
|
$newInstallation = new Unit;
|
||||||
$newInstallation->installation_name = $request->input('new_company_name');
|
$newInstallation->installation_name = $request->input('new_company_name');
|
||||||
|
|
@ -1210,9 +1201,8 @@ public function createProject(Request $request)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeProject(Request $request)
|
public function storeProject(Request $request) {
|
||||||
{
|
if($request->input('company_id') == 'new') {
|
||||||
if ($request->input('company_id') == 'new') {
|
|
||||||
$company = new CompanyProject; // Substitua "Company" pelo nome do seu modelo de empresas
|
$company = new CompanyProject; // Substitua "Company" pelo nome do seu modelo de empresas
|
||||||
$company->name = $request->input('new_company_name');
|
$company->name = $request->input('new_company_name');
|
||||||
$company->save();
|
$company->save();
|
||||||
|
|
@ -1225,8 +1215,7 @@ public function storeProject(Request $request)
|
||||||
// Agora, você pode usar $company_id ao criar o projeto
|
// Agora, você pode usar $company_id ao criar o projeto
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByUserNif(Request $request)
|
public function getByUserNif(Request $request) {
|
||||||
{
|
|
||||||
|
|
||||||
// dd(Plant::where('user_id', $request->input('user_id'))->get());
|
// dd(Plant::where('user_id', $request->input('user_id'))->get());
|
||||||
|
|
||||||
|
|
@ -1236,8 +1225,7 @@ public function getByUserNif(Request $request)
|
||||||
return response()->json($installations);
|
return response()->json($installations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAmbits($equipmentType)
|
public function getAmbits($equipmentType) {
|
||||||
{
|
|
||||||
|
|
||||||
$ambits = DB::table('ambits_equipments')
|
$ambits = DB::table('ambits_equipments')
|
||||||
->select('ambits_equipments.*')
|
->select('ambits_equipments.*')
|
||||||
|
|
@ -1246,8 +1234,7 @@ public function getAmbits($equipmentType)
|
||||||
return response()->json($ambits);
|
return response()->json($ambits);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttributes($id)
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,74 +9,110 @@
|
||||||
use App\Models\Equipment;
|
use App\Models\Equipment;
|
||||||
use App\Models\EquipmentComments;
|
use App\Models\EquipmentComments;
|
||||||
use App\Models\EquipmentType;
|
use App\Models\EquipmentType;
|
||||||
use App\Models\OrderEquipmentTasks;
|
|
||||||
use App\Models\SpecificAttributesEquipmentType;
|
|
||||||
use App\Models\ElementalTasks;
|
use App\Models\ElementalTasks;
|
||||||
|
|
||||||
use Yajra\DataTables\Facades\DataTables;
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
class ExecutionProjectController extends Controller
|
class ExecutionProjectController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function test11($equipmentID)
|
|
||||||
{
|
|
||||||
$dataEquipment =Equipment::find($equipmentID);
|
|
||||||
|
|
||||||
// dd($dataEquipment);
|
|
||||||
|
|
||||||
$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 :
|
|
||||||
$OrdemTasksIds = $OrdemTasks->pluck('elemental_tasks_id')->all(); // Array de IDs
|
|
||||||
|
|
||||||
return view ('projectsClients.articulated_2_ShowEquipment',compact('dataEquipment','OrdemTasks','OrdemTasksIds'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDataEquipment(Request $request)
|
public function getDataEquipment(Request $request)
|
||||||
{
|
{
|
||||||
|
// pode receber um request ou nao, depende de onde for chamado.
|
||||||
|
$numberProject = $request->get('numberProject');
|
||||||
|
|
||||||
$numberProject = $request->get('numberProject');
|
$checkUnits = $request->get('checkUnits');
|
||||||
|
$tipo_valvulasList = $request->get('tipo_valvulasList');
|
||||||
|
|
||||||
// Inicia a consulta
|
$receiveAllClients = $request->get('receiveAllClients');
|
||||||
$query = Equipment::with('equipmentType')
|
|
||||||
->select(['equipment_id', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
|
||||||
|
|
||||||
// Adiciona a cláusula where se numberProject for fornecido
|
$receiveAllPlants = $request->get('receiveAllPlants');
|
||||||
if ($numberProject) {
|
|
||||||
$query->where('company_projects_id', $numberProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Executa a consulta e obtém os resultados
|
$receiveAllUnits = $request->get('receiveAllUnits');
|
||||||
$equipment = $query->get();
|
|
||||||
|
$receiveEquipmentsType = $request->get('receiveEquipmentsType');
|
||||||
|
|
||||||
|
// Query padrão que todas as dataTables recebem, a partir dele fazemos os filt
|
||||||
|
$query = Equipment::with('equipmentType', 'unit')
|
||||||
|
->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.
|
||||||
|
if ($numberProject) {
|
||||||
|
$query->where('company_projects_id', $numberProject);
|
||||||
|
|
||||||
|
if ($checkUnits && $checkUnits !== '#') {
|
||||||
|
$query->where('unit_id', $checkUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tipo_valvulasList && $tipo_valvulasList !== '#') {
|
||||||
|
$query->where('equipment_type_id', $tipo_valvulasList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Filtar equipamentos por um cliente especifico.
|
||||||
|
if ($receiveAllClients && $receiveAllClients !== '#') {
|
||||||
|
// Filtra os equipamentos cujas unidades estão associadas às plantas do usuário especificado
|
||||||
|
$query->whereHas('unit.plant', function ($query) use ($receiveAllClients) {
|
||||||
|
$query->where('user_id', $receiveAllClients);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Filtar equipamentos por uma instalacao especifica.
|
||||||
|
if ($receiveAllPlants && $receiveAllPlants !== '#') {
|
||||||
|
$query->whereHas('unit', function ($query) use ($receiveAllPlants) {
|
||||||
|
$query->where('plant_id', $receiveAllPlants);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($receiveAllUnits && $receiveAllUnits !== '#') {
|
||||||
|
$query->where('unit_id', $receiveAllUnits);
|
||||||
|
}
|
||||||
|
if ($receiveEquipmentsType && $receiveEquipmentsType !== '#') {
|
||||||
|
$query->where('equipment_type_id', $receiveEquipmentsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Executa a consulta e obtém os resultados
|
||||||
|
$equipment = $query->get();
|
||||||
|
|
||||||
|
return DataTables::of($equipment)
|
||||||
|
->addColumn('unit_name', function ($equipment) {
|
||||||
|
// Retorna 'unit_name' do relacionamento 'unit'
|
||||||
|
return $equipment->unit ? $equipment->unit->unit_name : 'N/A';
|
||||||
|
})
|
||||||
|
->addColumn('equipment_type_name', function ($equipment) {
|
||||||
|
// Retorna 'equipment_type_name' do relacionamento 'equipmentType'
|
||||||
|
return $equipment->equipmentType ? $equipment->equipmentType->equipment_type_name : 'N/A';
|
||||||
|
})
|
||||||
|
|
||||||
|
->addColumn('action', function ($equipment) use ($numberProject) {
|
||||||
|
// Verifica se $numberProject não é nulo
|
||||||
|
if (!is_null($numberProject)) {
|
||||||
|
// Se não for nulo, usa a rota 'test11'
|
||||||
|
$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>';
|
||||||
|
} else {
|
||||||
|
// 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>';
|
||||||
|
}
|
||||||
|
return $actionBtn;
|
||||||
|
})
|
||||||
|
|
||||||
|
// ->addColumn('action', function ($equipment) use ($numberProject) {
|
||||||
|
// // Lógica para a coluna de ação com o link correto
|
||||||
|
// $actionBtn = '<a title="Detalhes do equipamento" href="' . route('test11', ['equipmentID' => $equipment->equipment_id]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
||||||
|
// return $actionBtn;
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
// $equipment = Equipment::with('equipmentType') // Certifique-se de que o método 'equipmentType' existe no modelo 'Equipment'
|
->editColumn('unit_id', function ($equipment) {
|
||||||
// ->select(['equipment_id', 'equipment_tag', 'unit_id', 'equipment_type_id'])
|
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
||||||
// ->where('company_projects_id', $numberProject);
|
return $equipment->unit->unit_name ?? 'N/A';
|
||||||
|
})
|
||||||
return DataTables::of($equipment)
|
->editColumn('equipment_type_id', function ($equipment) {
|
||||||
->addColumn('unit_name', function ($equipment) {
|
// Isto irá substituir 'equipment_type_id' pelo 'equipment_type_name' associado
|
||||||
// Retorna 'unit_name' do relacionamento 'unit'
|
return $equipment->equipmentType->equipment_type_name ?? 'N/A';
|
||||||
return $equipment->unit ? $equipment->unit->unit_name : 'N/A';
|
})
|
||||||
})
|
->rawColumns(['action'])
|
||||||
->addColumn('equipment_type_name', function ($equipment) {
|
->make(true);
|
||||||
// Retorna 'equipment_type_name' do relacionamento 'equipmentType'
|
|
||||||
return $equipment->equipmentType ? $equipment->equipmentType->equipment_type_name : 'N/A';
|
|
||||||
})
|
|
||||||
->addColumn('action', function ($equipment) use ($numberProject) {
|
|
||||||
// Lógica para a coluna de ação com o link correto
|
|
||||||
$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>';
|
|
||||||
return $actionBtn;
|
|
||||||
})
|
|
||||||
->editColumn('unit_id', function ($equipment) {
|
|
||||||
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
|
||||||
return $equipment->unit->unit_name ?? 'N/A';
|
|
||||||
})
|
|
||||||
->editColumn('equipment_type_id', function ($equipment) {
|
|
||||||
// Isto irá substituir 'equipment_type_id' pelo 'equipment_type_name' associado
|
|
||||||
return $equipment->equipmentType->equipment_type_name ?? 'N/A';
|
|
||||||
})
|
|
||||||
->rawColumns(['action'])
|
|
||||||
->make(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enterWorkstation()
|
public function enterWorkstation()
|
||||||
|
|
@ -119,7 +155,7 @@ public function receiveEquipmentIdForShowModal($EquipmentID)
|
||||||
return $task->elementalTask->elemental_tasks_code;
|
return $task->elementalTask->elemental_tasks_code;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$receveControlEquipment = ControlEquipmentWorkstation::where('equipment_id', $EquipmentID)->get();
|
$receveControlEquipment = ControlEquipmentWorkstation::where('equipment_id', $EquipmentID)->get();
|
||||||
|
|
||||||
$receiveCommentsEquipment = EquipmentComments::where('equipment_id', $EquipmentID)->get();
|
$receiveCommentsEquipment = EquipmentComments::where('equipment_id', $EquipmentID)->get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\AmbitsEquipment;
|
use App\Models\AmbitsEquipment;
|
||||||
|
use App\Models\Unit;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
@ -13,6 +14,9 @@
|
||||||
use App\Models\CompanyProject;
|
use App\Models\CompanyProject;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
|
use App\Models\OrderEquipmentTasks;
|
||||||
|
use App\Models\SpecificAttributesEquipmentType;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\ConstructionWorkstation;
|
use App\Models\ConstructionWorkstation;
|
||||||
use App\Models\EquipmentType;
|
use App\Models\EquipmentType;
|
||||||
|
|
@ -20,16 +24,64 @@
|
||||||
|
|
||||||
class ProjectoDatacontroller extends Controller
|
class ProjectoDatacontroller extends Controller
|
||||||
{
|
{
|
||||||
public function receivePlants($clientId)
|
|
||||||
{
|
public function receiveUnitsManageAssets($receivePlantClientRelated){
|
||||||
if ($clientId == 'all') {
|
|
||||||
$allPlants = Plant::all();
|
$UnitsData = Unit::where('plant_id',$receivePlantClientRelated)->get();
|
||||||
return response()->json($allPlants);
|
|
||||||
}
|
$formattedData = $UnitsData->map(function ($item) {
|
||||||
dd($clientId);
|
return [
|
||||||
|
'id' => $item->unit_id,
|
||||||
|
'name'=> $item->unit_name
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($formattedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function receivePlants($receiveAllClients) {
|
||||||
|
|
||||||
|
$PlantData = Plant::where('user_id', $receiveAllClients)->get();
|
||||||
|
// Criando um array para armazenar os dados formatados
|
||||||
|
$formattedData = $PlantData->map(function ($item) {
|
||||||
|
return [
|
||||||
|
'id' => $item->plant_id,
|
||||||
|
'name' => $item->plant_name
|
||||||
|
];
|
||||||
|
});
|
||||||
|
// Retorna os dados em formato JSON
|
||||||
|
return response()->json($formattedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Funcao que recebe a Acoes do dataTables das obrar em Planeamento.
|
||||||
|
public function test11($projectID,$equipmentID)
|
||||||
|
{
|
||||||
|
|
||||||
|
$dataEquipment =Equipment::find($equipmentID);
|
||||||
|
|
||||||
|
$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 :
|
||||||
|
$OrdemTasksIds = $OrdemTasks->pluck('elemental_tasks_id')->all(); // Array de IDs
|
||||||
|
|
||||||
|
return view ('projectsClients.articulated_2_ShowEquipment',compact('dataEquipment','OrdemTasks','OrdemTasksIds'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Funcao que recebe a Acoes do dataTables do portifolio.
|
||||||
|
public function test22($equipmentID){
|
||||||
|
|
||||||
|
|
||||||
|
$dataEquipment =Equipment::find($equipmentID);
|
||||||
|
|
||||||
|
$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 :
|
||||||
|
$OrdemTasksIds = $OrdemTasks->pluck('elemental_tasks_id')->all(); // Array de IDs
|
||||||
|
|
||||||
|
return view ('projectsClients.testRoute',compact('dataEquipment','OrdemTasks','OrdemTasksIds'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEquipmentDetails($receiveListEquipmentId)
|
public function getEquipmentDetails($receiveListEquipmentId)
|
||||||
{
|
{
|
||||||
$ids = explode(',', $receiveListEquipmentId);
|
$ids = explode(',', $receiveListEquipmentId);
|
||||||
|
|
@ -90,7 +142,9 @@ public function ManageAssets()
|
||||||
->join('users', 'plants.user_id', '=', 'users.user_id')
|
->join('users', 'plants.user_id', '=', 'users.user_id')
|
||||||
->select('plants.*', 'units.unit_name', 'users.user_name as user_name')
|
->select('plants.*', 'units.unit_name', 'users.user_name as user_name')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$equipments = Equipment::all();
|
$equipments = Equipment::all();
|
||||||
|
|
||||||
// $equipaments = DB::table('equipaments')
|
// $equipaments = DB::table('equipaments')
|
||||||
// ->join('factories','equipaments.factory_id', '=', 'factories.factories_id')
|
// ->join('factories','equipaments.factory_id', '=', 'factories.factories_id')
|
||||||
// ->join('equipament_types', 'equipaments.equipament_type_id', '=' , 'equipament_types.equipament_type_id')
|
// ->join('equipament_types', 'equipaments.equipament_type_id', '=' , 'equipament_types.equipament_type_id')
|
||||||
|
|
@ -98,6 +152,7 @@ public function ManageAssets()
|
||||||
// ->get();
|
// ->get();
|
||||||
|
|
||||||
$allEquipmentType = EquipmentType::all();
|
$allEquipmentType = EquipmentType::all();
|
||||||
|
|
||||||
$allClients = User::where('type_users', 3)->get();
|
$allClients = User::where('type_users', 3)->get();
|
||||||
|
|
||||||
return view('Admin/DataManagement/manageassets', compact('units', 'equipments', 'allEquipmentType', 'allClients'));
|
return view('Admin/DataManagement/manageassets', compact('units', 'equipments', 'allEquipmentType', 'allClients'));
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.container-fluid -->
|
</div><!-- /.container-fluid -->
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- /.content-header -->
|
<!-- /.content-header -->
|
||||||
|
|
||||||
<!-- Main content -->
|
<!-- Main content -->
|
||||||
|
|
@ -41,185 +40,204 @@ class="btn btn-block bg-gradient-primary btn-lg">{{ __('messages.portfolio.chang
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="card-light" id="cardAssetsTable">
|
<div class="card-light" id="cardAssetsTable">
|
||||||
|
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">{{ __('messages.portfolio.change_buttons.asset_table') }}</h3>
|
<h3 class="card-title">{{ __('messages.portfolio.change_buttons.asset_table') }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-header -->
|
<!-- /.card-header -->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<table id="showProjectEquipment1" class="table table-bordered table-striped">
|
<div class="row text-center">
|
||||||
<thead>
|
<div class="form-group col-sm">
|
||||||
<tr>
|
<label>Cliente </label>
|
||||||
<th>ID</th>
|
<select id="receiveAllClients" name="receiveAllClients" class="form-control">
|
||||||
<th>Tag</th>
|
<option value='#' selected>Mostrar Todos</option>
|
||||||
<th>Fabrica</th>
|
@foreach ($allClients as $client)
|
||||||
<th>Tipo</th>
|
<option value="{{ $client->user_id }}">
|
||||||
<th>Ações</th>
|
{{ $client->user_name }}</option>
|
||||||
</tr>
|
@endforeach
|
||||||
</thead>
|
</select>
|
||||||
</table>
|
</div>
|
||||||
|
|
||||||
<script>
|
<div class="form-group col-sm" id="card-receivePlantClientRelated">
|
||||||
$(document).ready(function() {
|
<label>Instalações </label>
|
||||||
|
<select id="receivePlantClientRelated" name="receivePlantClientRelated"
|
||||||
|
class="form-control">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
$('#showProjectEquipment1').DataTable({
|
<div class="col-sm" id="card-receiveUnitsClientRelated">
|
||||||
processing: true,
|
<div class="form-group">
|
||||||
serverSide: true,
|
<label>Fábricas </label>
|
||||||
ajax: {
|
<select id="receiveUnitsClientRelated" name="receiveUnitsClientRelated"
|
||||||
url: '{{ route('getDataEquipment') }}',
|
class="form-control">
|
||||||
type: 'GET',
|
</select>
|
||||||
},
|
</div>
|
||||||
columns: [{
|
</div>
|
||||||
data: 'equipment_id',
|
|
||||||
name: 'equipment_id'
|
<div class="form-group col-sm">
|
||||||
},
|
<label>Tipo de Equipamento </label>
|
||||||
{
|
<select id="tipo_valvulasList" name="equipmentTypeId" class="form-control">
|
||||||
data: 'equipment_tag',
|
<option value='#' selected>Mostrar Todos</option>
|
||||||
name: 'equipment_tag'
|
@foreach ($allEquipmentType as $equipmentsType)
|
||||||
},
|
<option value="{{ $equipmentsType->equipment_type_id }}">
|
||||||
{
|
{{ $equipmentsType->equipment_type_name }}</option>
|
||||||
data: 'unit_id',
|
@endforeach
|
||||||
name: 'unit_id'
|
</select>
|
||||||
},
|
</div>
|
||||||
{
|
</div>
|
||||||
data: 'equipment_type_id',
|
<!-- row text-center -->
|
||||||
name: 'equipment_type_id'
|
<table id="showProjectEquipment1" class="table table-bordered table-striped">
|
||||||
},
|
<thead>
|
||||||
{
|
<tr>
|
||||||
data: 'action',
|
<th>ID</th>
|
||||||
name: 'action',
|
<th>Tag</th>
|
||||||
orderable: false,
|
<th>Fabrica</th>
|
||||||
searchable: false
|
<th>Tipo</th>
|
||||||
},
|
<th>Ações</th>
|
||||||
],
|
</tr>
|
||||||
});
|
</thead>
|
||||||
});
|
</table>
|
||||||
</script>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-body -->
|
<!-- /.card-body -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{-- ./cardAssetsTable --}}
|
{{-- ./cardAssetsTable --}}
|
||||||
|
|
||||||
{{-- <div class="card card-primary" id="cardCreateAssets">
|
|
||||||
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{{-- ./col-md-12 --}}
|
||||||
</div>
|
</div>
|
||||||
|
{{-- ./justify-content-center --}}
|
||||||
</section>
|
</section>
|
||||||
|
{{-- ./content --}}
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('scriptsTemplateAdmin')
|
@section('scriptsTemplateAdmin')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
$(function() {
|
var dataTables;
|
||||||
$("#assetsTable").DataTable({
|
$(document).ready(function() {
|
||||||
"responsive": true,
|
|
||||||
"lengthChange": false,
|
dataTables = $('#showProjectEquipment1').DataTable({
|
||||||
"autoWidth": false,
|
responsive: true,
|
||||||
"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
|
processing: true,
|
||||||
}).buttons().container().appendTo('#assetsTable_wrapper .col-md-6:eq(0)');
|
serverSide: true,
|
||||||
|
ajax: {
|
||||||
|
url: '{{ route('getDataEquipment') }}',
|
||||||
|
type: 'GET',
|
||||||
|
data: function(d) {
|
||||||
|
// Envia as variaveis de acordo com as opcoes selecionadas para o DataTables
|
||||||
|
d.receiveAllClients = $('#receiveAllClients').val();
|
||||||
|
d.receiveAllPlants = $('#receivePlantClientRelated').val();
|
||||||
|
d.receiveAllUnits = $('#receiveUnitsClientRelated').val();
|
||||||
|
d.receiveEquipmentsType = $('#tipo_valvulasList').val();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
data: 'equipment_id',
|
||||||
|
name: 'equipment_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'equipment_tag',
|
||||||
|
name: 'equipment_tag'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'unit_id',
|
||||||
|
name: 'unit_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'equipment_type_id',
|
||||||
|
name: 'equipment_type_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'action',
|
||||||
|
name: 'action',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//De acordo com os valores deste campos, como anteriormente ja sao enviados para a DataTables para fazer as filtragens, agora atualizamos a Tabela com base no filtros feitos
|
||||||
|
$('#receiveAllClients,#receivePlantClientRelated,#receiveUnitsClientRelated,#tipo_valvulasList').on('change',
|
||||||
|
function() {
|
||||||
|
dataTables.ajax.reload();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{--
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// $('#cardAssetsTable').hide();
|
// Esconde os cards inicialmente
|
||||||
$('#cardCreateAssets').hide();
|
$('#card-receivePlantClientRelated').hide();
|
||||||
|
$('#card-receiveUnitsClientRelated').hide();
|
||||||
|
|
||||||
$('#receiveAllClients').on('change', function() {
|
$('#receiveAllClients').on('change', function() {
|
||||||
var receiveAllClients = $(this).val();
|
var receiveAllClients = $(this).val();
|
||||||
console.log(receiveAllClients);
|
|
||||||
if (receiveAllClients) {
|
// Esconde ambos os cards ao mudar o cliente
|
||||||
|
$('#card-receivePlantClientRelated').hide();
|
||||||
|
$('#card-receiveUnitsClientRelated').hide();
|
||||||
|
|
||||||
|
//Se existir receiveAllClients e for diferente de '#'
|
||||||
|
if (receiveAllClients && receiveAllClients !== '#') {
|
||||||
|
$('#card-receivePlantClientRelated').show(); // Mostra o card de Plantas
|
||||||
|
|
||||||
|
// Faz a requisição AJAX para receber as plantas
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/receivePlants/' + receiveAllClients,
|
url: '/api/receivePlants/' + receiveAllClients,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log(data);
|
var select = $('#receivePlantClientRelated');
|
||||||
|
select.empty(); // Limpa o select atual
|
||||||
|
select.append($('<option>', {
|
||||||
|
value: '#',
|
||||||
|
text: 'Mostrar Todas'
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Preenche o select de Plantas
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
select.append($('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.name
|
||||||
|
}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
|
||||||
</script> --}}
|
|
||||||
|
|
||||||
{{-- Script para DataTables Yajra --}}
|
|
||||||
{{-- <script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#assetsTable').DataTable({
|
|
||||||
autoWidth: false,
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: {
|
|
||||||
url: '/api/receiveAllEquipments/',
|
|
||||||
// data: function(d) {
|
|
||||||
// d.equipment_type_id = $('#tipo_valvulasList').val();
|
|
||||||
// },
|
|
||||||
},
|
|
||||||
columns: [{
|
|
||||||
data: 'equipment_tag',
|
|
||||||
name: 'equipment_tag'
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// data: 'equipment_type',
|
|
||||||
// name: 'equipment_type'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// data: 'Unit',
|
|
||||||
// name: 'Unit'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
data: 'equipment_description',
|
|
||||||
name: 'equipment_description'
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
rowId: 'equipment_id'
|
|
||||||
});
|
});
|
||||||
})
|
|
||||||
</script> --}}
|
|
||||||
|
|
||||||
|
$('#receivePlantClientRelated').on('change', function() {
|
||||||
|
var receivePlantClientRelated = $(this).val();
|
||||||
|
|
||||||
|
if (receivePlantClientRelated && receivePlantClientRelated !== '#') {
|
||||||
|
$('#card-receiveUnitsClientRelated').show(); // Mostra o card de Unidades
|
||||||
|
|
||||||
{{-- <script>
|
// Faz a requisição AJAX para receber as unidades
|
||||||
$(function() {
|
$.ajax({
|
||||||
$('input[name="daterange"]').daterangepicker({
|
url: 'api/receiveUnitsManageAssets/' + receivePlantClientRelated,
|
||||||
opens: 'right'
|
type: 'GET',
|
||||||
}, function(start, end, label) {
|
success: function(data) {
|
||||||
console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end
|
var select = $('#receiveUnitsClientRelated');
|
||||||
.format('YYYY-MM-DD'));
|
select.empty();
|
||||||
|
select.append($('<option>', {
|
||||||
|
value: '#',
|
||||||
|
text: 'Mostrar Todas'
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Preenche o select de Unidades
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
select.append($('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.name
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#card-receiveUnitsClientRelated').hide(); // Esconde o card de Unidades
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script> --}}
|
</script>
|
||||||
|
|
||||||
{{-- <script>
|
|
||||||
$(function() {
|
|
||||||
$("#TableEquipments").DataTable({
|
|
||||||
"responsive": true,
|
|
||||||
"lengthChange": false,
|
|
||||||
"autoWidth": false,
|
|
||||||
"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
|
|
||||||
}).buttons().container().appendTo('#TableEquipments_wrapper .col-md-6:eq(0)');
|
|
||||||
$("#example1").DataTable({
|
|
||||||
"responsive": true,
|
|
||||||
"lengthChange": false,
|
|
||||||
"autoWidth": false,
|
|
||||||
"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
|
|
||||||
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
|
|
||||||
$("#example2").DataTable({
|
|
||||||
"responsive": true,
|
|
||||||
"lengthChange": false,
|
|
||||||
"autoWidth": false,
|
|
||||||
"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
|
|
||||||
}).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)');
|
|
||||||
$("#example3").DataTable({
|
|
||||||
"responsive": true,
|
|
||||||
"lengthChange": false,
|
|
||||||
"autoWidth": false,
|
|
||||||
"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
|
|
||||||
}).buttons().container().appendTo('#example3_wrapper .col-md-6:eq(0)');
|
|
||||||
});
|
|
||||||
</script> --}}
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1182,6 +1182,40 @@ class="btn btn-info">Baixar Template</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row text-center">
|
||||||
|
|
||||||
|
<div class="col-sm" id="card-receiveUnitsClientRelated">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Fábricas </label>
|
||||||
|
|
||||||
|
<select class="form-control" id="receiveUnitsClientRelated1"
|
||||||
|
name="receiveUnitsClientRelated">
|
||||||
|
<option value='#' selected>Mostrar Todos</option>
|
||||||
|
@foreach ($checkUnits as $checkUnit)
|
||||||
|
<option value="{{ $checkUnit->unit_id }}">
|
||||||
|
{{ $checkUnit->unit_name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm">
|
||||||
|
<label>Tipo de Equipamento </label>
|
||||||
|
<select id="tipo_valvulasList" name="equipmentTypeId" class="form-control">
|
||||||
|
<option value='#' selected>Mostrar Todos</option>
|
||||||
|
@foreach ($typeEquipments as $typeEquipment)
|
||||||
|
<option value="{{ $typeEquipment->equipment_type_id }}">
|
||||||
|
{{ $typeEquipment->equipment_type_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- row text-center -->
|
||||||
|
|
||||||
<table id="showProjectEquipment" class="table table-bordered table-striped">
|
<table id="showProjectEquipment" class="table table-bordered table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -1194,46 +1228,6 @@ class="btn btn-info">Baixar Template</a>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
var numberProject = $('#receiveNumberProject').val();
|
|
||||||
|
|
||||||
$('#showProjectEquipment').DataTable({
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: {
|
|
||||||
url: '{{ route('getDataEquipment') }}',
|
|
||||||
type: 'GET',
|
|
||||||
data: {
|
|
||||||
'numberProject': numberProject
|
|
||||||
}
|
|
||||||
},
|
|
||||||
columns: [{
|
|
||||||
data: 'equipment_id',
|
|
||||||
name: 'equipment_id'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: 'equipment_tag',
|
|
||||||
name: 'equipment_tag'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: 'unit_id',
|
|
||||||
name: 'unit_id'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: 'equipment_type_id',
|
|
||||||
name: 'equipment_type_id'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: 'action',
|
|
||||||
name: 'action',
|
|
||||||
orderable: false,
|
|
||||||
searchable: false
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1425,6 +1419,120 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var dataTable;
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
dataTable = $('#showProjectEquipment').DataTable({
|
||||||
|
responsive: true,
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: {
|
||||||
|
url: '{{ route('getDataEquipment') }}',
|
||||||
|
type: 'GET',
|
||||||
|
data: function(d) {
|
||||||
|
d.numberProject = $('#receiveNumberProject').val();
|
||||||
|
d.checkUnits = $('#receiveUnitsClientRelated1').val();
|
||||||
|
d.tipo_valvulasList = $('#tipo_valvulasList').val();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
data: 'equipment_id',
|
||||||
|
name: 'equipment_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'equipment_tag',
|
||||||
|
name: 'equipment_tag'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'unit_id',
|
||||||
|
name: 'unit_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'equipment_type_id',
|
||||||
|
name: 'equipment_type_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'action',
|
||||||
|
name: 'action',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#receiveUnitsClientRelated1, #receiveNumberProject, #tipo_valvulasList').on('change', function() {
|
||||||
|
dataTable.ajax.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{-- <script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
// $('#card-receiveUnitsClientRelated').hide();
|
||||||
|
|
||||||
|
// Evento de mudança para o campo onde numberProject é selecionado
|
||||||
|
$('#receiveNumberProject').on('change', function() {
|
||||||
|
|
||||||
|
var numberProject = $(this).val();
|
||||||
|
|
||||||
|
if (numberProject) {
|
||||||
|
$.ajax({
|
||||||
|
url: '/api/receiveUnits/' + numberProject,
|
||||||
|
type: 'GET',
|
||||||
|
success: function(data) {
|
||||||
|
// Supondo que 'data' é um array de objetos com 'id' e 'name'
|
||||||
|
var options = "<option value='#' selected>Mostrar Todos</option>";
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
options += "<option value='" + item.id + "'>" + item
|
||||||
|
.name + "</option>";
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#receiveUnitsClientRelated').html(options);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
// Tratamento de erro
|
||||||
|
console.log('Erro ao carregar dados');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script> --}}
|
||||||
|
|
||||||
|
|
||||||
|
{{-- Nao vai precisar de scritp, pois este filtro nao vai precisar ser altera. --}}
|
||||||
|
{{-- <script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#receiveNumberProject').on('change', function() {
|
||||||
|
var numberProject = $(this).val();
|
||||||
|
|
||||||
|
if (numberProject) {
|
||||||
|
$.ajax({
|
||||||
|
url: '/api/receiveUnits/' + numberProject,
|
||||||
|
type: 'GET',
|
||||||
|
success: function(data) {
|
||||||
|
console.log(data);
|
||||||
|
var options = "<option value='#' selected>Mostrar Todos</option>";
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
options += "<option value='" + item.id + "'>" + item
|
||||||
|
.name + "</option>";
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#receiveUnitsClientRelated').html(options);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
console.log('Erro ao carregar dados');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script> --}}
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#equipmentType_id_list').on('change', function() {
|
$('#equipmentType_id_list').on('change', function() {
|
||||||
|
|
|
||||||
1249
resources/views/projectsClients/testRoute.blade.php
Normal file
1249
resources/views/projectsClients/testRoute.blade.php
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -28,16 +28,19 @@
|
||||||
use App\Http\Controllers\PreparedProjectController;
|
use App\Http\Controllers\PreparedProjectController;
|
||||||
use App\Http\Controllers\ExecutionProjectController;
|
use App\Http\Controllers\ExecutionProjectController;
|
||||||
use App\Http\Controllers\WorkstationsJobsController;
|
use App\Http\Controllers\WorkstationsJobsController;
|
||||||
use App\Http\Controllers\LanguageController;
|
use App\Http\Controllers\LanguageController;
|
||||||
|
|
||||||
|
|
||||||
Route::get('test', function () {
|
Route::get('test', function () {
|
||||||
return view('testDataTables');
|
return view('testDataTables');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('cancelElementalTaskForEquipment/{equipmentID}', [WorkstationsJobsController::class,'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
Route::get('cancelElementalTaskForEquipment/{equipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
||||||
|
|
||||||
Route::get('test2/{equipmentID}/{projectID?}',[ExecutionProjectController::class,'test11'])->name('test11');
|
|
||||||
|
// Nao gosto que esteja neste controller, verificar mais tarde
|
||||||
|
Route::get('test2/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'test11'])->name('test11');
|
||||||
|
Route::get('manageAssets/{equipmentID}', [ProjectoDatacontroller::class, 'test22'])->name('test22');
|
||||||
|
|
||||||
|
|
||||||
Route::get('getDataEquipment', [ExecutionProjectController::class, 'getDataEquipment'])->name('getDataEquipment');
|
Route::get('getDataEquipment', [ExecutionProjectController::class, 'getDataEquipment'])->name('getDataEquipment');
|
||||||
|
|
@ -56,7 +59,7 @@
|
||||||
->middleware(['auth', 'signed', 'throttle:6,1'])
|
->middleware(['auth', 'signed', 'throttle:6,1'])
|
||||||
->name('verification.verify');
|
->name('verification.verify');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -79,21 +82,21 @@
|
||||||
|*** Routes unique access to the technical
|
|*** Routes unique access to the technical
|
||||||
*/
|
*/
|
||||||
Route::middleware(['checkUserType:enterWorkstation'])->group(function () {
|
Route::middleware(['checkUserType:enterWorkstation'])->group(function () {
|
||||||
|
|
||||||
Route::get('enterWorkstation', function () {
|
Route::get('enterWorkstation', function () {
|
||||||
return view('workstations.start');
|
return view('workstations.start');
|
||||||
})->name('enterWorkstation');
|
})->name('enterWorkstation');
|
||||||
|
|
||||||
Route::get('/getEquipmentData/{equipment_id}', [WorkstationsJobsController::class, 'getEquipmentData'])->name('getEquipmentData');
|
Route::get('/getEquipmentData/{equipment_id}', [WorkstationsJobsController::class, 'getEquipmentData'])->name('getEquipmentData');
|
||||||
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
|
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| User_Type (Super_Administrador)
|
| User_Type (Super_Administrador)
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|*** Routes unique access to the Super_Administrator, Administrator
|
|*** Routes unique access to the Super_Administrator, Administrator
|
||||||
*/
|
*/
|
||||||
Route::middleware(['checkUserType:home'])->group(function () {
|
Route::middleware(['checkUserType:home'])->group(function () {
|
||||||
Route::get('/', [ProjectoDatacontroller::class, ('HomePage')])->name('home');
|
Route::get('/', [ProjectoDatacontroller::class, ('HomePage')])->name('home');
|
||||||
|
|
||||||
|
|
@ -112,16 +115,16 @@
|
||||||
Route::get('users/{id}/edit', 'edit')->name('users.edit');
|
Route::get('users/{id}/edit', 'edit')->name('users.edit');
|
||||||
Route::put('users/{user}', 'update')->name('users.update');
|
Route::put('users/{user}', 'update')->name('users.update');
|
||||||
Route::delete('users/{user}', 'destroy')->name('users.destroy');
|
Route::delete('users/{user}', 'destroy')->name('users.destroy');
|
||||||
|
|
||||||
Route::post('editProfile/{id}', 'EditProfile')->name('editProfile');
|
Route::post('editProfile/{id}', 'EditProfile')->name('editProfile');
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Management of projects created
|
| Management of projects created
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::controller(CreateProjectController::class)
|
Route::controller(CreateProjectController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
|
|
@ -203,4 +206,13 @@
|
||||||
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']);
|
||||||
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
|
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
|
||||||
Route::get('/api/ambits/{equipmentType}', [CreateProjectController::class, 'getAmbits']);
|
Route::get('/api/ambits/{equipmentType}', [CreateProjectController::class, 'getAmbits']);
|
||||||
|
|
||||||
|
|
||||||
|
// Route::get('/api/receiveUnits', [CreateProjectController::class, 'receiveUnits']);
|
||||||
|
//Rota Api diretamente para a cracao da Obra
|
||||||
|
Route::get('/api/receiveUnits/{numberProject}', [CreateProjectController::class, 'receiveUnits']);
|
||||||
|
|
||||||
|
Route::get('api/receivePlants/{receiveAllClients}', [ProjectoDatacontroller::class, 'receivePlants']);
|
||||||
|
|
||||||
|
Route::get('api/receiveUnitsManageAssets/{receivePlantClientRelated}',[ProjectoDatacontroller::class, 'receiveUnitsManageAssets']);
|
||||||
Loading…
Reference in New Issue
Block a user