fixed #681, ability to deactivate a menu item

This commit is contained in:
Stuardo Rodríguez 2013-02-06 15:21:41 -05:00
parent d870fdd35b
commit 1ae2a98788
4 changed files with 10 additions and 4 deletions

View File

@ -98,8 +98,8 @@ class Crunchbutton_Restaurant extends Cana_Table {
foreach ($newDishes as $dish) {
$dishO = new Dish($dish['id_dish']);
$dishO->active = 1;
$dishO->id_restaurant = $this->id_restaurant;
$dishO->active = isset($dish['active']) ? $dish['active'] : 1;
$dishO->name = $dish['name'];
$dishO->description = $dish['description'];
$dishO->price = $dish['price'];

View File

@ -49,7 +49,7 @@ input.notification {width: 400px;}
/* space between the category switcher and the dish name input */
.admin-food-item-content-padding > label {
float: left;
margin: 10px 0;
clear: both;
}
/* space between label and select */

View File

@ -510,13 +510,15 @@ th {
}
.dish-price {
width: 85px;
width: 70px;
float: right;
}
.dish-price input {
width: 65px;
width: 50px;
margin-left: .5em;
text-align: right;
}
.dish-name {

View File

@ -286,6 +286,7 @@ function saveDishes (complete) {
description: values['dish-description'],
price: values['dish-price'],
id_category: values['dish-id_category'],
active: values['dish-active'],
};
if (id) {
@ -574,10 +575,13 @@ App.showDish = function(dishItem) {
categoryOptions += '<option value="' + categories[i].id_category+ '" ' + selected + '>' + categories[i].name+ '</option>';
}
var active = (parseInt(dishItem.active)) ? 'checked="checked"' : '';
padding
.append('<input type="text" placeholder="Name" name="dish-name" class="dataset-dish clean-input dish-name" value="' + dishItem.name + '">')
.append('<div class="input-faker dish-price"><div class="input-faker-content">$&nbsp;</div><input type="text" placeholder="" name="dish-price" value="' + dishItem.price + '" class="dataset-dish clean-input" data-clean_type="float"><div class="divider"></div></div>')
.append('<label><span>Move to category</span><select name="dish-id_category" class="dataset-dish clean-input">' + categoryOptions + '</select></label')
.append('<label><span>Active</span><input type="checkbox" name="dish-active" class="dataset-dish clean-input" ' + active + ' /></label')
.append('<textarea placeholder="Description" name="dish-description" class="dataset-dish clean-input dish-description">' + dishDescription + '</textarea>')
.append('<div class="divider"></div><div class="divider dots" style="margin: 10px 0 10px 0;"></div>')
.append(options);