Commit 5788d72c authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

WIP migration recherche intervenant vers VueJS

parent 5b29d2dd
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
<template>
  <h1>Recherche Intervenant</h1>

  <div class="intervenant-recherche">
    <div class="critere">
      Saisissez le nom suivi éventuellement du prénom (2 lettres au moins) :<br/>
      <input id="term" v-on:keydown="rechercher" class="form-control input" type="text"/>
    </div>
  </div>


  <table>
    <thead>
    <th>Nom</th>
    <th>Prenom</th>
    </thead>
    <tbody>
    <tr v-for="intervenant in intervenants" :intervenant="intervenant">
      <td>{{ intervenant.nom }}</td>
      <td>{{ intervenant.prenom }}</td>
    </tr>
    </tbody>
  </table>
</template>

<script>


export default {
  name: 'Recherche',
  data() {
    return {
      searchTerm: [],
      intervenants: [],
    };
  },
  mounted() {
    this.reload();
  },
  methods: {
    rechercher: function (event) {
      this.searchTerm = event.target.value;
      this.reload();
    },
    reload() {
      console.log(this.searchTerm);

      axios.post(
          Util.url("intervenant/recherche-json"), {term: this.searchTerm}
      ).then(response => {
        this.intervenants = response.data;
      });
    },
  }
}
</script>

<style scoped>

</style>
 No newline at end of file
