Пример #1
0
<?php

/*
	This part of the code for
	1. ajax
	2. check login state
*/
include_once "../Brain/UserControl.php";
include_once "../Brain/Schedule.php";
include_once '../Brain/District.php';
include_once '../Brain/field_const.php';
if (UserControl::getType() != "d") {
    return;
}
$currentDay = date("Y-m-d");
if (isset($_POST[jobNo])) {
    if (isset($_POST[jobDate])) {
        if (editJob($_POST[jobNo], $_POST[jobDate], null)) {
            echo "true";
        } else {
            echo "false";
        }
        return;
    } else {
        if (isset($_POST["getDetail"])) {
            $retTable = '<table name="OrderTable" class="tableSimpleList" width="100%">
						<caption>' . $_POST[jobNo] . ' Details </caption><thead><tr><th>OrderNo</th><th>Address</th></tr></thead>';
            $result = getOrdersByJobNo($_POST[jobNo]);
            if (!isset($result)) {
                echo "No Order assigned";
                return;
Пример #2
0
											<th>Price:</th>
											<td>$' . $p[prodPrice] . '</td>
										</tr>
										<tr>
											<th>Supplier:</th>
											<td>' . $s[suppName] . '</td>
										</tr> ';
    if (UserControl::getType() == 'a') {
        echo '<tr>
											<th>Stock:</th>
											<td>' . $p[stockQty] . '</td>
										</tr>';
    }
    echo '	
									</table> ';
    if (!$outOfStock && (UserControl::getType() == NULL || UserControl::getType() == 'c')) {
        echo '
									<button class="btnAddToChart" rm="';
        if ($cart->isExist($p[prodNo])) {
            echo 'true';
        } else {
            echo 'false';
        }
        echo '" onclick="btnAddCartClicked(this)">';
        if ($cart->isExist($p[prodNo])) {
            echo 'REMOVE FROM CART';
        } else {
            echo 'ADD <input class="qty" type="text" value="1" onclick="event.stopPropagation();"/> TO CART';
        }
        echo '</button>';
    }
Пример #3
0
include_once "Brain/field_const.php";
include_once "Brain/User.php";
include "header1.php";
?>
<link href="css/register.css" rel="stylesheet" type="text/css" />
<script src='js/register.js'> </script>
<?php 
include "Brain/District.php";
include "Brain/UserControl.php";
include "header2.php";
include_once "Brain/ShoppingCart.php";
$cart = new SCart();
if (isset($_GET["error"])) {
    echo "<script> alert('Sorry, we only delivery two day after order.')</script>";
}
if (UserControl::checkState() && UserControl::getType() == 'c') {
    $cust = getCustomer(getInfo(UserControl::getUserNo())[ID]);
    if (isset($_POST[distNo], $_POST[custAddr], $_POST["sdate"])) {
        $date = strtotime($_POST["sdate"]);
        $minday = strtotime(date("Y-m-d", strtotime("+ 2 days")));
        if ($date < $minday) {
            header("Location: checkout.php?error=true");
        } else {
            if ($cart->checkout($_POST["sdate"], "100", $_POST[custAddr], $cust[custNo], $_POST[distNo])) {
                header("Location: shoppingcart.php?sucess=true");
            } else {
                echo "<script> alert('Sorry!');</script>";
            }
        }
    }
    $district = getAllDistricts();
Пример #4
0
				<div><a class="navIcon">Schedule</a></div>
			</div>
			<?php 
}
?>
			<?php 
if (UserControl::getType() == 'c') {
    ?>
			<div class="navTab col-10 col-m-20">
				<div><a class="navIcon"s>Orders</a></div>
			</div>
			<?php 
}
?>
			<?php 
if (UserControl::getType() == 'c') {
    ?>
			<div class="navTab navCart col-10 col-m-20">
				<div>
					<span class="fa fa-2x fa-shopping-cart cartIcon navIcon" onclick="window.location='shoppingCart.php'"></span>
					<div class="cartMenu">
						<ul>
							<?php 
    include_once "Brain/ShoppingCart.php";
    $cart = new SCart();
    $html = SCart::genCartMenuHtml($cart->getProducts());
    echo $html;
    ?>
						</ul>
						<button onclick="window.location='shoppingCart.php'">VIEW CART</button>
					</div>