diff --git a/app/assets/javascripts/quser.js.coffee b/app/assets/javascripts/quser.js.coffee
index d5740726..c62918df 100644
--- a/app/assets/javascripts/quser.js.coffee
+++ b/app/assets/javascripts/quser.js.coffee
@@ -6,9 +6,11 @@ window.Quser=
return
window.active_list = res
callback.call() if callback
- Quser.handle_active_list_default_actions()
+ Quser.handle_active_list_default_actions(res)
)
- handle_active_list_default_actions: ->
+ handle_active_list_default_actions: (response)->
+ if typeof(response) == 'object' && response.table_number
+ $('.table-number').text(response.table_number)
Quser.list_needs_payment_default_action()
Quser.list_needs_help_default_action()
list_needs_help_default_action: ->
@@ -37,7 +39,7 @@ window.Quser=
unless res.list_active
window.location = '/user/list_history/'+res._id + '?list_closed=true'
return
- Quser.handle_active_list_default_actions()
+ Quser.handle_active_list_default_actions(res)
body = $('#active-list-table tbody')
foot = $('#active-list-table tfoot')
body.find('tr').remove()
@@ -97,6 +99,9 @@ window.Quser=
populate_products_table: (src, include_order_buttons)->
$.get(src, (res) ->
body = $('#products-table tbody')
+ if res.table_number
+ $('.table-number').text(res.table_number)
+ delete(res['table_number'])
for category, products of res
body.append('
'+category+' |
')
for product in products
diff --git a/app/assets/stylesheets/phone/structure.css.sass b/app/assets/stylesheets/phone/structure.css.sass
index 1a14a9ba..c6c2b7b1 100644
--- a/app/assets/stylesheets/phone/structure.css.sass
+++ b/app/assets/stylesheets/phone/structure.css.sass
@@ -17,3 +17,6 @@ body
margin-bottom: 0
.order-count-cell
white-space: nowrap
+ .page-header
+ .table-number
+ float: right
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 3933d922..e761f2bb 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -56,7 +56,7 @@ class UserController < ApplicationController
products = list.supplier.products
products.include_relation(:product_categories)
products.sort_by!{|p| p.product_category.try(:position) || 90000}
- h = products.inject({}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
+ h = products.inject({table_number: list.table_number}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
render json: h
end
end
@@ -72,7 +72,7 @@ class UserController < ApplicationController
products = @table.supplier.products
products.include_relation(:product_categories)
products.sort_by!{|p| p.product_category.try(:position) || 90000}
- h = products.inject({}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
+ h = products.inject({table_number: @table.number}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
render json: h
end
end
diff --git a/app/views/user/active_list.html.slim b/app/views/user/active_list.html.slim
index d77a2be3..775f67b0 100644
--- a/app/views/user/active_list.html.slim
+++ b/app/views/user/active_list.html.slim
@@ -1,4 +1,5 @@
.page-header
+ .table-number
h4= t('user.active_list.title', list: List.model_name.human)
= link_to t('helpers.links.place_order'), user_list_products_path, class: ['btn btn-primary']
span#list-needs-payment-button
diff --git a/app/views/user/list_products.html.slim b/app/views/user/list_products.html.slim
index 811ca9bf..388541af 100644
--- a/app/views/user/list_products.html.slim
+++ b/app/views/user/list_products.html.slim
@@ -1,4 +1,5 @@
.page-header
+ .table-number
h4= t('user.show_products.title', products: Product.model_name.human_plural)
= link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['btn btn']
span#list-needs-help-button
diff --git a/app/views/user/list_products_for_table.html.slim b/app/views/user/list_products_for_table.html.slim
index 59f40a5a..092cbef1 100644
--- a/app/views/user/list_products_for_table.html.slim
+++ b/app/views/user/list_products_for_table.html.slim
@@ -1,4 +1,5 @@
.page-header
+ .table-number= @table.number
h4= t('user.show_products.title', products: Product.model_name.human_plural)
table#products-table.table.table-striped.table-hover
tbody