hidding the other time selection right now.
},
initialize: function(){
- this.registrants = new app.Collections.Front.RegRequestRegistrants( [] );
+ // this.registrants = new app.Collections.Front.RegRequestRegistrants( [] );
this.regTimes = new app.Collections.Front.RegTimes( [] );
},
// 'click .add-new-registrant': 'addNew',
// 'click .add-new-registrant-cancel': 'cancelAddNew',
'click .timeSelection': 'updateTimeSelection',
+ 'click .fc-event-container': 'updateTimeSelection',
},
updateTimeSelection: function(e){
+ console.log('updateTimeSelection called');
+ var timeId = e.currentTarget.value;
+ // console.log( timeId );
// Check to see if the time is already in the collection
// If it is then do nothing
- var findRegTime = this.model.regTimes.findWhere({ id: e.currentTarget.value });
- if ( !findRegTime ) {
+ console.log(this.model.get('regTimes'));
+
+ 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: parseInt( e.currentTarget.value ) });
// Add the RegTime model/view into this view
// console.log( e.currentTarget.value );
- console.log( app.Times );
+ // console.log( app.Times );
var targetTime = null;
for ( var i = 0; i < app.Times.length; i++ ) {
if ( app.Times[i].id == e.currentTarget.value ) {
},
render: function(){
- this.model.set({ reg_count: this.model.registrants.length });
+ // this.model.set({ reg_count: this.model.registrants.length });
this.$el.html( this.template( this.model.toJSON() ) );
// Go through the RegTimes Collection and render those
// var view = this.model.
// var accountContainer = this.$('.reg-class-accounts');
// accountContainer.append(view);
- if ( app.timeSpecific ) {
- // Need to require that the user select the time before entering attendees.
- }
if ( loginAccount === '' ) {
this.$('.glm-add-account').hide();
}
this.$('.glm-add-new-account').show();
}
}
+ if ( app.timeSpecific ) {
+ // Need to require that the user select the time before entering attendees.
+ this.setCalendar();
+ }
return this;
},
setCalendar: function(){
console.log( 'setting calendar' );
var times = this.model.get( 'times' );
- console.log(times);
- $('#eventCalendar').fullCalendar({
+ // console.log(times);
+ // console.log(app.Times);
+ // console.log(times);
+ // console.log('#eventCalendar-' + this.model.get('id'));
+ $('#eventCalendar-' + this.model.get('id')).fullCalendar({
events: function(start, end, timezone, callback) {
var events = [];
_.each( times, function( time ){
eventClick: function( calEvent, jsEvent, view ){
$('.fc-event').css( 'background-color', '#3a67ad' );
$(this).css( 'background-color', 'red' );
- jQuery( '#add_reg-select-time' ).val( calEvent.reg_time );
- jQuery( '#add_reg-select-time-display' ).html( calEvent.start.format( 'L LT' ) );
+ // jQuery( '#add_reg-select-time' ).val( calEvent.reg_time );
+ // jQuery( '#add_reg-select-time-display' ).html( calEvent.start.format( 'L LT' ) );
},
});
},
},
initialize: function(){
- this.registrants = new app.Collections.Front.RegRequestRegistrants( [] );
+ // this.registrants = new app.Collections.Front.RegRequestRegistrants( [] );
this.regTimes = new app.Collections.Front.RegTimes( [] );
},
// 'click .add-new-registrant': 'addNew',
// 'click .add-new-registrant-cancel': 'cancelAddNew',
'click .timeSelection': 'updateTimeSelection',
+ 'click .fc-event-container': 'updateTimeSelection',
},
updateTimeSelection: function(e){
+ console.log('updateTimeSelection called');
+ var timeId = e.currentTarget.value;
+ // console.log( timeId );
// Check to see if the time is already in the collection
// If it is then do nothing
- var findRegTime = this.model.regTimes.findWhere({ id: e.currentTarget.value });
- if ( !findRegTime ) {
+ console.log(this.model.get('regTimes'));
+
+ 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: parseInt( e.currentTarget.value ) });
// Add the RegTime model/view into this view
// console.log( e.currentTarget.value );
- console.log( app.Times );
+ // console.log( app.Times );
var targetTime = null;
for ( var i = 0; i < app.Times.length; i++ ) {
if ( app.Times[i].id == e.currentTarget.value ) {
},
render: function(){
- this.model.set({ reg_count: this.model.registrants.length });
+ // this.model.set({ reg_count: this.model.registrants.length });
this.$el.html( this.template( this.model.toJSON() ) );
// Go through the RegTimes Collection and render those
// var view = this.model.
// var accountContainer = this.$('.reg-class-accounts');
// accountContainer.append(view);
- if ( app.timeSpecific ) {
- // Need to require that the user select the time before entering attendees.
- }
if ( loginAccount === '' ) {
this.$('.glm-add-account').hide();
}
this.$('.glm-add-new-account').show();
}
}
+ if ( app.timeSpecific ) {
+ // Need to require that the user select the time before entering attendees.
+ this.setCalendar();
+ }
return this;
},
setCalendar: function(){
console.log( 'setting calendar' );
var times = this.model.get( 'times' );
- console.log(times);
- $('#eventCalendar').fullCalendar({
+ // console.log(times);
+ // console.log(app.Times);
+ // console.log(times);
+ // console.log('#eventCalendar-' + this.model.get('id'));
+ $('#eventCalendar-' + this.model.get('id')).fullCalendar({
events: function(start, end, timezone, callback) {
var events = [];
_.each( times, function( time ){
eventClick: function( calEvent, jsEvent, view ){
$('.fc-event').css( 'background-color', '#3a67ad' );
$(this).css( 'background-color', 'red' );
- jQuery( '#add_reg-select-time' ).val( calEvent.reg_time );
- jQuery( '#add_reg-select-time-display' ).html( calEvent.start.format( 'L LT' ) );
+ // jQuery( '#add_reg-select-time' ).val( calEvent.reg_time );
+ // jQuery( '#add_reg-select-time-display' ).html( calEvent.start.format( 'L LT' ) );
},
});
},
<div class="glm-columns glm-small-12 glm-large-12"> <%= reg_rate_name %> </div>
<div class="glm-columns glm-small-12 glm-large-12"> Base Rate: $<%= reg_rate_base_price %> </div>
<div class="glm-columns glm-small-12 glm-large-12"> Per Registrant: $<%= reg_rate_per_reg %> </div>
- <div class="glm-columns glm-small-12 glm-large-12">
+ <div class="glm-columns glm-small-12 glm-large-12 glm-hidden">
<% if ( app.timeSpecific ) { %>
<b>Select a time</b>
<% var curSchedule = ''; %>
</div>
</div>
</div>
- <div class="glm-columns glm-small-12 glm-large-12">
+ <div class="glm-columns glm-small-12 glm-large-6">
<div class="reg-class-detail">
+
<% if ( loggedIn ) { %>
<button class="glm-add-account tiny">Add Me</button>
<% } %>
- <div class="reg-class-times">
- </div>
+ <div class="reg-class-times"> </div>
</div>
</div>
+ <div class="glm-columns glm-small-12 glm-large-6">
+ Calendar to goes here!
+ <div id="eventCalendar-<%= id %>" style="width: 95%;"></div>
+ </div>
</div>
</script>
{/literal}
{/literal}{if $regEvent.time_specific.value}
{/if}{literal}
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-large-6">
+ <div class="glm-columns glm-small-12 glm-large-12">
<h4>{/literal}{$terms.reg_term_contact_information}{literal}</h4>
<div class="glm-row">
<div class="glm-columns glm-large-4 glm-small-12">First Name</div>