Update, company sistem

This commit is contained in:
ygbanzato 2024-04-22 12:22:41 +01:00
parent 87b1640c25
commit aaa479ef32
22 changed files with 524 additions and 92 deletions

View File

@ -4,6 +4,7 @@
use App\Models\AmbitsEquipment;
use App\Models\AssociationCompanyUser;
use App\Models\Company;
use App\Models\Equipment;
use App\Models\EquipmentAssociationAmbit;
use App\Models\EquipmentWorkHistory;
@ -300,7 +301,7 @@ public function getDataProjectsClient(Request $request)
//Criar Filtros para Atualizar os dados com base neles.
$allPlantsClient = Plant::where('user_id', $clientID)->pluck('plant_id')->toArray();
$allPlantsClient = Plant::where('company_id', $clientID)->pluck('plant_id')->toArray();
$query = CompanyProject::with('plant') // Assegure-se de que a relação está correta.
->whereIn('plant_id', $allPlantsClient)
@ -444,8 +445,10 @@ public function reportingDataClient($clientID = null)
$clientID = Auth::user()->user_id;
}
$companyDetails = Company::where('company_id',$clientID)->first();
// Busca todas as Instalacoes com base no id do CLIENTE
$allPlantsClient = Plant::where('user_id', $clientID)->get();
$allPlantsClient = Plant::where('company_id', $companyDetails->company_id)->get();
// Extrai os plant_id da coleção $recevePlantClient
$plantsIds = $allPlantsClient->pluck('plant_id');

View File

