'js/model/admin/*.js',
'js/collections/admin/*.js',
'js/views/admin/*.js',
- ], {awaitWriteFinish: true}, ['adminscripts']);
+ ], ['adminscripts']);
gulp.watch([
'js/model/front/*.js',
'js/collections/front/*.js',
this.parent = parent;
},
- //localStorage: new Backbone.LocalStorage( 'Accounts-' ),
+ url: ajaxUrl+'&glm_action=regFront&collection=accounts',
- urlBase: function(){
- return appAccountUrl;
- },
-
- // sync: function( method, model, options ){
- // console.log('sync called on collection. method: ' + method );
- // //console.log( method );
- // switch( method ){
- // case 'create':
- // console.log('Create called on Accounts' + model);
- // break;
- // case 'read':
- // console.log('Read called on Accounts' + model);
- // break;
- // case 'update':
- // console.log('Update called on Accounts' + model);
- // break;
- // case 'delete':
- // console.log('Delete called on Accounts' + model);
- // break;
- // }
- //
+ // create: function( model ){
+ // console.log( model );
+ // //model.save();
+ // //localStorage.setItem('Account-' + model.parent + '-'+ model.id, JSON.stringify( model ) );
+ // //this.add( model );
// },
- create: function( model ){
- localStorage.setItem('Account-' + model.parent + '-'+ model.id, JSON.stringify( model ) );
- this.add( model );
- },
-
remove: function( model ){
localStorage.removeItem( localStorage.key('Account-' + model.parent + '-'+ model.id ) );
- console.log( 'Delete called in collection ' );
+ //console.log( 'Delete called in collection ' );
},
read: function(){
parent: '',
},
- url: function(){
- return appAccountUrl + '?model=' + this.id;
- },
-
- sync: function( method, model ){
- // console.log( 'sync in model' );
- // console.log( method );
- // console.log( model );
- switch ( method ) {
- case 'delete':
- console.log( 'Delete called in account model' );
- break;
- }
- return false; //Backbone.sync.apply(this, arguments);
+ url: ajaxUrl+'&glm_action=regFront&collection=account',
- },
+ // sync: function( method, model ){
+ // console.log( 'sync in model' );
+ // // console.log( method );
+ // // console.log( model );
+ // switch ( method ) {
+ // case 'delete':
+ // console.log( 'Delete called in account model' );
+ // break;
+ // }
+ // Backbone.sync.apply(this, arguments);
+ //
+ // },
initialize: function(){
this.on( 'invalid', function( model, error ){
}
},
- // save: function( model, options ){
- // console.log( 'Save called on model account' );
- // console.log( this );
- // console.log( model );
- // console.log( options );
- // get the localStorage item and update it
- // localStorage.setItem(
- // 'Account-' + this.parent + '-'+ this.id,
- // JSON.stringify({id: this.id, email: this.email, parent: this.parent})
- // );
- // },
-
});
// js/models/accountDetail.js
accounts: [],
times: [],
request: {},
+ events: [],
},
setRequest: function( request ){
this.request = new app.Models.Front.Request( request );
- this.request.save();
+ //this.request.save();
},
setAccounts: function( accounts ){
defaults: {
id: null,
account: null,
- account_fname: '',
- account_lname: '',
+ validated: false,
+ validation_message: '',
+ bill_fname: '',
+ bill_lname: '',
+ bill_org: '',
+ bill_title: '',
+ bill_addr1: '',
+ bill_addr2: '',
+ bill_city: '',
+ bill_state: '',
+ bill_zip: '',
+ bill_country: '',
+ date_submitted: '',
+ pay_method: '',
+ status: '',
+ total: '',
+ cc_type: '',
+ cc_name: '',
+ cc_numb: '',
+ cc_exp: '',
+ cc_cvv: '',
+ cc_conf: '',
+ summary: '',
+ mf_data: '',
+ notes: '',
+ user_trace_info: '',
+ last_update: '',
},
url: ajaxUrl+'&glm_action=regFront&collection=request',
this.parent = parent;
},
- //localStorage: new Backbone.LocalStorage( 'Accounts-' ),
-
- urlBase: function(){
- return appAccountUrl;
- },
+ url: ajaxUrl+'&glm_action=regFront&collection=accounts',
- // sync: function( method, model, options ){
- // console.log('sync called on collection. method: ' + method );
- // //console.log( method );
- // switch( method ){
- // case 'create':
- // console.log('Create called on Accounts' + model);
- // break;
- // case 'read':
- // console.log('Read called on Accounts' + model);
- // break;
- // case 'update':
- // console.log('Update called on Accounts' + model);
- // break;
- // case 'delete':
- // console.log('Delete called on Accounts' + model);
- // break;
- // }
- //
+ // create: function( model ){
+ // console.log( model );
+ // //model.save();
+ // //localStorage.setItem('Account-' + model.parent + '-'+ model.id, JSON.stringify( model ) );
+ // //this.add( model );
// },
- create: function( model ){
- localStorage.setItem('Account-' + model.parent + '-'+ model.id, JSON.stringify( model ) );
- this.add( model );
- },
-
remove: function( model ){
localStorage.removeItem( localStorage.key('Account-' + model.parent + '-'+ model.id ) );
- console.log( 'Delete called in collection ' );
+ //console.log( 'Delete called in collection ' );
},
read: function(){
this.cart = cart;
this.event = new app.Views.Front.RegEvent({ model: regEvent });
this.render();
+ // var regRequest = cart.get( 'request' );
+ // console.log( regRequest.id );
},
render: function(){
},
events: {
- 'click #appLogin': 'login'
+ 'click #appLogin': 'login',
+ 'click #glm-reg-cart-continue': 'continue',
+ },
+
+ continue: function(){
+ console.log( cart );
+ // Need to update the cart
+
},
login: function(){
template: _.template( jQuery('#regClass-template').html() ),
initialize: function(){
+ this.model.accounts.fetch();
+
this.listenTo( this.model.accounts, 'add', this.addOne );
this.listenTo( this.model.accounts, 'create', this.addOne );
- this.listenTo( this.model.accounts, 'reset', this.addAll );
- this.listenTo( this.model, 'change', this.updateCount );
+ //this.listenTo( this.model.accounts, 'reset', this.addAll );
+ //this.listenTo( this.model.accounts, 'all', this.render );
+ this.listenTo( this.model, 'change', this.render );
- this.model.accounts.fetch();
return this;
},
- deleteOne: function(){
- console.log( 'Delete called' );
- //console.log( event );
+ render: function(){
+ this.model.set({ reg_count: this.model.accounts.length });
+ this.$el.html( this.template( this.model.toJSON() ) );
+ // Need to see if this class has attendees and render them
+ var view = this.model.accounts.map(function(item){
+ return (new app.Views.Front.Account({ model: item })).render().el;
+ });
+ var accountContainer = this.$('.reg-class-accounts');
+ accountContainer.append(view);
+ return this;
+ },
+
+ deleteOne: function( item ){
+ console.log( item );
+ console.log( 'Delete called in view' );
+ console.log( this.model.accounts.length );
+ this.render();
},
events: {
'click .addRegistrant': 'newEntry',
- 'click .toggle-class-open': 'toggleClassOpen',
- 'click .toggle-class-close': 'toggleClassClose',
+ // 'click .toggle-class-open': 'toggleClassOpen',
+ // 'click .toggle-class-close': 'toggleClassClose',
//'click .glm-reg-level-registrant-delete': 'deleteOne',
},
email: account.email,
parent: this.model.id
});
- this.model.trigger('change');
+ //this.model.trigger('change');
this.$newEmail.val('');
} else if ( account.email !== undefined ) {
// use the dummy id
email: account.email,
parent: this.model.id
});
- this.model.trigger('change');
+ //this.model.trigger('change');
this.$newEmail.val('');
}
})
});
},
- render: function(){
- this.model.set({ reg_count: this.model.accounts.length });
- this.$el.html( this.template( this.model.toJSON() ) );
- // Need to see if this class has attendees and render them
- var view = this.model.accounts.map(function(item){
- return (new app.Views.Front.Account({ model: item })).render().el;
- });
- var accountContainer = this.$('.reg-class-accounts');
- accountContainer.append(view);
- return this;
- },
-
- updateCount: function(){
- this.model.set({ reg_count: this.model.accounts.length });
- this.render();
- },
+ // updateCount: function(){
+ // this.model.set({ reg_count: this.model.accounts.length });
+ // this.render();
+ // },
addOne: function( item ){
- if ( item.isValid() ) {
- var view = new app.Views.Front.Account({ model: item });
- this.$el.append( view.render().el );
- }
+ this.render();
+ // if ( item.isValid() ) {
+ // var view = new app.Views.Front.Account({ model: item });
+ // this.$el.append( view.render().el );
+ // }
},
addAll: function(){
parent: '',
},
- url: function(){
- return appAccountUrl + '?model=' + this.id;
- },
-
- sync: function( method, model ){
- // console.log( 'sync in model' );
- // console.log( method );
- // console.log( model );
- switch ( method ) {
- case 'delete':
- console.log( 'Delete called in account model' );
- break;
- }
- return false; //Backbone.sync.apply(this, arguments);
-
- },
+ url: ajaxUrl+'&glm_action=regFront&collection=account',
+
+ // sync: function( method, model ){
+ // console.log( 'sync in model' );
+ // // console.log( method );
+ // // console.log( model );
+ // switch ( method ) {
+ // case 'delete':
+ // console.log( 'Delete called in account model' );
+ // break;
+ // }
+ // Backbone.sync.apply(this, arguments);
+ //
+ // },
initialize: function(){
this.on( 'invalid', function( model, error ){
}
},
- // save: function( model, options ){
- // console.log( 'Save called on model account' );
- // console.log( this );
- // console.log( model );
- // console.log( options );
- // get the localStorage item and update it
- // localStorage.setItem(
- // 'Account-' + this.parent + '-'+ this.id,
- // JSON.stringify({id: this.id, email: this.email, parent: this.parent})
- // );
- // },
-
});
accounts: [],
times: [],
request: {},
+ events: [],
},
setRequest: function( request ){
this.request = new app.Models.Front.Request( request );
- this.request.save();
+ //this.request.save();
},
setAccounts: function( accounts ){
defaults: {
id: null,
account: null,
- account_fname: '',
- account_lname: '',
+ validated: false,
+ validation_message: '',
+ bill_fname: '',
+ bill_lname: '',
+ bill_org: '',
+ bill_title: '',
+ bill_addr1: '',
+ bill_addr2: '',
+ bill_city: '',
+ bill_state: '',
+ bill_zip: '',
+ bill_country: '',
+ date_submitted: '',
+ pay_method: '',
+ status: '',
+ total: '',
+ cc_type: '',
+ cc_name: '',
+ cc_numb: '',
+ cc_exp: '',
+ cc_cvv: '',
+ cc_conf: '',
+ summary: '',
+ mf_data: '',
+ notes: '',
+ user_trace_info: '',
+ last_update: '',
},
url: ajaxUrl+'&glm_action=regFront&collection=request',
this.cart = cart;
this.event = new app.Views.Front.RegEvent({ model: regEvent });
this.render();
+ // var regRequest = cart.get( 'request' );
+ // console.log( regRequest.id );
},
render: function(){
},
events: {
- 'click #appLogin': 'login'
+ 'click #appLogin': 'login',
+ 'click #glm-reg-cart-continue': 'continue',
+ },
+
+ continue: function(){
+ console.log( cart );
+ // Need to update the cart
+
},
login: function(){
template: _.template( jQuery('#regClass-template').html() ),
initialize: function(){
+ this.model.accounts.fetch();
+
this.listenTo( this.model.accounts, 'add', this.addOne );
this.listenTo( this.model.accounts, 'create', this.addOne );
- this.listenTo( this.model.accounts, 'reset', this.addAll );
- this.listenTo( this.model, 'change', this.updateCount );
+ //this.listenTo( this.model.accounts, 'reset', this.addAll );
+ //this.listenTo( this.model.accounts, 'all', this.render );
+ this.listenTo( this.model, 'change', this.render );
- this.model.accounts.fetch();
return this;
},
- deleteOne: function(){
- console.log( 'Delete called' );
- //console.log( event );
+ render: function(){
+ this.model.set({ reg_count: this.model.accounts.length });
+ this.$el.html( this.template( this.model.toJSON() ) );
+ // Need to see if this class has attendees and render them
+ var view = this.model.accounts.map(function(item){
+ return (new app.Views.Front.Account({ model: item })).render().el;
+ });
+ var accountContainer = this.$('.reg-class-accounts');
+ accountContainer.append(view);
+ return this;
+ },
+
+ deleteOne: function( item ){
+ console.log( item );
+ console.log( 'Delete called in view' );
+ console.log( this.model.accounts.length );
+ this.render();
},
events: {
'click .addRegistrant': 'newEntry',
- 'click .toggle-class-open': 'toggleClassOpen',
- 'click .toggle-class-close': 'toggleClassClose',
+ // 'click .toggle-class-open': 'toggleClassOpen',
+ // 'click .toggle-class-close': 'toggleClassClose',
//'click .glm-reg-level-registrant-delete': 'deleteOne',
},
email: account.email,
parent: this.model.id
});
- this.model.trigger('change');
+ //this.model.trigger('change');
this.$newEmail.val('');
} else if ( account.email !== undefined ) {
// use the dummy id
email: account.email,
parent: this.model.id
});
- this.model.trigger('change');
+ //this.model.trigger('change');
this.$newEmail.val('');
}
})
});
},
- render: function(){
- this.model.set({ reg_count: this.model.accounts.length });
- this.$el.html( this.template( this.model.toJSON() ) );
- // Need to see if this class has attendees and render them
- var view = this.model.accounts.map(function(item){
- return (new app.Views.Front.Account({ model: item })).render().el;
- });
- var accountContainer = this.$('.reg-class-accounts');
- accountContainer.append(view);
- return this;
- },
-
- updateCount: function(){
- this.model.set({ reg_count: this.model.accounts.length });
- this.render();
- },
+ // updateCount: function(){
+ // this.model.set({ reg_count: this.model.accounts.length });
+ // this.render();
+ // },
addOne: function( item ){
- if ( item.isValid() ) {
- var view = new app.Views.Front.Account({ model: item });
- this.$el.append( view.render().el );
- }
+ this.render();
+ // if ( item.isValid() ) {
+ // var view = new app.Views.Front.Account({ model: item });
+ // this.$el.append( view.render().el );
+ // }
},
addAll: function(){
*/
public function modelAction( $actionData = false )
{
- static $accountId = 10;
+ //static $accountId = 10;
$return = false;
- $option = filter_var( ~_REQUEST['option'], FILTER_SANITIZE_STRING );
+ $option = filter_var( $_REQUEST['option'], FILTER_SANITIZE_STRING );
switch ( $option ) {
case 'login':
$collection = filter_var( $_REQUEST['collection'], FILTER_SANITIZE_STRING );
// If not a valid collection, die quietly
- if (!in_array($collection, array('regClasses', 'request'))) {
+ if (!in_array($collection, array('regClasses', 'request', 'account'))) {
wp_die();
}
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations AJAX processing for Registration Request Events
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release regRequestEvent.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Load Registrations data abstract
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
+
+class GlmMembersAdmin_registrations_ajax_account extends GlmDataRegistrationsRegRequest
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /**
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Run constructor for the REgistrations data class
+ *
+ * Note, the third parameter is a flag that indicates to the Contacts
+ * data class that it should flag a group of fields as 'view_only'.
+ */
+ parent::__construct(false, false, true);
+
+ }
+
+ public function modelAction($modelData)
+ {
+
+trigger_error(print_r($modelData,1));
+
+ if ( !isset( $modelData['option'] ) ) {
+ $option = null;
+ } else {
+ $option = $modelData['option'];
+ }
+
+ // Perform specified action
+ switch ( $option ) {
+
+ case 'add':
+ break;
+
+ case 'get':
+ break;
+
+ case 'update':
+ break;
+
+ case 'delete':
+ break;
+
+ default:
+ // If the model has an id then add it to the registrant table
+ // Check to see if the registrant is there if not create one
+ // $registrantId = $this->wpdb->get_var(
+ // $this->wpdb->prepare(
+ // "SELECT id
+ // FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant"
+ // )
+ // );
+ die(); // should never get here
+ break;
+
+ }
+
+ wp_die();
+
+
+
+ }
+
+
+}
$view = 'registration';
// Check to see if a session is set for this cart
- include GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH . '/regCartSupport.php';
+ include GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH . '/regCartSupport.php';
$regCart = new GlmRegCartSupport( $this->wpdb, $this->config );
if ( isset( $_SESSION['glm_reg_cart_id'] ) ) {
$cartId = $_SESSION['glm_reg_cart_id'];
- //unset( $_SESSION['glm_reg_cart_id'] );
- //echo '<pre>$cartId: ' . print_r( $cartId, true ) . '</pre>';
} else {
// create one
$cartId = $regCart->createRegistrationCart();
- //echo '<pre>$cart: ' . print_r( $cart, true ) . '</pre>';
if ( isset( $cartId ) && filter_var( $cartId, FILTER_VALIDATE_INT ) ) {
$_SESSION['glm_reg_cart_id'] = $cartId;
}
}
if ( isset( $cartId ) && filter_var( $cartId, FILTER_VALIDATE_INT ) ) {
$cart = $regCart->getRegistrationCart( $cartId );
- echo '<pre>$cart: ' . print_r( $cart, true ) . '</pre>';
+ //echo '<pre>$cart: ' . print_r( $cart, true ) . '</pre>';
$regRequestJSON = json_encode( $cart['request'] );
}
//echo '<pre>$_SESSION: ' . print_r( $_SESSION, true ) . '</pre>';
'attendee_max_per_reg' => $regEvent['attendee_max_per_reg'],
'reg_hold_minutes' => $regEvent['reg_hold_minutes'],
'cart_hold_days' => $regEvent['cart_hold_days'],
- 'terms' => 'Sample terms and conditions',
+ 'terms' => $regEvent['terms'],
);
+ // get the reg_classes
+ $RegClass = new GlmDataRegistrationsRegClass( $this->wpdb, $this->config );
+ $where = " T.reg_event = $eventRegID";
+ $regClass = $RegClass->getList( $where );
+ //echo '<pre>$regClass: ' . print_r( $regClass, true ) . '</pre>';
+ $RegRate = new GlmDataRegistrationsRegRate( $this->wpdb, $this->config);
+ foreach ( $regClass as &$rClass ) {
+ // grab the reg rate for this class
+ $rates = $RegRate->getList( "T.reg_class = " . $rClass['id'] );
+ //echo '<pre>$rates: ' . print_r( $rates, true ) . '</pre>';
+ foreach ( $rates as $rate ) {
+ $rClass['reg_rate_name'] = $rate['name'];
+ $rClass['reg_rate_base_price'] = $rate['base_rate'];
+ $rClass['reg_rate_per_reg'] = $rate['per_registrant'];
+ }
+ }
+ //echo '<pre>$regClass: ' . print_r( $regClass, true ) . '</pre>';
+
break;
}
// including test data for now
include GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/data/event_setup.php';
- $regClass = $regEventSample['reg_class'];
+ //$regClass = $regEventSample['reg_class'];
// Find the regClass rate to be used
// There will only be one as this is based on the date.
// Build the Class array of json objects for the classes.
$jsonClasses = array();
+
foreach ( $regClass as $rClass ) {
$jsonClasses[] = json_encode( $rClass );
}
{literal}
<script type="text/template" id="regEvent-template">
<h2><%= event_name %></h2>
- <div class="glm-reg-compcode-entry">
+ <div class="glm-reg-compcode-entry glm-hidden">
<input type="text" placeholder="Enter Comp Code Here" />
</div>
<div>
<p><%= descr %></p>
+ <% if ( attendee_max > 0 ) { %>
<p>Maximum Registrants: <%- attendee_max %></p>
+ <% } %>
+ <p><%= terms %></p>
</div>
- <div class="glm-reg-entryforms clearfix">
+ <div class="glm-reg-entryforms clearfix glm-hidden">
<div class="glm-reg-dates">
<h4>Pick your registration dates</h4>
<input type="date" placeholder="Enter Date" />
<input type="text" placeholder="Enter Time" />
</div>
- <div class="glm-reg-submit">
- <input type="submit" value="Continue to Cart" />
- </div>
+ </div>
+ <div class="glm-reg-submit">
+ <input id="glm-reg-cart-continue" type="submit" value="Continue to Cart" />
</div>
</script>
<div class="reg-class-detail">
<div><%- descr %></div>
<div>Current Rate: <%= reg_rate_name %></div>
- <div>Base Price: $<%= reg_rate_base_price %></div>
- <div>Per Registrant: $<%= reg_rate_per_reg %></div>
+ <div>Base Price: <%= reg_rate_base_price %></div>
+ <div>Per Registrant: <%= reg_rate_per_reg %></div>
<div class="registrant-add clearfix">
<input type="text" class="addEmail" placeholder="Enter Email Address">
<input type="submit" class="addRegistrant" value="Add">