$regEventDeleted = false;
$regNotifications = false;
$regNotifyUpdated = false;
+ $havePayCodes = false;
+ $payCodes = false;
+ $newPayCode = false;
$classes = false;
$haveRegistrants = false;
$registrants = false;
switch ($option) {
+ case 'paymentCodes':
+
+
+
+ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php';
+ $PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config);
+
+ if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') {
+ switch($_REQUEST['option2']) {
+
+ case 'new':
+ $PayCode->insertEntry();
+ break;
+
+ case 'update':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ $PayCode->updateEntry($payCodeId);
+ break;
+
+ case 'delete':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ if ( $payCodeId > 0 ) {
+echo "ID = $payCodeId<p>";
+ $PayCode->deleteEntry( $payCodeId, true );
+ }
+ break;
+ }
+ }
+
+ $newPayCode = $PayCode->newEntry();
+
+ // *** NEED TO FIX ref_type to include other possible one for events
+ $payCodes = $PayCode->getList("T.ref_type = 20 AND T.ref_dest = $regEventID");
+ if ($payCodes) {
+ $havePayCodes = true;
+ }
+
+ $regEvent = $this->getEntry($regEventID);
+
+ $view = 'eventPaymentCodes';
+
+ break;
+
case 'notificationsUpdate':
// New and updated notifications
'entry' => $regEventSample,
'regNotifications' => $regNotifications,
'regNotifyUpdated' => $regNotifyUpdated,
+ 'havePayCodes' => $havePayCodes,
+ 'payCodes' => $payCodes,
+ 'newPayCode' => $newPayCode,
+ 'eventPaycodeType' => $this->config['pay_code_ref_type_numb']['Event'],
'currentUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_ADMIN_URL,
'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
'regEventJSON' => $regEventJSON,
--- /dev/null
+{include file='admin/registrations/eventHeader.html'}
+{include file='admin/registrations/eventSubTabs.html'}
+
+<div>
+ <a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Event Payment Code</a>
+ <h1>Registration Event Payment Codes</h1>
+</div>
+<div> </div>
+
+<table class="glm-admin-table glm-settings-table" style="width: 99%;">
+ <tr><td colspan="2">
+ <!-- Add Registration Payment Code Button and Dialog Box -->
+ <div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Payment Code" stye="">
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="option" value="paymentCodes">
+ <input type="hidden" name="option2" value="new">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Payment Code:</th>
+ <td>
+ <input id="code" data-id="code" type="text" name="code" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="hidden" value="{$eventPaycodeType}" name="ref_type">
+ <input type="hidden" value="{$regEventID}" name="ref_dest">{$regEventID}
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Payment Code Type:</th>
+ <td>
+ <select id="default-code-type" data-id="code_type" name="code_type">
+ <option value=""></option>
+ {foreach from=$newPayCode.fieldData.code_type.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+ {$v.name}
+ </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Amount:</th>
+ <td>
+ <input id="amount" data-id="amount" type="text" name="amount" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Description:</th>
+ <td>
+ <textarea id="descr" data-id="descr" type="text" name="descr"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Payment Code" class="button button-primary">
+
+ </form>
+ </div>
+
+ <!-- Delete Registration Payment Code Button -->
+ <div id="deletePaymentCodeDialog" class="glm-dialog-box" title="Delete Payment Code">
+ <center>
+ <p>Are you sure you want to delete this Payment Code?</p>
+ <p><div id="deletePaymentCodeConfirm" class="button button-primary">Yes, delete this Payment Code</div></p>
+ <p><div id="deletePaymentCodeCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Registration Payment Code Dialog Box -->
+ <div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Payment Code">
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="option" value="paymentCodes">
+ <input type="hidden" name="option2" value="update">
+ <input id="payCodeId" type="hidden" name="payCodeId" value="">
+
+ <!-- This is only temporary until we reinstate the "Used With" selection below -->
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Payment Code:</th>
+ <td>
+ <input id="edit-code" data-id="code" type="text" name="code" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+
+ <td>
+ <input type="hidden" value="{$eventPaycodeType}" name="ref_type">
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Code Type:</th>
+ <td>
+ <select id="edit-code-type" data-id="code_type" name="code_type">
+ <option value=""></option>
+ {foreach from=$newPayCode.fieldData.code_type.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+ {$v.name}
+ </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Amount:</th>
+ <td>
+ <input id="edit-amount" data-id="amount" type="text" name="amount" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Description:</th>
+ <td>
+ <textarea id="edit-descr" data-id="descr" type="text" name="descr"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Payment Code">
+
+ </form>
+ </div>
+
+ <table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 99%;">
+ <thead>
+ <tr>
+ <th> Payment Code</th>
+ <th> Type </th>
+ <th> Amount </th>
+ <th> Description </th>
+ <th> Uses </th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+
+ {if $havePayCodes}
+ {assign var="i" value="0"}
+ {foreach $payCodes as $p}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <div id="paymentCode_{$p.id}" data-paycodeID="{$p.id}">{$p.code}</div>
+ </td>
+ <td>
+ <div id="paymentType_{$p.id}" data-value="{$p.code_type.value}" data-paycodeID="{$p.id}">{$p.code_type.name}</div>
+ </td>
+ <td>
+ {if $p.code_type.value==20}
+ ${$p.amount|number_format:2}
+ {elseif $p.code_type.value==30}
+ {$p.amount|number_format:2}%
+ {/if}
+ </td>
+ <td>
+ <div id="paymentDescription_{$p.id}" data-paycodeID="{$p.id}">{$p.descr}</div>
+ </td>
+ <td>
+ (n/a)
+ </td>
+ <td>
+ <div class="editPaymentCodeButton editPaymentCode button button-secondary glm-button-small glm-right" data-paycodeID="{$p.id}" data-payAmount="{$p.amount|number_format:2}">Edit</div>
+ <div class="deletePaymentCodeButton button button-secondary glm-button-small glm-right" data-paycodeID="{$p.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr class="alternate"><td colspan="2">(no payment codes listed)</td></tr>
+ {/if}
+ </tbody>
+ </table>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newPaymentCodeDialog").dialog({
+ autoOpen: false,
+ minWidth: 500,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editPaymentCodeDialog").dialog({
+ autoOpen: false,
+ minWidth: 500,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deletePaymentCodeDialog").dialog({
+ autoOpen: false,
+ minWidth: 500,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newPaymentCodeButton').click( function() {
+ $("#newPaymentCodeDialog").dialog("open");
+ });
+ $('.editPaymentCode').click( function() {
+ var paycodeID = $(this).attr('data-paycodeID');
+ var paycodeType = $('#paymentType_' + paycodeID).html();
+ var paycodeDescr = $('#paymentDescription_' + paycodeID).html();
+ var paycodeAmount = $(this).attr('data-payAmount');
+ var paycode = $('#paymentCode_' + paycodeID).html();
+ var paycodeTypeValue = $('#paymentType_' + paycodeID).data('value');
+
+ $('#payCodeId').val(paycodeID);
+
+ $('#edit-code').val(paycode);
+ $('#edit-amount').val(paycodeAmount);
+ $('#edit-descr').val(paycodeDescr);
+ $('#edit-type').val(paycodeType);
+
+ $("#edit-code-type option").filter(function() {
+ return parseInt($(this).val()) === parseInt(paycodeTypeValue);
+ }).prop('selected', true);
+
+
+ $("#editPaymentCodeDialog").dialog("open");
+ });
+ $('#editPaymentCodeCancel').click( function() {
+ $("#editPaymentCodeDialog").dialog("close");
+ });
+ $('#newPaymentCodeCancel').click( function() {
+ $("#newPaymentCodeDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deletePaymentCodeButton').click( function() {
+ id = $(this).attr('data-paycodeID');
+ $("#deletePaymentCodeDialog").dialog("open");
+ });
+ $('#deletePaymentCodeConfirm').click( function() {
+ $("#deletePaymentCodeDialog").dialog("close");
+ window.location.href = "{$thisUrl}?page={$thisPage}&option=paymentCodes&option2=delete&payCodeId=" + id;
+ });
+ $('#deletePaymentCodeCancel').click( function() {
+ $("#deletePaymentCodeDialog").dialog("close");
+ });
+
+ /*
+ * Edit area tabs
+ */
+ $('.glm-settings-tab').click( function() {
+
+ // Clear tabl highlights and hide all tables
+ $('.glm-settings-tab').removeClass('nav-tab-active');
+ $('.glm-settings-table').addClass('glm-hidden');
+
+ // Highlight selected tab
+ $(this).addClass('nav-tab-active');
+
+ // Show selected table
+ var table = $(this).attr('data-show-table');
+ $('#' + table).removeClass('glm-hidden');
+
+ });
+
+ });
+</script>
+
+{include file='admin/footer.html'}
+