Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Suvink committed Nov 20, 2020
1 parent 2295706 commit eb45933
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 43 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified controllers/customer/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions controllers/customer/DineinLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DineinLoginController extends Controller

public function __construct()
{
require './models/customer/OnlineOrderLoginModel.php';
require './models/customer/DineinLoginModel.php';
$this->DineinLoginModelModel = new DineinLoginModel();
}

Expand All @@ -22,7 +22,7 @@ function submitLogin($token, $otp)
echo $row["phone"];
$_SESSION['user_phone'] = $row["phone"];
echo '<script>alert("wade hari")</script>';
header('Location: /online');
header('Location: /dinein');
} else {
$this->triggerError('Login Failed!');
}
Expand Down
4 changes: 4 additions & 0 deletions css/dineinorderstyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ body {

/* FAB */

.icon{
margin-top: 12px;
}

.popout {
position: absolute;
bottom: 3rem;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<img src="img/logo.png" height="56" width="224" />
</div>
<div class="column is-10 has-text-right nav-buttons">
<a href="/online/signup"><button class="button is-primary">Sign Up</button></a>
<a href="/online/signup"><button class="button is-primary">Staff</button></a>
<a href="/online/login"><button class="button is-primary">Login</button></a>
</div>
</div>
Expand Down
31 changes: 30 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,33 @@ async function registerServiceWorker(){
console.log("Service Worker Registration Failed");
}
}
};
};


let deferredPrompt; // Allows to show the install prompt
const installButton = document.getElementById("install_button");

window.addEventListener("beforeinstallprompt", (e) => {
//TODO
console.log("beforeinstallprompt fired");
e.preventDefault();
deferredPrompt = e;
installButton.hidden = false;
installButton.addEventListener("click", installApp);
});

function installApp() {
deferredPrompt.prompt();
installButton.disabled = true;
deferredPrompt.userChoice.then(choiceResult => {
if (choiceResult.outcome === "accepted") {
console.log("PWA setup accepted");
installButton.hidden = true;
} else {
console.log("PWA setup rejected");
}
installButton.disabled = false;
deferredPrompt = null;
});
}

