From aae4bc8d5b90bdc1b6e045159e109cc9c5e29319 Mon Sep 17 00:00:00 2001 From: Atiwit Pattanapukdee <65160394@go.buu.ac.th> Date: Wed, 26 Mar 2025 17:16:24 +0700 Subject: [PATCH] Project Round 11 --- controllers/tourController.js | 14 ++------------ views/createtour.ejs | 10 +++++----- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/controllers/tourController.js b/controllers/tourController.js index 460324d..ec7c0fa 100644 --- a/controllers/tourController.js +++ b/controllers/tourController.js @@ -147,18 +147,8 @@ exports.updateProfile = async (req, res) => { //CRUD // แสดงฟอร์มสร้างทัวร์ -// ฟังก์ชันแสดงฟอร์มสร้างทัวร์ -exports.getCreateTour = async (req, res) => { - try { - // ดึงข้อมูลบริษัททั้งหมดจากฐานข้อมูล - const companies = await company.getAllCompanies(); - - // ส่งข้อมูลบริษัทไปยัง view 'createtour.ejs' - res.render('createtour', { companies }); - } catch (error) { - console.error('Error fetching companies:', error); - res.status(500).send('เกิดข้อผิดพลาดในการดึงข้อมูลบริษัท'); - } +exports.getCreateTour = (req, res) => { + res.render('createtour'); }; // บันทึกทัวร์ใหม่ diff --git a/views/createtour.ejs b/views/createtour.ejs index 96a6b93..0bf9c32 100644 --- a/views/createtour.ejs +++ b/views/createtour.ejs @@ -30,12 +30,12 @@ <div> <label for="tourCompany">บริษัท:</label> <select id="tourCompany" name="company_id" required> - <option value="">เลือกบริษัท</option> - <% companies.forEach(company => { %> - <option value="<%= company.id %>"><%= company.name %></option> - <% }) %> + <option value="" disabled selected>เลือกบริษัท</option> + <option value="1">Amazing Travel</option> + <option value="2">Wonderful Tours</option> + <option value="3">Explore Asia</option> </select> - </div> + </div> <button type="submit">สร้างโปรแกรม Tour</button> </form> </main> -- GitLab