diff --git a/views/index.ejs b/views/index.ejs index 88161347dea627176352a969540a21b722045b68..fdd0e8400ec941a326654edf15a20572e9b7094b 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -36,7 +36,9 @@ <% if (session && session.userId) { %> <a href="/edit/<%= tour.id %>" class="btn-edit">Edit</a> <!-- ปุ่มสำหรับแก้ไขทัวร์ --> - <a href="/delete/<%= tour.id %>" class="btn-delete">Delete</a> <!-- ปุ่มสำหรับลบทัวร์ --> + <form action="/tour/delete/<%= tour.id %>" method="POST" onsubmit="return confirmDelete()"> + <button type="submit" class="btn-delete">Delete</button> <!-- ปุ่มสำหรับลบทัวร์ --> + </form> <% } %> </li> <% }) %> @@ -46,5 +48,12 @@ <footer> <p>© 2025 Tour Website</p> </footer> + + <script> + // ฟังก์ชันยืนยันการลบ + function confirmDelete() { + return confirm("คุณแน่ใจหรือไม่ว่าต้องการลบทัวร์นี้?"); + } + </script> </body> </html> diff --git a/views/tour-details.ejs b/views/tour-details.ejs index 2a34d1197ae2983cf118a88d73e32ad37d6de9f3..c53af309b8217ca625ce47db036a79489b228dc5 100644 --- a/views/tour-details.ejs +++ b/views/tour-details.ejs @@ -16,7 +16,7 @@ <p><strong>ชื่อทัวร์:</strong> <%= tour.name %></p> <p><strong>คำอธิบาย:</strong> <%= tour.description %></p> <p><strong>ราคา:</strong> <%= tour.price %></p> - <p><strong>ระยะเวลา:</strong> <%= tour.duration %></p> + <p><strong>ระยะเวลา:</strong> <%= tour.duration %> วัน</p> <p><strong>บริษัท:</strong> <%= tour.cname %></p> <a href="/" class="btn-edit">ย้อนกลับ</a> </section>