Commit bec929e8 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Module Soutenance : Ajout d'une modale de confirmation lors de l'annulation d'une soutenance

parent 26859df8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ Journal des modifications
6.0.2
-----
- [SQL] Amélioration des libellés des 2 paramètres du module Rapport d'activité.
- Soutenance : Masquage du warning si la soutenance n'est plus à l'état EN_COURS
- Module Soutenance : Masquage des avertissements sur l'état du dossier si la soutenance n'est plus à l'état EN_COURS
- Module Soutenance : Ajout d'une modale de confirmation lors de l'annulation d'une soutenance

6.0.1
-----
+32 −14
Original line number Diff line number Diff line
@@ -384,11 +384,15 @@ class PresoutenanceController extends AbstractController
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

    public function stopperDemarcheAction() : Response
    public function stopperDemarcheAction() : ViewModel
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            if ($data["reponse"] === "oui") {
                $etat = $this->getPropositionService()->findPropositionEtatByCode(Etat::REJETEE);
                $proposition->setEtat($etat);
                $this->getPropositionService()->update($proposition);
@@ -404,7 +408,21 @@ class PresoutenanceController extends AbstractController
                    ->addSuccessMessage("Notifications d'arrêt des démarches de soutenance soutenance envoyées");

                $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_ETAT, "Annulation de la soutenance");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
                exit();
            }
        }

        $vm = new ViewModel();
        if ($proposition !== null) {
            $vm->setTemplate('soutenance/default/confirmation');
            $vm->setVariables([
                'title' => "Annuler/Rejeter la proposition de soutenance",
                'text' => "L'annulation effacera le dossier de soutentance et les justificatifs associés. Êtes-vous sûr·e de vouloir continuer ?",
                'action' => $this->url()->fromRoute('soutenance/presoutenance/stopper-demarche', ['these' => $these->getId()], [], true),
            ]);
        }
        return $vm;

    }

    public function modifierAdresseAction() : ViewModel
+48 −0
Original line number Diff line number Diff line
<?php

/**
 * @var string $title
 * @var string $text
 * @var string $action
 * @var bool $justificationOui
 * @var bool $justificationNon
 */

?>

<p class="lead">
<?php echo $text; ?>
</p>


<table style="width: 100%;">
    <tr><td style="width: 50%;">
<form method="post" action="<?php echo $action; ?>">
    <input type="hidden" name="reponse" value="oui">
    <?php if ($justificationOui === true) : ?>
        <label for="justification-oui"> Justification </label>
        <textarea id="justification-oui" name="justification-oui" style="width: 95%;" placeholder="Merci de justifier"></textarea><br/>
    <?php endif; ?>
    <input type="submit" name="reponse" class="btn btn-success action" value="Oui, je suis sûr&middot;e">
</form>
        </td><td style="width: 50%;">
<form method="post" action="<?php echo $action; ?>">
    <input type="hidden" name="reponse" value="non">
    <?php if ($justificationNon === true) : ?>
        <label for="justification-non"> Justification </label>
        <textarea id="justification-non" name="justification-non"  style="width: 95%;" placeholder="Merci de justifier"></textarea><br/>
    <?php endif; ?>
    <input type="submit" id="non" name="reponse" class="btn btn-danger action"  value="Non, je ne veux pas">
</form>
        </td></tr>
</table>

<script>
    $(function() {
        $("input#non").click(function(e){
            $('div.modal').modal('hide');
            e.preventDefault(e);
        });
    });
</script>
+15 −8
Original line number Diff line number Diff line
@@ -346,15 +346,15 @@ $canSimulerRemonter = $this->isAllowed(PresoutenancePrivileges::getResourceId(Pr
                    <span class="fas fa-thumbs-up"></span>
                    Donner le feu vert
                </a>
            <?php endif; ?>

                <?php /** @see \Soutenance\Controller\PresoutenanceController::stopperDemarcheAction() */ ?>
                <a href="<?php echo $this->url('soutenance/presoutenance/stopper-demarche', ['these' => $these->getId()], [], true); ?>"
               class="btn btn-danger action"
                   class="btn btn-danger action ajax-modal" data-event="annuler-soutenance"
                >
                    <span class="fas fa-thumbs-down"></span>
                Stopper les démarches
                    Annuler/Rejeter la proposition de soutenance
                </a>
            <?php endif; ?>


            <?php echo $this->derniersHorodatages($proposition, [
@@ -487,6 +487,13 @@ $canSimulerRemonter = $this->isAllowed(PresoutenancePrivileges::getResourceId(Pr
</style>

<script>
    $(function() {
        $("body").on("annuler-soutenance", function (event) {
            event.div.modal('hide');
            window.location.reload();
        });
    });

    $(function() {
        $("body").on("modification-date-rendu-rapport", function (event) {
            event.div.modal('hide');