From d6fba7b4c4c63c2eb3f16f099dd52904fb158279 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 8 Jun 2017 01:02:17 -0400 Subject: [PATCH] lp1686459 webstaff: item editor form validation Specifically for stat cats, we mark the select statements as required if the corresponding stat cat is required, but we can also start using HTML5 validation tests elsewhere in the form now as well. I also fixed the entries so that they display instead of blank entries, and forced the Price, Cost, and Deposit Amount fields to be of input type number, though you could still enter invalid numbers here from the database's POV, so better validation tests are still needed there. Signed-off-by: Jason Etheridge Signed-off-by: Andrea Neiman Signed-off-by: Galen Charlton --- .../templates/staff/cat/volcopy/t_attr_edit.tt2 | 33 ++++++++++++++-------- .../src/templates/staff/cat/volcopy/t_edit.tt2 | 2 +- .../web/js/ui/default/staff/cat/volcopy/app.js | 6 +++- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 index 0d61a68aa9..12f1f77c11 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 @@ -1,4 +1,12 @@ -
+ +
[% l('Template') %]
@@ -51,7 +59,7 @@
@@ -59,7 +67,7 @@
@@ -67,7 +75,7 @@
@@ -213,11 +221,11 @@ ng-disabled="!defaults.attributes.circ_modifier" ng-model="working.circ_modifier" ng-options="m.code() as m.name() for m in circ_modifier_list | orderBy: 'name()'" > - +
- +
@@ -241,7 +249,7 @@
- +
@@ -261,7 +269,7 @@
@@ -311,7 +319,7 @@
- +
@@ -421,8 +429,9 @@ @@ -432,4 +441,4 @@ - + diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 index 526673423e..886d41cd40 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 @@ -112,7 +112,7 @@ after-select="afterItemSelect" persist-key="cat.volcopy.copies"> - diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index def7cdcb2a..644be2f378 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -779,6 +779,8 @@ function(egCore , $q) { ['$scope','$q','$window','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc','$uibModal', function($scope , $q , $window , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , $uibModal) { + $scope.forms = {}; // Accessed by t_attr_edit.tt2 + $scope.defaults = { // If defaults are not set at all, allow everything barcode_checkdigit : false, auto_gen_barcode : false, @@ -1285,7 +1287,9 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , can_save = false; } ); - + if ($scope.forms.myForm && $scope.forms.myForm.$invalid) { + can_save = false; + } $scope.can_save = can_save; } -- 2.11.0