Adding form validation to BOM

This commit is contained in:
Rob Harrington
2015-10-01 21:56:44 +10:00
parent b08556ec7f
commit 33e1322a44
3 changed files with 17 additions and 5 deletions

View File

@@ -11,7 +11,6 @@ angular.module("ofn.admin").controller "AdminOrderMgmtCtrl", [
$scope.confirmDelete = true
$scope.startDate = formatDate start
$scope.endDate = formatDate end
$scope.pendingChanges = pendingChanges
$scope.quickSearch = ""
$scope.bulkActions = [ { name: "Delete Selected", callback: $scope.deleteLineItems } ]
$scope.selectedBulkAction = $scope.bulkActions[0]
@@ -111,6 +110,12 @@ angular.module("ofn.admin").controller "AdminOrderMgmtCtrl", [
$scope.deleteLineItem lineItem for lineItem in lineItems when lineItem.checked
$scope.confirmDelete = existingState
$scope.submit = ->
if $scope.bulk_order_form.$valid
pendingChanges.submitAll()
else
alert "Some errors must be resolved be before you can update orders.\nAny fields with red borders contain errors."
$scope.allBoxesChecked = ->
checkedCount = $scope.filteredLineItems.reduce (count,lineItem) ->
count + (if lineItem.checked then 1 else 0 )