sort supplier dashboard from old to new
This commit is contained in:
2014-09-05 16:20:08 +02:00
parent ad7b396dd1
commit 3491e77951
2 changed files with 10 additions and 4 deletions
@@ -5,17 +5,19 @@ App.IndexController = Ember.ObjectController.extend
sections: (-> @store.all('section')).property()
active_lists: (->
if @get('controllers.application.active_section.id')
@get('lists').filter (l)=>( l.get('section.id') == @get('controllers.application.active_section.id') && l.get('state') == 'active' )
lists = @get('lists').filter (l)=>( l.get('section.id') == @get('controllers.application.active_section.id') && l.get('state') == 'active' )
else
@get('lists').filterProperty('state', 'active')
lists = @get('lists').filterProperty('state', 'active')
lists.sortBy('created_at') # Not reversed, oldest on top, start with oldest order first :-) Customer happyness
).property('lists.@each.state', 'controllers.application.active_section.id')
active_section: (-> @get('controllers.application.active_section')).property('controllers.application.active_section')
active_orders: (->
if @get('active_section.id')
@get('orders').filter (o)=>( o.get('section.id') == @get('active_section.id') && o.get('needs_supplier_attention') )
orders = @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') )
orders = @get('orders').filter (o)->( o.get('needs_supplier_attention') )
orders.sortBy('created_at') # Not reversed, oldest on top, start with oldest order first :-) Customer happyness
).property('orders.@each.state', 'active_section.id')
actions: