diff --git a/.gitignore b/.gitignore
index cce723b..4d905f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,11 @@
config/config.php
config/config-backup.php
-config/conf.php
+scripts/.loc_hash
.idea
-/public/uploads
+public/uploads/*
+!public/uploads/default.png
/tmp
vendor
composer.json
composer.lock
-/src/Framework/SwiftMailerFactory.php
\ No newline at end of file
+/src/Framework/SwiftMailerFactory.php
diff --git a/public/css/mapael.css b/public/css/mapael.css
index 3ff5edc..dc3f3c8 100644
--- a/public/css/mapael.css
+++ b/public/css/mapael.css
@@ -1,8 +1,19 @@
.mapael .map {
- background-color: #cddee0;
+ background-color: rgba(0, 0, 0, 0.3);
+ padding: 15px;
margin-bottom: 10px;
position: relative;
+ width: 60%;
+ left: 50%;
+ transform: translateX(-50%);
+ border-radius: 10%;
}
+
+.home_map {
+ font-size:1.2rem;
+ font-weight:bold;
+}
+
/* For all zoom buttons */
.mapael .zoomButton {
background-color: #fff;
@@ -38,7 +49,7 @@
}
.mapael .mapTooltip {
position: absolute;
- background-color: #474c4b;
+ background-color: #1D1D1D;
moz-opacity: 0.70;
opacity: 0.70;
filter: alpha(opacity=70);
@@ -48,4 +59,4 @@
max-width: 200px;
display: none;
color: #fff;
-}
\ No newline at end of file
+}
diff --git a/public/css/products.css b/public/css/products.css
new file mode 100644
index 0000000..870b7c9
--- /dev/null
+++ b/public/css/products.css
@@ -0,0 +1,82 @@
+.container_main {
+ background-color: #2E2E2E;
+}
+.tableau {
+ width:100%;
+ background-color: white;
+ table-layout: fixed;
+ border-collapse: collapse;
+ /* border-spacing: 1px; // pour contrer les style de base */
+}
+/* Entête */
+.tableau th {
+ border-spacing: 0;
+ border-collapse: collapse;
+ padding: 0rem;
+ text-align: center;
+ border-left: lightgray 1px solid;
+ background-color:#999690;
+ color:#fff;
+}
+.tableau .colonne_image {
+ padding: 0; !important;
+}
+.tableau td {
+ border-bottom: solid 1px black;
+ border-left: lightgray 1px solid;
+ padding-left: 0.7rem;
+}
+.align_droite {
+
+ text-align: right;
+ padding-right: 2rem;
+}
+.breadcrumb {
+ font-size: 1rem;
+}
+
+.toggle_radio {
+ position: relative;
+ background: rgba(0,0,0,.1);
+ margin: -3px auto 4px 10px;
+ overflow: hidden;
+ padding: 0 !important;
+ border-radius: 50px;
+ height: 28px;
+ width: 215px;
+}
+.toggle_radio > * {
+ float: left;
+}
+.toggle_radio input[type=radio]{
+ display: none;
+}
+.toggle_radio label{
+ color: rgba(0,0,0,.9);
+ z-index: 0;
+ display: block;
+ width: 100px;
+ height: 20px;
+ margin: 3px 3px;
+ border-radius: 50px;
+ cursor: pointer;
+ z-index: 1;
+ text-align: center;
+}
+.toggle_option_slider{
+ width: 100px;
+ height: 20px;
+ position: absolute;
+ top: 4px;
+ border-radius: 50px;
+ transition: all .4s ease;
+}
+
+#first_toggle:checked ~ .toggle_option_slider{
+ background: rgba(0,0,0,.3);
+ left: 3px;
+}
+#second_toggle:checked ~ .toggle_option_slider{
+ background: rgba(0,0,0,.3);
+ left: 109px;
+}
diff --git a/public/css/style.css b/public/css/style.css
index 7a22520..8fe14b9 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -19,10 +19,19 @@ btn-custom {
-webkit-font-smoothing: antialiased;
}
+#logo_home {
+ width:30rem;
+ margin: 0 auto;
+ margin-top: -15px;
+ margin-bottom: 10px;
+ text-align: center;
+}
+
img {
max-width: 100%;
height: auto;
}
+
#la_page {
text-align: center;
width: 1174px;
@@ -30,6 +39,7 @@ img {
height:auto;
margin-left: auto;
margin-right: auto;
+ opacity:0.9;
}
#la_page a {
@@ -58,7 +68,9 @@ li {
background-size: 100% auto;
font-family: Bree Serif, Arial, sans-serif;
font-size: 14px;
+ opacity:0.97;
}
+
header.header {
width: 389px;
height: 259px;
@@ -86,20 +98,24 @@ header.header img {
font-size: 26px;
}
-.article {
- width:auto;
- height:auto;
- font-size: 24px;
-}
-.article2 {
+.article .article2 {
width:auto;
height:auto;
font-size: 24px;
}
+
.container {
font-family: Arial, sans-serif;
}
+.container.home {
+ font-family: Arial, sans-serif;
+ height:auto;
+ width:60rem;
+ text-align:center;
+ border: 0px;
+}
+
.records_content th, .records_content2 th {
background-color: lightgray;
color: rgba(0,0,0,0.85);
@@ -175,7 +191,7 @@ header.header img {
}
body.loading .loadingPubkey {
- overflow: hidden;
+ overflow: hidden;
display: block;
}
diff --git a/public/models/readRecords.php b/public/models/readRecords.php
index 55ddbf5..474c6d1 100644
--- a/public/models/readRecords.php
+++ b/public/models/readRecords.php
@@ -18,12 +18,12 @@
Prix en junes | ';
$params["antenne_slug"] = $antenne_slug;
- $requete = "SELECT products.*, users.username, users.pubkey
- FROM products
- LEFT JOIN antennes
- ON antennes.id = products.antenne_id
- LEFT JOIN users
- ON users.id = products.user_id
+ $requete = "SELECT products.*, users.username, users.pubkey
+ 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);
$stmt2 = $bdd->prepare($requete);
@@ -51,16 +51,27 @@
$number | ";
$prix = $row['prix'];
$vendeur = $row['username'];
- $produit = $row['name'];
+ $quantite = $row['quantite'];
+ if ($quantite == "0") {
+ $produit = "[Vendu] ";
+ } else {
+ $produit = "";
+ }
+ $produit .= $row['name'];
$pubkey = $row['pubkey'];
$pubkeyShort = substr($pubkey, 0, 8);
$vendeur_format = "$vendeur";
$cle_pub_format = " $pubkeyShort... ";
$data .= ''.$produit.' | ';
- $data .= ' | ';
+ $imagep = '../uploads/products/'.$antenne_slug.'/'.$row['image'].'';
+ if (file_exists($imagep) && $row['image']) {
+ $data .= ' | ';
+ } else {
+ $data .= ' | ';
+ }
$data .= ''.$vendeur_format.' | ';
$data .= ''.$cle_pub_format.' | ';
- $data .= ''.$row['quantite'].' | ';
+ $data .= ''.$quantite.' | ';
$data .= ''.$prix.' | ';
if ($row['username'] == $nom_connecte ) {
$data .= '';
diff --git a/public/models/readRecords2.php b/public/models/readRecords2.php
index f866e88..c6e9cb8 100644
--- a/public/models/readRecords2.php
+++ b/public/models/readRecords2.php
@@ -19,11 +19,11 @@
$params["antenne_slug"] = $antenne_slug;
$requete = "SELECT souhaits.*, users.username, users.pubkey
- FROM souhaits
- LEFT JOIN antennes
- ON antennes.id = souhaits.antenne_id
- LEFT JOIN users
- ON users.id = souhaits.user_id
+ FROM souhaits
+ LEFT JOIN antennes
+ ON antennes.id = souhaits.antenne_id
+ LEFT JOIN users
+ ON users.id = souhaits.user_id
WHERE antennes.slug = :antenne_slug";
$stmt = $bdd->prepare($requete);
$stmt2 = $bdd->prepare($requete);
@@ -55,7 +55,12 @@
$vendeur_format = "$vendeur";
$pubkeyShort = substr($pubkey, 0, 8);
$data .= ' | '.$produit.' | ';
- $data .= ' | ';
+ $imagep = '../uploads/recherches/'.$antenne_slug.'/'.$row['image'].'';
+ if (file_exists($imagep) && $row['image']) {
+ $data .= ' | ';
+ } else {
+ $data .= ' | ';
+ }
$data .= ''.$vendeur_format.' | ';
$data .= ''.$pubkeyShort.'... | ';
$data .= ''.$row['quantite'].' | ';
diff --git a/public/uploads/default.png b/public/uploads/default.png
new file mode 100755
index 0000000..ee6994b
Binary files /dev/null and b/public/uploads/default.png differ
diff --git a/scripts/check_sold.sh b/scripts/check_sold.sh
new file mode 100755
index 0000000..a245b45
--- /dev/null
+++ b/scripts/check_sold.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+[ "$EUID" -ne 0 ] && sudo="sudo" || sudo=""
+SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
+
+start=`date +%s`
+date=$(date +'%d-%m-%y à %H:%M')
+echo "### $date ###"
+
+## Initialisation
+DUNITER=$(grep g1_node $SCRIPTPATH/../config/config.php | awk '{ print $3}' | tr -d ';' | tr -d "'")
+TXBLOCKS=$(curl -s $DUNITER/blockchain/with/tx | jq '.result.blocks[]')
+TXBLOCKS=$(echo "$TXBLOCKS" | tail -n 2 | tr '\n' ' ')
+keyword="\[Achat GMarche] : "
+[ ! -e $SCRIPTPATH/.loc_hash ] && touch $SCRIPTPATH/.loc_hash
+
+## Récupération des transactions avec commentaire GMarche
+
+for i in $TXBLOCKS; do
+ result=$(curl -s $DUNITER/blockchain/block/$i | jq '.transactions[].hash, .transactions[].comment' | grep -v '""' | tr -d '"' | grep -B1 "$keyword")
+ rhash=$(echo "$result" | head -n1)
+ rcom=$(echo "$result" | tail -n1)
+ if [[ ! -z $result && -z $(grep $rhash $SCRIPTPATH/.loc_hash) ]]; then
+ isSell+=$(echo -e "$rcom;")
+ echo "$rhash" >> $SCRIPTPATH/.loc_hash
+ fi
+ sleep 1
+done
+
+## Ajout des transactions en piscine pour les users GMarche
+
+req="SELECT pubkey FROM users;"
+usersPubkeys=$($sudo mysql --database gmarche -e "$req" | grep .)
+
+for i in $usersPubkeys; do
+ result=$(curl -s $DUNITER/tx/history/$i/pending | jq '. | select(.history.sending == [])' | jq '.history.pending[].hash,.history.pending[].comment' | tr -d '"')
+ rhash=$(echo "$result" | head -n1)
+ rcom=$(echo "$result" | tail -n1)
+ if [[ ! -z $result && -z $(grep $rhash $SCRIPTPATH/.loc_hash) ]]; then
+ isSell+=$(echo -e "$rcom;")
+ echo "$rhash" >> $SCRIPTPATH/.loc_hash
+ fi
+done
+
+## Retrait de l'identifiant gmarche des commentaires
+isSell=$(echo $isSell | sed "s/$keyword//g")
+
+[[ ! -z $isSell ]] && echo "$isSell est vendu"
+
+## Retrait d'un quantité pour les articles vendu
+IFS=';'; ADDR=($isSell); unset IFS;
+for i in "${ADDR[@]}"; do
+ #req="UPDATE products SET status = 'solde' WHERE name = '$i';"
+ req="UPDATE products SET quantite = CASE WHEN quantite = 0 THEN quantite ELSE quantite - 1 END WHERE name = '$i';"
+ $sudo mysql --database gmarche -e "$req"
+done
+
+#$sudo mysql --database gmarche -e "SELECT name,status FROM products;"
+
+end=`date +%s`
+runtime=$((end-start))
+echo "Temps d'execution: ${runtime}s"
+exit 0
diff --git a/src/Gmarche/views/index.twig b/src/Gmarche/views/index.twig
index 37e89a4..2e5eeb2 100644
--- a/src/Gmarche/views/index.twig
+++ b/src/Gmarche/views/index.twig
@@ -4,9 +4,9 @@
Ğ1-Marché : Régions {% if page > 1 %}, page {{ page }} {% endif %}
{% endblock %}
{% block body %}
-
-
-
+
+
+
+
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig
index 3d52d42..9ca1f39 100644
--- a/src/Product/views/admin/products/index.twig
+++ b/src/Product/views/admin/products/index.twig
@@ -2,91 +2,10 @@
{% extends 'layout.twig' %}
{% block title "Ğ1-Marché - Produits" %}
+
{% block body %}
-
-
+