Fixing the add attendee forms. Changing the class used on the new form and the edit ones so they don't get confused in backbone.
Fixed: When adding attendee with the next attempt to add attendee wasn't working.
.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 {
+.new-reg-notime .add_reg_fname,
+.new-reg-notime .add_reg_lname,
+.new-reg-notime .add_reg_addr1,
+.new-reg-notime .add_reg_addr2,
+.new-reg-notime .add_reg_city,
+.new-reg-notime .add_reg_state,
+.new-reg-notime .add_reg_zip,
+.new-reg-notime .add_reg_country {
width: 46%;
margin-right: 1rem;
float: left;
}
-.new-reg-notime .reg_email {
+.new-reg-notime .add_reg_email {
width: 95%;
}
#reg-select-time {
// js/views/app.js
Backbone.emulateJSON = true;
Backbone.emulateHTTP = true;
+Backbone.history.start({ pushState: true, root: thisPageUrl });
// Event Registrant List View
app.Views.Front.App = Backbone.View.extend({
},
addNew: function(){
var findByEmail = [];
- var fname = this.$('.reg_fname').val().trim();
- var lname = this.$('.reg_lname').val().trim();
- var email = this.$('.reg_email').val().trim();
- var addr1 = this.$('.reg_addr1').val().trim();
- var addr2 = this.$('.reg_addr2').val().trim();
- var city = this.$('.reg_city').val().trim();
- var state = this.$('.reg_state').val().trim();
- var zip = this.$('.reg_zip').val().trim();
- var country = this.$('.reg_country').val().trim();
- if ( this.$('#reg-select-time').length ) {
- var rTime = this.$('#reg-select-time').val().trim();
+ var fname = this.$('.add_reg_fname').val().trim();
+ var lname = this.$('.add_reg_lname').val().trim();
+ var email = this.$('.add_reg_email').val().trim();
+ var addr1 = this.$('.add_reg_addr1').val().trim();
+ var addr2 = this.$('.add_reg_addr2').val().trim();
+ var city = this.$('.add_reg_city').val().trim();
+ 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 ( this.$('#add_reg-select-time').length ) {
+ var rTime = this.$('#add_reg-select-time').val().trim();
} else {
var rTime = null;
}
update: function(){
console.log( 'updating model' );
+ var fname = this.$('.reg_fname').val().trim();
+ var lname = this.$('.reg_lname').val().trim();
+ var email = this.$('.reg_email').val().trim();
+ var addr1 = this.$('.reg_addr1').val().trim();
+ var addr2 = this.$('.reg_addr2').val().trim();
+ var city = this.$('.reg_city').val().trim();
+ var state = this.$('.reg_state').val().trim();
+ var zip = this.$('.reg_zip').val().trim();
+ var country = this.$('.reg_country').val().trim();
+ if ( this.$('#reg-select-time').length ) {
+ var rTime = this.$('#reg-select-time').val().trim();
+ } else {
+ var rTime = null;
+ }
+ if ( app.timeSpecific && !rTime ) {
+ alert( 'You must select a time!' );
+ return;
+ }
+ if ( fname === '' || lname === '' ) {
+ alert( 'First and Last name required!' );
+ return;
+ }
// Validate the model
// Have to require reg_time if app.timeSpecific is true
// Get the form values and update the model.
this.model.set({
option: 'update',
- fname: this.$('.reg_fname').val().trim(),
- lname: this.$('.reg_lname').val().trim(),
- addr1: this.$('.reg_addr1').val().trim(),
- addr2: this.$('.reg_addr2').val().trim(),
- city: this.$('.reg_city').val().trim(),
- state: this.$('.reg_state').val().trim(),
- zip: this.$('.reg_zip').val().trim(),
- country: this.$('.reg_country').val().trim(),
- reg_time: this.$('#reg-select-time').val().trim(),
+ fname: fname,
+ lname: lname,
+ addr1: addr1,
+ addr2: addr2,
+ city: city,
+ state: state,
+ zip: zip,
+ country: country,
+ reg_time: rTime
});
- console.log( 'model id' );
- console.log( this.model.get( 'id' ) );
this.model.save();
},
template: _.template( jQuery('#eventReg-registrant-add').html() ),
events: {
- 'focusout .reg_email': 'verifyEmail'
+ 'focusout .add_reg_email': 'verifyEmail'
},
initialize: function(){
},
verifyEmail: function(){
- var email = this.$('.reg_email').val().trim();
+ var email = this.$('.add_reg_email').val().trim();
if ( email == '' ) {
return;
}
// This account already exists.
// They should not be able to edit the record.
console.log( 'Record exists not able to edit!' );
- this.$('.reg_fname').val(account.fname);
- this.$('.reg_lname').val(account.lname);
+ this.$('.add_reg_fname').val(account.fname);
+ this.$('.add_reg_lname').val(account.lname);
// lock the form
this.lockForm();
},
lockForm: function(){
- this.$('.reg_fname').prop('disabled', true);
- this.$('.reg_lname').prop('disabled', true);
- this.$('.reg_addr1').prop('disabled', true);
- this.$('.reg_addr2').prop('disabled', true);
- this.$('.reg_city').prop('disabled', true);
- this.$('.reg_state').prop('disabled', true);
- this.$('.reg_zip').prop('disabled', true);
- this.$('.reg_country').prop('disabled', true);
+ this.$('.add_reg_fname').prop('disabled', true);
+ this.$('.add_reg_lname').prop('disabled', true);
+ this.$('.add_reg_addr1').prop('disabled', true);
+ this.$('.add_reg_addr2').prop('disabled', true);
+ this.$('.add_reg_city').prop('disabled', true);
+ this.$('.add_reg_state').prop('disabled', true);
+ this.$('.add_reg_zip').prop('disabled', true);
+ this.$('.add_reg_country').prop('disabled', true);
},
unLockForm: function(){
- this.$('.reg_fname').prop('disabled', false);
- this.$('.reg_lname').prop('disabled', false);
- this.$('.reg_addr1').prop('disabled', false);
- this.$('.reg_addr2').prop('disabled', false);
- this.$('.reg_city').prop('disabled', false);
- this.$('.reg_state').prop('disabled', false);
- this.$('.reg_zip').prop('disabled', false);
- this.$('.reg_country').prop('disabled', false);
+ this.$('.add_reg_fname').prop('disabled', false);
+ this.$('.add_reg_lname').prop('disabled', false);
+ this.$('.add_reg_addr1').prop('disabled', false);
+ this.$('.add_reg_addr2').prop('disabled', false);
+ this.$('.add_reg_city').prop('disabled', false);
+ this.$('.add_reg_state').prop('disabled', false);
+ this.$('.add_reg_zip').prop('disabled', false);
+ this.$('.add_reg_country').prop('disabled', false);
},
});
// js/views/app.js
Backbone.emulateJSON = true;
Backbone.emulateHTTP = true;
+Backbone.history.start({ pushState: true, root: thisPageUrl });
// Event Registrant List View
app.Views.Front.App = Backbone.View.extend({
},
addNew: function(){
var findByEmail = [];
- var fname = this.$('.reg_fname').val().trim();
- var lname = this.$('.reg_lname').val().trim();
- var email = this.$('.reg_email').val().trim();
- var addr1 = this.$('.reg_addr1').val().trim();
- var addr2 = this.$('.reg_addr2').val().trim();
- var city = this.$('.reg_city').val().trim();
- var state = this.$('.reg_state').val().trim();
- var zip = this.$('.reg_zip').val().trim();
- var country = this.$('.reg_country').val().trim();
- if ( this.$('#reg-select-time').length ) {
- var rTime = this.$('#reg-select-time').val().trim();
+ var fname = this.$('.add_reg_fname').val().trim();
+ var lname = this.$('.add_reg_lname').val().trim();
+ var email = this.$('.add_reg_email').val().trim();
+ var addr1 = this.$('.add_reg_addr1').val().trim();
+ var addr2 = this.$('.add_reg_addr2').val().trim();
+ var city = this.$('.add_reg_city').val().trim();
+ 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 ( this.$('#add_reg-select-time').length ) {
+ var rTime = this.$('#add_reg-select-time').val().trim();
} else {
var rTime = null;
}
update: function(){
console.log( 'updating model' );
+ var fname = this.$('.reg_fname').val().trim();
+ var lname = this.$('.reg_lname').val().trim();
+ var email = this.$('.reg_email').val().trim();
+ var addr1 = this.$('.reg_addr1').val().trim();
+ var addr2 = this.$('.reg_addr2').val().trim();
+ var city = this.$('.reg_city').val().trim();
+ var state = this.$('.reg_state').val().trim();
+ var zip = this.$('.reg_zip').val().trim();
+ var country = this.$('.reg_country').val().trim();
+ if ( this.$('#reg-select-time').length ) {
+ var rTime = this.$('#reg-select-time').val().trim();
+ } else {
+ var rTime = null;
+ }
+ if ( app.timeSpecific && !rTime ) {
+ alert( 'You must select a time!' );
+ return;
+ }
+ if ( fname === '' || lname === '' ) {
+ alert( 'First and Last name required!' );
+ return;
+ }
// Validate the model
// Have to require reg_time if app.timeSpecific is true
// Get the form values and update the model.
this.model.set({
option: 'update',
- fname: this.$('.reg_fname').val().trim(),
- lname: this.$('.reg_lname').val().trim(),
- addr1: this.$('.reg_addr1').val().trim(),
- addr2: this.$('.reg_addr2').val().trim(),
- city: this.$('.reg_city').val().trim(),
- state: this.$('.reg_state').val().trim(),
- zip: this.$('.reg_zip').val().trim(),
- country: this.$('.reg_country').val().trim(),
- reg_time: this.$('#reg-select-time').val().trim(),
+ fname: fname,
+ lname: lname,
+ addr1: addr1,
+ addr2: addr2,
+ city: city,
+ state: state,
+ zip: zip,
+ country: country,
+ reg_time: rTime
});
- console.log( 'model id' );
- console.log( this.model.get( 'id' ) );
this.model.save();
},
template: _.template( jQuery('#eventReg-registrant-add').html() ),
events: {
- 'focusout .reg_email': 'verifyEmail'
+ 'focusout .add_reg_email': 'verifyEmail'
},
initialize: function(){
},
verifyEmail: function(){
- var email = this.$('.reg_email').val().trim();
+ var email = this.$('.add_reg_email').val().trim();
if ( email == '' ) {
return;
}
// This account already exists.
// They should not be able to edit the record.
console.log( 'Record exists not able to edit!' );
- this.$('.reg_fname').val(account.fname);
- this.$('.reg_lname').val(account.lname);
+ this.$('.add_reg_fname').val(account.fname);
+ this.$('.add_reg_lname').val(account.lname);
// lock the form
this.lockForm();
},
lockForm: function(){
- this.$('.reg_fname').prop('disabled', true);
- this.$('.reg_lname').prop('disabled', true);
- this.$('.reg_addr1').prop('disabled', true);
- this.$('.reg_addr2').prop('disabled', true);
- this.$('.reg_city').prop('disabled', true);
- this.$('.reg_state').prop('disabled', true);
- this.$('.reg_zip').prop('disabled', true);
- this.$('.reg_country').prop('disabled', true);
+ this.$('.add_reg_fname').prop('disabled', true);
+ this.$('.add_reg_lname').prop('disabled', true);
+ this.$('.add_reg_addr1').prop('disabled', true);
+ this.$('.add_reg_addr2').prop('disabled', true);
+ this.$('.add_reg_city').prop('disabled', true);
+ this.$('.add_reg_state').prop('disabled', true);
+ this.$('.add_reg_zip').prop('disabled', true);
+ this.$('.add_reg_country').prop('disabled', true);
},
unLockForm: function(){
- this.$('.reg_fname').prop('disabled', false);
- this.$('.reg_lname').prop('disabled', false);
- this.$('.reg_addr1').prop('disabled', false);
- this.$('.reg_addr2').prop('disabled', false);
- this.$('.reg_city').prop('disabled', false);
- this.$('.reg_state').prop('disabled', false);
- this.$('.reg_zip').prop('disabled', false);
- this.$('.reg_country').prop('disabled', false);
+ this.$('.add_reg_fname').prop('disabled', false);
+ this.$('.add_reg_lname').prop('disabled', false);
+ this.$('.add_reg_addr1').prop('disabled', false);
+ this.$('.add_reg_addr2').prop('disabled', false);
+ this.$('.add_reg_city').prop('disabled', false);
+ this.$('.add_reg_state').prop('disabled', false);
+ this.$('.add_reg_zip').prop('disabled', false);
+ this.$('.add_reg_country').prop('disabled', false);
},
});
public function modelAction($actionData = false)
{
+ nocache_headers();
$loginAccount = '';
$cartId = false;
$haveCart = false;
{/literal}{$terms.reg_term_contact_information}{literal}
</div>
<div>
- <input class="reg_fname" placeholder="First Name">
- <input class="reg_lname" placeholder="Last Name">
+ <input class="add_reg_fname" placeholder="First Name">
+ <input class="add_reg_lname" placeholder="Last Name">
</div>
<div>
- <input class="reg_email" placeholder="Email Address" value="<%- email %>">
+ <input class="add_reg_email" placeholder="Email Address" value="<%- email %>">
(Email is optional)
</div>
<div>
- <input class="reg_addr1" placeholder="Address 1">
- <input class="reg_addr2" placeholder="Address 2">
+ <input class="add_reg_addr1" placeholder="Address 1">
+ <input class="add_reg_addr2" placeholder="Address 2">
</div>
<div>
- <input class="reg_city" placeholder="City">
- <input class="reg_state" placeholder="State">
+ <input class="add_reg_city" placeholder="City">
+ <input class="add_reg_state" placeholder="State">
</div>
<div>
- <input class="reg_zip" placeholder="Zip/Postal Code">
- <input class="reg_country" placeholder="Country">
+ <input class="add_reg_zip" placeholder="Zip/Postal Code">
+ <input class="add_reg_country" placeholder="Country">
</div>
{/literal}{if $regEvent.time_specific.value}
<div>
- Selected Time: <span id="reg-select-time-display"></span>
- <input type="hidden" id="reg-select-time">
+ Selected Time: <span id="add_reg-select-time-display"></span>
+ <input type="hidden" id="add_reg-select-time">
</div>
{/if}{literal}
</div>
<input class="reg_lname" placeholder="Last Name" value="<%- lname %>">
</div>
<div>
- <input class="reg_email" placeholder="Email Address" value="<%- email %>">
+ <input class="reg_email" placeholder="Email Address" value="<%- email %>" disabled>
(Email is optional)
</div>
<div>
var appLoginUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=login';
var appAccountUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=account';
var ajaxUrl = '{$ajaxUrl}?action=glm_members_admin_ajax';
+var thisPageUrl = '{$thisUrl}';
var nextPageUrl = '{$thisUrl}?page=cart';
var app = {
Models: { Front: {}, Admin: {} },