updating, removing elementary work tasks and correcting errors when entering the portfolio
This commit is contained in:
parent
20d9ef2266
commit
78df37345c
2
.env
2
.env
|
|
@ -18,7 +18,7 @@ DB_PORT=3306
|
|||
|
||||
# Alteracoes para funcionar com o servidor, porem não funciona na firma
|
||||
DB_HOST=ispt-innovation.com
|
||||
DB_DATABASE=ispt40_version01_BK
|
||||
DB_DATABASE=ispt40_version01
|
||||
DB_USERNAME=ispt40
|
||||
DB_PASSWORD=qu3ro3ntr@r
|
||||
|
||||
|
|
|
|||
|
|
@ -438,6 +438,11 @@ public function finishCreatingProject($numberProject)
|
|||
// Recebe todos os dados dos postos de Trabalho
|
||||
$receiveWorkstaions = ConstructionWorkstation::where('company_projects_id', $numberProject)->get();
|
||||
|
||||
// Verifica se a coleção está vazia
|
||||
if ($receiveWorkstaions->isEmpty()) {
|
||||
return redirect()->back()->with('danger', 'Nenhum posto foi criado ainda..');
|
||||
}
|
||||
|
||||
foreach ($receiveWorkstaions as $workstation) {
|
||||
// Verifica se o ID da workstation está presente na tabela WorkstationsAssociationTasks
|
||||
$exists = WorkstationsAssociationTasks::where('id_workstations', $workstation->id_workstations)->exists();
|
||||
|
|
@ -689,10 +694,10 @@ public function createWorkStations(Request $request)
|
|||
//Apos criar a Workstation vamos criar um login para pode aceder os postos de trabalho na obra
|
||||
$loginWorkStation = new User;
|
||||
$loginWorkStation->user_name = $workstation->name_workstations;
|
||||
$loginWorkStation->email = $receveProjectCompanyNumber->project_company_name . '-' . $receiveNumberWorkstation . '@isptgroup.com';
|
||||
$loginWorkStation->password = bcrypt($receveProjectCompanyNumber->project_company_name . '-' . $receiveNumberWorkstation);
|
||||
$loginWorkStation->email = $receveProjectCompanyNumber->company_projects_id . '-' . $receiveNumberWorkstation . '@isptgroup.com';
|
||||
$loginWorkStation->password = bcrypt($receveProjectCompanyNumber->company_projects_id . '-' . $receiveNumberWorkstation);
|
||||
$loginWorkStation->type_users = 5;
|
||||
$loginWorkStation->user_nif = $receveProjectCompanyNumber->project_company_name . '-' . $receiveNumberWorkstation;
|
||||
$loginWorkStation->user_nif = $receveProjectCompanyNumber->company_projects_id . '-' . $receiveNumberWorkstation;
|
||||
$loginWorkStation->save();
|
||||
}
|
||||
|
||||
|
|
@ -730,7 +735,7 @@ public function showStep1($company_projects_id)
|
|||
|
||||
$receiveCompanyManager = '';
|
||||
$receiveCompanyManagerID = null; // Inicialize com null ou um valor padrão apropriado
|
||||
|
||||
|
||||
// Se o project_company_responsible for igual a null, significa que ainda não foi definido após a criação da Obra.
|
||||
// Se foi definido, deve buscar o nome do User atribuído.
|
||||
if ($projects->project_company_responsible === null) {
|
||||
|
|
@ -1321,13 +1326,13 @@ function normalize($value)
|
|||
'typePendingLog' => 1,
|
||||
'duplicate_line' => $i + 1,
|
||||
'original_line' => $uniqueRowsHashmap[$key] + 1,
|
||||
'reason' => 'Duplicata no Excel - (Original Line '. $uniqueRowsHashmap[$key] + 1 .') referente aos campos: ' . $columnRealNames[0] . ' e ' . $columnRealNames[1] . '.'
|
||||
'reason' => 'Duplicata no Excel - (Original Line ' . $uniqueRowsHashmap[$key] + 1 . ') referente aos campos: ' . $columnRealNames[0] . ' e ' . $columnRealNames[1] . '.'
|
||||
];
|
||||
|
||||
//este e criado apenas para o PendingEquipment a indicar a reason de sua criacao.
|
||||
$pending_equipment_creation_log = [
|
||||
'excel_Name' => $originalFileName,
|
||||
'reason' => 'Duplicata no Excel - (Original Line '. $uniqueRowsHashmap[$key] + 1 .') referente aos campos: ' . $columnRealNames[0] . ' e ' . $columnRealNames[1] . '.(Duplicate Line ' .$i + 1 .')'
|
||||
'reason' => 'Duplicata no Excel - (Original Line ' . $uniqueRowsHashmap[$key] + 1 . ') referente aos campos: ' . $columnRealNames[0] . ' e ' . $columnRealNames[1] . '.(Duplicate Line ' . $i + 1 . ')'
|
||||
];
|
||||
|
||||
$pendingEquipament = new PendingEquipment;
|
||||
|
|
@ -1447,7 +1452,7 @@ function normalize($value)
|
|||
$countEquipment++;
|
||||
|
||||
//Deve adicionar tambem os outros atributos espesificos para o equipameto.
|
||||
|
||||
|
||||
|
||||
//Criar o equipment Work History
|
||||
$newEquipmentWorkHistory = new EquipmentWorkHistory;
|
||||
|
|
@ -1825,4 +1830,40 @@ public function getAttributes($id)
|
|||
$equipment = Equipment::with('specificAttributes')->find($id);
|
||||
return response()->json($equipment->specificAttributes);
|
||||
}
|
||||
|
||||
public function removingElementalTasksFromProject(Request $request)
|
||||
{
|
||||
|
||||
$receiveAllEquipmentWorkHistory = EquipmentWorkHistory::where('company_projects_id', $request->numberProject)
|
||||
->where('equipment_status_project', 0)
|
||||
->get();
|
||||
$equipmentWorkHistoryIds = $receiveAllEquipmentWorkHistory->pluck('equipmentWorkHistorys_id')->toArray();
|
||||
|
||||
|
||||
$tasksToDelete = $request->tasks; // IDs das tarefas a serem deletadas vindo do request.
|
||||
|
||||
// Loop através dos IDs de EquipmentWorkHistory
|
||||
foreach ($equipmentWorkHistoryIds as $historyId) {
|
||||
// Recuperar todas as tarefas associadas ao EquipmentWorkHistory atual
|
||||
$tasks = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $historyId)->get();
|
||||
|
||||
// Filtrar e deletar as tarefas que estão no array $tasksToDelete
|
||||
$filteredTasks = $tasks->whereIn('elemental_tasks_id', $tasksToDelete);
|
||||
OrderEquipmentTasks::destroy($filteredTasks->pluck('id')); // Deletar tarefas filtradas
|
||||
|
||||
// Recuperar novamente as tarefas restantes após a exclusão para reordenar
|
||||
$remainingTasks = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $historyId)
|
||||
->orderBy('execution_order')
|
||||
->get();
|
||||
|
||||
// Reordenar as execution_order das tarefas restantes
|
||||
foreach ($remainingTasks as $index => $task) {
|
||||
$task->execution_order = $index + 1; // Ajustar a execution_order baseada no índice
|
||||
$task->save(); // Salvar as mudanças
|
||||
}
|
||||
}
|
||||
return back()->with('success','Tarefas removidas de todos os equipamentos com sucesso !!');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ protected function getAllowedRoutesForUserType($userType)
|
|||
'createCompany','ShowPendingUser','register','download','projectDetails_11','editEquipment','EditprocessStep1','createWorkStations','workstationsAssociationTasks','finishCreatingProject',
|
||||
'preparedProject','EditProjectForArticulated','companyEdit','reportingDataClient','ExecutionProject',
|
||||
'changeFromExecutionToPlanning','deleteWorkstation','deleteProject','showQrcodesInProject','showDataDetailsProjectClient',
|
||||
'getDataAmbitsOfProject', 'showReportingForAmbitsProject','getEquipmentsOfAmbit','getDataEquipmentsOfProject',
|
||||
'getDataAmbitsOfProject', 'showReportingForAmbitsProject','getEquipmentsOfAmbit','getDataEquipmentsOfProject','removingElementalTasksFromProject',
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -723,7 +723,7 @@ class="form-control card_inputs" id="isolation"
|
|||
</div>
|
||||
<div class="col-sm">
|
||||
<a class="btn btn-success float-right"
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['equipmentStatus'=>2,'projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
Detalhes</a>
|
||||
|
||||
</div>
|
||||
|
|
@ -1337,7 +1337,7 @@ class="form-control card_inputs" id="isolationEquipment"
|
|||
</div>
|
||||
<div class="col-sm">
|
||||
<a class="btn btn-success float-right"
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['equipmentStatus'=>2,'projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
Detalhes</a>
|
||||
|
||||
</div>
|
||||
|
|
@ -2135,7 +2135,7 @@ class="form-control card_inputs"
|
|||
</div>
|
||||
<div class="col-sm">
|
||||
<a class="btn btn-success float-right"
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
href="{{ route('showAmbitDetailsProjectHistory', ['equipmentStatus'=>2,'projectID' => $detailsEquipmentWorkHistory->company_projects_id, 'equipmentID' => $dataEquipment->equipment_id]) }}">Mais
|
||||
Detalhes</a>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,19 @@
|
|||
</script>
|
||||
@endif
|
||||
|
||||
@if (session('danger'))
|
||||
<div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
|
||||
{{ session('danger') }}
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
$('#alert-message-danger').fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000); // A mensagem desaparecerá após 5 segundos
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@if (session('errors'))
|
||||
@php
|
||||
$allMissingTasks = session('errors');
|
||||
|
|
@ -49,13 +62,16 @@ class="fas fa-minus"></i>
|
|||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>{{-- ./card card-danger --}}
|
||||
</div>
|
||||
@endif
|
||||
</div>{{-- ./row --}}
|
||||
|
||||
@if (count($allMissingTasks['elemental']) > 0)
|
||||
<div class="row">
|
||||
|
||||
{{-- @if (count($allMissingTasks['elemental']) > 0)
|
||||
<div class="col-sm">
|
||||
<div class="card card-danger">
|
||||
<div class="card-header">
|
||||
|
|
@ -76,9 +92,67 @@ class="fas fa-minus"></i>
|
|||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>{{-- ./card card-danger --}}
|
||||
</div><!-- ./card card-danger -->
|
||||
</div>
|
||||
@endif
|
||||
@endif --}}
|
||||
<div class="col-sm">
|
||||
<form action="{{route('removingElementalTasksFromProject')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="numberProject" value="{{ $numberProject }}">
|
||||
@if (count($allMissingTasks['elemental']) > 0)
|
||||
<div class="card card-danger">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Tarefas elementares não atribuídas - (Seleciona para remover da obra, se necessário)</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse">
|
||||
<i class="fas fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" style="padding: 0; margin-bottom: 0%">
|
||||
<ul class="list-group scrollable-list">
|
||||
@foreach ($allMissingTasks['elemental'] as $taskId => $taskDetails)
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center"
|
||||
aria-current="true">
|
||||
<div>
|
||||
<input class="task-checkbox" type="checkbox" name="tasks[]"
|
||||
value="{{ $taskId }}">
|
||||
{{ $taskDetails['code'] }} - {{ $taskDetails['description'] }}
|
||||
</div>
|
||||
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-info btn-sm" data-toggle="tooltip"
|
||||
data-placement="top" title="Todas as tarefas selecionadas serão retiradas de execução, e consequentemente, todos os equipamentos deixarão de ter essas tarefas para realizar. Para reverter esta alteração, basta entrar nos equipamentos individualmente e adicionar a tarefa removida. Assim, apenas os equipamentos que tiverem a tarefa adicionada realizarão a mesma.">
|
||||
Info
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="select-all">Selecionar
|
||||
Todos</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm float-right">Submeter</button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#select-all').click(function() {
|
||||
$('.task-checkbox').prop('checked', true);
|
||||
});
|
||||
|
||||
// Inicializa tooltips para os botões de info
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@if (count($allMissingTasks['further']) > 0)
|
||||
<div class="col-sm">
|
||||
<div class="card card-danger">
|
||||
|
|
@ -103,17 +177,12 @@ class="fas fa-minus"></i>
|
|||
</div>{{-- ./card card-danger --}}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>{{-- ./row --}}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
|
||||
@foreach (session('errors') as $error)
|
||||
{!! $error !!}
|
||||
<br>
|
||||
@endforeach
|
||||
</div> --}}
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
|
|
@ -157,16 +226,16 @@ class="fas fa-minus"></i>
|
|||
<input type="hidden" name="numberProject" value="{{ $numberProject }}">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<label class="mt-3" for="inputName" style="margin-right: 10px;">
|
||||
<label class="mt-3" for="inputName" style="margin-right: 10px;">
|
||||
Qtd. de Postos pretendidos :
|
||||
</label>
|
||||
<input class="form-control mt-3 mr-2" name="numberWorkstations" type="number"
|
||||
id="numberPosts">
|
||||
<button class="btn btn-success mb-2 " type="submit" value="Guardar"
|
||||
<input class="form-control mt-3 mr-2" name="numberWorkstations"
|
||||
type="number" id="numberPosts">
|
||||
<button class="btn btn-success mb-2 " type="submit" value="Guardar"
|
||||
type="button" style="align-self: flex-end;">Criar</button>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -238,8 +307,7 @@ class="btn btn-primary previous float-left mb-3">Articulado</a>
|
|||
</fieldset>
|
||||
{{-- ./content --}}
|
||||
@foreach ($listWorkstations as $listWorkstation)
|
||||
|
||||
@livewire('articulado.select-elemental-tasks-in-wonkstation', ['workstation' => $listWorkstation, 'key' => $listWorkstation->id_workstations])
|
||||
@livewire('articulado.select-elemental-tasks-in-wonkstation', ['workstation' => $listWorkstation, 'key' => $listWorkstation->id_workstations])
|
||||
|
||||
|
||||
{{-- modal-remover --}}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,8 @@
|
|||
Route::post('CreateNewEquipmentFromPendingEquipment/{id}', 'CreateNewEquipmentFromPendingEquipment')->name('CreateNewEquipmentFromPendingEquipment');
|
||||
Route::post('create-equipament-project', 'createEquipamentProject')->name('createEquipamentProject');
|
||||
Route::get('equipments/{id}/attributes', 'getAttributes');
|
||||
|
||||
Route::post('removingElementalTasksFromProject','removingElementalTasksFromProject')->name('removingElementalTasksFromProject');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Template Excel
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user