Pulling in the custom fields into the add attendee form.
// Go through the RegTimes Collection and render those
// var view = this.model.
// this.model.regTimes.sort();
+ // var classId = this.model.id;
var view = this.model.regTimes.map(function(item){
+ // item.parent = classId;
return (new app.Views.Front.RegTime({ model: item })).render().el;
});
var timeContainer = this.$('.reg-class-times');
if ( app.timeSpecific ) {
this.newRegAccount = new app.Models.Front.RegRequestRegistrant({ reg_time: this.model.get( 'selectedTime' ) });
} else {
- this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
+ // console.log(this.model);
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant({
+ reg_event: this.model.get('reg_event'),
+ reg_class: this.model.get('parent')
+ });
}
this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
this.$el.append( this.newRegAccountView.render().el );
if ( !parent ) {
return;
}
+
if ( findByEmail.length === 0 ) {
- this.model.registrants.create({
+ var newRegistrant = this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
reg_time: this.model.get( 'id' ),
reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
- // event_name: regEvent.get( 'event_name' ),
reg_rate: rateId,
email: email,
fname: fname,
zip: zip,
country: country,
});
+ // console.log( newRegistrant );
}
+
+ // return false;
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
// render the view
render: function(){
this.$el.html( this.template( this.model.toJSON() ) );
+ // console.log( this.model.get('reg_event') );
+ this.setCustomFieldsForm();
return this;
},
+ setCustomFieldsForm: function(){
+ var formData = {
+ 'action': 'glm_members_admin_ajax',
+ 'glm_action': 'customFieldsFront',
+ 'option': 'displayForm',
+ 'fid': 'glm_reg_customfields_reg_event_attendee_' + this.model.get('reg_event'),
+ 'recordId': '1',
+ 'parentFormId': 'abc-123',
+ 'formData': false
+ };
+ $.ajax({
+ type: 'POST',
+ url: ajaxUrl,
+ data: formData,
+ encode: true,
+ dataType: 'text'
+ })
+ .done( function( formHtml ) {
+ $('.attendee-cf').html( formHtml );
+ });
+ },
+
// verify the email address
verifyEmail: function(){
var email = this.$('.add_reg_email').val().trim();
// Go through the RegTimes Collection and render those
// var view = this.model.
// this.model.regTimes.sort();
+ // var classId = this.model.id;
var view = this.model.regTimes.map(function(item){
+ // item.parent = classId;
return (new app.Views.Front.RegTime({ model: item })).render().el;
});
var timeContainer = this.$('.reg-class-times');
if ( app.timeSpecific ) {
this.newRegAccount = new app.Models.Front.RegRequestRegistrant({ reg_time: this.model.get( 'selectedTime' ) });
} else {
- this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
+ // console.log(this.model);
+ this.newRegAccount = new app.Models.Front.RegRequestRegistrant({
+ reg_event: this.model.get('reg_event'),
+ reg_class: this.model.get('parent')
+ });
}
this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount});
this.$el.append( this.newRegAccountView.render().el );
if ( !parent ) {
return;
}
+
if ( findByEmail.length === 0 ) {
- this.model.registrants.create({
+ var newRegistrant = this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
reg_time: this.model.get( 'id' ),
reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
- // event_name: regEvent.get( 'event_name' ),
reg_rate: rateId,
email: email,
fname: fname,
zip: zip,
country: country,
});
+ // console.log( newRegistrant );
}
+
+ // return false;
// this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
// render the view
render: function(){
this.$el.html( this.template( this.model.toJSON() ) );
+ // console.log( this.model.get('reg_event') );
+ this.setCustomFieldsForm();
return this;
},
+ setCustomFieldsForm: function(){
+ var formData = {
+ 'action': 'glm_members_admin_ajax',
+ 'glm_action': 'customFieldsFront',
+ 'option': 'displayForm',
+ 'fid': 'glm_reg_customfields_reg_event_attendee_' + this.model.get('reg_event'),
+ 'recordId': '1',
+ 'parentFormId': 'abc-123',
+ 'formData': false
+ };
+ $.ajax({
+ type: 'POST',
+ url: ajaxUrl,
+ data: formData,
+ encode: true,
+ dataType: 'text'
+ })
+ .done( function( formHtml ) {
+ $('.attendee-cf').html( formHtml );
+ });
+ },
+
// verify the email address
verifyEmail: function(){
var email = this.$('.add_reg_email').val().trim();
.done( function(formHtml) {
$('#test-form-container').html(formHtml);
});
-
+
});
});
<h1 id="glm-reg-event-name"><%= event_name %></h1>
<div class="row">
{/literal}
-
+
{if $regEvent.image}
- <div class="small-12 medium-6 large-4 columns glm-reg-image-container">
+ <div class="small-12 medium-6 large-4 columns glm-reg-image-container">
<img src="{$imgBaseUrl}/medium/{$regEvent.image}"/>
</div>
{/if}
<div class="small-12 medium-6 large-5 columns glm-reg-event-profile-details-container">
-
+
<div class="row">
<div class="small-12 columns glm-reg-event-profile-details glm-reg-date"> {$regEvent.first_datetime.timestamp|date_format:"%A, %B %e, %Y"}</div>
<div class="small-12 columns glm-reg-event-profile-details glm-reg-time"> {$regEvent.first_datetime.timestamp|date_format:"%l:%M %p"}</div>
{/if}
{if $regEvent.locations.name || $regEvent.locations.address}
- <div class="small-12 columns glm-reg-event-profile-details glm-reg-location">
+ <div class="small-12 columns glm-reg-event-profile-details glm-reg-location">
{$regEvent.locations.name}
{if $regEvent.locations.address}
<br>{$regEvent.locations.address}
<div class="columns small-12 glm-reg-class-container">
<div class="row glm-reg-event-details">
<span class="columns small-12 large-3 glm-reg-level-title glm-reg-level-info"><%= name %></span>
-
+
<!-- <div class="columns small-12 large-2 glm-reg-level-info"> <%= reg_rate_name %> </div>-->
<% if( reg_rate_base_price ){ %>
<div class="columns small-12 large-2 glm-reg-level-info"> Base Rate: $<%= reg_rate_base_price %> </div>
<div class="row reg-class-detail collapsed">
<div class="reg-class-times"> </div>
-
+
<% if ( app.timeSpecific ) { %>
<div class="glm-reg-warning show-for-medium-up">
<!-- Please select a Date / Time!
<div class="columns large-4 small-12">Email Address</div>
<div class="columns large-8 small-12"><input class="add_reg_email" value="<%- email %>"></div>
</div>
+ <div class="attendee-cf"></div>
<div>
<a class="show-hide-address">Address (show/hide)</a>
</div>
},
regEventLock: false,
checkForEditLock: function(){
- console.log(app.regEventLock);
if ( app.regEventLock === true ) {
alert('Please complete your other edit first.');
return true;
regEvent.setClasses( {$regClassesJSON} );
regEvent.setClassRegistrants( {$regJSON} );
var glmApp = new app.Views.Front.App();
-
+
$("#glm-reg-detail-map-button").click(function() {
var map_container = "#glm-reg-map-container";
var map = "#glm-reg-map";
var mapNewH = 0;
var mapOverflow = 'hidden';
var mapBtnTxt = 'view map';
-
+
if ($(map_container).height() == 0) {
mapNewH = 250;
mapV = 'visible';
// Set default - Need to make this configurable
var map = new google.maps.Map(document.getElementById('glm-reg-map'), {
zoom: {$settings.maps_default_zoom},
- center: eventlocation,
+ center: eventlocation,
disableDefaultUI: false,
mapTypeId: google.maps.MapTypeId.MAP,
});
-
+
// Create a marker for this event
{if $regEvent.locations.lat !=0 && $regEvent.locations.lon != 0}
var marker = new google.maps.Marker({
return false;
});
var reg_class_detail = "#regApp .glm-reg-event-details";
-
+
$(reg_class_detail).click(function() {
$(this).parent().children(".reg-class-detail").slideToggle("fast", "swing", function() {});
$(this).parent().children(".reg-class-detail").toggleClass("collapsed");
-
+
});
});
</script>