Commit 2b04756c authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Code mort suite refonte discipline en vuejs

parent 2aea8475
Loading
Loading
Loading
Loading
+0 −1
Changes for front/Discipline/Discipline.vue: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ async function sauvegarderDiscipline(discipline) {
            unicaenVue.url('discipline/modifier-json'),
            data
        );
        console.log(response);
        if (!response.data.success) {
            console.error(response.data.errors);
            return false;
+1 −15
Changes for module/OffreFormation/config/module.config.php: 1 added line, 15 removed lines.
Original line number Diff line number Diff line
@@ -216,20 +216,6 @@ return [
                    ],
                    'action'      => 'voir',
                ],
                'saisir'    => [
                    'route'       => '/saisir[/:discipline]',
                    'constraints' => [
                        'discipline' => '[0-9]*',
                    ],
                    'action'      => 'saisir',
                ],
                'supprimer' => [
                    'route'       => '/supprimer/:discipline',
                    'constraints' => [
                        'discipline' => '[0-9]*',
                    ],
                    'action'      => 'supprimer',
                ],
                'index-json' => [
                    'route'  => '/index-json',
                    'action' => 'index-json',
@@ -542,7 +528,7 @@ return [
        ],
        [
            'controller' => DisciplineController::class,
            'action'     => ['saisir', 'supprimer', 'modifier-json', 'supprimer-json'],
            'action'     => ['modifier-json', 'supprimer-json'],
            'privileges' => [
                Privileges::DISCIPLINE_EDITION,
            ],
+3 −66
Changes for module/OffreFormation/src/Controller/DisciplineController.php: 3 added lines, 66 removed lines.
Original line number Diff line number Diff line
@@ -26,23 +26,8 @@ class DisciplineController extends AbstractController

    public function indexAction()
    {
        $this->em()->getFilters()->enable('historique')->init([
            Discipline::class,
        ]);
        $qb = $this->getServiceDiscipline()->initQuery()[0];
        $this->getServiceDiscipline()->join($this->getServiceSource(), $qb, 'source', true);

        $disciplines = $this->getServiceDiscipline()->getList($qb);

        $libellesCodesCorresp = [];
        for ($i = 1; $i <= 4; $i++) {
            $lcc = $this->getServiceParametres()->get('discipline_codes_corresp_' . $i . '_libelle');
            if ($lcc) {
                $libellesCodesCorresp[$i] = $lcc;
            }
        }

        return compact('disciplines', 'libellesCodesCorresp');
        // Les données sont chargées par le composant Vue via indexJsonAction
        return [];
    }

    public function indexJsonAction()
@@ -90,13 +75,10 @@ class DisciplineController extends AbstractController
            ];
        }

        $sourceImportable = $discipline->getSource()->getImportable();

        $result[] = [
            $libellesCodesCorresp,
            $disciplinesListe,
            $sourceImportable
        ];
            $disciplinesListe];

        return new AxiosModel($result);
    }
