Scan of occupied table, make mustache and do something with assets path for local android spinner

User event order added for multiple users
This commit is contained in:
2012-12-07 16:10:51 +01:00
parent 578f6ad696
commit 26877732b9
7 changed files with 37 additions and 17 deletions
@@ -64,7 +64,8 @@ var $translations = {
title: 'Join request',
body: '%{email} wants to join the table',
reject: 'Reject',
approve: 'Approve'
approve: 'Approve',
waiting_for_confirmation: 'Waiting for approval of the person on this table...'
},
move_table: {
cannot_move_to_occupied_table: 'You cannot move to an occupied table',
@@ -98,7 +99,8 @@ var $translations = {
title: 'Lijst deling',
body: '%{email} wil ook op jouw lijst bestellen',
reject: 'Afwijzen',
approve: 'Toestaan'
approve: 'Toestaan',
waiting_for_confirmation: 'Wachten op toestemming van huidige gebruikers om hier te kunnen bestellen...'
},
move_table: {
cannot_move_to_occupied_table: 'Je kan niet verhuizen naar een tafel die reeds gebruikt wordt.',
+6 -4
View File
@@ -36,6 +36,9 @@ class Quser
redirect_to 'list_products', message: 'join_request_approved'
else if(e.event == 'join_request_rejected')
redirect_to 'user_root', message: 'join_request_rejected'
else if(e.event == 'new_order')
$('#active-list-table tbody').append @mustache('#active-list-order-template', new Order(e.data.order))
$('.list-total-amount').html(currency(e.data.total_amount))
console.log(e)
false
home_loader: ->
@@ -226,13 +229,12 @@ class Quser
Mustache.to_html($(selector).html(), locs)
build_list_table: (body, foot, res) ->
body.find('tr').remove()
foot.find('tr').remove()
if !res.orders && !res.orders.length
Qwaiter.alert('No orders in list')
return
m_obj = res
body.append @mustache('#active-list-order-template', new Order(order)) for order in m_obj.orders
foot.append @mustache('#active-list-orders-footer-template', m_obj)
$('.list-total-amount').html(currency(m_obj.total_amount))
order_selected_products: ()->
return if $.isEmptyObject(window.active_products_list)
@@ -370,8 +372,8 @@ class Quser
$('.form-actions').remove()
cont = $('#join-occupied-table-progress-container')
cont.html('')
cont.append $('<img src="/assets/spinner.gif" />')
cont.append $('<p>Waiting for approval of the person on this table</p>')
cont.append $($('<img />').attr('src', "#{$asset_path}spinner.gif"))
cont.append $($('<p>').html(t('join_request.waiting_for_confirmation')))
$.post(data_host + '/user/join_occupied_table', $.extend({table_id: table_id}, authentication_object))
#setInterval('Quser.check_if_can_join_occupied_table("'+table_id+'")', 7500)
add_product: (product_id, count) ->
+5
View File
@@ -236,6 +236,11 @@ class List
product = loaded_products.find{|p| p.id == product_id} # to get the price
ProductOrder.create order: order, product_id: product_id, amount: number, price: product.price if number > 0
end
set_price
save
for user_id in user_ids
broadcast_user user_id, 'new_order', order: order.with_products_as_json, total_amount: price
end
broadcast_supplier supplier.id, 'new_order', order.with_products_as_json
broadcast_supplier supplier.id, 'list_update', with_info_as_json
order
@@ -1 +0,0 @@
<tr><td></td><td class="currency"><strong>{{#currency}}{{total_amount}}{{/currency}}</strong></td></tr>
+14 -8
View File
@@ -16,16 +16,22 @@ html lang="en"
link href="/images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon"
javascript:
var data_host = 'http://data.qwaiter.com';
var event_host = '#{event_host}';
var $locale = 'en';
var $url_vars = null;
var QMobile, Qwaiter, Quser;
- unless ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
- if ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
javascript:
var QMobile, Qwaiter, Quser;
var data_host = 'http://data.qwaiter.com';
var event_host = '#{event_host}';
var $locale = 'en';
var $asset_path = 'file:///android_asset/assets/';
- else
javascript:
var QMobile, Qwaiter, Quser;
var data_host = 'http://data.qwaiter.com';
var event_host = '#{event_host}';
var $locale = 'en';
var $asset_path = '#{asset_path('')}';
#{Rails.env.production? ? '' : "data_host = 'http://qwaiter.dev';"}
var data_host = 'http://localhost:3000';
//var data_host = 'http://localhost:3000';
QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){},
+4 -1
View File
@@ -16,8 +16,11 @@
tr
td colspan=2 = slider_image
tfoot
tr
td
td.currency
strong.list-total-amount
script#active-list-order-template[type="text/html"]= render 'active_list_order.mustache'
script#active-list-orders-footer-template[type="text/html"]= render 'active_list_orders_footer.mustache'
- content_for :footer do
javascript:
jQuery(function(){
+4 -1
View File
@@ -17,6 +17,9 @@ dl.dl-horizontal
tr
td colspan=2 = slider_image
tfoot
tr
td
td.currency
strong.list-total-amount
script#active-list-order-template[type="text/html"]= render 'active_list_order.mustache'
script#active-list-orders-footer-template[type="text/html"]= render 'active_list_orders_footer.mustache'
- onload_javascript "Quser.load_history_list()"