Front end work
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 9 Oct 2017 15:36:23 +0000 (11:36 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 9 Oct 2017 15:36:23 +0000 (11:36 -0400)
Fix error when no time specific entry is there.

css/front.css
js/frontRegApp.js
js/views/front/regClass.js
js/views/front/registrantForm.js
models/front/registrations/registration.php
views/front/registrations/registration.html

index b03bc59..347f04c 100644 (file)
@@ -161,6 +161,7 @@ div.glm-reg-register input.error {
 .reg-class-accounts {
     padding: 5px;
 }
+
 .new-reg {
     background-color: white;
     border: 1px solid black;
@@ -189,6 +190,35 @@ div.glm-reg-register input.error {
 .new-reg .reg_email {
     width: 96%;
 }
+
+.new-reg-notime {
+    background-color: white;
+    border: 1px solid black;
+    padding: 2rem;
+    position: absolute;
+    left: 1rem;
+    top: 0;
+    width: 40rem;
+    z-index: 999;
+}
+.new-reg-notime h2 {
+    width: auto;
+}
+.new-reg-notime .reg_fname,
+.new-reg-notime .reg_lname,
+.new-reg-notime .reg_addr1,
+.new-reg-notime .reg_addr2,
+.new-reg-notime .reg_city,
+.new-reg-notime .reg_state,
+.new-reg-notime .reg_zip,
+.new-reg-notime .reg_country {
+    width: 46%;
+    margin-right: 1rem;
+    float: left;
+}
+.new-reg-notime .reg_email {
+    width: 95%;
+}
 #reg-select-time {
     width: 150px;
 }
index a7c6e09..af5d506 100644 (file)
@@ -770,7 +770,7 @@ app.Views.Front.RegClass = Backbone.View.extend({
         var zip     = this.$('.reg_zip').val().trim();
         var country = this.$('.reg_country').val().trim();
         var rTime   = this.$('#reg-select-time').val().trim();
-        if ( !rTime ) {
+        if ( app.timeSpecific && !rTime ) {
             alert( 'You must select a time!' );
             return;
         }
@@ -1078,7 +1078,13 @@ app.Views.Front.Register = Backbone.View.extend({
 app.Views.Front.RegistrantForm = Backbone.View.extend({
     tagName: 'div',
 
-    className: 'new-reg',
+    className: function(){
+        if ( app.timeSpecific === true ) {
+            return 'new-reg';
+        } else {
+            return 'new-reg-notime';
+        }
+    },
 
     template: _.template( jQuery('#eventReg-registrant-add').html() ),
 
index 3fe7afe..14e182e 100644 (file)
@@ -84,7 +84,7 @@ app.Views.Front.RegClass = Backbone.View.extend({
         var zip     = this.$('.reg_zip').val().trim();
         var country = this.$('.reg_country').val().trim();
         var rTime   = this.$('#reg-select-time').val().trim();
-        if ( !rTime ) {
+        if ( app.timeSpecific && !rTime ) {
             alert( 'You must select a time!' );
             return;
         }
index aa86821..02f2316 100644 (file)
@@ -1,7 +1,13 @@
 app.Views.Front.RegistrantForm = Backbone.View.extend({
     tagName: 'div',
 
-    className: 'new-reg',
+    className: function(){
+        if ( app.timeSpecific === true ) {
+            return 'new-reg';
+        } else {
+            return 'new-reg-notime';
+        }
+    },
 
     template: _.template( jQuery('#eventReg-registrant-add').html() ),
 
index 88994cf..3698f00 100644 (file)
                 if ( is_array( $regEvent['recurrences'] ) && count( $regEvent['recurrences'] ) ) {
                     foreach ($regEvent['recurrences'] as $k=>$v) {
                         $first = current($v['times']);
-                        $first = current($v['times']);
+                        // $first = current($v['times']);
+                        // echo '<pre>$first: ' . print_r( $first, true ) . '</pre>';
                         $last = end($v['times']);
                         $regEvent['recurrences'][$k]['first_time'] = $first;
                         $regEvent['recurrences'][$k]['lastTime'] = $last;
                         if ($v['times'] && count($v['times']) > 0) {
-                            if (!$regEventFirstTime || $regEventFirstTime['timestamp'] < $first ) {
+                            if (!$regEventFirstTime || ( isset( $regEventFirstTime['timestamp'] ) && $regEventFirstTime['timestamp'] < $first ) ) {
                                 $regEventFirstTime = $first;
                             }
                         }
         }
         // echo '<pre>$registrants: ' . print_r( $registrants, true ) . '</pre>';
 
+// echo '<pre>$regEvent: ' . print_r( $regEvent, true ) . '</pre>';
         // Compile template data
         $templateData = array(
             'regEvent'          => $regEvent,
index c4ec06b..fb8e8b0 100644 (file)
 {/literal}
 {* Template for registrant add form *}{literal}
 <script type="text/template" id="eventReg-registrant-add">
-    <div style="float: right; width: 48%;">
-        <div id="eventCalendar" style="width: 90%;"></div>
-    </div>
-    <div style="width: 48%;">
+    {/literal}{if $regEvent.time_specific.value}
+        <div style="float: right; width: 48%;">
+            <div id="eventCalendar" style="width: 90%;"></div>
+        </div>
+    {/if}{literal}
+    {/literal}{if $regEvent.time_specific.value}
+        <div style="width: 48%;">
+        {else}
+        <div>
+    {/if}{literal}
         <div>
             {/literal}{$terms.reg_term_contact_information}{literal}
         </div>
             <input class="reg_zip" placeholder="Zip/Postal Code">
             <input class="reg_country" placeholder="Country">
         </div>
-        <div>
-            Selected Time: <span id="reg-select-time-display"></span>
-            <input type="hidden" id="reg-select-time">
-        </div>
+        {/literal}{if $regEvent.time_specific.value}
+            <div>
+                Selected Time: <span id="reg-select-time-display"></span>
+                <input type="hidden" id="reg-select-time">
+            </div>
+        {/if}{literal}
     </div>
 
     <div>
@@ -205,6 +213,7 @@ var app = {
         var regex = {literal}/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;{/literal}
         return regex.test(email);
     },
+    {if $regEvent.time_specific.value}
     initFullCalendar: function(){
         if ({$regEvent.time_specific.value}) {
             $('#eventCalendar').fullCalendar({
@@ -220,7 +229,7 @@ var app = {
                               {/if}
                                 start : '{$t.start_datetime.datetime}',
                                 end   : '{$t.end_datetime.datetime}',
-                                allday : {$t.all_day.value},
+                                    allday : {if $t.all_day.value}true{else}false{/if},
                                 reg_time: {$t.id}
                             }
                             {$sep = ','}
@@ -237,6 +246,10 @@ var app = {
             });
         }
     },
+    timeSpecific: true,
+    {else}
+    timeSpecific: false,
+    {/if}
 };
 var regEvent = '';
 var cart = '';