From: Anthony Talarico Date: Mon, 27 Feb 2017 21:42:02 +0000 (-0500) Subject: adding settings > global payment codes to the mgmt menu. Payment codes can be X-Git-Tag: v1.0.0^2~495 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5717c39c063534894ab996402ab4406109636c01;p=WP-Plugins%2Fglm-member-db-registrations.git adding settings > global payment codes to the mgmt menu. Payment codes can be added, edited and deleted. Only global paymentcodes show up in the admin --- diff --git a/classes/data/dataPaymentCode.php b/classes/data/dataPaymentCode.php index b4c82be..8395737 100644 --- a/classes/data/dataPaymentCode.php +++ b/classes/data/dataPaymentCode.php @@ -107,6 +107,14 @@ class GlmDataRegistrationsPaymentCode extends GlmDataAbstract */ $this->fields = array ( + // ID + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + // Payment Code Type 'code_type' => array ( @@ -121,7 +129,7 @@ class GlmDataRegistrationsPaymentCode extends GlmDataAbstract 'ref_type' => array ( 'field' => 'ref_type', 'type' => 'list', - 'list' => $this->config['payment_type'], + 'list' => $this->config['pay_code_ref_type'], 'required' => true, 'use' => 'a' ), diff --git a/css/admin.css b/css/admin.css new file mode 100644 index 0000000..59ae731 --- /dev/null +++ b/css/admin.css @@ -0,0 +1,6 @@ +.editPaymentCode{ + width: 44px; + text-align: center; + margin-right: 5px; + display: inline-block; +} \ No newline at end of file diff --git a/models/admin/settings/registrationsPaymentCode.php b/models/admin/settings/registrationsPaymentCode.php index b2b78bd..f128382 100644 --- a/models/admin/settings/registrationsPaymentCode.php +++ b/models/admin/settings/registrationsPaymentCode.php @@ -105,6 +105,10 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat $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'] ) ) { @@ -122,6 +126,7 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat if ( $id > 0 ) { $this->updateEntry( $id ); } + echo "no id"; break; case 'delete': @@ -140,7 +145,7 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat $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' ); @@ -171,11 +176,13 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat } // 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 diff --git a/views/admin/settings/registrationsPaymentCode.html b/views/admin/settings/registrationsPaymentCode.html index 612fa4b..d0900ea 100644 --- a/views/admin/settings/registrationsPaymentCode.html +++ b/views/admin/settings/registrationsPaymentCode.html @@ -17,9 +17,40 @@ - + + + + + + + + + + + + + + + + +
Payment Code Name:Payment Code: - + +
+ +
Payment Code Type: + +
Payment Amount: + +
Payment Description: +
@@ -48,10 +79,41 @@ + + + + + + + + + + + + + + + + - +
Payment Code: + +
+ +
Payment Code Type: + +
Payment Amount: + +
Payment Code Name:Payment Description: - +
@@ -68,11 +130,15 @@ - + + + + + {if $havePaymentCode} {assign var="i" value="0"} {foreach $payment_codes as $p} @@ -82,10 +148,23 @@ {/if} + + + + {/foreach} @@ -120,20 +199,25 @@ $("#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() { @@ -145,12 +229,12 @@ 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");
Payment Code Amount Description Payment Code Payment Code Type  
- {$p.name} +
{$p.amount}
+
+
{$p.descr}
+
+
{$p.code}
-
Delete
+
{$p.code_type.name}
+
+
Edit
+ +
+
Delete