// Load Member Types data abstract
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoiceTypes.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php';
/*
* This class performs the work for the default action of the "Members" menu
$invoiceTypes = false;
$error = false;
$enable_members = $this->config['settings']['enable_members'];
+ $memberTypes = false;
// Check for region id
$id = 0;
$invoiceTypes = $this->sortParentChild($invoiceTypes);
// echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
+ // Get list of Member Types
+ $MemberType = new GlmDataMemberTypes( $this->wpdb, $this->config );
+ $memberTypes = $MemberType->getList();
+ // echo '<pre>$memberTypes: ' . print_r( $memberTypes, true ) . '</pre>';
+
// If we had a fatal error, redirect to the error page
if ($error) {
'haveInvoiceTypes' => $haveInvoiceTypes,
'invoiceTypes' => $invoiceTypes,
'recurrenceTypes' => $this->config['recurrence'],
+ 'memberTypes' => $memberTypes,
);
// Return status, suggested view, and data to controller
<input type="hidden" name="option" value="addNew">
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Invoice Type Name:</th>
+ <th class="glm-required">Invoice Type Name</th>
<td>
<input type="text" name="name" class="glm-form-text-input" required>
</td>
</tr>
<tr>
- <th class="glm-required">Parent:</th>
+ <th class="glm-required">Parent</th>
<td>
<select name="parent">
<option value="0">(none)</option>
</select>
</td>
</tr>
+ <tr>
+ <th>Member Type</th>
+ <td>
+ <select name="member_type">
+ <option value="0">(none)</option>
+ {if $memberTypes}
+ {foreach $memberTypes as $type}
+ <option value="{$type.id}">{$type.name}</option>
+ {/foreach}
+ {/if}
+ </select>
+ </td>
+ </tr>
<tr>
<th class="glm-required">Amount:Numbers only<br> (999.99)</th>
<td>
</select>
</td>
</tr>
+ <tr>
+ <th>Member Type</th>
+ <td>
+ <select id="edit-member_type" name="member_type">
+ <option value="0">(none)</option>
+ {if $memberTypes}
+ {foreach $memberTypes as $type}
+ <option value="{$type.id}">{$type.name}</option>
+ {/foreach}
+ {/if}
+ </select>
+ </td>
+ </tr>
<tr>
<th style="text-align: right;" class="glm-required">Amount:Numbers only<br> (999.99)</th>
<td>
data-invoice-id="{$t.id}"
data-invoice-name="{$t.name}"
data-invoice-parent="{$t.parent.value}"
+ data-invoice-member_type="{$t.member_type.value}"
data-invoice-amount="{$t.amount}"
data-invoice-recurring="{$t.recurring.value}"
data-invoice-recurrence="{$t.recurrence}">{$t.name}</a>
$("#newInvoiceTypeDialog").dialog({
autoOpen: false,
- minWidth: 400,
+ minWidth: 600,
dialogClass: "glm-dialog-no-close"
});
$("#editInvoiceTypeDialog").dialog({
autoOpen: false,
- minWidth: 400,
+ minWidth: 600,
dialogClass: "glm-dialog-no-close"
});
$("#deleteInvoiceTypeDialog").dialog({
var invoiceID = $(this).data('invoice-id');
var invoiceName = $(this).data('invoice-name');
var invoiceParent = $(this).data('invoice-parent');
+ var invoiceType = $(this).data('invoice-member_type');
var invoiceAmount = $(this).data('invoice-amount');
var invoiceRecurring = $(this).data('invoice-recurring');
var invoiceRecurrence = $(this).data('invoice-recurrence');
$('#edit-id').val( invoiceID );
$('#edit-name').val( invoiceName );
$('#edit-parent').val( invoiceParent );
+ $('#edit-member_type').val( invoiceType );
$('#edit-amount').val( invoiceAmount );
if ( invoiceRecurring === 1 ) {
$('#edit-recurring').prop( 'checked', true );