Fix showing loading graphic when getting error adding attendee.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Jan 2018 17:04:59 +0000 (12:04 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Jan 2018 17:04:59 +0000 (12:04 -0500)
When adding the attendee if you forget the names fields it shows the
loading graphic.
Fixed so the loading graphic is hidden if an error occurs.

js/frontRegApp.js
js/views/front/regTime.js

index 11a3e52..eec6a21 100644 (file)
@@ -958,6 +958,7 @@ app.Views.Front.RegTime = Backbone.View.extend({
 
     // insert new registrant
     insertNew: function(){
+        // Show the loading Graphic
         this.$('#loading-' + this.model.get('id') ).show();
         var findByEmail = [];
         var fname   = this.$('.add_reg_fname').val().trim();
@@ -977,15 +978,21 @@ app.Views.Front.RegTime = Backbone.View.extend({
         }
         var rateId = this.model.get( 'rate_id' );
         if ( !rateId ) {
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
         if ( fname === '' || lname === '' ) {
             alert( 'First and Last name required!' );
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
         if ( email === '' ) {
             var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' );
             if ( !confAnsw ) {
+                // Hide the loading graphic
+                this.$('#loading-' + this.model.get('id') ).hide();
                 return;
             }
         } else {
@@ -998,6 +1005,8 @@ app.Views.Front.RegTime = Backbone.View.extend({
         var regRequest = cart.get( 'request' );
         var parent = this.model.get('parent');
         if ( !parent ) {
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
 
@@ -1032,6 +1041,7 @@ app.Views.Front.RegTime = Backbone.View.extend({
     },
 
     successCallback: function( collection, repsonse ){
+        // Hide the loading graphic
         this.$('#loading-' + this.model.get('id') ).hide();
     },
 
index 2ff5167..db63325 100644 (file)
@@ -68,6 +68,7 @@ app.Views.Front.RegTime = Backbone.View.extend({
 
     // insert new registrant
     insertNew: function(){
+        // Show the loading Graphic
         this.$('#loading-' + this.model.get('id') ).show();
         var findByEmail = [];
         var fname   = this.$('.add_reg_fname').val().trim();
@@ -87,15 +88,21 @@ app.Views.Front.RegTime = Backbone.View.extend({
         }
         var rateId = this.model.get( 'rate_id' );
         if ( !rateId ) {
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
         if ( fname === '' || lname === '' ) {
             alert( 'First and Last name required!' );
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
         if ( email === '' ) {
             var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' );
             if ( !confAnsw ) {
+                // Hide the loading graphic
+                this.$('#loading-' + this.model.get('id') ).hide();
                 return;
             }
         } else {
@@ -108,6 +115,8 @@ app.Views.Front.RegTime = Backbone.View.extend({
         var regRequest = cart.get( 'request' );
         var parent = this.model.get('parent');
         if ( !parent ) {
+            // Hide the loading graphic
+            this.$('#loading-' + this.model.get('id') ).hide();
             return;
         }
 
@@ -142,6 +151,7 @@ app.Views.Front.RegTime = Backbone.View.extend({
     },
 
     successCallback: function( collection, repsonse ){
+        // Hide the loading graphic
         this.$('#loading-' + this.model.get('id') ).hide();
     },