Commit 1434037f authored by joriot221's avatar joriot221
Browse files

correction ajout groupe

todo : corriger suppression, ajout type
parent 8a27a116
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -81,14 +81,12 @@ class TypeFormationController extends AbstractController
        }
        $form->bindRequestSave($groupeTypeFormation, $this->getRequest(), function () use ($groupeTypeFormation, $form) {


            $this->getServiceTypeFormation()->save($groupeTypeFormation);
            $this->getServiceGroupeTypeFormation()->save($groupeTypeFormation);
            $this->flashMessenger()->addSuccessMessage(
                "Ajout réussis"
            );
        });


        return compact('form', 'title');
    }

@@ -97,21 +95,20 @@ class TypeFormationController extends AbstractController
    public
    function supprimerAction()
    {
//        $typeformation = $this->getEvent()->getParam('typeformation');
//        $this->getServicetypeformation()->delete($typeformation, false);
//
//        return new MessengerViewModel();
    }
        $typeformation = $this->getEvent()->getParam('typeFormation');
        $this->getServiceTypeFormation()->delete($typeformation, true);

        return new MessengerViewModel();
    }


    public
    function supprimerGroupeAction()
    {
//        $typeformation = $this->getEvent()->getParam('typeformation');
//        $this->getServicetypeformation()->delete($typeformation, false);
//
//        return new MessengerViewModel();
        $typeformation = $this->getEvent()->getParam('groupeFypeFormation');
        $this->getServiceGroupeTypeFormation()->delete($typeformation, true);

        return new MessengerViewModel();
    }


+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ class TypeFormationSaisieForm extends AbstractForm
        $this->get('libelleLong')->setLabel('Libellé long');
        $this->setValueOptions('groupe', $this->getServiceGroupeTypeFormation()->getList());

        $this->addSubmit();

        return $this;
    }

+20 −1
Original line number Diff line number Diff line
@@ -32,7 +32,26 @@ class GroupeTypeFormationService extends AbstractEntityService
     *
     * @return string
     */
    public function getAlias(){
    public function getAlias()
    {
        return 'gtf';
    }



    /**
     * Sauvegarde la periode
     *
     * @param Periode $entity
     */
    public function save($entity)
    {
        if (empty($entity->getOrdre())) {
            $ordre = (int)$this->getEntityManager()->getConnection()->fetchOne("SELECT MAX(ORDRE) M FROM GROUPE_TYPE_FORMATION gtf");
            $ordre++;
            $entity->setOrdre($ordre);
        }

        return parent::save($entity);
    }
}
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
@@ -56,5 +56,4 @@ class TypeFormationService extends AbstractEntityService
        $qb->addOrderBy("$alias.libelleLong");
        return parent::getList($qb, $alias);
    }

}
 No newline at end of file
+2 −3
Original line number Diff line number Diff line
@@ -97,8 +97,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
    <tr class="champ-triable">
        <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie'); ?>"><i
                    class="fas fa-plus"></i>
            Ajout
            d'un nouveau type de formation</a>
            Ajout d'un nouveau type de formation</a>
    </tr>
<?php endif; ?>

@@ -132,7 +131,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
    });

    $(function () {
        $("body").on("groupe-formation-edition", function (event, data) {
        $("body").on("groupe-type-formation-edition", function (event, data) {
            window.location.reload();
        });
    });