From 622faa4bc9aa4ecc99cd33d5cd69c49288ab4029 Mon Sep 17 00:00:00 2001
From: Atiwit Pattanapukdee <65160394@go.buu.ac.th>
Date: Thu, 20 Mar 2025 21:36:51 +0700
Subject: [PATCH] Project Round 9

---
 routes/tourRoutes.js | 2 +-
 views/index.ejs      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/routes/tourRoutes.js b/routes/tourRoutes.js
index bf70451..1007191 100644
--- a/routes/tourRoutes.js
+++ b/routes/tourRoutes.js
@@ -34,7 +34,7 @@ router.post('/edit-profile', tourController.updateProfile);// อัปเดต
 
 //จองทัวร์
 router.get('/my-bookings', tourController.getUserBookings);
-router.get('/createbooking', tourController.getAllTours);
+router.get('/create-booking', tourController.getAllTours);
 router.post('/create-booking', tourController.createBooking);
 router.post('/cancel/:id', tourController.cancelBooking);
 
diff --git a/views/index.ejs b/views/index.ejs
index 562cd90..64930c6 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -13,7 +13,7 @@
     <nav>
       <% if (session && session.id) { %>
         <a href="/create" class="btn-create">Create Tour</a>
-        <a href="/createbooking" class="btn-create">Create Booking</a>
+        <a href="/create-booking" class="btn-create">Create Booking</a>
       <% } %>
       <form action="/search" method="GET" class="search-container">
         <input type="text" name="query" placeholder="Search for tours..." required>
@@ -36,7 +36,7 @@
         <li>
           <a href="/tour/<%= tour.id %>"><%= tour.name %></a> - <%= tour.price %> THB
           
-          <% if (session.id) { %>  
+          <% if (session && session.id) { %>  
             <a href="/edit/<%= tour.id %>" class="btn-edit">Edit</a> <!-- ปุ่มสำหรับแก้ไขทัวร์ -->
             <a href="/delete/<%= tour.id %>" class="btn-delete">Delete</a> <!-- ปุ่มสำหรับลบทัวร์ -->
           <% } %>
-- 
GitLab