Update Template
This commit is contained in:
parent
cd02d1c258
commit
f7ef77aaf0
|
|
@ -464,7 +464,7 @@ public function EditEquipmentsProjects(Request $request)
|
|||
}
|
||||
|
||||
// Retorna uma resposta
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('success', 'Equipamento ' . $equipment->equipment_tag . ' Editado com Sucesso!!!')
|
||||
->with('taskExecutionOrders', $taskExecutionOrders);
|
||||
}
|
||||
|
|
@ -755,7 +755,7 @@ public function createEquipmentManual(Request $request)
|
|||
]);
|
||||
|
||||
if ($existingEquipment) {
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('danger', 'Equipamento ja Existe !!')
|
||||
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ public function createEquipmentManual(Request $request)
|
|||
}
|
||||
|
||||
// O $request->numberProject e sempre necessario retornar para indicar a obra que se esta modificando...
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('success', 'Equipamento criado com sucesso')
|
||||
->with('listEquipmentsProjects', $listEquipmentsProjects);
|
||||
}
|
||||
|
|
@ -1055,12 +1055,12 @@ public function processStep2(Request $request)
|
|||
// $pendingEquipments = session('pendingEquipments');
|
||||
if ($countPendingEquipments != 0) {
|
||||
// return redirect()->route('articulated_2')->with('Danger', 'Equipamentos Pendentes')->with('listValves', $listValves)->with('pendingEquipments', $pendingEquipments);
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('danger', 'Equipamentos Pendentes criados : ' . $countPendingEquipments)
|
||||
->with('pendingEquipments', $pendingEquipments);
|
||||
// ->with('success', 'Equipamentos Criados :' . count($listValves))
|
||||
}
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('success', 'Equipamentos Criados :' . $countNewEquipment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
use App\Models\AssociationCompanyUser;
|
||||
use App\Models\Company;
|
||||
use App\Models\EquipmentWorkHistory;
|
||||
use App\Models\ProjectExcelLog;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
|
@ -36,7 +37,7 @@
|
|||
|
||||
// use DataTables;
|
||||
|
||||
|
||||
public function EditprocessStep1(Request $request)
|
||||
class CreateProjectController extends Controller
|
||||
{
|
||||
public function changeStateProject($projectId)
|
||||
|
|
@ -948,6 +949,15 @@ public function showStep2($company_projects_id)
|
|||
|
||||
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $numberProject)->get();
|
||||
|
||||
// $receiveAllLogsProject = ProjectExcelLog::where('company_projects_id', $company_projects_id)->get();
|
||||
|
||||
$receiveAllLogsProject = ProjectExcelLog::where('company_projects_id', $company_projects_id)
|
||||
->get()
|
||||
->groupBy('excel_name')
|
||||
->map(function ($group) {
|
||||
return $group->sortByDesc('project_excel_logs_id')->first();
|
||||
});
|
||||
|
||||
if (!$pendingEquipments->isEmpty()) {
|
||||
// Retornamos para a view 'step' => 2 indicando conclusao da primeira parte, $numberProject para associacao de equipamentos a esta obra, alem de todos os equipamentos e fabricao ja existente com base na Instalação que se iniciou a obra.
|
||||
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||
|
|
@ -958,7 +968,8 @@ public function showStep2($company_projects_id)
|
|||
->with('checkEquipments', $checkEquipments)
|
||||
->with('checkUnits', $checkUnits)
|
||||
->with('receiveNumberProject', $project)
|
||||
->with('groupedArrayForPendingEquipments', $groupedArrayForPendingEquipments);
|
||||
->with('groupedArrayForPendingEquipments', $groupedArrayForPendingEquipments)
|
||||
->with('receiveAllLogsProject', $receiveAllLogsProject);
|
||||
}
|
||||
return view('projectsClients/articulated_2', ['step' => 2, 'numberProject' => $numberProject])
|
||||
->with('listEquipmentsProjects', $listEquipmentsProjects)
|
||||
|
|
@ -1119,16 +1130,20 @@ public function processStep2(Request $request)
|
|||
{
|
||||
// Valide e processe os dados do formulário
|
||||
$file = $request->file('documento');
|
||||
// Criar o array para adicionar o HashMap
|
||||
$uniqueRowsHashmap = [];
|
||||
// Recebe a id do Projecto criado
|
||||
$company_projects_id = $request->numberProject;
|
||||
// Recebe mais detalhes da Obra Atual.
|
||||
$detailsCompanyProject = CompanyProject::where('company_projects_id', $company_projects_id)->first();
|
||||
// Inicializa o contador para ispt_number
|
||||
$isptNumber = 1;
|
||||
|
||||
// Recebe o valor do campo 'chooseIfSelectOrCreateEquipments' do formulário
|
||||
$chooseAction = $request->input('chooseIfSelectOrCreateEquipments');
|
||||
|
||||
// Certifique-se de que um arquivo foi enviado
|
||||
// Confirma que o arquivo foi enviado,ou seja sua existencia.
|
||||
// Antes de verificar o documento excel, deve ter uma forma de confirmar o mesmo como arquivo legitivo para criar dados de acordo com o nosso template.
|
||||
if ($file) {
|
||||
|
||||
//Busca o nome do arquivo xslx.
|
||||
$originalFileName = $file->getClientOriginalName();
|
||||
// Carregue o arquivo Excel
|
||||
|
|
@ -1146,28 +1161,56 @@ public function processStep2(Request $request)
|
|||
// Recebo os nomes das colunas do execel dependendo da linguagem selecionada
|
||||
$columnRealNames = $data[5];
|
||||
|
||||
// Inicialização do hashmap para rastrear as linhas únicas
|
||||
$uniqueRowsHashmap = [];
|
||||
$equipmentPendingLogs = [];
|
||||
$ignoredLines = [];
|
||||
// $ignoredLines = [];
|
||||
// $duplicateLines = [];
|
||||
|
||||
// Comece a partir da sexta linha do template os dados dos Equipamentos
|
||||
for ($i = 6; $i < count($data); $i++) {
|
||||
|
||||
$dataLines = $data[$i];
|
||||
// Separa o nome do arquivo para obter o tipo de documento e a data-hora
|
||||
$parts = explode('_', $originalFileName);
|
||||
$documentType = $parts[2]; // 98
|
||||
$timestamp = $parts[3]; // 2024-01-14_14-33
|
||||
|
||||
// Verifica se a coluna 'fábrica' (primeiro campo) está vazia
|
||||
if (empty($dataLines[0])) {
|
||||
// Se a coluna 'fábrica' estiver vazia, pule para a próxima linha
|
||||
continue;
|
||||
}
|
||||
$emptyFields = [];
|
||||
function normalize($value)
|
||||
{
|
||||
// Remove espaços em branco no início e no fim da string
|
||||
$trimmed = trim($value);
|
||||
// Remove espaços em branco no meio da string
|
||||
$noInnerSpaces = str_replace(' ', '', $trimmed);
|
||||
// Converte a string para minúsculas
|
||||
$lowercase = strtolower($noInnerSpaces);
|
||||
return $lowercase;
|
||||
}
|
||||
|
||||
// Busca o ID de todas as unidades referentes à Instalação da Obra e coloca em um array
|
||||
$allUnitsOnThePlantOfProject = Unit::where('plant_id', $detailsCompanyProject->plant_id)
|
||||
->pluck('unit_id')
|
||||
->toArray();
|
||||
|
||||
// Busca os equipamentos com base nos IDs das unidades encontradas
|
||||
$equipments = Equipment::select('equipment_id', 'unit_id', 'equipment_tag') // Substitua 'equipment_id', 'equipment_tag' pelos nomes corretos das colunas, se necessário
|
||||
->whereIn('unit_id', $allUnitsOnThePlantOfProject)
|
||||
->get()->keyBy(function ($item) {
|
||||
return normalize($item->unit->unit_name) . '-' . normalize($item->equipment_tag); // Cria uma chave única com 'unit_id-tag' para fácil comparação
|
||||
});
|
||||
|
||||
// Verifica se já existem registros com o mesmo 'equipment_id' e 'company_projects_id'
|
||||
$existingRecords = EquipmentWorkHistory::where('company_projects_id', $company_projects_id)
|
||||
->orderBy('ispt_number', 'desc') // Ordena de forma decrescente
|
||||
->first(); // Pega o primeiro resultado, que seria o maior número
|
||||
|
||||
if ($existingRecords) {
|
||||
// Se existirem registros, o próximo número será o maior número existente + 1
|
||||
$isptNumber = $existingRecords->ispt_number + 1;
|
||||
} else {
|
||||
// Se não existirem registros, começa com 1
|
||||
$isptNumber = 1;
|
||||
}
|
||||
|
||||
foreach ($data as $i => $dataLines) {
|
||||
|
||||
// Verifica se os 5 primeiros campos essenciais estão preenchidos
|
||||
for ($j = 0; $j < 5; $j++) {
|
||||
if (empty($dataLines[$j])) {
|
||||
// Adiciona o índice do campo vazio ao array $camposVazios
|
||||
$emptyFields[] = $columnRealNames[$j]; // ou simplesmente $j se não tiver o nome da coluna
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1179,75 +1222,135 @@ public function processStep2(Request $request)
|
|||
return !empty ($chave);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
// Verifica se a coluna 'fábrica' (primeiro campo) está vazia
|
||||
if (empty($dataLines[0])) {
|
||||
// Se a coluna 'fábrica' estiver vazia, pule para a próxima linha
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Recebe os detalhes da Unit recebida nesta linha do excel.
|
||||
// Deve verificar a Plant tambem, pois pode ter outra plante com esse mesmo nome de fabrica.
|
||||
//Nunca vai ser null ou diferente pois tem um code acima que se essa coluna for null faz um continue na linha atual XD
|
||||
$detailsUnit = Unit::where('unit_name', $datas['unit'])
|
||||
->where('plant_id', $detailsCompanyProject->plant_id)
|
||||
->first();
|
||||
|
||||
//Indentifica qual o tipo de equipamento selecionado de acordo com a tabela EquipmentType
|
||||
$equipmentType = EquipmentType::where('equipment_type_name', $datas['equipment_type_name'])->first();
|
||||
|
||||
$checkFactory = Unit::where('unit_name', $datas['unit'])->first();
|
||||
//-------- Linhas Ignoradas
|
||||
// Começa a contagem das linhas do excel a partir de 7 linha
|
||||
if ($i < 6) {
|
||||
continue;
|
||||
}
|
||||
// Contador para campos não vazios
|
||||
$nonEmptyFieldsCount = 0;
|
||||
// Array para rastrear campos não preenchidos
|
||||
$missingFields = [];
|
||||
|
||||
// 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['equipment_tag'])
|
||||
->first();
|
||||
// Verifica se os 5 primeiros campos estão preenchidos e conta os não vazios
|
||||
for ($j = 0; $j < 5; $j++) {
|
||||
if (!empty($dataLines[$j])) {
|
||||
$nonEmptyFieldsCount++;
|
||||
} else {
|
||||
$missingFields[] = $columnRealNames[$j]; // Assume-se que $columnRealNames mapeia corretamente para os nomes dos campos
|
||||
}
|
||||
}
|
||||
|
||||
//Nesta para vamos separar como tratar os equipamentos que existem, dependendo do tipo de select que o utilizador utilizou
|
||||
// Registra a linha como ignorada se menos de 2 campos estiverem preenchidos ou se houver campos não preenchidos
|
||||
if ($nonEmptyFieldsCount > 2 && $nonEmptyFieldsCount < 5) {
|
||||
$equipmentPendingLogs[] = [
|
||||
'typePendingLog' => 0 ,
|
||||
'line' => $i + 1,
|
||||
'reason' => implode(', ', $missingFields), // Converte o array de campos faltantes para uma string
|
||||
];
|
||||
continue; // Pula para a próxima linha
|
||||
}
|
||||
|
||||
if ($chooseAction == 'selectEquipments') {
|
||||
|
||||
if ($existingEquipment) {
|
||||
//-------- Linhas Repetidas no Execel
|
||||
$normalizedField1 = normalize($dataLines[0]);
|
||||
$normalizedField2 = normalize($dataLines[1]);
|
||||
$key = $normalizedField1 . '-' . $normalizedField2;
|
||||
|
||||
$foundInExcel = false;
|
||||
$rowExcelDuplicated = null;
|
||||
// Verifica duplicatas no Excel
|
||||
if (!array_key_exists($key, $uniqueRowsHashmap)) {
|
||||
$uniqueRowsHashmap[$key] = $i;
|
||||
} else {
|
||||
$duplicateLines[] = $i; // Linha duplicada no Excel
|
||||
$equipmentPendingLogs[] = [
|
||||
'typePendingLog' => 1,
|
||||
'duplicate_line' => $i + 1,
|
||||
'original_line' => $uniqueRowsHashmap[$key] + 1,
|
||||
'reason' => 'Duplicata no Excel referente aos campos: ' . $columnRealNames[0] . ' e ' . $columnRealNames[1] . '.'
|
||||
];
|
||||
|
||||
// Verificar duplicatas no Excel
|
||||
for ($j = 6; $j < $i; $j++) {
|
||||
if ($data[$j][0] === $datas['unit'] && $data[$j][1] === $datas['equipment_tag'] && $data[$j][4] === $datas['equipment_description']) {
|
||||
$foundInExcel = true;
|
||||
$rowExcelDuplicated = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$pendingEquipament = new PendingEquipment;
|
||||
|
||||
// Associar o equipamento encontrado ao projeto
|
||||
$existingEquipment->company_projects_id = $company_projects_id;
|
||||
$existingEquipment->save();
|
||||
// Defina os atributos do pendingEquipament conforme necessário.
|
||||
$pendingEquipament->pending_equipment_unit_id = $detailsUnit->unit_id;
|
||||
$pendingEquipament->pending_equipment_type_id = $equipmentType->equipment_type_id;
|
||||
$pendingEquipament->pending_equipment_tag = $datas['equipment_tag'];
|
||||
$pendingEquipament->pending_equipment_description = $datas['equipment_description'];
|
||||
$pendingEquipament->pending_equipment_serial_number = $datas['serial_number'];
|
||||
$pendingEquipament->pending_equipment_brand = $datas['model'];
|
||||
$pendingEquipament->pending_company_projects_id = $company_projects_id;
|
||||
$pendingEquipament->save();
|
||||
|
||||
// Incremente o contador de PendingEquipments
|
||||
$countPendingEquipments++;
|
||||
|
||||
continue; // Pula a próxima verificação para duplicatas identificadas no Excel
|
||||
}
|
||||
|
||||
|
||||
//--------- Linhas associada a equipamentos da base de dados.
|
||||
// Verifica duplicatas na base de dados
|
||||
if (isset($equipments[$key])) {
|
||||
$duplicateLines[] = $i; // Linha duplicada na base de dados
|
||||
$equipmentPendingLogs[] = [
|
||||
'typePendingLog' => 2,
|
||||
'line' => $i + 1,
|
||||
'equipment_id' => $equipments[$key]->equipment_id, // Adiciona o ID do equipamento
|
||||
'equipment_tag' => $equipments[$key]->equipment_tag, // Adiciona a tag do equipamento
|
||||
'reason' => '' // Adiciona uma razão vazia por padrão que será atualizada mais tarde
|
||||
];
|
||||
|
||||
// Busca o equipamento para ver se já está associado a algum projeto
|
||||
$findEquipment = Equipment::find($equipments[$key]->equipment_id);
|
||||
|
||||
if ($findEquipment->company_projects_id != null && $findEquipment->company_projects_id == $company_projects_id) {
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['reason'] = 'Equipamento já associado a esta obra';
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['typePendingLog'] = 2.1;
|
||||
|
||||
} elseif ($findEquipment->company_projects_id != null && $findEquipment->company_projects_id != $company_projects_id) {
|
||||
$findOtherCompanyProject = CompanyProject::find($findEquipment->company_projects_id);
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['reason'] = 'Equipamento associado a outra Obra: ' . $findOtherCompanyProject->company_project_description;
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['typePendingLog'] = 2.2;
|
||||
|
||||
} else {
|
||||
//equipamentos novos nao entram na equipmentPendingLogs, criar um proprio apenas para teste.
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['reason'] = 'Equipamento associado a obra com sucesso!';
|
||||
$equipmentPendingLogs[count($equipmentPendingLogs) - 1]['typePendingLog'] = 2.3;
|
||||
|
||||
// Associar o equipamento à Obra atual
|
||||
$findEquipment->company_projects_id = $company_projects_id;
|
||||
$findEquipment->save();
|
||||
|
||||
//Apenas para indicar qtd de equipamentos criados
|
||||
$countEquipment++;
|
||||
|
||||
// Guardo os valores de 'id' e do 'tipo de equipamento' que nosso novo equipamento acabado de criar
|
||||
$receveEquipment_ID = $existingEquipment->equipment_id;
|
||||
$receveEquipament_type_ID = $existingEquipment->equipment_type_id;
|
||||
|
||||
|
||||
|
||||
// Verifica se já existem registros com o mesmo 'equipment_id' e 'company_projects_id'
|
||||
$existingRecords = EquipmentWorkHistory::where('company_projects_id', $company_projects_id)
|
||||
->orderBy('ispt_number', 'desc') // Ordena de forma decrescente
|
||||
->first(); // Pega o primeiro resultado, que seria o maior número
|
||||
|
||||
|
||||
if ($existingRecords) {
|
||||
// Se existirem registros, o próximo número será o maior número existente + 1
|
||||
$isptNumber = $existingRecords->ispt_number + 1;
|
||||
} else {
|
||||
// Se não existirem registros, começa com 1
|
||||
$isptNumber = 1;
|
||||
}
|
||||
|
||||
// Criar um equipment_work_historys
|
||||
$newEquipmentWorkHistory = new EquipmentWorkHistory;
|
||||
$newEquipmentWorkHistory->equipment_id = $findEquipment->equipment_id;
|
||||
|
||||
$newEquipmentWorkHistory->equipment_id = $receveEquipment_ID;
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber++;
|
||||
$newEquipmentWorkHistory->company_projects_id = $company_projects_id;
|
||||
// Continua com o processo de salvar o novo registro
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber;
|
||||
|
||||
$newEquipmentWorkHistory->save();
|
||||
|
||||
// Recebe o Id do 'EquipmentWorkHistory' criado.
|
||||
$recebeNewEquipmentWorkHistoryID = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
|
||||
$isptNumber++;
|
||||
|
||||
//Adicionar Ambito e Tarefas para fazer.
|
||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
||||
|
||||
if ($ambit) {
|
||||
|
|
@ -1256,7 +1359,7 @@ public function processStep2(Request $request)
|
|||
|
||||
//Criar associacao do equipamento ao Âmbito
|
||||
$AssociationEquipmentAmbit = new EquipmentAssociationAmbit;
|
||||
$AssociationEquipmentAmbit->equipment_type_id = $existingEquipment->equipment_type_id;
|
||||
$AssociationEquipmentAmbit->equipment_type_id = $findEquipment->equipment_type_id;
|
||||
$AssociationEquipmentAmbit->ambits_id = $ambit_id;
|
||||
$AssociationEquipmentAmbit->equipmentWorkHistorys_id = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
|
||||
|
|
@ -1264,94 +1367,27 @@ public function processStep2(Request $request)
|
|||
|
||||
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
||||
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
||||
|
||||
$execution_order = 1;
|
||||
|
||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber++;
|
||||
$JoinsEquipmentsWithTasks->equipmentWorkHistorys_id = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
||||
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
||||
$JoinsEquipmentsWithTasks->save();
|
||||
}
|
||||
|
||||
// Separa o nome do arquivo para obter o tipo de documento e a data-hora
|
||||
$parts = explode('_', $originalFileName);
|
||||
$documentType = $parts[2]; // 98
|
||||
$timestamp = $parts[3]; // 2024-01-14_14-33
|
||||
|
||||
// Cria um array agrupado
|
||||
$groupedArrayForPendingEquipments = [$documentType, [$timestamp, $equipmentPendingLogs]];
|
||||
}
|
||||
//Se nao existir deve retornar 'equipamentos nao encontrados, deve ser a mesma coisa que as linha ignoradas
|
||||
$ignoredLines[] = [
|
||||
'line' => $i + 1,
|
||||
'emptyFields' => ['Nenhum equipamento foi localizado que cumpra os requisitos especificados nesta linha.']
|
||||
];
|
||||
continue; // Pula para a próxima linha
|
||||
continue; // Pula para a próxima iteração
|
||||
|
||||
//----- Para equipamento novos, nao pendentes. ---------
|
||||
// Caso a linha nao se enquadre em nenhuma das verificacoes anteriores, ele sera considerado um equipamento novo.
|
||||
} else {
|
||||
|
||||
} elseif ($chooseAction == 'createEquipments') {
|
||||
|
||||
if (!empty($emptyFields)) {
|
||||
// Se houver campos vazios, adicione a linha e os campos vazios às linhas ignoradas
|
||||
$ignoredLines[] = [
|
||||
'line' => $i + 1,
|
||||
'emptyFields' => $emptyFields
|
||||
];
|
||||
continue; // Pula para a próxima linha
|
||||
}
|
||||
|
||||
if ($existingEquipment) {
|
||||
|
||||
$foundInExcel = false;
|
||||
$rowExcelDuplicated = null;
|
||||
|
||||
// Verificar duplicatas no Excel
|
||||
for ($j = 6; $j < $i; $j++) {
|
||||
if ($data[$j][0] === $datas['unit'] && $data[$j][1] === $datas['equipment_tag'] && $data[$j][4] === $datas['equipment_description']) {
|
||||
$foundInExcel = true;
|
||||
$rowExcelDuplicated = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 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['equipment_tag'];
|
||||
$pendingEquipament->pending_equipment_description = $datas['equipment_description'];
|
||||
$pendingEquipament->pending_equipment_serial_number = $datas['serial_number'];
|
||||
$pendingEquipament->pending_equipment_brand = $datas['model'];
|
||||
$pendingEquipament->pending_company_projects_id = $company_projects_id;
|
||||
$pendingEquipament->save();
|
||||
|
||||
// Incremente o contador de PendingEquipments
|
||||
$countPendingEquipments++;
|
||||
|
||||
// A variavel $pendenteLogs, na 'linhaExcel' vai recebe a linha do execel onde encontrou a duplicata em Array, vinda do primeiro $data, onde transforma toda o execel em array
|
||||
// 'existingEquipmentId' vai ver qual o id do equipament que esta sendo duplicado.
|
||||
//'duplicadoNoExcel' vai ser um boolean indicando que este valor duplicado veio da base de dados ou se foi de uma coluna anterior.
|
||||
// linhaExcelDuplicada se o valor de duplicadoNoExcel for 'true' quer dizer que existe uma linha anterior com o mesmos dados, e essa variavel busco a o numero do array desta linha com base na variavel primeiro $data
|
||||
$equipmentPendingLogs[] = [
|
||||
'rowExecel' => $i + 1,
|
||||
'pendingEquipmentId' => $pendingEquipament->pending_equipment_id,
|
||||
'existingEquipmentId' => $existingEquipment->equipment_id,
|
||||
'foundInExcel' => $foundInExcel,
|
||||
'rowExcelDuplicated' => $rowExcelDuplicated
|
||||
];
|
||||
|
||||
// Continue com o próximo loop.
|
||||
continue;
|
||||
}
|
||||
|
||||
//Novo equipamento
|
||||
$newEquipament = new Equipment;
|
||||
|
||||
$newEquipament->unit_id = $checkFactory->unit_id;
|
||||
$newEquipament->unit_id = $detailsUnit->unit_id;
|
||||
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
||||
$newEquipament->equipment_Description = $datas['equipment_description'];
|
||||
$newEquipament->equipment_tag = $datas['equipment_tag'];
|
||||
|
|
@ -1359,43 +1395,19 @@ public function processStep2(Request $request)
|
|||
$newEquipament->equipment_brand = $datas['brand'];
|
||||
$newEquipament->equipment_model = $datas['model'];
|
||||
$newEquipament->company_projects_id = $company_projects_id;
|
||||
|
||||
$newEquipament->save();
|
||||
|
||||
$countEquipment++;
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
// Verifica se já existem registros com o mesmo 'equipment_id' e 'company_projects_id'
|
||||
$existingRecords = EquipmentWorkHistory::where('company_projects_id', $company_projects_id)
|
||||
->orderBy('ispt_number', 'desc') // Ordena de forma decrescente
|
||||
->first(); // Pega o primeiro resultado, que seria o maior número
|
||||
|
||||
|
||||
if ($existingRecords) {
|
||||
// Se existirem registros, o próximo número será o maior número existente + 1
|
||||
$isptNumber = $existingRecords->ispt_number + 1;
|
||||
} else {
|
||||
// Se não existirem registros, começa com 1
|
||||
$isptNumber = 1;
|
||||
}
|
||||
//Deve adicionar tambem os outros atributos espesificos para o equipameto.
|
||||
|
||||
//Criar o equipment Work History
|
||||
$newEquipmentWorkHistory = new EquipmentWorkHistory;
|
||||
|
||||
$newEquipmentWorkHistory->equipment_id = $receveEquipment_ID;
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber;
|
||||
$newEquipmentWorkHistory->equipment_id = $newEquipament->equipment_id;
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber++;
|
||||
$newEquipmentWorkHistory->company_projects_id = $company_projects_id;
|
||||
|
||||
$newEquipmentWorkHistory->save();
|
||||
|
||||
// Recebe o Id do 'EquipmentWorkHistory' criado.
|
||||
$recebeNewEquipmentWorkHistoryID = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
|
||||
$isptNumber++;
|
||||
|
||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
||||
|
||||
if ($ambit) {
|
||||
|
|
@ -1412,51 +1424,79 @@ public function processStep2(Request $request)
|
|||
|
||||
//Recebe a tabela com as associoacoes entre Âmbitos e tarefas Elementares
|
||||
$TasksAssociationAmbits = TasksAssociationAmbits::all()->where('ambits_equipment_id', $AssociationEquipmentAmbit->ambits_id);
|
||||
$execution_order = 1;
|
||||
|
||||
foreach ($TasksAssociationAmbits as $TasksAssociationAmbit) {
|
||||
$JoinsEquipmentsWithTasks = new OrderEquipmentTasks;
|
||||
$JoinsEquipmentsWithTasks->execution_order = $execution_order++;
|
||||
$JoinsEquipmentsWithTasks->equipmentWorkHistorys_id = $newEquipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
$JoinsEquipmentsWithTasks->elemental_tasks_id = $TasksAssociationAmbit->elemental_tasks_id;
|
||||
$JoinsEquipmentsWithTasks->further_tasks_id = null;
|
||||
$JoinsEquipmentsWithTasks->save();
|
||||
}
|
||||
|
||||
// Separa o nome do arquivo para obter o tipo de documento e a data-hora
|
||||
$parts = explode('_', $originalFileName);
|
||||
$documentType = $parts[2]; // 98
|
||||
$timestamp = $parts[3]; // 2024-01-14_14-33
|
||||
|
||||
// Cria um array agrupado
|
||||
$groupedArrayForPendingEquipments = [$documentType, [$timestamp, $equipmentPendingLogs]];
|
||||
// Armazenar $groupedArrayForPendingEquipments na sessão
|
||||
//------- Porem agora nao deve ser guardado em uma sessao em sim em uma tabela da Db ate terminar(concluir) a Obra
|
||||
session(['groupedArrayForPendingEquipments' => $groupedArrayForPendingEquipments]);
|
||||
$pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
||||
// $pendingEquipments = PendingEquipment::where('pending_company_projects_id', $request->numberProject)->get();
|
||||
|
||||
$equipmentPendingLogs[] = [
|
||||
'typePendingLog' => 3,
|
||||
'line' => $i + 1,
|
||||
'reason' => 'Equipamento Novo' // Adiciona uma razão vazia por padrão que será atualizada mais tarde
|
||||
];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Se a linha não for duplicada nem no Excel nem na base de dados,
|
||||
// a linha é considerada para a criação de um novo equipamento.
|
||||
// Sua lógica para criar um novo equipamento pode ser inserida aqui.
|
||||
|
||||
}
|
||||
|
||||
if ($countPendingEquipments != 0 && !empty($equipmentPendingLogs)) {
|
||||
// Se houver equipamentos pendentes, redirecione com essa informação e inclua os $linhasIgnoradas se não estiverem vazios
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
->with('danger', 'Equipamentos Pendentes criados: ' . $countPendingEquipments)
|
||||
->with('dangerLogs', $ignoredLines)
|
||||
->with('equipmentPendingLogs', $equipmentPendingLogs);
|
||||
// ->with('pendingEquipments', $pendingEquipments);
|
||||
} else {
|
||||
// Se não houver equipamentos pendentes, redirecione com uma mensagem de sucesso e inclua os $linhasIgnoradas se não estiverem vazios
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
->with('success', 'Equipamentos Criados: ' . $countEquipment)
|
||||
->with('dangerLogs', $ignoredLines);
|
||||
}
|
||||
// return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
$countEquipment; //Qtd de equipamentos novos criados
|
||||
$countPendingEquipments; // Qtd de equipamentos pendentes criados
|
||||
|
||||
|
||||
$createProjectLogs = new ProjectExcelLog;
|
||||
$createProjectLogs->company_projects_id = $detailsCompanyProject->company_projects_id;
|
||||
$createProjectLogs->excel_name = $originalFileName;
|
||||
$createProjectLogs->excel_logs = $equipmentPendingLogs;
|
||||
|
||||
$createProjectLogs->save();
|
||||
|
||||
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('success', 'Equipamentos criados com sucesso !');
|
||||
|
||||
|
||||
// if ($countPendingEquipments != 0 && !empty($equipmentPendingLogs)) {
|
||||
// // Se houver equipamentos pendentes, redirecione com essa informação e inclua os $linhasIgnoradas se não estiverem vazios
|
||||
// return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
// ->with('danger', 'Equipamentos Pendentes criados: ' . $countPendingEquipments)
|
||||
// ->with('dangerLogs', $ignoredLines)
|
||||
// ->with('equipmentPendingLogs', $equipmentPendingLogs);
|
||||
// // ->with('pendingEquipments', $pendingEquipments);
|
||||
// } else {
|
||||
// // Se não houver equipamentos pendentes, redirecione com uma mensagem de sucesso e inclua os $linhasIgnoradas se não estiverem vazios
|
||||
// return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
// ->with('success', 'Equipamentos Criados: ' . $countEquipment)
|
||||
// ->with('dangerLogs', $ignoredLines);
|
||||
// }
|
||||
// return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
// ->with('success', 'Equipamentos Adicionados a Obra com sucesso: ' . $countEquipment);
|
||||
} else {
|
||||
return redirect()->route('articulated_2', ['projectID' => $request->numberProject])
|
||||
->with('danger', 'Arquivo ignorado , por nao ser compativel com a template 4.0');
|
||||
// Nenhum arquivo enviado para verificacao do excel.
|
||||
}
|
||||
//Nao chega aqui ainda pois volta para a pagina com dados ja carregados.
|
||||
// //Nao chega aqui ainda pois volta para a pagina com dados ja carregados.
|
||||
// session(['form_data.step2' => $request->all()]);
|
||||
|
||||
session(['form_data.step2' => $request->all()]);
|
||||
|
||||
// Redirecione o Utilizador para a próxima etapa
|
||||
return redirect('/workStation_3');
|
||||
// // Redirecione o Utilizador para a próxima etapa
|
||||
// return redirect('/workStation_3');
|
||||
}
|
||||
|
||||
public function showStep3($company_projects_id)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\AmbitsEquipment;
|
||||
use App\Models\Company;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\ElementalTasks;
|
||||
use App\Models\EquipmentAssociationAmbit;
|
||||
|
|
@ -294,18 +295,20 @@ public function showAmbitDetailsProjectHistory($projectID, $equipmentID)
|
|||
public function showAllClientsForProjectReportsTable()
|
||||
{
|
||||
// Buscamos todos os clientes com type_users = 3
|
||||
$allClientsQuery = User::where('type_users', 3);
|
||||
// $allClientsQuery = User::where('type_users', 3);
|
||||
|
||||
$allClientsQuery = Company::all();
|
||||
|
||||
// Retornamos o objeto DataTables
|
||||
return DataTables::of($allClientsQuery)
|
||||
|
||||
->addColumn('client', function ($client) {
|
||||
->addColumn('company', function ($client) {
|
||||
// Aqui você pode retornar o ID do cliente ou algum outro identificador
|
||||
return $client->user_name;
|
||||
return $client->company_name;
|
||||
})
|
||||
->addColumn('amount_of_projects_completed', function ($client) {
|
||||
// Para cada cliente, obtemos os plant_ids associados
|
||||
$plantIds = Plant::where('user_id', $client->user_id)->pluck('plant_id');
|
||||
$plantIds = Plant::where('company_id', $client->company_id)->pluck('plant_id');
|
||||
|
||||
// Contamos os CompanyProjects associados com datas de início e fim não nulas
|
||||
$projectCount = CompanyProject::whereIn('plant_id', $plantIds)
|
||||
|
|
@ -318,7 +321,7 @@ public function showAllClientsForProjectReportsTable()
|
|||
})
|
||||
->addColumn('action', function ($client) {
|
||||
// Geramos o botão de ação
|
||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('reportingDataClient', ['clientID' => $client->user_id]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('reportingDataClient', ['clientID' => $client->company_id]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action']) // Isso permite que o HTML seja renderizado
|
||||
|
|
@ -345,6 +348,7 @@ public function testRelatorio()
|
|||
|
||||
public function receiveUnitsManageAssets($receivePlantClientRelated)
|
||||
{
|
||||
|
||||
|
||||
$UnitsData = Unit::where('plant_id', $receivePlantClientRelated)->get();
|
||||
|
||||
|
|
@ -609,8 +613,8 @@ public function ManageAssets()
|
|||
|
||||
$units = DB::table('plants')
|
||||
->join('units', 'plants.plant_id', '=', 'units.plant_id')
|
||||
->join('users', 'plants.user_id', '=', 'users.user_id')
|
||||
->select('plants.*', 'units.unit_name', 'users.user_name as user_name')
|
||||
->join('companies', 'plants.company_id', '=', 'companies.company_id')
|
||||
->select('plants.*', 'units.unit_name', 'companies.company_name as company_name')
|
||||
->get();
|
||||
|
||||
$equipments = Equipment::all();
|
||||
|
|
@ -623,7 +627,7 @@ public function ManageAssets()
|
|||
|
||||
$allEquipmentType = EquipmentType::all();
|
||||
|
||||
$allClients = User::where('type_users', 3)->get();
|
||||
$allClients = Company::all();
|
||||
|
||||
return view('Admin/DataManagement/manageassets', compact('units', 'equipments', 'allEquipmentType', 'allClients'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ protected function getAllowedRoutesForUserType($userType)
|
|||
case 5: // Técnico
|
||||
return ['enterWorkstation', 'getEquipmentData', 'receiveAnswersEquipment'];
|
||||
case 3: // Empresa
|
||||
return ['dashboardClient','reportingDataClient', 'manageAssetsClient',
|
||||
return ['dashboardClient','reportingDataClient', 'manageAssetsClient','usersProfiles',
|
||||
// Obras em Execussao
|
||||
'ExecutionProject',
|
||||
//Relatorios
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class Equipment extends Model
|
|||
|
||||
protected $primaryKey = 'equipment_id';
|
||||
|
||||
|
||||
public function unit()
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'unit_id', 'unit_id');
|
||||
|
|
|
|||
20
app/Models/ProjectExcelLog.php
Normal file
20
app/Models/ProjectExcelLog.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectExcelLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'project_excel_logs';
|
||||
protected $primaryKey = 'project_excel_logs_id';
|
||||
protected $fillable = ['company_projects_id', 'excel_name', 'excel_logs'];
|
||||
protected $casts = [
|
||||
'excel_logs' => 'array'
|
||||
];
|
||||
}
|
||||
|
|
@ -30,6 +30,15 @@
|
|||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="card card-success">
|
||||
<div class="card-header">Detalhes da Empresa</div>
|
||||
<div class="card-body">
|
||||
Foto da Empresa
|
||||
Qtd de Obras
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card card-success mb">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mb-0">Utilizadores associados a Empresa </h3>
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ class="btn btn-block bg-primary btn-lg">{{ __('messages.portfolio.change_buttons
|
|||
<select id="receiveAllClients" name="receiveAllClients" class="form-control">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($allClients as $client)
|
||||
<option value="{{ $client->user_id }}">
|
||||
{{ $client->user_name }}</option>
|
||||
<option value="{{ $client->company_id }}">
|
||||
{{ $client->company_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<title>{{ config('app.name') }}</title>
|
||||
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{ URL::asset('assets/dist/img/favicon.ico') }}">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="{{ URL::asset('assets/plugins/fontawesome-free/css/all.min.css') }}">
|
||||
<!-- icheck bootstrap -->
|
||||
|
|
@ -15,8 +18,19 @@
|
|||
<!-- Theme style -->
|
||||
<link rel="stylesheet" href="{{ URL::asset('assets/dist/css/adminlte.min.css') }}">
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
animation: theme 21s linear infinite;
|
||||
}
|
||||
|
|
@ -73,55 +87,36 @@
|
|||
|
||||
</head>
|
||||
|
||||
<body class="hold-transition login-page">
|
||||
<body>
|
||||
|
||||
<div class="container h-100">
|
||||
<div class="row justify-content-center align-items-center h-100">
|
||||
|
||||
|
||||
{{-- <div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card ">
|
||||
<div class="card-header">{{ __('Nova Palavra-passe') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('Email :') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
|
||||
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row mb-0">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Link de Palavra-passe') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{-- Se forbem sucedido, devolve o status sent,indicando o envio para o email --}}
|
||||
@if (session('status'))
|
||||
<div class="content">
|
||||
|
||||
<div class="alert alert-success" role="alert" id="alert-message-success"
|
||||
style="transition: opacity 1s;">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
$('#alert-message-success').fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 10000); // A mensagem desaparecerá após 5 segundos
|
||||
</script>
|
||||
@endif
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header text-center">
|
||||
<p class="h4" style="color:#00B0EA"><b>Recuperar palavra-passe.</b></p>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header text-center">
|
||||
<p class="h4" style="color:#00B0EA"><b>Recuperar palavra-passe</b></p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
|
|
@ -143,9 +138,10 @@ class="form-control @error('email') is-invalid @enderror" name="email"
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row mb-0">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary float-right">
|
||||
<div class="row">
|
||||
<div class="col d-flex justify-content-between">
|
||||
<a href="{{ route('login') }}" class="btn btn-danger">Login</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Enviar para o e-mail.') }}
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -153,12 +149,12 @@ class="form-control @error('email') is-invalid @enderror" name="email"
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- ./row justify-content-center --}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- ./container --}}
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -29,16 +29,17 @@
|
|||
$('#alert-message-danger').fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000); // A mensagem desaparecerá após 5 segundos
|
||||
}, 10000); // A mensagem desaparecerá após 10 segundos
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@if (session('dangerLogs') && !empty(session('dangerLogs')))
|
||||
{{-- Todos dos Logs referentes ao Obra atual --}}
|
||||
@if (!$receiveAllLogsProject->isEmpty())
|
||||
<div class="content pt-3">
|
||||
<div class="card card-danger collapsed-card">
|
||||
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title" style="color:black">Erros do Template</h3>
|
||||
<h3 class="card-title" style="color:black">Logs do Template</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button" data-card-widget="collapse"><i
|
||||
class="fas fa-plus"></i></button>
|
||||
|
|
@ -46,34 +47,96 @@ class="fas fa-plus"></i></button>
|
|||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<!-- ANTIGO code ficava, esta no note -->
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="card card-danger">
|
||||
@foreach ($receiveAllLogsProject as $log)
|
||||
<div class="card card-danger collapsed-card">
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title" style="color:black">{{ $log->excel_name }}</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button"
|
||||
data-card-widget="collapse">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$logs = collect($log->excel_logs); // Aqui assumimos que excel_logs já é um array
|
||||
$groupedLogs = $logs->groupBy('typePendingLog');
|
||||
@endphp
|
||||
{{-- @foreach ($groupedLogs as $type => $typeLogs)
|
||||
<div class="card card-danger collapsed-card">
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title" style="color:black">Log Type: {{ $type }}</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button" data-card-widget="collapse">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
@foreach ($typeLogs as $log)
|
||||
<li>{{ $log['reason'] ?? 'No specific reason' }} (Line {{ $log['line'] ?? $log['duplicate_line'] }})</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach --}}
|
||||
|
||||
@foreach ($groupedLogs as $type => $typeLogs)
|
||||
<div class="card card-danger collapsed-card">
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title" style="color:black">
|
||||
@switch($type)
|
||||
@case(0)
|
||||
Linhas com campos em falta (Nenhum dado criado)
|
||||
@break
|
||||
|
||||
@case(1)
|
||||
Linhas duplicadas no Excel
|
||||
@break
|
||||
|
||||
@case(2)
|
||||
Referente a equipamentos ja existentes
|
||||
@break
|
||||
|
||||
@case(3)
|
||||
Equipamentos Novos
|
||||
@break
|
||||
|
||||
|
||||
@endswitch
|
||||
</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button"
|
||||
data-card-widget="collapse">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
@foreach ($typeLogs as $log)
|
||||
<li>{{ $log['reason'] ?? 'No specific reason' }} (Line
|
||||
{{ $log['line'] ?? $log['duplicate_line'] }})</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title" style="color:black">Linhas Ignoradas</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button"
|
||||
data-card-widget="collapse"><i class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-body" style="padding: 0;margin-bottom: 0%">
|
||||
<ul class="list-group scrollable-list">
|
||||
@foreach (session('dangerLogs') as $ignoredLine)
|
||||
<li class="list-group-item d-flex align-items-center" aria-current="true">
|
||||
<span class="line-text">Linha({{ $ignoredLine['line'] }})</span>
|
||||
<span class="empty-fields"><b> - Campos :</b>
|
||||
{{ implode(', ', $ignoredLine['emptyFields']) }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>{{-- ./card card-danger --}}
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -1087,7 +1150,7 @@ class="input-group-text border rounded-left"
|
|||
<i class="fa-solid fa-download" style="color: #09255C;"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-10 col-md col-lg">
|
||||
{{-- <div class="col-10 col-md col-lg">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text border rounded-left"
|
||||
style="background-color: #ffffff;" data-toggle="tooltip"
|
||||
|
|
@ -1100,7 +1163,7 @@ class="input-group-text border rounded-left"
|
|||
<option value="createEquipments" selected>Criar Novos</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="col-9 col-md col-lg">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text border rounded-left"
|
||||
|
|
@ -1121,7 +1184,7 @@ class="input-group-text border rounded-left"
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 col-md-1 col-lg-1">
|
||||
<div class="col-2 col-md-2 col-lg">
|
||||
<button type="submit" class="btn"
|
||||
style="background-color: #09255C; color: #ffffff;">Enviar</button>
|
||||
</div>
|
||||
|
|
@ -1325,7 +1388,7 @@ class="btn btn-primary float-right">Postos de Trabalho</a>
|
|||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<ul>
|
||||
{{-- <ul>
|
||||
<li><b>Equipamento pendente (Tag): </b>
|
||||
{{ $pendingEquipment->pending_equipment_tag }}</li>
|
||||
<li><b>Equipamento pendente (Descrição):
|
||||
|
|
@ -1349,7 +1412,7 @@ class="btn btn-primary float-right">Postos de Trabalho</a>
|
|||
@else
|
||||
<li>Sem dados Disponiveis sobre sua criacao!!!</li>
|
||||
@endif
|
||||
</ul>
|
||||
</ul> --}}
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
|
|
@ -1506,9 +1569,6 @@ class="btn btn-primary float-right">Postos de Trabalho</a>
|
|||
|
||||
|
||||
@section('scriptsTemplateAdmin')
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var dataTable;
|
||||
$(document).ready(function() {
|
||||
|
|
@ -2335,7 +2395,7 @@ function(task) {
|
|||
form.append(table);
|
||||
form.append(
|
||||
'<button type="submit" class="btn btn-primary">Adicionar a Obra</button>'
|
||||
);
|
||||
);
|
||||
|
||||
$('#modal-addingEquipmentToProject .table-responsive').append(form);
|
||||
$('#modal-addingEquipmentToProject').modal('show');
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<table id="showAllClientsForProjectReportsTable" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cliente</th>
|
||||
<th>Empresa</th>
|
||||
<th>Qtd.Obras Concluidas</th>
|
||||
<th>Visualizar</th>
|
||||
</tr>
|
||||
|
|
@ -71,8 +71,8 @@
|
|||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'client',
|
||||
name: 'client'
|
||||
data: 'company',
|
||||
name: 'company'
|
||||
},
|
||||
{
|
||||
data: 'amount_of_projects_completed',
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public function store(Request $request): Responsable
|
|||
$status = $this->broker()->sendResetLink(
|
||||
$request->only(Fortify::email())
|
||||
);
|
||||
// dd($status);
|
||||
|
||||
return $status == Password::RESET_LINK_SENT
|
||||
? app(SuccessfulPasswordResetLinkRequestResponse::class, ['status' => $status])
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
|
||||
*/
|
||||
|
||||
'reset' => 'A sua palavra-passe foi redefinida com sucesso.',
|
||||
'reset' => 'A sua palavra-passe foi redefinida com sucesso.',
|
||||
'sent' => 'Enviámos para o seu email uma ligação para redefinir a sua palavra-passe.',
|
||||
'throttled' => 'Por favor, aguarde antes de tentar novamente.',
|
||||
'token' => 'Este token de redefinição de palavra-passe é inválido.',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user