@@ -108,37 +90,6 @@ class DisciplineController extends AbstractController
    }


    public function saisirAction()
    {
        $discipline = $this->getEvent()->getParam('discipline');
        $errors = [];

        $form = $this->getFormDiscipline();
        if (empty($discipline)) {
            $title = 'Création d\'une nouvelle discipline';
            $discipline = $this->getServiceDiscipline()->newEntity();
            $form->setObject($discipline);
        } else {
            $title = 'Édition de la discipine';
            $form->bind($discipline);
        }

        $request = $this->getRequest();
        if ($request->isPost()) {
            $form->setData($request->getPost());
            if ($form->isValid()) {
                try {
                    $this->getServiceDiscipline()->save($discipline);
                    $form->get('id')->setValue($discipline->getId()); // transmet le nouvel ID
                } catch (\Exception $e) {
                    $errors[] = $this->translate($e);
                }
            }
        }

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

    public function modifierJsonAction()
    {
        $request = $this->getRequest();
@@ -194,20 +145,6 @@ class DisciplineController extends AbstractController
        }
    }

    public function supprimerAction()
    {
        $discipline = $this->getEvent()->getParam('discipline');

        $title = "Suppression de la discipline";

        $form = $this->makeFormSupprimer(function () use ($discipline) {
            $this->getServiceDiscipline()->delete($discipline);
        });

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


    public function supprimerJsonAction()
    {
        $request = $this->getRequest();
+0 −2
Changes for module/OffreFormation/template_map.php: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -25,9 +25,7 @@ return [
    'offre-formation/type-intervention/saisie'                                => __DIR__ . '/view/offre-formation/type-intervention/saisie.phtml',
    'offre-formation/type-intervention/type-intervention-structure-saisie'    => __DIR__ . '/view/offre-formation/type-intervention/type-intervention-structure-saisie.phtml',
    'offre-formation/type-intervention/index'                                 => __DIR__ . '/view/offre-formation/type-intervention/index.phtml',
    'offre-formation/discipline/supprimer'                                    => __DIR__ . '/view/offre-formation/discipline/supprimer.phtml',
    'offre-formation/discipline/voir'                                         => __DIR__ . '/view/offre-formation/discipline/voir.phtml',
    'offre-formation/discipline/saisir'                                       => __DIR__ . '/view/offre-formation/discipline/saisir.phtml',
    'offre-formation/discipline/index'                                        => __DIR__ . '/view/offre-formation/discipline/index.phtml',
    'offre-formation/element-pedagogique/supprimer'                           => __DIR__ . '/view/offre-formation/element-pedagogique/supprimer.phtml',
    'offre-formation/element-pedagogique/voir'                                => __DIR__ . '/view/offre-formation/element-pedagogique/voir.phtml',
+0 −70
Changes for module/OffreFormation/view/offre-formation/discipline/index.phtml: 0 added lines, 70 removed lines.
Original line number Diff line number Diff line
@@ -4,79 +4,9 @@ $this->headTitle()->append("Gestion des disciplines");

use Application\Provider\Privilege\Privileges;

/* @var $disciplines \OffreFormation\Entity\Db\Discipline[] */
/* @var $libellesCodesCorresp string[] */

$canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DISCIPLINE_EDITION));

//function truncCodesCorresp ($value)
//{
//    if (!empty($value)) {
//        if (strlen($value) > 20) $value = '<span title="' . str_replace(',', ', ', $value) . '">' . substr($value, 0, 19) . '...</span>';
//
//        return str_replace(',', ', ', $value);
//    }
//
//    return $value;
//}


?>
<!--<h1 class="page-header">Gestion des disciplines</h1>-->
<!--<table class="table table-bordered table-sort">-->
<!--    <thead>-->
<!--    <tr>-->
<!--        <th>Code</th>-->
<!--        <th>Libellé court</th>-->
<!--        <th>Libellé long</th>-->
<!--        --><?php //if (isset($libellesCodesCorresp[1])) echo '<th>' . $libellesCodesCorresp[1] . '</th>' ?>
<!--        --><?php //if (isset($libellesCodesCorresp[2])) echo '<th>' . $libellesCodesCorresp[2] . '</th>' ?>
<!--        --><?php //if (isset($libellesCodesCorresp[3])) echo '<th>' . $libellesCodesCorresp[3] . '</th>' ?>
<!--        --><?php //if (isset($libellesCodesCorresp[4])) echo '<th>' . $libellesCodesCorresp[4] . '</th>' ?>
<!--        <th>Src/Actions</th>-->
<!--    </tr>-->
<!--    </thead>-->
<!--    <tbody>-->
<!--    --><?php //foreach ($disciplines as $discipline): ?>
<!--        <tr>-->
<!--            <td style="text-align: center">--><?php //= $discipline->getSourceCode(); ?><!--</td>-->
<!--            <td>--><?php //= $discipline->getLibelleCourt(); ?><!--</td>-->
<!--            <td>--><?php //= $discipline->getLibelleLong(); ?><!--</td>-->
<!--            --><?php //if (isset($libellesCodesCorresp[1])) echo '<td>' . truncCodesCorresp($discipline->getCodesCorresp1()) . '</td>' ?>
<!--            --><?php //if (isset($libellesCodesCorresp[2])) echo '<td>' . truncCodesCorresp($discipline->getCodesCorresp2()) . '</td>' ?>
<!--            --><?php //if (isset($libellesCodesCorresp[3])) echo '<td>' . truncCodesCorresp($discipline->getCodesCorresp3()) . '</td>' ?>
<!--            --><?php //if (isset($libellesCodesCorresp[4])) echo '<td>' . truncCodesCorresp($discipline->getCodesCorresp4()) . '</td>' ?>
<!--            <td style="text-align: center">-->
<!--                --><?php //if (!$discipline->getSource()->getImportable() && $canEdit): ?>
<!--                    <a class="ajax-modal" data-event="discipline-edition" href="--><?php //= $this->url('discipline/saisir', ['discipline' => $discipline->getId()]) ?><!--"-->
<!--                       title="Modifier la discipline"><i class="fas fa-pen-to-square"></i></a>-->
<!--                    <a class="ajax-modal" data-event="discipline-suppression"-->
<!--                       href="--><?php //= $this->url('discipline/supprimer', ['discipline' => $discipline->getId()]) ?><!--" title="Supprimer la discipline"><i-->
<!--                                class="fas fa-trash-can"></i></a>-->
<!--                --><?php //else: ?>
<!--                    --><?php //= $discipline->getSource(); ?>
<!--                --><?php //endif; ?>
<!--            </td>-->
<!--        </tr>-->
<!--    --><?php //endforeach; ?>
<!--    </tbody>-->
<!--</table>-->
<div>
    <?= $this->vue('discipline/Discipline', ['canEdit' => $canEdit]); ?>
</div>
<?php //if ($canEdit): ?>
<!--    <a class="btn btn-primary ajax-modal" data-event="discipline-edition" href="--><?php //= $this->url('discipline/saisir'); ?><!--"><i class="fas fa-plus"></i> Ajout-->
<!--        d'une-->
<!--        nouvelle discipline</a>-->
<?php //endif; ?>
<script type="text/javascript">
    $(function () {
        $("body").on("discipline-edition", function (event, data) {
            window.location.reload();
        });

        $("body").on("discipline-suppression", function (event, data) {
            window.location.reload();
        });
    });
</script>
 No newline at end of file
Loading