Commit b0d38978 authored by Johnny Leveneur's avatar Johnny Leveneur
Browse files

initialisation

parent 1d9b8560
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ return [
                [
                    'controller' => InscriptionController::class,
                    'action' => [
                        'supprimer',
                        'supprimer', "supprimer-place"
                    ],
                    'privileges' => [
                        EvenementielinscriptionPrivileges::SUPPRIMER,
@@ -264,6 +264,16 @@ return [
                                    ],
                                ],
                            ],
                          'supprimer-place' => [
                                'type' => Segment::class,
                                'options' => [
                                    'route' => '/supprimer-place/:entity[/:place]',
                                    'defaults' => [
                                        /** @see InscriptionController::supprimerPlaceAction() */
                                        'action' => 'supprimer-place',
                                    ],
                                ],
                            ],
                            'pointer-msg' => [
                                'type' => Segment::class,
                                'options' => [
+23 −0
Original line number Diff line number Diff line
@@ -297,6 +297,29 @@ class InscriptionController extends AbstractActionController
        return $this->redirect()->toRoute("evenementiel/inscription", [], [], true);
    }

    public function supprimerPlaceAction(): ViewModel
    {
        $inscription = $this->getInscriptionService()->getRequestedEntity($this);
        $inscriptionPlace = $this->getInscriptionService()->getRequestedInscriptionPlace($this, $inscription);

        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost();
            if ($data["reponse"] === "oui") {
//                $this->getInscriptionService()->
            }
            exit();
        }

        $vm = new ViewModel();
        $vm->setTemplate("default/confirmation");
        $vm->setVariables([
            "title" => "Supprimer une place",
            "text" => "La suppression est définitive êtes-vous sûr·e de vouloir continuer ?",
            "action" => $this->url()->fromRoute("evenementiel/inscription/supprimer-place", ['entity' => $inscription->getId(), 'place' => $inscriptionPlace->getId()]),
        ]);
        return $vm;
    }

    /**
     * Supprimer une entité
     *
+16 −0
Original line number Diff line number Diff line
@@ -26,6 +26,12 @@ class InscriptionPlaces extends AbstractHelper
            )
        );

        $canSupprimerInscription = $isAllowedHelper(
            EvenementielinscriptionPrivileges::getResourceId(
                EvenementielinscriptionPrivileges::SUPPRIMER
            )
        );


        /** @var Inscription $inscription */
        $emptyText = $options['empty_text'] ?? 'Les places ne sont pas renseignées';
@@ -101,6 +107,16 @@ class InscriptionPlaces extends AbstractHelper
                            . '"><span class="icon icon-unchecked" title="Dépointer"> Dépointer</span></a>';
                    }
                }
                if ($canPointerInscription and !$place->isPointee()) {
                    $html .= '<a class="btn btn-danger ajax-modal" href="'
                        . $this->getView()->url('evenementiel/inscription/supprimer-place',
                            [
                                'entity' => $inscription->getId(),
                                'place' => $place->getId()
                            ],
                            true)
                        . '" data-event="modification"> <span class="icon icon-delete" title="Supprimer"></span></a>';
                }
                $html .= "</li>\n";
            }
            $html .= "</ul>\n";