1 change: 1 addition & 0 deletions manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"start_url": ".",
"display": "standalone",
"background_color": "#fff",
"theme_color":"#f5a540",
"description": "The next generation reataurant maagement system",
"icons": [{
"src": "img/icon-512x512.png",
Expand Down
1 change: 1 addition & 0 deletions serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ self.addEventListener("activate", (e) => {
self.clients.claim();
});


self.addEventListener("fetch", async (event) => {
const req = event.request;
const url = new URL(req.url);
Expand Down
17 changes: 8 additions & 9 deletions views/customer/dinein.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
session_start();
ob_start();


echo $_SESSION['user_phone'];
if(!isset($_SERVER['HTTP_REFERER'])){
header('Location: /dinein/login');
}
Expand Down Expand Up @@ -105,12 +106,8 @@
<div class="column is-4 ml-0 mr-0">
<div class="card">
<h1 class="orange-color mt-0 mb-1">Order Summery</h1>

<form action="">
<div class="menu-selected" id="selected-menu">
</div>
</form>

<div class="menu-selected" id="selected-menu">
</div>
<div class="total-box d-flex">
<div class="title-col">
<h3 class="mt-1 mb-1">Total Amount</h3>
Expand Down Expand Up @@ -191,7 +188,8 @@ function addToOrder(itemId){

function updateCartQty(itemId){
let qtyDiv = 'item-qty-'+itemId;
let itemPriceDiv = 'item-price-'+itemId;
let itemPriceDiv = 'price-'+itemId;
let itemPriceDivCart = 'item-price-'+itemId;
let increasedQty = order[itemId] - document.getElementById(qtyDiv).value;

//TODO
Expand All @@ -207,7 +205,8 @@ function updateCartQty(itemId){
order[itemId] = document.getElementById(qtyDiv).value;
document.getElementById('order-array').value = JSON.stringify(order);


document.getElementById(itemPriceDivCart).innerHTML = 'LKR ' + (order[itemId] * parseInt(document.getElementById(itemPriceDiv).innerHTML.replace(/\D/g,'')))

//TODO
console.log(order);
}
Expand Down
4 changes: 2 additions & 2 deletions views/customer/dineinlogin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./controllers/customer/OnlineOrderLoginController.php";
require_once "./controllers/customer/DineinLoginController.php";

if (isset($_POST['submit'])) {
$token = $_REQUEST['token'];
Expand Down Expand Up @@ -56,7 +56,7 @@
<button class="button is-primary" onclick="sendOTP();">Send OTP</button>
</div>

<form action="/online/login" id="otpDiv" style="display: none" method="POST">
<form action="/dinein/login" id="otpDiv" style="display: none" method="POST">
<label class="field artemis-input-field">
<input class="artemis-input" type="text" placeholder="Your OTP here" name="otp" autocomplete="one-time-code" required>
<span class="label-wrap">
Expand Down
20 changes: 11 additions & 9 deletions views/customer/dineinorder.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

// if(!isset($_SERVER['HTTP_REFERER'])){
// //header('Location: /online/login');
// }
// if(!isset($_SESSION['user_phone'])){
// header('Location: /online/login');
// }
session_start();
ob_start();
echo $_SESSION['user_phone'];
if(!isset($_SERVER['HTTP_REFERER'])){
//header('Location: /online/login');
}
if(!isset($_SESSION['user_phone'])){
header('Location: /online/login');
}

require_once './controllers/customer/DineinOrderController.php';
//Initiate an instance of controller
Expand Down Expand Up @@ -62,7 +64,7 @@
<p class="menu-items">Chicken Ramen x1, Dosai x20, Faluda x2</p>
<h5 class=" ml-0 mb-0 title">Payment</h5>
<div class="mt-1 payment-buttons">
<form action="https://sandbox.payhere.lk/pay/checkout" method="POST">
<form class="mb-0" action="https://sandbox.payhere.lk/pay/checkout" method="POST">
<input type="hidden" name="merchant_id" value="1214666">
<input type="hidden" name="return_url" value="https://eat-me.live/dinein/order">
<input type="hidden" name="cancel_url" value="https://eat-me.live/dinein/order">
Expand Down Expand Up @@ -133,7 +135,7 @@
</div>
<textarea type="text" class="review-input mt-1" id="review-text" rows="3"></textarea>
</div>
<button class="button is-primary" onclick="submitReview();">Submit</button>
<button class="button is-primary mt-1" onclick="submitReview();">Submit</button>
<div class="row has-text-right">
Find More at Trip Advisor <i class="icon fab fa-tripadvisor"></i>
</div>
Expand Down
Empty file removed views/customer/dineinsignup.php
Empty file.
31 changes: 25 additions & 6 deletions views/customer/onlinecustomerprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,18 @@
<hr>
<h5 class=" ml-0 mb-0 title">Order Items</h5>
<p class="menu-items">Chicken Ramen x1, Dosai x20, Faluda x2</p>
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/payhere.png" alt="">
<div class="columns group">
<div class="column is-6 has-text-left">
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/payhere.png" alt="">
</div>
<div class="column is-6 has-text-right">
<h6 class=" ml-0 mb-0 title">Lakshan is on his way!</h6>
<h6 class=" ml-0 mb-0 mt-0 title">+94771655198</h6>
</div>
</div>
</div>

<div class="order-card">
<div class="columns group">
<div class="column is-6">
Expand All @@ -133,8 +142,13 @@
<hr>
<h5 class=" ml-0 mb-0 title">Order Items</h5>
<p class="menu-items">Chicken Ramen x1, Dosai x20, Faluda x2</p>
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/paycash.png" alt="">
<div class="columns group">
<div class="column is-6 has-text-left">
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/paycash.png" alt="">
</div>
<div class="column is-6 has-text-right"></div>
</div>
</div>
<div class="order-card">
<div class="columns group">
Expand All @@ -155,8 +169,13 @@
<hr>
<h5 class=" ml-0 mb-0 title">Order Items</h5>
<p class="menu-items">Chicken Ramen x1, Dosai x20, Faluda x2</p>
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/payhere.png" alt="">
<div class="columns group">
<div class="column is-6 has-text-left">
<h5 class=" ml-0 mb-0 title">Payment</h5>
<img class="payment-option" src="../../img/payhere.png" alt="">
</div>
<div class="column is-6 has-text-right"></div>
</div>
</div>
</div>
</section>
Expand Down
22 changes: 10 additions & 12 deletions views/customer/onlineorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
session_start();
ob_start();

if(!isset($_SERVER['HTTP_REFERER'])){
header('Location: /online/login');
}
if(!isset($_SESSION['user_phone'])){
header('Location: /online/login');
}
// if(!isset($_SERVER['HTTP_REFERER'])){
// header('Location: /online/login');
// }
// if(!isset($_SESSION['user_phone'])){
// header('Location: /online/login');
// }

require_once './controllers/customer/OnlineOrderController.php';
//Initiate an instance of controller
Expand Down Expand Up @@ -105,12 +105,8 @@
<div class="column is-4 ml-0 mr-0">
<div class="card">
<h1 class="orange-color mt-0 mb-1">Order Summery</h1>

<form action="">
<div class="menu-selected" id="selected-menu">
</div>
</form>

<div class="total-box d-flex">
<div class="title-col">
<h3 class="mt-1 mb-1">Total Amount</h3>
Expand Down Expand Up @@ -191,7 +187,8 @@ function addToOrder(itemId){

function updateCartQty(itemId){
let qtyDiv = 'item-qty-'+itemId;
let itemPriceDiv = 'item-price-'+itemId;
let itemPriceDiv = 'price-'+itemId;
let itemPriceDivCart = 'item-price-'+itemId;
let increasedQty = order[itemId] - document.getElementById(qtyDiv).value;

//TODO
Expand All @@ -207,7 +204,8 @@ function updateCartQty(itemId){
order[itemId] = document.getElementById(qtyDiv).value;
document.getElementById('order-array').value = JSON.stringify(order);


document.getElementById(itemPriceDivCart).innerHTML = 'LKR ' + (order[itemId] * parseInt(document.getElementById(itemPriceDiv).innerHTML.replace(/\D/g,'')))

//TODO
console.log(order);
}
Expand Down
2 changes: 1 addition & 1 deletion views/customer/onlineordersummery.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</div>
<div class="total-box d-flex nobottom">
<div class="title-col">
<h3 class="mt-0 mb-1">Delivery Charges:</h3>
<h3 class="mt-0 mb-1">Delivery Fee:</h3>
</div>
<div class="price-col mr-1">
<h3 class="mt-0 mb-1 has-text-right">100.00</h3>
Expand Down

0 comments on commit eb45933

Please sign in to comment.