Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit aae4bc8d authored by 65160394's avatar 65160394
Browse files

Project Round 11

parent 9db1e988
No related branches found
No related tags found
No related merge requests found
......@@ -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');
};
// บันทึกทัวร์ใหม่
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment