update,
This commit is contained in:
48
_resources/it114105/itp4513/Assignment/18-19/Login.php
Normal file
48
_resources/it114105/itp4513/Assignment/18-19/Login.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(strlen(trim($_POST['username']))>0 && strlen(trim($_POST['password']))>0){
|
||||
|
||||
$userName = $_POST['username'];
|
||||
$pwd = $_POST['password'];
|
||||
if(substr_count($userName,"@")==1){
|
||||
require_once('ini/conn.php');
|
||||
$sql= "SELECT password FROM administrator WHERE email='$userName'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_errno($conn));
|
||||
|
||||
|
||||
if(mysqli_num_rows($result)==1){
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
if($pwd==$record["password"]){
|
||||
setcookie("AdminName", $userName, time()+60*15);
|
||||
header("location: adminOrder.php");
|
||||
}else{
|
||||
header("location: index.php?Login=FALSE");
|
||||
}
|
||||
}else{
|
||||
header("location: index.php?Login=FALSE");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
require_once('ini/conn.php');
|
||||
$sql= "SELECT password FROM dealer WHERE dealerID='$userName'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_errno($conn));
|
||||
if(mysqli_num_rows($result)==1){
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
if($pwd==$record["password"]){
|
||||
setcookie("DealerName", $userName, time()+60*15);
|
||||
header("location: createOrder.php");
|
||||
}else{
|
||||
header("location: index.php?Login=FALSE");
|
||||
}
|
||||
}else{
|
||||
header("location: index.php?Login=FALSE");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
header("location: index.php?userName=FALSE&pwd=FALSE");
|
||||
}
|
||||
|
||||
?>
|
149
_resources/it114105/itp4513/Assignment/18-19/README.md.original
Normal file
149
_resources/it114105/itp4513/Assignment/18-19/README.md.original
Normal file
@@ -0,0 +1,149 @@
|
||||
# ITP4513-Assignment (18-19) Internet & Multimedia Application Development
|
||||
|
||||
# Requirements
|
||||
## 1. Design for Dealer (Interface Design: 15 marks; Function: 35 marks)
|
||||
|
||||
### a. Register account into system
|
||||
Managed to create a new dealer account into the system with all necessary information.
|
||||
Required information during registration as below:
|
||||
```
|
||||
1. Dealer’s ID (It should be created by dealer as Primary Key)
|
||||
2. Dealer’s Name
|
||||
3. Phone Number
|
||||
4. Address
|
||||
5. Password
|
||||
```
|
||||
|
||||
### b. Update dealer’s profile
|
||||
Managed to view and update dealer’s information
|
||||
Dealer’s information including:
|
||||
```
|
||||
1. Name
|
||||
2. Address
|
||||
3. Phone Number
|
||||
4. Password
|
||||
```
|
||||
|
||||
### c. Make the orders
|
||||
Managed to make orders into the system with all necessary information
|
||||
```
|
||||
#### View product information
|
||||
List of parts shown on site for dealer to choose (show the parts when status is “Available” and the stock quantity should be greater than zero)
|
||||
#### The parts should include 2 stock status:
|
||||
1. “Available”: Show only the available parts.
|
||||
2. “Unavailable”: The parts are unavailable.
|
||||
|
||||
|
||||
#### Required information for creating an order
|
||||
1. Delivery Address:
|
||||
- The address default as it registered.
|
||||
2. Part Name & Quantity:
|
||||
- Being able to order more than one parts in the same order.
|
||||
- Order quantity cannot be greater than the stock quantity in Part table
|
||||
<br>
|
||||
*orderID should be generate automatically by the system as Primary Key
|
||||
```
|
||||
|
||||
### d. View & update order records
|
||||
Managed to view the orders with necessary information
|
||||
```
|
||||
#### Required information for viewing the orders
|
||||
1. Order ID
|
||||
2. Address
|
||||
- Dealer address (Default) /New delivery address
|
||||
3. Order Date
|
||||
4. Part Number
|
||||
5. Part name
|
||||
6. Quantity
|
||||
7. Status
|
||||
8. Total Price
|
||||
,etc.
|
||||
|
||||
|
||||
#### The site should include 4 statuses:
|
||||
1. “In processing”: The order was made
|
||||
2. “Delivery”: The parts are delivering to the dealer
|
||||
3. “Completed”: The dealer received the parts ordered
|
||||
4. “Canceled”: The order is canceled by administrator
|
||||
|
||||
|
||||
#### Required functions:
|
||||
1. Being able to cancel the order even if the status is “In processing” stage
|
||||
- Records should be able to delete from the database
|
||||
2. Being able to make Confirmation when all parts are received by dealer
|
||||
- e.g. Click buttons to confirm completed orders
|
||||
- Order status should be able to change from “Delivery” to “Completed”
|
||||
```
|
||||
|
||||
|
||||
## 2. Design for Administrator (Interface Design: 15 marks; Function: 35 marks)
|
||||
|
||||
### a. Login to system
|
||||
Managed to login into the system with all necessary information.
|
||||
Required information during login
|
||||
```
|
||||
1. Email
|
||||
2. Password
|
||||
```
|
||||
|
||||
### b. View and edit parts’ information
|
||||
Managed to create a page contain the list of parts
|
||||
|
||||
```
|
||||
#### Required part information:
|
||||
1. Part Number
|
||||
2. Part Name
|
||||
3. Stock Quantity
|
||||
4. Stock Price
|
||||
5. Display the email of the administrator who did the latest editing
|
||||
,etc.
|
||||
*partNumber should be generate automatically by the system as Primary Key.
|
||||
|
||||
|
||||
#### Required functions:
|
||||
- Create an “edit” button to make change of stock quantity and stock price
|
||||
- Administrator can add in new parts /remove the parts (change
|
||||
the stock status from “Available” to “Unavailable”)
|
||||
- The latest modified email will be stored in Part table when the related administrator
|
||||
add/update the part record
|
||||
```
|
||||
|
||||
|
||||
### c. Manage order
|
||||
Managed to view the order with necessary information.
|
||||
```
|
||||
#### Required information for order page
|
||||
1. Order ID
|
||||
2. Dealer ID
|
||||
3. Dealer Name
|
||||
4. Order Date
|
||||
5. Address
|
||||
6. Part Number
|
||||
7. Quantity
|
||||
8. Total Price
|
||||
,etc.
|
||||
|
||||
#### Required Functions:
|
||||
- Deliver the parts when they are ready to deliver.
|
||||
-> Change the order status from “In Processing” to “Delivery”
|
||||
- -> Deduct the quantity of delivered part from Part table
|
||||
- Only dealer can change the “Delivery” stage to “Completed” stage, after they receive the
|
||||
goods
|
||||
#### Required functions:
|
||||
- Being able to cancel order if the dealer wish to
|
||||
-> Change the order status to “Canceled”
|
||||
```
|
||||
|
||||
# Additional requirements
|
||||
```
|
||||
a. Your web site should only use PHP as the server-side programming language (i.e. not ASP, ASP.NET, JSP, servlet etc.), however, you may use JavaScript and CSS for specific purposes. The database server used must be mySQL (version 5.0 or above).
|
||||
|
||||
b. In your PHP code, you must ensure to use the following parameter values for the following mySQL
|
||||
database functions :
|
||||
$conn = mysqli_connect($hostname, $username, $password, $database);
|
||||
set to the values below in a PHP script which is shared by the web pages :
|
||||
$hostname = "127.0.0.1";
|
||||
$database = "projectDB";
|
||||
$username = "root";
|
||||
$password = "";
|
||||
```
|
30
_resources/it114105/itp4513/Assignment/18-19/Register.php
Normal file
30
_resources/it114105/itp4513/Assignment/18-19/Register.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
if($_POST["Cpassword"]==$_POST["password"]){
|
||||
require_once("ini/conn.php");
|
||||
$sql = "SELECT dealerID FROM dealer WHERE dealerID='$_POST[dealerID]'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_num_rows($result)>0)
|
||||
header("location: index.php?regRe=FALSE");
|
||||
else{
|
||||
extract($_POST);
|
||||
$sql = "INSERT INTO dealer VALUES('$dealerID','$password','$dealerName','$phoneNo','$Address')";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)==1){
|
||||
mysqli_free_result($result);
|
||||
mysqli_close();
|
||||
header("location: index.php?Register=TRUE");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
header("location: index.php?regPwd=FALSE");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
176
_resources/it114105/itp4513/Assignment/18-19/ViewOrderAdmin.php
Normal file
176
_resources/it114105/itp4513/Assignment/18-19/ViewOrderAdmin.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["AdminName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("AdminName",$_COOKIE["AdminName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Order</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Login System</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo $_COOKIE["AdminName"]?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="adminOrder.php">View Order</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="stock.php">View Part</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Sales Order > <a href="adminOrder.php">View Order</a> > Order#</div>
|
||||
<?php
|
||||
if(isset($_GET["orderID"])&&isset($_GET["Cancel"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Cancel Order#$_GET[orderID] successful!</div>";
|
||||
elseif(isset($_GET["Cancel"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Cancel Order Unsuccessful!</div>';
|
||||
elseif(isset($_GET["orderID"])&&isset($_GET["Delivery"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Order#$_GET[orderID] Status change to Delivery</div>";
|
||||
elseif(isset($_GET["DeliveryError"]) && isset($_GET["orderID"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Order#$_GET[orderID] Status is not In Processing</div>';
|
||||
elseif(isset($_GET["DeliveryError"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Cannot Change the order status to Delivery</div>';
|
||||
?>
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px;">
|
||||
<?php
|
||||
$sql = "SELECT dealer.name, dealer.phoneNumber, orders.* FROM orders, dealer WHERE dealer.dealerID=orders.dealerID AND dealer.dealerID='$_GET[DealerName]' AND orderID='$_GET[orderID]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$record["status"] = "In Processing";
|
||||
$button = "<a href='adminToDelivery.php?orderID=$_GET[orderID]'>
|
||||
<button type='button' class='btn btn-primary'><i class='fas fa-truck'></i></button>
|
||||
</a><a href='adminOrderCancel.php?orderID=$_GET[orderID]'>
|
||||
<button type='button' class='btn btn-outline-danger'><i class='fas fa-trash'></i> Delete</button>
|
||||
</a>";
|
||||
break;
|
||||
case 2:
|
||||
$record["status"] = "Delivery";
|
||||
$button = "<a href='adminOrderCancel.php?orderID=$_GET[orderID]'>
|
||||
<button type='button' class='btn btn-outline-danger'><i class='fas fa-trash'></i> Delete</button>
|
||||
</a>";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
$button = "<a href='adminOrderCancel.php?orderID=$_GET[orderID]'>
|
||||
<button type='button' class='btn btn-outline-danger'><i class='fas fa-trash'></i> Delete</button>
|
||||
</a>";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
$button="";
|
||||
}
|
||||
|
||||
printf('
|
||||
<div class="float-left">
|
||||
<h1>OrderID# %s</h1>
|
||||
<label id="pName">Name: %s</label><br>
|
||||
<label id="pAddress">Delivery Address: %s</label><br>
|
||||
<label id="pPhone">Phone Number: %s</label><br>
|
||||
<label id="pdate">Date: %s</label><br>
|
||||
<label id="pstatus">Status: %s</label>
|
||||
</div>
|
||||
<div class="float-right">%s</div>
|
||||
',$_GET["orderID"],$record["name"],$record["deliveryAddress"],$record["phoneNumber"],$record["orderDate"],$record["status"],$button);
|
||||
?>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Part #</th>
|
||||
<th scope="col">Part Name</th>
|
||||
<th scope="col">Quantity</th>
|
||||
<th scope="col">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql="SELECT part.*, orderpart.* FROM part, orderpart WHERE orderpart.partNumber=part.partNumber AND orderID='$_GET[orderID]'";
|
||||
$rs = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$totalPrice=0;
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
$totalPrice +=$rc["price"];
|
||||
printf('<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>
|
||||
',$rc["partNumber"],$rc["partName"],$rc["quantity"],$rc["price"]);}
|
||||
printf('<tr>
|
||||
<td colspan="3" align="right">Total Price</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>',$totalPrice);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="viewOrder.php">
|
||||
<button type="button" class="btn btn-dark"><i class="fas fa-arrow-left"></i> Cancel</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
69
_resources/it114105/itp4513/Assignment/18-19/addOrder.php
Normal file
69
_resources/it114105/itp4513/Assignment/18-19/addOrder.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require_once('ini/conn.php');
|
||||
|
||||
$name = $_POST["DealerName"];
|
||||
$addr = $_POST["Address"];
|
||||
$phone = $_POST["phone"];
|
||||
$countFaild = 0;
|
||||
if(strlen(trim($name))>0&strlen(trim($addr))>0&strlen(trim($phone))>0){
|
||||
foreach($_POST as $key => $value){
|
||||
if($key!="DealerName" && $key!="Address" && $key!="phone"){
|
||||
if($value>0){
|
||||
$sesTitle = "";
|
||||
$sesTitle =$name.substr($key,8);
|
||||
$orderPart[$sesTitle] = $value;
|
||||
}else
|
||||
$countFaild++;
|
||||
}
|
||||
}
|
||||
$sql = "SELECT count(*) as count FROM part";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
|
||||
if($record["count"]==($countFaild)){
|
||||
header("location:createOrder.php?NotQty=0");
|
||||
}else{
|
||||
$sql = "SELECT dealerID FROM dealer WHERE name='$name'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
$getToday=date("Y-m-d H:i:s");
|
||||
|
||||
$sql = "INSERT INTO orders(dealerID, orderDate,deliveryAddress,status) VALUES('$record[dealerID]','$getToday','$addr',1)";
|
||||
$re = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
|
||||
$insertID = mysqli_insert_id($conn);
|
||||
|
||||
foreach($orderPart as $key => $value){
|
||||
$partNo = substr($key,strlen($name));
|
||||
$getPricesql = "SELECT stockPrice FROM part WHERE partNumber='$partNo'";
|
||||
$getPricesqlrs = mysqli_query($conn, $getPricesql) or die(mysqli_error($conn));
|
||||
$getPricesqlrc = mysqli_fetch_assoc($getPricesqlrs);
|
||||
$price = $getPricesqlrc["stockPrice"] * $value;
|
||||
|
||||
$sql = "INSERT INTO orderpart VALUES('$insertID','$partNo','$value','$price')";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
if(mysqli_affected_rows($conn)>0)
|
||||
|
||||
header("location:confirmOrder.php?orderID=$insertID");
|
||||
else
|
||||
header("location:createOrder.php?createOrder=FALSE");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
187
_resources/it114105/itp4513/Assignment/18-19/adminOrder.php
Normal file
187
_resources/it114105/itp4513/Assignment/18-19/adminOrder.php
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
|
||||
<?php
|
||||
if(!isset($_COOKIE["AdminName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("AdminName",$_COOKIE["AdminName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>View Order</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo $_COOKIE["AdminName"]?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#" data-toggle="collapse" aria-expanded="false">View Order</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="stock.php">View Part</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">View Order</div>
|
||||
<?php
|
||||
if(isset($_GET["Delivery"])&&isset($_GET["orderID"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Change the Order# $_GET[orderID] status is delivery</div>";
|
||||
else if(isset($_GET["error"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Change the order status unsuccessful</div>';
|
||||
else if(isset($_GET["DeliveryError"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Order #'.$_GET['orderID'].'Status is not In Processing</div>';
|
||||
else if(isset($_GET["Cancel"])&&isset($_GET["orderID"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Order# $_GET[orderID] Canceled</div>";
|
||||
else if(isset($_GET["Cancelerror"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Cancel Order is unsuccessful!</div>';
|
||||
?>
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px; min-height: 600px">
|
||||
<div class="float-right">
|
||||
<input type="text" name="search" class="form-control form-control-lg flat-input float-right" style="border: none;width: 250px; font-size: 14px;" onKeyUp="Search()" id="SearchOrder" placeholder="Search...">
|
||||
</div>
|
||||
<table class="table" width="100%" id=OrderTable>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#Order ID</th>
|
||||
<th>Dealer ID</th>
|
||||
<th>Order Date</th>
|
||||
<th>Total Price</th>
|
||||
<th>Order Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
require_once('ini/conn.php');
|
||||
$sql = "SELECT orderpart.orderID, dealerID, orderDate, deliveryAddress, SUM(price) AS TotalPrice, status FROM orderpart, orders WHERE orders.orderID=orderpart.orderID GROUP BY orderpart.orderID ORDER BY orderpart.orderID DESC";
|
||||
$rs = mysqli_query($conn, $sql);
|
||||
while($record = mysqli_fetch_assoc($rs)){
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$record["status"] = "In Processing";
|
||||
$button = "<a href='adminToDelivery.php?orderID=$record[orderID]'>
|
||||
<button type='button' class='btn btn-primary'><i class='fas fa-truck'></i></button>
|
||||
</a><a href='adminOrderCancel.php?orderID=$record[orderID]'>
|
||||
<button type='button' class='btn btn-danger'><i class='fas fa-trash'></i></button>
|
||||
</a>";
|
||||
break;
|
||||
case 2:
|
||||
$record["status"] = "Delivery";
|
||||
$button = "<a href='adminOrderCancel.php?orderID=$record[orderID]'>
|
||||
<button type='button' class='btn btn-danger'><i class='fas fa-trash'></i></button>
|
||||
</a>";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
$button = "<a href='adminOrderCancel.php?orderID=$record[orderID]'>
|
||||
<button type='button' class='btn btn-danger'><i class='fas fa-trash'></i></button>
|
||||
</a>";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
$button="";
|
||||
break;
|
||||
}
|
||||
printf("<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td><a href='ViewOrderAdmin.php?orderID=%s&DealerName=%s'>
|
||||
<button type='button' class='btn btn-secondary'><i class='fas fa-eye'></i></button>
|
||||
</a>%s
|
||||
|
||||
</td></tr>", $record['orderID'], $record['dealerID'], $record['orderDate'], $record['TotalPrice'], $record["status"], $record['orderID'],$record['dealerID'], $button);
|
||||
}
|
||||
echo '</table></form>';
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function Search() {
|
||||
var input = document.getElementById("SearchOrder");
|
||||
input = input.value.toUpperCase();
|
||||
var table = document.getElementById("OrderTable");
|
||||
var tr = table.getElementsByTagName("tr");
|
||||
for (var i = 0; i < tr.length; i++) {
|
||||
var td = tr[i].getElementsByTagName("td")[0];
|
||||
var td1 = tr[i].getElementsByTagName("td")[1];
|
||||
if (td && td1) {
|
||||
var txtValue = td.innerText;
|
||||
var txtValue2 = td1.innerText;
|
||||
if (txtValue.toUpperCase().indexOf(input) == 0 || txtValue2.toUpperCase().indexOf(input) == 0) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -0,0 +1,14 @@
|
||||
|
||||
<?php
|
||||
if(isset($_GET["orderID"])){
|
||||
require_once('ini/conn.php');
|
||||
$sql = "UPDATE orders set status=0 WHERE orderID='$_GET[orderID]'";
|
||||
mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn) > 0)
|
||||
header("location:adminOrder.php?orderID=$_GET[orderID]&Cancel=true");
|
||||
else
|
||||
header("location:adminOrder.php?Cancelerror=false");
|
||||
}else{
|
||||
header("location:adminOrder.php?Cancelerror=false");
|
||||
}
|
||||
?>
|
@@ -0,0 +1,30 @@
|
||||
|
||||
<?php
|
||||
if(isset($_GET["orderID"])){
|
||||
require_once('ini/conn.php');
|
||||
$orderID = $_GET['orderID'];
|
||||
$sql = "SELECT status FROM orders WHERE orderID='$orderID'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
if($record['status']==1){
|
||||
$sql = "UPDATE orders SET status=2 WHERE orderID=$orderID";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)>0){
|
||||
$sql = "SELECT * FROM orderpart WHERE orderID='$orderID'";
|
||||
$rs = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
$sql = "UPDATE part SET stockQuantity=stockQuantity-$rc[quantity] WHERE partNumber='$rc[partNumber]'";
|
||||
$result =mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
header("location:adminOrder.php?orderID=$orderID&Delivery=TRUE");
|
||||
}else{
|
||||
header("location:adminOrder.php?DeliveryError");
|
||||
}
|
||||
}else{
|
||||
header("location:adminOrder.php?DeliveryError=FALSE&orderID=$orderID");
|
||||
}
|
||||
}else{
|
||||
header("location:adminOrder.php?DeliveryError");
|
||||
}
|
||||
?>
|
185
_resources/it114105/itp4513/Assignment/18-19/confirmOrder.php
Normal file
185
_resources/it114105/itp4513/Assignment/18-19/confirmOrder.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8">
|
||||
<title>Confirm Order</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
<script src="js/jquery.easing.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo "$_COOKIE[DealerName]" ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="createOrder.php">Create Order</a></li>
|
||||
<li><a href="viewOrder.php">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="dealerSetting.php">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
|
||||
|
||||
<!-- MultiStep Form -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Sales Order > Create Order</div>
|
||||
<?php if(isset($_GET["orderID"]))
|
||||
echo '<div class="alert alert-success" style="margin: 20px 3%;" role="alert">Creare Order #'."$_GET[orderID]".' successful.</div>';
|
||||
else
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Create Order Unsucessful.</div>';
|
||||
?>
|
||||
<div id="msform">
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%; padding: 5%; height: 150px;">
|
||||
<ul id="progressbar" style="padding: 20px;">
|
||||
<li class="active">Dealer Information</li>
|
||||
<li class="active">Create Order</li>
|
||||
<li class="active">Confirm Order</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- fieldsets -->
|
||||
<form method="get" id="creatOrderForm" action="createOrder.php">
|
||||
<fieldset form="creatOrderForm" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">
|
||||
<h2 class="fs-title">Confirm Order</h2>
|
||||
<h3 class="fs-subtitle">Order Details</h3>
|
||||
<p align="left">
|
||||
<?php
|
||||
$sql = "SELECT dealer.name, dealer.phoneNumber, orders.* FROM orders, dealer WHERE dealer.dealerID=orders.dealerID AND dealer.dealerID='$_COOKIE[DealerName]' AND orderID='$_GET[orderID]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$record["status"] = "In processing";
|
||||
break;
|
||||
case 2:
|
||||
$record["status"] = "Delivery";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
break;
|
||||
}
|
||||
|
||||
printf('
|
||||
<label id="pOrderID">OrderID: %s</label><br>
|
||||
<label id="pName">Name: %s</label><br>
|
||||
<label id="pAddress">Delivery Address: %s</label><br>
|
||||
<label id="pPhone">Phone Number: %s</label><br>
|
||||
<label id="pdate">Date: %s</label><br>
|
||||
<label id="pstatus">Status: %s</label>
|
||||
',$_GET["orderID"],$record["name"],$record["deliveryAddress"],$record["phoneNumber"],$record["orderDate"],$record["status"]);
|
||||
|
||||
|
||||
|
||||
|
||||
echo '</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">PartName</th>
|
||||
<th scope="col">Price</th>
|
||||
<th scope="col">OrderQty</th>
|
||||
<th scope="col">Total($)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
$sql="SELECT part.*, orderpart.* FROM part, orderpart WHERE orderpart.partNumber=part.partNumber AND orderID='$_GET[orderID]'";
|
||||
$rs = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$totalPrice=0;
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
$totalPrice +=$rc["price"];
|
||||
printf('
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%.2f</td>
|
||||
|
||||
<td>
|
||||
<input type="number" min="0" step="1" value="%d" style="width: 50%%; height: 30px" readonly/>
|
||||
</td>
|
||||
<td>%.2f</td>
|
||||
</tr>',$rc["partNumber"],$rc["partName"],$rc["stockPrice"],$rc["quantity"],$rc["price"]);
|
||||
}
|
||||
|
||||
printf("<tr>
|
||||
<td colspan='4' align='right'>Total Price</td>
|
||||
<td>\$ %.2f</td>
|
||||
</tr>",$totalPrice);
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="viewOrder.php"><input type="button" name="submit" class="action-button" value="View all Order" style="margin-top: 100px"/></a>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<!-- link to designify.me code snippets -->
|
||||
|
||||
<!-- /.link to designify.me code snippets -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
209
_resources/it114105/itp4513/Assignment/18-19/createOrder.php
Normal file
209
_resources/it114105/itp4513/Assignment/18-19/createOrder.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8">
|
||||
<title>Create Order</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
<script src="js/jquery.easing.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo "$_COOKIE[DealerName]" ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="#">Create Order</a></li>
|
||||
<li><a href="viewOrder.php">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="dealerSetting.php">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<script>
|
||||
function Search() {
|
||||
var input = document.getElementById("SearchPart");
|
||||
input = input.value.toUpperCase();
|
||||
var table = document.getElementById("OrderTable");
|
||||
var tr = table.getElementsByTagName("tr");
|
||||
for (var i = 0; i < tr.length; i++) {
|
||||
var td = tr[i].getElementsByTagName("td")[0];
|
||||
var td1 = tr[i].getElementsByTagName("td")[1];
|
||||
if (td && td1) {
|
||||
var txtValue = td.innerText;
|
||||
var txtValue2 = td1.innerText;
|
||||
if (txtValue.toUpperCase().indexOf(input) == 0 || txtValue2.toUpperCase().indexOf(input) == 0) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- MultiStep Form -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Sales Order > Create Order</div>
|
||||
<?php
|
||||
if(isset($_GET["NotQty"])){
|
||||
echo '<div class="alert alert-danger" style="margin: 20px 3%;" role="alert">You should buy a least one Product</div>';
|
||||
}
|
||||
?>
|
||||
<div id="msform">
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%; padding: 5%; height: 150px;">
|
||||
<ul id="progressbar" style="padding: 20px;" >
|
||||
<li class="active">Dealer Information</li>
|
||||
<li>Create Order</li>
|
||||
<li>Confirm Order</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- fieldsets -->
|
||||
<form method="POST" id="creatOrderForm" action="addOrder.php">
|
||||
|
||||
<fieldset form="creatOrderForm" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">
|
||||
|
||||
<h2 class="fs-title">Dealer Information</h2>
|
||||
<?php
|
||||
$sql="SELECT name, phoneNumber, address FROM dealer WHERE dealerID='$_COOKIE[DealerName]'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
printf('
|
||||
<label class=float-left>Name:</label> <input type="text" name="DealerName" placeholder="Name" id="DealerName" value="%s" /><br>
|
||||
<label class=float-left>Delivery Address:</label> <input type="text" name="Address" value="%s" placeholder="Delivery Address" id="Address" /><br>
|
||||
<label class=float-left>Phone Number:</label> <input type="text" name="phone" value="%s" placeholder="Phone Number" id="Phone" />
|
||||
',$record['name'], $record['address'], $record['phoneNumber']);
|
||||
?>
|
||||
<input type="button" name="next" class="next action-button" value="Next" onClick="saveInf()"/>
|
||||
</fieldset>
|
||||
<fieldset form="creatOrderForm" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">
|
||||
<h2 class="fs-title">Create Sales Order</h2>
|
||||
<p align="left">
|
||||
<label id="pName">Name: </label><br>
|
||||
<label id="pAddress">Delivery Address: </label><br>
|
||||
<label id="pPhone">Phone Number:</label>
|
||||
</p>
|
||||
<script>
|
||||
function saveInf(){
|
||||
document.getElementById('pName').innerHTML = "Name : "+ document.getElementById("DealerName").value;
|
||||
document.getElementById('pAddress').innerHTML ="Delivery Address: "+ document.getElementById("Address").value;
|
||||
document.getElementById('pPhone').innerHTML = "Phone Number: "+ document.getElementById("Phone").value;
|
||||
}
|
||||
|
||||
</script>
|
||||
<input type="text" name="search" class="form-control form-control-lg flat-input float-right" style="border: none;width: 250px" onKeyUp="Search()" id="SearchPart" placeholder="Search...">
|
||||
<table class="table" id="OrderTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">PartName</th>
|
||||
<th scope="col">StockQty</th>
|
||||
<th scope="col">Price</th>
|
||||
<th scope="col">OrderQty</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<form method="POST" id="partForm" action="inn/conn.php">
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM part WHERE stockStatus";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_num_rows($result)>0){
|
||||
while($record = mysqli_fetch_assoc($result)){
|
||||
printf('<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%.1f</td>
|
||||
<td>
|
||||
<input type="number" value="0" min="0" step="1" name="orderQty%s" style="width: 50%%; height: 30px" />
|
||||
</td>
|
||||
</tr>',$record["partNumber"], $record["partName"], $record["stockQuantity"],$record["stockPrice"],$record["partNumber"]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</tbody>
|
||||
</table>
|
||||
<nav aria-label="...">
|
||||
<ul class="pagination justify-content-center" style="margin-bottom: 80px;">
|
||||
<li class="page-item active" aria-current="page">
|
||||
<span class="page-link">1<span class="sr-only">(current)</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<input type="button" name="previous" class="previous action-button-previous" value="Previous" />
|
||||
<input type="Submit" name="next" class="action-button" value="Submit" onClick=""/>
|
||||
<input type="hidden" name="next" class="next action-button" value="hifSub"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<!-- link to designify.me code snippets -->
|
||||
|
||||
<!-- /.link to designify.me code snippets -->
|
||||
<script src="js/multiForm.js"></script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
7
_resources/it114105/itp4513/Assignment/18-19/css/bootstrap.min.css
vendored
Normal file
7
_resources/it114105/itp4513/Assignment/18-19/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
5
_resources/it114105/itp4513/Assignment/18-19/css/fontawesome.min.css
vendored
Normal file
5
_resources/it114105/itp4513/Assignment/18-19/css/fontawesome.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
440
_resources/it114105/itp4513/Assignment/18-19/css/style.css
Normal file
440
_resources/it114105/itp4513/Assignment/18-19/css/style.css
Normal file
@@ -0,0 +1,440 @@
|
||||
body{
|
||||
background: #FFF;
|
||||
font-family: "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, "sans-serif";
|
||||
min-width: 680px;
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
line-height: 1.7em;
|
||||
}
|
||||
|
||||
a, a:hover, a:focus {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
padding: 15px 10px;
|
||||
background: #fff;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
margin-bottom: 40px;
|
||||
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.navbar-btn {
|
||||
box-shadow: none;
|
||||
outline: none !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.loginBox{
|
||||
background: #fff;
|
||||
padding: 80px;
|
||||
margin-top: 300px;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
.flat-input{
|
||||
margin-bottom: 40px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #4A4A4A;
|
||||
-webkit-transition: all 0.5s;
|
||||
transition: all 0.5s;
|
||||
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 96%, black 4%);
|
||||
background-position: -800px 0;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.flat-input:focus{
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
background-position: 0 0;
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.btn-login{
|
||||
border-radius: 0;
|
||||
background: #5A5959;
|
||||
color: #fff;
|
||||
-webkit-transition: all 0.8s;
|
||||
transition: all 0.8s;
|
||||
}
|
||||
|
||||
.btn-login:hover{
|
||||
border: 1px solid black;
|
||||
color: white;
|
||||
background: black;
|
||||
}
|
||||
|
||||
body{
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.loginBox{
|
||||
background: #fff;
|
||||
padding: 80px;
|
||||
margin-top: 120px;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
.flat-input{
|
||||
margin-bottom: 40px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #4A4A4A;
|
||||
-webkit-transition: all 0.5s;
|
||||
transition: all 0.5s;
|
||||
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 96%, black 4%);
|
||||
background-position: -800px 0;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.flat-input:focus{
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
background-position: 0 0;
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.btn-login{
|
||||
border-radius: 0;
|
||||
background: #5A5959;
|
||||
color: #fff;
|
||||
-webkit-transition: all 0.8s;
|
||||
transition: all 0.8s;
|
||||
}
|
||||
|
||||
.btn-login:hover{
|
||||
border: 1px solid black;
|
||||
color: white;
|
||||
background: black;
|
||||
}
|
||||
|
||||
|
||||
.navbar {
|
||||
padding: 15px 10px;
|
||||
background: #fff;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
margin-bottom: 40px;
|
||||
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.navbar-btn {
|
||||
box-shadow: none;
|
||||
outline: none !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.navbar-Black{
|
||||
background-color: Black;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------
|
||||
SIDEBAR STYLE
|
||||
----------------------------------------------------- */
|
||||
.wrapper {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
min-width: 250px;
|
||||
max-width: 250px;
|
||||
background: #FFF;
|
||||
transition: all 0.3s;
|
||||
box-shadow: 15px 5px 15px rgba(0, 0, 0, 0.1);
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
#sidebar.active {
|
||||
margin-left: -250px;
|
||||
}
|
||||
|
||||
#sidebar .sidebar-header {
|
||||
width: 100%;
|
||||
color: black;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
#sidebar ul.components {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid #47748b;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#sidebar ul p {
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#sidebar ul li a {
|
||||
padding: 10px;
|
||||
font-size: 1.1em;
|
||||
display: block;
|
||||
}
|
||||
#sidebar ul li a:hover {
|
||||
color: #CCCCCC;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#sidebar ul li.active > a, a[aria-expanded="true"] {
|
||||
color: #fff;
|
||||
background: black;
|
||||
|
||||
}
|
||||
.navHead{
|
||||
width: 100%;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.navTitle{
|
||||
font-size: 16px;
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ul ul a {
|
||||
font-size: 0.9em !important;
|
||||
padding-left: 30px !important;
|
||||
background: #FFF;
|
||||
|
||||
}
|
||||
|
||||
ul.CTAs {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
ul.CTAs a {
|
||||
text-align: center;
|
||||
font-size: 0.9em !important;
|
||||
display: block;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------
|
||||
CONTENT STYLE
|
||||
----------------------------------------------------- */
|
||||
#content {
|
||||
padding: 20px;
|
||||
min-height: 86vh;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.cardLayout{
|
||||
background: white;
|
||||
border: 0 none;
|
||||
border-radius: 0px;
|
||||
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
|
||||
padding: 20px 30px;
|
||||
box-sizing: border-box;
|
||||
width: 95%;
|
||||
margin: 0 3%;
|
||||
padding: 30px;
|
||||
margin-top: -40px;
|
||||
z-index: -999;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------
|
||||
Forms
|
||||
----------------------------------------------------- */
|
||||
/*form styles*/
|
||||
#msform {
|
||||
text-align: center;
|
||||
position: relative;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
#msform fieldset {
|
||||
background: white;
|
||||
border: 0 none;
|
||||
border-radius: 0px;
|
||||
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
|
||||
padding: 20px 30px;
|
||||
box-sizing: border-box;
|
||||
width: 94%;
|
||||
margin: 0 3%;
|
||||
position: relative;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
/*Hide all except first fieldset*/
|
||||
#msform fieldset:not(:first-of-type) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*inputs*/
|
||||
#msform input, #msform textarea {
|
||||
padding: 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0px;
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
font-family: montserrat;
|
||||
color: #2C3E50;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#msform input:focus, #msform textarea:focus {
|
||||
-moz-box-shadow: none !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
box-shadow: none !important;
|
||||
border: 1px solid black;
|
||||
outline-width: 0;
|
||||
transition: All 0.5s ease-in;
|
||||
-webkit-transition: All 0.5s ease-in;
|
||||
-moz-transition: All 0.5s ease-in;
|
||||
-o-transition: All 0.5s ease-in;
|
||||
}
|
||||
|
||||
/*buttons*/
|
||||
#msform .action-button {
|
||||
width: 100px;
|
||||
background: black;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
border: 0 none;
|
||||
border-radius: 25px;
|
||||
cursor: pointer;
|
||||
padding: 10px 5px;
|
||||
margin: 10px 5px;
|
||||
}
|
||||
|
||||
#msform .action-button:hover, #msform .action-button:focus {
|
||||
box-shadow: 0 0 0 2px white, 0 0 0 3px #BEBEBE;
|
||||
}
|
||||
|
||||
#msform .action-button-previous {
|
||||
width: 100px;
|
||||
background: #BEBEBE;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
border: 0 none;
|
||||
border-radius: 25px;
|
||||
cursor: pointer;
|
||||
padding: 10px 5px;
|
||||
margin: 10px 5px;
|
||||
}
|
||||
|
||||
#msform .action-button-previous:hover, #msform .action-button-previous:focus {
|
||||
box-shadow: 0 0 0 2px white, 0 0 0 3px black;
|
||||
}
|
||||
|
||||
/*headings*/
|
||||
.fs-title {
|
||||
font-size: 18px;
|
||||
text-transform: uppercase;
|
||||
color: #2C3E50;
|
||||
margin-bottom: 10px;
|
||||
letter-spacing: 2px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fs-subtitle {
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/*progressbar*/
|
||||
#progressbar {
|
||||
margin-bottom: 30px;
|
||||
overflow: hidden;
|
||||
/*CSS counters to number the steps*/
|
||||
counter-reset: step;
|
||||
|
||||
}
|
||||
|
||||
#progressbar li {
|
||||
list-style-type: none;
|
||||
color: black;
|
||||
text-transform: uppercase;
|
||||
font-size: 9px;
|
||||
width: 33.33%;
|
||||
float: left;
|
||||
position: relative;
|
||||
letter-spacing: 1px;
|
||||
padding-right: 20px;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
#progressbar li:before {
|
||||
content: counter(step);
|
||||
counter-increment: step;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 26px;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
background: black;
|
||||
border-radius: 25px;
|
||||
margin: 0 auto 10px auto;
|
||||
}
|
||||
|
||||
/*progressbar connectors*/
|
||||
#progressbar li:after {
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: #C9C9C9;
|
||||
position: absolute;
|
||||
left: -50%;
|
||||
top: 9px;
|
||||
z-index: -1; /*put it behind the numbers*/
|
||||
}
|
||||
|
||||
#progressbar li:first-child:after {
|
||||
/*connector not needed before the first step*/
|
||||
content: none;
|
||||
}
|
||||
|
||||
/*marking active/completed steps green*/
|
||||
/*The number of the step and the connector before it = green*/
|
||||
#progressbar li.active:before, #progressbar li.active:after {
|
||||
background: black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------
|
||||
MEDIAQUERIES
|
||||
----------------------------------------------------- */
|
||||
@media (max-width: 768px) {
|
||||
#sidebar {
|
||||
margin-left: -250px;
|
||||
}
|
||||
#sidebar.active {
|
||||
margin-left: 0;
|
||||
}
|
||||
#sidebarCollapse span {
|
||||
display: none;
|
||||
}
|
||||
}
|
157
_resources/it114105/itp4513/Assignment/18-19/dealerSetting.php
Normal file
157
_resources/it114105/itp4513/Assignment/18-19/dealerSetting.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8">
|
||||
<title>Setting</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo $_COOKIE["DealerName"] ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="createOrder.php">Create Order</a></li>
|
||||
<li><a href="viewOrder.php">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div class="row">
|
||||
|
||||
<!-- progressbar -->
|
||||
|
||||
<div class="col-md-8 col-sm-12 col-xl-6">
|
||||
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Setting</div>
|
||||
<?php
|
||||
if(isset($_GET["Update"])){
|
||||
if($_GET["Update"])
|
||||
echo '<div class="alert alert-success" style="margin: 20px 3%;" role="alert">Update successful!</div>';
|
||||
else
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Update Fail!</div>';
|
||||
}
|
||||
if(isset($_GET["pwdOld"])){
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;" >Old Password is Wrong!</div>';
|
||||
}
|
||||
if(isset($_GET["pwdNew"])){
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">New Password and Confirm Password is not match !</div>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px;padding: 5%;">
|
||||
<center><h3 style="margin-bottom: 100px">Update Information</h3></center><?php
|
||||
$sql = "SELECT name, address, phoneNumber FROM dealer WHERE dealerID='$_COOKIE[DealerName]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
|
||||
printf('<form method="POST" id="msform" action="updateInf.php?dealerID=%s">
|
||||
<div class="form-group row">
|
||||
<label for="inputName" class="col-sm-2 col-form-label">Name</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputName" value="%s" name="dealerName" placeholder="Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputAddress" class="col-sm-2 col-form-label">Address</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputAddress" name="dealerAddr" value ="%s" placeholder="Address">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="Phone" class="col-sm-2 col-form-label">Phone</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id=“inputPhone” name="phone" value ="%s" placeholder="Phone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputPhone" class="col-sm-2 col-form-label">Old Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" id="inputPhone" name="pwdOld" placeholder="Old Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputPwdNew" class="col-sm-2 col-form-label">New Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" id="inputPwdNew" name="pwdNew" placeholder="New Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputpwdNewConf" class="col-sm-2 col-form-label">Confirm Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" id="pwdNewConf" name="pwdNewConf" placeholder="Confirm Password">
|
||||
</div>
|
||||
</div>
|
||||
',$_COOKIE["DealerName"], $record["name"], $record["address"], $record["phoneNumber"]);
|
||||
?>
|
||||
<button type="submit" class="btn btn-dark btn-lg" style="margin-top: 100px;">Update</button></form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
15
_resources/it114105/itp4513/Assignment/18-19/deleteOrder.php
Normal file
15
_resources/it114105/itp4513/Assignment/18-19/deleteOrder.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
if(isset($_GET["orderID"])){
|
||||
require_once('ini/conn.php');
|
||||
$sql = "DELETE FROM orders WHERE orderID='$_GET[orderID]';DELETE FROM orderpart WHERE orderID='$_GET[orderID]'";
|
||||
$result = mysqli_multi_query($conn,$sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)>0)
|
||||
header("location:viewOrder.php?orderID=$_GET[orderID]&Del=TRUE");
|
||||
else
|
||||
header("location:viewOrder.php?Del=FALSE");
|
||||
}else{
|
||||
header("location:viewOrder.php?Del=FALSE");
|
||||
}
|
||||
|
||||
?>
|
139
_resources/it114105/itp4513/Assignment/18-19/index.php
Normal file
139
_resources/it114105/itp4513/Assignment/18-19/index.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
if(isset($_GET["Logout"])){
|
||||
setcookie("DealerName","",time()-3600);
|
||||
setcookie("AdminName","",time()-3600);
|
||||
}
|
||||
if(isset($_COOKIE["DealerName"])){
|
||||
header("location: viewOrder.php");
|
||||
}
|
||||
if(isset($_COOKIE["AdminName"])){
|
||||
header("location: adminOrder.php");
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Login System</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container" id="Login">
|
||||
<?php if(isset($_GET["Login"])){
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin-top: 20px;">Username or Password Wrong!</div>';
|
||||
}
|
||||
if(isset($_GET["pwd"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin-top: 20px;">Please input Username and Password!</div>';;
|
||||
if(isset($_GET["Register"])){
|
||||
echo '<div class="alert alert-success" role="alert" style="margin-top: 20px;">Registed</div>';
|
||||
}
|
||||
?>
|
||||
<div class="row justify-content-md-center">
|
||||
|
||||
<div class="col-md-5 col-md-auto loginBox">
|
||||
<h1 class="text-center" style="padding-bottom:60px; font-family:serif;">Login</h1>
|
||||
<form method="POST" action="Login.php">
|
||||
<div class="form-row">
|
||||
<div class="col-md-12">
|
||||
<input type="text" name="username" class="form-control form-control-lg flat-input" placeholder="Username">
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input type="password" name="password" class="form-control form-control-lg flat-input" placeholder="Password" style="margin-bottom:15px">
|
||||
<a href="javascript:void(0);" id="btnReg" style="float:right; margin-bottom: 20px; color:black;"><b>Register</b></a>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-lg btn-block btn-login">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container" id="Register">
|
||||
<?php if(isset($_GET["regRe"])){
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin-top: 20px; margin-bottom:-50px">Dealer ID is Signed</div>';
|
||||
}
|
||||
if(isset($_GET["regPwd"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin-top: 20px; margin-bottom:-50px">Password not match</div>';;
|
||||
?>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-6 col-md-auto loginBox" style=" margin-top: 100px;">
|
||||
<h1 class="text-center" style="padding-bottom:60px; font-family:serif;">Register</h1>
|
||||
<form method="POST" action="Register.php">
|
||||
<div class="form-row">
|
||||
<div class="col-md-12">
|
||||
<input type="text" name="dealerID" class="form-control form-control-lg flat-input" placeholder="Dealer ID" required>
|
||||
<input type="text" name="dealerName" class="form-control form-control-lg flat-input" placeholder="Dealer Name" required>
|
||||
<input type="tel" name="phoneNo" class="form-control form-control-lg flat-input" placeholder="Phone Number" required>
|
||||
<textarea type="text" name="Address" rows="2" class="form-control form-control-lg flat-input" placeholder="Address" required></textarea>
|
||||
<input type="password" name="password" class="form-control form-control-lg flat-input" placeholder="Password" required>
|
||||
<input type="password" name="Cpassword" class="form-control form-control-lg flat-input" placeholder="Confirm Password" required>
|
||||
<a href="javascript:changeType();" id="btnLogin" style="float:right; margin-bottom: 20px; color:black;"><b>Login</b></a>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-lg btn-block btn-login">Register</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
<?php if(isset($_GET["regPwd"])|| isset($_GET["regRe"])){
|
||||
echo '$("#Register").show();
|
||||
$("#Login").hide();
|
||||
|
||||
$("#btnReg").click(function() {
|
||||
$("#Login").fadeOut(800, function() {
|
||||
$("#Login").hide();
|
||||
$("#Register").fadeIn(800, function() {
|
||||
$("#Register").show();
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
$("#btnLogin").click(function() {
|
||||
$("#Register").fadeOut(800, function() {
|
||||
$("#Register").hide();
|
||||
$("#Login").fadeIn(800, function() {
|
||||
$("#Login").show();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});';
|
||||
}else{ echo'
|
||||
$("#Register").hide();
|
||||
|
||||
$("#btnReg").click(function() {
|
||||
$("#Login").fadeOut(800, function() {
|
||||
$("#Login").hide();
|
||||
$("#Register").fadeIn(800, function() {
|
||||
$("#Register").show();
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
$("#btnLogin").click(function() {
|
||||
$("#Register").fadeOut(800, function() {
|
||||
$("#Register").hide();
|
||||
$("#Login").fadeIn(800, function() {
|
||||
$("#Login").show();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});';
|
||||
}?>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$hostname = "localhost";
|
||||
$database = "projectDB";
|
||||
$username = "root";
|
||||
$password = "";
|
||||
|
||||
$conn = mysqli_connect($hostname, $username, $password, $database) or die(mysqli_connect_error());
|
||||
?>
|
5
_resources/it114105/itp4513/Assignment/18-19/js/all.min.js
vendored
Normal file
5
_resources/it114105/itp4513/Assignment/18-19/js/all.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
_resources/it114105/itp4513/Assignment/18-19/js/bootstrap.min.js
vendored
Normal file
7
_resources/it114105/itp4513/Assignment/18-19/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
_resources/it114105/itp4513/Assignment/18-19/js/jquery.easing.min.js
vendored
Normal file
1
_resources/it114105/itp4513/Assignment/18-19/js/jquery.easing.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e)}):"object"==typeof module&&"object"==typeof module.exports?exports=n(require("jquery")):n(jQuery)}(function(n){function e(n){var e=7.5625,t=2.75;return n<1/t?e*n*n:n<2/t?e*(n-=1.5/t)*n+.75:n<2.5/t?e*(n-=2.25/t)*n+.9375:e*(n-=2.625/t)*n+.984375}void 0!==n.easing&&(n.easing.jswing=n.easing.swing);var t=Math.pow,u=Math.sqrt,r=Math.sin,i=Math.cos,a=Math.PI,c=1.70158,o=1.525*c,s=2*a/3,f=2*a/4.5;n.extend(n.easing,{def:"easeOutQuad",swing:function(e){return n.easing[n.easing.def](e)},easeInQuad:function(n){return n*n},easeOutQuad:function(n){return 1-(1-n)*(1-n)},easeInOutQuad:function(n){return n<.5?2*n*n:1-t(-2*n+2,2)/2},easeInCubic:function(n){return n*n*n},easeOutCubic:function(n){return 1-t(1-n,3)},easeInOutCubic:function(n){return n<.5?4*n*n*n:1-t(-2*n+2,3)/2},easeInQuart:function(n){return n*n*n*n},easeOutQuart:function(n){return 1-t(1-n,4)},easeInOutQuart:function(n){return n<.5?8*n*n*n*n:1-t(-2*n+2,4)/2},easeInQuint:function(n){return n*n*n*n*n},easeOutQuint:function(n){return 1-t(1-n,5)},easeInOutQuint:function(n){return n<.5?16*n*n*n*n*n:1-t(-2*n+2,5)/2},easeInSine:function(n){return 1-i(n*a/2)},easeOutSine:function(n){return r(n*a/2)},easeInOutSine:function(n){return-(i(a*n)-1)/2},easeInExpo:function(n){return 0===n?0:t(2,10*n-10)},easeOutExpo:function(n){return 1===n?1:1-t(2,-10*n)},easeInOutExpo:function(n){return 0===n?0:1===n?1:n<.5?t(2,20*n-10)/2:(2-t(2,-20*n+10))/2},easeInCirc:function(n){return 1-u(1-t(n,2))},easeOutCirc:function(n){return u(1-t(n-1,2))},easeInOutCirc:function(n){return n<.5?(1-u(1-t(2*n,2)))/2:(u(1-t(-2*n+2,2))+1)/2},easeInElastic:function(n){return 0===n?0:1===n?1:-t(2,10*n-10)*r((10*n-10.75)*s)},easeOutElastic:function(n){return 0===n?0:1===n?1:t(2,-10*n)*r((10*n-.75)*s)+1},easeInOutElastic:function(n){return 0===n?0:1===n?1:n<.5?-(t(2,20*n-10)*r((20*n-11.125)*f))/2:t(2,-20*n+10)*r((20*n-11.125)*f)/2+1},easeInBack:function(n){return(c+1)*n*n*n-c*n*n},easeOutBack:function(n){return 1+(c+1)*t(n-1,3)+c*t(n-1,2)},easeInOutBack:function(n){return n<.5?t(2*n,2)*(7.189819*n-o)/2:(t(2*n-2,2)*((o+1)*(2*n-2)+o)+2)/2},easeInBounce:function(n){return 1-e(1-n)},easeOutBounce:e,easeInOutBounce:function(n){return n<.5?(1-e(1-2*n))/2:(1+e(2*n-1))/2}})});
|
2
_resources/it114105/itp4513/Assignment/18-19/js/jquery.min.js
vendored
Normal file
2
_resources/it114105/itp4513/Assignment/18-19/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
80
_resources/it114105/itp4513/Assignment/18-19/js/multiForm.js
Normal file
80
_resources/it114105/itp4513/Assignment/18-19/js/multiForm.js
Normal file
@@ -0,0 +1,80 @@
|
||||
var current_fs, next_fs, previous_fs; //fieldsets
|
||||
var left, opacity, scale; //fieldset properties which we will animate
|
||||
var animating; //flag to prevent quick multi-click glitches
|
||||
|
||||
$(".next").click(function(){
|
||||
if(animating) return false;
|
||||
animating = true;
|
||||
|
||||
current_fs = $(this).parent();
|
||||
next_fs = $(this).parent().next();
|
||||
|
||||
//activate next step on progressbar using the index of next_fs
|
||||
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
|
||||
|
||||
//show the next fieldset
|
||||
next_fs.show();
|
||||
//hide the current fieldset with style
|
||||
current_fs.animate({opacity: 0}, {
|
||||
step: function(now, mx) {
|
||||
//as the opacity of current_fs reduces to 0 - stored in "now"
|
||||
//1. scale current_fs down to 80%
|
||||
scale = 1 - (1 - now) * 0.2;
|
||||
//2. bring next_fs from the right(50%)
|
||||
left = (now * 50)+"%";
|
||||
//3. increase opacity of next_fs to 1 as it moves in
|
||||
opacity = 1 - now;
|
||||
current_fs.css({
|
||||
'transform': 'scale('+scale+')',
|
||||
'position': 'absolute'
|
||||
});
|
||||
next_fs.css({'left': left, 'opacity': opacity});
|
||||
},
|
||||
duration: 800,
|
||||
complete: function(){
|
||||
current_fs.hide();
|
||||
animating = false;
|
||||
},
|
||||
//this comes from the custom easing plugin
|
||||
easing: 'easeInOutBack'
|
||||
});
|
||||
});
|
||||
|
||||
$(".previous").click(function(){
|
||||
if(animating) return false;
|
||||
animating = true;
|
||||
|
||||
current_fs = $(this).parent();
|
||||
previous_fs = $(this).parent().prev();
|
||||
|
||||
//de-activate current step on progressbar
|
||||
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
|
||||
|
||||
//show the previous fieldset
|
||||
previous_fs.show();
|
||||
//hide the current fieldset with style
|
||||
current_fs.animate({opacity: 0}, {
|
||||
step: function(now, mx) {
|
||||
//as the opacity of current_fs reduces to 0 - stored in "now"
|
||||
//1. scale previous_fs from 80% to 100%
|
||||
scale = 0.8 + (1 - now) * 0.2;
|
||||
//2. take current_fs to the right(50%) - from 0%
|
||||
left = ((1-now) * 50)+"%";
|
||||
//3. increase opacity of previous_fs to 1 as it moves in
|
||||
opacity = 1 - now;
|
||||
current_fs.css({'left': left});
|
||||
previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity});
|
||||
},
|
||||
duration: 800,
|
||||
complete: function(){
|
||||
current_fs.hide();
|
||||
animating = false;
|
||||
},
|
||||
//this comes from the custom easing plugin
|
||||
easing: 'easeInOutBack'
|
||||
});
|
||||
});
|
||||
|
||||
$(".submit").click(function(){
|
||||
return false;
|
||||
})
|
153
_resources/it114105/itp4513/Assignment/18-19/order.php
Normal file
153
_resources/it114105/itp4513/Assignment/18-19/order.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Order</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Login System</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo "$_COOKIE[DealerName]" ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="createOrder.php">Create Order</a></li>
|
||||
<li><a href="viewOrder.php">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="dealerSetting.php">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Sales Order > <a href="viewOrder.php">View Order</a> > Order#<?php echo $_GET["orderID"]?></div>
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px;">
|
||||
<?php
|
||||
$sql = "SELECT dealer.name, dealer.phoneNumber, orders.* FROM orders, dealer WHERE dealer.dealerID=orders.dealerID AND dealer.dealerID='$_COOKIE[DealerName]' AND orderID='$_GET[orderID]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$record["status"] = "In processing";
|
||||
break;
|
||||
case 2:
|
||||
$record["status"] = "Delivery";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
}
|
||||
|
||||
printf('
|
||||
<h1>OrderID# %s</h1>
|
||||
<label id="pName">Name: %s</label><br>
|
||||
<label id="pAddress">Delivery Address: %s</label><br>
|
||||
<label id="pPhone">Phone Number: %s</label><br>
|
||||
<label id="pdate">Date: %s</label><br>
|
||||
<label id="pstatus">Status: %s</label>
|
||||
',$_GET["orderID"],$record["name"],$record["deliveryAddress"],$record["phoneNumber"],$record["orderDate"],$record["status"]);
|
||||
?>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Part #</th>
|
||||
<th scope="col">Part Name</th>
|
||||
<th scope="col">Quantity</th>
|
||||
<th scope="col">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql="SELECT part.*, orderpart.* FROM part, orderpart WHERE orderpart.partNumber=part.partNumber AND orderID='$_GET[orderID]'";
|
||||
$rs = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$totalPrice=0;
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
$totalPrice +=$rc["price"];
|
||||
printf('<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>
|
||||
',$rc["partNumber"],$rc["partName"],$rc["quantity"],$rc["price"]);}
|
||||
printf('<tr>
|
||||
<td colspan="3" align="right">Total Price</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>',$totalPrice);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="viewOrder.php">
|
||||
<button type="button" class="btn btn-dark"><i class="fas fa-arrow-left"></i> Cancel</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
169
_resources/it114105/itp4513/Assignment/18-19/orderAdmin.php
Normal file
169
_resources/it114105/itp4513/Assignment/18-19/orderAdmin.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
$count =0;
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
$count++;
|
||||
if(!isset($_COOKIE["AdminName"]))
|
||||
$count++;
|
||||
if($count==2)
|
||||
header("location: index.php?test=test");
|
||||
else if (!isset($_COOKIE["AdminName"]) && isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php?123");
|
||||
else
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_COOKIE["AdminName"]))
|
||||
setcookie("AdminName",$_COOKIE["AdminName"],time()+60*15);
|
||||
else if (isset($_COOKIE["DealerName"]))
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Order</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Login System</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo "$_COOKIE[DealerName]" ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="createOrder.php">Create Order</a></li>
|
||||
<li><a href="viewOrder.php">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="dealerSetting.php">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="cardLayout" style="padding: 10px 20px;">Sales Order > <a href="viewOrder.php">View Order</a> > Order#</div>
|
||||
<!-- progressbar -->
|
||||
<div class="cardLayout" style="margin-top: 20px; min-height: 600px">
|
||||
<?php
|
||||
$sql = "SELECT dealer.name, dealer.phoneNumber, orders.* FROM orders, dealer WHERE dealer.dealerID=orders.dealerID AND dealer.dealerID='$_COOKIE[DealerName]' AND orderID='$_GET[orderID]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$record["status"] = "In processing";
|
||||
break;
|
||||
case 2:
|
||||
$record["status"] = "Delivery";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
}
|
||||
|
||||
printf('
|
||||
<h1>OrderID# %s</h1>
|
||||
<label id="pName">Name: %s</label><br>
|
||||
<label id="pAddress">Delivery Address: %s</label><br>
|
||||
<label id="pPhone">Phone Number: %s</label><br>
|
||||
<label id="pdate">Date: %s</label><br>
|
||||
<label id="pstatus">Status: %s</label>
|
||||
',$_GET["orderID"],$record["name"],$record["deliveryAddress"],$record["phoneNumber"],$record["orderDate"],$record["status"]);
|
||||
?>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Part #</th>
|
||||
<th scope="col">Part Name</th>
|
||||
<th scope="col">Quantity</th>
|
||||
<th scope="col">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql="SELECT part.*, orderpart.* FROM part, orderpart WHERE orderpart.partNumber=part.partNumber AND orderID='$_GET[orderID]'";
|
||||
$rs = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
$totalPrice=0;
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
$totalPrice +=$rc["price"];
|
||||
printf('<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>
|
||||
',$rc["partNumber"],$rc["partName"],$rc["quantity"],$rc["price"]);}
|
||||
printf('<tr>
|
||||
<td colspan="3" align="right">Total Price</td>
|
||||
<td>$ %.2f</td>
|
||||
</tr>',$totalPrice);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="viewOrder.php">
|
||||
<button type="button" class="btn btn-dark"><i class="fas fa-arrow-left"></i> Cancel</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
261
_resources/it114105/itp4513/Assignment/18-19/stock.php
Normal file
261
_resources/it114105/itp4513/Assignment/18-19/stock.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["AdminName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("AdminName",$_COOKIE["AdminName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>View Part</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
function setValue(partID){
|
||||
var valName = "partName"+partID;
|
||||
var valQty = "stockQty"+partID;
|
||||
var valPrice = "stockPrice"+partID;
|
||||
document.getElementById("partID").value=partID;
|
||||
document.getElementById("partName").value=document.getElementById(valName).innerHTML;
|
||||
document.getElementById("quantity").value=document.getElementById(valQty).innerHTML;
|
||||
document.getElementById("price").value=document.getElementById(valPrice).innerHTML;
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo $_COOKIE["AdminName"]?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="adminOrder.php">View Order</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="stock.php">View Part</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=true">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">View Part
|
||||
<button type="button" class="btn btn-primary float-right" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo" style="margin-top: -8px;"><i class="fas fa-plus"></i> Add</button>
|
||||
</div>
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Add item</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method=post action=stockAdd.php>
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="col-form-label">partName:</label>
|
||||
<input type="text" class="form-control" name="partName" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label">quantity:</label>
|
||||
<input type="text" class="form-control" name="stockQuantity" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label">price:</label>
|
||||
<input type="text" class="form-control" name="stockPrice" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label">stockStatus:</label>
|
||||
<select name="stockStatus" class="custom-select custom-select-sm">
|
||||
<option value="1" selected>Available</option>
|
||||
<option value="0">Unavailable</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="adminEmail" value="<?php echo $_COOKIE["AdminName"];?>">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='submit' class='btn btn-primary' name='addbutton'>Add</button>
|
||||
<button type='button' class='btn btn-secondary' data-dismiss='modal' name='closebutton'>Close</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if(isset($_GET["partID"])&&isset($_GET["update"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Update part #$_GET[partID] Successful!</div>";
|
||||
elseif(isset($_GET["update"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Update part Unsuccessful!</div>';
|
||||
elseif(isset($_GET["partID"])&&isset($_GET["Status"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Update part Status #$_GET[partID] Successful!</div>";
|
||||
elseif(isset($_GET["Status"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Update part Status Unsuccessful!</div>';
|
||||
elseif(isset($_GET["partName"])&&isset($_GET["Add"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Add Part #$_GET[partName] Successful!</div>";
|
||||
elseif(isset($_GET["Add"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Add Part Unsuccessful!</div>';
|
||||
?>
|
||||
<!-- progressbar -->
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px; min-height: 600px">
|
||||
|
||||
<div class="float-right">
|
||||
<input type="text" name="search" class="form-control form-control-lg flat-input float-right" style="border: none;width: 250px; font-size: 14px;" onKeyUp="Search()" id="SearchPart" placeholder="Search...">
|
||||
</div>
|
||||
<table class="table" id="PartTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#partNumber</th>
|
||||
<th scope="col">PartName</th>
|
||||
<th scope="col">email</th>
|
||||
<th scope="col">stockQuantity</th>
|
||||
<th scope="col">stockPrice</th>
|
||||
<th scope="col">stockStatus</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = "Select * FROM part";
|
||||
$rs = mysqli_query($conn, $sql);
|
||||
while($rc = mysqli_fetch_assoc($rs)){
|
||||
if($rc['stockStatus']==0){
|
||||
$status = "UnAvailable";
|
||||
}else{
|
||||
$status = "Available";
|
||||
}
|
||||
printf("<tr>
|
||||
<td id='partNo%1\$s'>%s</td>
|
||||
<td id='partName%1\$s'>%s</td>
|
||||
<td id='email%1\$s'>%s</td>
|
||||
<td id='stockQty%1\$s'>%s</td>
|
||||
<td id='stockPrice%1\$s'>%s</td>
|
||||
<td>%s</td>
|
||||
<td>
|
||||
<button onClick='setValue(%s)' type='button' class='btn btn-secondary' data-toggle='modal' data-target='#editItem' data-whatever='@edit'><i class='fas fa-edit'></i></button>
|
||||
<a href='stokcAvailable.php?partNumber=%s&adminEmail=%s'>
|
||||
<button type='button' class='btn btn-info'><i class='fas fa-exchange-alt'></i></button>
|
||||
</a>
|
||||
</td></tr>",
|
||||
$rc['partNumber'], $rc['partName'], $rc['email'], $rc['stockQuantity'], $rc['stockPrice'], $status,$rc['partNumber'], $rc['partNumber'],$_COOKIE['AdminName']);
|
||||
}
|
||||
echo '</table></form>';
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function Search() {
|
||||
var input = document.getElementById("SearchPart");
|
||||
input = input.value.toUpperCase();
|
||||
var table = document.getElementById("PartTable");
|
||||
var tr = table.getElementsByTagName("tr");
|
||||
for (var i = 0; i < tr.length; i++) {
|
||||
var td = tr[i].getElementsByTagName("td")[0];
|
||||
var td1 = tr[i].getElementsByTagName("td")[1];
|
||||
if (td && td1) {
|
||||
var txtValue = td.innerText;
|
||||
var txtValue2 = td1.innerText;
|
||||
if (txtValue.toUpperCase().indexOf(input) == 0 || txtValue2.toUpperCase().indexOf(input) == 0) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="editItem" tabindex="-1" role="dialog" aria-labelledby="editItemLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Edit Part</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="updateStock.php">
|
||||
<input type="hidden" id="partID" name="partID" value="">
|
||||
<input type="hidden" id="email" name="email" value="<?php echo "$_COOKIE[AdminName]"?>">
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="col-form-label">Part Name:</label>
|
||||
<input id="partName" type="text" class="form-control" name="partName" value="" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label">Quantity:</label>
|
||||
<input id="quantity" type="text" class="form-control" name="stockQuantity" value="">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label">Price:</label>
|
||||
<input id="price" type="text" class="form-control" name="stockPrice" value="">
|
||||
</div>
|
||||
<input type="hidden" name="adminEmail" value="<?php echo $_COOKIE["AdminName"];?>">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
15
_resources/it114105/itp4513/Assignment/18-19/stockAdd.php
Normal file
15
_resources/it114105/itp4513/Assignment/18-19/stockAdd.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if(isset($_POST["partName"])){
|
||||
require_once('ini/conn.php');
|
||||
extract($_POST);
|
||||
$sql = "INSERT INTO part(email,partName,stockQuantity,stockPrice,stockStatus) VALUES ('$adminEmail', '$partName', '$stockQuantity', '$stockPrice', '$stockStatus')";
|
||||
mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn) > 0)
|
||||
header("location:stock.php?partName=$partName&Add=true");
|
||||
else
|
||||
header("location:stock.php?&Add=falseA");
|
||||
}else{
|
||||
header("location:stock.php?&Add=false");
|
||||
}
|
||||
?>
|
||||
|
13
_resources/it114105/itp4513/Assignment/18-19/stockDelete.php
Normal file
13
_resources/it114105/itp4513/Assignment/18-19/stockDelete.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if(isset($_GET[partNumber])){
|
||||
require_once('conn.php');
|
||||
$sql = "DELETE FROM part WHERE partNumber='$_GET[partNumber]'";
|
||||
mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn) > 0)
|
||||
header("location:stock.php?partNumber=$_GET[partNumber]&Delete=ture");
|
||||
else
|
||||
header("location:stock.php?Delete=false");
|
||||
}else{
|
||||
header("location:stock.php?Delete=false");
|
||||
}
|
||||
?>
|
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if(isset($_GET['partNumber'])){
|
||||
require_once('ini/conn.php');
|
||||
$sql = "UPDATE part set stockStatus=!stockStatus, email='$_GET[adminEmail]' WHERE partNumber='$_GET[partNumber]'";
|
||||
mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn) > 0)
|
||||
header("location:stock.php?partID=$_GET[partNumber]&&Status=Changed");
|
||||
else
|
||||
header("location:stock.php?Status=unchange");
|
||||
}else{
|
||||
header("location:stock.php?Status=unchange");
|
||||
}
|
||||
?>
|
32
_resources/it114105/itp4513/Assignment/18-19/updateInf.php
Normal file
32
_resources/it114105/itp4513/Assignment/18-19/updateInf.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if(isset($_POST["dealerName"])){
|
||||
|
||||
require_once('ini/conn.php');
|
||||
$sql = "SELECT password FROM dealer WHERE dealerID='$_GET[dealerID]'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
if($_POST["pwdOld"]!=$record["password"])
|
||||
header("location:dealerSetting.php?pwdOld=FALSE");
|
||||
else if($_POST["pwdNew"]!=$_POST["pwdNewConf"])
|
||||
header("location:dealerSetting.php?pwdNew=FALSE");
|
||||
else{
|
||||
extract($_POST);
|
||||
$sql = "UPDATE dealer SET name='$dealerName', password='$pwdNew', address='$dealerAddr', phoneNumber=$phone WHERE dealerID='$_GET[dealerID]'";
|
||||
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)>0){
|
||||
setcookie("DealerName",$_GET["dealerID"],time()*60*15);
|
||||
header("location:dealerSetting.php?Update=TRUE");
|
||||
}else
|
||||
header("location:dealerSetting.php?Update=FALSE");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
15
_resources/it114105/itp4513/Assignment/18-19/updateStat.php
Normal file
15
_resources/it114105/itp4513/Assignment/18-19/updateStat.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
if(isset($_GET["orderID"])){
|
||||
require_once('ini/conn.php');
|
||||
$sql = "UPDATE orders SET status=3 WHERE orderID='$_GET[orderID]'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)>0){
|
||||
header("location:viewOrder.php?orderID=$_GET[orderID]&Update=TRUE");
|
||||
}else
|
||||
header("location:viewOrder.php?Update=FALSE");
|
||||
}else{
|
||||
header("location:viewOrder.php?Update=FALSE");
|
||||
}
|
||||
|
||||
?>
|
20
_resources/it114105/itp4513/Assignment/18-19/updateStock.php
Normal file
20
_resources/it114105/itp4513/Assignment/18-19/updateStock.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if(isset($_POST["partID"])){
|
||||
extract($_POST);
|
||||
require_once('ini/conn.php');
|
||||
$sql = "UPDATE part SET email='$adminEmail', stockQuantity='$stockQuantity', stockPrice='$stockPrice' WHERE partNumber='$partID'";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
if(mysqli_affected_rows($conn)>0){
|
||||
header("location: stock.php?partID=$partID&update=TRUE");
|
||||
}else{
|
||||
header("location: stock.php?");
|
||||
}
|
||||
}else{
|
||||
header("location: stock.php?update=FALSE");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
184
_resources/it114105/itp4513/Assignment/18-19/viewOrder.php
Normal file
184
_resources/it114105/itp4513/Assignment/18-19/viewOrder.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
if(!isset($_COOKIE["DealerName"]))
|
||||
header("location: index.php");
|
||||
else
|
||||
setcookie("DealerName",$_COOKIE["DealerName"],time()+60*15);
|
||||
require_once("ini/conn.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>View Order</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/all.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="row justify-content-center">
|
||||
<i class="fas fa-user-circle fa-5x"></i>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<h5><?php echo "$_COOKIE[DealerName]" ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled components">
|
||||
<li class="active">
|
||||
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="true">Sales Order</a>
|
||||
<ul class="collapse list-unstyled" id="homeSubmenu">
|
||||
<li><a href="createOrder.php">Create Order</a></li>
|
||||
<li><a href="#">View Order</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="dealerSetting.php">Setting</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs row justify-content-center">
|
||||
<li class="row justify-content-center"><a href="index.php?Logout=TRUE">Log Out</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid" style="padding:0;">
|
||||
<!-- Page Content Holder -->
|
||||
<div class="navHead">
|
||||
<nav class="navbar navbar-Black ">
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-8">
|
||||
<a href="#" id="sidebarCollapse"><i class="fas fa-bars fa-2x" style="color: white"> </i></a>
|
||||
<font size="4" color="white" style="margin-left: 10px;"> Spares Order System</font>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div id="content" style="margin-bottom: 50px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: -20px 3%;">Sales Order > View Order</div>
|
||||
<!-- progressbar -->
|
||||
<?php
|
||||
if(isset($_GET["Del"])&&isset($_GET["orderID"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Delete Order #$_GET[orderID] successful!</div>";
|
||||
elseif(isset($_GET["Del"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Delete Fail!</div>';
|
||||
elseif(isset($_GET["Update"])&&isset($_GET["orderID"]))
|
||||
echo "<div class='alert alert-success' style='margin: 20px 3%;' role='alert'>Order #$_GET[orderID] Completed!</div>";
|
||||
elseif(isset($_GET["Update"]))
|
||||
echo '<div class="alert alert-danger" role="alert" style="margin: 20px 3%;">Update Order Status Unsuccessful!</div>';
|
||||
?>
|
||||
<div class="shadow-sm p-3 mb-5 bg-white rounded" style="margin: 0 3%;margin-top: 20px">
|
||||
<div class="float-right">
|
||||
<input type="text" name="search" class="form-control form-control-lg flat-input float-right" style="border: none;width: 250px; font-size: 14px;" onKeyUp="Search()" id="SearchOrder" placeholder="Search...">
|
||||
</div>
|
||||
<table class="table" id="OrderTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Address</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">OrderDate</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql="SELECT * FROM orders WHERE dealerID='$_COOKIE[DealerName]' ORDER BY orderDate DESC, orderID DESC";
|
||||
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
|
||||
|
||||
while($record = mysqli_fetch_assoc($result)){
|
||||
$button = '<a href="order.php?orderID='.$record["orderID"].'">
|
||||
<button type="button" class="btn btn-secondary"><i class="fas fa-eye"></i></button>
|
||||
</a>';
|
||||
switch($record["status"]){
|
||||
case 1:
|
||||
$button .=' <a href="deleteOrder.php?orderID='.$record["orderID"].'">
|
||||
<button type="button" class="btn btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</a>';
|
||||
$record["status"] = "In processing";
|
||||
break;
|
||||
case 2:
|
||||
$button .= ' <a href="updateStat.php?orderID='.$record["orderID"].'">
|
||||
<button type="button" class="btn btn-success"><i class="fas fa-check"></i></button>
|
||||
</a>';
|
||||
$record["status"] = "Delivery";
|
||||
break;
|
||||
case 3:
|
||||
$record["status"] = "Completed";
|
||||
break;
|
||||
case 0:
|
||||
$record["status"] = "Canceled";
|
||||
}
|
||||
|
||||
printf('
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>
|
||||
%s
|
||||
</td>
|
||||
</tr>',$record["orderID"], $record["deliveryAddress"],$record["status"],$record["orderDate"],$button);
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<nav aria-label="...">
|
||||
<ul class="pagination justify-content-center" style="margin-bottom: 80px;">
|
||||
<li class="page-item active" aria-current="page">
|
||||
<span class="page-link">1
|
||||
<span class="sr-only">(current)</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-Black" style="background-color: Black; margin-bottom: -100px: 0; z-index: 1; padding: 15px; z-index: 9999;">
|
||||
<font color="White">Copyright © 2019 SLMC All Rights Reserved</font>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#sidebarCollapse').on('click', function() {
|
||||
$('#sidebar').toggleClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function Search() {
|
||||
var input = document.getElementById("SearchOrder");
|
||||
input = input.value.toUpperCase();
|
||||
var table = document.getElementById("OrderTable");
|
||||
var tr = table.getElementsByTagName("tr");
|
||||
for (var i = 0; i < tr.length; i++) {
|
||||
var td = tr[i].getElementsByTagName("td")[0];
|
||||
if (td ) {
|
||||
var txtValue = td.innerText;
|
||||
if (txtValue.toUpperCase().indexOf(input) == 0) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user