@ -845,7 +845,7 @@ public function CreateNewEquipmentFromPendingEquipment(Request $request, $id)
public function processStep1(Request $request)
{
// dd($request);
dd($request);
//NAO DEVE SER CRIAR UMA NOVA EMPRESA NA CRIACAO DA OBRA (era uma boa ideia para facilitar ao Admin ter que criar a empresa para Depois a Obra, mas e necessario pelo facto da autentificao de 2 factores e envio e email , entao devido essa adicoes, nao preciso atualmente fazer sentido criar isto)
// Dito isto vamos sempre pensar que o Cliente ja deve estar criado , para ser feita uma Obra para o mesmo.
// dd($request);
@ -1146,7 +1146,6 @@ public function processStep2(Request $request)
// Inicializa o contador para ispt_number
$isptNumber = 1;
// Confirma que o arquivo foi enviado,ou seja sua existencia.
// Antes de verificar o documento excel, deve ter uma forma de confirmar o mesmo como arquivo legitivo para criar dados de acordo com o nosso template.
if ($file) {
@ -1218,12 +1217,10 @@ function normalize($value)
foreach ($data as $i => $dataLines) {
// Em cada um das linhas horizontais do excel, vai se guardar a 'key' vinculada ao valor do campo preenchido ou seja a 'key' vai ter o mesmo nome de um dos dados da tabela 'general_attributes_equipaments' na coluna : general_attributes_equipment_description, assim sendo mais facil implementar na tabela : specific_attributes_equipament_types
$joinArrays = array_combine($columnNames, $dataLines);
// vai guardar todos os campos de possiveis novos equipamentos, cada um em um array para multiplos inserts, na base de dados
$datas = array_filter($joinArrays, function ($chave) {
return !empty ($chave);
@ -1243,6 +1240,7 @@ function normalize($value)
->where('plant_id', $detailsCompanyProject->plant_id)
->first();
//Indentifica qual o tipo de equipamento selecionado de acordo com a tabela EquipmentType
$equipmentType = EquipmentType::where('equipment_type_name', $datas['equipment_type_name'])->first();
@ -1753,17 +1751,19 @@ public function storeProject(Request $request)
public function getByUserNif(Request $request)
{
// dd($request);
$companyId = $request->input('company_id'); // Considerando que este ID é na verdade o ID da empresa
// Busca as instalações associadas à empresa
// $installations = Plant::where('company_id', $companyId)->get();
$installations = Plant::where('company_id', $companyId)->get();
// Busca os usuários associados à empresa
$userIds = AssociationCompanyUser::where('company_id', $companyId)->pluck('user_id');
$users = User::whereIn('user_id', $userIds)->get();
return response()->json([
// 'installations' => $installations,
'installations' => $installations,
'users' => $users
]);
}

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\Company;
use App\Models\EquipmentWorkHistory;
use App\Models\Plant;
use App\Models\Unit;
@ -409,16 +410,6 @@ public function getDataEquipment1(Request $request)
}
public function enterWorkstation()
{
return view('workstations/index');
@ -429,12 +420,32 @@ public function receiveExecutionProject($ProjectId)
$DatasProject = CompanyProject::find($ProjectId);
$equipmentsTypes = EquipmentType::all();
$receivePlant = Plant::where('plant_id', $DatasProject->plant_id)->first();
$receiveCompany = Company::where('company_id', $receivePlant->company_id)->first();
// return view('projectsClients/executionProject')
return view('projectsClients/executionProjectNew')
->with('DatasProject', $DatasProject)
->with('equipmentsTypes', $equipmentsTypes);
->with('equipmentsTypes', $equipmentsTypes)
->with('receiveCompany', $receiveCompany);
}
public function changeFromExecutionToPlanning($projectID)
{
$receiveCompanyProject = CompanyProject::where('company_projects_id', $projectID)->first();
if ($receiveCompanyProject) {
$receiveCompanyProject->order_project = 1; // Supondo que 1 seja 'Planeamento'
$receiveCompanyProject->save();
return redirect()->route('articulated_2', ['projectID' => $receiveCompanyProject->company_projects_id])
->with('success', 'O projeto foi alterado para Planeamento.');
} else {
return back()->with('error', 'Projeto não encontrado.');
}
}
public function receiveWorkstationExecutionProject($receiveNumberProject)
{
$model = ConstructionWorkstation::where('company_projects_id', $receiveNumberProject)->with('workstationsAssociationTasks');

View File

@ -10,7 +10,7 @@ public function switchLanguage(Request $request)
{
$locale = $request->input('locale');
if (!in_array($locale, ['en', 'pt'])) {
if (!in_array($locale, ['pt', 'en'])) {
abort(400);
}

View File

@ -2,7 +2,9 @@
namespace App\Http\Controllers;
use App\Models\Company;
use App\Models\EquipmentWorkHistory;
use App\Models\Plant;
use App\Models\QrcodesAssociatedEquipment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@ -74,7 +76,6 @@ class PreparedProjectController extends Controller
public function showAllEquipmentsInProjectForQrCode($projectId)
{
$equipments = Equipment::where('company_projects_id', $projectId)->get();
$userLogoPath = Auth::user()->user_logo ? asset('user_logos/' . Auth::user()->user_logo) : asset('user_logos/logoISPT4.0.jpg');
$equipmentData = [];
foreach ($equipments as $equipment) {
@ -95,11 +96,22 @@ public function showAllEquipmentsInProjectForQrCode($projectId)
];
}
$detailsCompanyProject = CompanyProject::find($projectId);
$detailsPlant = Plant::where('plant_id', $detailsCompanyProject->plant_id)->first();
$detailsCompany= Company::where('company_id', $detailsPlant->company_id)->first();
$logoPath = public_path('companies_logo/' . ($detailsCompany->company_logo ?: 'logoISPT4.0.jpg'));
if (!file_exists($logoPath)) {
$logoPath = public_path('companies_logo/logoISPT4.0.jpg');
}
// dd($equipmentData);
$html = view('projectsClients.showAllEquipmentsInProjectQrCodePdf', [
'equipmentData' => $equipmentData,
'userLogoPath' => $userLogoPath
'logoPath' => $logoPath
])->render();
$mpdf = new \Mpdf\Mpdf([
@ -122,7 +134,17 @@ public function showDetailsEquipmentForQrCode($equipmentId, $projectId)
// Converte o QR Code para base64 para incorporar na página
$qrCodeImage = 'data:image/png;base64,' . base64_encode($writer->write($qrCode)->getString());
// $userLogoPath = Auth::user()->user_logo ? asset('user_logos/' . Auth::user()->user_logo) : asset('user_logos/logoISPT4.0.jpg');
$detailsCompanyProject = CompanyProject::find($projectId);
$detailsPlant = Plant::where('plant_id', $detailsCompanyProject->plant_id)->first();
$detailsCompany= Company::where('company_id', $detailsPlant->company_id)->first();
$logoPath = public_path('companies_logo/' . ($detailsCompany->company_logo ?: 'logoISPT4.0.jpg'));
if (!file_exists($logoPath)) {
$logoPath = public_path('companies_logo/logoISPT4.0.jpg');
}
$associatedEquipments = QrcodesAssociatedEquipment::where('equipment_id', $detailsEquipment->equipment_id)->get();
@ -133,7 +155,7 @@ public function showDetailsEquipmentForQrCode($equipmentId, $projectId)
$html = view('projectsClients.showDetailsEquipmentForQrCodePdf', [
'detailsEquipment' => $detailsEquipment,
// 'userLogoPath' => $userLogoPath,
'logoPath' => $logoPath,
'qrCodeImage' => $qrCodeImage,
'associatedArray' => $associatedArray
])->render();

View File

@ -4,6 +4,8 @@
use App\Models\AssociationCompanyUser;
use App\Models\Company;
use App\Models\CompanyProject;
use App\Models\Plant;
use App\Models\TypeUser;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
@ -27,6 +29,7 @@
class userController extends Controller
{
public function EditProfile(Request $request)
{
// Verifica se um arquivo foi enviado e se o tamanho é maior que 70 KB
@ -46,7 +49,6 @@ public function EditProfile(Request $request)
'nif' => 'required',
], $messages);
// dd($messages);
$user = User::find($request->userID);
@ -259,19 +261,113 @@ public function showCompany($id)
// Busca os detalhes dos usuários na tabela users usando os IDs coletados
$companyUsers = User::whereIn('user_id', $userIds)->get();
return view('Admin.CrudCompanies.showCompanyDetails', compact('company','companyUsers'));
// Para cada cliente, obtemos os plant_ids associados
$plantIds = Plant::where('company_id', $company->company_id)->pluck('plant_id');
// Contamos os CompanyProjects associados com datas de início e fim não nulas
$projectCount = CompanyProject::whereIn('plant_id', $plantIds)
->whereNotNull('date_started')
->whereNotNull('end_date')
->count();
return view('Admin.CrudCompanies.showCompanyDetails', compact('company', 'companyUsers', 'projectCount'));
}
public function createCompany(Request $request)
{
// Função interna para normalizar nomes de empresas
function normalize($value)
{
$trimmed = trim($value);
$noInnerSpaces = str_replace(' ', '', $trimmed);
$lowercase = strtolower($noInnerSpaces);
return $lowercase;
}
// Normaliza o nome da empresa recebido
$normalizedInputName = normalize($request->company_name);
// Verifica se já existe uma empresa com nome similar
$existingCompany = Company::whereRaw("LOWER(REPLACE(company_name, ' ', '')) = ?", [$normalizedInputName])->first();
if ($existingCompany) {
return back()->with('danger', 'Uma empresa com um nome similar já existe.');
}
$createCompany = new Company;
$createCompany->company_name = $request->company_name;
// Primeiro, verificamos se um arquivo foi enviado e se seu tamanho é maior que 70KB.
if ($request->hasFile('company_logo') && $request->file('company_logo')->getSize() > 71680) {
return back()->with('danger', 'O tamanho da imagem não deve ser maior que 70KB.');
}
// Processo para salvar a imagem, se tudo estiver ok
if ($request->hasFile('company_logo')) {
$imageName = time() . '.' . $request->company_logo->extension();
// Move o novo arquivo de imagem para o diretório
$request->company_logo->move(public_path('companies_logo'), $imageName);
$createCompany->company_logo = $imageName;
} else {
// Se nenhuma imagem foi enviada, atribuímos uma imagem padrão.
$createCompany->company_logo = 'logoISPT4.0.jpg';
}
$createCompany->save();
return redirect('CreateUsers')->with('status', 'A Empresa ' . $createCompany->company_name . ' foi criada com êxito. Consulte na página "Empresas".');
}
public function companyEdit(Request $request)
{
// Verifica se um arquivo foi enviado e se o tamanho é maior que 70 KB
if ($request->hasFile('company_logo') && $request->file('company_logo')->getSize() > 71680) {
return back()->with('danger', 'O tamanho da imagem não deve ser maior que 70KB, valores não alteradas.');
}
$messages = [
'user_logo.max' => 'O tamanho da imagem não deve ser maior que 70KB.',
];
$companyDetails = Company::find($request->companyId);
// Processo para salvar a imagem, se tudo estiver ok
if ($request->hasFile('company_logo')) {
$imageName = time() . '.' . $request->company_logo->extension();
// Verifica se o usuário já tem uma imagem e se é diferente da nova imagem
if ($companyDetails->company_logo && $companyDetails->company_logo != $imageName) {
// Constrói o caminho completo para o arquivo de imagem existente
$existingImagePath = public_path('companies_logo/' . $companyDetails->company_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->company_logo->move(public_path('companies_logo'), $imageName);
// Atualiza o campo user_logo do usuário com o nome do novo arquivo de imagem
$companyDetails->company_logo = $imageName;
$companyDetails->save();
return back()->with('success', 'Logo atualizado com sucesso!');
}
return back()->with('danger', 'Erro ao carregar a imagem.');
}
}

View File

@ -64,7 +64,8 @@ protected function getAllowedRoutesForUserType($userType)
//Api.s
'getDataAmbitsOfProject','getDataEquipmentsOfProject','getEquipmentsOfAmbit'];
case 2: // Administrador
return ['home',
return [
'home',
'createProject','processStep1','articulated_2',
'showAllClientsForProjectReports',
'manageAssets',
@ -76,6 +77,8 @@ protected function getAllowedRoutesForUserType($userType)
'articulated_2CreateEquipment','processStep2','deleteEquipmentInProject','changeAmbitEquipment',
'deletePendingEquipments','CreateNewEquipmentFromPendingEquipment','removeEquipment','receiveEquipmentToAssociateTasks',
'createCompany','ShowPendingUser','register','download','projectDetails_11','editEquipment','EditprocessStep1','createWorkStations','workstationsAssociationTasks','finishCreatingProject',
'preparedProject','EditProjectForArticulated','companyEdit','reportingDataClient','ExecutionProject',
'changeFromExecutionToPlanning',
];

View File

@ -83,7 +83,7 @@
|
*/
'locale' => 'en',
'locale' => 'pt',
/*
|--------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,6 +1,32 @@
@extends('Templates/templateAdmin')
@section('Main-content')
@if (session('success'))
<div class="alert alert-info" role="alert" id="alert-message-success" style="transition: opacity 1s;">
{{ session('danger') }}
</div>
<script>
setTimeout(function() {
$('#alert-message-success').fadeOut('slow', function() {
$(this).remove();
});
}, 5000); // A mensagem desaparecerá após 5 segundos
</script>
@endif
@if (session('danger'))
<div class="alert alert-success" role="alert" id="alert-message-success" style="transition: opacity 1s;">
{{ session('danger') }}
</div>
<script>
setTimeout(function() {
$('#alert-message-success').fadeOut('slow', function() {
$(this).remove();
});
}, 5000); // A mensagem desaparecerá após 5 segundos
</script>
@endif
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
@ -31,10 +57,139 @@
<div class="card-body">
<div class="card card-success">
<div class="card-header">Detalhes da Empresa</div>
<div class="card-header">{{ $company->company_name }}</div>
<div class="card-body">
Foto da Empresa
Qtd de Obras
<!-- Bordered Tabs -->
<ul class="nav nav-tabs nav-tabs-bordered">
<li class="nav-item">
<button class="nav-link active" data-bs-toggle="tab"
data-bs-target="#company-overview">Detalhes</button>
</li>
<li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#company-edit">Editar
Empresa
</li>
</ul>
<div class="tab-content pt-2">
<div class="tab-pane fade show active company-overview pt-3" id="company-overview">
<div class="row">
<div class="col-sm">
<div class="card mx-auto mt-4" style="width: 18rem;">
<div class="card-body ">
<img class="card-img img-fluid" style="max-width: 250px; height: auto;"
src="{{ asset('companies_logo/' . ($company->company_logo ?? 'logoISPT4.0.jpg')) }}"
alt="Company Logo">
</div>
</div>
</div><!-- col-sm -->
<div class="col-sm">
{{-- Criar um numero real --}}
<p>Qtd de Obra Concluidas : {{$projectCount}}</p>
<a href="{{route('reportingDataClient',['clientID' => $company->company_id])}}" class="btn btn-success">Visualizar Obras da empresa</a>
</div><!-- col-sm -->
</div><!-- row -->
{{-- <p>Logo empresa</p>
<img class="img-fluid" style="max-width: 250px; height: auto;"
src="{{ asset('companies_logo/' . ($company->company_logo ?? 'logoISPT4.0.jpg')) }}"
alt="Company Logo">
--}}
{{-- <img src="{{ asset('storage/' . $company->company_logo) }}" alt="Company Logo" style="width:200px; height:200px;"> --}}
{{-- <div class="row">
<label class="col-lg-3 col-md-4 ">
{{ __('messages.profile.show_profile.full_name') }} </label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->user_name }}</div>
</div>
<div class="row">
<label class="col-lg-3 col-md-4">
{{ __('messages.profile.show_profile.nif') }} </label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->user_nif }}</div>
</div>
<div class="row">
<label class="col-lg-3 col-md-4">
{{ __('messages.profile.show_profile.email_address') }} </label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->email }}</div>
</div>
<div class="row">
<label class="col-lg-3 col-md-4">
{{ __('messages.profile.show_profile.user_type') }} </label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->userType->type_user }}</div>
</div>
<div class="row">
<label class="col-lg-3 col-md-4">
{{ __('messages.profile.show_profile.mobile_phone') }} </label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->user_phone }}</div>
</div>
<div class="row">
<label class="col-lg-3 col-md-4">
{{ __('messages.profile.show_profile.account_creation_date') }}
</label>
<div class="col-lg-9 col-md-8 text-center mb-2">{{ $user->created_at }}</div>
</div> --}}
</div>
<div class="tab-pane fade company-edit pt-3" id="company-edit">
<form action="{{ route('companyEdit') }}" method="POST" enctype="multipart/form-data">
@csrf
{{-- Deve enviar o id da empresa junto --}}
<input type="hidden" name="companyId" value="{{ $company->company_id }}">
<div class="row mb-3">
<div class="row mb-3">
<label for="company_logo" class="col-md-5 col-lg-5 form-label">
Carregar Nova Logo
</label>
<div class="custom-file col-md-7 col-lg-7">
<input type="file" class="custom-file-input" id="company_logo"
name="company_logo" accept="image/*">
<label class="custom-file-label" for="customFile">
{{ __('messages.profile.edit_profile.image') }} : Max(70kb)
</label>
</div>
</div>
</div>
<!-- row -->
<button class="btn btn-danger" type="submit">Enviar</button>
</form>
</div>
</div><!-- End Bordered Tabs -->
</div>
</div>

View File

@ -243,9 +243,8 @@ class="fas fa-bars"></i></a>
class="form-inline">
@csrf
<select class="custom-select" name="locale" onchange="this.form.submit()">
<option value="pt" {{ app()->getLocale() == 'pt' ? 'selected' : '' }}>Português </option>
<option value="en" {{ app()->getLocale() == 'en' ? 'selected' : '' }}>English</option>
<option value="pt" {{ app()->getLocale() == 'pt' ? 'selected' : '' }}>Português
</option>
</select>
</form>
</li>

View File

@ -7,6 +7,21 @@
</div>
@endif
@if (session('danger'))
<div class="content">
<div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
{{ session('danger') }}
</div>
</div>
<script>
setTimeout(function() {
$('#alert-message-danger').fadeOut('slow', function() {
$(this).remove();
});
}, 10000); // A mensagem desaparecerá após 10 segundos
</script>
@endif
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
@ -69,26 +84,45 @@ class="btn btn-light">{{ __('messages.pendingUsers.submit') }}</button>
</div>
<div class="card-body">
<form action="{{ route('createCompany') }}" method="post">
<form action="{{ route('createCompany') }}" method="post" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-sm-8">
<div class="col-sm mb-2">
<div class="input-group-prepend">
<span class="input-group-text" id="form-tagEquipment">
<i class="fa fa-building" style="color: #00B0EA;"></i>
<i class="fa fa-building" style="color: #00B0EA;" data-toggle="tooltip"
title="Nome Empresa"></i>
</span>
<div class="has-float-label">
<input type="text" name="company_name" class="form-control card_inputs" id="company_name"
placeholder="Nome da empresa..." aria-label="Tag Equipment"
aria-describedby="form-tagEquipment">
<input type="text" name="company_name" class="form-control card_inputs"
id="company_name" placeholder="Nome da empresa..." aria-label="Tag Equipment"
aria-describedby="form-tagEquipment" required>
</div>
</div>
</div>
<div class="col-sm-4 text-center">
<button type="submit"
class="btn btn-light">Criar Empresa</button>
<div class="col-sm mb-2">
<div class="input-group-prepend">
<span class="input-group-text" id="form-tagEquipment">
<i class="fa-regular fa-image" style="color: #00B0EA;" data-toggle="tooltip"
title="(Opcional)Add Logo"></i>
</span>
<div class="custom-file col-md col-lg">
<input type="file" class="custom-file-input" id="company_logo"
name="company_logo" accept="image/*">
<label class="custom-file-label" for="customFile">
{{ __('messages.profile.edit_profile.image') }} : Max(70kb)
</label>
</div>
</div>
</div>
<div class="col-sm text-right mb-2">
<button type="submit" class="btn btn-light">Criar Empresa</button>
</div>
</div>
</form>
</div>
{{-- /.card-body --}}
@ -146,4 +180,10 @@ class="fa-solid fa-eye text-primary"></i></a></td>
}).buttons().container().appendTo('#tableReceiveAllPendingUsers_wrapper .col-md-6:eq(0)');
});
</script>
<script>
$(function() {
$('[data-toggle="tooltip"]').tooltip();
})
</script>
@endsection

View File

@ -97,15 +97,15 @@ class="fas fa-plus"></i></button>
@break
@case(1)
Linhas duplicadas no Excel
Linhas duplicadas no Excel (Criado pendentes)
@break
@case(2)
Referente a equipamentos ja existentes
Referente a equipamentos ja existentes (Nenhum dado criado)
@break
@case(3)
Equipamentos Novos
Equipamentos Novos (Criado novos equipamentos)
@break

View File

@ -67,9 +67,6 @@
<div class="form-group col-sm-6">
<label>{{ __('messages.createProject.ispt_project_number') }}<b
style="color:red">*</b></label>
{{-- <input type="number" name="n_project_ispt" class="form-control"
placeholder="{{ __('messages.createProject.ispt_project_number') }}&hellip;"
required> --}}
<input type="number" name="n_project_ispt" class="form-control" data-type="ispt"
placeholder="{{ __('messages.createProject.ispt_project_number') }}&hellip;"
required>
@ -101,27 +98,19 @@
<div class="row">
<!-- Gestor de Projeto da Empresa -->
{{-- <div class="form-group col-sm" id="companyProjectManager" >
<label>{{ __('messages.createProject.compan_project_manager') }} <b
style="color:red">*</b></label>
<input type="text" name="responsible_project_company" class="form-control"
placeholder="{{ __('messages.createProject.compan_project_manager') }}&hellip;"
required>
</div> --}}
<div class="form-group col-sm" id="companyProjectManager">
<label>{{ __('messages.createProject.compan_project_manager') }}
<b style="color:red">*</b></label>
<label for="user_id">{{ __('messages.createProject.compan_project_manager') }}<b style="color:red">*</b></label>
<select class="form-control" name="user_id" id="user_id" required>
<option value="#" disabled selected>Select a manager</option>
<!-- As opções de instalação serão preenchidas dinamicamente -->
</select>
</div>
<!-- Instalação -->
<div class="form-group col-sm" id="installationField">
<label>{{ __('messages.createProject.select_plant.plant') }} <b
style="color:red">*</b></label>
<select class="form-control" name="installation_id" id="installationSelect"
required>
<select class="form-control" name="installation_id" id="installationSelect" required>
<!-- As opções de instalação serão preenchidas dinamicamente -->
</select>
</div>
@ -173,9 +162,7 @@
<div class="form-group col-sm-6">
<label>{{ __('messages.createProject.company_project_number') }}<b
style="color:red">*</b></label>
{{-- <input type="number" name="project_company_number" class="form-control"
placeholder="{{ __('messages.createProject.company_project_number') }}&hellip;"
required> --}}
<input type="number" name="project_company_number" class="form-control"
data-type="company"
placeholder="{{ __('messages.createProject.company_project_number') }}&hellip;"
@ -185,11 +172,9 @@
<!-- Data de Início do Projeto -->
<div class="form-group col-sm-6">
<label>{{ __('messages.createProject.project_start_date') }} : <b
style="color:red">*</b></label>
<label>{{ __('messages.createProject.project_start_date') }} : <b style="color:red">*</b></label>
<div class="input-group">
<input name="date_started" type="datetime-local"
class="form-control float-right" required>
<input name="date_started" type="datetime-local" class="form-control float-right" required min="{{ now()->format('Y-m-d\TH:i') }}">
</div>
<!-- /.input group -->
</div>
@ -496,7 +481,7 @@ function updateSubmitButtonState() {
// Busca dados combinados de gestores e instalações
$.get('/api/installations?company_id=' + companyId, function(response) {
console.log(response);
response.users.forEach(function(user) {
userManagerSelect.append('<option value="' + user.user_id + '">' +
user.user_name + '</option>');

View File

@ -30,6 +30,11 @@
<div class="col-md-12">
<div class="row">
<div class="col-sm" id="ViewDetailsButton">
<a href="#" type="button" class="btn btn-block bg-primary btn-lg"
style="margin-bottom: 2%;">Detalhes</a>
</div>
<div class="col-sm" id="ViewEquipmentsButton">
<a href="#" type="button" class="btn btn-block bg-primary btn-lg"
style="margin-bottom: 2%;"> Equipamentos</a>
@ -38,12 +43,90 @@
<a href="#" type="button" class="btn btn-block bg-primary btn-lg"
style="margin-bottom: 2%;">Tarefas</a>
</div>
{{-- <div class="col-sm" id="ViewWorkstationButton">
<a href="#" type="button" class="btn btn-block bg-primary btn-lg"
style="margin-bottom: 2%;">Postos de Trabalho</a>
</div> --}}
</div>
<div class="card card-primary" id="CardViewDetails">
<div class="card-header">
<h3 class="text-center">Detalhes da Obra</h3>
</div>
<div class="card-body p-0">
<table class="table table-striped text-center">
<tbody>
<tr>
<td>Descrição da obra:</td>
<td>{{ $DatasProject->company_project_description }}</td>
</tr>
<tr>
<td>N.º obra ISPT:</td>
<td>{{ $DatasProject->project_ispt_number }}</td>
</tr>
<tr>
<td>Resp.ISPT:</td>
<td>{{ $DatasProject->project_ispt_responsible }}</td>
</tr>
<tr>
<td>Empresa :</td>
<td>{{ $receiveCompany->company_name }}</td>
</tr>
<tr>
<td>Resp.Cliente:</td>
{{-- <td>{{ $DatasProject->project_company_responsible }}</td> --}}
<td>Yuri Empresa Teste</td>
</tr>
<tr>
<td>N.º obra Cliente :</td>
<td>{{ $DatasProject->project_company_number }}</td>
</tr>
</tbody>
</table>
<div class="row m-3">
<div class="ml-auto">
<button class="btn btn-info" data-toggle="modal" data-target="#exampleModal">Adicionar
equipamentos a Obra</button>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Alterar para planeamento?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Ao optar por adicionar equipamentos, a fase do projeto será modificada para
'Planeamento', impossibilitando o acompanhamento do estado atual dos
equipamentos até que o projeto retorne à fase de 'Execução'.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal">Fechar</button>
<form action="{{ route('changeFromExecutionToPlanning', ['projectID' => $DatasProject->company_projects_id]) }}" method="post">
@csrf
<button type="submit" class="btn btn-primary">Alterar para Planeamento</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<div class="card card-primary" id="CardViewEquipments">
<div class="card-header">
<h3 class="card-title">Equipamentos</h3>
@ -107,6 +190,7 @@
$("#ViewEquipmentsButton").hide();
$("#CardViewTasks").hide();
$("#CardViewWorkstations").hide();
$("#CardViewDetails").hide();
//Visualizacao das Tarefas
$("#ViewTasksButton").on('click', function() {
@ -114,7 +198,9 @@
$("#CardViewTasks").show();
$("#ViewEquipmentsButton").show();
$("#ViewWorkstationButton").show();
$("#ViewDetailsButton").show();
$("#CardViewDetails").hide();
$("#CardViewEquipments").hide();
$("#CardViewWorkstations").hide();
$("#ViewTasksButton").hide();
@ -124,9 +210,12 @@
$("#ViewEquipmentsButton").on('click', function() {
$("#CardViewEquipments").show();
$("#ViewTasksButton").show();
$("#ViewWorkstationButton").show();
$("#ViewDetailsButton").show();
$("#CardViewDetails").hide();
$("#CardViewTasks").hide();
$("#CardViewWorkstations").hide();
$("#ViewEquipmentsButton").hide();
@ -138,11 +227,30 @@
$("#CardViewWorkstations").show();
$("#ViewEquipmentsButton").show();
$("#ViewTasksButton").show();
$("#ViewDetailsButton").show();
$("#CardViewDetails").hide();
$("#CardViewEquipments").hide();
$("#CardViewTasks").hide();
$("#ViewWorkstationButton").hide();
})
$("#ViewDetailsButton").on('click', function() {
$("#CardViewDetails").show();
$("#ViewDetailsButton").hide();
$("#ViewEquipmentsButton").show();
$("#ViewTasksButton").show();
$("#ViewWorkstationButton").show();
$("#CardViewWorkstations").hide();
$("#CardViewEquipments").hide();
$("#CardViewTasks").hide();
})
});
</script>
@endsection

View File

@ -32,6 +32,7 @@
<input type="hidden" name="projectId" value="{{ $projects->company_projects_id }}">
<input type="hidden" name="statusProject" value="edit">
<div class="row">
<div class="form-group col-sm-6">
<label>Descrição da obra</label>
@ -166,7 +167,7 @@
</span>
</div>
<input name="date_started" type="datetime-local"
class="form-control float-right">
class="form-control float-right" min="{{ now()->format('Y-m-d\TH:i') }}">
</div>
<!-- /.input group -->
</div>

View File

@ -163,7 +163,7 @@
alt="Logo Esquerdo">
</div>
<div class="col2-img col-2-img">
<img class="img-istp" src="{{ public_path('/img/ispt/4.0/isptLogoVertical.png') }}"
<img class="img-istp" src="{{ $logoPath }}"
alt="Logo Esquerdo">
</div>
</div>

View File

@ -163,8 +163,9 @@
<img class="img-company" src="{{ public_path('/img/ispt/4.0/galpLogo1.png') }}" alt="Logo Esquerdo">
</div>
<div class="col2-img col-2-img">
<img class="img-istp" src="{{ public_path('/img/ispt/4.0/isptLogoVertical.png') }}"
alt="Logo Esquerdo">
{{-- <img class="img-istp" src="{{ public_path('/img/ispt/4.0/isptLogoVertical.png') }}"
alt="Logo Esquerdo"> --}}
<img class="img-istp" src="{{ $logoPath }}" alt="Logo da Empresa">
</div>
</div>
</div>

View File

@ -47,8 +47,11 @@
Route::get('/checkProjectIsptNumber/{projectId?}', [ProjectoDatacontroller::class, 'checkProjectIsptNumber'])->name('checkProjectIsptNumber');
Route::post('deletePendingEquipments', [CreateProjectController::class, 'deletePendingEq
uipments'])->name('deletePendingEquipments');
Route::post('deletePendingEquipments', [
CreateProjectController::class,
'deletePendingEq
uipments'
])->name('deletePendingEquipments');
@ -71,6 +74,7 @@
// Nao gosto que esteja neste controller, verificar mais tarde
Route::get('articulated_2/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'projectDetails_11'])->name('projectDetails_11');
Route::get('manageAssets/{equipmentID}', [ProjectoDatacontroller::class, 'articulated_22'])->name('articulated_22');
Route::get('showAmbitDetailsProjectHistory/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'showAmbitDetailsProjectHistory'])->name('showAmbitDetailsProjectHistory');
@ -209,6 +213,7 @@
Route::get('company/{id}', 'showCompany')->name('showCompany');
Route::post('createCompany', 'createCompany')->name('createCompany');
Route::post('companyEdit', 'companyEdit')->name('companyEdit');
});
Route::post('editEquipmentTasks/{equipmentID}/{projectId}', [ProjectoDatacontroller::class, 'editEquipmentTasks'])->name('editEquipmentTasks');
@ -268,6 +273,9 @@
Route::get('ExecutionProject/{projectID}', [ExecutionProjectController::class, 'receiveExecutionProject'])->name('ExecutionProject');
Route::get('/ReceiveEquipmentIdForShowModal/{EquipmentID}', [ExecutionProjectController::class, 'receiveEquipmentIdForShowModal'])->name('ReceiveEquipmentIdForShowModal ');
Route::post('/changeFromExecutionToPlanning/{projectID}', [ExecutionProjectController::class, 'changeFromExecutionToPlanning'])->name('changeFromExecutionToPlanning');
//Gerir os Ativos gerais