Initial Commit

This commit is contained in:
ldy
2025-06-06 17:31:03 +08:00
parent 787a7b5741
commit 66cd489ea8
244 changed files with 13574 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:15%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attraction.php" style="border-color: white;">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var attractionDetail; // Declare globally
var aid; // Declare globally
function GoodFunction(){
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
detailHtml += '<tr><td rowspan="11"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].attraction_type_image+'" alt="Hotel Image"></td>';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].name + '</td></tr>';
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
detailHtml += '<tr><td>Open Time</td><td>' + attractionDetail[0].open_time + '</td></tr>';
detailHtml += '<tr><td>Close Time</td><td>' + attractionDetail[0].close_time + '</td></tr>';
detailHtml += '<tr><td>Open Day</td><td>' + attractionDetail[0].open_day + '</td></tr>';
detailHtml += '<tr><td>Close Day</td><td>' + attractionDetail[0].close_day + '</td></tr>';
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].attraction_type_name + '</td></tr>';
detailHtml += '<tr><td>Ticket</td><td>' + attractionDetail[0].price + 'RMB</td></tr>';
detailHtml += '<tr><td> &nbsp</td><td></td>&nbsp</tr>';
detailHtml += '<tr><td style="vertical-align:top">Introduction</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
detailHtml += '</table>';
detailHtml +='<a href="../attractions.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getAtInfo.php?id=" + aid, true);
xmlhttp.send();
}
function add_cart() {
let start_date = document.getElementById("start_date").value;
let quantity = document.getElementById("quantity").value;
let price = attractionDetail[0].price; // Now accessible
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=3&price=' + price;
}
GoodFunction();
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>

View File

@@ -0,0 +1,171 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:10%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php" style="border-color: white;">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attractions.php">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var aid;
var attractionDetail;
function GoodFunction(){
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].flight_code + '</td></tr>';
detailHtml += '<tr><td>Departure</td><td>' + attractionDetail[0].from_name +'<td>Airport: '+attractionDetail[0].departure_airport_name+'</td></td></tr>';
detailHtml += '<tr><td>Destination</td><td>' + attractionDetail[0].dest_name + '<td>Airport: '+attractionDetail[0].arrival_airport_name+'</td></tr>';
detailHtml += '<tr><td>Week routine</td><td>' + attractionDetail[0].week_routine + '</td></tr>';
detailHtml += '<tr><td>Take off time</td><td>' + attractionDetail[0].takeoff_time + '</td></tr>';
detailHtml += '<tr><td>Landing time</td><td>' + attractionDetail[0].landing_time + '</td></tr>';
for (var i = 0; i < attractionDetail.length; i++) {
detailHtml += '<tr>';
detailHtml += '<td><input type="radio" id="flight_class_id" name="flight_class_id" value="' + attractionDetail[i].flight_class_id + '">';
detailHtml += attractionDetail[i].class + '</td>';
detailHtml += '<td>' + attractionDetail[i].fee + 'RMB</td>';
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].flight_class_id + ')">Add to Plan</div></td>';
if (i==0){
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
}
detailHtml += '</tr>';
}
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '</table>';
detailHtml +='<a href="../flight.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getFlInfo.php?id=" + aid, true);
xmlhttp.send();
}
function add_cart() {
let start_date = document.getElementById("start_date").value;
let quantity = document.getElementById("quantity").value;
let price = attractionDetail[0].price; // Now accessible
let product_id = document.getElementById("flight_class_id").value;
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=5&price=' + price;
}
GoodFunction();
function addToPlan(flightClassId) {
var startDate = prompt("Select visit_date:", formatDate(new Date()));
if (startDate) {
var url = `../plans_do.php?flightClassId=${flightClassId}&visit_date=${startDate}`;
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
}
return response.json();
})
.then(data => {
if (data.code === 0) {
alert(data.msg)
} else {
console.error(`Error adding to the plan. Message: ${data.message}`);
}
})
.catch(error => {
console.error("Fetch error:", error);
});
}
}
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, '0');
var day = date.getDate().toString().padStart(2, '0');
return year + '-' + month + '-' + day;
}
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>

View File

