quick demo commit
This commit is contained in:
parent
082a33f8c3
commit
ac2472aa90
@ -3,7 +3,6 @@
|
|||||||
class Controller_api_v1_login extends Crunchbutton_Controller_Rest {
|
class Controller_api_v1_login extends Crunchbutton_Controller_Rest {
|
||||||
public function init() {
|
public function init() {
|
||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
|
|
||||||
case 'get':
|
case 'get':
|
||||||
$user = Crunchbutton_User::o(c::getPagePiece(2));
|
$user = Crunchbutton_User::o(c::getPagePiece(2));
|
||||||
if (!$file->id_file) {
|
if (!$file->id_file) {
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class Controller_api_v1_note extends Crunchbutton_Controller_Rest {
|
|
||||||
public function init() {
|
|
||||||
switch ($this->method()) {
|
|
||||||
case 'get':
|
|
||||||
$note = Note::o(c::getPagePiece(3));
|
|
||||||
if (!$note->id_note) {
|
|
||||||
echo json_encode(['error' => 'invalid resource']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
echo $note->json();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'post':
|
|
||||||
$note = new Note;
|
|
||||||
$note->serialize($this->request());
|
|
||||||
$note->save();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
23
include/controllers/default/crunchbutton/api/order/index.php
Normal file
23
include/controllers/default/crunchbutton/api/order/index.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Controller_api_order extends Crunchbutton_Controller_Rest {
|
||||||
|
public function init() {
|
||||||
|
switch ($this->method()) {
|
||||||
|
case 'get':
|
||||||
|
$order = Order::o(c::getPagePiece(2));
|
||||||
|
if ($order->id_order) {
|
||||||
|
echo $order->json();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'invalid object']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'post':
|
||||||
|
$order = new Order;
|
||||||
|
$order->serialize($this->request());
|
||||||
|
$order->save();
|
||||||
|
$order->notify();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
class Controller_home extends Cana_Controller {
|
class Controller_home extends Cana_Controller {
|
||||||
public function init() {
|
public function init() {
|
||||||
$r = Restaurant::q('select * from restaurant where active=1');
|
|
||||||
Cana::view()->restaurants = $r;
|
|
||||||
Cana::view()->display('home/index');
|
Cana::view()->display('home/index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,12 +43,41 @@
|
|||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<div class="personal-info">
|
<div class="personal-info field-container">
|
||||||
|
<label>Name</label>
|
||||||
|
<div class="input-item"><input type="text" name="name"></div>
|
||||||
|
|
||||||
|
<label>Phone #</label>
|
||||||
|
<div class="input-item"><input type="text" name="phone"></div>
|
||||||
|
|
||||||
|
<label>Deliver</label>
|
||||||
|
<div class="input-item"><textarea name="deliver"></textarea></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="payment-info field-container">
|
||||||
|
<label>Credit card #</label>
|
||||||
|
<div class="input-item"><input type="text" name="card"></div>
|
||||||
|
|
||||||
|
<label>Expiration</label>
|
||||||
|
<div class="input-item">
|
||||||
|
<select><option>Month</option></select>
|
||||||
|
<select><option>Year</option></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label>Tip</label>
|
||||||
|
<div class="input-item">
|
||||||
|
<select>
|
||||||
|
<option>0%</option>
|
||||||
|
<option>5%</option>
|
||||||
|
<option>10%</option>
|
||||||
|
<option>15%</option>
|
||||||
|
<option>20%</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="payment-info">
|
<br /><br />
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button class="button-submitorder"><div>Submit Order</div></button>
|
<button class="button-submitorder"><div>Submit Order</div></button>
|
||||||
@ -332,6 +332,28 @@ b {
|
|||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
input, textarea, select {
|
||||||
|
overflow: auto;
|
||||||
|
padding: 2px 4px 2px 4px;
|
||||||
|
font-size: 15px;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: normal;
|
||||||
|
font-family: Helvetica;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
height: 2.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media only screen
|
@media only screen
|
||||||
and (min-device-width : 320px)
|
and (min-device-width : 320px)
|
||||||
|
|||||||
@ -74,7 +74,7 @@ App.loadRestaurant = function(id) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
App.page.community = function(id) {
|
App.page.community = function(id) {
|
||||||
App.community = App.cache('Community', id, function() {
|
//App.community = App.cache('Community', id, function() {
|
||||||
|
|
||||||
document.title = 'Crunchbutton - ' + App.community.name;
|
document.title = 'Crunchbutton - ' + App.community.name;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ App.page.community = function(id) {
|
|||||||
|
|
||||||
$('.meal-items').append(restaurant);
|
$('.meal-items').append(restaurant);
|
||||||
}
|
}
|
||||||
});
|
//});
|
||||||
};
|
};
|
||||||
|
|
||||||
App.page.restaurant = function(id) {
|
App.page.restaurant = function(id) {
|
||||||
@ -123,7 +123,7 @@ App.loadPage = function() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
App.page.community('yale');
|
App.page.community(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -178,10 +178,11 @@ App.cart = {
|
|||||||
$('.cart-total').html();
|
$('.cart-total').html();
|
||||||
},
|
},
|
||||||
customize: function(item) {
|
customize: function(item) {
|
||||||
|
alert('nope.');
|
||||||
},
|
},
|
||||||
submit: function() {
|
submit: function() {
|
||||||
console.log(JSON.stringify(App.cart.items));
|
console.log(JSON.stringify(App.cart.items));
|
||||||
|
alert(JSON.stringify(App.cart.items));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -234,7 +235,7 @@ $(function() {
|
|||||||
$(this).removeClass('button-submitorder-click');
|
$(this).removeClass('button-submitorder-click');
|
||||||
});
|
});
|
||||||
|
|
||||||
App.community = App.cache('Community','yale', function() {
|
App.community = App.cache('Community',1, function() {
|
||||||
App.loadPage();
|
App.loadPage();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user