Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] Suppression du code mort lié à l'ancien formulaire #2315

Merged
merged 10 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ WIDGET_SIGNALEMENT_ACCEPTED_NO_SUIVI_CACHE_EXPIRED_AFTER=30 #second
WIDGET_SIGNALEMENT_TERRITOIRE_CACHE_EXPIRED_AFTER=30 #second
WIDGET_ESABORA_EVENTS_CACHE_EXPIRED_AFTER=3600 #second
FEATURE_ASK_VISITE_ENABLE=1
FEATURE_NEW_FORM_ENABLE=0
FEATURE_OILHI_ENABLE=1
FEATURE_DOCUMENTS_ENABLE=1
CRON_ENABLE=1
Expand Down
1 change: 0 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
HISTOLOGE_URL=http://localhost:8080
WIREMOCK_HOSTNAME=histologe_wiremock
WIREMOCK_PORT=8080
FEATURE_NEW_FORM_ENABLE=1
FEATURE_OILHI_ENABLE=1
FEATURE_ASK_VISITE_ENABLE=1
FEATURE_DOCUMENTS_ENABLE=1
Expand Down
31 changes: 1 addition & 30 deletions assets/styles/histologe.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ pre {
max-width: 100%;
}


.fr-hover-critere:hover {
background: rgba(0, 0, 145, 0.15);
}

[aria-expanded="true"] .fr-hover-critere {
background: rgba(0, 0, 145, 0.15);
}

