Implementation of structure for creation of the work
This commit is contained in:
parent
3db065ae53
commit
d83552e106
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
@ -18,12 +16,463 @@
|
||||||
use App\Models\SpecificAttributesEquipmentType;
|
use App\Models\SpecificAttributesEquipmentType;
|
||||||
use App\Models\GeneralAttributesEquipment;
|
use App\Models\GeneralAttributesEquipment;
|
||||||
use App\Models\PendingEquipment;
|
use App\Models\PendingEquipment;
|
||||||
|
use App\Models\AmbitsEquipment;
|
||||||
|
use App\Models\EquipmentAssociationAmbit;
|
||||||
|
|
||||||
|
|
||||||
class CreateProjectController extends Controller
|
class CreateProjectController extends Controller
|
||||||
{
|
{
|
||||||
|
// Funcao apenas para retornar os dados necessarios para a view criar uma Obra.
|
||||||
|
public function createProjectForStep1(){
|
||||||
|
$companies = User::where('type_users', 3)->get();
|
||||||
|
|
||||||
// Nao vinculado ao project ainda
|
// Apos terminar nao vai ficar step 1
|
||||||
|
return view('projectsClients/createProject', ['step' => 1], ['companies' => $companies]);
|
||||||
|
}
|
||||||
|
// Progress Bar
|
||||||
|
//Devolve para a primeira para na descricao do projecto apenas user com ID 3, quer dizer que apenas as "empresas"
|
||||||
|
public function showStep1($company_projects_id)
|
||||||
|
{
|
||||||
|
$projects = CompanyProject::find($company_projects_id);
|
||||||
|
$companies = User::where('type_users', 3)->get();
|
||||||
|
|
||||||
|
return view('projectsClients/projectDetails_1', ['step' => 1], ['companies' => $companies])
|
||||||
|
->with('projects',$projects);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se forem alterados dados dos Detalhes da Obra, vai ser alterado
|
||||||
|
public function EditprocessStep1(Request $request){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePendingEquipment($id){
|
||||||
|
$equipment = PendingEquipment::findOrFail($id);
|
||||||
|
$equipment->delete();
|
||||||
|
return back()->with('success', 'Equipamento pendente removido com sucesso!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function CreateNewEquipmentFromPendingEquipment(Request $request, $id){
|
||||||
|
$checkPendingEquipment = PendingEquipment::findOrFail($id);
|
||||||
|
|
||||||
|
$counter = 2;
|
||||||
|
$baseTag = $checkPendingEquipment->pending_equipment_tag;
|
||||||
|
$baseDescription = $checkPendingEquipment->pending_equipment_description;
|
||||||
|
|
||||||
|
// Ciclo para verificar se ja existe um equipamento com o mesmo nome se existir vai criando com o contador iniciado a partir de (2)
|
||||||
|
while (Equipment::where('equipment_tag', $baseTag . "({$counter})")->orWhere('equipment_description', $baseDescription . "({$counter})")->exists()) {
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newEquipment = new Equipment;
|
||||||
|
$newEquipment->unit_id = $checkPendingEquipment->pending_equipment_unit_id;
|
||||||
|
$newEquipment->equipment_type_id = $checkPendingEquipment->pending_equipment_type_id;
|
||||||
|
$newEquipment->equipment_tag = $baseTag . "({$counter})";
|
||||||
|
$newEquipment->equipment_description = $baseDescription . "({$counter})";
|
||||||
|
$newEquipment->equipment_serial_number = $checkPendingEquipment->pending_equipment_serial_number;
|
||||||
|
$newEquipment->equipment_brand = $checkPendingEquipment->pending_equipment_brand;
|
||||||
|
$newEquipment->equipment_model = $checkPendingEquipment->pending_equipment_model;
|
||||||
|
$newEquipment->company_projects_id = $checkPendingEquipment->pending_company_projects_id;
|
||||||
|
$newEquipment->save();
|
||||||
|
|
||||||
|
$receiveEquipmentID = $newEquipment->equipment_id;
|
||||||
|
|
||||||
|
$newEquipmentAssociationAmbits = new EquipmentAssociationAmbit;
|
||||||
|
$newEquipmentAssociationAmbits->equipment_type_id = $newEquipment->equipment_type_id;
|
||||||
|
$newEquipmentAssociationAmbits->ambits_id = $request->EquipmentAmbit;
|
||||||
|
$newEquipmentAssociationAmbits->equipment_id = $receiveEquipmentID;
|
||||||
|
$newEquipmentAssociationAmbits->save();
|
||||||
|
|
||||||
|
$checkPendingEquipment->delete();
|
||||||
|
|
||||||
|
return back()->with('success', 'Equipamento '.$newEquipment->equipment_tag.' criado com sucesso');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function processStep1(Request $request)
|
||||||
|
{
|
||||||
|
// Validação...
|
||||||
|
$installationId = $request->input('installation_id');
|
||||||
|
|
||||||
|
if ($installationId == 'new_install') {
|
||||||
|
|
||||||
|
// Criar uma nova instalação...
|
||||||
|
$newInstallation = new Plant;
|
||||||
|
|
||||||
|
$newInstallation->plant_name = $request->input('new_company_name');
|
||||||
|
$newInstallation->plant_address = $request->input('new_company_address');
|
||||||
|
$newInstallation->user_id = $request->input('user_id');
|
||||||
|
|
||||||
|
// $newInstallation->save();
|
||||||
|
|
||||||
|
// Use o id da nova instalação.
|
||||||
|
$installationId = $newInstallation->plant_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$project = new CompanyProject;
|
||||||
|
|
||||||
|
$project->company_project_description = $request->input('description_project');
|
||||||
|
$project->project_ispt_number = $request->input('n_project_ispt');
|
||||||
|
$project->project_company_number = $request->input('project_company_number');
|
||||||
|
$project->project_ispt_responsible = $request->input('responsible_project_ispt');
|
||||||
|
$project->project_company_responsible = $request->input('responsible_project_company');
|
||||||
|
$project->date_started = $request->input('date_started');
|
||||||
|
|
||||||
|
$project->plant_id = $installationId;
|
||||||
|
|
||||||
|
$project->save();
|
||||||
|
|
||||||
|
session(['form_data.step1' => $request->all()]);
|
||||||
|
|
||||||
|
// // Redirecione o usuário para a próxima etapa
|
||||||
|
// return redirect('/test2')
|
||||||
|
// ->with('project', $project)
|
||||||
|
// ->with('success', 'Dados guardados com sucesso');
|
||||||
|
return redirect()->route('test2', ['id' => $project->company_projects_id])
|
||||||
|
->with('success', 'Detalhes, Projecto criado com sucesso');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showStep2($company_projects_id)
|
||||||
|
{
|
||||||
|
// Verifique se a etapa 1 foi concluída
|
||||||
|
|
||||||
|
// if (!session('form_data.step1')) {
|
||||||
|
// return redirect('/createProject');
|
||||||
|
// }
|
||||||
|
|
||||||
|
//recebe o Id de Plant vai devolver todos os equipamentos relacionados a esta instalacao(plant)
|
||||||
|
// Carregue o projeto com o id fornecido
|
||||||
|
$project = CompanyProject::find($company_projects_id);
|
||||||
|
|
||||||
|
$numberProject = $project->company_projects_id;
|
||||||
|
|
||||||
|
$typeEquipments = EquipmentType::all();
|
||||||
|
|
||||||
|
//Retorna todas as Fabricas Unit, com base na instalacao
|
||||||
|
$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', '=', $company_projects_id)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
//Retorna todos os Equipamentos, com base na instalcao do projecto
|
||||||
|
$checkEquipments = DB::table('equipments')
|
||||||
|
->join('units', 'equipments.unit_id', '=', 'units.unit_id')
|
||||||
|
->join('plants', 'units.plant_id', '=', 'plants.plant_id')
|
||||||
|
->select('equipments.*') // Seleciona todas as colunas da tabela 'equipments'
|
||||||
|
->where('plants.plant_id', '=', $project['plant_id']) // Filtra baseado no 'plant_id'
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Para listar os equipamentos vinculados na obra, buscamos suas associações gerais entre suas tabelas , ou seja a : fabrica(unit), tipo de equipamento e o Ambito para se realizar a tarefas pretendida neste obra.
|
||||||
|
// $listEquipmentsProjects = Equipment::with(['unit', 'equipmentType', 'equipmentAssociationAmbit.ambitsEquipment'])
|
||||||
|
// ->where('company_projects_id', $company_projects_id)
|
||||||
|
// ->get();
|
||||||
|
$listEquipmentsProjects = Equipment::with(['unit', 'equipmentType', 'equipmentAssociationAmbit.ambitsEquipment', 'specificAttributes' => function ($query) {
|
||||||
|
$query->orderBy('specific_attributes_value', 'asc');
|
||||||
|
}])
|
||||||
|
->where('company_projects_id', $company_projects_id)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $numberProject)->get();
|
||||||
|
|
||||||
|
if (!$pendingEquipments->isEmpty()) {
|
||||||
|
// Retornamos para a view 'step' => 2 indicando conclusao da primeira parte, $numberProject para associacao de equipamentos a esta obra, alem de todos os equipamentos e fabricao ja existente com base na instalacao que se iniciou a obra.
|
||||||
|
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||||
|
->with('danger', 'Equipamentos Pendentes: ' . count($pendingEquipments))
|
||||||
|
->with('pendingEquipments', $pendingEquipments)
|
||||||
|
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
||||||
|
->with('typeEquipments', $typeEquipments)
|
||||||
|
->with('checkEquipments', $checkEquipments)
|
||||||
|
->with('checkUnits', $checkUnits);
|
||||||
|
}
|
||||||
|
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||||
|
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
||||||
|
->with('typeEquipments', $typeEquipments)
|
||||||
|
->with('checkEquipments', $checkEquipments)
|
||||||
|
->with('checkUnits', $checkUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createEquipmentManual(Request $request)
|
||||||
|
{
|
||||||
|
// EquipmentAmbit
|
||||||
|
// *** Recebe a Instalacao(Plant), com base no numero da Obra Criada
|
||||||
|
$receivePlant = DB::table('plants')
|
||||||
|
->join('company_projects', 'company_projects.plant_id', 'plants.plant_id')
|
||||||
|
->select('plants.plant_id')
|
||||||
|
->where('company_projects.company_projects_id', '=', $request->numberProject)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
//recebe a lista de todos os equipmentos relacionados a obra que se esta a criar.
|
||||||
|
$listEquipmentsProjects = DB::table('equipments')
|
||||||
|
->select('equipments.*')
|
||||||
|
->where('equipments.company_projects_id', '=', $request->numberProject)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Verifica se ja existe um equipamento com as as caracteristicas : tag,unit_id, iguais ao que pretendemos criar
|
||||||
|
$existingEquipment = Equipment::firstWhere([
|
||||||
|
'equipment_tag' => $request->tag,
|
||||||
|
'unit_id' => $request->unit_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($existingEquipment) {
|
||||||
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
->with('danger', 'Equipamento ja Existe !!')
|
||||||
|
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se realmente for um equipamento novo, verifica se ira associar a uma fabrica (unit) nova ou ja existente
|
||||||
|
$newEquipmentProject = new Equipment;
|
||||||
|
|
||||||
|
// Se for uma fabrica(Unit) existente
|
||||||
|
if ($request->new_unit_name == null) {
|
||||||
|
$newEquipmentProject->unit_id = $request->unit_id;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//ja retorna se for uma fabrica nova (Unit)
|
||||||
|
$newUnit = new Unit;
|
||||||
|
$newUnit->unit_name = $request->new_unit_name;
|
||||||
|
$newUnit->plant_id = $receivePlant[0]->plant_id;
|
||||||
|
$newUnit->save();
|
||||||
|
|
||||||
|
$newEquipmentProject->unit_id = $newUnit->unit_id;
|
||||||
|
}
|
||||||
|
$newEquipmentProject->equipment_type_id = $request->equipmentTypeId;
|
||||||
|
$newEquipmentProject->equipment_tag = $request->tag;
|
||||||
|
$newEquipmentProject->equipment_description = $request->equipmentDescription;
|
||||||
|
|
||||||
|
// Estes campos a baixo : podem ter valor ou nao
|
||||||
|
$newEquipmentProject->equipment_serial_number = $request->serialNumberEquipment ?? NULL;
|
||||||
|
$newEquipmentProject->equipment_brand = $request->equipmentBrand ?? NULL;
|
||||||
|
$newEquipmentProject->equipment_model = $request->equipmentModel ?? NULL;
|
||||||
|
|
||||||
|
$newEquipmentProject->company_projects_id = $request->numberProject;
|
||||||
|
$newEquipmentProject->save();
|
||||||
|
|
||||||
|
// ID do equipamento criado
|
||||||
|
$equipmentID = $newEquipmentProject->equipment_id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Verifica os campos do Card_do tipo de valvula selecionado (Ex: psv_card) e de acordo com os campos preenchidos se for de atributos especificos, ele compara o 'name' dos inputs com os 'general_attributes_equipment_description' da tabela : GeneralAttributesEquipment e associa
|
||||||
|
$checkAtributs = GeneralAttributesEquipment::whereIn('general_attributes_equipment_description', array_keys($request->all()))
|
||||||
|
->pluck('general_attributes_equipment_id', 'general_attributes_equipment_description')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
// Recebe esta associacao, e cria um array para cada 'name'(inputs) igual ao 'general_attributes_equipment_description', contanto que seu valor(input) seja diferente de *NULL, assim o "$receivesAssociationAttributes" recebe o id de acordo com a tabela , o nome de acordo com a tabela e o valor do $request recebido associado ao campo
|
||||||
|
$receivesAssociationAttributes = [];
|
||||||
|
foreach ($checkAtributs as $description => $id) {
|
||||||
|
if ($request[$description] !== null) {
|
||||||
|
$receivesAssociationAttributes[] = [
|
||||||
|
'general_attributes_equipment_id' => $id,
|
||||||
|
'general_attributes_equipment_description' => $description,
|
||||||
|
'value' => $request[$description]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Para cada um dos Arrays criados acima, vai criar os novos dados na tabela 'SpecificAttributesEquipmentType'
|
||||||
|
foreach ($receivesAssociationAttributes as $receivesAssociationAttribute) {
|
||||||
|
$AddAtributsEquipments = new SpecificAttributesEquipmentType;
|
||||||
|
$AddAtributsEquipments->equipment_id = $equipmentID;
|
||||||
|
$AddAtributsEquipments->equipment_type_id = $request->equipmentTypeId;
|
||||||
|
$AddAtributsEquipments->specific_attributes_equipment_type_id = $receivesAssociationAttribute['general_attributes_equipment_id'];
|
||||||
|
$AddAtributsEquipments->specific_attributes_value = $receivesAssociationAttribute['value'];
|
||||||
|
$AddAtributsEquipments->save();
|
||||||
|
}
|
||||||
|
//Criar associacao do equipamento ao Ambito
|
||||||
|
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
||||||
|
$AssociationEquipmentAmbit->equipment_type_id = $request->equipmentTypeId;
|
||||||
|
$AssociationEquipmentAmbit->ambits_id = $request->EquipmentAmbit;
|
||||||
|
$AssociationEquipmentAmbit->equipment_id = $equipmentID;
|
||||||
|
$AssociationEquipmentAmbit->save();
|
||||||
|
|
||||||
|
|
||||||
|
// O $request->numberProject e sempre necessario retornar para indicar a obra que se esta modificando...
|
||||||
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
->with('success', 'Equipamento criado com sucesso')
|
||||||
|
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||||
|
}
|
||||||
|
public function receiveIdEquipment(Equipment $equipment){
|
||||||
|
// return response()->json($equipment);
|
||||||
|
return view('projectsClients/articulated_2', ['equipment' => $equipment]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processStep2(Request $request)
|
||||||
|
{
|
||||||
|
// Valide e processe os dados do formulário
|
||||||
|
$file = $request->file('documento');
|
||||||
|
|
||||||
|
// Recebe a id do Projecto criado
|
||||||
|
$company_projects_id = $request->numberProject;
|
||||||
|
|
||||||
|
// Certifique-se de que um arquivo foi enviado
|
||||||
|
if ($file) {
|
||||||
|
// Carregue o arquivo Excel
|
||||||
|
$spreadsheet = IOFactory::load($file->path());
|
||||||
|
|
||||||
|
// Obtenha a primeira planilha, onde fica os nomes chaves para associar a tabela : general_attributes_equipaments
|
||||||
|
$worksheet = $spreadsheet->getSheet(0);
|
||||||
|
|
||||||
|
// Transforme os dados da planilha em um array
|
||||||
|
$data = $worksheet->toArray();
|
||||||
|
|
||||||
|
// Retorna um array com todos os names preenchidos na primeira linha do template de Excel
|
||||||
|
$nomesColunas = $data[0];
|
||||||
|
|
||||||
|
$countPendingEquipments = 0;
|
||||||
|
$countNewEquipment = 0;
|
||||||
|
|
||||||
|
// Comece a partir da sexta linha
|
||||||
|
for ($i = 6; $i < count($data); $i++) {
|
||||||
|
|
||||||
|
$dadosLinha = $data[$i];
|
||||||
|
|
||||||
|
// Verifica se os 5 primeiros campos essenciais estao preenchidos, um deles nao estiver preenchido ele ignora e nao cria o equipamento
|
||||||
|
$isEmpty = false;
|
||||||
|
for ($j = 0; $j < 5; $j++) {
|
||||||
|
if (empty($dadosLinha[$j])) {
|
||||||
|
$isEmpty = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($isEmpty) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
$juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
||||||
|
|
||||||
|
// vai guardar todos os campos de possiveis novos equipamentos, cada um em um array para multiplos inserts, na base de dados
|
||||||
|
$datas = array_filter($juntarArrays, function ($chave) {
|
||||||
|
return !empty($chave);
|
||||||
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
|
//Indentifica qual o tipo de equipamento selecionado de acordo com a tabela EquipmentType
|
||||||
|
$equipmentType = EquipmentType::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
||||||
|
|
||||||
|
$checkFactory = Unit::where('unit_name', $datas['fabrica'])->first();
|
||||||
|
|
||||||
|
|
||||||
|
// Antes de criar o novo equipamento, verifique se já existe um equipamento
|
||||||
|
// com o mesmo factory_id e tag.
|
||||||
|
$existingEquipment = Equipment::where('unit_id', $checkFactory->unit_id)
|
||||||
|
->where('equipment_tag', $datas['tag'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($existingEquipment) {
|
||||||
|
|
||||||
|
// Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
||||||
|
$pendingEquipament = new PendingEquipment;
|
||||||
|
|
||||||
|
// Defina os atributos do pendingEquipament conforme necessário.
|
||||||
|
$pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
||||||
|
$pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
|
$pendingEquipament->pending_equipment_tag = $datas['tag'];
|
||||||
|
$pendingEquipament->pending_equipment_description = $datas['equipment_Description'];
|
||||||
|
$pendingEquipament->pending_equipment_serial_number = $datas['n_serie'];
|
||||||
|
$pendingEquipament->pending_equipment_brand = $datas['modelo'];
|
||||||
|
$pendingEquipament->pending_company_projects_id = $company_projects_id;
|
||||||
|
$pendingEquipament->save();
|
||||||
|
|
||||||
|
// Incremente o contador de PendingEquipments
|
||||||
|
$countPendingEquipments++;
|
||||||
|
|
||||||
|
// Continue com o próximo loop.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newEquipament = new Equipment;
|
||||||
|
|
||||||
|
$newEquipament->unit_id = $checkFactory->unit_id;
|
||||||
|
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
|
$newEquipament->equipment_Description = $datas['equipment_Description'];
|
||||||
|
$newEquipament->equipment_tag = $datas['tag'];
|
||||||
|
$newEquipament->equipment_serial_number = $datas['n_serie'];
|
||||||
|
$newEquipament->equipment_model = $datas['modelo'];
|
||||||
|
$newEquipament->company_projects_id = $company_projects_id;
|
||||||
|
|
||||||
|
$newEquipament->save();
|
||||||
|
|
||||||
|
$countNewEquipment++;
|
||||||
|
|
||||||
|
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
||||||
|
$receveEquipment_ID = $newEquipament->equipment_id;
|
||||||
|
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
||||||
|
|
||||||
|
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambito'])->first();
|
||||||
|
|
||||||
|
if ($ambit) {
|
||||||
|
$ambit_id = $ambit->ambits_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
||||||
|
|
||||||
|
$AssociationEquipmentAmbit->equipment_type_id = $receveEquipament_type_ID;
|
||||||
|
$AssociationEquipmentAmbit->ambits_id = $ambit_id;
|
||||||
|
$AssociationEquipmentAmbit->equipment_id = $receveEquipment_ID;
|
||||||
|
$AssociationEquipmentAmbit->save();
|
||||||
|
|
||||||
|
$generalAttributes = GeneralAttributesEquipment::all();
|
||||||
|
|
||||||
|
foreach ($generalAttributes as $generalAttribute) {
|
||||||
|
// Verifica se a chave existe em $datas, comparando com os dados da tabela : GeneralAttributesEquipment assim adicionando todos diferentes de NULL relacionados com o equipamento acabado de cria
|
||||||
|
if (isset($datas[$generalAttribute->general_attributes_equipment_description])) {
|
||||||
|
$specificAttribute = new SpecificAttributesEquipmentType;
|
||||||
|
|
||||||
|
$specificAttribute->equipment_id = $receveEquipment_ID;
|
||||||
|
$specificAttribute->equipment_type_id = $receveEquipament_type_ID;
|
||||||
|
$specificAttribute->specific_attributes_equipment_type_id = $generalAttribute->general_attributes_equipment_id;
|
||||||
|
// Atribui o valor da chave correspondente em $datas
|
||||||
|
$specificAttribute->specific_attributes_value = $datas[$generalAttribute->general_attributes_equipment_description];
|
||||||
|
|
||||||
|
// $specificAttribute->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
||||||
|
|
||||||
|
// $pendingEquipments = session('pendingEquipments');
|
||||||
|
if ($countPendingEquipments != 0) {
|
||||||
|
// return redirect()->route('test2')->with('Danger', 'Equipamentos Pendentes')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
||||||
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
->with('danger', 'Equipamentos Pendentes criados : ' . $countPendingEquipments)
|
||||||
|
->with('pendingEquipments', $pendingEquipments);
|
||||||
|
// ->with('success', 'Equipamentos Criados :' . count($listValves))
|
||||||
|
}
|
||||||
|
return redirect()->route('test2', ['id' => $request->numberProject])
|
||||||
|
->with('success', 'Equipamentos Criados :' . $countNewEquipment);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Nao chega aqui ainda pois volta para a pagina com dados ja carregados.
|
||||||
|
|
||||||
|
session(['form_data.step2' => $request->all()]);
|
||||||
|
|
||||||
|
// Redirecione o usuário para a próxima etapa
|
||||||
|
return redirect('/test3');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showStep3()
|
||||||
|
{
|
||||||
|
// Verifique se a etapa 2 foi concluída
|
||||||
|
// if (!session('form_data.step2')) {
|
||||||
|
// return redirect('/test2');
|
||||||
|
// }
|
||||||
|
|
||||||
|
return view('projectsClients/workStation_3', ['step' => 3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processStep3(Request $request)
|
||||||
|
{
|
||||||
|
// Valide e processe os dados do formulário
|
||||||
|
// ...
|
||||||
|
session(['form_data.step3' => $request->all()]);
|
||||||
|
|
||||||
|
// Aqui, todas as etapas foram concluídas
|
||||||
|
// Você pode redirecionar o usuário para uma página de "Obrigado" ou processar os dados do formulário
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +489,7 @@ public function index()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
dd($results);
|
// dd($results);
|
||||||
|
|
||||||
$groupedEquipments = [];
|
$groupedEquipments = [];
|
||||||
|
|
||||||
|
|
@ -74,7 +523,6 @@ public function listCompanies()
|
||||||
{
|
{
|
||||||
$companies = User::where('type_users', 3)->get();
|
$companies = User::where('type_users', 3)->get();
|
||||||
return view('projectsClients/createProject', ['companies' => $companies]);
|
return view('projectsClients/createProject', ['companies' => $companies]);
|
||||||
// return view('projectsClients/createProject', ['companies' => $companies]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -111,6 +559,8 @@ public function createProject(Request $request)
|
||||||
$project->save();
|
$project->save();
|
||||||
|
|
||||||
return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso');
|
return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso');
|
||||||
|
// return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeProject(Request $request)
|
public function storeProject(Request $request)
|
||||||
|
|
@ -131,14 +581,24 @@ public function storeProject(Request $request)
|
||||||
public function getByUserNif(Request $request)
|
public function getByUserNif(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
// dd(Installation::where('user_id', $request->input('user_id'))->get());
|
// dd(Plant::where('user_id', $request->input('user_id'))->get());
|
||||||
|
|
||||||
$user_id = $request->input('user_id'); //Check
|
$user_id = $request->input('user_id'); //Check
|
||||||
$installations = Unit::where('user_id', $user_id)->get();
|
$installations = Plant::where('user_id', $user_id)->get();
|
||||||
|
|
||||||
return response()->json($installations);
|
return response()->json($installations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 createEquipamentProject(Request $request)
|
// public function createEquipamentProject(Request $request)
|
||||||
// {
|
// {
|
||||||
// $file = $request->file('documento');
|
// $file = $request->file('documento');
|
||||||
|
|
@ -214,110 +674,129 @@ public function getByUserNif(Request $request)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public function createEquipamentProject(Request $request)
|
|
||||||
{
|
|
||||||
$file = $request->file('documento');
|
|
||||||
|
|
||||||
// Certifique-se de que um arquivo foi enviado
|
|
||||||
if ($file) {
|
|
||||||
// Carregue o arquivo Excel
|
|
||||||
$spreadsheet = IOFactory::load($file->path());
|
|
||||||
|
|
||||||
// Obtenha a primeira planilha
|
|
||||||
$worksheet = $spreadsheet->getSheet(0);
|
|
||||||
|
|
||||||
// Transforme os dados da planilha em um array
|
|
||||||
$data = $worksheet->toArray();
|
|
||||||
|
|
||||||
$nomesColunas = $data[0];
|
|
||||||
|
|
||||||
// Atributos que você quer buscar e inserir
|
|
||||||
$attributes = ["dimension", "dn_ent", "p&id", "n_sap", "isolation", "scaffolding", "grua", "interlocks"];
|
|
||||||
|
|
||||||
// Comece a partir da sexta linha
|
|
||||||
for ($i = 6; $i < count($data); $i++) {
|
|
||||||
$dadosLinha = $data[$i];
|
|
||||||
|
|
||||||
//Se nao preencher o campo $dadosLinha[0], nao cria um novo equipamento
|
|
||||||
//Trocar pelos 5 primeiros
|
|
||||||
if (empty($dadosLinha[0])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
|
||||||
|
|
||||||
$datas = array_filter($juntarArrays, function ($chave) {
|
|
||||||
return !empty($chave);
|
|
||||||
}, ARRAY_FILTER_USE_KEY);
|
|
||||||
|
|
||||||
$equipmentType = EquipmentType::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
|
||||||
|
|
||||||
$checkFactory = Unit::where('unit_name', $datas['fabrica'])->first();
|
|
||||||
|
|
||||||
|
|
||||||
// Antes de criar o novo equipamento, verifique se já existe um equipamento
|
|
||||||
// com o mesmo factory_id e tag.
|
|
||||||
$existingEquipment = Equipment::where('unit_id', $checkFactory->unit_id)
|
|
||||||
->where('equipment_tag', $datas['tag'])
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($existingEquipment) {
|
|
||||||
// Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
|
||||||
$pendingEquipament = new PendingEquipment;
|
|
||||||
// Defina os atributos do pendingEquipament conforme necessário.
|
|
||||||
$pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
|
||||||
$pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
|
||||||
$pendingEquipament->pending_equipment_tag = $datas['tag'];
|
|
||||||
$pendingEquipament->pending_equipment_description = $datas['equipment_Description'];
|
|
||||||
$pendingEquipament->pending_equipment_serial_number = $datas['n_serie'];
|
|
||||||
$pendingEquipament->pending_equipment_brand = $datas['modelo'];
|
|
||||||
|
|
||||||
$pendingEquipament->save();
|
|
||||||
|
|
||||||
// Continue com o próximo loop.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$newEquipament = new Equipment;
|
|
||||||
|
|
||||||
$newEquipament->unit_id = $checkFactory->unit_id;
|
|
||||||
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
|
||||||
$newEquipament->equipment_Description = $datas['equipment_Description'];
|
|
||||||
$newEquipament->equipment_tag = $datas['tag'];
|
|
||||||
$newEquipament->equipment_serial_number = $datas['n_serie'];
|
|
||||||
$newEquipament->equipment_model = $datas['modelo'];
|
|
||||||
|
|
||||||
$newEquipament->save();
|
|
||||||
|
|
||||||
$receveEquipment_ID = $newEquipament->equipment_id;
|
|
||||||
|
|
||||||
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($attributes as $attribute) {
|
|
||||||
|
|
||||||
$generalAttribute = GeneralAttributesEquipment::where('general_attributes_equipment_description', $attribute)->first();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($generalAttribute)) {
|
// public function createEquipamentProject(Request $request)
|
||||||
|
// {
|
||||||
|
// $file = $request->file('documento');
|
||||||
|
|
||||||
$specificAttribute = new SpecificAttributesEquipmentType;
|
// // Certifique-se de que um arquivo foi enviado
|
||||||
|
// if ($file) {
|
||||||
|
// // Carregue o arquivo Excel
|
||||||
|
// $spreadsheet = IOFactory::load($file->path());
|
||||||
|
|
||||||
$specificAttribute->equipment_id = $receveEquipment_ID;
|
// // Obtenha a primeira planilha
|
||||||
$specificAttribute->equipment_type_id = $receveEquipament_type_ID;
|
// $worksheet = $spreadsheet->getSheet(0);
|
||||||
$specificAttribute->specific_attributes_equipment_type_id = $generalAttribute->general_attributes_equipment_id;
|
|
||||||
$specificAttribute->specific_attributes_value = $datas[$attribute];
|
|
||||||
|
|
||||||
$specificAttribute->save();
|
// // Transforme os dados da planilha em um array
|
||||||
|
// $data = $worksheet->toArray();
|
||||||
|
|
||||||
}
|
// $nomesColunas = $data[0];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$listValves = Equipment::all();
|
// // Atributos que você quer buscar e inserir
|
||||||
return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
// $attributes = ["dimension", "dn_ent", "p&id", "n_sap", "isolation", "scaffolding", "grua", "interlocks"];
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// // Comece a partir da sexta linha
|
||||||
|
// for ($i = 6; $i < count($data); $i++) {
|
||||||
|
|
||||||
|
// $dadosLinha = $data[$i];
|
||||||
|
|
||||||
|
// //Se nao preencher o campo $dadosLinha[0], nao cria um novo equipamento
|
||||||
|
// //Trocar pelos 5 primeiros
|
||||||
|
// if (empty($dadosLinha[0])) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// $juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
||||||
|
|
||||||
|
// $datas = array_filter($juntarArrays, function ($chave) {
|
||||||
|
// return !empty($chave);
|
||||||
|
// }, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
|
// $equipmentType = EquipmentType::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
||||||
|
|
||||||
|
// $checkFactory = Unit::where('unit_name', $datas['fabrica'])->first();
|
||||||
|
|
||||||
|
|
||||||
|
// // Antes de criar o novo equipamento, verifique se já existe um equipamento
|
||||||
|
// // com o mesmo factory_id e tag.
|
||||||
|
// $existingEquipment = Equipment::where('unit_id', $checkFactory->unit_id)
|
||||||
|
// ->where('equipment_tag', $datas['tag'])
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// if ($existingEquipment) {
|
||||||
|
// // Se o equipamento existir, crie o novo equipamento na tabela pending_equipaments.
|
||||||
|
// $pendingEquipament = new PendingEquipment;
|
||||||
|
// // Defina os atributos do pendingEquipament conforme necessário.
|
||||||
|
// $pendingEquipament->pending_equipment_unit_id = $checkFactory->unit_id;
|
||||||
|
// $pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
|
// $pendingEquipament->pending_equipment_tag = $datas['tag'];
|
||||||
|
// $pendingEquipament->pending_equipment_description = $datas['equipment_Description'];
|
||||||
|
// $pendingEquipament->pending_equipment_serial_number = $datas['n_serie'];
|
||||||
|
// $pendingEquipament->pending_equipment_brand = $datas['modelo'];
|
||||||
|
|
||||||
|
// $pendingEquipament->save();
|
||||||
|
|
||||||
|
// // Adicione uma variável de sessão para indicar que um equipamento pendente foi criado.
|
||||||
|
// session(['pendingEquipmentCreated' => true]);
|
||||||
|
|
||||||
|
// // Adicione uma variável de sessão para indicar que um equipamento pendente foi criado.
|
||||||
|
// session()->push('pendingEquipments', $pendingEquipament);
|
||||||
|
|
||||||
|
// // Continue com o próximo loop.
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newEquipament = new Equipment;
|
||||||
|
|
||||||
|
// $newEquipament->unit_id = $checkFactory->unit_id;
|
||||||
|
// $newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
||||||
|
// $newEquipament->equipment_Description = $datas['equipment_Description'];
|
||||||
|
// $newEquipament->equipment_tag = $datas['tag'];
|
||||||
|
// $newEquipament->equipment_serial_number = $datas['n_serie'];
|
||||||
|
// $newEquipament->equipment_model = $datas['modelo'];
|
||||||
|
|
||||||
|
// $newEquipament->save();
|
||||||
|
|
||||||
|
// $receveEquipment_ID = $newEquipament->equipment_id;
|
||||||
|
|
||||||
|
// $receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
||||||
|
|
||||||
|
|
||||||
|
// foreach ($attributes as $attribute) {
|
||||||
|
|
||||||
|
// $generalAttribute = GeneralAttributesEquipment::where('general_attributes_equipment_description', $attribute)->first();
|
||||||
|
|
||||||
|
// if (!is_null($generalAttribute)) {
|
||||||
|
|
||||||
|
// $specificAttribute = new SpecificAttributesEquipmentType;
|
||||||
|
|
||||||
|
// $specificAttribute->equipment_id = $receveEquipment_ID;
|
||||||
|
// $specificAttribute->equipment_type_id = $receveEquipament_type_ID;
|
||||||
|
// $specificAttribute->specific_attributes_equipment_type_id = $generalAttribute->general_attributes_equipment_id;
|
||||||
|
// $specificAttribute->specific_attributes_value = $datas[$attribute];
|
||||||
|
|
||||||
|
// // $specificAttribute->save();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $listValves = Equipment::all();
|
||||||
|
// $pendingEquipments = PendingEquipment::all();
|
||||||
|
|
||||||
|
// // return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
||||||
|
|
||||||
|
// // return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
||||||
|
|
||||||
|
// $listValves = Equipment::all();
|
||||||
|
// $pendingEquipments = session('pendingEquipments');
|
||||||
|
// if ($pendingEquipments) {
|
||||||
|
// return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
||||||
|
// } else {
|
||||||
|
// return redirect()->route('createProject')->with('success', 'Dados guardados com sucesso')->with('listValves', $listValves);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,22 @@
|
||||||
|
|
||||||
use App\Models\Equipment;
|
use App\Models\Equipment;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
|
use App\Models\CompanyProject;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ProjectoDatacontroller extends Controller
|
class ProjectoDatacontroller extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function HomePage(){
|
||||||
|
$CompanyProject = CompanyProject::all();
|
||||||
|
|
||||||
|
return view('Admin/index')
|
||||||
|
// return view('codePronto');
|
||||||
|
->with("CompanyProject", $CompanyProject);
|
||||||
|
}
|
||||||
|
|
||||||
public function ManageAssets()
|
public function ManageAssets()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ class AmbitsEquipment extends Model
|
||||||
protected $table = 'ambits_equipments';
|
protected $table = 'ambits_equipments';
|
||||||
protected $primaryKey = 'ambits_equipment_id';
|
protected $primaryKey = 'ambits_equipment_id';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
|
||||||
|
public function equipmentAssociationAmbit(){
|
||||||
|
return $this->hasMany(EquipmentAssociationAmbit::class, 'ambits_id', 'ambits_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,20 @@ public function equipmentType()
|
||||||
return $this->belongsTo(EquipmentType::class, 'equipment_type_id', 'equipment_type_id');
|
return $this->belongsTo(EquipmentType::class, 'equipment_type_id', 'equipment_type_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function specificAttributes()
|
||||||
|
// {
|
||||||
|
// return $this->hasMany(SpecificAttributesEquipmentType::class, 'equipment_id', 'equipment_id');
|
||||||
|
// }
|
||||||
|
|
||||||
public function specificAttributes()
|
public function specificAttributes()
|
||||||
{
|
{
|
||||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'equipment_id', 'equipment_id');
|
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()
|
||||||
|
{
|
||||||
|
return $this->hasMany(EquipmentAssociationAmbit::class, 'equipment_id', 'equipment_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
app/Models/EquipmentAssociationAmbit.php
Normal file
28
app/Models/EquipmentAssociationAmbit.php
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,16 @@ public function equipments(){
|
||||||
return $this->hasMany(Equipment::class, 'equipment_type_id', 'equipment_type_id');
|
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(){
|
public function specificAttributesEquipamentTypes(){
|
||||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'equipment_type_id', 'equipment_type_id');
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ class GeneralAttributesEquipment extends Model
|
||||||
|
|
||||||
public function specificAttributes()
|
public function specificAttributes()
|
||||||
{
|
{
|
||||||
return $this->hasMany(SpecificAttributesEquipmentType::class, 'specific_attributes_equipment_type_id', 'general_attributes_equipment_id');
|
return $this->hasMany(SpecificAttributesEquipmentType::class, 'general_attributes_equipment_id', 'general_attributes_equipment_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,15 @@ class PendingEquipment extends Model
|
||||||
protected $table = 'pending_equipments';
|
protected $table = 'pending_equipments';
|
||||||
|
|
||||||
protected $primaryKey = 'pending_equipment_id';
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,13 @@ public function equipment()
|
||||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
return $this->belongsTo(Equipment::class, 'equipment_id', 'equipment_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generalAttribute()
|
public function generalAttributesEquipment()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(GeneralAttributesEquipment::class, 'specific_attributes_equipment_type_id', 'general_attributes_equipment_id');
|
return $this->belongsTo(GeneralAttributesEquipament::class, 'general_attributes_equipment_id', 'general_attributes_equipment_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
class Unit extends Model
|
class Unit extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
protected $table = 'units';
|
protected $table = 'units';
|
||||||
|
|
||||||
|
|
@ -16,4 +17,8 @@ public function equipments(){
|
||||||
|
|
||||||
return $this->hasMany(Equipment::class, 'unit_id', 'unit_id');
|
return $this->hasMany(Equipment::class, 'unit_id', 'unit_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pendingEquipments(){
|
||||||
|
return $this->hasMany(PendingEquipment::class, 'pending_equipment_unit_id', 'unit_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,52 @@ :root {
|
||||||
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.has-float-label {
|
||||||
|
position: relative;
|
||||||
|
font-size: 70%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-float-label label {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 1;
|
||||||
|
transition: all .2s;
|
||||||
|
top: -.5em;
|
||||||
|
left: .75rem;
|
||||||
|
z-index: 0;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 0 1px;
|
||||||
|
color: gray;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-float-label label::after {
|
||||||
|
content: " ";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
background: #fff;
|
||||||
|
height: 2px;
|
||||||
|
top: 50%;
|
||||||
|
left: -.2em;
|
||||||
|
right: -.2em;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-float-label .form-control:placeholder-shown:not(:focus)::-webkit-input-placeholder {
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-float-label .form-control:placeholder-shown:not(:focus)+label {
|
||||||
|
font-size: 120%;
|
||||||
|
opacity: .5;
|
||||||
|
top: .3em;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Progress Bar */
|
/* Progress Bar */
|
||||||
|
|
||||||
#progressbar {
|
#progressbar {
|
||||||
|
|
@ -72,6 +118,7 @@ #progressbar li:before {
|
||||||
background: rgb(196, 196, 196);
|
background: rgb(196, 196, 196);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0 auto 5px auto;
|
margin: 0 auto 5px auto;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*progressbar connectors*/
|
/*progressbar connectors*/
|
||||||
|
|
@ -102,6 +149,14 @@ #progressbar li.active:after {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Inputs Obrigatorios */
|
||||||
|
input[required] {
|
||||||
|
border-color: red;
|
||||||
|
}
|
||||||
|
.required {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#msform {
|
#msform {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
@extends('Templates/templateAdmin')
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
@section('Main-content')
|
@section('Main-content')
|
||||||
|
|
||||||
<!-- Content Wrapper. Contains page content -->
|
<!-- Content Wrapper. Contains page content -->
|
||||||
|
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
|
|
@ -33,13 +32,13 @@
|
||||||
<span class="info-box-icon"><i class="fas fa-file-edit"></i></span>
|
<span class="info-box-icon"><i class="fas fa-file-edit"></i></span>
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">Em planeamento</span>
|
<span class="info-box-text">Em planeamento</span>
|
||||||
<span class="info-box-number">3</span>
|
<span class="info-box-number">{{count($CompanyProject)}}</span>
|
||||||
|
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar" style="width: 100%"></div>
|
<div class="progress-bar" style="width: 100%"></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="progress-description">
|
<span class="progress-description">
|
||||||
Em planeamento de 2022
|
Em planeamento de 2023
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.info-box-content -->
|
<!-- /.info-box-content -->
|
||||||
|
|
@ -47,36 +46,22 @@
|
||||||
<!-- /.info-box -->
|
<!-- /.info-box -->
|
||||||
<!-- /.Card header-->
|
<!-- /.Card header-->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
@foreach ($CompanyProject as $project)
|
||||||
<div class="card card-secondary card-outline">
|
<div class="card card-secondary card-outline">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h5 class="card-title">Paragem Cliente 1 NOV2023</h5>
|
<h5 class="card-title">{{ $project->company_project_description }}</h5>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<a href="#" class="btn btn-tool" data-toggle="modal" data-target="#modal-articulado">
|
<a href="{{ route('test2', ['id' => $project->company_projects_id]) }}"
|
||||||
<i class="fas fa-eye"></i>
|
class="btn btn-tool">
|
||||||
</a>
|
<i class="fa-solid fa-eye" style="color:rgb(62, 62, 62)"></i>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card card-secondary card-outline">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5 class="card-title">Paragem Cliente 1 OUT2023</h5>
|
|
||||||
<div class="card-tools">
|
|
||||||
<a href="#" class="btn btn-tool">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card card-secondary card-outline">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5 class="card-title">Paragem Cliente 2 MAIO2023</h5>
|
|
||||||
<div class="card-tools">
|
|
||||||
<a href="#" class="btn btn-tool">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -250,7 +235,4 @@
|
||||||
{{-- /.container-fluid --}}
|
{{-- /.container-fluid --}}
|
||||||
</section>
|
</section>
|
||||||
<!-- /.content -->
|
<!-- /.content -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
@ -36,7 +36,31 @@
|
||||||
<!-- jQuery UI -->
|
<!-- jQuery UI -->
|
||||||
<link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
|
<link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
|
||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
{{-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> --}}
|
||||||
|
|
||||||
|
{{-- DataTables --}}
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css')}}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables-responsive/css/responsive.bootstrap4.min.css')}}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables-buttons/css/buttons.bootstrap4.min.css')}}">
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables/jquery.dataTables.min.js')}}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js')}}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('plugins/datatables-responsive/js/dataTables.responsive.min.js')}}">
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<!-- DataTables CSS -->
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
|
||||||
|
<!-- DataTables JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
||||||
|
<!-- DataTables Bootstrap 4 JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap4.min.js"></script>
|
||||||
|
<!-- DataTables Buttons JavaScript -->
|
||||||
|
<script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
@ -126,6 +150,13 @@ class="fas fa-bars"></i></a>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{{-- <li class="nav-item">
|
||||||
|
<a href="{{ route('createProject') }}" class="nav-link">
|
||||||
|
<i class="nav-icon fas fa-helmet-safety"></i>
|
||||||
|
<p> Criar obra </p>
|
||||||
|
</a>
|
||||||
|
</li> --}}
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ route('createProject') }}" class="nav-link">
|
<a href="{{ route('createProject') }}" class="nav-link">
|
||||||
<i class="nav-icon fas fa-helmet-safety"></i>
|
<i class="nav-icon fas fa-helmet-safety"></i>
|
||||||
|
|
@ -133,10 +164,6 @@ class="fas fa-bars"></i></a>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{-- <li class="nav-item">
|
{{-- <li class="nav-item">
|
||||||
<a href="{{ route('test') }}" class="nav-link active">
|
<a href="{{ route('test') }}" class="nav-link active">
|
||||||
<i class="nav-icon fas fa-tachometer-alt"></i>
|
<i class="nav-icon fas fa-tachometer-alt"></i>
|
||||||
|
|
@ -257,7 +284,6 @@ class="fas fa-bars"></i></a>
|
||||||
<!-- jQuery -->
|
<!-- jQuery -->
|
||||||
<script src="{{ asset('plugins/jquery/jquery.min.js') }}"></script>
|
<script src="{{ asset('plugins/jquery/jquery.min.js') }}"></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- Bootstrap 4 -->
|
<!-- Bootstrap 4 -->
|
||||||
<script src="{{ asset('plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
<script src="{{ asset('plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||||
|
|
||||||
|
|
@ -282,7 +308,7 @@ class="fas fa-bars"></i></a>
|
||||||
|
|
||||||
|
|
||||||
<!-- daterangepicker -->
|
<!-- daterangepicker -->
|
||||||
<script src="plugins/moment/moment.min.js"></script>
|
<script src="{{asset('plugins/moment/moment.min.js')}}"></script>
|
||||||
<script src="{{ asset('plugins/daterangepicker/daterangepicker.js') }}"></script>
|
<script src="{{ asset('plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||||
<!-- Tempusdominus Bootstrap 4 -->
|
<!-- Tempusdominus Bootstrap 4 -->
|
||||||
<script src="{{ asset('plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js') }}"></script>
|
<script src="{{ asset('plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js') }}"></script>
|
||||||
|
|
|
||||||
1775
resources/views/codePronto.blade.php
Normal file
1775
resources/views/codePronto.blade.php
Normal file
File diff suppressed because it is too large
Load Diff
1769
resources/views/projectsClients/articulated_2.blade.php
Normal file
1769
resources/views/projectsClients/articulated_2.blade.php
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -1,29 +1,27 @@
|
||||||
@extends('Templates/templateAdmin')
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
@section('Main-content')
|
@section('Main-content')
|
||||||
@if (session('success'))
|
|
||||||
<div class="alert alert-success" role="alert">
|
|
||||||
{{ session('success') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12">
|
||||||
<!-- Multiplos FieldSet -->
|
|
||||||
<div class="col-12" id="msform">
|
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- Progressbar -->
|
<!-- Progressbar -->
|
||||||
<ul id="progressbar" class="nav nav-pills flex-sm-row">
|
<ul id="progressbar" class="nav nav-pills d-flex flex-sm-row justify-content-center">
|
||||||
<li class="active flex-sm-fill">Detalhes do projecto</li>
|
<li class="@if ($step == 1) active @endif flex-sm-fill"></li>
|
||||||
<li class="flex-sm-fill">Articulado</li>
|
{{-- Project details --}}
|
||||||
<li class="flex-sm-fill">Postos de Trabalho</li>
|
<li class="@if ($step == 2) active @endif flex-sm-fill"></li>
|
||||||
|
{{-- Articulated --}}
|
||||||
|
<li class="@if ($step == 3) active @endif flex-sm-fill"></li>
|
||||||
|
{{-- Workstation --}}
|
||||||
</ul>
|
</ul>
|
||||||
|
{{-- <ul id="progressbar" class="nav nav-pills d-flex flex-sm-row justify-content-center">
|
||||||
|
<li class="@if ($step == 1) active @endif "></li>
|
||||||
|
<li class="@if ($step == 2) active @endif "></li>
|
||||||
|
<li class="@if ($step == 3) active @endif "></li>
|
||||||
|
</ul> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Card details project -->
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="card card-primary" id="CardDetalhes">
|
<div class="card card-primary" id="CardDetalhes">
|
||||||
<div class="card-header bg-primary text-white">
|
<div class="card-header bg-primary text-white">
|
||||||
|
|
@ -32,7 +30,9 @@
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<form method="POST" action="{{ route('createProject1') }}" id="idDoFormulario">
|
{{-- <form method="POST" action="{{ route('createProject1') }}" id="idDoFormulario"> --}}
|
||||||
|
<form method="POST" action="{{ route('processStep1') }}" id="idDoFormulario">
|
||||||
|
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
<select class="form-control" name="user_id" id="company_select">
|
<select class="form-control" name="user_id" id="company_select">
|
||||||
<option value="#">Selecione uma Empresa...</option>
|
<option value="#">Selecione uma Empresa...</option>
|
||||||
@foreach ($companies as $company)
|
@foreach ($companies as $company)
|
||||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
<option value="{{ $company->user_id }}">{{ $company->user_name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -105,8 +105,8 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label>Nº. de obra cliente</label>
|
<label>Nº. de obra Empresa</label>
|
||||||
<input type="number" name="" class="form-control"
|
<input type="number" name="project_company_number" class="form-control"
|
||||||
placeholder="Nº. de obra cliente…">
|
placeholder="Nº. de obra cliente…">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -138,171 +138,15 @@
|
||||||
{{-- /.card-body --}}
|
{{-- /.card-body --}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
|
{{-- Verificar se realmente tem funcionalidade ir para a segunda parte a partir daqui, lembrando que se tirar do argumento vai dar erro, pois para a route :2 espera receber um ID --}}
|
||||||
|
{{-- <a href="{{ route('test2') }}" class="btn btn-primary next float-right">Next</a> --}}
|
||||||
|
|
||||||
{{-- /.card card-primary --}}
|
{{-- /.card card-primary --}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Articulado</h3>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card-header -->
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="container">
|
|
||||||
<div class="card card-success collapsed-card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Criar Equipamentos Manualmente</h3>
|
|
||||||
|
|
||||||
<div class="card-tools">
|
|
||||||
<button type="button" class="btn btn-tool"
|
|
||||||
data-card-widget="collapse"><i class="fas fa-plus"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<!-- /.card-tools -->
|
|
||||||
</div>
|
|
||||||
<!-- /.card-header -->
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label>Nº ISPT</label>
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
placeholder="Nº ISPT...">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label>TAG</label>
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
placeholder="TAG equipamento...">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{-- card card-success collapsed-card --}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{-- <form action="{{ route('createEquipamentProject') }}" method="post"
|
|
||||||
enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="inputDocumento">Selecione um documento:</label>
|
|
||||||
<input type="file" class="form-control-file" id="inputDocumento" name="documento"
|
|
||||||
accept=".xlsx, .xls">
|
|
||||||
</div>
|
|
||||||
</form> --}}
|
|
||||||
|
|
||||||
<form action="{{ route('createEquipamentProject') }}" method="post"
|
|
||||||
enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label for="exampleInputFile">Import Articulated</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="custom-file">
|
|
||||||
<input type="file" class="custom-file-input" id="exampleInputFile"
|
|
||||||
name="documento" accept=".xlsx, .xls">
|
|
||||||
<label class="custom-file-label" for="exampleInputFile">Choose
|
|
||||||
File</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<button type="submit" class="btn btn-primary">Enviar</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{-- ./row --}}
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6"></div>
|
|
||||||
<div class="col-sm-6"><a id="btn-download-template" href="{{ route('download') }}"
|
|
||||||
class="btn btn-info">Baixar
|
|
||||||
Template</a></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Fabrica</th>
|
|
||||||
<th>Tipo de Equipamento</th>
|
|
||||||
<th>Tag</th>
|
|
||||||
<th>Descricao Equipamento</th>
|
|
||||||
<th>Numero de Serie</th>
|
|
||||||
<th>Marca</th>
|
|
||||||
<th>Modelo</th>
|
|
||||||
<th>Editar</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@if (Session::has('listValves'))
|
|
||||||
@foreach (Session::get('listValves') as $valve)
|
|
||||||
<tr>
|
|
||||||
<td>{{ $valve->equipment_id }}</td>
|
|
||||||
<td>{{ $valve->unit_id }}</td>
|
|
||||||
<td>{{ $valve->equipment_type_id }}</td>
|
|
||||||
<td>{{ $valve->equipment_tag }}</td>
|
|
||||||
<td>{{ $valve->equipment_description }}</td>
|
|
||||||
<td>{{ $valve->equipment_serial_number }}</td>
|
|
||||||
<td>{{ $valve->equipment_brand }}</td>
|
|
||||||
<td>{{ $valve->equipment_model }}</td>
|
|
||||||
<td>Botoes Editar</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- /.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card card-Primary -->
|
|
||||||
|
|
||||||
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Project Details</h3>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card-header -->
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- /.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card card-Primary -->
|
|
||||||
|
|
||||||
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{-- /.Multiplos FieldSet --}}
|
|
||||||
</div>
|
|
||||||
<!-- /.row justify-content-center -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -331,11 +175,12 @@ class="btn btn-info">Baixar
|
||||||
'<option value="new_install">Criar uma nova Instalacao ?</option>');
|
'<option value="new_install">Criar uma nova Instalacao ?</option>');
|
||||||
|
|
||||||
// Agora você pode adicionar suas opções dinâmicas.
|
// Agora você pode adicionar suas opções dinâmicas.
|
||||||
|
|
||||||
$.each(data, function(index, installation) {
|
$.each(data, function(index, installation) {
|
||||||
|
|
||||||
select.append('<option value="' + installation.installation_id +
|
select.append('<option value="' + installation.plant_id +
|
||||||
'">' +
|
'">' +
|
||||||
installation.installation_name + '</option>');
|
installation.plant_name + '</option>');
|
||||||
});
|
});
|
||||||
// Armazene os dados em installationsData
|
// Armazene os dados em installationsData
|
||||||
installationsData = data;
|
installationsData = data;
|
||||||
|
|
@ -363,12 +208,12 @@ class="btn btn-info">Baixar
|
||||||
if (installationsData) {
|
if (installationsData) {
|
||||||
// Encontre a instalação selecionada nos dados da instalação
|
// Encontre a instalação selecionada nos dados da instalação
|
||||||
var selectedInstallation = installationsData.find(function(installation) {
|
var selectedInstallation = installationsData.find(function(installation) {
|
||||||
return installation.installation_id == this.value;
|
return installation.plant_id == this.value;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
if (selectedInstallation) {
|
if (selectedInstallation) {
|
||||||
// Preencha o valor do campo de endereço com o endereço da instalação selecionada
|
// Preencha o valor do campo de endereço com o endereço da instalação selecionada
|
||||||
$('#localization_installation_client input').val(selectedInstallation.address);
|
$('#localization_installation_client input').val(selectedInstallation.plant_address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -378,7 +223,10 @@ class="btn btn-info">Baixar
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
|
|
||||||
|
{{-- <script>
|
||||||
// Atribua a URL ao atributo formaction do botão
|
// Atribua a URL ao atributo formaction do botão
|
||||||
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
|
@ -444,57 +292,5 @@ function criarTabelaHtml(dados) {
|
||||||
const form = document.querySelector('form');
|
const form = document.querySelector('form');
|
||||||
form.addEventListener('submit', handleFormSubmit);
|
form.addEventListener('submit', handleFormSubmit);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script> --}}
|
||||||
@endsection
|
|
||||||
|
|
||||||
{{-- Script ProgressBar --}}
|
|
||||||
@section('scripts')
|
|
||||||
<script>
|
|
||||||
//jQuery time
|
|
||||||
var current_fs, next_fs, previous_fs; //fieldsets
|
|
||||||
var left, opacity, scale; //fieldset properties which we will animate
|
|
||||||
var animating; //flag to prevent quick multi-click glitches
|
|
||||||
|
|
||||||
$(".next").click(function() {
|
|
||||||
if (animating) return false;
|
|
||||||
animating = true;
|
|
||||||
|
|
||||||
current_fs = $(this).parent();
|
|
||||||
next_fs = $(this).parent().next();
|
|
||||||
|
|
||||||
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
|
|
||||||
|
|
||||||
current_fs.animate({
|
|
||||||
opacity: 0
|
|
||||||
}, 800, function() {
|
|
||||||
current_fs.hide();
|
|
||||||
next_fs.show();
|
|
||||||
next_fs.css({
|
|
||||||
'opacity': 1
|
|
||||||
});
|
|
||||||
animating = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".previous").click(function() {
|
|
||||||
if (animating) return false;
|
|
||||||
animating = true;
|
|
||||||
|
|
||||||
current_fs = $(this).parent();
|
|
||||||
previous_fs = $(this).parent().prev();
|
|
||||||
|
|
||||||
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
|
|
||||||
|
|
||||||
current_fs.animate({
|
|
||||||
opacity: 0
|
|
||||||
}, 800, function() {
|
|
||||||
current_fs.hide();
|
|
||||||
previous_fs.show();
|
|
||||||
previous_fs.css({
|
|
||||||
'opacity': 1
|
|
||||||
});
|
|
||||||
animating = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
560
resources/views/projectsClients/createProjectSalvo.blade.php
Normal file
560
resources/views/projectsClients/createProjectSalvo.blade.php
Normal file
|
|
@ -0,0 +1,560 @@
|
||||||
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
@if (session('success'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
|
<!-- Multiplos FieldSet -->
|
||||||
|
<div class="col-12" id="msform">
|
||||||
|
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- Progressbar -->
|
||||||
|
<ul id="progressbar" class="nav nav-pills flex-sm-row">
|
||||||
|
<li class="active flex-sm-fill">Detalhes do projecto</li>
|
||||||
|
<li class="flex-sm-fill">Articulado</li>
|
||||||
|
<li class="flex-sm-fill">Postos de Trabalho</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Card details project -->
|
||||||
|
<fieldset>
|
||||||
|
<div class="card card-primary" id="CardDetalhes">
|
||||||
|
<div class="card-header bg-primary text-white">
|
||||||
|
<h3 class="card-title mb-0">Detalhes da Obra</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('processStep1') }}" id="idDoFormulario">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Descrição da obra</label>
|
||||||
|
<input type="text" name="description_project" class="form-control"
|
||||||
|
placeholder="Descrição da obra;">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. obra ISPT</label>
|
||||||
|
<input type="number" name="n_project_ispt" class="form-control"
|
||||||
|
placeholder="Nº. obra ISPT…">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra ISPT</label>
|
||||||
|
<input type="text" name="responsible_project_ispt" class="form-control"
|
||||||
|
placeholder="Responsável obra ISPT…">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra Empresa</label>
|
||||||
|
<input type="text" name="responsible_project_company" class="form-control"
|
||||||
|
placeholder="Responsável obra cliente…">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="companyField">
|
||||||
|
<label>Empresa</label>
|
||||||
|
<select class="form-control" name="user_id" id="company_select">
|
||||||
|
<option value="#">Selecione uma Empresa...</option>
|
||||||
|
@foreach ($companies as $company)
|
||||||
|
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="installationField" hidden>
|
||||||
|
<label>Instalação</label>
|
||||||
|
<select class="form-control" name="installation_id" id="installationSelect">
|
||||||
|
|
||||||
|
<!-- As opções de instalação serão preenchidas dinamicamente -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" id="new_company_div">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Instalacao :</label>
|
||||||
|
<input type="text" id="new_company_name" class="form-control" name="new_company_name"
|
||||||
|
placeholder="Digite o nome da nova empresa">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Localização</label>
|
||||||
|
<input type="text" class="form-control" name="new_company_address"
|
||||||
|
placeholder="Localização...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group" id="localization_installation_client">
|
||||||
|
<label>Localização</label>
|
||||||
|
<input type="text" class="form-control" placeholder="Localização" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. de obra cliente</label>
|
||||||
|
<input type="number" name="" class="form-control"
|
||||||
|
placeholder="Nº. de obra cliente…">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Date -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Datas:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<i class="far fa-calendar-alt"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input name="date_started" type="datetime-local" class="form-control float-right">
|
||||||
|
</div>
|
||||||
|
<!-- /.input group -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- /.card-body --}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
||||||
|
{{-- /.card card-primary --}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<div class="card card-primary">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Articulado</h3>
|
||||||
|
</div>
|
||||||
|
<!-- ./Card-header -->
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="container">
|
||||||
|
<div class="card card-success collapsed-card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Criar Equipamentos Manualmente</h3>
|
||||||
|
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i
|
||||||
|
class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-tools -->
|
||||||
|
</div>
|
||||||
|
<!-- /.card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº ISPT</label>
|
||||||
|
<input type="text" class="form-control" placeholder="Nº ISPT...">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>TAG</label>
|
||||||
|
<input type="text" class="form-control" placeholder="TAG equipamento...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- card card-success collapsed-card --}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{-- <form action="{{ route('createEquipamentProject') }}" method="post"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputDocumento">Selecione um documento:</label>
|
||||||
|
<input type="file" class="form-control-file" id="inputDocumento" name="documento"
|
||||||
|
accept=".xlsx, .xls">
|
||||||
|
</div>
|
||||||
|
</form> --}}
|
||||||
|
|
||||||
|
<form action="{{ route('createEquipamentProject') }}" method="post"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label for="exampleInputFile">Import Articulated</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="custom-file">
|
||||||
|
<input type="file" class="custom-file-input" id="exampleInputFile"
|
||||||
|
name="documento" accept=".xlsx, .xls">
|
||||||
|
<label class="custom-file-label" for="exampleInputFile">Choose
|
||||||
|
File</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<button type="submit" class="btn btn-primary">Enviar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{-- ./row --}}
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6"></div>
|
||||||
|
<div class="col-sm-6"><a id="btn-download-template" href="{{ route('download') }}"
|
||||||
|
class="btn btn-info">Baixar
|
||||||
|
Template</a></div>
|
||||||
|
|
||||||
|
<a href='#' data-toggle='modal' data-target='#modal-pedingEquipments'>
|
||||||
|
<button class="btn btn-warning">Pendentes </button>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Fabrica</th>
|
||||||
|
<th>Tipo de Equipamento</th>
|
||||||
|
<th>Tag</th>
|
||||||
|
<th>Descricao Equipamento</th>
|
||||||
|
<th>Numero de Serie</th>
|
||||||
|
<th>Marca</th>
|
||||||
|
<th>Modelo</th>
|
||||||
|
<th>Editar</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@if (Session::has('listValves'))
|
||||||
|
@foreach (Session::get('listValves') as $valve)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $valve->equipment_id }}</td>
|
||||||
|
<td>{{ $valve->unit_id }}</td>
|
||||||
|
<td>{{ $valve->equipment_type_id }}</td>
|
||||||
|
<td>{{ $valve->equipment_tag }}</td>
|
||||||
|
<td>{{ $valve->equipment_description }}</td>
|
||||||
|
<td>{{ $valve->equipment_serial_number }}</td>
|
||||||
|
<td>{{ $valve->equipment_brand }}</td>
|
||||||
|
<td>{{ $valve->equipment_model }}</td>
|
||||||
|
<td>Botoes Editar</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- ./Card card-Primary -->
|
||||||
|
|
||||||
|
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
||||||
|
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<div class="card card-primary">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Project Details</h3>
|
||||||
|
</div>
|
||||||
|
<!-- ./Card-header -->
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- ./Card card-Primary -->
|
||||||
|
|
||||||
|
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
||||||
|
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- /.Multiplos FieldSet --}}
|
||||||
|
</div>
|
||||||
|
<!-- /.row justify-content-center -->
|
||||||
|
|
||||||
|
<div class="modal fade" id="modal-pedingEquipments">
|
||||||
|
<div class="modal-dialog modal-xl">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>equipment_id</th>
|
||||||
|
<th>unit_id</th>
|
||||||
|
<th>Tipo de Equipamento</th>
|
||||||
|
<th>Tag</th>
|
||||||
|
<th>Descricao Equipamento</th>
|
||||||
|
<th>Numero de Serie</th>
|
||||||
|
<th>Marca</th>
|
||||||
|
<th>Modelo</th>
|
||||||
|
<th>Editar</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@if (Session::has('pendingEquipments'))
|
||||||
|
@foreach (Session::get('pendingEquipments') as $pendingEquipment)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_id }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_unit_id }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_type_id }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_tag }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_description }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_serial_number }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_brand }}</td>
|
||||||
|
<td>{{ $pendingEquipment->pending_equipment_model }}</td>
|
||||||
|
<td>Botoes Editar</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{{-- ./table-responsive --}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- ./modal-content --}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
@if (Session::has('pendingEquipments'))
|
||||||
|
$(function() {
|
||||||
|
$('#model-pedingEquipments').modal('show');
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var installationsData; // Esta variável irá armazenar as informações das instalações
|
||||||
|
$('#company_select').change(function() {
|
||||||
|
var user_id = $(this).val();
|
||||||
|
|
||||||
|
if (user_id == '#') {
|
||||||
|
$('#installationField').attr('hidden', 'hidden');
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get('/api/installations?user_id=' + user_id, function(data) {
|
||||||
|
|
||||||
|
var select = $('#installationSelect');
|
||||||
|
select.empty();
|
||||||
|
|
||||||
|
// Adicione as opções fixas aqui
|
||||||
|
select.append('<option value="#">Selecione uma instalação...</option>');
|
||||||
|
select.append(
|
||||||
|
'<option value="new_install">Criar uma nova Instalacao ?</option>');
|
||||||
|
|
||||||
|
// Agora você pode adicionar suas opções dinâmicas.
|
||||||
|
$.each(data, function(index, installation) {
|
||||||
|
|
||||||
|
select.append('<option value="' + installation.installation_id +
|
||||||
|
'">' +
|
||||||
|
installation.installation_name + '</option>');
|
||||||
|
});
|
||||||
|
// Armazene os dados em installationsData
|
||||||
|
installationsData = data;
|
||||||
|
|
||||||
|
$('#installationField').removeAttr('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// Adicione este código para lidar com a mudança na seleção da instalação
|
||||||
|
$('#installationSelect').change(function() {
|
||||||
|
if (this.value == 'new_install') {
|
||||||
|
$('#new_company_div').show();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').show();
|
||||||
|
|
||||||
|
if (this.value == '#') {
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifique se installationsData está definido
|
||||||
|
if (installationsData) {
|
||||||
|
// Encontre a instalação selecionada nos dados da instalação
|
||||||
|
var selectedInstallation = installationsData.find(function(installation) {
|
||||||
|
return installation.installation_id == this.value;
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
if (selectedInstallation) {
|
||||||
|
// Preencha o valor do campo de endereço com o endereço da instalação selecionada
|
||||||
|
$('#localization_installation_client input').val(selectedInstallation.address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Atribua a URL ao atributo formaction do botão
|
||||||
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
|
||||||
|
function handleFormSubmit(event) {
|
||||||
|
event.preventDefault(); // Previne o comportamento padrão do formulário
|
||||||
|
const inputFile = document.getElementById('inputDocumento').files[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsBinaryString(inputFile);
|
||||||
|
reader.onload = function() {
|
||||||
|
const fileData = reader.result;
|
||||||
|
const workbook = XLSX.read(fileData, {
|
||||||
|
type: 'binary'
|
||||||
|
});
|
||||||
|
const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
const tabelaHtml1 = criarTabelaHtml(tableData1);
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
if (tabelaExcel1 !== null) {
|
||||||
|
tabelaExcel1.innerHTML = tabelaHtml1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function criarTabelaHtml(dados) {
|
||||||
|
|
||||||
|
const colunasObj = dados[2];
|
||||||
|
const colunasheader = Object.keys(colunasObj).map(key =>
|
||||||
|
colunasObj[key]);
|
||||||
|
|
||||||
|
console.log(dados);
|
||||||
|
|
||||||
|
const colunasHtml = colunasheader.map(coluna => `<th>${coluna}</th>`).join('');
|
||||||
|
|
||||||
|
const colunas = Object.keys(dados[2]);
|
||||||
|
|
||||||
|
const linhasHtml = dados
|
||||||
|
.slice(3)
|
||||||
|
.map(linha => {
|
||||||
|
const celulasHtml = colunas.map(coluna => {
|
||||||
|
const valor = linha[coluna] !== undefined ? linha[coluna] : 'NULL';
|
||||||
|
return `<td>${valor}</td>`;
|
||||||
|
}).join('');
|
||||||
|
return `<tr>${celulasHtml}</tr>`;
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
|
||||||
|
// console.log()
|
||||||
|
return `
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>${colunasHtml}</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${linhasHtml}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = document.querySelector('form');
|
||||||
|
form.addEventListener('submit', handleFormSubmit);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
{{-- Script ProgressBar --}}
|
||||||
|
@section('scripts')
|
||||||
|
<script>
|
||||||
|
//jQuery time
|
||||||
|
var current_fs, next_fs, previous_fs; //fieldsets
|
||||||
|
var left, opacity, scale; //fieldset properties which we will animate
|
||||||
|
var animating; //flag to prevent quick multi-click glitches
|
||||||
|
|
||||||
|
$(".next").click(function() {
|
||||||
|
if (animating) return false;
|
||||||
|
animating = true;
|
||||||
|
|
||||||
|
current_fs = $(this).parent();
|
||||||
|
next_fs = $(this).parent().next();
|
||||||
|
|
||||||
|
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
|
||||||
|
|
||||||
|
current_fs.animate({
|
||||||
|
opacity: 0
|
||||||
|
}, 800, function() {
|
||||||
|
current_fs.hide();
|
||||||
|
next_fs.show();
|
||||||
|
next_fs.css({
|
||||||
|
'opacity': 1
|
||||||
|
});
|
||||||
|
animating = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".previous").click(function() {
|
||||||
|
if (animating) return false;
|
||||||
|
animating = true;
|
||||||
|
|
||||||
|
current_fs = $(this).parent();
|
||||||
|
previous_fs = $(this).parent().prev();
|
||||||
|
|
||||||
|
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
|
||||||
|
|
||||||
|
current_fs.animate({
|
||||||
|
opacity: 0
|
||||||
|
}, 800, function() {
|
||||||
|
current_fs.hide();
|
||||||
|
previous_fs.show();
|
||||||
|
previous_fs.css({
|
||||||
|
'opacity': 1
|
||||||
|
});
|
||||||
|
animating = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
316
resources/views/projectsClients/projectDetails_1.blade.php
Normal file
316
resources/views/projectsClients/projectDetails_1.blade.php
Normal file
|
|
@ -0,0 +1,316 @@
|
||||||
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- Progressbar -->
|
||||||
|
<ul id="progressbar" class="nav nav-pills d-flex flex-sm-row justify-content-center">
|
||||||
|
<li class="@if ($step == 1) active @endif flex-sm-fill"></li>
|
||||||
|
{{-- Project details --}}
|
||||||
|
<li class="@if ($step == 2) active @endif flex-sm-fill"></li>
|
||||||
|
{{-- Articulated --}}
|
||||||
|
<li class="@if ($step == 3) active @endif flex-sm-fill"></li>
|
||||||
|
{{-- Workstation --}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<div class="card card-primary" id="CardDetalhes">
|
||||||
|
<div class="card-header bg-primary text-white">
|
||||||
|
<h3 class="card-title mb-0">Detalhes da Obra</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="{{ route('processStep1') }}" id="idDoFormulario">
|
||||||
|
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Descrição da obra</label>
|
||||||
|
<input type="text" name="description_project" class="form-control"
|
||||||
|
placeholder="Descrição da obra" value="{{$projects->company_project_description}}">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. obra ISPT</label>
|
||||||
|
<input type="number" name="n_project_ispt" class="form-control"
|
||||||
|
placeholder="Nº. obra ISPT…" value="{{$projects->project_ispt_number}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra ISPT</label>
|
||||||
|
<input type="text" name="responsible_project_ispt" class="form-control"
|
||||||
|
placeholder="Responsável obra ISPT…" value="{{$projects->project_ispt_number}}" >
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra Empresa</label>
|
||||||
|
<input type="text" name="responsible_project_company" class="form-control"
|
||||||
|
placeholder="Responsável obra cliente…" value="{{$projects->project_company_responsible}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="companyField">
|
||||||
|
<label>Empresa Obra</label>
|
||||||
|
<input type="text" name="user_id" class="form-control" value="{{$projects->plant_id}}" readonly>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="" >
|
||||||
|
<label>Instalação Obra</label>
|
||||||
|
<input type="text" name="user_id" class="form-control" value="{{$projects->plant_id}}" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="companyField">
|
||||||
|
<label>Empresa Nova </label>
|
||||||
|
<select class="form-control" name="user_id" id="company_select">
|
||||||
|
<option value="#">Selecione uma Empresa...</option>
|
||||||
|
@foreach ($companies as $company)
|
||||||
|
<option value="{{ $company->user_id }}">{{ $company->user_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="installationField" hidden>
|
||||||
|
<label>Instalação Nova</label>
|
||||||
|
<select class="form-control" name="installation_id" id="installationSelect">
|
||||||
|
|
||||||
|
<!-- As opções de instalação serão preenchidas dinamicamente -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" id="new_company_div">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Instalacao :</label>
|
||||||
|
<input type="text" id="new_company_name" class="form-control" name="new_company_name"
|
||||||
|
placeholder="Digite o nome da nova empresa">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Localização</label>
|
||||||
|
<input type="text" class="form-control" name="new_company_address"
|
||||||
|
placeholder="Localização...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group" id="localization_installation_client">
|
||||||
|
<label>Localização</label>
|
||||||
|
<input type="text" class="form-control" placeholder="Localização" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. de obra Empresa</label>
|
||||||
|
<input type="number" name="project_company_number" class="form-control"
|
||||||
|
placeholder="Nº. de obra cliente…" value="{{$projects->project_company_number}}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Date -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Data inicio obra:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<i class="far fa-calendar-alt"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input type="text" value="{{ \Carbon\Carbon::parse($projects->date_started)->format('d/m/Y') }}" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova data inicio obra:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<i class="far fa-calendar-alt"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input name="date_started" type="datetime-local" class="form-control float-right">
|
||||||
|
</div>
|
||||||
|
<!-- /.input group -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- /.card-body --}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- /.card card-primary --}}
|
||||||
|
<a href="{{ route('test2', ['id' => $projects]) }}" class="btn btn-primary next float-right">Seguinte</a>
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var installationsData; // Esta variável irá armazenar as informações das instalações
|
||||||
|
$('#company_select').change(function() {
|
||||||
|
var user_id = $(this).val();
|
||||||
|
|
||||||
|
if (user_id == '#') {
|
||||||
|
$('#installationField').attr('hidden', 'hidden');
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get('/api/installations?user_id=' + user_id, function(data) {
|
||||||
|
|
||||||
|
var select = $('#installationSelect');
|
||||||
|
select.empty();
|
||||||
|
|
||||||
|
// Adicione as opções fixas aqui
|
||||||
|
select.append('<option value="#">Selecione uma instalação...</option>');
|
||||||
|
select.append(
|
||||||
|
'<option value="new_install">Criar uma nova Instalacao ?</option>');
|
||||||
|
|
||||||
|
// Agora você pode adicionar suas opções dinâmicas.
|
||||||
|
|
||||||
|
$.each(data, function(index, installation) {
|
||||||
|
|
||||||
|
select.append('<option value="' + installation.plant_id +
|
||||||
|
'">' +
|
||||||
|
installation.plant_name + '</option>');
|
||||||
|
});
|
||||||
|
// Armazene os dados em installationsData
|
||||||
|
installationsData = data;
|
||||||
|
|
||||||
|
$('#installationField').removeAttr('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// Adicione este código para lidar com a mudança na seleção da instalação
|
||||||
|
$('#installationSelect').change(function() {
|
||||||
|
if (this.value == 'new_install') {
|
||||||
|
$('#new_company_div').show();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').show();
|
||||||
|
|
||||||
|
if (this.value == '#') {
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifique se installationsData está definido
|
||||||
|
if (installationsData) {
|
||||||
|
// Encontre a instalação selecionada nos dados da instalação
|
||||||
|
var selectedInstallation = installationsData.find(function(installation) {
|
||||||
|
return installation.plant_id == this.value;
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
if (selectedInstallation) {
|
||||||
|
// Preencha o valor do campo de endereço com o endereço da instalação selecionada
|
||||||
|
$('#localization_installation_client input').val(selectedInstallation.plant_address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{-- <script>
|
||||||
|
// Atribua a URL ao atributo formaction do botão
|
||||||
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
|
||||||
|
function handleFormSubmit(event) {
|
||||||
|
event.preventDefault(); // Previne o comportamento padrão do formulário
|
||||||
|
const inputFile = document.getElementById('inputDocumento').files[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsBinaryString(inputFile);
|
||||||
|
reader.onload = function() {
|
||||||
|
const fileData = reader.result;
|
||||||
|
const workbook = XLSX.read(fileData, {
|
||||||
|
type: 'binary'
|
||||||
|
});
|
||||||
|
const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
const tabelaHtml1 = criarTabelaHtml(tableData1);
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
if (tabelaExcel1 !== null) {
|
||||||
|
tabelaExcel1.innerHTML = tabelaHtml1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function criarTabelaHtml(dados) {
|
||||||
|
|
||||||
|
const colunasObj = dados[2];
|
||||||
|
const colunasheader = Object.keys(colunasObj).map(key =>
|
||||||
|
colunasObj[key]);
|
||||||
|
|
||||||
|
console.log(dados);
|
||||||
|
|
||||||
|
const colunasHtml = colunasheader.map(coluna => `<th>${coluna}</th>`).join('');
|
||||||
|
|
||||||
|
const colunas = Object.keys(dados[2]);
|
||||||
|
|
||||||
|
const linhasHtml = dados
|
||||||
|
.slice(3)
|
||||||
|
.map(linha => {
|
||||||
|
const celulasHtml = colunas.map(coluna => {
|
||||||
|
const valor = linha[coluna] !== undefined ? linha[coluna] : 'NULL';
|
||||||
|
return `<td>${valor}</td>`;
|
||||||
|
}).join('');
|
||||||
|
return `<tr>${celulasHtml}</tr>`;
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
|
||||||
|
// console.log()
|
||||||
|
return `
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>${colunasHtml}</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${linhasHtml}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = document.querySelector('form');
|
||||||
|
form.addEventListener('submit', handleFormSubmit);
|
||||||
|
})();
|
||||||
|
</script> --}}
|
||||||
|
@endsection
|
||||||
23
resources/views/projectsClients/workStation_3.blade.php
Normal file
23
resources/views/projectsClients/workStation_3.blade.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- Progressbar -->
|
||||||
|
<ul id="progressbar" class="nav nav-pills flex-sm-row">
|
||||||
|
<li class="@if ($step == 1) active @endif flex-sm-fill">Project details</li>
|
||||||
|
<li class="@if ($step == 2) active @endif flex-sm-fill">Articulated</li>
|
||||||
|
<li class="@if ($step == 3) active @endif flex-sm-fill">Workstation</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card card-primary">
|
||||||
|
<h1>Workstation</h1>
|
||||||
|
<!-- Aqui vai o conteúdo do seu form da página 3 -->
|
||||||
|
<a href="{{ route('test2') }}" class="btn btn-primary">Previous</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -66,6 +66,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@extends('Templates/templateAdmin')
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,164 +0,0 @@
|
||||||
@extends('Templates/templateAdmin')
|
|
||||||
|
|
||||||
@section('Main-content')
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
|
|
||||||
<!-- Multiplos FieldSet -->
|
|
||||||
<div class="col-12" id="msform">
|
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="card-body">
|
|
||||||
<!-- Progressbar -->
|
|
||||||
<ul id="progressbar" class="nav nav-pills flex-sm-row">
|
|
||||||
<li class="active flex-sm-fill">Project details</li>
|
|
||||||
<li class="flex-sm-fill">Articulated</li>
|
|
||||||
<li class="flex-sm-fill">Workstation</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Card details project -->
|
|
||||||
<fieldset>
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Project Details</h3>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card-header -->
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
</div>
|
|
||||||
<!-- /.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card card-Primary -->
|
|
||||||
|
|
||||||
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- ./Card details project -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Card Articulado -->
|
|
||||||
<fieldset>
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Project Details</h3>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card-header -->
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
</div>
|
|
||||||
<!-- /.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card card-Primary -->
|
|
||||||
|
|
||||||
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Project Details</h3>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card-header -->
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- /.card-body -->
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ./Card card-Primary -->
|
|
||||||
|
|
||||||
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
|
||||||
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Multiplos FieldSet -->
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
{{-- Script ProgressBar --}}
|
|
||||||
@section('scripts')
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
var activeFieldsetIndex =
|
|
||||||
"{{ session('activeFieldsetIndex') }}"; // Obtenha o índice do fieldset ativo da sessão
|
|
||||||
|
|
||||||
if (activeFieldsetIndex !== "") {
|
|
||||||
// Se activeFieldsetIndex não estiver vazio, mostre o fieldset correspondente
|
|
||||||
var fieldsets = $("fieldset");
|
|
||||||
fieldsets.hide(); // Esconda todos os fieldsets
|
|
||||||
$(fieldsets.get(activeFieldsetIndex)).show(); // Mostre o fieldset ativo
|
|
||||||
$("#progressbar li").eq(activeFieldsetIndex).addClass(
|
|
||||||
"active"); // Marque a progress bar correspondente como ativa
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//jQuery time
|
|
||||||
var current_fs, next_fs, previous_fs; //fieldsets
|
|
||||||
var left, opacity, scale; //fieldset properties which we will animate
|
|
||||||
var animating; //flag to prevent quick multi-click glitches
|
|
||||||
|
|
||||||
$(".next").click(function() {
|
|
||||||
if (animating) return false;
|
|
||||||
animating = true;
|
|
||||||
|
|
||||||
current_fs = $(this).parent();
|
|
||||||
next_fs = $(this).parent().next();
|
|
||||||
|
|
||||||
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
|
|
||||||
|
|
||||||
current_fs.animate({
|
|
||||||
opacity: 0
|
|
||||||
}, 800, function() {
|
|
||||||
current_fs.hide();
|
|
||||||
next_fs.show();
|
|
||||||
next_fs.css({
|
|
||||||
'opacity': 1
|
|
||||||
});
|
|
||||||
animating = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".previous").click(function() {
|
|
||||||
if (animating) return false;
|
|
||||||
animating = true;
|
|
||||||
|
|
||||||
current_fs = $(this).parent();
|
|
||||||
previous_fs = $(this).parent().prev();
|
|
||||||
|
|
||||||
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
|
|
||||||
|
|
||||||
current_fs.animate({
|
|
||||||
opacity: 0
|
|
||||||
}, 800, function() {
|
|
||||||
current_fs.hide();
|
|
||||||
previous_fs.show();
|
|
||||||
previous_fs.css({
|
|
||||||
'opacity': 1
|
|
||||||
});
|
|
||||||
animating = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endsection
|
|
||||||
|
|
@ -30,10 +30,31 @@
|
||||||
|
|
||||||
// Route::get('test',[CreateProjectController::class,'index'] )->name('test');
|
// Route::get('test',[CreateProjectController::class,'index'] )->name('test');
|
||||||
|
|
||||||
Route::get('test1', function(){
|
|
||||||
return view('test2');
|
// Vai ser unicamente a pagina de criacao de uma obra
|
||||||
|
Route::get('/createProject', [CreateProjectController::class,'createProjectForStep1'])->name('createProject');
|
||||||
|
Route::post('/newProject1', [CreateProjectController::class,'processStep1'])->name('processStep1');
|
||||||
|
|
||||||
|
Route::get('/test1/{id}', [CreateProjectController::class,'showStep1'])->name('test1');
|
||||||
|
Route::get('/test2/{id}', [CreateProjectController::class,'showStep2'])->name('test2');
|
||||||
|
|
||||||
|
Route::post('test1', [CreateProjectController::class,'EditprocessStep1'])->name('EditprocessStep1');
|
||||||
|
Route::post('/test2', [CreateProjectController::class,'processStep2'])->name('processStep2');
|
||||||
|
|
||||||
|
Route::post('/test2CreateEquipment',[CreateProjectController::class,'createEquipmentManual'])->name('test2CreateEquipment');
|
||||||
|
|
||||||
|
Route::get('/test3', [CreateProjectController::class,'showStep3'])->name('test3');
|
||||||
|
Route::post('/test3', [CreateProjectController::class,'processStep3']);
|
||||||
|
|
||||||
|
Route::get('testando',function(){
|
||||||
|
return view('codePronto');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::delete('/removeEquipment/{id}', [CreateProjectController::class, 'removePendingEquipment'])->name('removeEquipment');
|
||||||
|
Route::post('CreateNewEquipmentFromPendingEquipment/{id}', [CreateProjectController::class, 'CreateNewEquipmentFromPendingEquipment'])->name('CreateNewEquipmentFromPendingEquipment');
|
||||||
|
// Ainda nao funciona corretamente
|
||||||
|
// Route::get('/receiveEquipmentID/{equipment}',[CreateProjectController::class,'receiveIdEquipment'])->name('receiveIdEquipment');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -68,6 +89,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
Route::get('users/ListUsers', [userController::class, 'ListUsers'])->name('users.list');
|
Route::get('users/ListUsers', [userController::class, 'ListUsers'])->name('users.list');
|
||||||
|
|
||||||
Route::get('users/ListCompanies', [userController::class, 'ListCompanies'])->name('users.company');
|
Route::get('users/ListCompanies', [userController::class, 'ListCompanies'])->name('users.company');
|
||||||
|
|
||||||
Route::get('users/{id}', [userController::class, 'show'])->name('users.Show');
|
Route::get('users/{id}', [userController::class, 'show'])->name('users.Show');
|
||||||
|
|
@ -108,13 +130,11 @@
|
||||||
*/
|
*/
|
||||||
Route::middleware(['auth', 'verified'])->group(function () {
|
Route::middleware(['auth', 'verified'])->group(function () {
|
||||||
|
|
||||||
|
|
||||||
// Rotas protegidas que exigem verificação de e-mail
|
// Rotas protegidas que exigem verificação de e-mail
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', [ProjectoDatacontroller::class,('HomePage')])->name('home');
|
||||||
return view('Admin/index');
|
|
||||||
})->name('home');
|
|
||||||
|
|
||||||
|
//
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -146,14 +166,21 @@
|
||||||
| be assigned to the "web" middleware group. Make something great!
|
| be assigned to the "web" middleware group. Make something great!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
Route::get('createProject', [CreateProjectController::class,'listCompanies'])->name('createProject');
|
|
||||||
|
|
||||||
Route::post('createProject1',[CreateProjectController::class,'createProject'])->name('createProject1');
|
|
||||||
|
// Route::post('createProject1',[CreateProjectController::class,'createProject'])->name('createProject1');
|
||||||
|
|
||||||
|
// Route::get('createProject', [CreateProjectController::class,'listCompanies'])->name('createProject');
|
||||||
|
|
||||||
|
// Route::post('createProject1',[CreateProjectController::class,'createProject'])->name('createProject1');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Route::post('/create-equipament-project', [CreateProjectController::class,'createEquipamentProject'])->name('createEquipamentProject');
|
Route::post('/create-equipament-project', [CreateProjectController::class,'createEquipamentProject'])->name('createEquipamentProject');
|
||||||
|
|
||||||
/* Api */
|
/* Api */
|
||||||
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
|
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
|
||||||
|
Route::get('/api/ambits/{equipmentType}',[CreateProjectController::class, 'getAmbits']);
|
||||||
|
|
||||||
|
|
||||||
Route::post('/register', [CustomRegistrationController::class, 'store'])->name('register');
|
Route::post('/register', [CustomRegistrationController::class, 'store'])->name('register');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user