From f9237f38d22e34ba678b644f8b33b792108c8638 Mon Sep 17 00:00:00 2001 From: nox Date: Sun, 6 Oct 2019 23:08:41 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20affichage=20des=20boutons=20d'acti?= =?UTF-8?q?on=20suite=20=C3=A0=20une=20suppression=20de=20bien/service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/ajax/readRecords.php | 7 ++----- public/ajax/updateProduitsDetails.php | 5 +---- public/js/script.js | 4 +++- src/Product/views/admin/products/index.twig | 2 +- views/layout.twig | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/public/ajax/readRecords.php b/public/ajax/readRecords.php index 174fc89..8d66f72 100644 --- a/public/ajax/readRecords.php +++ b/public/ajax/readRecords.php @@ -3,9 +3,8 @@ ini_set('display_errors', 0); include '../../config/conf.php'; $antenne_slug = $_GET['antenne_slug']; -if ($bdd === null ) { - $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); -} +$bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); + // Design initial table header $data = ' @@ -52,9 +51,7 @@ if ($bdd === null ) { if ($row['username'] == $_GET['nom_connecte'] ) { $data .= ')" class=\'btn btn-primary\''; } else { - $data .= ')" class=\'btn btn-info\' disabled=true'; - //$('.btn-disabled').prop('disabled', true); } $data .= '>Mettre à jour'; $data .= ''; diff --git a/public/ajax/updateProduitsDetails.php b/public/ajax/updateProduitsDetails.php index 381b623..86c39b8 100644 --- a/public/ajax/updateProduitsDetails.php +++ b/public/ajax/updateProduitsDetails.php @@ -3,11 +3,9 @@ include '../../config/conf.php'; $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); -// check request + if(isset($_POST)) { - // get values - $params["id"] = $_POST['id']; $name = $_POST['produit']; $quantite = $_POST['quantite']; @@ -17,5 +15,4 @@ if(isset($_POST)) $requete = "UPDATE products SET name = '$name', quantite = '$quantite', prix = $prix WHERE id = :id"; $query = $bdd->prepare($requete); $query->execute($params); - } diff --git a/public/js/script.js b/public/js/script.js index 4b68ccd..5b465fb 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -84,7 +84,9 @@ function DeleteProduits(id, antenne_slug) { }, function (data, status) { // Rechargement de la liste Biens/services - readRecords(antenne_slug); + var nom_connecte = $("#nom_connecte").text(); + // READ records on page load + readRecords(antenne_slug, nom_connecte); } ); } diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig index e282bec..597814b 100644 --- a/src/Product/views/admin/products/index.twig +++ b/src/Product/views/admin/products/index.twig @@ -110,7 +110,7 @@ diff --git a/views/layout.twig b/views/layout.twig index 359f716..f9471ca 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -2,8 +2,8 @@ {% block title "Ğ1-Marché " %} - + +