From: Steve Sutton Date: Tue, 10 Oct 2017 20:44:50 +0000 (-0400) Subject: Pull in time text for selected reg_time on registrant edit. X-Git-Tag: v1.0.0^2~359 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=cf5503c66f0ae472846e0376e4ce179f62fc7ff2;p=WP-Plugins%2Fglm-member-db-registrations.git Pull in time text for selected reg_time on registrant edit. Pull in the time text for the selected reg_time when editing registrant. Trying to get the calendar also to show the selected time but not finding a way to do this. --- diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 8f1ce1e..2c2a11a 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -978,7 +978,9 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ editRegistrant: function(){ this.$('.reg-edit-form').show(); if ( app.timeSpecific === true ) { + this.$('#reg-select-time').val( this.model.get( 'reg_time' ) ); app.initFullCalendar(); + console.log( this.model.get( 'reg_time' ) ); } }, diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index 4276501..b0fa90e 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -48,7 +48,9 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ editRegistrant: function(){ this.$('.reg-edit-form').show(); if ( app.timeSpecific === true ) { + this.$('#reg-select-time').val( this.model.get( 'reg_time' ) ); app.initFullCalendar(); + console.log( this.model.get( 'reg_time' ) ); } }, diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index 1d747d2..76e6fe7 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -232,6 +232,20 @@ $registrant['account'] ) ); + $this->wpdb->show_errors(); + if ( $registrant['reg_time'] && filter_var( $registrant['reg_time'], FILTER_VALIDATE_INT ) ) { + $regTimeText = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT DATE_FORMAT( start_datetime, '%%m/%%d/%%Y %%l:%%i %%p' ) + FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + WHERE id = %d", + $registrant['reg_time'] + ) + ); + var_dump( $regTimeText ); + $registrant['reg_time_text'] = $regTimeText; + } + $this->wpdb->print_error(); $registrant['class_id'] = $classId; $registrant['email'] = $email; $registrant['validated'] = $accountData['validated']; @@ -241,6 +255,7 @@ $registrant['state'] = $accountData['state']; $registrant['zip'] = $accountData['zip']; $registrant['country'] = $accountData['country']; + echo '
$registrant: ' . print_r( $registrant, true ) . '
'; $registrants[] = $registrant; } } diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 3dfbe00..c007a3c 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -203,7 +203,7 @@ {/literal}{if $regEvent.time_specific.value}
- Selected Time: + Selected Time: {literal}<%= reg_time_text %>{/literal}
{/if}{literal} @@ -241,7 +241,7 @@ var app = { {if $regEvent.time_specific.value} initFullCalendar: function(){ if ({$regEvent.time_specific.value}) { - $('#eventCalendar').fullCalendar({ + app.FullCalendar = $('#eventCalendar').fullCalendar({ {if $regEvent} events: [ {$sep = ''} @@ -254,7 +254,7 @@ var app = { {/if} start : '{$t.start_datetime.datetime}', end : '{$t.end_datetime.datetime}', - allday : {if $t.all_day.value}true{else}false{/if}, + allday : {if $t.all_day.value}true{else}false{/if}, reg_time: {$t.id} } {$sep = ','} @@ -264,8 +264,10 @@ var app = { timeFormat : 'h:mma', 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') ); + $(this).css('background-color', 'red'); } {/if} });