+37 −19
Original line number Diff line number Diff line
@@ -30,6 +30,24 @@ return [
                            ],
                        ],
                    ],
                    'recherche-intervenant' => [
                        'type'    => 'Literal',
                        'options' => [
                            'route'    => '/recherche-intervenant',
                            'defaults' => [
                                'action' => 'recherche-intervenant',
                            ],
                        ],
                    ],
                    'recherche-json'        => [
                        'type'    => 'Literal',
                        'options' => [
                            'route'    => '/recherche-json',
                            'defaults' => [
                                'action' => 'recherche-json',
                            ],
                        ],
                    ],
                    'recherche'             => [
                        'type'    => 'Literal',
                        'options' => [
@@ -293,7 +311,7 @@ return [
            PrivilegeController::class => [
                [
                    'controller' => 'Application\Controller\Intervenant',
                    'action'     => ['rechercher', 'recherche'],
                    'action'     => ['rechercher', 'recherche', 'recherche-json', 'recherche-intervenant'],
                    'privileges' => [
                        Privileges::INTERVENANT_RECHERCHE,
                    ],
+63 −46
Original line number Diff line number Diff line
@@ -2,38 +2,37 @@

namespace Application\Controller;

use Service\Entity\Db\RegleStructureValidation;
use Service\Entity\Db\TypeVolumeHoraire;
use Application\Entity\Db\Validation;
use Service\Entity\Recherche;
use Application\Controller\EtatVolumeHoraire;
use Application\Entity\Db\Intervenant;
use Application\Form\Intervenant\Traits\EditionFormAwareTrait;
use Application\Form\Intervenant\Traits\HeuresCompFormAwareTrait;
use Application\Processus\Traits\IntervenantProcessusAwareTrait;
use Intervenant\Service\NoteServiceAwareTrait;
use Plafond\Processus\PlafondProcessusAwareTrait;
use Referentiel\Processus\ServiceReferentielProcessusAwareTrait;
use Application\Provider\Privilege\Privileges;
use Service\Service\CampagneSaisieServiceAwareTrait;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\DossierServiceAwareTrait;
use Service\Service\EtatVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\FormuleResultatServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\LocalContextServiceAwareTrait;
use Application\Service\Traits\SourceServiceAwareTrait;
use Intervenant\Service\StatutServiceAwareTrait;
use Service\Service\TypeVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\UtilisateurServiceAwareTrait;
use Application\Service\Traits\ValidationServiceAwareTrait;
use Application\Service\Traits\WorkflowServiceAwareTrait;
use UnicaenApp\Traits\SessionContainerTrait;
use Intervenant\Service\NoteServiceAwareTrait;
use Intervenant\Service\StatutServiceAwareTrait;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use LogicException;
use Application\Entity\Db\Intervenant;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
use Plafond\Processus\PlafondProcessusAwareTrait;
use Referentiel\Processus\ServiceReferentielProcessusAwareTrait;
use Service\Entity\Db\TypeVolumeHoraire;
use Service\Service\CampagneSaisieServiceAwareTrait;
use Service\Service\EtatVolumeHoraireServiceAwareTrait;
use Service\Service\TypeVolumeHoraireServiceAwareTrait;
use UnicaenApp\Traits\SessionContainerTrait;
use UnicaenImport\Entity\Differentiel\Query;
use UnicaenImport\Processus\Traits\ImportProcessusAwareTrait;
use UnicaenImport\Service\Traits\DifferentielServiceAwareTrait;
use Laminas\View\Model\ViewModel;
use function Application\Controller\count;

/**
 * Description of IntervenantController
@@ -85,7 +84,6 @@ class IntervenantController extends AbstractController
    }



    public function rechercherAction()
    {
        $recents = $this->getIntervenantsRecents();
@@ -94,7 +92,6 @@ class IntervenantController extends AbstractController
    }



    public function rechercheAction()
    {
        $this->em()->getFilters()->enable('historique')->init([
@@ -112,6 +109,38 @@ class IntervenantController extends AbstractController
        return compact('intervenants');
    }

    public function rechercheJsonAction()
    {
        $recherche = $this->getProcessusIntervenant()->recherche();
        $term = $this->getRequest()->getPost('term');
        var_dump($term);
        die;

        $intervenants = $recherche->rechercher($term, 21);

        $jsonData = [
            'data'     => $intervenants,
            'messages' => null,
        ];

        $model = new JsonModel($jsonData);


        return $model;

    }

    /**
     * Page d'index des missions
     *
     * @return array|\Laminas\View\Model\ViewModel
     */
    public function rechercheIntervenantAction()
    {


        return [];
    }


    public function voirAction()
@@ -138,7 +167,6 @@ class IntervenantController extends AbstractController
    }



    public function definirParDefautAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -151,7 +179,6 @@ class IntervenantController extends AbstractController
    }



    public function ficheAction()
    {
        $role = $this->getServiceContext()->getSelectedIdentityRole();
@@ -161,7 +188,6 @@ class IntervenantController extends AbstractController
    }



    public function saisirAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -251,7 +277,6 @@ class IntervenantController extends AbstractController
    }



    public function synchronisationAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -276,7 +301,6 @@ class IntervenantController extends AbstractController
    }



    public function synchroniserAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -287,7 +311,6 @@ class IntervenantController extends AbstractController
    }



    public function voirHeuresCompAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -332,7 +355,6 @@ class IntervenantController extends AbstractController
    }



    public function formuleTotauxHetdAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -345,7 +367,6 @@ class IntervenantController extends AbstractController
    }



    public function supprimerAction()
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
@@ -383,7 +404,6 @@ class IntervenantController extends AbstractController
    }



    public function historiserAction()
    {
        /* @var $intervenant \Application\Entity\Db\Intervenant */
@@ -398,7 +418,6 @@ class IntervenantController extends AbstractController
    }



    public function restaurerAction()
    {
        /* @var $intervenant \Application\Entity\Db\Intervenant */
@@ -415,7 +434,6 @@ class IntervenantController extends AbstractController
    }



    /**
     *
     * @return array
@@ -445,7 +463,6 @@ class IntervenantController extends AbstractController
    }



    /**
     *
     * @param \Application\Entity\Db\Intervenant $intervenant
+11 −0
Original line number Diff line number Diff line
<?php


$title = 'Recherche intervenant';


echo $this->messenger()->addCurrentMessagesFromFlashMessenger();

echo $this->vue('intervenant/recherche', []);