Fix active order display in supplier side

This commit is contained in:
2013-03-10 18:24:09 +01:00
parent 5eac918255
commit 0979eda9be
11 changed files with 157 additions and 34 deletions
@@ -9,6 +9,7 @@ class List
active: -> @attributes.state == 'active'
table_id: -> @attributes.table_id
products: -> @attributes.products || []
has_active_orders: -> @attributes.has_active_orders
supplier_name: -> @attributes.supplier_name
created_at: -> @attributes.created_at
display: ->
@@ -35,6 +35,7 @@ root.Qsupplier=
table.addClass('occupied')
table.addClass('needs_help') if list.needs_help()
table.addClass('needs_payment') if list.needs_payment()
table.addClass('active_order') if list.has_active_orders()
else if e.event == 'list_closed'
$('#list-row-'+e.data.id).remove()
$('.of-list-'+e.data.id).remove()
@@ -52,20 +53,24 @@ root.Qsupplier=
$('#order-row-'+e.data.id).remove()
$('.section-table-list-'+e.data.list_id).removeClass('active_order')
else if e.event == 'list_changed_table'
list_row = $('#list-row-'+e.data.list_id)
list_row.find('.table_number').text(e.data.table.number).addClass('changed')
list = new List(e.data.list)
list_row = $('#list-row-'+list.id())
list_row.find('.table_number').text(list.table_number()).addClass('changed')
list_row.find('.section_title').text(e.data.section_title)
order_rows = $('.of-list-'+e.data.list_id)
order_rows.find('.table_number').text(e.data.table.number).addClass('changed')
order_rows = $('.of-list-'+list.id())
order_rows.find('.table_number').text(list.table_number()).addClass('changed')
order_rows.find('.section_title').text(e.data.section_title)
# Move properties from table in section tables view
window.last_data = e.data
from_table = $('#section-table-'+e.data.from_table_id)
to_table = $('#section-table-'+e.data.table._id)
# Now switch classes
from_class = from_table.attr('class')
from_table.attr('class', to_table.attr('class'))
to_table.attr('class', from_class)
to_table = $('#section-table-'+list.table_id())
if to_table.length
to_table.addClass('section-table-list-'+list.id())
to_table.addClass('occupied')
to_table.addClass('needs_help') if list.needs_help()
to_table.addClass('needs_payment') if list.needs_payment()
to_table.addClass('active_order') if list.has_active_orders()
from_table.removeClass('occupied needs_help needs_payment active_order section-table-list-'+list.id())
console.log(e)