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) { foreach ($newDishes as $dish) {
$dishO = new Dish($dish['id_dish']); $dishO = new Dish($dish['id_dish']);
$dishO->active = 1;
$dishO->id_restaurant = $this->id_restaurant; $dishO->id_restaurant = $this->id_restaurant;
$dishO->active = isset($dish['active']) ? $dish['active'] : 1;
$dishO->name = $dish['name']; $dishO->name = $dish['name'];
$dishO->description = $dish['description']; $dishO->description = $dish['description'];
$dishO->price = $dish['price']; $dishO->price = $dish['price'];

View File

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

View File

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

View File

@ -286,6 +286,7 @@ function saveDishes (complete) {
description: values['dish-description'], description: values['dish-description'],
price: values['dish-price'], price: values['dish-price'],
id_category: values['dish-id_category'], id_category: values['dish-id_category'],
active: values['dish-active'],
}; };
if (id) { if (id) {
@ -574,10 +575,13 @@ App.showDish = function(dishItem) {
categoryOptions += '<option value="' + categories[i].id_category+ '" ' + selected + '>' + categories[i].name+ '</option>'; categoryOptions += '<option value="' + categories[i].id_category+ '" ' + selected + '>' + categories[i].name+ '</option>';
} }
var active = (parseInt(dishItem.active)) ? 'checked="checked"' : '';
padding padding
.append('<input type="text" placeholder="Name" name="dish-name" class="dataset-dish clean-input dish-name" value="' + dishItem.name + '">') .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('<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>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('<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('<div class="divider"></div><div class="divider dots" style="margin: 10px 0 10px 0;"></div>')
.append(options); .append(options);