diff --git a/.DS_Store b/.DS_Store index 07fe6d5..9a34aae 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/public/.DS_Store b/public/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/public/.DS_Store differ diff --git a/public/Minecraft.ttf b/public/Minecraft.ttf new file mode 100644 index 0000000..85c1472 Binary files /dev/null and b/public/Minecraft.ttf differ diff --git a/public/minecraft_logo_icon_168974.png b/public/minecraft_logo_icon_168974.png new file mode 100644 index 0000000..ca1ff86 Binary files /dev/null and b/public/minecraft_logo_icon_168974.png differ diff --git a/public/script.js b/public/script.js new file mode 100644 index 0000000..005ac20 --- /dev/null +++ b/public/script.js @@ -0,0 +1,6 @@ + +function afficherLaSuite() { + document.getElementById("nouveau-participant").setAttribute("type", "text"); + document.getElementById("bouton-continuer").setAttribute("display", "inline"); +} + diff --git a/public/styles.css b/public/styles.css index d13f59f..76012da 100644 --- a/public/styles.css +++ b/public/styles.css @@ -1,16 +1,38 @@ +@font-face { + font-family: 'Minecraft'; + src: url('Minecraft.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +.titre, .sous-titre { + font-family: 'Poppins', Geneva, Verdana, sans-serif; + text-align: center; +} + +.titre { + font-size: xx-large; + font-weight: bold; + color: red; +} + +.sous-titre { + color: #6c757d +} + .tableau ul { display: flex; justify-content: space-between; - text-align: left; + text-align: center; } .tableau li { width: 80px; } -.tableau li:nth-child(2) { +.tableau li:nth-child(1) { width: 200px; } -.tableau li:nth-child(3) { +.tableau li:nth-child(2) { width: 20px; } .tableau li { @@ -18,12 +40,14 @@ list-style-type: none; padding: 0px 4px; align-self: center; - text-align: left; } figure { margin: 4px 0px !important; } +.tableau li a:link { + text-decoration: none; +} .tableau ul:nth-child(even) { background-color: #fff3f3; @@ -58,13 +82,14 @@ ul > li > a { img { height: 80px !important; - transition: transform .1s; + transition: transform .4s; } -img:hover{ +img:hover { -ms-transform: scale(5); /* IE 9 */ -webkit-transform: scale(5); /* Safari 3-8 */ transform: scale(5); + transition: .4s; } .offrants { @@ -84,4 +109,38 @@ img:hover{ .vote-sm { text-align: center; font-size: x-large; +} + +.participant { + width: 200px; + margin-top: 15px; + margin-bottom: 15px; +} + +/* Résultats du vote */ +.general { + width: 70%; + display: flex; + align-items: center; + background-color: lightgreen; +} + +.logo img { + margin: 15px; + transition: none !important; + transform: none !important; +} + +.emoticon { + font-size: 78px; + margin: 15px; +} + +.vote { + width: inherit; + font-family: "Minecraft"; +} + +.btn-secondary { + margin-top: 25px;; } \ No newline at end of file diff --git a/views/index.hbs b/views/index.hbs index 1a6d8a9..0486d6e 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -1,67 +1,35 @@ - + - Cadeaux de Noël pour Louisa - + Notre liste d'envies +
-
-

Liste des cadeaux pour Louisa

-

{{ message }}

-
+

Notre liste d'envies

+

A court d'idée pour un cadeau ? De quoi vous inspirer...



- {{#each cadeaux}} {{/each}}
diff --git a/views/offrant.hbs b/views/offrant.hbs index 4b143b1..4935746 100644 --- a/views/offrant.hbs +++ b/views/offrant.hbs @@ -1,30 +1,31 @@ - + - Qui êtes-vous ? + Réservation pour Louisa +
-
-

Qui êtes-vous ?

+
+

Qui es-tu ?

{{ message }}

- -
-
- {{#each listeOffrants}} - - {{/each}} +
+
+ + + +
- Retour aux cadeaux + << Annuler (retour aux cadeaux)
+ + diff --git a/views/reservation.hbs b/views/reservation.hbs index 8cb81d8..3aba0f2 100644 --- a/views/reservation.hbs +++ b/views/reservation.hbs @@ -1,85 +1,47 @@ - + - Réserver un des cadeaux + Réservation pour Louisa
-
-

Réserver ce cadeau

+
+

Merci {{offrant}} : voici le cadeau que tu as sélectionné

{{ message }}

-
-
{{infosCadeaux.libelle}}
+
+
{{infosCadeau.libelle}}
- - + +
- +
-
- - -

Pour l'instant, tu as déjà dépensé : {{totalAchats}}€

-
-
-
- -
- - -
-
- - -
-
-
- - -
-
- -
- - -
-
- - -
-
-
- +
- +
- - Retour aux cadeaux +
+ << Annuler (retour aux cadeaux)
diff --git a/views/votre-vote.hbs b/views/votre-vote.hbs index a8f4b69..150db06 100644 --- a/views/votre-vote.hbs +++ b/views/votre-vote.hbs @@ -9,11 +9,14 @@ -

-
{{#if present}}😁{{else}}☹️{{/if}} {{enfant}} {{#unless present}}ne{{/unless}} sera {{#unless present}}pas{{/unless}} là à l'anniversaire de Louisa le 17 décembre
-
-
- {{#unless present}}
Si vous changez d'avis, vous pouvez toujours nous contacter au 06.22.88.28.80 ou au 06.52.90.38.10
{{/unless}} - {{#if present}}
Louisa a hâte de retrouver ses copains pour cette occasion !!
{{/if}} +
+ + {{enfant}} {{#unless present}}ne{{/unless}} sera {{#unless present}}pas{{/unless}} la a l'anniversaire
de Louisa le 14 decembre 2024
+ + {{#if present}}😁{{else}}☹️{{/if}} + +
\ No newline at end of file diff --git a/wishlist.js b/wishlist.js index ea51818..1c20801 100644 --- a/wishlist.js +++ b/wishlist.js @@ -6,6 +6,10 @@ const path = require("path") const publicDir = path.join(__dirname, './public') var bodyParser = require('body-parser') +/* Pour le Javascript embarqué */ +app.use('/js', express.static(__dirname + './../public')); + + /* Connexion à la BDD MySQL */ dotenv.config({ path: './.env'}) const db = mysql.createConnection({ @@ -23,7 +27,6 @@ db.connect((error) => { } }) - app.set('view engine', 'hbs'); app.use(express.static(publicDir)); /* Pour utiliser le bootstrap local */ @@ -48,7 +51,7 @@ hbs.registerHelper('equals', isEqual); app.get("/", (req, res) => { - db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, p.prenom as "acheteur", c.achete as "achete", c.paye as "paye", p2.prenom as "responsableAchat", c.pour_noel as "pourNoel", c.emballe as "emballe" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.offrant LEFT OUTER JOIN participant p2 on p2.id = pc.responsable_achat ORDER BY c.pour_noel, c.prix', async (error, resultCadeaux) => { + db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, pc.offrant as "acheteur", c.pour_noel as "pourNoel" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id ORDER BY c.pour_noel, c.prix', async (error, resultCadeaux) => { let message; if(error){ @@ -66,70 +69,35 @@ app.get("/", (req, res) => { app.get("/choix-offrant", (req, res) => { let cadeau = req.query.cadeau; - db.query('SELECT id, prenom FROM participant ORDER BY prenom', async (error, result) => { - if(error) { - console.log(error); - } - if (result && result.length > 0) { - res.render('offrant', { "cadeau" : cadeau, "listeOffrants": result}); - } - }) + res.render('offrant', { "cadeau" : cadeau}); }) app.get("/reservation", (req, res) => { - let reqCadeau = req.query.cadeau; - let reqOffrant = req.query.offrant; - let totalAchats; + let cadeau = req.query.cadeau; + let offrant = req.query.offrant; - db.query('SELECT id, libelle, prix, photo, lien, achete, paye, pour_noel as "pourNoel" FROM cadeau WHERE id = ?', [reqCadeau], async (error, infosCadeau) => { + db.query('SELECT id, libelle, prix, photo, lien, pour_noel as "pourNoel" FROM cadeau WHERE id = ?', [cadeau], async (error, infosCadeau) => { if(error) { console.log(error); } - if (infosCadeau.length > 0) { - db.query('SELECT COALESCE(sum(c.prix),0) as "total" FROM cadeau c RIGHT OUTER JOIN participations pc ON pc.cadeau = c.id INNER JOIN participant p ON p.id = pc.offrant WHERE p.id=?', [reqOffrant], async (error, result) => { - if(error) { - console.log(error); - } - if (result && result.length > 0) { - totalAchats = result[0] - } + res.render('reservation', { "infosCadeau": infosCadeau[0], "offrant" : offrant }); + }); - db.query('SELECT id, prenom FROM participant WHERE id=?', [reqOffrant], async (error, result) => { - if(error) { - console.log(error); - } - if (result && result.length > 0) { - offrant = result[0]; - } - }); - - db.query('SELECT id, prenom FROM participant ORDER BY prenom', async (error, listeResponsables) => { - if(error) { - console.log(error); - } - res.render('reservation', { "infosCadeaux": infosCadeau[0], - "offrant" : offrant, - "totalAchats": totalAchats.total, - "listeResponsables" : listeResponsables} ); - }) - }) - } - }) }); app.post("/confirm-reservation", (req, res) => { - const { cadeau, offrant, achete, paye, occasion, responsableAchat } = req.body + const { cadeau, offrant, occasion } = req.body - db.query('UPDATE cadeau SET achete=?, paye=?, pour_noel=? WHERE ID=?', [achete, paye, occasion, cadeau], function (err, result) { + db.query('UPDATE cadeau SET pour_noel=? WHERE ID=?', [occasion, cadeau], function (err, result) { if (err) throw err; console.log("1 record updated"); }); - db.query('INSERT INTO participations (offrant, cadeau, responsable_achat) VALUES (?, ?, ?)', [offrant, cadeau, responsableAchat], function (err, result) { + db.query('INSERT INTO participations (offrant, cadeau) VALUES (?, ?)', [offrant, cadeau], function (err, result) { if (err) throw err; console.log("1 record inserted"); }); @@ -143,7 +111,7 @@ app.get("/presence-anniversaire", (req, res) => { var child_process = require("child_process"); let enfant = req.query.e; let present = req.query.p; - let messageNotif = enfant + (present == 'true' ? "" : " ne") + " sera" + (present == 'true' ? "" : " pas") + " là le 17 décembre"; + let messageNotif = enfant + (present == 'true' ? "" : " ne") + " sera" + (present == 'true' ? "" : " pas") + " là le 14 décembre 2024"; db.query("DELETE FROM anniversaire WHERE enfant = ?", [enfant], function (err, result) { if (err) throw err;