Loading front/Intervenant/Recherche.vue +60 −46 Original line number Diff line number Diff line Loading @@ -4,12 +4,12 @@ <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"/> <input id="term" v-on:keyup="rechercher" class="form-control input" type="text"/> </div> </div> <table> <table class="table table-bordered table-sm"> <thead> <th>Nom</th> <th>Prenom</th> Loading @@ -19,6 +19,7 @@ <td>{{ intervenant.nom }}</td> <td>{{ intervenant.prenom }}</td> </tr> </tbody> </table> </template> Loading @@ -28,13 +29,16 @@ export default { name: 'Recherche', data() { data() { return { searchTerm: [], intervenants: [], }; }, mounted() { mounted() { this.reload(); }, methods: { Loading @@ -42,23 +46,33 @@ export default { this.searchTerm = event.target.value; this.reload(); }, reload() { console.log(this.searchTerm); reload() { console.log(this.intervenants.length) if (this.timer) { clearTimeout(this.timer); this.timer = null; } this.timer = setTimeout(() => { axios.post( Util.url("intervenant/recherche-json"), { term: 'dupo' }) .then(function (response) { console.log(response.data); term: this.searchTerm } ) .then(response => { this.intervenants = response.data; }) .catch(function (error) { console.log(error); .catch(response => { console.log(response.message); }); }, 800); ; }, } }, } </script> Loading module/Application/src/Controller/IntervenantController.php +6 −4 Original line number Diff line number Diff line Loading @@ -116,11 +116,13 @@ class IntervenantController extends AbstractController public function rechercheJsonAction() { $recherche = $this->getProcessusIntervenant()->recherche(); $term = $this->getRequest()->getPost('term'); $intervenants = []; $term = $this->axios()->fromPost('term'); if (!empty($term)) { $intervenants = $recherche->rechercher($term, 21); } $jsonData = [ 'data' => $intervenants, Loading Loading
front/Intervenant/Recherche.vue +60 −46 Original line number Diff line number Diff line Loading @@ -4,12 +4,12 @@ <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"/> <input id="term" v-on:keyup="rechercher" class="form-control input" type="text"/> </div> </div> <table> <table class="table table-bordered table-sm"> <thead> <th>Nom</th> <th>Prenom</th> Loading @@ -19,6 +19,7 @@ <td>{{ intervenant.nom }}</td> <td>{{ intervenant.prenom }}</td> </tr> </tbody> </table> </template> Loading @@ -28,13 +29,16 @@ export default { name: 'Recherche', data() { data() { return { searchTerm: [], intervenants: [], }; }, mounted() { mounted() { this.reload(); }, methods: { Loading @@ -42,23 +46,33 @@ export default { this.searchTerm = event.target.value; this.reload(); }, reload() { console.log(this.searchTerm); reload() { console.log(this.intervenants.length) if (this.timer) { clearTimeout(this.timer); this.timer = null; } this.timer = setTimeout(() => { axios.post( Util.url("intervenant/recherche-json"), { term: 'dupo' }) .then(function (response) { console.log(response.data); term: this.searchTerm } ) .then(response => { this.intervenants = response.data; }) .catch(function (error) { console.log(error); .catch(response => { console.log(response.message); }); }, 800); ; }, } }, } </script> Loading
module/Application/src/Controller/IntervenantController.php +6 −4 Original line number Diff line number Diff line Loading @@ -116,11 +116,13 @@ class IntervenantController extends AbstractController public function rechercheJsonAction() { $recherche = $this->getProcessusIntervenant()->recherche(); $term = $this->getRequest()->getPost('term'); $intervenants = []; $term = $this->axios()->fromPost('term'); if (!empty($term)) { $intervenants = $recherche->rechercher($term, 21); } $jsonData = [ 'data' => $intervenants, Loading