many changes
This commit is contained in:
@@ -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)->
|
||||
|
||||
Reference in New Issue
Block a user