diff --git a/controllers/tourController.js b/controllers/tourController.js index 460324d6379c0ca26ddbf0c047ed0e8c094fb4c5..ec7c0faa3e29a5afae8bdaee4de05dc2e95eaf61 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 96a6b93fc2384cfd52461bd20851a58012539bb5..0bf9c32827318ad8347add8708091d53450cdc62 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>