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
@@ -9,13 +9,13 @@
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require twitter/bootstrap
//= require mustache
//= require faye
//= require supplier/base
//= require_directory .
//= require_self
var path_mapping = {
@@ -33,8 +33,5 @@ function redirect_to(mapping, variables){
window.location = path_mapping[mapping] + '?' + vars.join('&')
}
function currency(num) {
if (isNaN(num) || num === '' || num === null) {
num = 0.0;
}
return '€ ' + parseFloat(num).toFixed(2);
return Qwaiter.currency(num);
}
@@ -0,0 +1,6 @@
jQuery ->
$('#product-category-list').sortable
axis: 'y'
handle: '.handle'
update: ->
$.post($(this).data('update-url'), $(this).sortable('serialize'))
+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)->