diff --git a/config/conf-sample.php b/config/conf-sample.php new file mode 100644 index 0000000..d322285 --- /dev/null +++ b/config/conf-sample.php @@ -0,0 +1,5 @@ + \DI\env('ENV', 'production'), - /*'env' => \DI\env('ENV', 'development'),*/ - 'database.host' => 'localhost', - 'database.username' => 'root', + 'database.host' => '', + 'database.username' => '', 'database.password' => '', - 'database.name' => 'gmarche', + 'database.name' => '', 'views.path' => dirname(__DIR__) . '/views', 'twig.extensions' => [ \DI\get(RouterTwigExtension::class), @@ -50,4 +49,4 @@ return [ 'mail.to' => 'admin@gmarche-testmail.com', 'mail.from' => 'no-reply@admin.fr', Swift_Mailer::class => \DI\factory(\Framework\SwiftMailerFactory::class) -]; \ No newline at end of file +]; diff --git a/public/ajax/addRecord.php b/public/ajax/addRecord.php new file mode 100644 index 0000000..bd31c58 --- /dev/null +++ b/public/ajax/addRecord.php @@ -0,0 +1,19 @@ + diff --git a/public/ajax/addRecord2.php b/public/ajax/addRecord2.php new file mode 100644 index 0000000..88deb2a --- /dev/null +++ b/public/ajax/addRecord2.php @@ -0,0 +1,22 @@ + diff --git a/public/ajax/deleteProduits.php b/public/ajax/deleteProduits.php new file mode 100644 index 0000000..b8a0cea --- /dev/null +++ b/public/ajax/deleteProduits.php @@ -0,0 +1,17 @@ +prepare($requete); + $stmt->execute($params); +} + diff --git a/public/ajax/deleteRecherches.php b/public/ajax/deleteRecherches.php new file mode 100644 index 0000000..5f189b1 --- /dev/null +++ b/public/ajax/deleteRecherches.php @@ -0,0 +1,17 @@ + diff --git a/public/ajax/readProduitsDetails.php b/public/ajax/readProduitsDetails.php new file mode 100644 index 0000000..561d02d --- /dev/null +++ b/public/ajax/readProduitsDetails.php @@ -0,0 +1,35 @@ +prepare($requete); + $query->execute($params); + $results = array(); + while ($row = $query->fetch(PDO::FETCH_ASSOC)) { + $results = $row; + }; + echo json_encode($results); + } else { + $response['status'] = 200; + $response['message'] = "Invalid Request!"; + } + } catch (PDOException $e) { + echo "Erreur : " . $e->getMessage() . "
"; + } + + diff --git a/public/ajax/readRecherchesDetails.php b/public/ajax/readRecherchesDetails.php new file mode 100644 index 0000000..a9f1d4e --- /dev/null +++ b/public/ajax/readRecherchesDetails.php @@ -0,0 +1,34 @@ + 0) { + while ($row = mysqli_fetch_assoc($result)) { + $response = $row; + } + } + else + { + $response['status'] = 200; + $response['message'] = "Data not found!"; + } + // display JSON data + echo json_encode($response); +} +else +{ + $response['status'] = 200; + $response['message'] = "Invalid Request!"; +} diff --git a/public/ajax/readRecords.php b/public/ajax/readRecords.php new file mode 100644 index 0000000..bf6ecf7 --- /dev/null +++ b/public/ajax/readRecords.php @@ -0,0 +1,78 @@ + + + No. + Bien / service + Vendeur + Clé publique + Quantité + Prix en junes + Actions + '; + + $params["antenne_slug"] = $antenne_slug; + $requete = "SELECT products.*, users.username + FROM products + LEFT JOIN antennes + ON antennes.id = products.antenne_id + LEFT JOIN users + ON users.id = products.user_id + WHERE antennes.slug = :antenne_slug"; + $stmt = $bdd->prepare($requete); + $stmt->execute($params); + $count = $stmt->rowCount(); + + if ($count > 0) + { + $number = 1; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + + $data .= " + $number"; + + $data .= ''.$row['name'].''; + $data .= ''.$row['username'].''; + $data .= ''.$row['cle_pub'].''; + $data .= ''.$row['quantite'].''; + $data .= ''.$row['prix'].''; + $data .= ''; + $data .= ' + + + + + '; + $number++; + } + } + else + { + // records now found + $data .= "Pas d'enregistrement"; + } + + $data .= ''; + + echo $data; +?> diff --git a/public/ajax/updateProduitsDetails.php b/public/ajax/updateProduitsDetails.php new file mode 100644 index 0000000..2f556b3 --- /dev/null +++ b/public/ajax/updateProduitsDetails.php @@ -0,0 +1,21 @@ +prepare($requete); + $query->execute($params); + +} diff --git a/public/ajax/updateRecherchesDetails.php b/public/ajax/updateRecherchesDetails.php new file mode 100644 index 0000000..a937ba2 --- /dev/null +++ b/public/ajax/updateRecherchesDetails.php @@ -0,0 +1,20 @@ +getAttribute('slug'); $page = $params['p'] ?? 1; // Si la page n'est pas définie, on l'initialise à 1 $antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(10, $page); - //echo "Antennes1="; - //var_dump($this->antenneTable->findAllbyRegion($region_id)); - //echo "


Antennes="; - //var_dump($antennes); - //die(); + $region=$this->regionTable->findBy('slug', $request->getAttribute('slug')); $antenne = 1; /*if ($region->slug !== $slug) { diff --git a/src/Product/Table/ProductTable.php b/src/Product/Table/ProductTable.php index b7093d4..b53f7c0 100644 --- a/src/Product/Table/ProductTable.php +++ b/src/Product/Table/ProductTable.php @@ -42,24 +42,4 @@ class ProductTable extends Table ->where("$field = $value" ) ->order('p.created_at DESC'); } - /* public function findPublic(): Query - { - return $this->makeQuery() - ->where('created_at < NOW()'); - } - public function findPaginatedProduct(string $table, int $perPage, int $currentPage): Pagerfanta - { - $query = new PaginatedQuery( - $this->pdo, - "SELECT * - FROM {$this->table} - ORDER BY name ASC", - "SELECT COUNT(id) FROM {$this->table}", - $this->entity - ); - return (new Pagerfanta($query)) - ->setMaxPerPage($perPage) - ->setCurrentPage($currentPage); - }*/ - } diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig index 70ba95d..6dc2d6a 100644 --- a/src/Product/views/admin/products/index.twig +++ b/src/Product/views/admin/products/index.twig @@ -1,3 +1,4 @@ + {% extends 'layout.twig' %} {% block title "Ğ1-Marché - Produits" %} @@ -42,6 +43,7 @@ padding-right: 2rem; } +

G-Marché de : {{ antenne_name }}

@@ -52,13 +54,95 @@ {% endif %} -

- - Ajouter un produit - - {{ items[name] }} -

- +
+
+
+

+ + + +

+
+
+
+
+ + + + + + - {% for item in items %} - - - - - - - - - - - {% endfor %} - -
{{ item.name }} {% if item.image %} - - {% endif %} - {{ item.username }} {{ item.quantite }} {{ item.prix }} {{ item.strUpdatedAt }} - {% if current_user().id == item.userId %} - Editer - {% else %} - - {% endif %} - - {% if current_user().id == item.userId %} -
- - - {{ field('antenne_id', explodeUrl()[4], "", {type: 'hidden'}) }} - {{ field('produit_name', item.name, "", {type: 'hidden'}) }} - {{ token_input | raw }} -
- {% else %} - - {% endif %} -
- - {{ paginate(items, routePrefix ~ '.index', {id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }} +
{% endblock %} diff --git a/views/layout.twig b/views/layout.twig index c141d19..51756cc 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -58,13 +58,8 @@
{% endif %} - - - + + {% block body %}{% endblock %}