/*STYLE*/
.fr-w-100 {
width: 100%;
Expand Down Expand Up @@ -138,7 +129,7 @@ pre {
background-color: rgba(191, 204, 251, 0.37);
}

.fr-toggle--parent, .fr-accordion, .toggle-criticite, [role="button"], .fr-list--hover li, .fr-btn, .fr-checkbox-affectation__parent, .fr-checkbox-affectation__parent label {
.fr-toggle--parent, .fr-accordion, [role="button"], .fr-list--hover li, .fr-btn, .fr-checkbox-affectation__parent, .fr-checkbox-affectation__parent label {
cursor: pointer !important;
user-select: none;
}
Expand All @@ -148,11 +139,6 @@ pre {
background-color: var(--background-alt-grey);
}

.toggle-criticite:hover {
border-radius: .25rem;
background-color: white;
}

.fr-rounded {
border-radius: .25rem;
}
Expand Down Expand Up @@ -388,21 +374,6 @@ a.fr-btn.fr-btn--icon-left.fr-fi-file-pdf-fill.ignore-blank-style::before {
resize: vertical;
}

.toggle-criticite > input[type="radio"] {
width: 60px;
height: 50px;
position: relative;
}

.toggle-criticite > input[type="radio"]::before {
position: absolute;
content: '';
top: 0;
left: 25%;
width: 50px;
height: 50px;
}

.bar-bulle {
position: relative;
}
Expand Down
7 changes: 0 additions & 7 deletions config/app/nondecence.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
imports:
- { resource: 'app/widgets.yaml'}
- { resource: 'app/insee.yaml'}
- { resource: 'app/nondecence.yaml'}
- { resource: 'app/documents.yaml'}
- { resource: 'app/competences.yaml'}
- { resource: 'app/suivi_messages.yaml'}
Expand All @@ -31,7 +30,6 @@ parameters:
cron_enable: '%env(bool:CRON_ENABLE)%'
mail_enable: '%env(bool:MAIL_ENABLE)%'
feature_ask_visite: '%env(FEATURE_ASK_VISITE_ENABLE)%'
feature_new_form: '%env(bool:FEATURE_NEW_FORM_ENABLE)%'
feature_oilhi_enable: '%env(bool:FEATURE_OILHI_ENABLE)%'
feature_documents_enable: '%env(bool:FEATURE_DOCUMENTS_ENABLE)%'
platform_name: 'Histologe'
Expand Down
778 changes: 31 additions & 747 deletions public/js/app.js

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions public/js/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,6 @@ const serializeArray = (form) => {
return response
}, {})
};
const checkFirstStep = (form) => {
return !(form.id === "signalement-step-2" && null === form.querySelector('[type="radio"]:checked') || form.id === "signalement-step-2" && form.querySelectorAll('[type="checkbox"]:checked').length !== form.querySelectorAll('[type="radio"]:checked').length);
}
const checkFieldset = (form) => {
let field = form.querySelector('fieldset[aria-required="true"]')
if (field) {
if (null === field.querySelector('[type="checkbox"]:checked')) {
field.classList.add('fr-fieldset--error');
field?.querySelector('.fr-error-text')?.classList.remove('fr-hidden');
invalid = field.parentElement;
return false;
} else {
field.classList.remove('fr-fieldset--error');
field?.querySelector('.fr-error-text')?.classList.add('fr-hidden');
return true;
}
} else
return true;
}
const goToStep = (step) => {
document.querySelector('#signalement-step-' + step + '-btn').click();
}
const sortTableFunction = (table) => {
return function (ev) {
if (ev.target.tagName.toLowerCase() === 'A') {
Expand Down
30 changes: 0 additions & 30 deletions public/js/const.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 0 additions & 73 deletions src/Controller/Back/SignalementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,20 @@
use App\Entity\Intervention;
use App\Entity\Signalement;
use App\Entity\SignalementQualification;
use App\Entity\Suivi;
use App\Entity\User;
use App\Event\SignalementClosedEvent;
use App\Event\SignalementViewedEvent;
use App\Form\ClotureType;
use App\Form\SignalementType;
use App\Manager\AffectationManager;
use App\Manager\SignalementManager;
use App\Repository\AffectationRepository;
use App\Repository\CriticiteRepository;
use App\Repository\DesordrePrecisionRepository;
use App\Repository\InterventionRepository;
use App\Repository\SignalementQualificationRepository;
use App\Repository\SituationRepository;
use App\Repository\TagRepository;
use App\Security\Voter\UserVoter;
use App\Service\FormHelper;
use App\Service\Signalement\CriticiteCalculator;
use App\Service\Signalement\Qualification\SignalementQualificationUpdater;
use App\Service\Signalement\SignalementDesordresProcessor;
use DateTimeImmutable;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
Expand Down Expand Up @@ -212,7 +205,6 @@ public function viewSignalement(
'listConcludeProcedures' => $listConcludeProcedures,
'partnersCanVisite' => $partnerVisite,
'pendingVisites' => $interventionRepository->getPendingVisitesForSignalement($signalement),
'isNewFormEnabled' => $parameterBag->get('feature_new_form'),
'isDocumentsEnabled' => $parameterBag->get('feature_documents_enable'),
]);
}
Expand All @@ -226,71 +218,6 @@ private function isSignalementNDEActif(?SignalementQualification $signalementQua
return false;
}

#[Route('/{uuid}/editer', name: 'back_signalement_edit', methods: ['GET', 'POST'])]
public function editSignalement(
Signalement $signalement,
Request $request,
ManagerRegistry $doctrine,
SituationRepository $situationRepository,
CriticiteCalculator $criticiteCalculator,
SignalementQualificationUpdater $signalementQualificationUpdater,
ParameterBagInterface $parameterBag,
): Response {
$this->denyAccessUnlessGranted('SIGN_EDIT', $signalement);
if (Signalement::STATUS_ACTIVE !== $signalement->getStatut()) {
$this->addFlash('error', "Ce signalement n'est pas éditable.");

return $this->redirectToRoute('back_index');
}
if ($parameterBag->get('feature_new_form')) {
return $this->redirectToRoute('back_signalement_view', ['uuid' => $signalement->getUuid()]);
}
$title = 'Administration - Edition signalement #'.$signalement->getReference();
$etats = ['Etat moyen', 'Mauvais état', 'Très mauvais état'];
$etats_classes = ['moyen', 'grave', 'tres-grave'];
$form = $this->createForm(SignalementType::class, $signalement);
$form->handleRequest($request);
if ($form->isSubmitted()) {
if ($form->isValid()) {
$signalement->setModifiedBy($this->getUser());
$signalement->setModifiedAt(new DateTimeImmutable());
$signalement->setScore($criticiteCalculator->calculate($signalement));

$signalementQualificationUpdater->updateQualificationFromScore($signalement);
$suivi = new Suivi();
$suivi->setCreatedBy($this->getUser());
$suivi->setSignalement($signalement);
$suivi->setIsPublic(false);
$suivi->setDescription('Modification du signalement par un partenaire');
$suivi->setType(SUIVI::TYPE_AUTO);
$doctrine->getManager()->persist($suivi);
$signalement->setGeoloc($form->getExtraData()['geoloc']);
$signalement->setInseeOccupant($form->getExtraData()['inseeOccupant']);
$doctrine->getManager()->persist($signalement);
$doctrine->getManager()->flush();
$this->addFlash('success', 'Signalement modifié avec succès !');

return $this->json(['response' => 'success_edited']);
}

return $this->json(
[
'response' => 'formErrors',
'errsMsgList' => FormHelper::getErrorsFromForm($form),
],
);
}

return $this->render('back/signalement/edit.html.twig', [
'title' => $title,
'form' => $form->createView(),
'signalement' => $signalement,
'situations' => $situationRepository->findAllActive(),
'etats' => $etats,
'etats_classes' => $etats_classes,
]);
}

#[Route('/{uuid}/supprimer', name: 'back_signalement_delete', methods: 'POST')]
public function deleteSignalement(Signalement $signalement, Request $request, ManagerRegistry $doctrine): Response
{
Expand Down
2 changes: 0 additions & 2 deletions src/Controller/Back/SignalementListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function index(
return $this->stream('back/table_result.html.twig', [
'filters' => $filters,
'signalements' => $signalements,
'isNewFormEnabled' => $parameterBag->get('feature_new_form'),
]);
}

Expand All @@ -47,7 +46,6 @@ public function index(
'countActiveFilters' => $searchFilterService->getCountActive(),
'displayRefreshAll' => true,
'signalements' => $signalements,
'isNewFormEnabled' => $parameterBag->get('feature_new_form'),
]);
}
}
Loading
Loading