additional implementation of the authentication method and route selection, based on the type of user and start of creation of the client's display structure
This commit is contained in:
parent
5dca96d473
commit
ff6e6a91ad
33
app/Http/Controllers/ClientController.php
Normal file
33
app/Http/Controllers/ClientController.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
use App\Models\Plant;
|
||||||
|
use App\Models\CompanyProject;
|
||||||
|
|
||||||
|
|
||||||
|
class ClientController extends Controller
|
||||||
|
{
|
||||||
|
public function receiveProjectsClient()
|
||||||
|
{
|
||||||
|
$client = Auth::user()->user_id;
|
||||||
|
|
||||||
|
$recevePlantClient = Plant::where('user_id', $client)->get();
|
||||||
|
|
||||||
|
// Extrai os plant_id da coleção $recevePlantClient
|
||||||
|
$plantIds = $recevePlantClient->pluck('plant_id');
|
||||||
|
|
||||||
|
// Busca todos os CompanyProject que têm um plant_id dentro da lista $plantIds
|
||||||
|
$allProjectsClient = CompanyProject::whereIn('plant_id', $plantIds)->get();
|
||||||
|
|
||||||
|
return view('userClient.dashboardClient',compact('allProjectsClient'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function receiveManageAssetsClient(){
|
||||||
|
// return view()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/Http/Controllers/ClienteController.php
Normal file
29
app/Http/Controllers/ClienteController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\CompanyProject;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class ClienteController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
public function receiveProjectsClient()
|
||||||
|
{
|
||||||
|
$client = Auth::user()->user_id;
|
||||||
|
|
||||||
|
$recevePlantClient = Plant::where('user_id', $client)->get();
|
||||||
|
|
||||||
|
// Extrai os plant_id da coleção $recevePlantClient
|
||||||
|
$plantIds = $recevePlantClient->pluck('plant_id');
|
||||||
|
|
||||||
|
// Busca todos os CompanyProject que têm um plant_id dentro da lista $plantIds
|
||||||
|
$allProjectsClient = CompanyProject::whereIn('plant_id', $plantIds)->get();
|
||||||
|
|
||||||
|
|
||||||
|
return view('dashboardClient',compact('allProjectsClient'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,12 +34,14 @@
|
||||||
// use DataTables;
|
// use DataTables;
|
||||||
|
|
||||||
|
|
||||||
class CreateProjectController extends Controller {
|
class CreateProjectController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
public function receiveUnits($numberProject) {
|
public function receiveUnits($numberProject)
|
||||||
|
{
|
||||||
$PlantData = CompanyProject::where('company_projects_id', $numberProject)->first();
|
$PlantData = CompanyProject::where('company_projects_id', $numberProject)->first();
|
||||||
|
|
||||||
if(!$PlantData) {
|
if (!$PlantData) {
|
||||||
return response()->json([]);
|
return response()->json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +59,8 @@ public function receiveUnits($numberProject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function deleteFurtherTasks(Request $request) {
|
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)
|
||||||
|
|
@ -65,12 +68,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,15 +83,16 @@ 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)
|
||||||
|
|
@ -107,15 +111,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();
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +132,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;
|
||||||
|
|
@ -146,17 +150,18 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +169,8 @@ 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();
|
||||||
|
|
@ -174,16 +180,17 @@ 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
|
||||||
|
|
@ -194,13 +201,14 @@ 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');
|
||||||
|
|
@ -213,12 +221,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
|
||||||
|
|
@ -230,22 +238,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;
|
||||||
|
|
||||||
|
|
@ -255,7 +263,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
|
||||||
|
|
@ -272,7 +280,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);
|
||||||
|
|
@ -283,11 +291,12 @@ 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();
|
||||||
|
|
||||||
|
|
@ -305,19 +314,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -327,11 +336,12 @@ 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!');
|
||||||
|
|
@ -341,7 +351,8 @@ 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);
|
||||||
|
|
@ -355,22 +366,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)
|
||||||
|
|
@ -378,7 +389,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();
|
||||||
}
|
}
|
||||||
|
|
@ -398,18 +409,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;
|
||||||
|
|
@ -418,7 +429,7 @@ public function EditEquipmentsProjects(Request $request) {
|
||||||
$orderEquipmentTask->save();
|
$orderEquipmentTask->save();
|
||||||
|
|
||||||
$executionOrder++;
|
$executionOrder++;
|
||||||
} elseif($value == "off" && $orderEquipmentTask) {
|
} elseif ($value == "off" && $orderEquipmentTask) {
|
||||||
$orderEquipmentTask->delete();
|
$orderEquipmentTask->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -429,7 +440,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++;
|
||||||
|
|
@ -440,17 +451,18 @@ 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();
|
||||||
|
|
@ -462,7 +474,8 @@ 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([
|
||||||
|
|
@ -471,7 +484,8 @@ 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;
|
||||||
|
|
||||||
|
|
@ -487,15 +501,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();
|
||||||
|
|
||||||
|
|
@ -505,22 +519,23 @@ 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]);
|
||||||
|
|
@ -528,7 +543,8 @@ public function createProjectForStep1() {
|
||||||
|
|
||||||
// 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,16 +557,19 @@ 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;
|
||||||
|
|
@ -558,15 +577,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;
|
||||||
|
|
@ -585,15 +604,16 @@ 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;
|
||||||
|
|
@ -617,7 +637,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');
|
||||||
|
|
@ -637,7 +657,8 @@ 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')) {
|
||||||
|
|
@ -686,10 +707,10 @@ public function showStep2($company_projects_id) {
|
||||||
// dd($checkUnits);
|
// 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,7 +726,8 @@ 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')
|
||||||
|
|
@ -726,7 +748,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);
|
||||||
|
|
@ -736,7 +758,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 {
|
||||||
|
|
||||||
|
|
@ -772,8 +794,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,
|
||||||
|
|
@ -782,7 +804,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;
|
||||||
|
|
@ -803,7 +825,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++;
|
||||||
|
|
@ -819,20 +841,26 @@ 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');
|
||||||
|
|
||||||
// Recebe a id do Projecto criado
|
// Recebe a id do Projecto criado
|
||||||
$company_projects_id = $request->numberProject;
|
$company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
|
// Inicializa o contador para ispt_number
|
||||||
|
$isptNumber = 1;
|
||||||
|
|
||||||
// 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());
|
||||||
|
|
||||||
|
|
@ -849,19 +877,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -884,7 +912,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;
|
||||||
|
|
@ -914,20 +942,22 @@ public function processStep2(Request $request) {
|
||||||
$newEquipament->equipment_tag = $datas['tag'];
|
$newEquipament->equipment_tag = $datas['tag'];
|
||||||
$newEquipament->equipment_serial_number = $datas['n_serie'];
|
$newEquipament->equipment_serial_number = $datas['n_serie'];
|
||||||
$newEquipament->equipment_model = $datas['modelo'];
|
$newEquipament->equipment_model = $datas['modelo'];
|
||||||
|
$newEquipament->ispt_number = $isptNumber;
|
||||||
$newEquipament->company_projects_id = $company_projects_id;
|
$newEquipament->company_projects_id = $company_projects_id;
|
||||||
|
|
||||||
$newEquipament->save();
|
$newEquipament->save();
|
||||||
|
|
||||||
|
|
||||||
$countNewEquipment++;
|
$countNewEquipment++;
|
||||||
|
|
||||||
|
$isptNumber++;
|
||||||
|
|
||||||
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
||||||
$receveEquipment_ID = $newEquipament->equipment_id;
|
$receveEquipment_ID = $newEquipament->equipment_id;
|
||||||
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
||||||
|
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -943,7 +973,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++;
|
||||||
|
|
@ -957,9 +987,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;
|
||||||
|
|
@ -976,15 +1006,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.
|
||||||
|
|
@ -995,33 +1025,34 @@ 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
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1031,7 +1062,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1049,13 +1080,14 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
@ -1063,11 +1095,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)
|
||||||
|
|
@ -1081,11 +1113,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
|
||||||
|
|
@ -1093,7 +1125,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1102,10 +1134,11 @@ 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()]);
|
||||||
|
|
@ -1115,7 +1148,8 @@ 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')
|
||||||
|
|
@ -1133,8 +1167,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] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1146,8 +1180,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1159,18 +1193,20 @@ 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');
|
||||||
|
|
@ -1201,8 +1237,9 @@ 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();
|
||||||
|
|
@ -1215,7 +1252,8 @@ 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());
|
||||||
|
|
||||||
|
|
@ -1225,7 +1263,8 @@ 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.*')
|
||||||
|
|
@ -1234,7 +1273,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public function getDataEquipment(Request $request)
|
||||||
|
|
||||||
// Query padrão que todas as dataTables recebem, a partir dele fazemos os filt
|
// Query padrão que todas as dataTables recebem, a partir dele fazemos os filt
|
||||||
$query = Equipment::with('equipmentType', 'unit')
|
$query = Equipment::with('equipmentType', 'unit')
|
||||||
->select(['equipment_id', 'equipment_tag', 'unit_id', 'equipment_type_id']);
|
->select(['equipment_id','ispt_number' ,'equipment_tag', 'unit_id', 'equipment_type_id']);
|
||||||
|
|
||||||
// Consultas para a Criacao da Obra, Ambas vao ser diferentes, pois na creacao, recebes os equipamentos por obra, porem no portifolio vamos buscar todos.
|
// Consultas para a Criacao da Obra, Ambas vao ser diferentes, pois na creacao, recebes os equipamentos por obra, porem no portifolio vamos buscar todos.
|
||||||
if ($numberProject) {
|
if ($numberProject) {
|
||||||
|
|
@ -96,13 +96,6 @@ public function getDataEquipment(Request $request)
|
||||||
return $actionBtn;
|
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;
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
->editColumn('unit_id', function ($equipment) {
|
->editColumn('unit_id', function ($equipment) {
|
||||||
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
// Isto irá substituir 'unit_id' pelo 'unit_name' associado
|
||||||
return $equipment->unit->unit_name ?? 'N/A';
|
return $equipment->unit->unit_name ?? 'N/A';
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,64 @@ class CheckUserType
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function handle(Request $request, Closure $next, $routeType)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
$userType = auth()->user()->userType->type_user;
|
if (!auth()->check()) {
|
||||||
|
return redirect()->route('login');
|
||||||
if ($routeType == 'enterWorkstation' && $userType != 'Técnico') {
|
|
||||||
return redirect()->route('home'); // ou qualquer rota padrão para redirecionar
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($routeType == 'home' && $userType != 'Super_Administrador') {
|
$userType = auth()->user()->userType->type_user;
|
||||||
return redirect()->route('enterWorkstation'); // ou qualquer rota padrão para redirecionar
|
$currentRouteName = $request->route()->getName();
|
||||||
|
|
||||||
|
// Permitir que o Super_Administrador acesse qualquer rota
|
||||||
|
if ($userType === 'Super_Administrador') {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obter as rotas permitidas para o tipo de usuário atual
|
||||||
|
$allowedRoutes = $this->getAllowedRoutesForUserType($userType);
|
||||||
|
|
||||||
|
// Verificar se a rota atual está permitida para o tipo de usuário
|
||||||
|
if (!in_array($currentRouteName, $allowedRoutes)) {
|
||||||
|
// Redirecionar para a rota padrão do tipo de usuário
|
||||||
|
return redirect()->route($this->getDefaultRouteForUserType($userType));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retorna as rotas permitidas para um dado tipo de usuário.
|
||||||
|
*/
|
||||||
|
protected function getAllowedRoutesForUserType($userType)
|
||||||
|
{
|
||||||
|
switch ($userType) {
|
||||||
|
case 'Técnico':
|
||||||
|
return ['enterWorkstation', 'getEquipmentData', 'receiveAnswersEquipment'];
|
||||||
|
case 'Empresa':
|
||||||
|
return ['dashboardClient', 'manageAssetsClient'];
|
||||||
|
// Adicione mais casos conforme necessário
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retorna a rota padrão para um dado tipo de usuário.
|
||||||
|
*/
|
||||||
|
protected function getDefaultRouteForUserType($userType)
|
||||||
|
{
|
||||||
|
switch ($userType) {
|
||||||
|
case 'Super_Administrador':
|
||||||
|
return 'home';
|
||||||
|
case 'Técnico':
|
||||||
|
return 'enterWorkstation';
|
||||||
|
case 'Empresa':
|
||||||
|
return 'dashboardClient';
|
||||||
|
// Adicione mais casos conforme necessário
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
398
resources/views/Templates/templateClient.blade.php
Normal file
398
resources/views/Templates/templateClient.blade.php
Normal file
|
|
@ -0,0 +1,398 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/dist/css/adminlte.css') }}">
|
||||||
|
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
|
||||||
|
|
||||||
|
<!-- Font Awesome -->
|
||||||
|
{{-- <link rel="stylesheet" href="{{ asset('assets/plugins/fontawesome-free/css/all.min.css') }}"> --}}
|
||||||
|
<!-- Font Awesome 6.1.1 -->
|
||||||
|
{{-- <link rel="stylesheet" href="{{ asset('plugins/fontawesome-611/css/all.min.css') }}"> --}}
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/fontawesome-6.4.2/css/all.css') }}">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Ionicons -->
|
||||||
|
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||||
|
<!-- Tempusdominus Bootstrap 4 -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="{{ asset('assets/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css') }}">
|
||||||
|
<!-- iCheck -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/icheck-bootstrap/icheck-bootstrap.min.css') }}">
|
||||||
|
<!-- JQVMap -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/jqvmap/jqvmap.min.css') }}">
|
||||||
|
<!-- Theme style -->
|
||||||
|
|
||||||
|
<!-- overlayScrollbars -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/overlayScrollbars/css/OverlayScrollbars.min.css') }}">
|
||||||
|
<!-- Daterange picker -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/daterangepicker/daterangepicker.css') }}">
|
||||||
|
<!-- summernote -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/summernote/summernote-bs4.min.css') }}">
|
||||||
|
<!-- jQuery UI -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/jquery-ui/jquery-ui.css') }}">
|
||||||
|
|
||||||
|
<!-- daterange picker -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/daterangepicker/daterangepicker.css') }}">
|
||||||
|
|
||||||
|
<!-- DataTables -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') }}">
|
||||||
|
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="{{ asset('assets/plugins/datatables-responsive/css/responsive.bootstrap4.min.css') }}">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables-buttons/css/buttons.bootstrap4.min.css') }}">
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<!-- DataTables CSS -->
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
|
||||||
|
<!-- DataTables JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
||||||
|
<!-- DataTables Bootstrap 4 JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap4.min.js"></script>
|
||||||
|
<!-- DataTables Buttons JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
{{-- Graficos para gestao com chart.js --}}
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#isptGroupLink:hover {
|
||||||
|
color: #EAF3F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spin {
|
||||||
|
animation: spin 1s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ***************************** */
|
||||||
|
.accordion {
|
||||||
|
overflow-anchor: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion>.card {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion>.card:not(:last-of-type) {
|
||||||
|
border-bottom: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion>.card:not(:first-of-type) {
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion>.card>.card-header {
|
||||||
|
border-radius: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nome de baixo do circulo */
|
||||||
|
.steps {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nome dentro do circulo de ainda não de chegar o progress bar */
|
||||||
|
.step-button {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: none;
|
||||||
|
background-color: var(--prm-gray);
|
||||||
|
transition: .4s;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-button[aria-expanded="true"] {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background-color: var(--prm-color);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.done {
|
||||||
|
background-color: var(--prm-color);
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.step-item {
|
||||||
|
z-index: 10;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#progress {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
position: absolute;
|
||||||
|
width: 95%;
|
||||||
|
z-index: 5;
|
||||||
|
height: 10px;
|
||||||
|
margin-left: 18px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* to customize progress bar */
|
||||||
|
#progress::-webkit-progress-value {
|
||||||
|
background-color: var(--prm-color);
|
||||||
|
transition: .5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#progress::-webkit-progress-bar {
|
||||||
|
background-color: var(--prm-gray);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#editImg {
|
||||||
|
width: 215px;
|
||||||
|
height: 215px;
|
||||||
|
object-fit: cover;
|
||||||
|
/* Isso fará com que a imagem cubra completamente a área sem distorcer */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="hold-transition sidebar-mini layout-fixed">
|
||||||
|
|
||||||
|
<!-- Wrapper -->
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<!-- Preloader -->
|
||||||
|
|
||||||
|
<div class="preloader flex-column justify-content-center align-items-center">
|
||||||
|
<img class="animation__shake spin" src="{{ asset('img/logo4.0.jpg') }}" alt="AdminLTELogo" height="60"
|
||||||
|
width="60">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Navbar -->
|
||||||
|
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
|
||||||
|
<!-- Left navbar links -->
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i
|
||||||
|
class="fas fa-bars"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Right navbar links -->
|
||||||
|
<ul class="navbar-nav ml-auto align-items-center">
|
||||||
|
<li class="nav-item my-2">
|
||||||
|
<form id="language-form" action="{{ route('language.switch') }}" method="post"
|
||||||
|
class="form-inline">
|
||||||
|
@csrf
|
||||||
|
<select class="custom-select" name="locale" onchange="this.form.submit()">
|
||||||
|
<option value="en" {{ app()->getLocale() == 'en' ? 'selected' : '' }}>English</option>
|
||||||
|
<option value="pt" {{ app()->getLocale() == 'pt' ? 'selected' : '' }}>Português
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-widget="fullscreen" href="#" role="button">
|
||||||
|
<i class="fas fa-expand-arrows-alt"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
<!-- /.navbar -->
|
||||||
|
|
||||||
|
<!-- Main Sidebar Container -->
|
||||||
|
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
||||||
|
<!-- Brand Logo -->
|
||||||
|
<a href="#" class="brand-link" style="pointer-events: none;">
|
||||||
|
<img src="{{ asset('/img/ispt.jpg') }}" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
|
||||||
|
style="opacity: .8">
|
||||||
|
<span class="brand-text font-weight-light">ISPT 4.0</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- Sidebar -->
|
||||||
|
<div class="sidebar">
|
||||||
|
<!-- Sidebar user panel (optional) -->
|
||||||
|
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
|
||||||
|
{{-- Verifica se esta logado , se estiver , busca os dados do utilizador atual. --}}
|
||||||
|
@if (Auth::check())
|
||||||
|
<div class="image">
|
||||||
|
<img class="img-circle elevation-2 imgProfile editImg"
|
||||||
|
src="{{ asset('user_logos/' . (Auth::user()->user_logo ?? 'logoISPT4.0.jpg')) }}"
|
||||||
|
alt="User Logo">
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<a href="{{ route('usersProfiles', ['id' => Auth::user()->user_id]) }}"
|
||||||
|
class="d-block">{{ Auth::user()->userType?->type_user }}</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sidebar Menu -->
|
||||||
|
<nav class="mt-2">
|
||||||
|
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
|
||||||
|
data-accordion="false">
|
||||||
|
<!-- Add icons to the links using the .nav-icon class
|
||||||
|
with font-awesome or any other icon font library -->
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ route('dashboardClient') }}" class="nav-link active">
|
||||||
|
<i class="nav-icon fas fa-tachometer-alt"></i>
|
||||||
|
<p> {{ __('messages.dashboard.dashboard') }} </p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ route('manageAssetsClient') }}" class="nav-link">
|
||||||
|
<i class="fa-solid fa-file-edit"></i>
|
||||||
|
<p> {{ __('messages.portfolio.top_view_part.management_assets') }}</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<form method="POST" action="{{ route('logout') }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="btn btn-danger">Terminar sessão</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- /.Single menu item -->
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- /.sidebar-menu -->
|
||||||
|
</div>
|
||||||
|
<!-- /.sidebar -->
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
@yield('Main-content')
|
||||||
|
{{-- <section class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
./col-md-12
|
||||||
|
</div>
|
||||||
|
./row justify-content-center
|
||||||
|
</div>
|
||||||
|
./container-fluid
|
||||||
|
</section> --}}
|
||||||
|
{{-- ./content --}}
|
||||||
|
</div>
|
||||||
|
{{-- ./content-wrapper --}}
|
||||||
|
|
||||||
|
<!-- Control Sidebar -->
|
||||||
|
<aside class="control-sidebar control-sidebar-dark">
|
||||||
|
<!-- Control sidebar content goes here -->
|
||||||
|
</aside>
|
||||||
|
<!-- /.control-sidebar -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- ./ Wrapper -->
|
||||||
|
|
||||||
|
<footer class="main-footer">
|
||||||
|
<strong>Copyright © 2017-{{ date('Y') }} <a href="https://www.isptgroup.com" id="isptGroupLink">ISPT
|
||||||
|
-
|
||||||
|
Industrial Services, SA</a>.</strong>
|
||||||
|
Todos os direitos reservados.
|
||||||
|
<div class="float-right d-none d-sm-inline-block">
|
||||||
|
<b>Versão</b> {{ config('app.version') }}
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
@yield('scriptsTemplateAdmin')
|
||||||
|
{{-- Scripts-Plugins --}}
|
||||||
|
|
||||||
|
<script src="{{ asset('assets/dist/js/bootstrap.bundle.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script src="{{ asset('assets/plugins/jquery/jquery.min.js') }}"></script>
|
||||||
|
<!-- jQuery UI 1.11.4 -->
|
||||||
|
<script src="{{ asset('assets/plugins/jquery-ui/jquery-ui.min.js') }}"></script>
|
||||||
|
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
|
||||||
|
<script>
|
||||||
|
$.widget.bridge('uibutton', $.ui.button)
|
||||||
|
</script>
|
||||||
|
<!-- Bootstrap 4 -->
|
||||||
|
<script src="{{ asset('assets/plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ChartJS -->
|
||||||
|
<script src="{{ asset('assets/plugins/chart.js/Chart.min.js') }}"></script>
|
||||||
|
<!-- Sparkline -->
|
||||||
|
<script src="{{ asset('assets/plugins/sparklines/sparkline.js') }}"></script>
|
||||||
|
<!-- JQVMap -->
|
||||||
|
<script src="{{ asset('assets/plugins/jqvmap/jquery.vmap.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/jqvmap/maps/jquery.vmap.usa.js') }}"></script>
|
||||||
|
<!-- jQuery Knob Chart -->
|
||||||
|
<script src="{{ asset('assets/plugins/jquery-knob/jquery.knob.min.js') }}"></script>
|
||||||
|
<!-- daterangepicker -->
|
||||||
|
<script src="{{ asset('assets/plugins/moment/moment.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||||
|
<!-- Tempusdominus Bootstrap 4 -->
|
||||||
|
<script src="{{ asset('assets/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js') }}"></script>
|
||||||
|
<!-- Summernote -->
|
||||||
|
<script src="{{ asset('assets/plugins/summernote/summernote-bs4.min.js') }}"></script>
|
||||||
|
<!-- overlayScrollbars -->
|
||||||
|
<script src="{{ asset('assets/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js') }}"></script>
|
||||||
|
<!-- AdminLTE App -->
|
||||||
|
<script src="{{ asset('assets/dist/js/adminlte.js') }}"></script>
|
||||||
|
<!-- AdminLTE for demo purposes -->
|
||||||
|
{{-- <script src="{{ asset('js/demo.js') }}"></script>
|
||||||
|
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
|
||||||
|
<script src="{{ asset('js/pages/dashboard.js') }}"></script> --}}
|
||||||
|
<!-- jQuery Script fadeIn fadeOut for the dropdown -->
|
||||||
|
<script src="{{ asset('assets/plugins/datatables/jquery.dataTables.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-responsive/js/dataTables.responsive.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-responsive/js/responsive.bootstrap4.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-buttons/js/dataTables.buttons.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-buttons/js/buttons.bootstrap4.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/jszip/jszip.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/pdfmake/pdfmake.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/pdfmake/vfs_fonts.js') }}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-buttons/js/buttons.html5.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-buttons/js/buttons.print.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/plugins/datatables-buttons/js/buttons.colVis.min.js') }}"></script>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -1220,6 +1220,7 @@ class="btn btn-info">Baixar Template</a>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
|
<th>Numero Ispt</th>
|
||||||
<th>Tag</th>
|
<th>Tag</th>
|
||||||
<th>Fabrica</th>
|
<th>Fabrica</th>
|
||||||
<th>Tipo</th>
|
<th>Tipo</th>
|
||||||
|
|
@ -1441,6 +1442,10 @@ class="btn btn-primary float-right">Seguinte</a>
|
||||||
data: 'equipment_id',
|
data: 'equipment_id',
|
||||||
name: 'equipment_id'
|
name: 'equipment_id'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
data: 'ispt_number',
|
||||||
|
name: 'ispt_number'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
data: 'equipment_tag',
|
data: 'equipment_tag',
|
||||||
name: 'equipment_tag'
|
name: 'equipment_tag'
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
<div class="card card-primary">
|
<div class="card card-primary">
|
||||||
<div class="card-header "> <!-- Flex container with spaced between items -->
|
<div class="card-header "> <!-- Flex container with spaced between items -->
|
||||||
<h3 class="float-left">Numero ispt</h3> <!-- This item will be on the left -->
|
<h3 class="float-left"><b>Número ISPT:</b> {{ $dataEquipment->ispt_number }}</h3> <!-- This item will be on the left -->
|
||||||
<h3 class="float-right">{{ $dataEquipment->equipment_tag }}</h3> <!-- This item will be on the right -->
|
<h3 class="float-right"> <b>Tag:</b> {{ $dataEquipment->equipment_tag }}</h3> <!-- This item will be on the right -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
|
||||||
113
resources/views/userClient/dashboardClient.blade.php
Normal file
113
resources/views/userClient/dashboardClient.blade.php
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
@extends('Templates/templateClient')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<!-- Content Wrapper. Contains page content -->
|
||||||
|
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<div class="content-header">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h1 class="m-0" style="color:#09255C">Dashboard</h1>
|
||||||
|
</div><!-- /.col -->
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<ol class="breadcrumb float-sm-right">
|
||||||
|
<li class="breadcrumb-item"><a href="#"></a>Dashboard</li>
|
||||||
|
</ol>
|
||||||
|
</div><!-- /.col -->
|
||||||
|
</div><!-- /.row -->
|
||||||
|
</div><!-- /.container-fluid -->
|
||||||
|
</div>
|
||||||
|
<!-- /.content-header -->
|
||||||
|
|
||||||
|
<!-- Main content -->
|
||||||
|
<section class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
{{-- Execucao --}}
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="card card-row card-default">
|
||||||
|
<!-- Card header -->
|
||||||
|
<div class="card-header info-box bg-warning">
|
||||||
|
<span class="info-box-icon"><i class="fas fa-file-alt"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{ __('messages.dashboard.on_going.description') }}</span>
|
||||||
|
<span {{-- class="info-box-number">{{ $CompanyProject->where('order_project', 3)->count() }}</span> --}} <span class="progress-description">
|
||||||
|
{{ __('messages.dashboard.on_going.text') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
<!-- /.Card header-->
|
||||||
|
<div class="card-body">
|
||||||
|
@foreach ($allProjectsClient as $project)
|
||||||
|
@if ($project->order_project == 3)
|
||||||
|
<div class="card card-secondary card-outline">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="progress-description">{{ $project->company_project_description }}
|
||||||
|
</h5>
|
||||||
|
<div class="card-tools">
|
||||||
|
<a href="{{ route('ExecutionProject', ['ProjectId' => $project->company_projects_id]) }}"
|
||||||
|
class="btn btn-tool">
|
||||||
|
<i class="fa-solid fa-eye" style="color:rgb(62, 62, 62)"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{-- ./Execucao --}}
|
||||||
|
|
||||||
|
{{-- Concluidas --}}
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="card card-row card-success">
|
||||||
|
<!-- Card header -->
|
||||||
|
<div class="card-header info-box bg-success">
|
||||||
|
<span class="info-box-icon"><i class="fas fa-check-circle"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{ __('messages.dashboard.finished.description') }}</span>
|
||||||
|
<span {{-- class="info-box-number">{{ $CompanyProject->where('order_project', 4)->count() }}</span> --}} <span class="progress-description">
|
||||||
|
{{ __('messages.dashboard.finished.text') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
<!-- /.Card header-->
|
||||||
|
<div class="card-body">
|
||||||
|
@foreach ($allProjectsClient as $project)
|
||||||
|
@if ($project->order_project == 4)
|
||||||
|
<div class="card card-secondary card-outline">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="progress-description">{{ $project->company_project_description }}
|
||||||
|
</h5>
|
||||||
|
<div class="card-tools">
|
||||||
|
<a href="{{ route('ExecutionProject', ['ProjectId' => $project->company_projects_id]) }}"
|
||||||
|
class="btn btn-tool">
|
||||||
|
<i class="fa-solid fa-eye" style="color:rgb(62, 62, 62)"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{-- ./Concluidas --}}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
@endsection
|
||||||
6
resources/views/userClient/manageAssetsClient.blade.php
Normal file
6
resources/views/userClient/manageAssetsClient.blade.php
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
@extends('Templates/templateClient')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<!-- Content Wrapper. Contains page content -->
|
||||||
|
<h1> Teste Gestao do cliente</h1>
|
||||||
|
@endsection
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\ClientController;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
@ -28,7 +29,7 @@
|
||||||
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 () {
|
||||||
|
|
@ -91,12 +92,19 @@
|
||||||
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
|
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware(['checkUserType:testClient'])->group(function () {
|
||||||
|
Route::get('dashboardClient', [ClientController::class, 'receiveProjectsClient'])->name('dashboardClient');
|
||||||
|
Route::get('manageAssetsClient', [ClientController::class, 'receiveManageAssetsClient'])->name('manageAssetsClient');
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| 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');
|
||||||
|
|
||||||
|
|
@ -125,7 +133,6 @@
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::controller(CreateProjectController::class)
|
Route::controller(CreateProjectController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
|
|
||||||
|
|
@ -191,7 +198,6 @@
|
||||||
|
|
||||||
// Mostrar Instalação click
|
// Mostrar Instalação click
|
||||||
|
|
||||||
// Route::middleware(['checkUserType:enterWorkstation'])
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -215,4 +221,21 @@
|
||||||
|
|
||||||
Route::get('api/receivePlants/{receiveAllClients}', [ProjectoDatacontroller::class, 'receivePlants']);
|
Route::get('api/receivePlants/{receiveAllClients}', [ProjectoDatacontroller::class, 'receivePlants']);
|
||||||
|
|
||||||
Route::get('api/receiveUnitsManageAssets/{receivePlantClientRelated}',[ProjectoDatacontroller::class, 'receiveUnitsManageAssets']);
|
Route::get('api/receiveUnitsManageAssets/{receivePlantClientRelated}', [ProjectoDatacontroller::class, 'receiveUnitsManageAssets']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Rotas para o tipo de usuário 'Técnico'
|
||||||
|
Route::middleware(['auth', 'checkUserType:enterWorkstation'])->group(function () {
|
||||||
|
Route::get('enterWorkstation', function () {
|
||||||
|
return view('workstations.start');
|
||||||
|
})->name('enterWorkstation');
|
||||||
|
// Adicione outras rotas específicas para 'Técnico' aqui
|
||||||
|
});
|
||||||
|
|
||||||
|
// Rotas para o tipo de usuário 'Empresa'
|
||||||
|
Route::middleware(['auth', 'checkUserType:dashboardClient'])->group(function () {
|
||||||
|
Route::get('dashboardClient', [ClientController::class, 'receiveProjectsClient'])->name('dashboardClient');
|
||||||
|
// Adicione outras rotas específicas para 'Empresa' aqui
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user