Relecture du code v1
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
table.setFilter("colors", "keywords", "red green blue"); //returns rows with a colors filed containing either the word "red", "green", or "blue"
|
||||
|
||||
table.setFilter("colors", "keywords", "red green blue", {matchAll:true}); //returns rows with a colors filed containing ALL the words "red", "green" & "blue"
|
||||
|
||||
function customFilter(data, filterParams){
|
||||
//data - the data for the row being filtered
|
||||
//filterParams - params object passed to the filter
|
||||
|
||||
return data.name == "bob" && data.height < filterParams.height; //must return a boolean, true if it passes the filter.
|
||||
}
|
||||
|
||||
table.setFilter(customFilter, {height:3});
|
||||
|
||||
table.refreshFilter();
|
||||
BIN
static/js/bootstrap.min.js:Zone.Identifier
Normal file
BIN
static/js/bootstrap.min.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/carnet_carburant.js:Zone.Identifier
Normal file
BIN
static/js/carnet_carburant.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/carnet_sortie_vehicule.js:Zone.Identifier
Normal file
BIN
static/js/carnet_sortie_vehicule.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/detail_course.js:Zone.Identifier
Normal file
BIN
static/js/detail_course.js:Zone.Identifier
Normal file
Binary file not shown.
@@ -1,17 +1,3 @@
|
||||
// document.getElementById("id_mois_concerne").addEventListener("change", function () {
|
||||
// fetch(`/gestion-produit/recuperer-fournisseur-categorie/${this.value}`)
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// champs_fournisseur.innerHTML = "";
|
||||
// data.forEach(fournisseur => {
|
||||
// const option = document.createElement("option");
|
||||
// option.value = fournisseur.id;
|
||||
// option.text = fournisseur.nom_fournisseur;
|
||||
// champs_fournisseur.appendChild(option);
|
||||
// });
|
||||
// })
|
||||
// })
|
||||
|
||||
carnetBordMois = document.querySelector("#carnetBordForm #id_mois_concerne");
|
||||
|
||||
carnetBordMois.addEventListener("change", function () {
|
||||
|
||||
BIN
static/js/detail_gestion_vehicule.js:Zone.Identifier
Normal file
BIN
static/js/detail_gestion_vehicule.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/details_fournisseur.js:Zone.Identifier
Normal file
BIN
static/js/details_fournisseur.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/gestion_fournisseur_index.js:Zone.Identifier
Normal file
BIN
static/js/gestion_fournisseur_index.js:Zone.Identifier
Normal file
Binary file not shown.
@@ -17,7 +17,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
$('detailDateDemande').value = data.detailDeMiseADispo;
|
||||
$('detailARendre').checked = data.detailARendre ? true : false;
|
||||
|
||||
// Sauvegarde de l’ID pour les boutons d’action
|
||||
if(data.chef_departement){
|
||||
$('confirmerBtn').dataset.id = produitId;
|
||||
$('refuserBtn').dataset.id = produitId;
|
||||
@@ -29,18 +28,20 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
|
||||
function updateStatut(demandeId, action) {
|
||||
const csrf = document.querySelector("[name=csrfmiddlewaretoken]").value;
|
||||
fetch('/gestion-produit/update-demande', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-CSRFToken': csrf
|
||||
},
|
||||
body: `id=${demandeId}&action=${action}&emetteur=chef`
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
alert(`Demande ${action} avec succès !`);
|
||||
location.reload(); // recharge la page pour voir le nouveau statut
|
||||
alert(data.message);
|
||||
location.reload();
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
@@ -49,22 +50,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
try{
|
||||
$('confirmerBtn').addEventListener('click', function () {
|
||||
updateStatut(this.dataset.id, '1'); // '1' pour confirmer
|
||||
$('confirmerBtn').addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
updateStatut(this.dataset.id, '1');
|
||||
});
|
||||
|
||||
$('refuserBtn').addEventListener('click', function () {
|
||||
updateStatut(this.dataset.id, '0'); // '0' pour refuser
|
||||
$('refuserBtn').addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
updateStatut(this.dataset.id, '0');
|
||||
});
|
||||
}catch{
|
||||
}catch (error) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const tabulator = new Tabulator("#listeDemandeTable", {
|
||||
columns: [
|
||||
{ title: "Nom Produit", field: "produit", sorter: "string" },
|
||||
// { title: "Catégorie", field: "categorie", sorter: "string" },
|
||||
{ title: "Motif", field: "motifs", sorter: "string" },
|
||||
{ title: "Date de mise à disposition souhaitée", field: "dateDeMiseADispoSouhaite", sorter: "date" },
|
||||
{ title: "À Rendre", field: "a_rendre", sorter: "boolean", formatter: "tickCross" },
|
||||
@@ -80,7 +81,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
ajaxURL: `${$("listeDemandeTable").dataset.url}`,
|
||||
})
|
||||
|
||||
// ----------------------------------------------------------- FILTRE
|
||||
// --------------------------- FILTRE PAR NOM DU PRODUIT -------------------------
|
||||
$('searchInput').addEventListener('keyup', function() {
|
||||
const filter = this.value.toLowerCase();
|
||||
const cards = document.querySelectorAll('.card');
|
||||
@@ -104,7 +105,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const champs_produit = $("id_produit");
|
||||
const champs_fournisseur = $("id_fournisseur");
|
||||
champs_produit.value = idProduit;
|
||||
// champs_produit.disabled = true;
|
||||
|
||||
fetch(`/gestion-produit/recuperer-fournisseur-categorie/${idProduit}`)
|
||||
.then(response => response.json())
|
||||
@@ -122,6 +122,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
})
|
||||
});
|
||||
|
||||
// Fenetre modal pour emettre une demande de nouveau produit
|
||||
const listeDemandeButton = document.querySelectorAll(".listeDemandeButton");
|
||||
const demanderModal = new bootstrap.Modal($("demanderModal"));
|
||||
|
||||
@@ -129,14 +130,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
demanderButton.addEventListener("click", function() {
|
||||
const produitCommanderId = this.dataset.id;
|
||||
const champs_produit = document.querySelector("#demanderModal #id_produit");
|
||||
// champs_produit.disabled = true;
|
||||
|
||||
champs_produit.value = produitCommanderId;
|
||||
|
||||
demanderModal.show();
|
||||
})
|
||||
});
|
||||
|
||||
// Filtre des produits par categorie
|
||||
$("filterCategorie").addEventListener("change", function(){
|
||||
const card = document.querySelectorAll(".card");
|
||||
const filtre = this.value;
|
||||
@@ -156,17 +156,19 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
})
|
||||
|
||||
// Enregistrement de nouveau produit
|
||||
$("enregistrement-produit-form").addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
const form = this;
|
||||
const url = this.dataset.url;
|
||||
// const csrf =
|
||||
const csrf = document.querySelector('[name=csrfmiddlewaretoken]').value;
|
||||
fetch(
|
||||
url,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"X-CSRFToken": csrf
|
||||
},
|
||||
body: new FormData(form)
|
||||
}
|
||||
@@ -181,6 +183,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
</div>
|
||||
`;
|
||||
form.reset();
|
||||
}else{
|
||||
messageZone.innerHTML = `
|
||||
<div class="alert alert-danger">
|
||||
${data.message}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -188,44 +196,45 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
$('enregistrerProduit').addEventListener("hidden.bs.modal", function () {
|
||||
location.reload()
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
// --------------------------------- Tableau categorie
|
||||
const url_liste_categorie = $("listecategorie").dataset.url;
|
||||
const tableau_categorie = new Tabulator("#listecategorie", {
|
||||
columns: [
|
||||
{title: "Nom de la catégorie", field: "categorie"}
|
||||
],
|
||||
ajaxURL: url_liste_categorie
|
||||
})
|
||||
|
||||
$("enregistrer-categorie").addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
const form = this;
|
||||
const url = this.dataset.url;
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
headers:{
|
||||
"X-Requested-With": "XMLHttpResponse"
|
||||
},
|
||||
body: new FormData(form)
|
||||
// --------------------------- Gestion des categories -------------------------
|
||||
const url_liste_categorie = $("listecategorie").dataset.url;
|
||||
const tableau_categorie = new Tabulator("#listecategorie", {
|
||||
columns: [
|
||||
{title: "Nom de la catégorie", field: "categorie"}
|
||||
],
|
||||
ajaxURL: url_liste_categorie
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if(data.success){
|
||||
const messageBox = $("message-creation-categorie");
|
||||
messageBox.innerHTML = `
|
||||
<div class="alert alert-success">
|
||||
Categorie crée avec succès
|
||||
</div>
|
||||
`;
|
||||
tableau_categorie.setData(url_liste_categorie);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$("enregistrerCategorie").addEventListener("hidden.bs.modal", function () {
|
||||
location.reload();
|
||||
})
|
||||
$("enregistrer-categorie").addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
const form = this;
|
||||
const url = this.dataset.url;
|
||||
const csrf = document.querySelector('[name=csrfmiddlewaretoken]').value;
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
headers:{
|
||||
"X-Requested-With": "XMLHttpResponse",
|
||||
"X-CSRFToken": csrf
|
||||
},
|
||||
body: new FormData(form)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if(data.success){
|
||||
const messageBox = $("message-creation-categorie");
|
||||
messageBox.innerHTML = `
|
||||
<div class="alert alert-success">
|
||||
Categorie crée avec succès
|
||||
</div>
|
||||
`;
|
||||
tableau_categorie.setData(url_liste_categorie);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$("enregistrerCategorie").addEventListener("hidden.bs.modal", function () {
|
||||
location.reload();
|
||||
})
|
||||
});
|
||||
BIN
static/js/gestion_produit.js:Zone.Identifier
Normal file
BIN
static/js/gestion_produit.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/gestion_vehicule.js:Zone.Identifier
Normal file
BIN
static/js/gestion_vehicule.js:Zone.Identifier
Normal file
Binary file not shown.
@@ -93,10 +93,13 @@ $("produit_normal").addEventListener("click", function() {
|
||||
|
||||
function updateStatut(demandeId, action, motifRefus='') {
|
||||
const url = $("radioRefuser").dataset.url;
|
||||
const csrf = document.querySelector('[name=csrfmiddlewaretoken]').value;
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'X-CSRFToken': csrf
|
||||
},
|
||||
body: `id=${demandeId}&action=${action}&emetteur=logisticien&motif_refus=${motifRefus}`
|
||||
})
|
||||
@@ -144,11 +147,13 @@ table_commande.on("rowClick", function(e, row){
|
||||
});
|
||||
|
||||
$('enregistrerModifsCommande').addEventListener('click', function () {
|
||||
const csrf = document.querySelector('[name=csrfmiddlewaretoken]').value;
|
||||
if($("produit_livre").checked){
|
||||
fetch(`${$("enregistrerModifsCommande").dataset.url}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-CSRFToken': csrf
|
||||
},
|
||||
body: `id_commande=${$("enregistrerModifsCommande").dataset.id}`
|
||||
})
|
||||
@@ -181,10 +186,12 @@ const tableau_equipement_rendre = new Tabulator("#tableau-equipement-rendre", {
|
||||
|
||||
$("equipementARendreEnregistrer").addEventListener("click", function () {
|
||||
const information_equipement = tableau_equipement_rendre.getData();
|
||||
const csrf = document.querySelector('[name=csrfmiddlewaretoken]').value;
|
||||
fetch(`${$("equipementARendreEnregistrer").dataset.url}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-CSRFToken": csrf
|
||||
},
|
||||
body: JSON.stringify(information_equipement)
|
||||
})
|
||||
|
||||
BIN
static/js/index.js:Zone.Identifier
Normal file
BIN
static/js/index.js:Zone.Identifier
Normal file
Binary file not shown.
@@ -2,22 +2,22 @@ const $ = (id) => document.getElementById(id);
|
||||
|
||||
const tableau_entre = new Tabulator("#tableau-stock-entree", {
|
||||
columns: [
|
||||
{title: "Produit", field: "produit"},
|
||||
{title: "Catégorie", field: "categorie"},
|
||||
{title: "Conditionnement", field: "conditionnement"},
|
||||
{title: "Fournisseur", field: "fournisseur"},
|
||||
{title: "Date de commande", field: "date_commande"},
|
||||
{title: "Date de livraison", field: "date_livraison"},
|
||||
{title: "Quantité commandée", field: "quantite_commander"},
|
||||
{title: "Produit", field: "produit_entree"},
|
||||
{title: "Catégorie", field: "categorie_entree"},
|
||||
{title: "Conditionnement", field: "conditionnement_entree"},
|
||||
{title: "Fournisseur", field: "fournisseur_entree"},
|
||||
{title: "Date de commande", field: "date_commande_entree"},
|
||||
{title: "Date de livraison", field: "date_livraison_entree"},
|
||||
{title: "Quantité commandée", field: "quantite_commander_entree"},
|
||||
],
|
||||
})
|
||||
|
||||
const tableau_sortie = new Tabulator("#tableau-stock-sortie", {
|
||||
columns: [
|
||||
{title: "Produit", field: "produit"},
|
||||
{title: "Catégorie", field: "categorie"},
|
||||
{title: "Conditionnement", field: "conditionnement"},
|
||||
{title: "Date de la demande", field: "date_demande"},
|
||||
{title: "Produit", field: "produit_sortie"},
|
||||
{title: "Catégorie", field: "categorie_sortie"},
|
||||
{title: "Conditionnement", field: "conditionnement_sortie"},
|
||||
{title: "Date de la demande", field: "date_demande_sortie"},
|
||||
// {title: "Date de mise à disposition", field: "date_mise_a_dispo"},
|
||||
{title: "Quantité demandée", field: "quantite_demander"},
|
||||
]
|
||||
@@ -37,16 +37,14 @@ filtreMois.addEventListener("change", function () {
|
||||
})
|
||||
})
|
||||
|
||||
$("type_operation").addEventListener("change", function () {
|
||||
if(this.value === "entree"){
|
||||
$("tableau-stock-entree").style.display = "";
|
||||
$("tableau-stock-sortie").style.display = "none";
|
||||
}
|
||||
})
|
||||
|
||||
$("type_operation").addEventListener("change", function () {
|
||||
if(this.value === "sortie"){
|
||||
$("tableau-stock-entree").style.display = "none";
|
||||
$("tableau-stock-sortie").style.display = "";
|
||||
}
|
||||
|
||||
if(this.value === "entree"){
|
||||
$("tableau-stock-entree").style.display = "";
|
||||
$("tableau-stock-sortie").style.display = "none";
|
||||
}
|
||||
})
|
||||
BIN
static/js/mouvement_stock.js:Zone.Identifier
Normal file
BIN
static/js/mouvement_stock.js:Zone.Identifier
Normal file
Binary file not shown.
BIN
static/js/tabulator.min.js:Zone.Identifier
Normal file
BIN
static/js/tabulator.min.js:Zone.Identifier
Normal file
Binary file not shown.
Reference in New Issue
Block a user