Add remove list needs payment functionality

This commit is contained in:
2014-09-01 10:45:11 +02:00
parent f76c883bb9
commit ef7c242018
10 changed files with 46 additions and 3 deletions
@@ -49,4 +49,7 @@ App.List = DS.Model.extend
is_helped: ->
@markHelped()
$.post Routes.supplier_mark_list_as_helped_path(), list_id: @id
remove_needs_payment: ->
@set 'needs_payment', false
$.post Routes.supplier_remove_list_needs_payment_path(), list_id: @id
sorted_orders: (-> @get('relevant_orders').sortBy('created_at').reverseObjects()).property('relevant_orders.@each.isLoaded')
@@ -17,6 +17,7 @@ td.actions
i.fa.fa-bell.fa-stack-small
i.fa.fa-ban.revoke
App.MarkListHelpedButtonView content=view.content
App.RemoveListNeedsPaymentView content=view.content
App.CloseListButtonView content=view.content
button.show-list.button{action "showList" view.content.id}: span
@@ -0,0 +1,3 @@
span.fa-stack.fa-2x.fa-stack-sized
i.fa.fa-money.fa-stack-small
i.fa.fa-ban.revoke
@@ -0,0 +1,7 @@
App.RemoveListNeedsPaymentView = Ember.View.extend
templateName: 'remove_list_needs_payment_button'
classNames: ['remove_list_needs_payment']
classNameBindings: ['content.needs_payment:show:hide']
tagName: 'button'
click: (e)->
@get('content').then (l)->l.remove_needs_payment()
@@ -60,6 +60,10 @@ root.Qsupplier =
else if e.event == 'order_being_delivered'
order.markDelivered() if order = App.Order.findCached(e.data.id)
else if e.event == 'remove_list_needs_payment'
if list = App.List.findCached(e.data.id)
list.set 'needs_payment', false
else if e.event == 'orders_in_process_count'
$('.supplier-orders-in-process-count-number').text e.data.count
else if e.event == 'orders_placed_count'