last Update Routes

This commit is contained in:
ygbanzato 2023-10-13 09:02:16 +01:00
parent 1a0735328f
commit 476118578a
3 changed files with 121 additions and 268 deletions

View File

@ -15,36 +15,6 @@
class WorkstationsJobsController extends Controller
{
public function index()
{
return view('workstations.start');
}
public function controlEquipment()
{
// A partir deste dado consigo receber os valores do WS,TE e Equipment
$controlEquipmentWorkstationId = 33;
$receiveEquipment = Equipment::where('equipment_id', 1443)->first();
$task_todo = 1;
return view('workstations.workstations', [
'task_todo' => $task_todo,
'controlEquipmentWorkstationId' => $controlEquipmentWorkstationId,
'receiveEquipment' => $receiveEquipment
]);
}
// public function receiveAnswersEquipment(Request $request)
// {
// $receiveAnswersElementalTasks = new workstationsTaskAnswers;
// $receiveAnswersElementalTasks->control_equipment_workstation_id = $request->control_equipment_workstation_id;
// $receiveAnswersElementalTasks->answer_json =
// }
// Recebe as perguntas e respostas e deve criar um linha nova.
public function receiveAnswersEquipment(Request $request)
{
// Primeiro ele deve criar a associação entre id atual do control + perguntas e respostas

View File

@ -15,17 +15,17 @@ class CheckUserType
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next)
public function handle(Request $request, Closure $next, $routeType)
{
if (auth()->user()) {
$currentRoute = Route::currentRouteName();
$userType = auth()->user()->userType->type_user;
if ($userType == 'Super_Administrador' && $currentRoute != 'home') {
return redirect()->route('home');
} elseif ($userType == 'Técnico' && $currentRoute != 'enterWorkstation') {
return redirect()->route('enterWorkstation');
if ($routeType == 'enterWorkstation' && $userType != 'Técnico') {
return redirect()->route('home'); // ou qualquer rota padrão para redirecionar
}
if ($routeType == 'home' && $userType != 'Super_Administrador') {
return redirect()->route('enterWorkstation'); // ou qualquer rota padrão para redirecionar
}
return $next($request);

View File

@ -30,40 +30,16 @@
use App\Http\Controllers\WorkstationsJobsController;
// Esta rota so pode aceder quem tiver o link atravez do email
Route::get('formulario', function () {
return view('email/FormAdmin');
})->name('formulario');
route::get('testt', function () {
return view('test');
});
Route::get('te102', function () {
return view('workstations.TE10(2)');
});
Route::get('user-data', [PreparedProjectController::class, 'getData1'])->name('getData');
Route::get('preparedProject/{ProjectId}', [PreparedProjectController::class, 'PreparedProject'])->name('preparedProject');
Route::get('EditProjectForArticulated', [PreparedProjectController::class, 'editProjectForArticulated'])->name('EditProjectForArticulated');
Route::get('ExecutionProject/{ProjectId}', [ExecutionProjectController::class, 'receiveExecutionProject'])->name('ExecutionProject');
Route::get('/ReceiveEquipmentIdForShowModal/{EquipmentID}', [ExecutionProjectController::class, 'receiveEquipmentIdForShowModal'])->name('ReceiveEquipmentIdForShowModal ');
// Email
Route::get('/your-verification-route/{id}/{hash}', [UserController::class, 'yourVerificationMethod'])
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');
Route::get('/receiveThisShit', function () {
return redirect()->route('test');
})->name('verification.notice');
Route::get('/testExcel', function () {
return view('createProjectExcel');
})->name('testExcel');
/*
|--------------------------------------------------------------------------
@ -76,39 +52,41 @@
|
*/
/*
|--------------------------------------------------------------------------
| User_Type (Super_Administrador)
|--------------------------------------------------------------------------
|*** Routes unique access to the Super_Administrator, due to its sensitive data.
|
|
*/
// Route::middleware(['auth', 'verified', 'checksuperadmin', 'checkAdmin'])->group(function () {
// Profile page
Route::get('usersProfiles/{id}', [userController::class, 'UserProfile'])->name('usersProfiles');
// Rotas protegidas que exigem verificação de e-mail
Route::middleware(['auth'])->group(function () {
/*
|--------------------------------------------------------------------------
| User_Type (tecnico)
|--------------------------------------------------------------------------
|*** Routes unique access to the technical
*/
Route::middleware(['checkUserType:enterWorkstation'])->group(function () {
Route::post('enviar-formulario', [FormController::class, 'enviarEmail'])->name('enviar.formulario');
/*
Route::get('enterWorkstation', function () {
return view('workstations.start');
})->name('enterWorkstation');
Route::get('/getEquipmentData/{equipment_id}', [WorkstationsJobsController::class, 'getEquipmentData'])->name('getEquipmentData');
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
});
/*
|--------------------------------------------------------------------------
| User_Type (Super_Administrador)
|--------------------------------------------------------------------------
|*** Routes unique access to the Super_Administrator, Administrator
*/
Route::middleware(['checkUserType:home'])->group(function () {
Route::get('/', [ProjectoDatacontroller::class, ('HomePage')])->name('home');
/*
|--------------------------------------------------------------------------
| CRUD - users
|--------------------------------------------------------------------------
|
| Definition routes to implement the CRUD model
|
*/
/*
|--------------------------------------------------------------------------
| Create Users with Super Admin, Admin
|--------------------------------------------------------------------------
|
|The creation of records can be done by both the admin and the superAdmin,
|however the Admin will not have access to the data of the SupersAdmins only.
|
*/
Route::controller(userController::class)
Route::controller(userController::class)
->group(function () {
Route::get('users/listUsers', 'listUsers')->name('users.list');
@ -120,8 +98,15 @@
Route::post('editProfile/{id}', 'EditProfile')->name('editProfile');
});
Route::controller(CreateProjectController::class)
/*
|--------------------------------------------------------------------------
| Management of projects created
|--------------------------------------------------------------------------
|
*/
Route::controller(CreateProjectController::class)
->group(function () {
// indication of progress bar to projects that are in 'Planning'
Route::get('test1/{id}', 'showStep1')->name('test1');
Route::get('test2/{id}', 'showStep2')->name('test2');
@ -133,7 +118,6 @@
Route::get('createProject', 'createProjectForStep1')->name('createProject');
Route::post('receiveEquipmentToAssociateTasks', 'receiveEquipmentToAssociateTasks')->name('receiveEquipmentToAssociateTasks');
Route::get('finishCreatingProject/{numberProject}', 'finishCreatingProject')->name('finishCreatingProject');
Route::get('testDataTables', 'testDataTables')->name('testDataTables');
@ -151,116 +135,45 @@
Route::post('test3', 'processStep3');
Route::delete('removeEquipment/{id}', 'removePendingEquipment')->name('removeEquipment');
Route::post('CreateNewEquipmentFromPendingEquipment/{id}', 'CreateNewEquipmentFromPendingEquipment')->name('CreateNewEquipmentFromPendingEquipment');
Route::get('template1/{numberProject}', 'receiveUnitsForExcelTemplate')->name('download');
Route::post('create-equipament-project', 'createEquipamentProject')->name('createEquipamentProject');
Route::get('equipments/{id}/attributes', 'getAttributes');
/*
|--------------------------------------------------------------------------
| Template Excel
|--------------------------------------------------------------------------
*/
Route::get('template1/{numberProject}', 'receiveUnitsForExcelTemplate')->name('download');
});
Route::get('user-data', [PreparedProjectController::class, 'getData1'])->name('getData');
Route::get('preparedProject/{ProjectId}', [PreparedProjectController::class, 'PreparedProject'])->name('preparedProject');
Route::get('EditProjectForArticulated', [PreparedProjectController::class, 'editProjectForArticulated'])->name('EditProjectForArticulated');
Route::get('ExecutionProject/{ProjectId}', [ExecutionProjectController::class, 'receiveExecutionProject'])->name('ExecutionProject');
Route::get('/ReceiveEquipmentIdForShowModal/{EquipmentID}', [ExecutionProjectController::class, 'receiveEquipmentIdForShowModal'])->name('ReceiveEquipmentIdForShowModal ');
/*
|--------------------------------------------------------------------------
| Create Users with Super Admin
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('manageAssets', [ProjectoDatacontroller::class, 'ManageAssets'])->name('manageAssets');
//Gerir os Ativos gerais
Route::get('manageAssets', [ProjectoDatacontroller::class, 'ManageAssets'])->name('manageAssets');
Route::get('units/{id}', [ProjectoDatacontroller::class, 'showUnit'])->name('showUnit');
Route::get('enterWorkstation', [WorkstationsJobsController::class, 'index'])->name('enterWorkstation');
Route::get('controlEquipment', [WorkstationsJobsController::class, 'controlEquipment'])->name('controlEquipment');
Route::get('usersProfiles/{id}', [userController::class, 'UserProfile'])->name('usersProfiles');
Route::post('enviar-formulario', [FormController::class, 'enviarEmail'])->name('enviar.formulario');
Route::get('/getEquipmentData/{equipment_id}', [WorkstationsJobsController::class, 'getEquipmentData'])->name('getEquipmentData');
Route::get('/CreateUsers/{id}', [Pending_UserController::class, 'ShowFormUser'])->name('ShowPendingUser');
Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
Route::get('/CreateUsers', [Pending_UserController::class, 'ListPendingUsers'])->name('CreateUsers');
Route::post('/register', [CustomRegistrationController::class, 'store'])->name('register');
// Mostrar Instalação click
Route::post('receiveAnswersEquipment', [WorkstationsJobsController::class, 'receiveAnswersEquipment'])->name('receiveAnswersEquipment');
Route::middleware(['auth', 'checkUserType'])->group(function () {
// Rotas protegidas que exigem verificação de e-mail
Route::get('/', [ProjectoDatacontroller::class, ('HomePage')])->name('home');
// Route::middleware(['checkUserType:enterWorkstation'])
});
});
/*
|--------------------------------------------------------------------------
| CRUD -Instalation
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
// Mostrar Instalação click
Route::get('units/{id}', [ProjectoDatacontroller::class, 'showUnit'])->name('showUnit');
/*
|--------------------------------------------------------------------------
| Create Projects with Super Admin and Admin
|--------------------------------------------------------------------------
|
|Crud model for the application's projects, where both their creation and the indication of project statuses are handled.
|
*/
Route::get('/CreateUsers/{id}', [Pending_UserController::class, 'ShowFormUser'])->name('ShowPendingUser');
Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
Route::post('/register', [CustomRegistrationController::class, 'store'])->name('register');
Route::get('/CreateUsers', [Pending_UserController::class, 'ListPendingUsers'])->name('CreateUsers');
/*
|--------------------------------------------------------------------------
| Template Excel
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
/*
|--------------------------------------------------------------------------
| Create Project
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
/*
|--------------------------------------------------------------------------
| CRUD -Equipaments
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
// *** All api routes have been moved to api.php ***
Route::get('/api/receiveEquipmentsExecutionProject/{receiveNumberProject}', [ExecutionProjectController::class, 'receiveEquipmentsExecutionProject'])->name('receiveEquipmentsExecutionProject');
Route::get('/api/receiveAllEquipments', [ProjectoDatacontroller::class, 'receiveAllEquipments']);
Route::get('/api/receiveEquipmentsProject/{receiveNumberProject}', [ProjectoDatacontroller::class, 'receiveEquipmentsProject']);
@ -272,33 +185,3 @@
Route::get('/api/equipment/{id}', [CreateProjectController::class, 'showJson']);
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
Route::get('/api/ambits/{equipmentType}', [CreateProjectController::class, 'getAmbits']);
// Route::controller(CreateProjectController::class)
// ->group(function () {
// Route::post('receiveEquipmentToAssociateTasks', [CreateProjectController::class, 'receiveEquipmentToAssociateTasks'])->name('receiveEquipmentToAssociateTasks');
// Route::get('finishCreatingProject/{numberProject}', [CreateProjectController::class, 'finishCreatingProject'])->name('finishCreatingProject');
// Route::get('testDataTables', [CreateProjectController::class, 'testDataTables'])->name('testDataTables');
// Route::get('workstationsAssociationTasks', [CreateProjectController::class, 'workstationsAssociationTasks'])->name('workstationsAssociationTasks');
// Route::get('AddNomenclatureWorkstation', [CreateProjectController::class, 'AddNomenclatureWorkstation'])->name('AddNomenclatureWorkstation');
// Route::get('removeProjectEquipment', [CreateProjectController::class, 'removeProjectEquipment'])->name('removeProjectEquipment');
// Route::delete('deleteWorkstation/{name}', [CreateProjectController::class, 'deleteWorkstation'])->name('deleteWorkstation');
// Route::post('/EditEquipmentsProjects', [CreateProjectController::class, 'EditEquipmentsProjects'])->name('EditEquipmentsProjects');
// Route::get('/createProject', [CreateProjectController::class, 'createProjectForStep1'])->name('createProject');
// Route::post('/newProject1', [CreateProjectController::class, 'processStep1'])->name('processStep1');
// Route::post('/createWorkStations', [CreateProjectController::class, 'createWorkStations'])->name('createWorkStations');
// Route::get('/test1/{id}', [CreateProjectController::class, 'showStep1'])->name('test1');
// Route::get('/test2/{id}', [CreateProjectController::class, 'showStep2'])->name('test2');
// Route::get('/test3/{id}', [CreateProjectController::class, 'showStep3'])->name('test3');
// Route::post('test1', [CreateProjectController::class, 'EditprocessStep1'])->name('EditprocessStep1');
// Route::post('/test2', [CreateProjectController::class, 'processStep2'])->name('processStep2');
// Route::post('/test2CreateEquipment', [CreateProjectController::class, 'createEquipmentManual'])->name('test2CreateEquipment');
// Route::post('/test3', [CreateProjectController::class, 'processStep3']);
// Route::delete('/removeEquipment/{id}', [CreateProjectController::class, 'removePendingEquipment'])->name('removeEquipment');
// Route::post('CreateNewEquipmentFromPendingEquipment/{id}', [CreateProjectController::class, 'CreateNewEquipmentFromPendingEquipment'])->name('CreateNewEquipmentFromPendingEquipment');
// Route::get('/template1/{numberProject}', [CreateProjectController::class, 'receiveUnitsForExcelTemplate'])->name('download');
// Route::post('/create-equipament-project', [CreateProjectController::class, 'createEquipamentProject'])->name('createEquipamentProject');
// Route::get('/equipments/{id}/attributes', 'getAttributes');
// });