// Add times into regTimes collection
var classTimes = this.model.get('times');
- //var timeArs = [];
for ( var key in classTimes ) {
var newTime = new app.Models.Front.RegTime( classTimes[key] );
newTime.set({reg_event: this.model.get('reg_event'), parent: this.model});
- //timeArs.push( newTime );
this.model.regTimes.create( newTime );
}
- //this.model.regTimes.reset( timeArs );
-
- // console.log( classTimes );
-
return this;
},
// used for binding events to the view
events: {
- 'click .addRegistrant': 'newEntry',
- 'click .fc-event-container': 'updateTimeSelection',
- 'click .show-hide-address': 'toggleClass',
+ // 'click .addRegistrant': 'newEntry',
+ // 'click .fc-event-container': 'updateTimeSelection',
+ // 'click .show-hide-address': 'toggleClass',
},
// togle the ereg-addr class for the registrant form
});
},
- // used to add login account to the class
- addAccount: function(){
- // Check to make sure the loginAccount is not empty
- if ( loginAccount !== '' ) {
- this.$('.glm-add-account').hide();
- var regRequest = cart.get( 'request' );
- var accountEmail = loginAccount.get( 'email' );
- var accountId = loginAccount.get( 'id' );
- if ( accountId && accountEmail ) {
- // If the model is already there then don't add
- var findById = this.model.registrants.where({account: accountId});
- if ( findById.length === 0 ) {
- // create the regRequestRegistrant for the account
- registrant = new app.Models.Front.RegRequestRegistrant({
- account: accountId,
- reg_request: regRequest.id,
- reg_event: this.model.get( 'reg_event' ),
- reg_class: this.model.get( 'id' ),
- reg_rate: this.model.get('reg_rate_id'),
- email: accountEmail,
- fname: loginAccount.get('fname'),
- lname: loginAccount.get('lname')
- });
- // this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
- this.newRegAccountView = new app.Views.Front.RegistrantForm({model: registrant});
- this.$el.append( this.newRegAccountView.render().el );
- if ( app.timeSpecific ) {
- // this.setCalendar();
- }
- }
- }
- }
- },
-
// cancel add new
cancelAddNew: function(){
this.$('.glm-add-new-account').show();
this.newRegAccountView.remove();
},
- // add new account
- addNewAccount: function(){
- this.$('.glm-add-new-account').hide();
- // Create the new Registrant View
- if ( app.timeSpecific ) {
- 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 );
- },
-
// For the new entry check the email from the server and see
// if there's already an account setup.
newEntry: function(){
// used to setup initial class
initialize: function(){
this.listenTo( this.model, 'change', this.render );
+
+ // Call the custom fields ajax
+ // if ( this.model.id ) {
+ // this.customFieldFormData = app.setCustomFieldsForm(
+ // this.model.get('reg_event'),
+ // this.model.id,
+ // 'return'
+ // );
+ // }
+
return this;
},
'click .glm-registrant-edit': 'editRegistrant',
'click .update-registrant-cancel': 'cancelEdit',
'click .update-registrant': 'update',
+ 'click .show-hide-address': 'toggleClass',
},
// update the model
app.regEventLock = false;
},
+ toggleClass: function(){
+ this.$('.ereg-addr').toggle();
+ },
+
// cancel the edit of model
cancelEdit: function(){
this.$('.reg-edit-form').hide();
this.$el.html( this.template( this.model.toJSON() ) );
this.$emailInput = this.$('.editEmail');
this.$('.reg-edit-form').hide();
+ // if ( this.customFieldFormData ) {
+ // this.$('.attendee-cf-' + this.model.get('id')).html( this.customFieldFormData );
+ // }
return this;
},
// bind events to the view
events: {
- 'blur input.add_reg_email': 'verifyEmail'
+ 'blur input.add_reg_email': 'verifyEmail',
+ 'click .show-hide-address': 'toggleClass',
},
// setup the view
return this;
},
+ toggleClass: function(){
+ this.$('.ereg-addr').toggle();
+ },
+
// verify the email address
verifyEmail: function(){
var email = this.$('.add_reg_email').val().trim();
// Add times into regTimes collection
var classTimes = this.model.get('times');
- //var timeArs = [];
for ( var key in classTimes ) {
var newTime = new app.Models.Front.RegTime( classTimes[key] );
newTime.set({reg_event: this.model.get('reg_event'), parent: this.model});
- //timeArs.push( newTime );
this.model.regTimes.create( newTime );
}
- //this.model.regTimes.reset( timeArs );
-
- // console.log( classTimes );
-
return this;
},
// used for binding events to the view
events: {
- 'click .addRegistrant': 'newEntry',
- 'click .fc-event-container': 'updateTimeSelection',
- 'click .show-hide-address': 'toggleClass',
+ // 'click .addRegistrant': 'newEntry',
+ // 'click .fc-event-container': 'updateTimeSelection',
+ // 'click .show-hide-address': 'toggleClass',
},
// togle the ereg-addr class for the registrant form
});
},
- // used to add login account to the class
- addAccount: function(){
- // Check to make sure the loginAccount is not empty
- if ( loginAccount !== '' ) {
- this.$('.glm-add-account').hide();
- var regRequest = cart.get( 'request' );
- var accountEmail = loginAccount.get( 'email' );
- var accountId = loginAccount.get( 'id' );
- if ( accountId && accountEmail ) {
- // If the model is already there then don't add
- var findById = this.model.registrants.where({account: accountId});
- if ( findById.length === 0 ) {
- // create the regRequestRegistrant for the account
- registrant = new app.Models.Front.RegRequestRegistrant({
- account: accountId,
- reg_request: regRequest.id,
- reg_event: this.model.get( 'reg_event' ),
- reg_class: this.model.get( 'id' ),
- reg_rate: this.model.get('reg_rate_id'),
- email: accountEmail,
- fname: loginAccount.get('fname'),
- lname: loginAccount.get('lname')
- });
- // this.newRegAccount = new app.Models.Front.RegRequestRegistrant();
- this.newRegAccountView = new app.Views.Front.RegistrantForm({model: registrant});
- this.$el.append( this.newRegAccountView.render().el );
- if ( app.timeSpecific ) {
- // this.setCalendar();
- }
- }
- }
- }
- },
-
// cancel add new
cancelAddNew: function(){
this.$('.glm-add-new-account').show();
this.newRegAccountView.remove();
},
- // add new account
- addNewAccount: function(){
- this.$('.glm-add-new-account').hide();
- // Create the new Registrant View
- if ( app.timeSpecific ) {
- 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 );
- },
-
// For the new entry check the email from the server and see
// if there's already an account setup.
newEntry: function(){
// used to setup initial class
initialize: function(){
this.listenTo( this.model, 'change', this.render );
+
+ // Call the custom fields ajax
+ // if ( this.model.id ) {
+ // this.customFieldFormData = app.setCustomFieldsForm(
+ // this.model.get('reg_event'),
+ // this.model.id,
+ // 'return'
+ // );
+ // }
+
return this;
},
'click .glm-registrant-edit': 'editRegistrant',
'click .update-registrant-cancel': 'cancelEdit',
'click .update-registrant': 'update',
+ 'click .show-hide-address': 'toggleClass',
},
// update the model
app.regEventLock = false;
},
+ toggleClass: function(){
+ this.$('.ereg-addr').toggle();
+ },
+
// cancel the edit of model
cancelEdit: function(){
this.$('.reg-edit-form').hide();
this.$el.html( this.template( this.model.toJSON() ) );
this.$emailInput = this.$('.editEmail');
this.$('.reg-edit-form').hide();
+ // if ( this.customFieldFormData ) {
+ // this.$('.attendee-cf-' + this.model.get('id')).html( this.customFieldFormData );
+ // }
return this;
},