table management fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
window.Qwaiter=
|
||||
alert: (msg) ->
|
||||
$('.modal').modal('hide')
|
||||
template = @mustache('#alert-template', {title: 'Alert', message: msg, close: 'OK'})
|
||||
$(template).modal()
|
||||
false
|
||||
|
||||
@@ -134,10 +134,8 @@ root.Qsupplier=
|
||||
Qsupplier.build_list_table(body, foot, res)
|
||||
)
|
||||
build_list_table: (body, foot, res) ->
|
||||
if !res.orders && !res.orders.length
|
||||
alert('No orders in list')
|
||||
return
|
||||
body.html('')
|
||||
return unless res.orders
|
||||
for order in res.orders
|
||||
body.append @mustache('#list-order-template', new Order(order))
|
||||
foot.find('.list-total').html(currency(res.total_amount))
|
||||
@@ -160,10 +158,11 @@ root.Qsupplier=
|
||||
by_row_count = parseInt($('#arrange-tables-by-row-count').val())
|
||||
by_column_count = parseInt($('#arrange-tables-by-column-count').val())
|
||||
if(option == "by_row")
|
||||
return alert('Please fill in a positive number representing the number of tables per row') unless by_row_count && by_row_count > 0
|
||||
return @alert(t('section.arrange_tables.by_row_no_row_count')) unless by_row_count && by_row_count > 0
|
||||
if(option == "by_column")
|
||||
return alert('Please fill in a positive number representing the number of tables per column') unless by_column_count && by_column_count > 0
|
||||
$.post('/supplier/sections/'+current_section_id+'/arrange_tables', {option: option, row_count: by_row_count, column_count: by_column_count}, -> window.location.reload())
|
||||
return @alert(t('section.arrange_tables.by_column_no_column_count')) unless by_column_count && by_column_count > 0
|
||||
$.post '/supplier/sections/'+current_section_id+'/arrange_tables', {option: option, row_count: by_row_count, column_count: by_column_count}, (response)=>
|
||||
if response.ok then window.location.reload() else @alert(t(response.message))
|
||||
false
|
||||
mustache: (selector, locals)->
|
||||
locs = $.extend(locals,
|
||||
@@ -172,3 +171,4 @@ root.Qsupplier=
|
||||
currency(Mustache.render(val, this))
|
||||
)
|
||||
Mustache.to_html($(selector).html(), locs)
|
||||
alert: Qwaiter.alert
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
var $translations = {
|
||||
en: {
|
||||
messages: <%= I18n.t('messages', locale: :en).to_json %>,
|
||||
models: <%= I18n.t('activemodel.models', locale: :en).to_json %>,
|
||||
attributes: <%= I18n.t('activemodel.attributes', locale: :en).to_json %>,
|
||||
helpers: <%= I18n.t('helpers', locale: :en).to_json %>,
|
||||
<%= I18n.t('supplier', locale: :en).to_json[1..-2] %>
|
||||
},
|
||||
nl: {
|
||||
models: <%= I18n.t('activemodel.models', locale: :nl).to_json %>,
|
||||
attributes: <%= I18n.t('activemodel.attributes', locale: :nl).to_json %>,
|
||||
helpers: <%= I18n.t('helpers', locale: :nl).to_json %>,
|
||||
<%= I18n.t('supplier', locale: :nl).to_json[1..-2] %>
|
||||
}
|
||||
}
|
||||
@@ -15,6 +16,7 @@ $transformation_mappings = {
|
||||
downcase: 'toLowerCase',
|
||||
upcase: 'toUpperCase'
|
||||
}
|
||||
|
||||
function t(path, vars){
|
||||
vars || (vars = {});
|
||||
var result, m, translatable, isafety,replacable;
|
||||
|
||||
Reference in New Issue
Block a user