Compare commits
No commits in common. "Version_beta_Test_Ispt_40" and "master" have entirely different histories.
Version_be
...
master
0
.editorconfig
Executable file → Normal file
0
.editorconfig
Executable file → Normal file
78
.env
78
.env
|
|
@ -1,78 +0,0 @@
|
|||
APP_NAME="ISPT4.0"
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:ahx5/AvVGu/iHQx1mjX/EQg4m1NHLvtjzb6pFa49TlE=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_VERSION = "1.0.0"
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_PORT=3306
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_DATABASE=ispt_4.0
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=123456789
|
||||
|
||||
# Alteracoes para funcionar com o servidor, porem não funciona na firma
|
||||
DB_HOST=ispt-innovation.com
|
||||
DB_DATABASE=ispt40_backup
|
||||
DB_USERNAME=ispt40
|
||||
DB_PASSWORD=qu3ro3ntr@r
|
||||
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
|
||||
# ***For MailGiun***
|
||||
# MAIL_MAILER=mailgun
|
||||
# MAILGUN_DOMAIN=sandboxdef4c3b1ceca4a53aa14d91d69bfe8a0.mailgun.org
|
||||
# MAILGUN_SECRET=9b87b9ff449885a1b7ea856d8e4cad73-181449aa-479369f2
|
||||
# MAIL_FROM_ADDRESS=ubuntu@ispt-innovation.com
|
||||
# MAIL_FROM_NAME="Ispt-4.0"
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
# MAIL_HOST=smtp.sendgrid.net
|
||||
MAIL_HOST= mail.ispt-innovation.com
|
||||
# MAIL_PORT=587
|
||||
MAIL_PORT= 465
|
||||
# MAIL_USERNAME=apikey
|
||||
MAIL_USERNAME= ubuntu
|
||||
# MAIL_PASSWORD=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
|
||||
MAIL_PASSWORD= 6bhWUN62KYSD
|
||||
MAIL_ENCRYPTION=tls
|
||||
MAIL_FROM_ADDRESS=ubuntu@ispt-innovation.com
|
||||
MAIL_FROM_NAME="Ispt4.0"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
0
.env.example
Executable file → Normal file
0
.env.example
Executable file → Normal file
0
.gitattributes
vendored
Executable file → Normal file
0
.gitattributes
vendored
Executable file → Normal file
38
.gitignore
vendored
Executable file → Normal file
38
.gitignore
vendored
Executable file → Normal file
|
|
@ -1,19 +1,19 @@
|
|||
# /.phpunit.cache
|
||||
# /node_modules
|
||||
# /public/build
|
||||
# /public/hot
|
||||
# /public/storage
|
||||
# /storage/*.key
|
||||
# /vendor
|
||||
# .env
|
||||
# .env.backup
|
||||
# .env.production
|
||||
# .phpunit.result.cache
|
||||
# Homestead.json
|
||||
# Homestead.yaml
|
||||
# auth.json
|
||||
# npm-debug.log
|
||||
# yarn-error.log
|
||||
# /.fleet
|
||||
# /.idea
|
||||
# /.vscode
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
|
|
|
|||
18
app/Actions/Fortify/CreateNewUser.php
Executable file → Normal file
18
app/Actions/Fortify/CreateNewUser.php
Executable file → Normal file
|
|
@ -8,8 +8,6 @@
|
|||
use Illuminate\Validation\Rule;
|
||||
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
|
||||
class CreateNewUser implements CreatesNewUsers
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
|
@ -21,14 +19,22 @@ class CreateNewUser implements CreatesNewUsers
|
|||
*/
|
||||
public function create(array $input): User
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => [
|
||||
'required',
|
||||
'string',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique(User::class),
|
||||
],
|
||||
'password' => $this->passwordRules(),
|
||||
])->validate();
|
||||
|
||||
return User::create([
|
||||
'user_name' => $input['user_name'],
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
'password' => Hash::make($input['password']),
|
||||
'type_users' => $input['type_users'],
|
||||
'user_phone' => $input['user_phone'],
|
||||
'user_nif' => $input['user_nif'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
app/Actions/Fortify/PasswordValidationRules.php
Executable file → Normal file
0
app/Actions/Fortify/PasswordValidationRules.php
Executable file → Normal file
0
app/Actions/Fortify/ResetUserPassword.php
Executable file → Normal file
0
app/Actions/Fortify/ResetUserPassword.php
Executable file → Normal file
0
app/Actions/Fortify/UpdateUserPassword.php
Executable file → Normal file
0
app/Actions/Fortify/UpdateUserPassword.php
Executable file → Normal file
0
app/Actions/Fortify/UpdateUserProfileInformation.php
Executable file → Normal file
0
app/Actions/Fortify/UpdateUserProfileInformation.php
Executable file → Normal file
0
app/Console/Kernel.php
Executable file → Normal file
0
app/Console/Kernel.php
Executable file → Normal file
0
app/Exceptions/Handler.php
Executable file → Normal file
0
app/Exceptions/Handler.php
Executable file → Normal file
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Fortify\Contracts\SendPasswordResetLinkViewResponse;
|
||||
|
||||
class PasswordResetLinkController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
return view('auth.forgot-password');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
// public function create(Request $request, $token)
|
||||
// {
|
||||
// return view('auth.reset-password', ['token' => $token, 'email' => $request->email]);
|
||||
// }
|
||||
|
||||
public function reset(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'token' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|min:8|confirmed',
|
||||
]);
|
||||
|
||||
$response = Password::reset(
|
||||
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||
function ($user, $password) {
|
||||
$user->forceFill([
|
||||
'password' => bcrypt($password)
|
||||
])->save();
|
||||
|
||||
$user->setRememberToken(Str::random(60));
|
||||
}
|
||||
);
|
||||
|
||||
if ($response == Password::PASSWORD_RESET) {
|
||||
return response()->json(['message' => 'Password reset successfully.']);
|
||||
} else {
|
||||
return response()->json(['message' => 'Failed to reset the password.'], 400);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// use App\Http\Controllers\ResetPasswordController;
|
||||
|
||||
// Route::post('/reset-password', [ResetPasswordController::class, 'reset'])->name('password.update');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0
app/Http/Controllers/Controller.php
Executable file → Normal file
0
app/Http/Controllers/Controller.php
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Actions\Fortify\CreateNewUser;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\PendingUser;
|
||||
|
||||
use App\Mail\NewUserNotification;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
class CustomRegistrationController extends Controller
|
||||
{
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$user = app(CreateNewUser::class)->create($request->all());
|
||||
|
||||
$pendingUser = PendingUser::where('pending_user_email', $user->email)->first();
|
||||
if ($pendingUser) {
|
||||
$pendingUser->delete();
|
||||
|
||||
event(new Registered($user));
|
||||
// Chame sendEmailVerificationNotification para enviar o e-mail de verificação
|
||||
$user->sendEmailVerificationNotification();
|
||||
}
|
||||
|
||||
return $request->wantsJson()
|
||||
? new JsonResponse([], 201)
|
||||
: Redirect::to('/CreateUsers')->with('success', 'Utilizador criado com sucesso, aguarda confirmacao por Email!!');
|
||||
}
|
||||
|
||||
|
||||
public function yourVerificationMethod(Request $request, $id, $hash)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
if (!hash_equals((string) $hash, sha1($user->getEmailForVerification()))) {
|
||||
abort(403, 'Unauthorized action.');
|
||||
}
|
||||
|
||||
if ($user->markEmailAsVerified()) {
|
||||
event(new Verified($user));
|
||||
}
|
||||
|
||||
// Redirecione para a rota desejada após a verificação bem-sucedida
|
||||
return redirect()->route('CreateUsers')->with('message', 'E-mail verificado com sucesso!');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\CompanyProject;
|
||||
use App\Models\ConstructionWorkstation;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\EquipmentComments;
|
||||
use App\Models\EquipmentType;
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class ExecutionProjectController extends Controller
|
||||
{
|
||||
public function enterWorkstation()
|
||||
{
|
||||
return view('workstations/index');
|
||||
}
|
||||
|
||||
public function receiveExecutionProject($ProjectId)
|
||||
{
|
||||
$DatasProject = CompanyProject::find($ProjectId);
|
||||
$equipmentsTypes = EquipmentType::all();
|
||||
|
||||
// return view('projectsClients/executionProject')
|
||||
return view('projectsClients/executionProjectNew')
|
||||
->with('DatasProject', $DatasProject)
|
||||
->with('equipmentsTypes', $equipmentsTypes);
|
||||
}
|
||||
|
||||
public function receiveWorkstationExecutionProject($receiveNumberProject)
|
||||
{
|
||||
$model = ConstructionWorkstation::where('company_projects_id', $receiveNumberProject)->with('workstationsAssociationTasks');
|
||||
|
||||
return DataTables::of($model)
|
||||
->addColumn('workstations_Association_Tasks', function ($row) {
|
||||
return $row->workstationsAssociationTasks->map(function ($task) {
|
||||
return $task->elementalTask->elemental_tasks_code;
|
||||
})->implode('-');
|
||||
})
|
||||
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function receiveEquipmentIdForShowModal($EquipmentID)
|
||||
{
|
||||
// Recebe e encontra os dados do Equipamento indicada na Tabela.
|
||||
$equipment = Equipment::find($EquipmentID);
|
||||
|
||||
// Recebe todas as tarefas e devolve em um Array
|
||||
$task_codes = $equipment->orderEquipmentTasks->map(function ($task) {
|
||||
return $task->elementalTask->elemental_tasks_code;
|
||||
})->toArray();
|
||||
|
||||
$receveControlEquipment = ControlEquipmentWorkstation::where('equipment_id',$EquipmentID)->get();
|
||||
|
||||
$receiveCommentsEquipment = EquipmentComments::where('equipment_id',$EquipmentID)->get();
|
||||
|
||||
// return view('projectsClients/executionProject',['receveControlEquipment'=>$receveControlEquipment]);
|
||||
return response()->json(['task_codes' => $task_codes,'receveControlEquipment' => $receveControlEquipment, 'receiveCommentsEquipment' => $receiveCommentsEquipment]);
|
||||
}
|
||||
|
||||
// public function receiveEquipmentsExecutionProject($receiveNumberProject)
|
||||
// {
|
||||
// // Recebe os dados vindos da funcao 'data' criada na view
|
||||
// $equipment_type_id = request('equipment_type_id');
|
||||
// $ambits_id = request('ambits_id');
|
||||
|
||||
// //Recebe sempre apenas os equipamentos relacionados a obra
|
||||
// $model = Equipment::where('company_projects_id', $receiveNumberProject);
|
||||
|
||||
// // Caso 'equipment_type_id' seja '#', mostra todos os equipamentos
|
||||
// if ($equipment_type_id == '#') {
|
||||
// $model = Equipment::query()->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
// }
|
||||
// // Caso 'equipment_type_id' não seja '#', filtra os equipamentos por tipo e Âmbito (caso 'ambits_id' não seja '#')
|
||||
// else {
|
||||
// $equipment_type_id = intval($equipment_type_id);
|
||||
// $model = Equipment::where('equipments.equipment_type_id', $equipment_type_id)
|
||||
// ->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
||||
// ->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
|
||||
// if ($ambits_id != '#') {
|
||||
// $ambits_id = intval($ambits_id);
|
||||
// $model->where('equipment_association_ambits.ambits_id', $ambits_id);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return DataTables::of($model)
|
||||
// ->addColumn('equipment_type', function ($row) {
|
||||
// return $row->equipmentType->equipment_type_name;
|
||||
// })
|
||||
// ->addColumn('Ambits', function ($row) {
|
||||
// return $row->equipmentAssociationAmbit->ambitsEquipment->ambits_description;
|
||||
// })
|
||||
// ->addColumn('order_tasks', function ($row) {
|
||||
// return $row->orderEquipmentTasks->map(function ($task) {
|
||||
// return $task->elementalTask->elemental_tasks_code;
|
||||
// })->implode('-');
|
||||
// })
|
||||
// ->addColumn('current_task', function ($row) {
|
||||
// return $row->controlEquipmentWorkstation->map(function ($task) {
|
||||
// return $task->elementalTask->elemental_tasks_code;
|
||||
// })->implode('-');
|
||||
// })
|
||||
// ->toJson();
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
public function enviarEmail(Request $request)
|
||||
{
|
||||
$email = $request->input('email');
|
||||
|
||||
Mail::send('email.email', [], function ($message) use ($email) {
|
||||
$message->to($email);
|
||||
$message->subject('Formulário "Ispt4.0"');
|
||||
});
|
||||
|
||||
return back()->with('status', 'Email enviado com sucesso!');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
use App\Mail\NewUserNotification;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
use App\Models\PendingUser;
|
||||
use App\Models\User;
|
||||
use App\Models\TypeUser;
|
||||
|
||||
class Pending_UserController extends Controller
|
||||
{
|
||||
public function ListPendingUsers()
|
||||
{
|
||||
$pend_users = PendingUser::all();
|
||||
return view('email/pendingUsers', compact('pend_users'));
|
||||
}
|
||||
|
||||
public function ShowFormUser($id){
|
||||
$pend_user = PendingUser::findOrFail($id);
|
||||
$types = TypeUser::all();
|
||||
return view ('Admin.CrudUsers.createUser', compact('pend_user','types'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request){
|
||||
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'lastName' => 'required',
|
||||
'pending_email' => 'required|email|unique:pending_users,pending_user_email|unique:users,email',
|
||||
'pending_phone' => 'required',
|
||||
'pending_nif' => 'required',
|
||||
'pending_password' => 'required|min:8|confirmed',
|
||||
]);
|
||||
|
||||
$joinName = $request->get('name') . ' ' . $request->get('lastName');
|
||||
|
||||
// $pendingUser = new PendingUser([
|
||||
// 'pending_user_name' => $joinName,
|
||||
// 'pending_user_email' => $request->get('pending_email'),
|
||||
// 'pending_user_phone' => $request->get('pending_phone'),
|
||||
// 'pending_user_nif' => $request->get('pending_nif'),
|
||||
// 'pending_user_password' => Hash::make($request->get('pending_password')),
|
||||
// ]);
|
||||
|
||||
$pendingUser = new PendingUser();
|
||||
$pendingUser->pending_user_name = $joinName;
|
||||
$pendingUser->pending_user_email = $request->get('pending_email');
|
||||
$pendingUser->pending_user_phone = $request->get('pending_phone');
|
||||
$pendingUser->pending_user_nif = $request->get('pending_nif');
|
||||
$pendingUser->pending_user_password = Hash::make($request->get('pending_password'));
|
||||
|
||||
$pendingUser->save();
|
||||
|
||||
// Enviar email de notificação para todos os Super_Administrador
|
||||
$superAdmins = User::where('type_users', 'Super_Administrador')->get();
|
||||
$newUserNotification = new NewUserNotification();
|
||||
|
||||
foreach ($superAdmins as $superAdmin) {
|
||||
Mail::to($superAdmin->email)->send($newUserNotification);
|
||||
}
|
||||
|
||||
return redirect('/formulario')->with('success', 'O seu registro foi enviado e aguarda aprovação.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
|
||||
use App\Models\CompanyProject;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\EquipmentType;
|
||||
use App\Models\Unit;
|
||||
use App\Models\AmbitsEquipment;
|
||||
|
||||
|
||||
class PreparedProjectController extends Controller
|
||||
{
|
||||
public function PreparedProject($ProjectId)
|
||||
{
|
||||
|
||||
$numberProject = CompanyProject::find($ProjectId);
|
||||
|
||||
$equipmentsProjects = Equipment::all()->where('company_projects_id', $ProjectId);
|
||||
$equipmentsTypes = EquipmentType::all();
|
||||
|
||||
//Retorna todas as Fabricas Unit, com base na Instalação
|
||||
$checkUnits = DB::table('units')
|
||||
->join('plants', 'units.plant_id', '=', 'plants.plant_id')
|
||||
->join('company_projects', 'plants.plant_id', '=', 'company_projects.plant_id')
|
||||
->select('units.*')
|
||||
->where('company_projects.company_projects_id', '=', $numberProject->company_projects_id)
|
||||
->get();
|
||||
|
||||
return view('projectsClients/preparedProject')
|
||||
// ->with('equipmentsProjects', $equipmentsProjects)
|
||||
->with('equipmentsTypes', $equipmentsTypes)
|
||||
->with('units', $checkUnits)
|
||||
->with('numberProject', $numberProject)
|
||||
->with('equipmentsProjects', $equipmentsProjects);
|
||||
}
|
||||
|
||||
public function getAmbits($equipmentType)
|
||||
{
|
||||
$ambits = DB::table('ambits_equipments')
|
||||
->select('ambits_equipments.*')
|
||||
->where('ambits_equipments.equipment_type_id', $equipmentType)
|
||||
->get();
|
||||
return response()->json($ambits);
|
||||
}
|
||||
|
||||
public function editProjectForArticulated(Request $request)
|
||||
{
|
||||
|
||||
$numberProject = CompanyProject::find($request->ProjectId);
|
||||
|
||||
$numberProject->order_project = 1;
|
||||
$numberProject->save();
|
||||
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
public function getData1()
|
||||
{
|
||||
|
||||
$equipment_type_id = request('equipment_type_id');
|
||||
$unit_id = request('unit_id');
|
||||
$ambits_id = request('ambits_id');
|
||||
|
||||
// Equipment::all()->where('company_projects_id', $ProjectId);
|
||||
|
||||
// Caso 'equipment_type_id' seja '#', mostra todos os equipamentos
|
||||
if ($equipment_type_id == '#') {
|
||||
$model = Equipment::query()->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
}
|
||||
// Caso 'equipment_type_id' não seja '#', filtra os equipamentos por tipo e Âmbito (caso 'ambits_id' não seja '#')
|
||||
else {
|
||||
$equipment_type_id = intval($equipment_type_id);
|
||||
$model = Equipment::where('equipments.equipment_type_id', $equipment_type_id)
|
||||
->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
||||
->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
|
||||
if ($ambits_id != '#') {
|
||||
$ambits_id = intval($ambits_id);
|
||||
$model->where('equipment_association_ambits.ambits_id', $ambits_id);
|
||||
}
|
||||
}
|
||||
if(request()->has('inspec') && request('inspec') != '#') {
|
||||
$inspectionFilter = request('inspec') === 'Sim';
|
||||
$model->whereHas('orderEquipmentTasks', function ($query) use ($inspectionFilter) {
|
||||
$query->where('inspection', $inspectionFilter ? 'Sim' : 'Nao');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Aplica o filtro de 'unit_id', se aplicável
|
||||
if ($unit_id != '#') {
|
||||
$unit_id = intval($unit_id);
|
||||
$model->where('equipments.unit_id', $unit_id);
|
||||
}
|
||||
|
||||
// Gera a tabela de dados
|
||||
return DataTables::of($model)
|
||||
->addColumn('equipment_type', function ($row) {
|
||||
return $row->equipmentType->equipment_type_name;
|
||||
})
|
||||
->addColumn('Unit', function ($row) {
|
||||
return $row->unit->unit_name;
|
||||
})
|
||||
->addColumn('Ambits', function ($row) {
|
||||
return $row->equipmentAssociationAmbit->ambitsEquipment->ambits_description;
|
||||
})
|
||||
->addColumn('Inspec', function ($row) {
|
||||
return $row->hasInspectionYes() ? 'Sim' : 'Nao';
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\AmbitsEquipment;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
use App\Models\Equipment;
|
||||
use App\Models\Plant;
|
||||
use App\Models\CompanyProject;
|
||||
use App\Models\User;
|
||||
|
||||
|
||||
use App\Models\ConstructionWorkstation;
|
||||
use App\Models\EquipmentType;
|
||||
use Mockery\Undefined;
|
||||
|
||||
class ProjectoDatacontroller extends Controller
|
||||
{
|
||||
public function receivePlants($clientId)
|
||||
{
|
||||
if ($clientId == 'all') {
|
||||
$allPlants = Plant::all();
|
||||
return response()->json($allPlants);
|
||||
}
|
||||
dd($clientId);
|
||||
}
|
||||
|
||||
|
||||
public function getEquipmentDetails($receiveListEquipmentId)
|
||||
{
|
||||
$ids = explode(',', $receiveListEquipmentId);
|
||||
|
||||
$equipments = Equipment::whereIn('equipment_id', $ids)->get();
|
||||
|
||||
// Pegar os unique "equipment_type_id"s
|
||||
$equipmentTypeIds = $equipments->pluck('equipment_type_id')->unique();
|
||||
|
||||
// Obter todos os "AmbitsEquipment" para esses "equipment_type_id"s
|
||||
$ambitsEquipments = AmbitsEquipment::whereIn('equipment_type_id', $equipmentTypeIds)->get();
|
||||
|
||||
// Mapear os "AmbitsEquipment" de volta aos equipamentos correspondentes
|
||||
foreach ($equipments as $equipment) {
|
||||
$equipment->ambits = $ambitsEquipments->where('equipment_type_id', $equipment->equipment_type_id);
|
||||
}
|
||||
return response()->json($equipments);
|
||||
}
|
||||
|
||||
|
||||
public function receiveAllInstallationEquipment($receiveNumberProject)
|
||||
{
|
||||
|
||||
$receveProject = CompanyProject::find($receiveNumberProject);
|
||||
$receveEquipments = Equipment::whereHas('unit.plant', function ($query) use ($receveProject) {
|
||||
$query->where('plants.plant_id', '=', $receveProject->plant_id);
|
||||
})
|
||||
->where('company_projects_id', null) // Adiciona a condição aqui
|
||||
->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment'])
|
||||
->get();
|
||||
|
||||
|
||||
return DataTables::of($receveEquipments)
|
||||
->addColumn('equipment_type', function ($row) {
|
||||
return $row->equipmentType->equipment_type_name;
|
||||
})
|
||||
->addColumn('unit', function ($row) {
|
||||
return $row->unit->unit_name;
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
|
||||
|
||||
public function HomePage()
|
||||
{
|
||||
$CompanyProject = CompanyProject::all();
|
||||
|
||||
return view('Admin/index')
|
||||
// return view('codePronto');
|
||||
->with("CompanyProject", $CompanyProject);
|
||||
}
|
||||
|
||||
public function ManageAssets()
|
||||
{
|
||||
|
||||
$units = DB::table('plants')
|
||||
->join('units', 'plants.plant_id', '=', 'units.plant_id')
|
||||
->join('users', 'plants.user_id', '=', 'users.user_id')
|
||||
->select('plants.*', 'units.unit_name', 'users.user_name as user_name')
|
||||
->get();
|
||||
$equipments = Equipment::all();
|
||||
// $equipaments = DB::table('equipaments')
|
||||
// ->join('factories','equipaments.factory_id', '=', 'factories.factories_id')
|
||||
// ->join('equipament_types', 'equipaments.equipament_type_id', '=' , 'equipament_types.equipament_type_id')
|
||||
// ->select('equipaments.*', 'factories.factories_name', 'equipament_types.equipment_type_name')
|
||||
// ->get();
|
||||
|
||||
$allEquipmentType = EquipmentType::all();
|
||||
$allClients = User::where('type_users', 3)->get();
|
||||
|
||||
return view('Admin/DataManagement/manageassets', compact('units', 'equipments', 'allEquipmentType', 'allClients'));
|
||||
}
|
||||
|
||||
public function showUnit($id)
|
||||
{
|
||||
|
||||
$equipaments = Equipment::where('equipment_id', $id)->firstOrFail();
|
||||
return view('Admin/DataManagement/showEquipament', compact('equipaments'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function receiveEquipmentsProject($receiveNumberProject)
|
||||
{
|
||||
// Recebe os dados vindos da funcao 'data' criada na view
|
||||
$equipment_type_id = request('equipment_type_id');
|
||||
|
||||
$ambits_id = request('ambits_id');
|
||||
|
||||
// Caso 'equipment_type_id' seja '#', mostra todos os equipamentos
|
||||
if ($equipment_type_id == '#') {
|
||||
$model = Equipment::query()
|
||||
->where('company_projects_id', $receiveNumberProject)
|
||||
->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
}
|
||||
// Caso 'equipment_type_id' não seja '#', filtra os equipamentos por tipo e Âmbito (caso 'ambits_id' não seja '#')
|
||||
else {
|
||||
$equipment_type_id = intval($equipment_type_id);
|
||||
$model = Equipment::where('equipments.equipment_type_id', $equipment_type_id)
|
||||
->where('company_projects_id', $receiveNumberProject)
|
||||
->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
||||
->with(['equipmentType', 'unit', 'equipmentAssociationAmbit.ambitsEquipment']);
|
||||
|
||||
if ($ambits_id != '#') {
|
||||
$ambits_id = intval($ambits_id);
|
||||
$model->where('equipment_association_ambits.ambits_id', $ambits_id)
|
||||
->where('company_projects_id', $receiveNumberProject);
|
||||
}
|
||||
}
|
||||
return DataTables::of($model)
|
||||
->addColumn('equipment_type', function ($row) {
|
||||
return $row->equipmentType->equipment_type_name;
|
||||
})
|
||||
->addColumn('Unit', function ($row) {
|
||||
return $row->unit->unit_name;
|
||||
})
|
||||
->addColumn('Ambits', function ($row) {
|
||||
return $row->equipmentAssociationAmbit->ambitsEquipment->ambits_description;
|
||||
})
|
||||
// Este 2 em especial, tem a condicao se a tarefa elementar estiver a null ele deve pegar a valor do campo ao lado ou seja da further task.
|
||||
->addColumn('order_tasks', function ($row) {
|
||||
return $row->orderEquipmentTasks->sortBy('execution_order')->map(function ($task) {
|
||||
// Se elementalTask não for null, retorna elemental_tasks_code
|
||||
if (!is_null($task->elementalTask)) {
|
||||
return $task->elementalTask->elemental_tasks_code;
|
||||
}
|
||||
// Caso contrário, retorna further_tasks_name
|
||||
return $task->furtherTasks->further_tasks_name;
|
||||
})->implode(' ||');
|
||||
})
|
||||
->addColumn('current_task', function ($row) {
|
||||
return $row->controlEquipmentWorkstation->map(function ($task) {
|
||||
// Se elementalTask não for null, retorna elemental_tasks_code
|
||||
if (!is_null($task->elementalTask)) {
|
||||
return $task->elementalTask->elemental_tasks_code;
|
||||
}
|
||||
// Caso contrário, retorna further_tasks_name
|
||||
return $task->furtherTasks->further_tasks_name;
|
||||
})->implode(' ||');
|
||||
})
|
||||
|
||||
|
||||
|
||||
->addColumn('Inspec', function ($row) {
|
||||
return $row->hasInspectionYes() ? 'Sim' : 'Nao';
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function receiveAllEquipments()
|
||||
{
|
||||
$model = Equipment::all();
|
||||
// ->with(['equipmentType', 'unit']);
|
||||
|
||||
|
||||
return DataTables::of($model)
|
||||
// ->addColumn('equipment_type', function ($row) {
|
||||
// return $row->equipmentType->equipment_type_name;
|
||||
// })
|
||||
// ->addColumn('Unit', function ($row) {
|
||||
// return $row->unit->unit_name;
|
||||
// })
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function receiveWorkstationProject($receiveNumberProject)
|
||||
{
|
||||
$model = ConstructionWorkstation::where('company_projects_id', $receiveNumberProject)->with('workstationsAssociationTasks');
|
||||
|
||||
// Se ao varificar na tabela 'workstationsAssociationTasks' a coluna elementalTask estiver a null, significa que e uma further task, sendo assim ele busca o campo ao lado.
|
||||
return DataTables::of($model)
|
||||
->addColumn('workstations_Association_Tasks', function ($row) {
|
||||
return $row->workstationsAssociationTasks->map(function ($task) {
|
||||
// Se elementalTask não for null, retorna elemental_tasks_code
|
||||
if (!is_null($task->elementalTask)) {
|
||||
return $task->elementalTask->elemental_tasks_code;
|
||||
}
|
||||
// Caso contrário, retorna further_tasks_name
|
||||
return $task->furtherTask->further_tasks_name;
|
||||
})->implode(' ||');
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,301 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ConstructionWorkstation;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\ElementalTasks;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\workstationsTaskAnswers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class WorkstationsJobsController extends Controller
|
||||
{
|
||||
public function receiveAnswersEquipment(Request $request)
|
||||
{
|
||||
|
||||
// Primeiro ele deve criar a associação entre id atual do control + perguntas e respostas
|
||||
$receiveAnswersElementalTasks = new workstationsTaskAnswers;
|
||||
$receiveAnswersElementalTasks->control_equipment_workstation_id = $request->control_equipment_workstationid;
|
||||
|
||||
// Inicializando o array que vai armazenar os objetos JSON
|
||||
$answersArray = [];
|
||||
|
||||
foreach ($request->all() as $key => $value) {
|
||||
// Ignorando a chave control_equipment_workstation_id
|
||||
if ($key !== 'control_equipment_workstation_id') {
|
||||
// Verificando se $key contém '-'
|
||||
if (strpos($key, '-') === false) {
|
||||
// Se não contiver, pular esta iteração
|
||||
continue;
|
||||
}
|
||||
// Dividindo a chave em duas partes: question e type
|
||||
list($question, $type) = explode('-', $key);
|
||||
|
||||
// Adicionando um novo objeto JSON ao array
|
||||
$answersArray[] = [
|
||||
'type' => $type,
|
||||
'value' => $value,
|
||||
'question' => $question
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Convertendo o array em uma string JSON
|
||||
$jsonString = json_encode($answersArray);
|
||||
|
||||
// Armazenando a string JSON no banco de dados
|
||||
$receiveAnswersElementalTasks->answer_json = $jsonString;
|
||||
// $receiveAnswersElementalTasks->save();
|
||||
|
||||
// update departure_date value
|
||||
$receiveDataControlWs = ControlEquipmentWorkstation::find($request->control_equipment_workstationid);
|
||||
$receiveDataControlWs->departure_date = now();
|
||||
$receiveDataControlWs->save();
|
||||
|
||||
//FINALIZOU A TAREFA ANTERIOR COM DEPARTURE
|
||||
|
||||
//Busca o Email
|
||||
$userEmail = Auth::user()->email;
|
||||
|
||||
//Busca o id Anterior
|
||||
$control_ew_id = $request->control_equipment_workstationid;
|
||||
|
||||
// Busca a Ws com base no id recebido da tabela Control.
|
||||
$recebeDataControlId = ControlEquipmentWorkstation::find($request->control_equipment_workstationid);
|
||||
|
||||
//Chama o procedimento
|
||||
$controlTasks = DB::select('CALL ManageNextTask(?, ?)', [$userEmail, $control_ew_id]);
|
||||
|
||||
//Saving the values to a variable
|
||||
if (count($controlTasks) > 0) {
|
||||
$current_workstation = $controlTasks[0]->id_workstations;
|
||||
$next_workstation = $controlTasks[0]->next_workstation;
|
||||
$next_todo = $controlTasks[0]->next_todo;
|
||||
} else {
|
||||
//It should always exist, but you never know :)
|
||||
$next_todo = null;
|
||||
}
|
||||
//RECEBE OS VALORES DA PROXIMA WS E PROXIMA TAREFA
|
||||
|
||||
// Recebe os dados de cada Tarefa Elementar.
|
||||
$receiveDataElementalTask = ElementalTasks::find($recebeDataControlId->elemental_tasks_id);
|
||||
$receiveDataEquipment = Equipment::find($recebeDataControlId->equipment_id);
|
||||
|
||||
if ($next_todo < 25) {
|
||||
$elemental_tasks_id = $next_todo;
|
||||
$further_tasks_id = null;
|
||||
} else {
|
||||
$elemental_tasks_id = null;
|
||||
$further_tasks_id = $next_todo;
|
||||
}
|
||||
|
||||
// Para criar a divisao do equipamento em entre compo e Obturador
|
||||
if ($receiveDataControlWs->elemental_tasks_id == 5 || $receiveDataControlWs->elemental_tasks_id == 6) {
|
||||
$nextEquipmentTask1 = DB::select("
|
||||
INSERT INTO control_equipment_workstation
|
||||
(equipment_id, id_workstations, elemental_tasks_id, further_tasks_id, equipment_comments_id, entry_date, departure_date)
|
||||
VALUES
|
||||
(:equipment_id,NULL,8,:further_tasks_id,NULL,NULL,NULL)
|
||||
", [
|
||||
'equipment_id' => $receiveDataEquipment->equipment_id,
|
||||
'further_tasks_id' => $further_tasks_id
|
||||
]);
|
||||
|
||||
$nextEquipmentTask2 = DB::select("
|
||||
INSERT INTO control_equipment_workstation
|
||||
(equipment_id, id_workstations, elemental_tasks_id, further_tasks_id, equipment_comments_id, entry_date, departure_date)
|
||||
VALUES
|
||||
(:equipment_id,NULL,9,:further_tasks_id,NULL,NULL,NULL)
|
||||
", [
|
||||
'equipment_id' => $receiveDataEquipment->equipment_id,
|
||||
'further_tasks_id' => $further_tasks_id
|
||||
]);
|
||||
// Equipamento separado em 2 corpo/ Obturador
|
||||
return redirect()->route('enterWorkstation');
|
||||
}
|
||||
|
||||
// Quando concluir as tarefas 8 e 9 ele apenas deve
|
||||
else if ($receiveDataControlWs->elemental_tasks_id == 8 || $receiveDataControlWs->elemental_tasks_id == 9) {
|
||||
// Verifique se já existem registros na tabela control_equipment_workstation
|
||||
$existingRecords = DB::table('control_equipment_workstation')
|
||||
->where('equipment_id', $receiveDataControlWs->equipment_id)
|
||||
->whereIn('elemental_tasks_id', [8, 9])
|
||||
->whereNotNull('departure_date')
|
||||
->get();
|
||||
|
||||
// Verifique se há pelo menos dois registros que atendem às condições
|
||||
if ($existingRecords->count() >= 2) {
|
||||
// Crie um novo registro com elemental_tasks_id igual a 10
|
||||
$nextEquipmentTask3 = DB::table('control_equipment_workstation')->insertGetId([
|
||||
'equipment_id' => $receiveDataControlWs->equipment_id,
|
||||
'id_workstations' => NULL,
|
||||
'elemental_tasks_id' => 10,
|
||||
'further_tasks_id' => $further_tasks_id,
|
||||
'equipment_comments_id' => NULL,
|
||||
'entry_date' => NULL,
|
||||
'departure_date' => NULL,
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('enterWorkstation');
|
||||
}
|
||||
|
||||
//Se a proxima WS for igual a atual deve criar dados para a ws
|
||||
else if ($recebeDataControlId->id_workstations == $next_workstation) {
|
||||
$nextEquipmentTask = DB::select("
|
||||
INSERT INTO control_equipment_workstation
|
||||
(equipment_id, id_workstations, elemental_tasks_id, further_tasks_id, equipment_comments_id, entry_date, departure_date)
|
||||
VALUES
|
||||
(:equipment_id,:next_workstation,:elemental_tasks_id,:further_tasks_id,NULL,CURRENT_TIMESTAMP,NULL)
|
||||
", [
|
||||
'equipment_id' => $receiveDataEquipment->equipment_id,
|
||||
'next_workstation' => $next_workstation,
|
||||
'elemental_tasks_id' => $elemental_tasks_id,
|
||||
'further_tasks_id' => $further_tasks_id
|
||||
]);
|
||||
|
||||
$lastInsertedId = DB::getPdo()->lastInsertId();
|
||||
|
||||
return view('workstations.workstations', [
|
||||
'receiveDataElementalTask' => $receiveDataElementalTask,
|
||||
'receiveDataEquipment' => $receiveDataEquipment,
|
||||
'control_ew_id' => $lastInsertedId,
|
||||
'task_todo' => $next_todo
|
||||
]);
|
||||
// Se verificar que a proxima tarefa e Null ele deve apenas voltar ao start
|
||||
} else if ($next_todo == null) {
|
||||
|
||||
return redirect()->route('enterWorkstation');
|
||||
} else {
|
||||
$nextEquipmentTask = DB::select("
|
||||
INSERT INTO control_equipment_workstation
|
||||
(equipment_id, id_workstations, elemental_tasks_id, further_tasks_id, equipment_comments_id, entry_date, departure_date)
|
||||
VALUES
|
||||
(:equipment_id,NULL,:elemental_tasks_id,:further_tasks_id,NULL,NULL,NULL)
|
||||
", [
|
||||
'equipment_id' => $receiveDataEquipment->equipment_id,
|
||||
'elemental_tasks_id' => $elemental_tasks_id,
|
||||
'further_tasks_id' => $further_tasks_id
|
||||
]);
|
||||
|
||||
return redirect()->route('enterWorkstation');
|
||||
}
|
||||
}
|
||||
|
||||
// Ao selecionar o equipamento para se inicializar a tarefa deve mostrar os dados relacionados.
|
||||
public function getEquipmentData($equipment_id)
|
||||
{ //vai receber o email atual, no caso o da workstation que se encontra
|
||||
$userEmail = Auth::user();
|
||||
|
||||
|
||||
// Busca os dados da Ws com base no Login
|
||||
$findDataWs = ConstructionWorkstation::where('name_workstations', $userEmail->user_name)->first();
|
||||
|
||||
// Recebe os dados do Equipamento
|
||||
$receiveDataEquipment = Equipment::where('equipment_id', $equipment_id)->first();
|
||||
|
||||
// Busca as tarefas do Equipamento a serem feitas
|
||||
$equipmentTasks = DB::table('users as u')
|
||||
->join('construction_workstations as cw', 'u.user_name', '=', 'cw.name_workstations')
|
||||
->join('workstations_association_tasks as wat', 'cw.id_workstations', '=', 'wat.id_workstations')
|
||||
->join('equipments as e', 'wat.company_projects_id', '=', 'e.company_projects_id')
|
||||
->join('ordered_equipment_tasks as oet', 'e.equipment_id', '=', 'oet.equipment_id')
|
||||
->where('u.email', $userEmail->email)
|
||||
->select('e.equipment_id', 'e.equipment_tag', DB::raw('GROUP_CONCAT(DISTINCT COALESCE(oet.elemental_tasks_id, oet.further_tasks_id) ORDER BY oet.execution_order) AS equipment_all_tasks'))
|
||||
->groupBy('e.equipment_id', 'e.equipment_tag')
|
||||
->orderBy('e.equipment_id', 'ASC')
|
||||
->get();
|
||||
|
||||
//Busca as tarefas que podem ser feitas pela WS Atual a partir do Email
|
||||
$userTasks = DB::table('users as u')
|
||||
->join('construction_workstations as cw', 'u.user_name', '=', 'cw.name_workstations')
|
||||
->join('workstations_association_tasks as wat', 'cw.id_workstations', '=', 'wat.id_workstations')
|
||||
->where('u.email', $userEmail->email)
|
||||
->select('cw.id_workstations', 'cw.name_workstations', DB::raw('GROUP_CONCAT(COALESCE(wat.elemental_tasks_id, wat.further_tasks_id)) AS all_tasks'))
|
||||
->groupBy('cw.id_workstations', 'cw.name_workstations')
|
||||
->get();
|
||||
|
||||
// Convertendo as tarefas do usuário em um array
|
||||
$tasksArray = explode(',', $userTasks->pluck('all_tasks')->first());
|
||||
|
||||
$controlEquipmentWorkstation = ControlEquipmentWorkstation::where('equipment_id', $receiveDataEquipment->equipment_id)
|
||||
->whereIn('elemental_tasks_id', $tasksArray)
|
||||
->whereNull('id_workstations')
|
||||
->whereNull('entry_date')
|
||||
->whereNull('departure_date')
|
||||
->first();
|
||||
|
||||
// Se encontrar um dado que satisfaca as verificacoes acima deve implementar a tarefa para esta WS.
|
||||
if ($controlEquipmentWorkstation) {
|
||||
|
||||
$controlEquipmentWorkstation->id_workstations = $findDataWs->id_workstations;
|
||||
$controlEquipmentWorkstation->entry_date = now();
|
||||
$controlEquipmentWorkstation->save();
|
||||
|
||||
$receiveDataElementalTask = ElementalTasks::find($controlEquipmentWorkstation->elemental_tasks_id);
|
||||
|
||||
//Returning the values to a view "values"
|
||||
return view('workstations.workstations', [
|
||||
'receiveDataElementalTask' => $receiveDataElementalTask,
|
||||
'receiveDataEquipment' => $receiveDataEquipment,
|
||||
'control_ew_id' => $controlEquipmentWorkstation->control_equipment_workstation_id,
|
||||
'task_todo' => $controlEquipmentWorkstation->elemental_tasks_id
|
||||
]);
|
||||
} else
|
||||
|
||||
//cria a nova linha
|
||||
$equipmentData = DB::select('CALL ManageEquipmentTasks(?, ?)', [$userEmail->email, $equipment_id]);
|
||||
|
||||
// //Saving the values to a variable
|
||||
if (count($equipmentData) > 0) {
|
||||
$control_ew_id = $equipmentData[0]->control_ew_id;
|
||||
$task_todo = $equipmentData[0]->task_todo;
|
||||
} else {
|
||||
//It should always exist, but you never know :)
|
||||
$control_ew_id = null;
|
||||
$task_todo = null;
|
||||
}
|
||||
|
||||
// Recebe os dados de cada Tarefa Elementar.
|
||||
|
||||
$recebeDataControlId = ControlEquipmentWorkstation::find($control_ew_id);
|
||||
|
||||
// Quando se da Refreash a pagina me devolve um erro de laravel pois o $recebeDataControlId e Null , pois claramente ja foi feita seus scripts e apos o refreash nao e feito denovo, sendo assim e melhor perder os dados criados e fazer novamente do que ter erros de lAravel :D
|
||||
if ($recebeDataControlId == NULL) {
|
||||
|
||||
$deleteDataControlWhereRefreashPage = ControlEquipmentWorkstation::where('id_workstations', $findDataWs->id_workstations)
|
||||
->where('equipment_id', $receiveDataEquipment->equipment_id)
|
||||
->whereNotNull('entry_date')
|
||||
->whereNull('departure_date')
|
||||
->first();
|
||||
// dd($deleteDataControlWhereRefreashPage);
|
||||
|
||||
if ($deleteDataControlWhereRefreashPage) {
|
||||
$deleteDataControlWhereRefreashPage->id_workstations = null;
|
||||
$deleteDataControlWhereRefreashPage->entry_date = null;
|
||||
$deleteDataControlWhereRefreashPage->departure_date = null;
|
||||
$deleteDataControlWhereRefreashPage->save();
|
||||
}
|
||||
return redirect()->route('enterWorkstation');
|
||||
|
||||
} else
|
||||
|
||||
$receiveDataElementalTask = ElementalTasks::find($recebeDataControlId->elemental_tasks_id);
|
||||
|
||||
|
||||
//Deve recupar os dados da tarefa Atual quando receber o control_id
|
||||
|
||||
//Returning the values to a view "values"
|
||||
return view('workstations.workstations', [
|
||||
'receiveDataElementalTask' => $receiveDataElementalTask,
|
||||
'receiveDataEquipment' => $receiveDataEquipment,
|
||||
'control_ew_id' => $control_ew_id,
|
||||
'task_todo' => $task_todo
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\TypeUser;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;
|
||||
use Laravel\Fortify\Contracts\LogoutResponse as LogoutResponseContract;
|
||||
use Laravel\Fortify\Fortify;
|
||||
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController as FortifyAuthenticatedSessionController;
|
||||
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class userController extends Controller
|
||||
{
|
||||
public function EditProfile(Request $request)
|
||||
{
|
||||
// dd($request);
|
||||
$messages = [
|
||||
'user_logo.max' => 'O tamanho da imagem não deve ser maior que 70KB.',
|
||||
];
|
||||
|
||||
$request->validate([
|
||||
'user_logo' => 'image|mimes:jpeg,png,jpg,gif,svg|max:70',
|
||||
'fullName' => 'required',
|
||||
'email' => 'required|email|unique:users,email,' . $request->userID . ',user_id',
|
||||
'phone' => 'required',
|
||||
'nif' => 'required',
|
||||
], $messages);
|
||||
|
||||
$user = User::find($request->userID);
|
||||
|
||||
if ($request->hasFile('user_logo')) {
|
||||
$imageName = time() . '.' . $request->user_logo->extension();
|
||||
|
||||
// Verifica se o usuário já tem uma imagem e se é diferente da nova imagem
|
||||
if ($user->user_logo && $user->user_logo != $imageName) {
|
||||
// Constrói o caminho completo para o arquivo de imagem existente
|
||||
$existingImagePath = public_path('user_logos/' . $user->user_logo);
|
||||
|
||||
// Verifica se o arquivo de imagem existente realmente existe no sistema de arquivos
|
||||
if (File::exists($existingImagePath)) {
|
||||
// Exclui o arquivo de imagem existente
|
||||
File::delete($existingImagePath);
|
||||
}
|
||||
}
|
||||
|
||||
// Move o novo arquivo de imagem para o diretório
|
||||
$request->user_logo->move(public_path('user_logos'), $imageName);
|
||||
|
||||
// Atualiza o campo user_logo do usuário com o nome do novo arquivo de imagem
|
||||
$user->user_logo = $imageName;
|
||||
}
|
||||
|
||||
$user->user_name = $request->fullName;
|
||||
$user->email = $request->email;
|
||||
$user->user_phone = $request->phone;
|
||||
$user->user_nif = $request->nif;
|
||||
$user->save();
|
||||
|
||||
return back()->with('success', "Perfil actualizado com sucesso!");
|
||||
}
|
||||
|
||||
|
||||
public function UserProfile($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
return view('Admin.profile', compact('user'));
|
||||
}
|
||||
|
||||
public function yourVerificationMethod(Request $request, $id, $hash)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
if (!hash_equals((string) $hash, sha1($user->getEmailForVerification()))) {
|
||||
abort(403, 'Unauthorized action.');
|
||||
}
|
||||
|
||||
if ($user->markEmailAsVerified()) {
|
||||
event(new Verified($user));
|
||||
}
|
||||
|
||||
// Redirecione para a rota desejada após a verificação bem-sucedida
|
||||
return redirect()->route('CreateUsers')->with('message', 'E-mail verificado com sucesso!');
|
||||
}
|
||||
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
Fortify::username() => 'required|string',
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if ($user && Hash::check($request->password, $user->password)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function authenticateAndRedirect(Request $request)
|
||||
{
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if ($user && Hash::check($request->password, $user->password)) {
|
||||
Auth::login($user);
|
||||
|
||||
return redirect()->route('CreateUsers');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function listCompanies()
|
||||
{
|
||||
$users = User::with('userType')->where('type_users', '=', 3)->get();
|
||||
|
||||
return view('Admin.CrudUsers.listCompany', compact('users'));
|
||||
}
|
||||
|
||||
//Busca Todos os Utilizador Exeto as 'Empresas'
|
||||
public function listUsers()
|
||||
{
|
||||
$users = User::with('userType')->where('type_users', '<>', 3)->get();
|
||||
|
||||
return view('Admin.CrudUsers.listUsers', compact('users'));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
return view('Admin.CrudUsers.showUsers', compact('user'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
return view('Admin.CrudUsers.editUsers', compact('user'));
|
||||
}
|
||||
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
// dump($request);
|
||||
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'email' => 'required|email|unique:users,email,' . $user->user_id . ',user_id',
|
||||
'password' => 'nullable|min:8|confirmed',
|
||||
'user_type' => 'required',
|
||||
'user_phone' => 'required',
|
||||
'user_nif' => 'required',
|
||||
]);
|
||||
|
||||
$user->update([
|
||||
'name' => $request->get('name'),
|
||||
'email' => $request->get('email'),
|
||||
'password' => $request->filled('password') ? Hash::make($request->get('password')) : $user->password,
|
||||
'user_type' => $request->get('user_type'),
|
||||
'user_phone' => $request->get('user_phone'),
|
||||
'user_nif' => $request->get('user_nif'),
|
||||
]);
|
||||
|
||||
$user->save();
|
||||
|
||||
|
||||
return redirect('/users/listUsers')->with('success', 'Utilizador atualizado com Sucesso!!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('users.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required|min:8|confirmed',
|
||||
'user_type' => 'required',
|
||||
'user_phone' => 'required',
|
||||
'user_nif' => 'required',
|
||||
]);
|
||||
|
||||
$user = new User([
|
||||
'name' => $request->get('name'),
|
||||
'email' => $request->get('email'),
|
||||
'password' => Hash::make($request->get('password')),
|
||||
'user_type' => $request->get('user_type'),
|
||||
'user_phone' => $request->get('user_phone'),
|
||||
'user_nif' => $request->get('user_nif'),
|
||||
]);
|
||||
|
||||
$user->save();
|
||||
return redirect('/users')->with('success', 'User created successfully!');
|
||||
}
|
||||
|
||||
public function destroy(User $user)
|
||||
{
|
||||
$user->delete();
|
||||
return redirect('/users/listUsers')->with('success', 'User deleted successfully!');
|
||||
}
|
||||
}
|
||||
9
app/Http/Kernel.php
Executable file → Normal file
9
app/Http/Kernel.php
Executable file → Normal file
|
|
@ -53,17 +53,9 @@ class Kernel extends HttpKernel
|
|||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
// Route for setting home based on user type
|
||||
'checkUserType' => \App\Http\Middleware\CheckUserType::class,
|
||||
|
||||
'checksuperadmin' => \App\Http\Middleware\CheckSuperAdmin::class,
|
||||
'checkAdmin' => \App\Http\Middleware\CheckAdmin::class,
|
||||
'checkTechnical' => \App\Http\Middleware\CheckTechnical::class,
|
||||
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
|
|
@ -71,6 +63,5 @@ class Kernel extends HttpKernel
|
|||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
|
||||
];
|
||||
}
|
||||
|
|
|
|||
0
app/Http/Middleware/Authenticate.php
Executable file → Normal file
0
app/Http/Middleware/Authenticate.php
Executable file → Normal file
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CheckAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (auth()->user() && auth()->user()->userType->type_user == 'Administrador') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return abort(403, 'Acesso não autorizado.');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CheckSuperAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (auth()->user() && auth()->user()->userType->type_user == 'Super_Administrador') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return abort(403, 'Acesso não autorizado.');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CheckTechnical
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (auth()->user() && auth()->user()->userType->type_user == 'Técnico') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return abort(403, 'Acesso não autorizado.');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class CheckUserType
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
|
||||
public function handle(Request $request, Closure $next, $routeType)
|
||||
{
|
||||
$userType = auth()->user()->userType->type_user;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
0
app/Http/Middleware/EncryptCookies.php
Executable file → Normal file
0
app/Http/Middleware/EncryptCookies.php
Executable file → Normal file
0
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Executable file → Normal file
0
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Executable file → Normal file
22
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file → Normal file
22
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file → Normal file
|
|
@ -19,27 +19,9 @@ public function handle(Request $request, Closure $next, string ...$guards): Resp
|
|||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
// foreach ($guards as $guard) {
|
||||
// if (Auth::guard($guard)->check()) {
|
||||
// return redirect(RouteServiceProvider::HOME);
|
||||
// }
|
||||
// }
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check() && ! $request->is('register') && ! $request->is('email/verify')) {
|
||||
$user = Auth::guard($guard)->user();
|
||||
|
||||
switch ($user->user_type) {
|
||||
case 'Cliente':
|
||||
return redirect(RouteServiceProvider::CLIENTE);
|
||||
case 'Tecnicos':
|
||||
return redirect(RouteServiceProvider::TECNICO);
|
||||
case 'inspetor':
|
||||
return redirect(RouteServiceProvider::INSPETOR);
|
||||
// Adicione outros tipos de Utilizador e suas rotas aqui
|
||||
default:
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
0
app/Http/Middleware/TrimStrings.php
Executable file → Normal file
0
app/Http/Middleware/TrimStrings.php
Executable file → Normal file
0
app/Http/Middleware/TrustHosts.php
Executable file → Normal file
0
app/Http/Middleware/TrustHosts.php
Executable file → Normal file
0
app/Http/Middleware/TrustProxies.php
Executable file → Normal file
0
app/Http/Middleware/TrustProxies.php
Executable file → Normal file
0
app/Http/Middleware/ValidateSignature.php
Executable file → Normal file
0
app/Http/Middleware/ValidateSignature.php
Executable file → Normal file
6
app/Http/Middleware/VerifyCsrfToken.php
Executable file → Normal file
6
app/Http/Middleware/VerifyCsrfToken.php
Executable file → Normal file
|
|
@ -11,7 +11,7 @@ class VerifyCsrfToken extends Middleware
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
// protected $except = [
|
||||
// '/create-equipament-project',
|
||||
// ];
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,386 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WorkstationComposer
|
||||
{
|
||||
public function compose(View $view)
|
||||
{
|
||||
$userEmail = Auth::user()->email;
|
||||
|
||||
$equipmentsTodo = DB::select("
|
||||
WITH equipments_multiple_rows AS (
|
||||
SELECT
|
||||
e.equipment_id,
|
||||
e.equipment_tag,
|
||||
COALESCE(MAX(oet.elemental_tasks_id), MAX(oet.further_tasks_id)) AS equipment_all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
JOIN
|
||||
equipments e ON wat.company_projects_id = e.company_projects_id
|
||||
JOIN
|
||||
ordered_equipment_tasks oet ON e.equipment_id = oet.equipment_id
|
||||
WHERE
|
||||
u.email = :email1
|
||||
AND
|
||||
oet.execution_order = 1
|
||||
GROUP BY
|
||||
e.equipment_id,
|
||||
e.equipment_tag
|
||||
),
|
||||
|
||||
workstations_multiple_rows AS (
|
||||
SELECT
|
||||
cw.id_workstations,
|
||||
cw.name_workstations,
|
||||
COALESCE(wat.elemental_tasks_id, wat.further_tasks_id) AS all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
WHERE
|
||||
u.email = :email2
|
||||
),
|
||||
|
||||
workstations_control_all_tasks AS (
|
||||
SELECT
|
||||
cew.control_equipment_workstation_id,
|
||||
cew.equipment_id,
|
||||
CASE
|
||||
WHEN cew.id_workstations IS NULL THEN NULL
|
||||
WHEN cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email3
|
||||
) THEN cew.id_workstations
|
||||
ELSE NULL
|
||||
END AS control_id_workstations,
|
||||
COALESCE(cew.elemental_tasks_id, cew.further_tasks_id) AS control_workstation_all_tasks,
|
||||
cew.equipment_comments_id,
|
||||
cew.entry_date,
|
||||
cew.departure_date
|
||||
FROM
|
||||
control_equipment_workstation cew
|
||||
WHERE
|
||||
cew.id_workstations IS NULL
|
||||
OR cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email4
|
||||
)
|
||||
)
|
||||
|
||||
SELECT
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
FROM
|
||||
equipments_multiple_rows emr
|
||||
WHERE
|
||||
(
|
||||
emr.equipment_all_tasks IN (SELECT all_tasks FROM workstations_multiple_rows)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM workstations_control_all_tasks wc
|
||||
WHERE wc.equipment_id = emr.equipment_id
|
||||
AND wc.control_id_workstations IN (SELECT id_workstations FROM workstations_multiple_rows)
|
||||
)
|
||||
)
|
||||
OR
|
||||
(
|
||||
emr.equipment_id IN (
|
||||
SELECT equipment_id
|
||||
FROM workstations_control_all_tasks
|
||||
WHERE control_id_workstations IS NULL
|
||||
AND entry_date IS NULL
|
||||
AND departure_date IS NULL
|
||||
AND control_workstation_all_tasks IN (SELECT all_tasks FROM workstations_multiple_rows)
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM workstations_control_all_tasks wc
|
||||
WHERE wc.equipment_id = emr.equipment_id
|
||||
AND wc.control_id_workstations IS NOT NULL
|
||||
GROUP BY wc.equipment_id
|
||||
HAVING COUNT(DISTINCT wc.control_id_workstations) > 20
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
ORDER BY
|
||||
emr.equipment_id ASC;
|
||||
", [
|
||||
'email1' => $userEmail,
|
||||
'email2' => $userEmail,
|
||||
'email3' => $userEmail,
|
||||
'email4' => $userEmail
|
||||
]);
|
||||
|
||||
|
||||
$equipmentsReturned = DB::select("
|
||||
WITH equipments_multiple_rows AS (
|
||||
SELECT
|
||||
e.equipment_id,
|
||||
e.equipment_tag,
|
||||
COALESCE(MAX(oet.elemental_tasks_id), MAX(oet.further_tasks_id)) AS equipment_all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
JOIN
|
||||
equipments e ON wat.company_projects_id = e.company_projects_id
|
||||
JOIN
|
||||
ordered_equipment_tasks oet ON e.equipment_id = oet.equipment_id
|
||||
WHERE
|
||||
u.email = :email1
|
||||
AND
|
||||
oet.execution_order = 1
|
||||
GROUP BY
|
||||
e.equipment_id,
|
||||
e.equipment_tag
|
||||
),
|
||||
|
||||
|
||||
|
||||
workstations_multiple_rows AS (
|
||||
SELECT
|
||||
cw.id_workstations,
|
||||
cw.name_workstations,
|
||||
COALESCE(wat.elemental_tasks_id, wat.further_tasks_id) AS all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
WHERE
|
||||
u.email = :email2
|
||||
),
|
||||
|
||||
|
||||
|
||||
workstations_control_all_tasks AS (
|
||||
SELECT
|
||||
cew.control_equipment_workstation_id,
|
||||
cew.equipment_id,
|
||||
CASE
|
||||
WHEN cew.id_workstations IS NULL THEN NULL
|
||||
WHEN cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email3
|
||||
) THEN cew.id_workstations
|
||||
ELSE NULL
|
||||
END AS control_id_workstations,
|
||||
COALESCE(cew.elemental_tasks_id, cew.further_tasks_id) AS control_workstation_all_tasks,
|
||||
cew.equipment_comments_id,
|
||||
cew.entry_date,
|
||||
cew.departure_date
|
||||
FROM
|
||||
control_equipment_workstation cew
|
||||
WHERE
|
||||
cew.id_workstations IS NULL
|
||||
OR cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email4
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
SELECT
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
FROM
|
||||
equipments_multiple_rows emr
|
||||
WHERE
|
||||
emr.equipment_id IN (
|
||||
SELECT equipment_id
|
||||
FROM workstations_control_all_tasks
|
||||
WHERE control_id_workstations IS NULL
|
||||
AND entry_date IS NULL
|
||||
AND departure_date IS NULL
|
||||
AND control_workstation_all_tasks IN (SELECT all_tasks FROM workstations_multiple_rows)
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM workstations_control_all_tasks wc
|
||||
WHERE wc.equipment_id = emr.equipment_id
|
||||
AND wc.control_id_workstations IS NOT NULL
|
||||
GROUP BY wc.equipment_id
|
||||
HAVING COUNT(DISTINCT wc.control_id_workstations) >= 20
|
||||
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
ORDER BY
|
||||
emr.equipment_id ASC;
|
||||
|
||||
", [
|
||||
|
||||
'email1' => $userEmail,
|
||||
'email2' => $userEmail,
|
||||
'email3' => $userEmail,
|
||||
'email4' => $userEmail
|
||||
|
||||
]);
|
||||
|
||||
|
||||
$equipmentsDone = DB::select("
|
||||
WITH equipments_multiple_rows AS (
|
||||
SELECT
|
||||
e.equipment_id,
|
||||
e.equipment_tag,
|
||||
COALESCE(MAX(oet.elemental_tasks_id), MAX(oet.further_tasks_id)) AS equipment_all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
JOIN
|
||||
equipments e ON wat.company_projects_id = e.company_projects_id
|
||||
JOIN
|
||||
ordered_equipment_tasks oet ON e.equipment_id = oet.equipment_id
|
||||
WHERE
|
||||
u.email = :email1
|
||||
AND
|
||||
oet.execution_order = 1
|
||||
GROUP BY
|
||||
e.equipment_id,
|
||||
e.equipment_tag
|
||||
),
|
||||
|
||||
workstations_multiple_rows AS (
|
||||
SELECT
|
||||
cw.id_workstations,
|
||||
cw.name_workstations,
|
||||
COALESCE(wat.elemental_tasks_id, wat.further_tasks_id) AS all_tasks
|
||||
FROM
|
||||
users u
|
||||
JOIN
|
||||
construction_workstations cw ON u.user_name = cw.name_workstations
|
||||
JOIN
|
||||
workstations_association_tasks wat ON cw.id_workstations = wat.id_workstations
|
||||
WHERE
|
||||
u.email = :email2
|
||||
),
|
||||
|
||||
workstations_control_all_tasks AS (
|
||||
SELECT
|
||||
cew.control_equipment_workstation_id,
|
||||
cew.equipment_id,
|
||||
CASE
|
||||
WHEN cew.id_workstations IS NULL THEN NULL
|
||||
WHEN cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email3
|
||||
) THEN cew.id_workstations
|
||||
ELSE NULL
|
||||
END AS control_id_workstations,
|
||||
COALESCE(cew.elemental_tasks_id, cew.further_tasks_id) AS control_workstation_all_tasks,
|
||||
cew.equipment_comments_id,
|
||||
cew.entry_date,
|
||||
cew.departure_date
|
||||
FROM
|
||||
control_equipment_workstation cew
|
||||
WHERE
|
||||
cew.id_workstations IS NULL
|
||||
OR cew.id_workstations IN (
|
||||
SELECT wat.id_workstations
|
||||
FROM workstations_association_tasks wat
|
||||
JOIN construction_workstations cw ON wat.company_projects_id = cw.company_projects_id
|
||||
JOIN users u ON u.user_name = cw.name_workstations
|
||||
WHERE u.email = :email4
|
||||
)
|
||||
)
|
||||
|
||||
SELECT
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
FROM
|
||||
equipments_multiple_rows emr
|
||||
WHERE
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM workstations_control_all_tasks wc
|
||||
JOIN workstations_multiple_rows wmr ON wc.control_id_workstations = wmr.id_workstations
|
||||
WHERE wc.equipment_id = emr.equipment_id
|
||||
AND wc.control_workstation_all_tasks = wmr.all_tasks
|
||||
AND wc.entry_date IS NOT NULL
|
||||
AND wc.departure_date IS NOT NULL
|
||||
AND wc.control_id_workstations IS NOT NULL
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM workstations_control_all_tasks wc
|
||||
WHERE wc.equipment_id = emr.equipment_id
|
||||
AND wc.control_workstation_all_tasks IN (SELECT all_tasks FROM workstations_multiple_rows)
|
||||
AND wc.control_id_workstations IS NULL
|
||||
)
|
||||
GROUP BY
|
||||
emr.equipment_id,
|
||||
emr.equipment_tag
|
||||
ORDER BY
|
||||
emr.equipment_id ASC;
|
||||
", [
|
||||
'email1' => $userEmail,
|
||||
'email2' => $userEmail,
|
||||
'email3' => $userEmail,
|
||||
'email4' => $userEmail
|
||||
]);
|
||||
|
||||
$workstationNameQuery = DB::select("
|
||||
SELECT construction_workstations.nomenclature_workstation
|
||||
FROM construction_workstations
|
||||
JOIN users
|
||||
WHERE construction_workstations.name_workstations = users.user_name
|
||||
AND users.email = :email;
|
||||
", ['email' => $userEmail]);
|
||||
|
||||
$workstationName = $workstationNameQuery[0]->nomenclature_workstation;
|
||||
|
||||
//Counting of equipments
|
||||
$equipmentsTodoCount = count($equipmentsTodo);
|
||||
$equipmentsDoneCount = count($equipmentsDone);
|
||||
$equipmentsReturnedCount = count($equipmentsReturned);
|
||||
|
||||
|
||||
//Returning values of the queries to workstations layout
|
||||
$view->with([
|
||||
'equipmentsTodo' => $equipmentsTodo,
|
||||
'equipmentsTodoCount' => $equipmentsTodoCount,
|
||||
'equipmentsDone' => $equipmentsDone,
|
||||
'equipmentsDoneCount' => $equipmentsDoneCount,
|
||||
'equipmentsReturned' => $equipmentsReturned,
|
||||
'equipmentsReturnedCount' => $equipmentsReturnedCount,
|
||||
'workstationName' => $workstationName
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Articulado;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
|
||||
use App\Models\FurtherTasks;
|
||||
|
||||
class AdditonalTask extends Component
|
||||
{
|
||||
public $equipment;
|
||||
public $tasks = [];
|
||||
public $furtherTasks = [];
|
||||
public $furtherTaskRecords = [];
|
||||
public $selectedFurtherTask = 'null';
|
||||
public $showAdditionalTask = false;
|
||||
|
||||
|
||||
public function mount($equipment)
|
||||
{
|
||||
$this->equipment = $equipment;
|
||||
|
||||
$this->tasks = OrderEquipmentTasks::where('equipment_id', $this->equipment->equipment_id)
|
||||
->orderBy('execution_order', 'asc')
|
||||
->get();
|
||||
|
||||
// Coletando todos os registros onde further_tasks_id é diferente de null
|
||||
$this->furtherTaskRecords = OrderEquipmentTasks::where('equipment_id', $this->equipment->equipment_id)
|
||||
->whereNotNull('further_tasks_id')
|
||||
->get();
|
||||
|
||||
// Coletando todos os further_tasks_id da coleção $tasks que são diferentes de null
|
||||
$existingFurtherTaskIds = $this->tasks->whereNotNull('further_tasks_id')->pluck('further_tasks_id');
|
||||
|
||||
// Buscando furtherTasks que não estão presentes em $tasks
|
||||
$this->furtherTasks = FurtherTasks::where('company_projects_id', $this->equipment->company_projects_id)
|
||||
->whereNotIn('further_tasks_id', $existingFurtherTaskIds)
|
||||
->get();
|
||||
}
|
||||
|
||||
public function toggle()
|
||||
{
|
||||
|
||||
$this->showAdditionalTask = !$this->showAdditionalTask;
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.articulado.additonal-task');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Articulado;
|
||||
|
||||
use App\Models\ElementalTasks;
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Models\Equipment;
|
||||
|
||||
use App\Models\EquipmentAssociationAmbit;
|
||||
use App\Models\TasksAssociationAmbits;
|
||||
use App\Models\FurtherTasks;
|
||||
|
||||
// Chama o Repositorio para amazenar as variaveis e depois conseguir chamar facilmente sem precisar de sessao.
|
||||
use App\Repositories\ReceiveTasksRepository;
|
||||
|
||||
class SelectElementalTasksInWonkstation extends Component
|
||||
{
|
||||
public $workstation;
|
||||
|
||||
// recebe todos os equipamentos e pode filtros por tipos de equipamentos.
|
||||
public $receiveAllEquipments = [];
|
||||
|
||||
// Recebe todos os Ambitos nao repetidos, apos filtrar por todos os equipamentos.
|
||||
public $uniqueAmbitsIds = [];
|
||||
|
||||
public $receiveAllFurtherTasks = [];
|
||||
|
||||
public $receiveElementalTasks = [];
|
||||
|
||||
public $dataElementalTasks;
|
||||
|
||||
public $receiveAllAmbits = [];
|
||||
|
||||
public $elementalTasksDetails = [];
|
||||
|
||||
public $test;
|
||||
|
||||
public function mount($workstation)
|
||||
{
|
||||
$this->workstation = $workstation;
|
||||
|
||||
$this->receiveAllEquipments = Equipment::where('company_projects_id', $this->workstation->company_projects_id)
|
||||
->join('equipment_association_ambits', 'equipments.equipment_id', '=', 'equipment_association_ambits.equipment_id')
|
||||
->select('equipments.equipment_id', 'equipments.equipment_type_id', 'equipment_association_ambits.ambits_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
$this->receiveAllFurtherTasks = FurtherTasks::where('company_projects_id', $this->workstation->company_projects_id)
|
||||
->get();
|
||||
|
||||
// Inicializar a matriz
|
||||
$this->receiveElementalTasks = [
|
||||
'geral' => [],
|
||||
'1' => [],
|
||||
'2' => [],
|
||||
'3' => []
|
||||
];
|
||||
|
||||
// Coletar todos os elemental_tasks_id para cada equipment_type_id
|
||||
foreach ($this->receiveAllEquipments as $equipment) {
|
||||
$elementalTasksIds = TasksAssociationAmbits::where('ambits_equipment_id', $equipment['ambits_id'])
|
||||
->pluck('elemental_tasks_id')
|
||||
->toArray();
|
||||
|
||||
// Inicializar cada ID como uma chave com um array vazio como valor
|
||||
foreach ($elementalTasksIds as $id) {
|
||||
$this->receiveElementalTasks[$equipment['equipment_type_id']][$id] = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Mover elemental_tasks_id que aparecem em mais de um equipment_type_id para 'geral'
|
||||
foreach ($this->receiveElementalTasks as $key1 => $values1) {
|
||||
foreach ($this->receiveElementalTasks as $key2 => $values2) {
|
||||
if ($key1 !== $key2 && $key1 !== 'geral' && $key2 !== 'geral') {
|
||||
$commonValues = array_intersect_key($values1, $values2);
|
||||
if (!empty($commonValues)) {
|
||||
foreach ($commonValues as $value => $emptyArray) {
|
||||
$this->receiveElementalTasks['geral'][$value] = [];
|
||||
unset($this->receiveElementalTasks[$key1][$value]);
|
||||
unset($this->receiveElementalTasks[$key2][$value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Iterar sobre $receiveElementalTasks
|
||||
foreach ($this->receiveElementalTasks as $key => $ids) {
|
||||
// Para cada ID em uma chave específica, buscar os detalhes na tabela ElementalTasks
|
||||
$details = ElementalTasks::whereIn('elemental_tasks_id', array_keys($ids))
|
||||
->select(['elemental_tasks_id', 'elemental_tasks_code', 'elemental_tasks_description'])
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
// Atualizar o array $receiveElementalTasks com os detalhes
|
||||
foreach ($details as $detail) {
|
||||
$this->receiveElementalTasks[$key][$detail['elemental_tasks_id']] = [
|
||||
'code' => $detail['elemental_tasks_code'],
|
||||
'description' => $detail['elemental_tasks_description']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Armazenar os dados na sessão
|
||||
session([
|
||||
'receiveAllFurtherTasks' => $this->receiveAllFurtherTasks,
|
||||
'receiveElementalTasks' => $this->receiveElementalTasks,
|
||||
]);
|
||||
|
||||
$receiveTasksRepository = app(ReceiveTasksRepository::class);
|
||||
// Chama a variavel do Repositorio para amazenar a variavel e depois conseguir chamar facilmente.
|
||||
$receiveTasksRepository->setElementalTasks($this->receiveElementalTasks);
|
||||
$receiveTasksRepository->setFurtherTasks($this->receiveAllFurtherTasks);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.articulado.select-elemental-tasks-in-wonkstation');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Execução;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Exceptions\PublicPropertyNotFoundException;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\GeneralAttributesEquipment;
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
|
||||
use Spatie\LaravelIgnition\Recorders\DumpRecorder\Dump;
|
||||
|
||||
class EquipmentsDashboard extends Component
|
||||
{
|
||||
public $totalEquipmentsCount;
|
||||
public $unstarted;
|
||||
public $inProgress;
|
||||
public $completed;
|
||||
public $completed1;
|
||||
public $totalEquivalentEquipment;
|
||||
public $equivalentUnstarted;
|
||||
public $equivalentInProgress;
|
||||
public $equivalentCompleted;
|
||||
|
||||
public $datasProject;
|
||||
public $lastUpdated;
|
||||
|
||||
|
||||
public function mount($datasProject)
|
||||
{
|
||||
$this->datasProject = $datasProject;
|
||||
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
|
||||
|
||||
// chama a funcao e envia a variavel datasProject recebido da view principal
|
||||
$this->refreshDataEquipments($datasProject);
|
||||
}
|
||||
|
||||
public function updateTimeGrafics()
|
||||
{
|
||||
// $this->lastUpdated = now()->toDateTimeString();
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
|
||||
|
||||
// Chame o método para atualizar os dados dos gráficos
|
||||
$this->refreshDataEquipments($this->datasProject);
|
||||
|
||||
// Disparar um evento com os dados atualizados
|
||||
$this->dispatch('refreshData', [
|
||||
'totalEquipmentsCount' => $this->totalEquipmentsCount,
|
||||
'unstarted' => $this->unstarted,
|
||||
'inProgress' => $this->inProgress,
|
||||
'completed' => $this->completed,
|
||||
'totalEquivalentEquipment' => $this->totalEquivalentEquipment,
|
||||
'equivalentUnstarted' => $this->equivalentUnstarted,
|
||||
'equivalentInProgress' => $this->equivalentInProgress,
|
||||
'equivalentCompleted' => $this->equivalentCompleted,
|
||||
]);
|
||||
}
|
||||
|
||||
// Por tipo de equipamento,
|
||||
|
||||
// Por Fabrica
|
||||
|
||||
//Porcentagem
|
||||
public function showPercentageEquipments()
|
||||
{
|
||||
// Disparar um evento com os dados atualizados
|
||||
$this->dispatch('refreshPercentageEquipments', [
|
||||
'totalEquipmentsCount' => $this->totalEquipmentsCount,
|
||||
'unstarted' => $this->unstarted,
|
||||
'inProgress' => $this->inProgress,
|
||||
'completed' => $this->completed,
|
||||
'totalEquivalentEquipment' => $this->totalEquivalentEquipment,
|
||||
'equivalentUnstarted' => $this->equivalentUnstarted,
|
||||
'equivalentInProgress' => $this->equivalentInProgress,
|
||||
'equivalentCompleted' => $this->equivalentCompleted,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function refreshDataEquipments($datasProject)
|
||||
{
|
||||
|
||||
// Inicializa a zero o contador para toda a vez que atualizar.
|
||||
$this->completed = 0;
|
||||
$this->inProgress = 0;
|
||||
$this->unstarted = 0;
|
||||
$this->equivalentCompleted = 0;
|
||||
$this->equivalentInProgress = 0;
|
||||
$this->equivalentUnstarted = 0;
|
||||
|
||||
|
||||
$totalEquipments = Equipment::where('company_projects_id', $datasProject->company_projects_id)->get();
|
||||
// Busca o valor total de todos os equipamentos encontrados
|
||||
$this->totalEquipmentsCount = $totalEquipments->count();
|
||||
|
||||
$equipmentCounts = [];
|
||||
|
||||
foreach ($totalEquipments as $equipment) {
|
||||
|
||||
// Conta quantas vezes o equipamento aparece em OrderEquipmentTasks
|
||||
$tasksCount = OrderEquipmentTasks::where('equipment_id', $equipment->equipment_id)->count();
|
||||
|
||||
// ira receber varios dados para o array sendo array[key:equipment_id,valor:quantidade de vezes que o equipment_id se repete na tabela 'OrderEquipmentTasks']
|
||||
$equipmentCounts[$equipment->equipment_id] = $tasksCount;
|
||||
|
||||
// Verifica quantos dados tem para o mesmo equipamento, resumindo quantas tarefas ja vez e seu circuito ao longo de seu Ambito
|
||||
$controlCount = ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)->count();
|
||||
|
||||
// Verifica inicialmente se a quantido de vezes que tal equipamento apacere na ControlEquipmentWorkstation e o mesmo numero de vezes que aparece na tabela : OrderEquipmentTasks
|
||||
// Isto para ver se o ciclo foi correto sem retornos se os 2 valores forem iguais significa que o equipamento foi concluido.
|
||||
// if (
|
||||
// $controlCount >= $tasksCount && ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)
|
||||
// // apos receber ambos os numeros se as colunas 'entry_date' e 'departure_date' forem diferente de Null significa que o equipamento foi concluido
|
||||
// ->whereNotNull('entry_date')
|
||||
// ->whereNotNull('departure_date')
|
||||
// ->count() >= $tasksCount
|
||||
// ) {
|
||||
|
||||
if (ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)
|
||||
// apos receber ambos os numeros se as colunas 'entry_date' e 'departure_date' forem diferente de Null significa que o equipamento foi concluido
|
||||
|
||||
->whereNotNull('id_workstations')
|
||||
->whereNotNull('entry_date')
|
||||
->whereNotNull('departure_date')
|
||||
->count() >= $tasksCount
|
||||
) {
|
||||
|
||||
// se o equipamento foi considerado concluido, conta +1 para o completed e o equivalentCompleted busca no array equipmentCounts, quando a key for igual ao equipment_id atual e conta com + os valores da key encontrada
|
||||
$this->completed++;
|
||||
|
||||
$this->completed1[] = $equipment->equipment_id; // Adiciona o equipment_id ao array
|
||||
|
||||
$this->equivalentCompleted += $equipmentCounts[$equipment->equipment_id];
|
||||
} elseif (ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)->exists()) {
|
||||
$this->inProgress++;
|
||||
$this->equivalentInProgress += $equipmentCounts[$equipment->equipment_id];
|
||||
} else {
|
||||
$this->unstarted++;
|
||||
$this->equivalentUnstarted += $equipmentCounts[$equipment->equipment_id];
|
||||
}
|
||||
}
|
||||
// Busca o valor total de todas as ocorrências criadas na variavel equipmentCounts
|
||||
$this->totalEquivalentEquipment = array_sum($equipmentCounts);
|
||||
|
||||
$this->completed1 = collect($this->completed1);
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.execução.equipments-dashboard');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Execução;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Models\Equipment;
|
||||
|
||||
class StepByStepEquipmentTasks extends Component
|
||||
{
|
||||
public $equipmentId;
|
||||
public $modalOpen = false;
|
||||
|
||||
// public function loadDetails($equipmentId)
|
||||
// {
|
||||
// $this->equipmentId = $equipmentId;
|
||||
// $this->dispatchBrowserEvent('openModalEvent'); // Emitindo o evento
|
||||
// }
|
||||
|
||||
public function loadDetails($equipmentId)
|
||||
{
|
||||
$this->equipmentId = $equipmentId;
|
||||
$this->emit('openModalEvent');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.execução.step-by-step-equipment-tasks');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Execução;
|
||||
|
||||
use App\Models\Equipment;
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\ElementalTasks;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Repositories\ReceiveTasksRepository;
|
||||
|
||||
class TasksDashboard extends Component
|
||||
{
|
||||
public $datasProject;
|
||||
// protected $receiveTasksRepository;
|
||||
|
||||
public $receiveElementalTasks; // Recebe todas as acoes ja feitas atualmente por tarefa
|
||||
public $receiveElementalTasksAll;// Recebe o total de tarefas que vamos fazer
|
||||
|
||||
public $countElementalTasks;
|
||||
public $countElementalTasksAll;
|
||||
public $lastUpdated;
|
||||
|
||||
// Por enquanto nao ira usar, vamos deixar
|
||||
// public $receiveAllFurtherTasks;
|
||||
|
||||
|
||||
|
||||
// Deveria funcionar para receber o Repositorio.
|
||||
// public function initialize()
|
||||
// {
|
||||
// // Injetar o repositório
|
||||
// $this->receiveTasksRepository = app(ReceiveTasksRepository::class);
|
||||
|
||||
// // Agora você pode usar o repositório
|
||||
// $this->receiveElementalTasks = $this->receiveTasksRepository->getElementalTasks();
|
||||
// $this->receiveAllFurtherTasks = $this->receiveTasksRepository->getFurtherTasks();
|
||||
// }
|
||||
|
||||
public function updateTimeGrafics()
|
||||
{
|
||||
// Data atual
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
|
||||
// Chame o método para atualizar os dados dos gráficos
|
||||
$this->refreshDataEquipments($this->datasProject);
|
||||
|
||||
// Disparar um evento com os dados atualizados
|
||||
$this->dispatch('refreshData', [
|
||||
'receiveElementalTasks' => $this->receiveElementalTasks,
|
||||
'receiveElementalTasksAll' => $this->receiveElementalTasksAll,
|
||||
]);
|
||||
}
|
||||
|
||||
// Graficos de porcentagem entre o valor atual de finalizadas com valor final de quantas faltam
|
||||
public function showPercentageElementalTasks()
|
||||
{
|
||||
// Disparar um evento com os dados atualizados
|
||||
$this->dispatch('refreshPercentageElementalTasks', [
|
||||
'receiveElementalTasks' => $this->receiveElementalTasks,
|
||||
'receiveElementalTasksAll' => $this->receiveElementalTasksAll,
|
||||
'countElementalTasksAll'=> $this->countElementalTasksAll
|
||||
]);
|
||||
}
|
||||
|
||||
public function mount($datasProject)
|
||||
{
|
||||
$this->datasProject = $datasProject;
|
||||
|
||||
// Obter todos os equipamentos relacionados ao projeto
|
||||
$receiveEquipmentsProject = Equipment::where('company_projects_id', $datasProject->company_projects_id)->get();
|
||||
|
||||
$elementalTasks = collect();
|
||||
$furtherTasks = collect();
|
||||
|
||||
// Total de tarefas na Obra.
|
||||
$elementalTasksCountsAll = [];
|
||||
|
||||
foreach ($receiveEquipmentsProject as $equipment) {
|
||||
// Obter todas as OrderEquipmentTasks relacionadas a este equipamento
|
||||
$relatedTasks = OrderEquipmentTasks::where('equipment_id', $equipment->equipment_id)->get();
|
||||
|
||||
// Filtrar e armazenar os IDs únicos de elemental_tasks_id e further_tasks_id
|
||||
$elementalTasks = $elementalTasks->merge($relatedTasks->whereNotNull('elemental_tasks_id')->pluck('elemental_tasks_id'))->unique();
|
||||
$furtherTasks = $furtherTasks->merge($relatedTasks->whereNotNull('further_tasks_id')->pluck('further_tasks_id'))->unique();
|
||||
|
||||
// Agrupar as tasks relacionadas por elemental_tasks_id e contar o número de ocorrências
|
||||
$groupedTasks = $relatedTasks->whereNotNull('elemental_tasks_id')->groupBy('elemental_tasks_id');
|
||||
|
||||
foreach ($groupedTasks as $taskId => $tasksGroup) {
|
||||
if (isset($elementalTasksCountsAll[$taskId])) {
|
||||
$elementalTasksCountsAll[$taskId] += count($tasksGroup);
|
||||
} else {
|
||||
$elementalTasksCountsAll[$taskId] = count($tasksGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->receiveElementalTasksAll = $elementalTasksCountsAll;
|
||||
|
||||
// Contar o número de ocorrências de cada ID na tabela ControlEquipmentWorkstation
|
||||
$elementalTasksCount1 = ControlEquipmentWorkstation::whereIn('elemental_tasks_id', $elementalTasks)->get()->countBy('elemental_tasks_id');
|
||||
$furtherTasksCount1 = ControlEquipmentWorkstation::whereIn('further_tasks_id', $furtherTasks)->get()->countBy('further_tasks_id');
|
||||
|
||||
$newArray = [];
|
||||
|
||||
foreach ($elementalTasksCount1 as $taskId => $count) {
|
||||
$task = ElementalTasks::find($taskId);
|
||||
if ($task) {
|
||||
$newArray[$task->elemental_tasks_code] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
$this->receiveElementalTasks = $newArray;
|
||||
|
||||
$newArray1 = [];
|
||||
|
||||
foreach ($this->receiveElementalTasksAll as $taskId1 => $count) {
|
||||
$task1 = ElementalTasks::find($taskId1);
|
||||
if ($task1) {
|
||||
$newArray1[$task1->elemental_tasks_code] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
// Agora, $newArray contém a contagem de tasks por elemental_tasks_code
|
||||
$this->receiveElementalTasksAll = $newArray1;
|
||||
|
||||
|
||||
// Criar o contador para receber o valor total.
|
||||
$this->countElementalTasksAll =array_sum($this->receiveElementalTasksAll);
|
||||
|
||||
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function refreshDataEquipments($datasProject)
|
||||
{
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.execução.tasks-dashboard');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Execução;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\ConstructionWorkstation;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class WorkstationDashboard extends Component
|
||||
{
|
||||
public $receivefnishTasksInWorkstation;
|
||||
|
||||
public $lastUpdated;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// Obtendo todos os registros onde entry_date e departure_date não são nulos
|
||||
$validWorkstations = ControlEquipmentWorkstation::whereNotNull('entry_date')
|
||||
->whereNotNull('departure_date')
|
||||
->get();
|
||||
|
||||
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
|
||||
// Inicializando um array para armazenar a contagem
|
||||
// $workstationCounts = [];
|
||||
|
||||
// // Iterando sobre os registros válidos
|
||||
// foreach ($validWorkstations as $workstation) {
|
||||
// // Obtendo o id_workstations do registro atual
|
||||
// $workstationId = $workstation->id_workstations;
|
||||
|
||||
// // Se o id_workstations já existe no array, incrementa o contador, senão, inicializa com 1
|
||||
// if (isset($workstationCounts[$workstationId])) {
|
||||
// $workstationCounts[$workstationId]++;
|
||||
// } else {
|
||||
// $workstationCounts[$workstationId] = 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// dump($workstationCounts);
|
||||
|
||||
$workstationCounts = ControlEquipmentWorkstation::select('id_workstations', DB::raw('count(*) as count'))
|
||||
->whereNotNull('id_workstations')
|
||||
->whereNotNull('entry_date')
|
||||
->whereNotNull('departure_date')
|
||||
->groupBy('id_workstations')
|
||||
->get()
|
||||
->pluck('count', 'id_workstations')
|
||||
->toArray();
|
||||
|
||||
$receiveNameWK = [];
|
||||
|
||||
foreach ($workstationCounts as $wkId1 => $count) {
|
||||
$wkId1 = ConstructionWorkstation::find($wkId1);
|
||||
if ($wkId1) {
|
||||
$receiveNameWK[$wkId1->nomenclature_workstation] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
$this->receivefnishTasksInWorkstation = $receiveNameWK;
|
||||
}
|
||||
|
||||
public function updateData()
|
||||
{
|
||||
// Atualize a variável com os novos dados
|
||||
$this->receivefnishTasksInWorkstation = [1, 2, 3];
|
||||
|
||||
// Data atual
|
||||
$this->lastUpdated = now()->format('Y-m-d H:i');
|
||||
|
||||
// Emita um evento com os novos dados
|
||||
$this->dispatch('updateChart', $this->receivefnishTasksInWorkstation);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.execução.workstation-dashboard');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\ManagementDashboard;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Models\Equipment;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
|
||||
|
||||
class WorkManagement extends Component
|
||||
{
|
||||
public $totalEquipments;
|
||||
public $type1Count;
|
||||
public $type2Count;
|
||||
public $type3Count;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->refreshData();
|
||||
}
|
||||
|
||||
public function refreshData()
|
||||
|
||||
{
|
||||
$this->totalEquipments = Equipment::count();
|
||||
|
||||
// Inicializar type3Count como 0
|
||||
$this->type3Count = 0;
|
||||
|
||||
// Obter todos os equipamentos
|
||||
$equipments = Equipment::all();
|
||||
|
||||
foreach ($equipments as $equipment) {
|
||||
|
||||
// conta quantos dados existem na model OrderEquipmentTasks, referente ao equipamento indicado
|
||||
$tasksCount = OrderEquipmentTasks::where('equipment_id', $equipment->equipment_id)->count();
|
||||
// Verifica quantos dados tem ao mesmo equipamento
|
||||
$controlCount = ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)->count();
|
||||
|
||||
if ($controlCount >= $tasksCount) {
|
||||
$isValid = ControlEquipmentWorkstation::where('equipment_id', $equipment->equipment_id)
|
||||
->whereNotNull('entry_date')
|
||||
->whereNotNull('departure_date')
|
||||
->count() >= $tasksCount;
|
||||
|
||||
if ($isValid) {
|
||||
$this->type3Count++;
|
||||
$type3EquipmentIds[] = $equipment->equipment_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Atualizar type2Count
|
||||
$this->type2Count = Equipment::whereIn('equipment_id', ControlEquipmentWorkstation::select('equipment_id'))
|
||||
->whereNotIn('equipment_id', $type3EquipmentIds)
|
||||
->count();
|
||||
|
||||
// Contar equipamentos que NÃO estão em ControlEquipmentWorkstation
|
||||
$this->type1Count = Equipment::whereNotIn('equipment_id', ControlEquipmentWorkstation::select('equipment_id'))->count();
|
||||
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.management-dashboard.work-management');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Preparadas;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use App\Models\Equipment;
|
||||
use App\Models\QrcodesAssociatedEquipment;
|
||||
|
||||
class ShowQrcodeAndDetallsEquipment extends Component
|
||||
{
|
||||
public $equipment;
|
||||
|
||||
public function mount($equipment)
|
||||
{
|
||||
$this->equipment = $equipment;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
// $this->equipment = Equipment::find($this->equipment->id);
|
||||
// return view('livewire.preparadas.show-qrcode-and-detalls-equipment');
|
||||
|
||||
// $associatedEquipments = QrcodesAssociatedEquipment::where('equipment_id', $this->equipment->equipment_id)->get();
|
||||
// return view('livewire.preparadas.show-qrcode-and-detalls-equipment', ['associatedEquipments' => $associatedEquipments]);
|
||||
|
||||
$associatedEquipments = QrcodesAssociatedEquipment::where('equipment_id', $this->equipment->equipment_id)->get();
|
||||
|
||||
$associatedArray = [];
|
||||
foreach ($associatedEquipments as $associatedEquipment) {
|
||||
$associatedArray[$associatedEquipment->id] = $associatedEquipment->component_tag;
|
||||
}
|
||||
|
||||
return view('livewire.preparadas.show-qrcode-and-detalls-equipment', ['associatedArray' => $associatedArray,'associatedEquipments' => $associatedEquipments]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class NewUserNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->subject('Um novo utilizador para criar')
|
||||
->view('emails.new_user_notification');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'New User Notification',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'email.new_user_notification',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AmbitsEquipment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ambits_equipments';
|
||||
protected $primaryKey = 'ambits_equipment_id';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
public function equipmentAssociationAmbit(){
|
||||
return $this->hasMany(EquipmentAssociationAmbit::class, 'ambits_id', 'ambits_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CompanyProject extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'company_projects';
|
||||
|
||||
protected $primaryKey = 'company_projects_id';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function plants(){
|
||||
|
||||
return $this->hasMany(Plant::class,'plant_id', 'plant_id');
|
||||
}
|
||||
|
||||
public function user(){
|
||||
return $this->hasOneThrough(User::class, Plant::class, 'plant_id', 'user_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ConstructionWorkstation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'construction_workstations';
|
||||
|
||||
protected $primaryKey = 'id_workstations';
|
||||
|
||||
public function workstationsAssociationTasks()
|
||||
{
|
||||
return $this->hasMany(WorkstationsAssociationTasks::class, 'id_workstations','id_workstations');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ControlEquipmentWorkstation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'control_equipment_workstation';
|
||||
|
||||
protected $primaryKey = 'control_equipment_workstation_id';
|
||||
|
||||
// protected $primaryKey = 'id';
|
||||
|
||||
public function equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function elementalTask()
|
||||
{
|
||||
return $this->belongsTo(ElementalTasks::class,'elemental_tasks_id','elemental_tasks_id');
|
||||
}
|
||||
|
||||
public function furtherTasks()
|
||||
{
|
||||
return $this->belongsTo(FurtherTasks::class,'further_tasks_id','further_tasks_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ElementalTasks extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'elemental_tasks';
|
||||
|
||||
protected $primaryKey = 'elemental_tasks_id';
|
||||
|
||||
public function orderEquipmentTasks()
|
||||
{
|
||||
return $this->hasMany(OrderEquipmentTasks::class,'elemental_tasks_id','elemental_tasks_id');
|
||||
}
|
||||
|
||||
public function controlEquipmentWorkstation()
|
||||
{
|
||||
return $this->hasMany(ControlEquipmentWorkstation::class, 'elemental_tasks_id', 'elemental_tasks_id');
|
||||
}
|
||||
|
||||
public function workstationsAssociationTasks()
|
||||
{
|
||||
return $this->hasMany(WorkstationsAssociationTasks::class,'elemental_tasks_id','elemental_tasks_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use APP\Models\equipament_type;
|
||||
use App\Models\factorie;
|
||||
use App\Models\specific_Attributes_Equipament_Type;
|
||||
use App\Models\installation;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Equipment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'equipments';
|
||||
|
||||
protected $primaryKey = 'equipment_id';
|
||||
|
||||
public function unit()
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'unit_id', 'unit_id');
|
||||
}
|
||||
|
||||
public function equipmentType()
|
||||
{
|
||||
return $this->belongsTo(EquipmentType::class, 'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
public function specificAttributes()
|
||||
{
|
||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'equipment_id', 'equipment_id')
|
||||
->join('general_attributes_equipaments', 'specific_attributes_equipament_types.general_attributes_equipment_id', '=', 'general_attributes_equipaments.general_attributes_equipment_id')
|
||||
->orderBy('general_attributes_equipaments.general_attributes_equipment_description', 'asc');
|
||||
}
|
||||
|
||||
public function equipmentAssociationAmbit()
|
||||
{
|
||||
//Antiga hasMany , apenas colocado hasOne para funcionar o datatables
|
||||
return $this->hasOne(EquipmentAssociationAmbit::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function orderEquipmentTasks()
|
||||
{
|
||||
return $this->hasMany(OrderEquipmentTasks::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function equipmentComments()
|
||||
{
|
||||
return $this->hasMany(EquipmentComments::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function controlEquipmentWorkstation()
|
||||
{
|
||||
return $this->hasMany(ControlEquipmentWorkstation::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function hasInspectionYes()
|
||||
{
|
||||
return $this->orderEquipmentTasks()->where('inspection', 'Sim')->exists();
|
||||
}
|
||||
|
||||
public function QrcodesAssociatedEquipment(){
|
||||
return $this->hasMany(QrcodesAssociatedEquipment::class,'equipment_id','equipment_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EquipmentAssociationAmbit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'equipment_association_ambits';
|
||||
|
||||
public function equipmentType(){
|
||||
return $this->belongsTo(EquipmentType::class,'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
public function ambitsEquipment(){
|
||||
return $this->belongsTo(AmbitsEquipment::class,'ambits_id', 'ambits_id');
|
||||
}
|
||||
|
||||
public function Equipment(){
|
||||
return $this->belongsTo(Equipment::class,'equipment_id', 'equipment_id');
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EquipmentComments extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'equipment_comments';
|
||||
|
||||
protected $primaryKey = 'equipment_comment_id';
|
||||
|
||||
|
||||
public function equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EquipmentType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'equipment_types';
|
||||
|
||||
protected $primaryKey = 'equipament_type_id';
|
||||
|
||||
public function equipments(){
|
||||
return $this->hasMany(Equipment::class, 'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
public function pendingEquipments(){
|
||||
return $this->hasMany(PendingEquipment::class, 'pending_equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
|
||||
public function specificAttributesEquipamentTypes(){
|
||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
public function equipmentAssociationAmbits(){
|
||||
return $this->hasMany(EquipmentAssociationAmbit::class,'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FurtherTasks extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'further_tasks';
|
||||
|
||||
protected $primaryKey = 'further_tasks_id';
|
||||
|
||||
public function orderEquipmentTasks()
|
||||
{
|
||||
return $this->hasMany(OrderEquipmentTasks::class,'further_tasks_id','further_tasks_id');
|
||||
}
|
||||
|
||||
public function workstationsAssociationTasks()
|
||||
{
|
||||
return $this->hasMany(WorkstationsAssociationTasks::class,'further_tasks_id','further_tasks_id');
|
||||
}
|
||||
|
||||
public function controlEquipmentWorkstation()
|
||||
{
|
||||
return $this->hasMany(ControlEquipmentWorkstation::class, 'further_tasks_id', 'further_tasks_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GeneralAttributesEquipment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'general_attributes_equipaments';
|
||||
|
||||
protected $primaryKey = 'general_attributes_equipment_id';
|
||||
|
||||
public function specificAttributes()
|
||||
{
|
||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'general_attributes_equipment_id', 'general_attributes_equipment_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OrderEquipmentTasks extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'ordered_equipment_tasks';
|
||||
|
||||
// protected $primaryKey = 'ordered_equipment_tasks_id';
|
||||
|
||||
public function equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function elementalTask()
|
||||
{
|
||||
return $this->belongsTo(ElementalTasks::class,'elemental_tasks_id','elemental_tasks_id');
|
||||
}
|
||||
|
||||
public function furtherTasks()
|
||||
{
|
||||
return $this->belongsTo(FurtherTasks::class,'further_tasks_id','further_tasks_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PendingEquipment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'pending_equipments';
|
||||
|
||||
protected $primaryKey = 'pending_equipment_id';
|
||||
|
||||
public function unit()
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'pending_equipment_unit_id', 'unit_id');
|
||||
}
|
||||
|
||||
public function equipmentType()
|
||||
{
|
||||
return $this->belongsTo(EquipmentType::class, 'pending_equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PendingUser extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'pending_users';
|
||||
|
||||
protected $primaryKey = 'pending_user_id';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'pending_name',
|
||||
'pending_email',
|
||||
'pending_phone',
|
||||
'pending_nif',
|
||||
'pending_password',
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
];
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Plant extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'plants';
|
||||
|
||||
protected $primaryKey = 'plant_id';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class, 'user_id', 'user_id');
|
||||
}
|
||||
|
||||
public function companyProjects(){
|
||||
return $this->hasMany(CompanyProject::class, 'plant_id', 'plant_id');
|
||||
}
|
||||
|
||||
public function units(){
|
||||
return $this->hasMany(Unit::class, 'plant_id', 'plant_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QrcodesAssociatedEquipment extends Model
|
||||
{
|
||||
protected $fillable = ['equipment_id', 'component_tag'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected $table = 'qrcodes_associated_equipment';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
public function equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SpecificAttributesEquipmentType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'specific_attributes_equipament_types';
|
||||
|
||||
public function equipmentType(){
|
||||
return $this->belongsTo(EquipmentType::class,'equipment_type_id', 'equipment_type_id');
|
||||
}
|
||||
|
||||
public function equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||
}
|
||||
|
||||
public function generalAttributesEquipment()
|
||||
{
|
||||
return $this->belongsTo(GeneralAttributesEquipament::class, 'general_attributes_equipment_id', 'general_attributes_equipment_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TasksAssociationAmbits extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tasks_association_ambits';
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TypeUser extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'type_users';
|
||||
|
||||
protected $primaryKey = 'type_user_id';
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class, 'type_users', 'type_user_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Unit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'units';
|
||||
|
||||
protected $primaryKey = 'unit_id';
|
||||
public function equipments(){
|
||||
|
||||
return $this->hasMany(Equipment::class, 'unit_id', 'unit_id');
|
||||
}
|
||||
|
||||
public function pendingEquipments(){
|
||||
return $this->hasMany(PendingEquipment::class, 'pending_equipment_unit_id', 'unit_id');
|
||||
}
|
||||
|
||||
public function plant()
|
||||
{
|
||||
return $this->belongsTo(Plant::class, 'plant_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
30
app/Models/User.php
Executable file → Normal file
30
app/Models/User.php
Executable file → Normal file
|
|
@ -8,27 +8,20 @@
|
|||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
|
||||
|
||||
class User extends Authenticatable
|
||||
// implements MustVerifyEmail
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
protected $table = 'users';
|
||||
|
||||
protected $primaryKey = 'user_id';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
|
||||
protected $fillable = ['user_id','user_name', 'email', 'password', 'user_phone', 'user_nif', 'type_users'];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
|
|
@ -48,17 +41,4 @@ class User extends Authenticatable
|
|||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
// public function typeUser(){
|
||||
// return $this->belongsTo(TypeUser::class, 'type_users', 'type_user_id');
|
||||
// }
|
||||
|
||||
public function userType() {
|
||||
return $this->belongsTo(TypeUser::class, 'type_users', 'type_user_id');
|
||||
}
|
||||
|
||||
public function plants(){
|
||||
return $this->hasMany(Plant::class,'user_id', 'user_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WorkstationsAssociationTasks extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'workstations_association_tasks';
|
||||
|
||||
|
||||
public function constructionWorkstation()
|
||||
{
|
||||
return $this->belongsTo(ConstructionWorkstation::class, 'id_workstations','id_workstations');
|
||||
}
|
||||
public function elementalTask()
|
||||
{
|
||||
return $this->belongsTo(ElementalTasks::class,'elemental_tasks_id','elemental_tasks_id');
|
||||
}
|
||||
|
||||
public function furtherTask()
|
||||
{
|
||||
return $this->belongsTo(FurtherTasks::class,'further_tasks_id','further_tasks_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class workstationsTaskAnswers extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'workstations_task_answers';
|
||||
|
||||
protected $primaryKey = 'control_equipment_workstation_id';
|
||||
|
||||
public $timestamps = false;
|
||||
// protected $primaryKey = 'id';
|
||||
}
|
||||
16
app/Providers/AppServiceProvider.php
Executable file → Normal file
16
app/Providers/AppServiceProvider.php
Executable file → Normal file
|
|
@ -2,15 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
// Receber a referencia para passar os valores as view.
|
||||
use App\Http\ViewComposers\WorkstationComposer;
|
||||
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
use App\Repositories\ReceiveTasksRepository;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
|
|
@ -18,9 +11,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(ReceiveTasksRepository::class, function ($app) {
|
||||
return new ReceiveTasksRepository();
|
||||
});
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -28,9 +19,6 @@ public function register(): void
|
|||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
View::composer(
|
||||
['workstations.start', 'workstations.workstations'],
|
||||
WorkstationComposer::class
|
||||
);
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
app/Providers/AuthServiceProvider.php
Executable file → Normal file
0
app/Providers/AuthServiceProvider.php
Executable file → Normal file
0
app/Providers/BroadcastServiceProvider.php
Executable file → Normal file
0
app/Providers/BroadcastServiceProvider.php
Executable file → Normal file
0
app/Providers/EventServiceProvider.php
Executable file → Normal file
0
app/Providers/EventServiceProvider.php
Executable file → Normal file
67
app/Providers/FortifyServiceProvider.php
Executable file → Normal file
67
app/Providers/FortifyServiceProvider.php
Executable file → Normal file
|
|
@ -10,16 +10,6 @@
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
|
||||
use Laravel\Fortify\Contracts\ResetPasswordViewResponse;
|
||||
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||
|
||||
use Laravel\Fortify\Fortify;
|
||||
|
||||
class FortifyServiceProvider extends ServiceProvider
|
||||
|
|
@ -29,9 +19,7 @@ class FortifyServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(ResetPasswordController::class, function () {
|
||||
return new ResetPasswordController();
|
||||
});
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -44,69 +32,20 @@ public function boot(): void
|
|||
return view('auth.login');
|
||||
});
|
||||
|
||||
Fortify::registerView(function () {
|
||||
return view('auth.register');
|
||||
});
|
||||
|
||||
Fortify::verifyEmailView(function () {
|
||||
return view('auth.verify-email');
|
||||
});
|
||||
|
||||
Fortify::authenticateUsing(function (Request $request) {
|
||||
$email = $request->input('email');
|
||||
|
||||
// Verifica se "@" já está presente no e-mail. Se não, adiciona "@isptgroup.com" ao final.
|
||||
if (!str_contains($email, '@')) {
|
||||
$email .= '@isptgroup.com';
|
||||
}
|
||||
|
||||
$password = $request->input('password');
|
||||
|
||||
$user = User::where('email', $email)->first();
|
||||
|
||||
if ($user && Hash::check($password, $user->password)) {
|
||||
return $user;
|
||||
}
|
||||
});
|
||||
|
||||
Fortify::createUsersUsing(CreateNewUser::class);
|
||||
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
||||
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
|
||||
|
||||
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
|
||||
|
||||
RateLimiter::for('login', function (Request $request) {
|
||||
$email = (string) $request->email;
|
||||
|
||||
return Limit::perMinute(5)->by($email . $request->ip());
|
||||
return Limit::perMinute(5)->by($email.$request->ip());
|
||||
});
|
||||
|
||||
RateLimiter::for('two-factor', function (Request $request) {
|
||||
return Limit::perMinute(5)->by($request->session()->get('login.id'));
|
||||
});
|
||||
|
||||
|
||||
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
|
||||
|
||||
|
||||
Fortify::requestPasswordResetLinkView(function () {
|
||||
return view('auth.forgot-password');
|
||||
});
|
||||
|
||||
$this->registerPasswordResetResponseBindings();
|
||||
Fortify::resetPasswordView(function ($request) {
|
||||
return view('auth.reset-password', ['token' => $request->route('token')]);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected function registerPasswordResetResponseBindings()
|
||||
{
|
||||
$this->app->singleton(SendPasswordResetLinkViewResponse::class, function () {
|
||||
return view('auth.forgot-password');
|
||||
});
|
||||
|
||||
$this->app->singleton(ResetPasswordViewResponse::class, function () {
|
||||
return view('auth.reset-password');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
app/Providers/RouteServiceProvider.php
Executable file → Normal file
5
app/Providers/RouteServiceProvider.php
Executable file → Normal file
|
|
@ -19,11 +19,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public const HOME = '/';
|
||||
|
||||
// public const HOME = '/home';
|
||||
public const CLIENTE = '/cliente';
|
||||
public const TECNICO = '/Tecnicos';
|
||||
public const INSPETOR = '/inspetor';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ReceiveTasksRepository
|
||||
{
|
||||
protected $elementalTasks = [];
|
||||
protected $furtherTasks = [];
|
||||
|
||||
public function setElementalTasks(array $tasks)
|
||||
{
|
||||
$this->elementalTasks = $tasks;
|
||||
}
|
||||
|
||||
public function getElementalTasks(): array
|
||||
{
|
||||
return $this->elementalTasks;
|
||||
}
|
||||
|
||||
public function setFurtherTasks(Collection $tasks)
|
||||
{
|
||||
$this->furtherTasks = $tasks;
|
||||
}
|
||||
|
||||
public function getFurtherTasks(): Collection
|
||||
{
|
||||
return $this->furtherTasks;
|
||||
}
|
||||
}
|
||||
0
bootstrap/app.php
Executable file → Normal file
0
bootstrap/app.php
Executable file → Normal file
0
bootstrap/cache/.gitignore
vendored
Executable file → Normal file
0
bootstrap/cache/.gitignore
vendored
Executable file → Normal file
9
composer.json
Executable file → Normal file
9
composer.json
Executable file → Normal file
|
|
@ -6,16 +6,11 @@
|
|||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"guzzlehttp/guzzle": "^7.5",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/fortify": "^1.17",
|
||||
"laravel/framework": "^10.8",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.8",
|
||||
"livewire/livewire": "^3.0",
|
||||
"phpoffice/phpspreadsheet": "^1.28",
|
||||
"symfony/http-client": "^6.2",
|
||||
"symfony/mailgun-mailer": "^6.2",
|
||||
"yajra/laravel-datatables-oracle": "^10.3.1"
|
||||
"laravel/tinker": "^2.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
|
|
|
|||
859
composer.lock
generated
Executable file → Normal file
859
composer.lock
generated
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
17
config/app.php
Executable file → Normal file
17
config/app.php
Executable file → Normal file
|
|
@ -83,9 +83,7 @@
|
|||
|
|
||||
*/
|
||||
|
||||
// 'locale' => 'en',
|
||||
'locale' => 'pt',
|
||||
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -172,9 +170,7 @@
|
|||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
// Laravel\Fortify\FortifyServiceProvider::class,
|
||||
App\Providers\FortifyServiceProvider::class,
|
||||
|
||||
|
||||
App\Providers\FortifyServiceProvider::class
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|
|
@ -192,13 +188,4 @@
|
|||
// 'Example' => App\Facades\Example::class,
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom app variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
*/
|
||||
|
||||
'version' => env('PROJECT_VERSION', '1.0.0'),
|
||||
|
||||
];
|
||||
|
|
|
|||
0
config/auth.php
Executable file → Normal file
0
config/auth.php
Executable file → Normal file
0
config/broadcasting.php
Executable file → Normal file
0
config/broadcasting.php
Executable file → Normal file
0
config/cache.php
Executable file → Normal file
0
config/cache.php
Executable file → Normal file
0
config/cors.php
Executable file → Normal file
0
config/cors.php
Executable file → Normal file
0
config/database.php
Executable file → Normal file
0
config/database.php
Executable file → Normal file
0
config/filesystems.php
Executable file → Normal file
0
config/filesystems.php
Executable file → Normal file
8
config/fortify.php
Executable file → Normal file
8
config/fortify.php
Executable file → Normal file
|
|
@ -63,7 +63,6 @@
|
|||
|
||||
'home' => RouteServiceProvider::HOME,
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Fortify Routes Prefix / Subdomain
|
||||
|
|
@ -135,8 +134,8 @@
|
|||
'features' => [
|
||||
Features::registration(),
|
||||
Features::resetPasswords(),
|
||||
// Features::emailVerification(),
|
||||
|
||||
// Features::emailVerification(),
|
||||
// Features::updateProfileInformation(),
|
||||
// Features::updatePasswords(),
|
||||
// Features::twoFactorAuthentication([
|
||||
|
|
@ -145,4 +144,9 @@
|
|||
// // 'window' => 0,
|
||||
// ]),
|
||||
],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
|
|
|||
0
config/hashing.php
Executable file → Normal file
0
config/hashing.php
Executable file → Normal file
|
|
@ -1,158 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Class Namespace
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value sets the root class namespace for Livewire component classes in
|
||||
| your application. This value will change where component auto-discovery
|
||||
| finds components. It's also referenced by the file creation commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'class_namespace' => 'App\\Livewire',
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| View Path
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value is used to specify where Livewire component Blade templates are
|
||||
| stored when running file creation commands like `artisan make:livewire`.
|
||||
| It is also used if you choose to omit a component's render() method.
|
||||
|
|
||||
*/
|
||||
|
||||
'view_path' => resource_path('views/livewire'),
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Layout
|
||||
|---------------------------------------------------------------------------
|
||||
| The view that will be used as the layout when rendering a single component
|
||||
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
|
||||
| In this case, the view returned by CreatePost will render into $slot.
|
||||
|
|
||||
*/
|
||||
|
||||
'layout' => 'components.layouts.app',
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Lazy Loading Placeholder
|
||||
|---------------------------------------------------------------------------
|
||||
| Livewire allows you to lazy load components that would otherwise slow down
|
||||
| the initial page load. Every component can have a custom placeholder or
|
||||
| you can define the default placeholder view for all components below.
|
||||
|
|
||||
*/
|
||||
|
||||
'lazy_placeholder' => null,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Temporary File Uploads
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Livewire handles file uploads by storing uploads in a temporary directory
|
||||
| before the file is stored permanently. All file uploads are directed to
|
||||
| a global endpoint for temporary storage. You may configure this below:
|
||||
|
|
||||
*/
|
||||
|
||||
'temporary_file_upload' => [
|
||||
'disk' => null, // Example: 'local', 's3' | Default: 'default'
|
||||
'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
|
||||
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
|
||||
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
|
||||
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
|
||||
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
|
||||
'mov', 'avi', 'wmv', 'mp3', 'm4a',
|
||||
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
|
||||
],
|
||||
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
|
||||
],
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Render On Redirect
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines if Livewire will run a component's `render()` method
|
||||
| after a redirect has been triggered using something like `redirect(...)`
|
||||
| Setting this to true will render the view once more before redirecting
|
||||
|
|
||||
*/
|
||||
|
||||
'render_on_redirect' => false,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Eloquent Model Binding
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Previous versions of Livewire supported binding directly to eloquent model
|
||||
| properties using wire:model by default. However, this behavior has been
|
||||
| deemed too "magical" and has therefore been put under a feature flag.
|
||||
|
|
||||
*/
|
||||
|
||||
'legacy_model_binding' => false,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Auto-inject Frontend Assets
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| By default, Livewire automatically injects its JavaScript and CSS into the
|
||||
| <head> and <body> of pages containing Livewire components. By disabling
|
||||
| this behavior, you need to use @livewireStyles and @livewireScripts.
|
||||
|
|
||||
*/
|
||||
|
||||
'inject_assets' => true,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Navigate (SPA mode)
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| By adding `wire:navigate` to links in your Livewire application, Livewire
|
||||
| will prevent the default link handling and instead request those pages
|
||||
| via AJAX, creating an SPA-like effect. Configure this behavior here.
|
||||
|
|
||||
*/
|
||||
|
||||
'navigate' => [
|
||||
'show_progress_bar' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| HTML Morph Markers
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Livewire intelligently "morphs" existing HTML into the newly rendered HTML
|
||||
| after each update. To make this process more reliable, Livewire injects
|
||||
| "markers" into the rendered Blade surrounding @if, @class & @foreach.
|
||||
|
|
||||
*/
|
||||
|
||||
'inject_morph_markers' => true,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Pagination Theme
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| When enabling Livewire's pagination feature by using the `WithPagination`
|
||||
| trait, Livewire will use Tailwind templates to render pagination views
|
||||
| on the page. If you want Bootstrap CSS, you can specify: "bootstrap"
|
||||
|
|
||||
*/
|
||||
|
||||
'pagination_theme' => 'tailwind',
|
||||
];
|
||||
0
config/logging.php
Executable file → Normal file
0
config/logging.php
Executable file → Normal file
2
config/mail.php
Executable file → Normal file
2
config/mail.php
Executable file → Normal file
|
|
@ -51,8 +51,6 @@
|
|||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
|
|
|
|||
0
config/queue.php
Executable file → Normal file
0
config/queue.php
Executable file → Normal file
0
config/sanctum.php
Executable file → Normal file
0
config/sanctum.php
Executable file → Normal file
0
config/services.php
Executable file → Normal file
0
config/services.php
Executable file → Normal file
0
config/session.php
Executable file → Normal file
0
config/session.php
Executable file → Normal file
0
config/view.php
Executable file → Normal file
0
config/view.php
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user