From ede526b0718db2a0214a2173b3b90fa0426087c2 Mon Sep 17 00:00:00 2001 From: Atiwit Pattanapukdee <65160394@go.buu.ac.th> Date: Tue, 18 Mar 2025 13:47:22 +0700 Subject: [PATCH] Project Round 3 --- public/css/styles.css | 16 ++++++++++++++++ routes/tourRoutes.js | 3 +++ views/index.ejs | 1 + 3 files changed, 20 insertions(+) diff --git a/public/css/styles.css b/public/css/styles.css index 4a00cac..033ebe4 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -111,6 +111,22 @@ ul li span { background-color: #007bb5; } +.btn-delete { + display: inline-block; + padding: 10px 20px; + background-color: #ff0000; + color: white; + text-decoration: none; + border-radius: 5px; + margin-top: 20px; + font-size: 1rem; + transition: background-color 0.3s ease; +} + +.btn-delete:hover { + background-color: #e72323; +} + footer { background-color: #333; color: white; diff --git a/routes/tourRoutes.js b/routes/tourRoutes.js index 6f58f78..d160241 100644 --- a/routes/tourRoutes.js +++ b/routes/tourRoutes.js @@ -17,4 +17,7 @@ router.get('/logout', tourController.Logout); // ออกจากระบบ router.get('/create', tourController.getCreateTour); // หน้าสร้างทัวร์ router.post('/create', tourController.createTour); // บันทึกทัวร์ลงฐานข้อมูล +//แก้ไขทัวร์ +router.get('/edit/:id', tourController.getTourDetails); // หน้ารายละเอียดของทัวร์ + module.exports = router; diff --git a/views/index.ejs b/views/index.ejs index ece7e65..cd22e5c 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -37,6 +37,7 @@ <% if (session.userId) { %> <!-- ตรวจสอบว่าเป็นผู้ใช้ที่ล็อกอินแล้วหรือไม่ --> <a href="/edit/<%= tour.id %>" class="btn-edit">Edit</a> <!-- ปุ่มสำหรับแก้ไขทัวร์ --> + <a href="/delete/<%= tour.id %>" class="btn-delete">Delete</a> <% } %> </li> <% }) %> -- GitLab