table numbering
This commit is contained in:
@@ -6,9 +6,11 @@ window.Quser=
|
|||||||
return
|
return
|
||||||
window.active_list = res
|
window.active_list = res
|
||||||
callback.call() if callback
|
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_payment_default_action()
|
||||||
Quser.list_needs_help_default_action()
|
Quser.list_needs_help_default_action()
|
||||||
list_needs_help_default_action: ->
|
list_needs_help_default_action: ->
|
||||||
@@ -37,7 +39,7 @@ window.Quser=
|
|||||||
unless res.list_active
|
unless res.list_active
|
||||||
window.location = '/user/list_history/'+res._id + '?list_closed=true'
|
window.location = '/user/list_history/'+res._id + '?list_closed=true'
|
||||||
return
|
return
|
||||||
Quser.handle_active_list_default_actions()
|
Quser.handle_active_list_default_actions(res)
|
||||||
body = $('#active-list-table tbody')
|
body = $('#active-list-table tbody')
|
||||||
foot = $('#active-list-table tfoot')
|
foot = $('#active-list-table tfoot')
|
||||||
body.find('tr').remove()
|
body.find('tr').remove()
|
||||||
@@ -97,6 +99,9 @@ window.Quser=
|
|||||||
populate_products_table: (src, include_order_buttons)->
|
populate_products_table: (src, include_order_buttons)->
|
||||||
$.get(src, (res) ->
|
$.get(src, (res) ->
|
||||||
body = $('#products-table tbody')
|
body = $('#products-table tbody')
|
||||||
|
if res.table_number
|
||||||
|
$('.table-number').text(res.table_number)
|
||||||
|
delete(res['table_number'])
|
||||||
for category, products of res
|
for category, products of res
|
||||||
body.append('<tr><td colspan="4"><h4>'+category+'<h4></td></tr>')
|
body.append('<tr><td colspan="4"><h4>'+category+'<h4></td></tr>')
|
||||||
for product in products
|
for product in products
|
||||||
|
|||||||
@@ -17,3 +17,6 @@ body
|
|||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
.order-count-cell
|
.order-count-cell
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
|
.page-header
|
||||||
|
.table-number
|
||||||
|
float: right
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class UserController < ApplicationController
|
|||||||
products = list.supplier.products
|
products = list.supplier.products
|
||||||
products.include_relation(:product_categories)
|
products.include_relation(:product_categories)
|
||||||
products.sort_by!{|p| p.product_category.try(:position) || 90000}
|
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
|
render json: h
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -72,7 +72,7 @@ class UserController < ApplicationController
|
|||||||
products = @table.supplier.products
|
products = @table.supplier.products
|
||||||
products.include_relation(:product_categories)
|
products.include_relation(:product_categories)
|
||||||
products.sort_by!{|p| p.product_category.try(:position) || 90000}
|
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
|
render json: h
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.page-header
|
.page-header
|
||||||
|
.table-number
|
||||||
h4= t('user.active_list.title', list: List.model_name.human)
|
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']
|
= link_to t('helpers.links.place_order'), user_list_products_path, class: ['btn btn-primary']
|
||||||
span#list-needs-payment-button
|
span#list-needs-payment-button
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.page-header
|
.page-header
|
||||||
|
.table-number
|
||||||
h4= t('user.show_products.title', products: Product.model_name.human_plural)
|
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']
|
= 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
|
span#list-needs-help-button
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.page-header
|
.page-header
|
||||||
|
.table-number= @table.number
|
||||||
h4= t('user.show_products.title', products: Product.model_name.human_plural)
|
h4= t('user.show_products.title', products: Product.model_name.human_plural)
|
||||||
table#products-table.table.table-striped.table-hover
|
table#products-table.table.table-striped.table-hover
|
||||||
tbody
|
tbody
|
||||||
|
|||||||
Reference in New Issue
Block a user