Clear coordinator fees when coordinator changes

This commit is contained in:
Rohan Mitchell
2013-07-30 13:46:30 +10:00
parent d64bcf0e94
commit 4a0e35deef
2 changed files with 7 additions and 1 deletions

View File

@@ -275,3 +275,9 @@ angular.module('order_cycle', ['ngResource'])
parsed = $parse(attrs.datetimepicker)
parsed.assign(scope, dateText)
])
.directive('ofwOnChange', ->
(scope, element, attrs) ->
element.bind 'change', ->
scope.$apply(attrs.ofwOnChange)
)

View File

@@ -30,7 +30,7 @@
%h2 Coordinator
= f.label :coordinator_id, 'Coordinator'
= f.collection_select :coordinator_id, coordinating_enterprises, :id, :name, {}, {'ng-model' => 'order_cycle.coordinator_id', 'required' => true}
= f.collection_select :coordinator_id, coordinating_enterprises, :id, :name, {}, {'ng-model' => 'order_cycle.coordinator_id', 'ofw-on-change' => 'order_cycle.coordinator_fees = []', 'required' => true}
%table
%tr{'ng-repeat' => 'enterprise_fee in order_cycle.coordinator_fees'}