// insert new registrant
insertNew: function(){
+ this.$('#loading-' + this.model.get('id') ).show();
var findByEmail = [];
var fname = this.$('.add_reg_fname').val().trim();
var lname = this.$('.add_reg_lname').val().trim();
}
} else {
findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
+ console.log( findByEmail.length );
+ if ( findByEmail.length > 0 ) {
+ this.$('#loading-' + this.model.get('id') ).hide();
+ }
}
var regRequest = cart.get( 'request' );
var parent = this.model.get('parent');
// to the collection.
var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize();
- this.$('#loading-' + this.model.get('id') ).show();
var newRegistrant = this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
},
errorCallback: function( collection, response ){
- // console.log( 'errorCallback Called' );
- // console.log( response );
+ console.log( 'errorCallback Called' );
+ console.log( response );
},
// cancel add new registrant
// bind events to the view
events: {
'blur input.add_reg_email': 'verifyEmail',
- 'click .show-hide-address': 'toggleClass',
+ // 'click .show-hide-address': 'toggleClass',
+ 'click .lookup-attendee': 'lookupEmail'
},
// setup the view
this.$('.ereg-addr').toggle();
},
- // verify the email address
verifyEmail: function(){
var email = this.$('.add_reg_email').val().trim();
+ var isValidEmail = app.isValidEmail( email );
+ if ( !isValidEmail ) {
+ alert( 'Email must be valid' );
+ this.$('.add_reg_email').val('');
+ return;
+ }
+ },
+
+ // verify the email address
+ lookupEmail: function(){
+ var email = this.$('.lookup_email').val().trim();
if ( email == '' ) {
return;
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
alert( 'Email must be valid' );
- this.$('.add_reg_email').val('');
+ this.$('.lookup_email').val('');
return;
} else {
// Check to see if this is a valid email.
if ( account.id ) {
// This account already exists.
// They should not be able to edit the record.
+ this.$('.add_reg_email').val(account.email);
this.$('.add_reg_fname').val(account.fname);
this.$('.add_reg_lname').val(account.lname);
this.$('.add_reg_addr1').val(account.addr1);
this.$('.add_reg_state').val(account.state);
this.$('.add_reg_zip').val(account.zip);
this.$('.add_reg_country').val(account.country);
-
- // lock the form
- // this.lockForm();
+ // alert( 'Account Found' );
+ this.$('.account-lookup').hide();
} else {
- // They should be able to edit the form
- this.unLockForm();
+ // Notify them nothing found
+ alert( 'Could not find account' );
+ this.$('.add_reg_email').val(email);
}
})
.fail(function(msg){
// insert new registrant
insertNew: function(){
+ this.$('#loading-' + this.model.get('id') ).show();
var findByEmail = [];
var fname = this.$('.add_reg_fname').val().trim();
var lname = this.$('.add_reg_lname').val().trim();
}
} else {
findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
+ console.log( findByEmail.length );
+ if ( findByEmail.length > 0 ) {
+ this.$('#loading-' + this.model.get('id') ).hide();
+ }
}
var regRequest = cart.get( 'request' );
var parent = this.model.get('parent');
// to the collection.
var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize();
- this.$('#loading-' + this.model.get('id') ).show();
var newRegistrant = this.model.registrants.create({
option: 'add',
reg_request: regRequest.id,
},
errorCallback: function( collection, response ){
- // console.log( 'errorCallback Called' );
- // console.log( response );
+ console.log( 'errorCallback Called' );
+ console.log( response );
},
// cancel add new registrant
// bind events to the view
events: {
'blur input.add_reg_email': 'verifyEmail',
- 'click .show-hide-address': 'toggleClass',
+ // 'click .show-hide-address': 'toggleClass',
+ 'click .lookup-attendee': 'lookupEmail'
},
// setup the view
this.$('.ereg-addr').toggle();
},
- // verify the email address
verifyEmail: function(){
var email = this.$('.add_reg_email').val().trim();
+ var isValidEmail = app.isValidEmail( email );
+ if ( !isValidEmail ) {
+ alert( 'Email must be valid' );
+ this.$('.add_reg_email').val('');
+ return;
+ }
+ },
+
+ // verify the email address
+ lookupEmail: function(){
+ var email = this.$('.lookup_email').val().trim();
if ( email == '' ) {
return;
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
alert( 'Email must be valid' );
- this.$('.add_reg_email').val('');
+ this.$('.lookup_email').val('');
return;
} else {
// Check to see if this is a valid email.
if ( account.id ) {
// This account already exists.
// They should not be able to edit the record.
+ this.$('.add_reg_email').val(account.email);
this.$('.add_reg_fname').val(account.fname);
this.$('.add_reg_lname').val(account.lname);
this.$('.add_reg_addr1').val(account.addr1);
this.$('.add_reg_state').val(account.state);
this.$('.add_reg_zip').val(account.zip);
this.$('.add_reg_country').val(account.country);
-
- // lock the form
- // this.lockForm();
+ // alert( 'Account Found' );
+ this.$('.account-lookup').hide();
} else {
- // They should be able to edit the form
- this.unLockForm();
+ // Notify them nothing found
+ alert( 'Could not find account' );
+ this.$('.add_reg_email').val(email);
}
})
.fail(function(msg){
{/if}{literal}
<div>
<div>
+ <div class="row account-lookup">
+ <div class="columns small-12">
+ Search for existing Account
+ </div>
+ </div>
+ <div class="row account-lookup">
+ <div class="columns large-6 small-12"><input placeholder="Enter Email Address" class="lookup_email" value=""></div>
+ <div class="columns large-6 small-12 text-right">
+ <input class="lookup-attendee button" value="Search by Email" type="submit">
+ </div>
+ </div>
<h4>{/literal}{$terms.reg_term_attendee_cap} Info{literal}</h4>
<div class="row">
<div class="columns small-12 text-right glm-reg-required">