many changes

This commit is contained in:
2012-12-03 18:39:36 +01:00
parent e3dc6a7c68
commit 7d64ab2022
37 changed files with 540 additions and 101 deletions
+11 -17
View File
@@ -283,29 +283,23 @@ class Quser
@populate_products_table('/user/list_products_for_table.json?'+authentication_string+'&table_id='+table_id)
populate_products_table: (src)->
$.getJSON(data_host + src, (res) =>
if res.has_occupied_info
include_order_buttons = !res.is_occupied
delete(res['has_occupied_info'])
delete(res['is_occupied'])
else
include_order_buttons = true
body = $('#products-table tbody')
if res.table_number
$('.table-number').text(res.table_number)
delete(res['table_number'])
if res.supplier_name
$('.supplier-name').text(res.supplier_name)
delete(res['supplier_name'])
include_order_buttons = res.my_list
$('.table-number').text(res.table_number) if res.table_number
$('.supplier-name').text(res.supplier_name) if res.supplier_name
window.products = {}
body = $('#products-table tbody')
body.find('tr').remove()
script_id = if include_order_buttons then '#products-category-for-order-template' else '#products-category-template'
for category, products of res
#for category, products of res
for category in res.categories
body.append @mustache(script_id,
category: category,
products: products,
category: category.name,
products: category.products,
include_order_buttons: include_order_buttons
)
for product in products
for product in category.products
window.products[product._id] = product
)
increment_products_counter: (product_id)->