this.listenTo( this.model, 'change', this.render );
this.listenTo( this.model.regTimes, 'add', this.render );
+ // Add times into regTimes collection
+ var classTimes = this.model.get('times');
+ for ( var key in classTimes ) {
+ var newTime = new app.Models.Front.RegTime( classTimes[key] );
+ newTime.set({reg_event: this.model.get('reg_event'), parent: this.model});
+ this.model.regTimes.create( newTime );
+ }
+
+ console.log( classTimes );
+
return this;
},
this.listenTo( this.model, 'change', this.render );
this.listenTo( this.model.regTimes, 'add', this.render );
+ // Add times into regTimes collection
+ var classTimes = this.model.get('times');
+ for ( var key in classTimes ) {
+ var newTime = new app.Models.Front.RegTime( classTimes[key] );
+ newTime.set({reg_event: this.model.get('reg_event'), parent: this.model});
+ this.model.regTimes.create( newTime );
+ }
+
+ console.log( classTimes );
+
return this;
},
$jsonClasses = array();
$regClasses = array();
- $regTimes = array();
+ // $regTimes = array();
if ( isset( $regEvent['reg_class'] ) && is_array( $regEvent['reg_class'] ) ) {
if ( $regEvent['time_specific'] ) {
$rClass['selectedTime'] = $time['id'];
}
- if ( empty( $regtimes[$time['id']] ) ) {
- $regTimes[$time['id']] = json_encode( $time, JSON_NUMERIC_CHECK );
- }
+ // if ( empty( $regtimes[$time['id']] ) ) {
+ // $regTimes[$time['id']] = json_encode( $time, JSON_NUMERIC_CHECK );
+ // }
}
$rClass['startingTime'] = $classStartingTime['start_datetime']['datetime'];
$jsonClasses[] = json_encode( $rClass, JSON_NUMERIC_CHECK );
// Build the regClass JSON for the template.
$regClassJSON = '[' . implode( ',', $jsonClasses ) . ']';
$regCartJSON = json_encode( $cart );
- $regTimesJSON = '[' . implode( ',', $regTimes ) . ']';
+ // $regTimesJSON = '[' . implode( ',', $regTimes ) . ']';
// Get terms into JSON
$termsJSON = json_encode( $this->config['terms'] );
'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
'regEventJSON' => json_encode( $event, JSON_NUMERIC_CHECK ),
'regClassesJSON' => $regClassJSON,
- 'regTimesJSON' => $regTimesJSON,
+ // 'regTimesJSON' => $regTimesJSON,
'regCartJSON' => $regCartJSON,
'imgBaseUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL ."/images/",
'regRequestJSON' => $regRequestJSON,
Models: { Front: {}, Admin: {} },
Collections: { Front: {}, Admin: {} },
Views: { Front: {}, Admin: {} },
- Times: {$regTimesJSON},
+ //Times: {$regTimesJSON},
isValidEmail: function( email ){
var regex = {literal}/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;{/literal}
return regex.test(email);