From: Steve Sutton Date: Mon, 9 Oct 2017 15:36:23 +0000 (-0400) Subject: Front end work X-Git-Tag: v1.0.0^2~367 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=fc5683c262287899cb134836b29185fdde9de3a3;p=WP-Plugins%2Fglm-member-db-registrations.git Front end work Fix error when no time specific entry is there. --- diff --git a/css/front.css b/css/front.css index b03bc59..347f04c 100644 --- a/css/front.css +++ b/css/front.css @@ -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; } diff --git a/js/frontRegApp.js b/js/frontRegApp.js index a7c6e09..af5d506 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -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() ), diff --git a/js/views/front/regClass.js b/js/views/front/regClass.js index 3fe7afe..14e182e 100644 --- a/js/views/front/regClass.js +++ b/js/views/front/regClass.js @@ -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; } diff --git a/js/views/front/registrantForm.js b/js/views/front/registrantForm.js index aa86821..02f2316 100644 --- a/js/views/front/registrantForm.js +++ b/js/views/front/registrantForm.js @@ -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() ), diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index 88994cf..3698f00 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -119,12 +119,13 @@ 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 '
$first: ' . print_r( $first, true ) . '
'; $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; } } @@ -251,6 +252,7 @@ } // echo '
$registrants: ' . print_r( $registrants, true ) . '
'; +// echo '
$regEvent: ' . print_r( $regEvent, true ) . '
'; // Compile template data $templateData = array( 'regEvent' => $regEvent, diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index c4ec06b..fb8e8b0 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -112,10 +112,16 @@ {/literal} {* Template for registrant add form *}{literal}