diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 9ca7a4a..bf9ab58 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -34,6 +34,10 @@ form { font-size: 1em; } +ol { + color: grey; +} + input { border-style: solid; border-color: #c1c1c1; @@ -89,6 +93,25 @@ input.button, { .button:hover { background-color: #ff7a7f; } +.centered { + margin: 0 auto; + text-align: left; + width: 90%; +} +.buttons { +width: 10em; +height: 3em; +margin: 0.2em; +background-color: #ff5a60; +color: white; +font-size: 1em; +border-radius: 4px; +border-color: grey; +align: center; +} +.buttons:hover { +background-color: #ff7a7f; +} .navbar { position: fixed; @@ -105,3 +128,33 @@ input.button, { height: 2.6em; width: 100%; } +.single-booking { + display: flex; + margin: 10px; + padding: 20px; + height: 50px; + border-style: solid; + border-radius: 4px; + border-color: #c1c1c1; + border-width: 1px; +} +.single-listing { + display: flex; + margin: 10px; + padding: 20px; + height: 175px; + border-style: solid; + border-radius: 4px; + border-color: #c1c1c1; + border-width: 1px; +} +.single-request { + display: flex; + margin: 10px; + padding: 20px; + height: 100px; + border-style: solid; + border-radius: 4px; + border-color: #c1c1c1; + border-width: 1px; +} diff --git a/routes/index.js b/routes/index.js index 04db469..0338986 100644 --- a/routes/index.js +++ b/routes/index.js @@ -25,39 +25,46 @@ router.get('/login', function(req, res) { router.post('/login',function(req,res){ sess = req.session; - return models.User.count({ where: { email: req.body.email } && { password: req.body.password } }) - .then(count => { - if (count !== 0) { - sess.email=req.body.email; - res.redirect('/user'); - } - res.render('login_error', { - sess: sess - }); + return models.User.count({ where: { email: req.body.email } && { password: req.body.password } }) + .then(count => { + if (count !== 0) { + sess.email=req.body.email; + res.redirect('/user'); + } + res.render('login_error', { + sess: sess }); + }); }); router.post('/booking/accept/:booking_id', function(req, res) { + sess = req.session; + var user; + var booking; + models.Booking.find({where: {id: req.params.booking_id }}).then(function(booking) { + booking.update({accepted: true}).then(function(){ + res.redirect('/user/my_account'); + }); + }); +}); + router.post('/booking/reject/:booking_id', function(req, res) { sess = req.session; var user; var booking; models.Booking.find({where: {id: req.params.booking_id }}).then(function(booking) { - booking.update({accepted: true}).then(function(){ - res.redirect('/user/my_account'); - }); + booking.update({accepted: false}).then(function(){ + res.redirect('/user/my_account'); }); + }); + }); - router.post('/booking/reject/:booking_id', function(req, res) { - sess = req.session; - var user; - var booking; - models.Booking.findAll({where: {id: req.params.booking_id }}).then(function(booking) { - booking.update({accepted: false}).then(function(){ - res.redirect('/user/my_account'); - }); - }); - }); - + router.post('/booking/delete/:booking_id', function(req, res) { + sess = req.session; + var user; + var booking; + models.Booking.destroy({where: {id: req.params.booking_id }}).then(function(booking) { + res.redirect('/user/my_account'); + }); }); diff --git a/views/admin.ejs b/views/admin.ejs index ae7d2d2..d5b84ba 100644 --- a/views/admin.ejs +++ b/views/admin.ejs @@ -6,50 +6,73 @@ + <% include ./partials/header.ejs %>
- +Listing number: <%= booking.listing_id %>. From <%= booking.checkin %> to <%= booking.checkout %>
booking accepted, you will soon receive a confirmation email
+Booking accepted. You will soon receive a confirmation email
<% } else if (booking.accepted === false) { %> -booking declined, you will soon receive an explanation email
+Booking declined. You will soon receive an explanation email
<% } else { %> -booking's acceptation pending
+Booking's acceptation pending
<% } %>