Mon commit initial
This commit is contained in:
34
static/js/gestion_fournisseur_index.js
Normal file
34
static/js/gestion_fournisseur_index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const $ = (id) => document.getElementById(id);
|
||||
|
||||
const tableau_liste_fournisseur = new Tabulator("#liste_fournisseur", {
|
||||
layout:"fitColumns",
|
||||
ajaxURL: `${$('liste_fournisseur').dataset.url}`,
|
||||
columns:[
|
||||
{title:"Nom de l'entreprise", field:"nom_entreprise"},
|
||||
{title:"Nom et prénom du representant", field:"representant"},
|
||||
{title:"Fonction", field:"fonction"},
|
||||
{title:"Téléphone", field:"telephone"},
|
||||
{title:"E-mail", field:"email"},
|
||||
// {title:"Note", field:"note", formatter: "star"},
|
||||
],
|
||||
});
|
||||
|
||||
document.getElementById("searchFournisseur").addEventListener("keyup", function () {
|
||||
if(this.value){
|
||||
tableau_liste_fournisseur.setFilter("nom_entreprise", "like", this.value)
|
||||
}else{
|
||||
tableau_liste_fournisseur.clearFilter();
|
||||
}
|
||||
})
|
||||
|
||||
document.getElementById("filterCategorie").addEventListener("change", function (e) {
|
||||
if(this.value === ""){
|
||||
tableau_liste_fournisseur.setData(`${$('liste_fournisseur').dataset.url}`)
|
||||
}else{
|
||||
tableau_liste_fournisseur.setData("/gestion-fournisseur/liste-fournisseur-categorie", {"c": this.value})
|
||||
}
|
||||
})
|
||||
|
||||
tableau_liste_fournisseur.on("rowClick", function(e, row){
|
||||
location.href = `details-fournisseur/${row.getData().id}`;
|
||||
});
|
||||
Reference in New Issue
Block a user