diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..07fe6d5 Binary files /dev/null and b/.DS_Store differ diff --git a/app.js b/app.js index 5e04183..89d0114 100644 --- a/app.js +++ b/app.js @@ -29,7 +29,7 @@ app.use('/css', express.static(__dirname + '/node_modules/bootstrap/dist/css')); app.use(express.json()); 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 "demandeur", c.achete as "achete", p2.prenom as "responsable" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.personne LEFT OUTER JOIN participant p2 on p2.id = pc.responsable', async (error, resultCadeaux) => { + 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 "responsable_achat" 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', async (error, resultCadeaux) => { let message; if(error){ @@ -50,9 +50,11 @@ app.get("/reserve", (req, res) => { console.log(error); } if (result.length > 0) { + db.query('SELECT id, prenom, FROM participant', async (error, selectOffrant) => { - db.query('SELECT id, prenom FROM participant', async (error, select) => { - res.render('reservation', { "id": result[0].id, "libelle": result[0].libelle, "photo": result[0].photo, "responsable": select } ); + db.query('SELECT sum(c.prix) FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id WHERE pc.offrant = ?', [], async (error, totalAchats) => { + res.render('reservation', { "id": result[0].id, "libelle": result[0].libelle, "photo": result[0].photo, "offrant": selectOffrant, "totalDepenses": totalAchats } ); + }) }) } }) diff --git a/node_modules/.DS_Store b/node_modules/.DS_Store new file mode 100644 index 0000000..6592518 Binary files /dev/null and b/node_modules/.DS_Store differ diff --git a/node_modules/bootstrap/.DS_Store b/node_modules/bootstrap/.DS_Store new file mode 100644 index 0000000..7f2c00b Binary files /dev/null and b/node_modules/bootstrap/.DS_Store differ diff --git a/node_modules/call-bind/.DS_Store b/node_modules/call-bind/.DS_Store new file mode 100644 index 0000000..ec027a2 Binary files /dev/null and b/node_modules/call-bind/.DS_Store differ diff --git a/node_modules/chokidar/.DS_Store b/node_modules/chokidar/.DS_Store new file mode 100644 index 0000000..94634bc Binary files /dev/null and b/node_modules/chokidar/.DS_Store differ diff --git a/node_modules/concat-map/.DS_Store b/node_modules/concat-map/.DS_Store new file mode 100644 index 0000000..2dccfc8 Binary files /dev/null and b/node_modules/concat-map/.DS_Store differ diff --git a/node_modules/define-data-property/.DS_Store b/node_modules/define-data-property/.DS_Store new file mode 100644 index 0000000..0fd47e0 Binary files /dev/null and b/node_modules/define-data-property/.DS_Store differ diff --git a/node_modules/function-bind/.DS_Store b/node_modules/function-bind/.DS_Store new file mode 100644 index 0000000..f5f5ee9 Binary files /dev/null and b/node_modules/function-bind/.DS_Store differ diff --git a/node_modules/get-intrinsic/.DS_Store b/node_modules/get-intrinsic/.DS_Store new file mode 100644 index 0000000..8778eb9 Binary files /dev/null and b/node_modules/get-intrinsic/.DS_Store differ diff --git a/node_modules/gopd/.DS_Store b/node_modules/gopd/.DS_Store new file mode 100644 index 0000000..ef16658 Binary files /dev/null and b/node_modules/gopd/.DS_Store differ diff --git a/node_modules/handlebars/.DS_Store b/node_modules/handlebars/.DS_Store new file mode 100644 index 0000000..c5f2458 Binary files /dev/null and b/node_modules/handlebars/.DS_Store differ diff --git a/node_modules/has-property-descriptors/.DS_Store b/node_modules/has-property-descriptors/.DS_Store new file mode 100644 index 0000000..3dcf339 Binary files /dev/null and b/node_modules/has-property-descriptors/.DS_Store differ diff --git a/node_modules/has-proto/.DS_Store b/node_modules/has-proto/.DS_Store new file mode 100644 index 0000000..9bbed1e Binary files /dev/null and b/node_modules/has-proto/.DS_Store differ diff --git a/node_modules/has-symbols/.DS_Store b/node_modules/has-symbols/.DS_Store new file mode 100644 index 0000000..65b6674 Binary files /dev/null and b/node_modules/has-symbols/.DS_Store differ diff --git a/node_modules/iconv-lite/.DS_Store b/node_modules/iconv-lite/.DS_Store new file mode 100644 index 0000000..e6dab25 Binary files /dev/null and b/node_modules/iconv-lite/.DS_Store differ diff --git a/node_modules/minimist/.DS_Store b/node_modules/minimist/.DS_Store new file mode 100644 index 0000000..1f3c380 Binary files /dev/null and b/node_modules/minimist/.DS_Store differ diff --git a/node_modules/mysql/.DS_Store b/node_modules/mysql/.DS_Store new file mode 100644 index 0000000..83ec667 Binary files /dev/null and b/node_modules/mysql/.DS_Store differ diff --git a/node_modules/nodemon/.DS_Store b/node_modules/nodemon/.DS_Store new file mode 100644 index 0000000..292865d Binary files /dev/null and b/node_modules/nodemon/.DS_Store differ diff --git a/node_modules/nopt/.DS_Store b/node_modules/nopt/.DS_Store new file mode 100644 index 0000000..471b9b6 Binary files /dev/null and b/node_modules/nopt/.DS_Store differ diff --git a/node_modules/object-inspect/.DS_Store b/node_modules/object-inspect/.DS_Store new file mode 100644 index 0000000..23d540c Binary files /dev/null and b/node_modules/object-inspect/.DS_Store differ diff --git a/node_modules/pstree.remy/.DS_Store b/node_modules/pstree.remy/.DS_Store new file mode 100644 index 0000000..b8c69d9 Binary files /dev/null and b/node_modules/pstree.remy/.DS_Store differ diff --git a/node_modules/qs/.DS_Store b/node_modules/qs/.DS_Store new file mode 100644 index 0000000..88e478a Binary files /dev/null and b/node_modules/qs/.DS_Store differ diff --git a/node_modules/readable-stream/.DS_Store b/node_modules/readable-stream/.DS_Store new file mode 100644 index 0000000..3699978 Binary files /dev/null and b/node_modules/readable-stream/.DS_Store differ diff --git a/node_modules/semver/.DS_Store b/node_modules/semver/.DS_Store new file mode 100644 index 0000000..fb67969 Binary files /dev/null and b/node_modules/semver/.DS_Store differ diff --git a/node_modules/side-channel/.DS_Store b/node_modules/side-channel/.DS_Store new file mode 100644 index 0000000..e1face7 Binary files /dev/null and b/node_modules/side-channel/.DS_Store differ diff --git a/node_modules/simple-update-notifier/.DS_Store b/node_modules/simple-update-notifier/.DS_Store new file mode 100644 index 0000000..2e91b3c Binary files /dev/null and b/node_modules/simple-update-notifier/.DS_Store differ diff --git a/node_modules/source-map/.DS_Store b/node_modules/source-map/.DS_Store new file mode 100644 index 0000000..8ccc4bc Binary files /dev/null and b/node_modules/source-map/.DS_Store differ diff --git a/node_modules/string_decoder/.DS_Store b/node_modules/string_decoder/.DS_Store new file mode 100644 index 0000000..7f15d07 Binary files /dev/null and b/node_modules/string_decoder/.DS_Store differ diff --git a/node_modules/uglify-js/.DS_Store b/node_modules/uglify-js/.DS_Store new file mode 100644 index 0000000..9d8a407 Binary files /dev/null and b/node_modules/uglify-js/.DS_Store differ diff --git a/node_modules/undefsafe/.DS_Store b/node_modules/undefsafe/.DS_Store new file mode 100644 index 0000000..3912af0 Binary files /dev/null and b/node_modules/undefsafe/.DS_Store differ diff --git a/node_modules/wordwrap/.DS_Store b/node_modules/wordwrap/.DS_Store new file mode 100644 index 0000000..ebcafd2 Binary files /dev/null and b/node_modules/wordwrap/.DS_Store differ diff --git a/views/index.hbs b/views/index.hbs index 91149c6..bb506f7 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -38,20 +38,29 @@