Adding stuff for new registrant
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 27 Sep 2017 20:58:57 +0000 (16:58 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 27 Sep 2017 20:58:57 +0000 (16:58 -0400)
This will be for a new account to be registered.

js/frontRegApp.js
js/models/front/regEvent.js
js/views/front/app.js
models/admin/ajax/regFront/registrant.php
views/front/registrations/registration.html

index 92e61f9..bfb4979 100644 (file)
@@ -186,7 +186,9 @@ app.Models.Front.RegEvent = Backbone.Model.extend({
     setClassRegistrants: function( registrants ){
         for ( var i = 0; i < registrants.length; i++ ) {
             var foundClass = this.classes.findWhere({ id: registrants[i].class_id });
-            foundClass.registrants.create( registrants[i] );
+            if ( foundClass != undefined ) {
+                foundClass.registrants.create( registrants[i] );
+            }
         }
     },
 
@@ -460,6 +462,11 @@ app.Views.Front.App = Backbone.View.extend({
         'click #glm-reg-cart-continue': 'continue',
         'click #accountLogin': 'loginToAccount',
         'click #accountLogout': 'logout',
+        'click #register': 'register',
+    },
+
+    register: function(){
+        // Have to create new view and model for the register
     },
 
     continue: function(){
index eb73ebd..5b0a393 100644 (file)
@@ -29,7 +29,9 @@ app.Models.Front.RegEvent = Backbone.Model.extend({
     setClassRegistrants: function( registrants ){
         for ( var i = 0; i < registrants.length; i++ ) {
             var foundClass = this.classes.findWhere({ id: registrants[i].class_id });
-            foundClass.registrants.create( registrants[i] );
+            if ( foundClass != undefined ) {
+                foundClass.registrants.create( registrants[i] );
+            }
         }
     },
 
index 82a573f..14cdf6e 100644 (file)
@@ -29,6 +29,11 @@ app.Views.Front.App = Backbone.View.extend({
         'click #glm-reg-cart-continue': 'continue',
         'click #accountLogin': 'loginToAccount',
         'click #accountLogout': 'logout',
+        'click #register': 'register',
+    },
+
+    register: function(){
+        // Have to create new view and model for the register
     },
 
     continue: function(){
index e781b53..dfd6dcd 100644 (file)
@@ -275,9 +275,10 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations
                 $this->wpdb->insert(
                     GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account',
                     array(
-                        'fname' => $modelData['fname'],
-                        'lname' => $modelData['lname'],
-                        'email' => $modelData['email']
+                        'fname'        => $modelData['fname'],
+                        'lname'        => $modelData['lname'],
+                        'email'        => $modelData['email'],
+                        'date_created' => date('Y-m-d'),
                     ),
                     '%s'
                 );
index aac27de..cd886c4 100644 (file)
@@ -2,21 +2,27 @@
 {* Underscore Templates for the Event Registration App *}
 {* Template for Account Login *}{literal}
 <script type="text/template" id="eventReg-account-login">
+    <a class="glm-reg-account-login" id="loginCancel">Close</a>
     <h4>Login</h4>
     <% if ( message ) { %>
         <span style="color: red;"><%= message %></span>
     <% } %>
-    <a class="glm-reg-account-login" id="loginCancel">Close</a>
-    <a id="forgotLogin">Forgot Password</a>
     <input class="login" placeholder="Email Address" type="email">
     <input class="password" placeholder="Password" type="password">
     <input type="submit" id="accountLogin" value="Login">
+    <a id="register">Register</a>
+    <a id="forgotLogin">Forgot Password</a>
 </script>
 {/literal}
 {* Template for Logged in Account *}{literal}
 <script type="text/template" id="account-template">
-    <span>Logged in as <%= email %></span>
-    <span id="accountLogout">Logout</span>
+    <span>Logged in as <%= fname %><%= lname %></span>
+    <a id="accountLogout">Logout</a>
+</script>
+{/literal}
+{* Template for Register New Account *}{literal}
+<script type="text/template" id="register-new-account">
+<h1>New Account</h1>
 </script>
 {/literal}
 {* Template for the regEvent *}{literal}