@@ -0,0 +1,131 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:15%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php" style="border-color: white;">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attractions.php">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var attractionDetail; // Declare globally
var aid; // Declare globally
function GoodFunction(){
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
detailHtml += '<tr><td rowspan="11"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].image+'" alt="Hotel Image"></td>';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].rname + '</td></tr>';
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
detailHtml += '<tr><td>Open Time</td><td>' + attractionDetail[0].open_time + '</td></tr>';
detailHtml += '<tr><td>Close Time</td><td>' + attractionDetail[0].close_time + '</td></tr>';
detailHtml += '<tr><td>Open Day</td><td>' + attractionDetail[0].open_day + '</td></tr>';
detailHtml += '<tr><td>Close Day</td><td>' + attractionDetail[0].close_day + '</td></tr>';
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].restaurant_style_name + '</td></tr>';
detailHtml += '<tr><td>Fee</td><td>' + attractionDetail[0].fee + 'RMB</td></tr>';
detailHtml += '<tr><td> &nbsp</td><td></td>&nbsp</tr>';
detailHtml += '<tr><td style="vertical-align:top">Description</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
detailHtml += '</table>';
detailHtml +='<a href="../foods.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getFoInfo.php?id=" + aid, true);
xmlhttp.send();
}
function add_cart() {
let start_date = document.getElementById("start_date").value;
let quantity = document.getElementById("quantity").value;
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=2';
}
GoodFunction();
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>

View File

@@ -0,0 +1,130 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:15%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attractions.php">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php" style="border-color: white;">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var attractionDetail; // Declare globally
var aid; // Declare globally
function GoodFunction(){
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].username + '</td></tr>';
detailHtml += '<tr><td>Working age</td><td>' + attractionDetail[0].working_age + '</td></tr>';
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].guide_type_name + '</td></tr>';
detailHtml += '<tr><td>Fee</td><td>' + attractionDetail[0].fee+ 'RMB</td></tr>';
detailHtml += '<tr><td> &nbsp</td><td></td>&nbsp</tr>';
detailHtml += '<tr><td style="vertical-align:top">Description</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field with button"><input type="date" id="end_date" class="edit-button" name="end_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="end_date">End date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
detailHtml += '</table>';
detailHtml +='<a href="../guiding.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
detailHtml +='<a href="../guiding.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getGuInfo.php?id=" + aid, true);
xmlhttp.send();
}
function add_cart() {
let start_date = document.getElementById("start_date").value;
let end_date = document.getElementById("end_date").value;
let quantity = document.getElementById("quantity").value;
let price = attractionDetail[0].price; // Now accessible
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=' + end_date + '&quantity=' + quantity + '&table=4&price=' + price;
}
GoodFunction();
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>

View File

@@ -0,0 +1,179 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:10%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php" style="border-color: white;">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attractions.php">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var attractionDetail; // Declare globally
var aid; // Declare globally
function GoodFunction() {
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
detailHtml += '<tr><td rowspan="20"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].image+'" alt="Hotel Image"></td>';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].hname + '</td></tr>';
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
detailHtml += '<tr><td style="vertical-align:top;">Description</td><td style="vertical-align:top;">' + attractionDetail[0].descrip + '</td></tr>';
for (var i = 0; i < attractionDetail.length; i++) {
detailHtml += '<tr>';
detailHtml += '<td><input type="radio" id="hotel_room_id" name="hotel_room_id" value="' + attractionDetail[i].hotel_room_id + '">';
detailHtml += attractionDetail[i].rType + '</td>';
detailHtml += '<td>' + attractionDetail[i].price + 'RMB</td>';
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].hotel_room_id + ')">Add to Plan</div></td>';
if (i==0){
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
}
detailHtml += '</tr>';
}
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field with button"><input type="date" id="end_date" class="edit-button" name="end_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="end_date">End date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '</table><a href="../stays.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
detailHtml += '';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getHoInfo.php?id=" + aid, true);
xmlhttp.send();
function add_cart() {
let start_date = document.getElementById("start_date").value;
let end_date = document.getElementById("end_date").value;
let quantity = document.getElementById("quantity").value;
let price = attractionDetail[0].price; // Now accessible
let product_id = document.getElementById("hotel_room_id").value;
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=' + end_date + '&quantity=' + quantity + '&table=1&price=' + price;
}
}
GoodFunction();
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>
<script>
function addToPlan(roomId) {
var startDate = prompt("Select start date:", formatDate(new Date()));
var endDate = prompt("Select end date:", formatDate(new Date()));
if (startDate && endDate) {
var url = `../plans_do.php?roomId=${roomId}&startDate=${startDate}&endDate=${endDate}`;
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
}
return response.json();
})
.then(data => {
if (data.code === 0) {
alert(data.msg)
} else {
console.error(`Error adding to the plan. Message: ${data.message}`);
}
})
.catch(error => {
console.error("Fetch error:", error);
});
}
}
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, '0');
var day = date.getDate().toString().padStart(2, '0');
return year + '-' + month + '-' + day;
}
</script>

