just progress
This commit is contained in:
parent
5caf2f2f71
commit
a0924eeb38
@ -3,6 +3,7 @@
|
|||||||
class Controller_api_config extends Crunchbutton_Controller_Rest {
|
class Controller_api_config extends Crunchbutton_Controller_Rest {
|
||||||
public function init() {
|
public function init() {
|
||||||
$config = [];
|
$config = [];
|
||||||
|
$config['user'] = c::user()->exports();
|
||||||
echo json_encode($config);
|
echo json_encode($config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ class Crunchbutton_App extends Cana_App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function user() {
|
public function user() {
|
||||||
return $this->_user;
|
return $this->auth()->user();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayPage($page = null) {
|
public function displayPage($page = null) {
|
||||||
|
|||||||
11
include/library/Crunchbutton/Restaurant/DefaultOrder.php
Normal file
11
include/library/Crunchbutton/Restaurant/DefaultOrder.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Crunchbutton_Restaurant_DefaultOrder extends Cana_Table {
|
||||||
|
public function __construct($id = null) {
|
||||||
|
parent::__construct();
|
||||||
|
$this
|
||||||
|
->table('restaurant_default_order')
|
||||||
|
->idVar('id_restaurant_default_order')
|
||||||
|
->load($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,18 @@ class Crunchbutton_User extends Cana_Table {
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function defaults() {
|
||||||
|
return Restaurant_DefaultOrder::q('
|
||||||
|
select * from restaurant_default_order where id_user="'.$this->id_user.'"
|
||||||
|
');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exports() {
|
||||||
|
$out = $this->properties();
|
||||||
|
$out['defaults'] = $this->defaults();
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct($id = null) {
|
public function __construct($id = null) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this
|
$this
|
||||||
|
|||||||
@ -66,7 +66,7 @@ a {
|
|||||||
-webkit-tap-highlight-color: rgba(205,69,29,.5);
|
-webkit-tap-highlight-color: rgba(205,69,29,.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-submitorder, .meal-item, .meal-item-content {
|
.button-bottom, .meal-item, .meal-item-content {
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,8 +279,7 @@ b {
|
|||||||
.cart-button {
|
.cart-button {
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
-webkit-border-radius: 7px;
|
border-radius: 7px;
|
||||||
-moz-border-radius: 7px;
|
|
||||||
background: #d74924;
|
background: #d74924;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
float: left;
|
float: left;
|
||||||
@ -290,6 +289,8 @@ b {
|
|||||||
.cart-item-name {
|
.cart-item-name {
|
||||||
float: left;
|
float: left;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
@ -320,7 +321,8 @@ b {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-submitorder {
|
.button-bottom {
|
||||||
|
margin-top: 25px;
|
||||||
width: 310px;
|
width: 310px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fb422e), to(#fb2418));
|
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fb422e), to(#fb2418));
|
||||||
@ -343,14 +345,14 @@ b {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-submitorder:hover {
|
.button-bottom:hover {
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 0 12px rgba(255,254,196,.8),
|
inset 0 0 12px rgba(255,254,196,.8),
|
||||||
0px 2px 5px 0px rgba(0, 0, 0, 0.15)
|
0px 2px 5px 0px rgba(0, 0, 0, 0.15)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-submitorder-click {
|
.button-bottom-click {
|
||||||
-webkit-transition-property: box-shadow;
|
-webkit-transition-property: box-shadow;
|
||||||
-webkit-transition-duration: .01s;
|
-webkit-transition-duration: .01s;
|
||||||
-webkit-transition-timing-function: ease-out;
|
-webkit-transition-timing-function: ease-out;
|
||||||
@ -364,7 +366,7 @@ b {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-submitorder-click div {
|
.button-bottom-click div {
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,6 +396,11 @@ b {
|
|||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clearfix:after {
|
||||||
|
clear: both;
|
||||||
|
content:"";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media only screen
|
@media only screen
|
||||||
and (min-device-width : 320px)
|
and (min-device-width : 320px)
|
||||||
|
|||||||
@ -139,8 +139,13 @@ App.page.restaurant = function(id) {
|
|||||||
'<div class="restaurant-pic-wrapper"><div class="restaurant-pic" style="background: url(/assets/images/food/' + App.restaurant.image + ');"></div></div>' +
|
'<div class="restaurant-pic-wrapper"><div class="restaurant-pic" style="background: url(/assets/images/food/' + App.restaurant.image + ');"></div></div>' +
|
||||||
'<div class="restaurant-items"></div>' +
|
'<div class="restaurant-items"></div>' +
|
||||||
'<div class="cart-items"></div>' +
|
'<div class="cart-items"></div>' +
|
||||||
'<div class="cart-total"></div>' +
|
'<div class="cart-total"></div>');
|
||||||
'<button class="button-submitorder"><div>Submit Order</div></button>');
|
|
||||||
|
if (!App.config.user.id_user) {
|
||||||
|
$('.main-content').append('<button class="button-deliver-payment button-bottom"><div>Next</div></button>');
|
||||||
|
} else {
|
||||||
|
$('.main-content').append('<button class="button-submitorder button-bottom"><div>Submit Order</div></button>');
|
||||||
|
}
|
||||||
|
|
||||||
$('.restaurant-items').append(
|
$('.restaurant-items').append(
|
||||||
'<div class="restaurant-item-title">top items</div>' +
|
'<div class="restaurant-item-title">top items</div>' +
|
||||||
@ -250,6 +255,11 @@ App.cart = {
|
|||||||
toppings = {},
|
toppings = {},
|
||||||
substitutions = {};
|
substitutions = {};
|
||||||
|
|
||||||
|
if (arguments[2]) {
|
||||||
|
toppings = arguments[2]['toppings'];
|
||||||
|
substitutions = arguments[2]['substitutions'];
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'Dish':
|
case 'Dish':
|
||||||
|
|
||||||
@ -289,10 +299,11 @@ App.cart = {
|
|||||||
|
|
||||||
var el = $('<div class="cart-item cart-item-dish" data-cart_id="' + id + '" data-cart_type="' + type + '"></div>');
|
var el = $('<div class="cart-item cart-item-dish" data-cart_id="' + id + '" data-cart_type="' + type + '"></div>');
|
||||||
el
|
el
|
||||||
.append('<div class="cart-button">-</div>')
|
.append('<div class="cart-button cart-button-remove">-</div>')
|
||||||
|
.append('<div class="cart-button cart-button-add">+</div>')
|
||||||
.append('<div class="cart-item-name">' + App.cache(type,item).name + '</div>');
|
.append('<div class="cart-item-name">' + App.cache(type,item).name + '</div>');
|
||||||
|
|
||||||
if (type == 'Dish') {
|
if (type == 'Dish' && (App.cached['Dish'][item].toppings().length || App.cached['Dish'][item].substitutions().length)) {
|
||||||
el.append('<div class="cart-item-config"><a href="javascript:;">Customize</a></div>');
|
el.append('<div class="cart-item-config"><a href="javascript:;">Customize</a></div>');
|
||||||
}
|
}
|
||||||
el.append('<div class="divider"></div>');
|
el.append('<div class="divider"></div>');
|
||||||
@ -302,6 +313,16 @@ App.cart = {
|
|||||||
el.fadeIn();
|
el.fadeIn();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
clone: function(item) {
|
||||||
|
var
|
||||||
|
cartid = item.attr('data-cart_id'),
|
||||||
|
cart = App.cart.items.dishes[cartid];
|
||||||
|
|
||||||
|
App.cart.add('Dish',cart.id, {
|
||||||
|
toppings: cart.toppings,
|
||||||
|
substitutions: cart.substitutions
|
||||||
|
});
|
||||||
|
},
|
||||||
remove: function(item) {
|
remove: function(item) {
|
||||||
var
|
var
|
||||||
name,
|
name,
|
||||||
@ -434,10 +455,14 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.cart-button').live('click',function() {
|
$('.cart-button-remove').live('click',function() {
|
||||||
App.cart.remove($(this).closest('.cart-item'));
|
App.cart.remove($(this).closest('.cart-item'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.cart-button-add').live('click',function() {
|
||||||
|
App.cart.clone($(this).closest('.cart-item'));
|
||||||
|
});
|
||||||
|
|
||||||
$('.cart-item-config a').live('click',function() {
|
$('.cart-item-config a').live('click',function() {
|
||||||
App.cart.customize($(this).closest('.cart-item'));
|
App.cart.customize($(this).closest('.cart-item'));
|
||||||
});
|
});
|
||||||
@ -446,20 +471,20 @@ $(function() {
|
|||||||
App.cart.submit();
|
App.cart.submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.button-submitorder').live({
|
$('.button-bottom').live({
|
||||||
mousedown: function() {
|
mousedown: function() {
|
||||||
$(this).addClass('button-submitorder-click');
|
$(this).addClass('button-bottom-click');
|
||||||
},
|
},
|
||||||
touchstart: function() {
|
touchstart: function() {
|
||||||
$(this).addClass('button-submitorder-click');
|
$(this).addClass('button-bottom-click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.button-submitorder').live({
|
$('.button-bottom').live({
|
||||||
mouseup: function() {
|
mouseup: function() {
|
||||||
$(this).removeClass('button-submitorder-click');
|
$(this).removeClass('button-bottom-click');
|
||||||
},
|
},
|
||||||
touchend: function() {
|
touchend: function() {
|
||||||
$(this).removeClass('button-submitorder-click');
|
$(this).removeClass('button-bottom-click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user