Passing the selected time to the new registrant model being created.
},
updateTimeSelection: function(){
- this.model.set({ selectedTime: this.$('.timeSelection:checked').val() });
+ // Need to remove the newRegModal and views
+ if ( this.newRegAccount ) {
+ this.newRegAccount.destroy();
+ this.newRegAccountView.remove();
+ }
+ this.model.set({ selectedTime: parseInt( this.$('.timeSelection:checked').val() ) });
+ console.log( this.$('.timeSelection:checked').val());
},
render: function(){
if ( loginAccount != '' && this.model.hasMe() ) {
this.$('.glm-add-account').hide();
}
+ if ( !app.timeSpecific ) {
+ this.$('.glm-add-new-account').show();
+ } else {
+ var sTime = this.model.get( 'selectedTime' );
+ if ( !sTime ) {
+ this.$('.glm-add-new-account').hide();
+ } else {
+ this.$('.glm-add-new-account').show();
+ }
+ }
return this;
},
var testDate = new Date( time.start_datetime.datetime );
timeParts.push( {id: time.id,date: testDate} );
});
- console.log( timeParts );
+ // console.log( timeParts );
return timeParts;
},
var state = this.$('.add_reg_state').val().trim();
var zip = this.$('.add_reg_zip').val().trim();
var country = this.$('.add_reg_country').val().trim();
+ if ( app.timeSpecific ) {
+ var sTime = this.model.get( 'selectedTime' );
+ } else {
+ var sTime = null;
+ }
if ( this.$('#add_reg-select-time').length ) {
- var rTime = this.$('#add_reg-select-time').val().trim();
var times = this.model.get( 'times' );
var rateId = null;
// Setup the needed reg_rate
_.each( times, function( time ){
- if ( time.id == rTime ) {
+ if ( time.id == sTime ) {
rateId = time.rate_id;
}
} );
} else {
- var rTime = null;
var times = this.model.get( 'times' );
var rateId = null;
_.each( times, function( time ){
rateId = time.rate_id;
} );
}
- if ( app.timeSpecific && !rTime ) {
+ if ( app.timeSpecific && !sTime ) {
alert( 'You must select a time!' );
return;
}
this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
- reg_time: rTime,
+ reg_time: sTime,
reg_event: this.model.get( 'reg_event' ),
reg_class: this.model.get( 'id' ),
event_name: regEvent.get( 'event_name' ),
}
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
- app.calendar = false;
+ // app.calendar = false;
},
cancelAddNew: function(){
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
- app.calendar = false;
+ // app.calendar = false;
if ( loginAccount != '' && this.model.hasMe() ) {
this.$('.glm-add-account').hide();
// console.log('hiding');
addNewAccount: function(){
// Create the new Registrant View
- this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
- this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
- this.$el.append( this.newRegAccountView.render().el );
if ( app.timeSpecific ) {
- // this.setCalendar();
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant({ reg_time: this.model.get( 'selectedTime' ) });
+ } else {
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
}
+ this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
+ this.$el.append( this.newRegAccountView.render().el );
},
toggleClassOpen: function(){
},
updateTimeSelection: function(){
- this.model.set({ selectedTime: this.$('.timeSelection:checked').val() });
+ // Need to remove the newRegModal and views
+ if ( this.newRegAccount ) {
+ this.newRegAccount.destroy();
+ this.newRegAccountView.remove();
+ }
+ this.model.set({ selectedTime: parseInt( this.$('.timeSelection:checked').val() ) });
+ console.log( this.$('.timeSelection:checked').val());
},
render: function(){
if ( loginAccount != '' && this.model.hasMe() ) {
this.$('.glm-add-account').hide();
}
+ if ( !app.timeSpecific ) {
+ this.$('.glm-add-new-account').show();
+ } else {
+ var sTime = this.model.get( 'selectedTime' );
+ if ( !sTime ) {
+ this.$('.glm-add-new-account').hide();
+ } else {
+ this.$('.glm-add-new-account').show();
+ }
+ }
return this;
},
var testDate = new Date( time.start_datetime.datetime );
timeParts.push( {id: time.id,date: testDate} );
});
- console.log( timeParts );
+ // console.log( timeParts );
return timeParts;
},
var state = this.$('.add_reg_state').val().trim();
var zip = this.$('.add_reg_zip').val().trim();
var country = this.$('.add_reg_country').val().trim();
+ if ( app.timeSpecific ) {
+ var sTime = this.model.get( 'selectedTime' );
+ } else {
+ var sTime = null;
+ }
if ( this.$('#add_reg-select-time').length ) {
- var rTime = this.$('#add_reg-select-time').val().trim();
var times = this.model.get( 'times' );
var rateId = null;
// Setup the needed reg_rate
_.each( times, function( time ){
- if ( time.id == rTime ) {
+ if ( time.id == sTime ) {
rateId = time.rate_id;
}
} );
} else {
- var rTime = null;
var times = this.model.get( 'times' );
var rateId = null;
_.each( times, function( time ){
rateId = time.rate_id;
} );
}
- if ( app.timeSpecific && !rTime ) {
+ if ( app.timeSpecific && !sTime ) {
alert( 'You must select a time!' );
return;
}
this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
- reg_time: rTime,
+ reg_time: sTime,
reg_event: this.model.get( 'reg_event' ),
reg_class: this.model.get( 'id' ),
event_name: regEvent.get( 'event_name' ),
}
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
- app.calendar = false;
+ // app.calendar = false;
},
cancelAddNew: function(){
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
- app.calendar = false;
+ // app.calendar = false;
if ( loginAccount != '' && this.model.hasMe() ) {
this.$('.glm-add-account').hide();
// console.log('hiding');
addNewAccount: function(){
// Create the new Registrant View
- this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
- this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
- this.$el.append( this.newRegAccountView.render().el );
if ( app.timeSpecific ) {
- // this.setCalendar();
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant({ reg_time: this.model.get( 'selectedTime' ) });
+ } else {
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
}
+ this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
+ this.$el.append( this.newRegAccountView.render().el );
},
toggleClassOpen: function(){
$registrants = array();
- // echo '<pre>$cart: ' . print_r( $cart, true ) . '</pre>';
+ echo '<pre>$cart: ' . print_r( $cart, true ) . '</pre>';
// Looping through to grab out registrants from the cart.
if ( isset( $cart['events'] ) && is_array( $cart['events'] ) ) {
} // - End loop through events.
}
- // echo '<pre>$registrants: ' . print_r( $registrants, true ) . '</pre>';
+ echo '<pre>$registrants: ' . print_r( $registrants, true ) . '</pre>';
// Compile template data
$templateData = array(
<div class="glm-columns glm-small-12 glm-large-12">
<div class="glm-row">
<span class="glm-reg-level-title"><%= name %></span>
- <span class="reg-class-count"><%= reg_count %> {/literal}{$terms.reg_term_attendee_plur_cap}{literal}</span>
+ <span class="reg-class-count"><%= reg_count %>
+ <% if ( reg_count == 1 ) { %>
+ {/literal}{$terms.reg_term_attendee_cap}{literal}
+ <% } else { %>
+ {/literal}{$terms.reg_term_attendee_plur_cap}{literal}
+ <% } %>
+ </span>
<div class="glm-columns glm-small-12">
<%- descr %>
</div>
<b>Select a time</b>
<% _.each( this.getTimeArray(), function(time){ %>
<label>
- <input class="timeSelection" type="radio" name="timeOption" value="<%= time.id %>" /> <%= time.date.toLocaleTimeString('en-US', {hour: '2-digit', minute: '2-digit'}) %>
+ <input class="timeSelection" type="radio" name="timeOption" value="<%= time.id %>"
+ <% if ( selectedTime == time.id ) { %>
+ checked
+ <% } %>
+ /> <%= time.date.toLocaleTimeString('en-US', {hour: '2-digit', minute: '2-digit'}) %>
</label>
<% }); %>
</div>
{else}
timeSpecific: false,
{/if}
- calendar: false,
};
var regEvent = '';
var cart = '';