View File

@@ -0,0 +1,172 @@
<html>
<title>RoamEase</title>
<link rel="shortcut icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="../../../icon/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../home.css?version=1" type="text/css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header>
<style>
.pagebutton{
background-color: #ADD8FF;
border: none;
color: white;
text-decoration: none;
display: inline-block;
font-size: 13px;
width:10%;
border-radius: 10px;
font-size:17px;
transition:background-color 0.3s ease;
}
</style>
<div class="logo">
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
</div>
<div class="nav-links">
<?php
session_start();
if (isset($_SESSION['loggedin'])) {
echo '<a href="../process/cart.php">Cart</a>
<a href="../../../login/login.php">Account</a>';
}
else {
echo '<a href="../../../login/register.php">Sign up</a>
<a href="../../../login/username.php">Log in</a>';
}
?>
</div>
</header>
<header>
<nav>
<a href="../stays.php">
<img src="../../../icon/header/stays.svg" alt="Stays">
</a>
<a href="../transport.php">
<img src="../../../icon/header/transportations.svg" alt="Transportations">
</a>
<a href="../foods.php">
<img src="../../../icon/header/foods.svg" alt="Foods">
</a>
<a href="../attractions.php" style="border-color: white;">
<img src="../../../icon/header/attractions.svg" alt="Attractions">
</a>
<a href="../guiding.php">
<img src="../../../icon/header/guiding.svg" alt="Guiding">
</a>
<a href="../plans.php">
<img src="../../../icon/header/plans.svg" alt="Plans">
</a>
</nav>
</header>
<style>
table tr td:first-child {
width: 160px;
}
</style>
<script>
var attractionDetail; // Declare globally
var aid; // Declare globally
function GoodFunction(){
var urlParams = new URLSearchParams(window.location.search);
aid = urlParams.get('id');
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
attractionDetail = JSON.parse(this.responseText);
console.log(attractionDetail);
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].train_code + '</td></tr>';
detailHtml += '<tr><td>Departure</td><td>' + attractionDetail[0].from_name +'<td>Station: ' +attractionDetail[0].departure_station_name+'</td></tr>';
detailHtml += '<tr><td>Destination</td><td>' + attractionDetail[0].dest_name +'<td>Station: ' +attractionDetail[0].arrival_station_name+'</td></tr>';
detailHtml += '<tr><td>Week routine</td><td>' + attractionDetail[0].week_routine + '</td></tr>';
detailHtml += '<tr><td>Strat time</td><td>' + attractionDetail[0].start_time + '</td></tr>';
detailHtml += '<tr><td>Arrive time</td><td>' + attractionDetail[0].arrive_time + '</td></tr>';
for (var i = 0; i < attractionDetail.length; i++) {
detailHtml += '<tr>';
detailHtml += '<td><input type="radio" id="train_seat_id" name="train_seat_id" value="' + attractionDetail[i].train_seat_id + '">';
detailHtml += attractionDetail[i].class + '</td>';
detailHtml += '<td>' + attractionDetail[i].fee + 'RMB</td>';
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].train_seat_id + ')">Add to Plan</div></td>';
if (i==0){
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
}
detailHtml += '</tr>';
}
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
detailHtml += '</table>';
detailHtml +='<a href="../railway.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
document.getElementById("detail").innerHTML = detailHtml;
}
document.getElementById('add_cart').addEventListener('click', add_cart);
}
xmlhttp.open("GET", "getRaInfo.php?id=" + aid, true);
xmlhttp.send();
}
function add_cart() {
let start_date = document.getElementById("start_date").value;
let quantity = document.getElementById("quantity").value;
let price = attractionDetail[0].price; // Now accessible
let product_id = document.getElementById("train_seat_id").value;
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=6&price=' + price;
}
GoodFunction();
function addToPlan(trainClassId) {
var startDate = prompt("Select visit_date:", formatDate(new Date()));
if (startDate) {
var url = `../plans_do.php?trainClassId=${trainClassId}&visit_date=${startDate}`;
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
}
return response.json();
})
.then(data => {
if (data.code === 0) {
alert(data.msg)
} else {
console.error(`Error adding to the plan. Message: ${data.message}`);
}
})
.catch(error => {
console.error("Fetch error:", error);
});
}
}
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, '0');
var day = date.getDate().toString().padStart(2, '0');
return year + '-' + month + '-' + day;
}
</script>
<div id="detail"></div><br><br><br>
<footer>
<div class="logo">
<a href="../../../index.php"><img src="../../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
</div>
<div class="nav-links" style="font-size: 80%;">
<a href="#" style="color: white; margin: 0 10px;">About us</a>
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
</div>
</footer>
</html>

