WIP for the logout and adding attendees
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 12 Oct 2017 17:25:58 +0000 (13:25 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 12 Oct 2017 17:25:58 +0000 (13:25 -0400)
Fix the add attendee so you can select the time.
Logout will now go to the event list.

css/front.css
js/frontRegApp.js
js/views/front/app.js
js/views/front/regClass.js
js/views/front/regRequestRegistrant.js
models/admin/ajax/account.php
models/front/registrations/registration.php
views/front/registrations/registration.html

index bad3cac..7e1e659 100644 (file)
@@ -175,19 +175,19 @@ div.glm-reg-register input.error {
 .new-reg h2 {
     width: auto;
 }
-.new-reg .reg_fname,
-.new-reg .reg_lname,
-.new-reg .reg_addr1,
-.new-reg .reg_addr2,
-.new-reg .reg_city,
-.new-reg .reg_state,
-.new-reg .reg_zip,
-.new-reg .reg_country {
+.new-reg .add_reg_fname,
+.new-reg .add_reg_lname,
+.new-reg .add_reg_addr1,
+.new-reg .add_reg_addr2,
+.new-reg .add_reg_city,
+.new-reg .add_reg_state,
+.new-reg .add_reg_zip,
+.new-reg .add_reg_country {
     width: 46%;
     margin-right: 1rem;
     float: left;
 }
-.new-reg .reg_email {
+.new-reg .add_reg_email {
     width: 96%;
 }
 
index f5338fb..8ff12ce 100644 (file)
@@ -523,7 +523,6 @@ app.Views.Front.App = Backbone.View.extend({
             data: 'option=logout'
         })
         .done(function( msg ){
-            console.log( msg );
             // Here we can update.
             loginAccount = '';
             this.accountView.remove();
@@ -532,6 +531,8 @@ app.Views.Front.App = Backbone.View.extend({
                 item.set({ loggedIn: false });
             });
             jQuery('#appLogin').show();
+            // Need to reload the page now
+            window.location.href = thisPageUrl;
         })
         .fail(function(msg){
             console.log('Fail:');
@@ -828,7 +829,7 @@ app.Views.Front.RegClass = Backbone.View.extend({
         this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
         this.$el.append( this.newRegAccountView.render().el );
         if ( app.timeSpecific ) {
-            app.initFullCalendar();
+            app.initFullCalendar( true );
             console.log('called app.initFullCalendar()');
         }
     },
@@ -1001,7 +1002,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.$('.reg-edit-form').show();
         if ( app.timeSpecific === true ) {
             this.$('#reg-select-time').val( this.model.get( 'reg_time' ) );
-            app.initFullCalendar();
+            app.initFullCalendar( false );
             console.log( this.model.get( 'reg_time' ) );
         }
     },
index b9358ad..b7d1317 100644 (file)
@@ -54,7 +54,6 @@ app.Views.Front.App = Backbone.View.extend({
             data: 'option=logout'
         })
         .done(function( msg ){
-            console.log( msg );
             // Here we can update.
             loginAccount = '';
             this.accountView.remove();
@@ -63,6 +62,8 @@ app.Views.Front.App = Backbone.View.extend({
                 item.set({ loggedIn: false });
             });
             jQuery('#appLogin').show();
+            // Need to reload the page now
+            window.location.href = thisPageUrl;
         })
         .fail(function(msg){
             console.log('Fail:');
index cba27ce..4b39580 100644 (file)
@@ -139,7 +139,7 @@ app.Views.Front.RegClass = Backbone.View.extend({
         this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
         this.$el.append( this.newRegAccountView.render().el );
         if ( app.timeSpecific ) {
-            app.initFullCalendar();
+            app.initFullCalendar( true );
             console.log('called app.initFullCalendar()');
         }
     },
index b60b749..9f62500 100644 (file)
@@ -69,7 +69,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.$('.reg-edit-form').show();
         if ( app.timeSpecific === true ) {
             this.$('#reg-select-time').val( this.model.get( 'reg_time' ) );
-            app.initFullCalendar();
+            app.initFullCalendar( false );
             console.log( this.model.get( 'reg_time' ) );
         }
     },
index 6fa45a3..09053fe 100644 (file)
@@ -183,7 +183,10 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount
 
             break;
         case 'logout':
-            unset( $_SESSION['LoginAccount'] );
+            unset(
+                $_SESSION['LoginAccount'],
+                $_SESSION['glm_reg_cart_id']
+            );
             $return = array( 'valid' => false );
             break;
         case 'login':
index 83fd2e2..8d02298 100644 (file)
@@ -42,6 +42,7 @@
         $loginAccount      = '';
         $cartId            = false;
         $haveCart          = false;
+        $isNewCart         = false;
         $regEventFirstTime = false;
 
         // Have Backbone.js loaded
                 // Try to get the new cart
                 $cart = $RegCart->getRegistrationCart( $cartId );
                 if ($cart !== false && is_array($cart)) {
-                    $haveCart = true;
+                    $haveCart  = true;
+                    $isNewCart = true;
                     $_SESSION['glm_reg_cart_id'] = $cartId;
                 }
 
             }
 
+            // Need to refresh the page
+
         }
 
         // If we have a good cart, convert to JSON for view
         // Compile template data
         $templateData = array(
             'haveCart'          => $haveCart,
+            'isNewCart'         => $isNewCart,
             'regEvent'          => $regEvent,
             'regEventFirstTime' => $regEventFirstTime,
             'thisJsUrl'         => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
index 89d6c60..2ec44d0 100644 (file)
@@ -240,7 +240,8 @@ var app = {
         return regex.test(email);
     },
     {if $regEvent.time_specific.value}
-    initFullCalendar: function(){
+    initFullCalendar: function( isNew ){
+        console.log( isNew );
         if ({$regEvent.time_specific.value}) {
             $('#eventCalendar').fullCalendar({
                 {if $regEvent}
@@ -266,8 +267,13 @@ var app = {
                     fixedWeekCount : false,
                     eventClick: function(calEvent, jsEvent, view) {
                         $('.fc-event').css('background-color', '#3a67ad');
-                        jQuery('#reg-select-time').val( calEvent.reg_time );
-                        jQuery('#reg-select-time-display').html( calEvent.start.format('L LT') );
+                        if ( isNew ) {
+                            jQuery('#add_reg-select-time').val( calEvent.reg_time );
+                            jQuery('#add_reg-select-time-display').html( calEvent.start.format('L LT') );
+                        } else {
+                            jQuery('#reg-select-time').val( calEvent.reg_time );
+                            jQuery('#reg-select-time-display').html( calEvent.start.format('L LT') );
+                        }
                         $(this).css('background-color', 'red');
                     }
                 {/if}
@@ -283,6 +289,9 @@ var regEvent = '';
 var cart = '';
 var loginAccount = '';
 jQuery(function($){
+    {if $isNewCart}
+        location.reload( true );
+    {/if}
     {if $loginAccount }
         loginAccount = new app.Models.Front.Account( {$loginAccount} );
     {else}