$option2 = '';
$newPaymentCode = $this->newEntry();
+ $global_paycode = $this->config['pay_code_ref_type_numb']['Global'];
+
+ $enable_members = $this->config['settings']['enable_members'];
+
// Check if a category ID is supplied
$id = 0;
if ( isset( $_REQUEST['id'] ) ) {
if ( $id > 0 ) {
$this->updateEntry( $id );
}
+ echo "no id";
break;
case 'delete':
$option2 = $_REQUEST['option2'];
}
// Get a current list of payment_codes
- $payment_codes = $this->getList();
+ $payment_codes = $this->getList('ref_type = 10');
if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) {
glmMembersAdmin::addNotice( $payment_codes, 'DataBlock', 'Payment Code Data' );
}
// Compile template data
$templateData = array(
- 'havePaymentCode' => $havePaymentCode,
- 'payment_codes' => $payment_codes,
- 'groups' => null,
- 'option2' => $option2,
- 'newPaymentCode' => $newPaymentCode,
+ 'enable_members' => $enable_members,
+ 'havePaymentCode' => $havePaymentCode,
+ 'payment_codes' => $payment_codes,
+ 'groups' => null,
+ 'option2' => $option2,
+ 'newPaymentCode' => $newPaymentCode,
+ 'global_paycode' => $global_paycode
);
// Return status, suggested view, and data to controller
<!-- This is only temporary until we reinstate the "Used With" selection below -->
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Payment Code Name:</th>
+ <th class="glm-required">Payment Code:</th>
<td>
- <input type="text" name="name" class="glm-form-text-input">
+ <input id="code" data-id="code" type="text" name="code" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+
+ <td>
+ <input type="hidden" value="{$global_paycode}" name="ref_type">
+ </td>
+ </tr>
+ <tr>
+ <th>Payment Code Type:</th>
+ <td>
+ <select id="default-code-type" data-id="code_type" name="code_type">
+ <option value=""></option>
+ {foreach from=$newPaymentCode.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>
+ <input id="descr" data-id="descr" type="text" name="descr" class="glm-form-text-input">
</td>
</tr>
</table>
<!-- 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="{$global_paycode}" 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=$newPaymentCode.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 class="glm-required">Payment Code Name:</th>
+ <th>Payment Description:</th>
<td>
- <input id="editPaymentCodeName" type="text" name="name" class="glm-form-text-input">
+ <input id="edit-descr" data-id="descr" type="text" name="descr" class="glm-form-text-input">
</td>
</tr>
</table>
<table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 90%;">
<thead>
<tr>
- <th>Payment Code</th>
+ <th> Amount </th>
+ <th> Description </th>
+ <th> Payment Code</th>
+ <th> Payment Code Type </th>
<th> </th>
</tr>
</thead>
<tbody>
+
{if $havePaymentCode}
{assign var="i" value="0"}
{foreach $payment_codes as $p}
<tr class="alternate">
{/if}
<td>
- <a class="editPaymentCode" data-amenityID="{$p.id}" data-amenityUsesValue="{$p.uses_value.value}">{$p.name}</a>
+ <div id="paymentAmount_{$p.id}" data-paycodeID="{$p.id}" >{$p.amount}</div>
+ </td>
+ <td>
+ <div id="paymentDescription_{$p.id}" data-paycodeID="{$p.id}">{$p.descr}</div>
+ </td>
+ <td>
+ <div id="paymentCode_{$p.id}" data-paycodeID="{$p.id}">{$p.code}</div>
</td>
<td>
- <div class="deletePaymentCodeButton button button-secondary glm-button-small glm-right" data-amenityID="{$p.id}">Delete</div>
+ <div id="paymentType_{$p.id}" data-value="{$p.code_type.value}" data-paycodeID="{$p.id}">{$p.code_type.name}</div>
+ </td>
+ <td>
+ <div class="editPaymentCodeButton editPaymentCode button button-secondary glm-button-small glm-right" data-paycodeID="{$p.id}">Edit</div>
+
+ </td>
+ <td>
+ <div class="deletePaymentCodeButton button button-secondary glm-button-small glm-right" data-paycodeID="{$p.id}">Delete</div>
</td>
</tr>
{/foreach}
$("#newPaymentCodeDialog").dialog("open");
});
$('.editPaymentCode').click( function() {
- var amenityID = $(this).attr('data-amenityID');
- var amenityName = $(this).text();
- var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue'));
- var amenityDescr = $('#editPaymentCodeDescr_' + amenityID).html();
- var amenityShortDescr = $('#editPaymentCodeShortDescr_' + amenityID).html();
- $('#editPaymentCodeID').val(amenityID);
- $('#editPaymentCodeName').val(amenityName.trim());
- $('#editPaymentCodeUsesValue').prop('checked', amenityUsesValue);
- $('.amenityGroup').each(function(){
- $(this).prop('checked', false);
- });
- $('.amenitySearch').each(function(){
- $(this).prop('checked', false);
- });
+ var paycodeID = $(this).attr('data-paycodeID');
+ var paycodeType = $('#paymentType_' + paycodeID).html();
+ var paycodeDescr = $('#paymentDescription_' + paycodeID).html();
+ var paycodeAmount = $('#paymentAmount_' + paycodeID).html();
+ var paycode = $('#paymentCode_' + paycodeID).html();
+ var paycodeTypeValue = $('#paymentType_' + paycodeID).data('value');
+
+ $('#editPaymentCodeID').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() {
var id = false;
$('.deletePaymentCodeButton').click( function() {
- id = $(this).attr('data-amenityID');
+ id = $(this).attr('data-paycodeID');
$("#deletePaymentCodeDialog").dialog("open");
});
$('#deletePaymentCodeConfirm').click( function() {
$("#deletePaymentCodeDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=eventAmenities&option=delete&id=" + id;
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=registrationsPaymentCode&option=delete&id=" + id;
});
$('#deletePaymentCodeCancel').click( function() {
$("#deletePaymentCodeDialog").dialog("close");