View File

@@ -0,0 +1,19 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT attraction.attraction_id, name,location,open_time,close_time,open_day,close_day,attraction_type.attraction_type_name,price,descrip,attraction_type.attraction_type_image
FROM attraction JOIN attraction_type USING(attraction_type_id)
WHERE attraction_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$row["attraction_type_image"] = base64_encode($row["attraction_type_image"]);
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>

View File

@@ -0,0 +1,44 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
transport_flight.flight_id,
transport_flight.flight_code,
departure_city.name AS from_name,
arrival_city.name AS dest_name,
departure_airport.name AS departure_airport_name,
arrival_airport.name AS arrival_airport_name,
flight_class_id,
week_routine,
takeoff_time,
class,
fee,
landing_time
FROM
transport_flight
JOIN
transport_airport AS departure_airport ON transport_flight.from_airport_id = departure_airport.airport_id
JOIN
transport_airport AS arrival_airport ON transport_flight.dest_airport_id = arrival_airport.airport_id
JOIN
transport_airline ON transport_flight.airline_id = transport_airline.airline_id
JOIN
cities AS departure_city ON departure_airport.city_id = departure_city.id
JOIN transport_flight_class USING (flight_id)
JOIN cities AS arrival_city ON arrival_airport.city_id = arrival_city.id
WHERE flight_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>

View File

@@ -0,0 +1,37 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
restaurant.restaurant_id,
restaurant.name AS rname,
cities.name AS cname,
restaurant.location,
restaurant.open_day,
restaurant.close_day,
restaurant.open_time,
restaurant.close_time,
restaurant.rating,
restaurant_style.restaurant_style_name,
restaurant.descrip,
restaurant.fee,
restaurant_style.restaurant_style_image AS image
FROM
restaurant
JOIN
cities ON restaurant.city_id = cities.id
JOIN
restaurant_style ON restaurant.restaurant_style_id = restaurant_style.restaurant_style_id
WHERE restaurant_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$row["image"] = base64_encode($row["image"]);
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>

View File

@@ -0,0 +1,28 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
user_guide.u_id,
user_guide.username,
user_guide.working_age,
guide_type.guide_type_name,
user_guide.rating,
user_guide.fee,
user_guide.descrip
FROM
user_guide
JOIN
guide_type ON user_guide.guide_type_id = guide_type.guide_type_id
WHERE user_guide.u_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>

View File

@@ -0,0 +1,34 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
hotel.hotel_id,
hotel.location,
hotel.name AS 'hname',
hotel_room_type.room_type_name AS 'rType',
hotel_room.price AS 'price',
hotel_room.hotel_room_id,
hotel.descrip,
hotel_type.hotel_type_image AS image
FROM
hotel
JOIN
hotel_room ON hotel.hotel_id = hotel_room.hotel_id
JOIN
hotel_room_type ON hotel_room.room_type_id = hotel_room_type.room_type_id
JOIN hotel_type USING(hotel_type_id)
WHERE hotel.hotel_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$row["image"] = base64_encode($row["image"]);
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>

View File

@@ -0,0 +1,43 @@
<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
transport_railway.train_id,
transport_railway.train_code,
departure_station.name AS departure_station_name,
arrival_station.name AS arrival_station_name,
departure_city.name AS from_name,
arrival_city.name AS dest_name,
train_seat_id,
transport_railway.start_time,
transport_railway.arrive_time,
class,
fee,
transport_railway.week_routine
FROM
transport_railway
JOIN
transport_railway_station AS departure_station ON transport_railway.from_station_id = departure_station.station_id
JOIN
transport_railway_station AS arrival_station ON transport_railway.dest_station_id = arrival_station.station_id
JOIN
cities AS departure_city ON departure_station.city_id = departure_city.id
JOIN
cities AS arrival_city ON arrival_station.city_id = arrival_city.id
JOIN transport_railway_class USING (train_id)
WHERE train_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>