Initial Commit
This commit is contained in:
149
indexes/seller/attractions.php
Normal file
149
indexes/seller/attractions.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any attraction.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the attraction products you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100;; src="data:image/jpeg;base64,'+data[i].attraction_type_image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].aname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].price + 'RMB</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].attraction_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getAttraction.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteAttraction.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
14
indexes/seller/deleteAttraction.php
Normal file
14
indexes/seller/deleteAttraction.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM attraction WHERE attraction_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success','time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
14
indexes/seller/deleteFood.php
Normal file
14
indexes/seller/deleteFood.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM restaurant WHERE restaurant_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success', 'time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
14
indexes/seller/deleteHotel.php
Normal file
14
indexes/seller/deleteHotel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM hotel WHERE hotel_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success', 'time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
157
indexes/seller/foods.php
Normal file
157
indexes/seller/foods.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
|
||||
</nav>
|
||||
</header>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any restaurant.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the restaurant you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].rname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].fee + 'RMB</td></tr>';
|
||||
html += '<tr><td style="vertical-align:top">Characteristics</td><td style="vertical-align:top">' + data[i].descrip + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].restaurant_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getFood.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteFood.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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>
|
||||
|
||||
|
||||
<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>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
58
indexes/seller/getAttraction.php
Normal file
58
indexes/seller/getAttraction.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM attraction WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
// search current page data
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
$sql = "SELECT
|
||||
attraction.attraction_id,
|
||||
attraction.name AS aname,
|
||||
cities.name AS cname,
|
||||
attraction.rating,
|
||||
attraction.descrip,
|
||||
attraction.price,
|
||||
attraction_type.attraction_type_image
|
||||
FROM
|
||||
attraction
|
||||
JOIN
|
||||
cities ON attraction.city_id = cities.id
|
||||
JOIN
|
||||
attraction_type ON attraction.attraction_type_id = attraction_type.attraction_type_id
|
||||
WHERE attraction.seller_id = $seller_id AND attraction.name LIKE '%" . $q . "%'
|
||||
";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["attraction_type_image"] = base64_encode($row["attraction_type_image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
62
indexes/seller/getFood.php
Normal file
62
indexes/seller/getFood.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM restaurant WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
// search current page data
|
||||
$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.seller_id = $seller_id AND restaurant.name LIKE '%".$q."%';";
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
51
indexes/seller/getHotel.php
Normal file
51
indexes/seller/getHotel.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
|
||||
$result_count = $conn->query("SELECT COUNT(*) AS count FROM hotel WHERE name LIKE '%$q%'");
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
$sql = "SELECT
|
||||
hotel.hotel_id,
|
||||
hotel.name AS hname,
|
||||
cities.name AS cname,
|
||||
hotel_type.hotel_type_name,
|
||||
hotel.rating,
|
||||
hotel_type.hotel_type_image AS image
|
||||
FROM
|
||||
hotel
|
||||
JOIN
|
||||
cities ON hotel.city_id = cities.id
|
||||
JOIN
|
||||
hotel_type ON hotel.hotel_type_id = hotel_type.hotel_type_id
|
||||
WHERE hotel.seller_id = $seller_id AND hotel.name LIKE '%" . $q . "%'
|
||||
";
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
70
indexes/seller/home.php
Normal file
70
indexes/seller/home.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
|
||||
body{
|
||||
background-color:rgb(214,214,214)
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div style="font-size: 40px; color: black; text-align: center; font-family: 'Times New Roman', Times, serif;">
|
||||
<br><br>Welcome to RoamEase!<br><br>
|
||||
As a business, please operate with integrity and build a harmonious society together.
|
||||
<br><br><br><br>
|
||||
Select the type of product you have on the header.
|
||||
</div><br><br>
|
||||
|
||||
</body>
|
||||
|
||||
<br><br><br><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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
147
indexes/seller/stays.php
Normal file
147
indexes/seller/stays.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
|
||||
</nav>
|
||||
</header>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any hotel.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the hotel you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].hname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Type</td><td>' + data[i].hotel_type_name + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].hotel_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getHotel.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteHotel.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user