this.regTimes = new app.Collections.Front.RegTimes( [] );
},
- // setRegistrants: function( registrants ) {
- // this.registrants.reset( registrants );
- // },
-
- // Check to see if the current login user in the list of registrants
- // hasMe: function() {
- // return false;
- // if ( loginAccount ) {
- // var foundMe = this.registrants.findWhere({ account: loginAccount.get( 'id' ) });
- // if ( foundMe ) {
- // return true;
- // } else {
- // return false;
- // }
- // return true;
- // } else {
- // return false;
- // }
- // },
-
});
// js/models/regEvent.js
var foundClass = this.classes.findWhere({ id: registrants[i].class_id });
// console.log(foundClass);
if ( foundClass != undefined ) {
- var foundRegTime = _.findWhere(app.Times, { id: registrants[i].reg_time });
+ // Try looking through the class times
+ // console.log(foundClass);
+ // var foundRegTime = foundClass.regTimes.findWhere({id: registrants[i].reg_time});
+ var foundRegTime = _.findWhere(foundClass.get('times'), { id: registrants[i].reg_time });
+ // console.log(foundRegTime);
+ // return;
+ // var foundRegTime = _.findWhere(app.Times, { id: registrants[i].reg_time });
// Now add the time if needed
var hasRegTime = _.findWhere(foundClass, { reg_time: foundRegTime.id });
// console.log(hasRegTime);
events: {
'click .addRegistrant': 'newEntry',
- // 'click .glm-add-account': 'addAccount',
- // 'click .glm-add-new-account': 'addNewAccount',
- // 'click .add-new-registrant': 'addNew',
- // 'click .add-new-registrant-cancel': 'cancelAddNew',
- // 'click .timeSelection': 'updateTimeSelection',
'click .fc-event-container': 'updateTimeSelection',
'click .show-hide-address': 'toggleClass',
},
},
updateTimeSelection: function(e){
- console.log('updateTimeSelection called');
var timeId = this.$('.timeSelection').val().trim();
- console.log( timeId );
// Check to see if the time is already in the collection
// If it is then do nothing
- console.log(this.model.regTimes.length);
-
var findRegTime = this.model.regTimes.where({ id: timeId });
- console.log(findRegTime.length);
+
if ( findRegTime.length == 0 ) {
- console.log('regTime not found, creating one.');
this.model.set({ selectedTime: timeId });
// Add the RegTime model/view into this view
- // console.log( app.Times );
- var targetTime = null;
- for ( var i = 0; i < app.Times.length; i++ ) {
- if ( app.Times[i].id == timeId ) {
- targetTime = app.Times[i];
+ var classTimes = this.model.get('times');
+ var targetTime = {};
+ for ( var key in classTimes ) {
+ if ( classTimes[key].id == timeId ) {
+ targetTime = classTimes[key];
}
}
if ( targetTime ) {
var selectedTime = new app.Models.Front.RegTime( targetTime );
selectedTime.set({parent: this.model});
- console.log('creating time entry');
- console.log(selectedTime);
this.model.regTimes.create( selectedTime );
}
}
// this.$('.glm-add-account').hide();
// }
if ( !app.timeSpecific ) {
- this.$('.glm-add-new-account').show();
+ console.log('Should be showing the add attendee part now');
+ // this.$('.glm-add-new-account').show();
+ this.updateTimeSelection();
} else {
var sTime = this.model.get( 'selectedTime' );
if ( !sTime ) {
$('.fc-event').css( 'background-color', '#3a67ad' );
$(this).css( 'background-color', 'red' );
jQuery( '.timeSelection' ).val( calEvent.reg_time );
- // jQuery( '#add_reg-select-time-display' ).html( calEvent.start.format( 'L LT' ) );
},
});
},
var times = this.model.get( 'times' );
}
var rateId = this.model.get( 'rate_id' );
+ console.log(rateId);
if ( !rateId ) {
// console.log( 'No rate id!' );
// console.log( sTime );