Commit aaba3b5c authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

WIP recherche intervenant

parent 5186d3a9
Loading
Loading
Loading
Loading
+52 −10
Original line number Diff line number Diff line
@@ -3,21 +3,50 @@

    <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:keyup="rechercher" class="form-control input" type="text"/>
            <div>
                <input id="term" v-on:keyup="rechercher" class="form-control input" type="text"
                       placeholder="Saisissez le nom suivi éventuellement du prénom (2 lettres au moins)"/><br/>
            </div>
            <div>
                Type d'intervenant :
                <input v-on:click="reload()" type="checkbox" name="type[]" value="permanent" checked="checked" v-model="checkedTypes"> Permanent
                <input v-on:click="reload()" type="checkbox" name="type[]" value="vacataire" checked="checked" v-model="checkedTypes"> Vacataire
                <input v-on:click="reload()" type="checkbox" name="type[]" value="etudiant" checked="checked" v-model="checkedTypes"> Etudiant
            </div>
            <div>checked : {{ checkedTypes }}</div>
            <br/>
        </div>
    </div>


    <table class="table table-bordered table-sm">
        <thead>
        <th>Nom</th>
        <tr>
            <th></th>
            <th>Civilité</th>
            <th>Prenom</th>
            <th>Nom</th>
            <th>Structure</th>
            <th>Statut</th>
            <th>Type</th>
            <th>Date de naissance</th>
            <th>N° Personnel</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="intervenant in intervenants" :intervenant="intervenant">
            <td>{{ intervenant.nom }}</td>
        <tr :class="{'bg-danger': intervenant.destruction!==null}" :title="(intervenant.destruction!==null) ? 'Fiche historisé' : ''"
            v-for="(intervenant,code) in intervenants">
            <td>
                <a :href="urlFiche(code)">Fiche</a>
            </td>
            <td>{{ intervenant.civilite }}</td>
            <td>{{ intervenant.prenom }}</td>
            <td>{{ intervenant.nom }}</td>
            <td>{{ intervenant.structure }}</td>
            <td>{{ intervenant.statut }}</td>
            <td>{{ intervenant.typeIntervenantLibelle }}</td>
            <td>{{ intervenant.dateNaissance.toLocaleString() }}</td>
            <td>{{ intervenant.numeroPersonnel }}</td>
        </tr>

        </tbody>
@@ -35,6 +64,7 @@ export default {
        return {
            searchTerm: [],
            intervenants: [],
            checkedTypes: [],
        };
    },
    mounted()
@@ -42,13 +72,24 @@ export default {
        this.reload();
    },
    methods: {
        rechercher: function (event) {
        rechercher: function (event)
        {
            this.searchTerm = event.target.value;

            this.reload();
        },
        filtrer: function ()
        {

        },
        urlFiche(code)
        {
            return '/intervenant/code:' + code + '/voir';
        },
        reload()
        {
            console.log(this.intervenants.length)
            console.log(this.checkedTypes);

            if (this.timer) {
                clearTimeout(this.timer);
                this.timer = null;
@@ -71,7 +112,8 @@ export default {



    },
    }
    ,

}
</script>
+31 −14
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ class RechercheProcessus
    protected $showHisto = false;



    /**
     * @param string  $critere
     * @param integer $limit
@@ -34,6 +35,7 @@ class RechercheProcessus
    }



    /**
     * @return bool
     */
@@ -43,6 +45,7 @@ class RechercheProcessus
    }



    /**
     * @param bool $showHisto
     *
@@ -56,6 +59,7 @@ class RechercheProcessus
    }



    /**
     * @param string  $critere
     * @param integer $limit
@@ -68,6 +72,7 @@ class RechercheProcessus
    }



    private function sqlLocale(): string
    {
        $sql = "
@@ -76,6 +81,8 @@ class RechercheProcessus
          i.code,
          i.code_rh,
          i.statut_id,
          ti.code type_intervenant_code,
          ti.libelle type_intervenant_libelle,        
          i.nom_usuel,
          i.nom_patronymique,
          i.prenom,
@@ -91,6 +98,7 @@ class RechercheProcessus
          LEFT JOIN structure s ON s.id = i.structure_id
          LEFT JOIN civilite c ON c.id = i.civilite_id
          LEFT JOIN statut si ON si.id = i.statut_id
          LEFT JOIN type_intervenant ti ON ti.id = si.type_intervenant_id
        ";
        if (!$this->showHisto) {
            $sql .= "WHERE i.histo_destruction IS NULL";
@@ -100,6 +108,7 @@ class RechercheProcessus
    }



    private function sqlSource(): string
    {
        return "
@@ -107,6 +116,8 @@ class RechercheProcessus
          NULL id,
          i.code,
          i.statut_id,
          ti.code type_intervenant_code,
          ti.libelle type_intervenant_libelle,
          i.nom_usuel,
          i.nom_patronymique,
          i.prenom,
@@ -122,10 +133,12 @@ class RechercheProcessus
          LEFT JOIN structure s ON s.id = i.structure_id
          LEFT JOIN civilite c ON c.id = i.civilite_id
          LEFT JOIN statut si ON si.id = i.statut_id
          LEFT JOIN type_intervenant ti ON ti.id = si.type_intervenant_id
        ";
    }



    protected function makeKey(array $data, string $key): string
    {
        $resKey = $key;
@@ -137,6 +150,7 @@ class RechercheProcessus
    }



    private function rechercheGenerique($critere, $limit = 50, string $key = ':CODE', $onlyLocale = false)
    {
        if (strlen($critere) < 2) return [];
@@ -191,11 +205,14 @@ class RechercheProcessus
                    'civilite'               => $r['CIVILITE'],
                    'nom'                    => $r['NOM_USUEL'],
                    'prenom'                 => $r['PRENOM'],
                    'date-naissance'   => new \DateTime($r['DATE_NAISSANCE']),
                    'dateNaissance'          => new \DateTime($r['DATE_NAISSANCE']),
                    'structure'              => $r['STRUCTURE'],
                    'statut'                 => $r['STATUT'],
                    'numero-personnel' => $r['CODE_RH'],
                    'typeIntervenantCode'    => $r['TYPE_INTERVENANT_CODE'],
                    'typeIntervenantLibelle' => $r['TYPE_INTERVENANT_LIBELLE'],
                    'numeroPersonnel'        => $r['CODE_RH'],
                    'destruction'            => $r['HISTO_DESTRUCTION'],

                ];
            } else {
                if ($intervenants[$k]['destruction'] && !$r['HISTO_DESTRUCTION']) {