36 lines
1.2 KiB
CoffeeScript
36 lines
1.2 KiB
CoffeeScript
Qsupplier.App.IndexController = Ember.ObjectController.extend
|
|
needs: ['application']
|
|
active_lists: (->
|
|
if @get('active_section.id')
|
|
@get('lists').filter (l)=>( l.get('section.id') == @get('active_section.id') && l.get('state') == 'active' )
|
|
else
|
|
@get('lists').filterProperty('state', 'active')
|
|
).property('lists.@each.state', 'active_section.id')
|
|
|
|
active_orders: (->
|
|
if @get('active_section.id')
|
|
@get('orders').filter (o)=>( o.get('section.id') == @get('active_section.id') && o.get('needs_supplier_attention') )
|
|
else
|
|
@get('orders').filter (o)->( o.get('needs_supplier_attention') )
|
|
).property('orders.@each.state', 'active_section.id')
|
|
|
|
markListAsHelped: (id)->
|
|
if list = Qsupplier.App.List.findCached(id)
|
|
list.is_helped()
|
|
|
|
closeList: (id)->
|
|
if list = Qsupplier.App.List.findCached(id)
|
|
list.close()
|
|
|
|
markOrderDelivered: (id)->
|
|
$.post('/supplier/order_is_delivered', order_id: id)
|
|
if order = Qsupplier.App.Order.findCached(id)
|
|
order.set('state', 'delivered')
|
|
|
|
markOrderActive: (id)->
|
|
$.post('/supplier/mark_order_in_process', order_id: id)
|
|
if order = Qsupplier.App.Order.findCached(id)
|
|
order.set('state', 'active')
|
|
showListInfo: (view, link)->
|
|
debugger
|