Using the attendee_max_per_reg. if not 0.
nRegTime.save();
// console.log(nRegTime);
// console.log('total registrants: ' + nRegTime.registrants.length);
-
+ app.attendeeCount++;
}
}
// Need to release the lock if they want to delete the attendee
app.regEventLock = false;
+ // Delete the count
+ app.attendeeCount--;
+
this.remove();
},
// add new account
addNewAccount: function(){
+ if ( app.checkForMaxAttendees() === true ) {
+ alert( 'You\'re only allowed to have ' + app.attendeeMaxPerReg + ' ' + app.attendeePlurCapTerm + ' per Registration!' );
+ return;
+ }
// check for the lock
if ( app.checkForEditLock() === true ) {
return;
return;
}
if ( email === '' ) {
- var confAnsw = confirm( 'You did not supply an Email address! Are you sure you want to add this registrant?' );
- if ( !confAnsw ) {
- // Hide the loading graphic
- this.$('#loading-' + this.model.get('id') ).hide();
- return;
- }
+ // var confAnsw = confirm( 'You did not supply and Email address! Are you sure you want to add this registrant?' );
+ // if ( !confAnsw ) {
+ // // Hide the loading graphic
+ // this.$('#loading-' + this.model.get('id') ).hide();
+ // return;
+ // }
} else {
findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
if ( findByEmail.length > 0 ) {
this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
+
+ // Add the count
+ app.attendeeCount++;
},
successCallback: function( collection, repsonse ){
nRegTime.save();
// console.log(nRegTime);
// console.log('total registrants: ' + nRegTime.registrants.length);
-
+ app.attendeeCount++;
}
}
// Need to release the lock if they want to delete the attendee
app.regEventLock = false;
+ // Delete the count
+ app.attendeeCount--;
+
this.remove();
},
// add new account
addNewAccount: function(){
+ if ( app.checkForMaxAttendees() === true ) {
+ alert( 'You\'re only allowed to have ' + app.attendeeMaxPerReg + ' ' + app.attendeePlurCapTerm + ' per Registration!' );
+ return;
+ }
// check for the lock
if ( app.checkForEditLock() === true ) {
return;
return;
}
if ( email === '' ) {
- var confAnsw = confirm( 'You did not supply and Email address! Are you sure you want to add this registrant?' );
- if ( !confAnsw ) {
- // Hide the loading graphic
- this.$('#loading-' + this.model.get('id') ).hide();
- return;
- }
+ // var confAnsw = confirm( 'You did not supply and Email address! Are you sure you want to add this registrant?' );
+ // if ( !confAnsw ) {
+ // // Hide the loading graphic
+ // this.$('#loading-' + this.model.get('id') ).hide();
+ // return;
+ // }
} else {
findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
if ( findByEmail.length > 0 ) {
this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
+
+ // Add the count
+ app.attendeeCount++;
},
successCallback: function( collection, repsonse ){
{$reg_bulletin}
</div>
{/if}
-
+
{if $settings.reg_not_submitted_dialog}
<div id="regNotSubmittedDialog" title="PLEASE NOTE!">
<p class="glm-reg-warning">
return regex.test(email);
},
regEventLock: false,
+ attendeeCount: 0,
+ attendeeMaxPerReg: parseInt( {$regEvent.attendee_max_per_reg} ),
+ attendeePlurCapTerm: '{$terms.reg_term_attendee_plur_cap}',
+ checkForMaxAttendees: function(){
+ if ( app.attendeeMaxPerReg ) {
+ // Here we need to see how many registrants total in each class.
+ if ( app.attendeeCount >= app.attendeeMaxPerReg ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ },
checkForEditLock: function(){
if ( app.regEventLock === true ) {
alert('Please complete your other edit first.');
// Registration not submitted Dialog actions
- {if $settings.reg_not_submitted_dialog}
+ {if $settings.reg_not_submitted_dialog}
var notSubmittedTimer;
notSubmittedDialog = $( "#regNotSubmittedDialog" ).dialog({
open: function(event,ui) {
clearInterval(notSubmittedTimer);
},
- close: function(event,ui) {
+ close: function(event,ui) {
resetNotSubmittedTimer();
},
buttons: [
});
startNotSubmittedTimer();
- {/if}
-
+ {/if}
+
});
</script>