More progress on posting payments. Customer selection now works as well as the date picker. At this point, we need to figure out how to insert this data into the database. Of course, significant cleanup is still required, as is beautification.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@155 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -148,6 +148,8 @@ class CustomersController extends AppController {
|
|||||||
|
|
||||||
$this->sidemenu_links[] =
|
$this->sidemenu_links[] =
|
||||||
array('name' => 'Operations', 'header' => true);
|
array('name' => 'Operations', 'header' => true);
|
||||||
|
$this->sidemenu_links[] =
|
||||||
|
array('name' => 'Payment', 'url' => array('action' => 'payment', $id));
|
||||||
$this->sidemenu_links[] =
|
$this->sidemenu_links[] =
|
||||||
array('name' => 'Move-Out', 'url' => array('controller' => 'units', 'action' => 'move-out'));
|
array('name' => 'Move-Out', 'url' => array('controller' => 'units', 'action' => 'move-out'));
|
||||||
|
|
||||||
@@ -172,12 +174,12 @@ class CustomersController extends AppController {
|
|||||||
/* $this->redirect(array('action'=>'index')); */
|
/* $this->redirect(array('action'=>'index')); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
if ($this->RequestHandler->isPost()) {
|
/* if ($this->RequestHandler->isPost()) { */
|
||||||
pr($this->data);
|
/* pr($this->data); */
|
||||||
//$this->redirect(array('action'=>'index'));
|
/* //$this->redirect(array('action'=>'index')); */
|
||||||
$customer = $this->data;
|
/* $customer = $this->data; */
|
||||||
}
|
/* } */
|
||||||
elseif (isset($id)) {
|
if (isset($id)) {
|
||||||
$customer = $this->Customer->details($id);
|
$customer = $this->Customer->details($id);
|
||||||
unset($customer['deposits']['Entries']);
|
unset($customer['deposits']['Entries']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,38 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$grid_setup = array();
|
||||||
|
|
||||||
|
if (isset($customer['Customer']['id']))
|
||||||
|
$grid_setup['hiddengrid'] = true;
|
||||||
|
|
||||||
|
$grid_setup['onSelectRow'] = array
|
||||||
|
('--special' =>
|
||||||
|
'function(ids) { if (ids != null)' .
|
||||||
|
' {' .
|
||||||
|
// Set the customer id that will be returned with the form
|
||||||
|
' $("#customer-id").val(ids);' .
|
||||||
|
// Get the customer name from the grid
|
||||||
|
' $("#payment_customer").html($("#"+$(this).attr("id"))' .
|
||||||
|
' .getCell(ids, "Customer-name"));' .
|
||||||
|
// Replace that with just the text portion of the hyperlink
|
||||||
|
' $("#payment_customer").html("Receipt for "+ $("#payment_customer a").html());' .
|
||||||
|
' } }'
|
||||||
|
);
|
||||||
|
|
||||||
|
/* $grid_setup['loadComplete'] = array */
|
||||||
|
/* ('--special' => */
|
||||||
|
/* 'function() { ' . */
|
||||||
|
/* //' $("#"+$(this).attr("id")).setSelection($("#customer-id").val());' . */
|
||||||
|
/* ' $(\'#customers-list-jqGrid\').setSelection($(\'#customer-id\').val());' . */
|
||||||
|
/* ' $("#"+$(this).attr("id")).setCaption("Hello");' . */
|
||||||
|
/* ' alert("Loaded");' . */
|
||||||
|
/* ' }' */
|
||||||
|
/* ); */
|
||||||
|
|
||||||
|
|
||||||
//pr($customer);
|
//pr($customer);
|
||||||
echo ("<H3>" . $customer['Customer']['name'] . "</H3>\n");
|
//echo ('<A HREF="#" ONCLICK="$(\'#debug\').append(htmlEncode($(\'#customers-list\').html())); return false">Get grid code</A><BR>');
|
||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
// Outstanding balance
|
// Outstanding balance
|
||||||
@@ -63,8 +93,6 @@ echo ("<H3>" . $customer['Customer']['name'] . "</H3>\n");
|
|||||||
// How to apply (even split, oldest charges first, etc)
|
// How to apply (even split, oldest charges first, etc)
|
||||||
|
|
||||||
|
|
||||||
echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
@@ -72,37 +100,35 @@ echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
|
|||||||
// prepare the form when the DOM is ready
|
// prepare the form when the DOM is ready
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var options = {
|
var options = {
|
||||||
target: '#debug', // target element(s) to be updated with server response
|
target: '#output-debug', // target element(s) to be updated with server response
|
||||||
beforeSubmit: showRequest, // pre-submit callback
|
beforeSubmit: verifyRequest, // pre-submit callback
|
||||||
success: showResponse // post-submit callback
|
success: showResponse, // post-submit callback
|
||||||
|
|
||||||
// other available options:
|
// other available options:
|
||||||
//url: url // override for form's 'action' attribute
|
//url: url, // override for form's 'action' attribute
|
||||||
//type: type // 'get' or 'post', override for form's 'method' attribute
|
//type: type, // 'get' or 'post', override for form's 'method' attribute
|
||||||
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
|
//dataType: null, // 'xml', 'script', or 'json' (expected server response type)
|
||||||
//clearForm: true // clear all form fields after successful submit
|
//clearForm: true, // clear all form fields after successful submit
|
||||||
//resetForm: true // reset the form after successful submit
|
resetForm: true, // reset the form after successful submit
|
||||||
|
|
||||||
// $.ajax options can be used here too, for example:
|
// $.ajax options can be used here too, for example:
|
||||||
//timeout: 3000
|
//timeout: 3000,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a clean slate for our payments
|
// get a clean slate
|
||||||
$('#payments').html('');
|
resetPaymentForm();
|
||||||
$('#payment-id').val(1);
|
|
||||||
addPaymentSource(false);
|
|
||||||
|
|
||||||
// bind form using 'ajaxForm'
|
// bind form using 'ajaxForm'
|
||||||
$('#payment-form').ajaxForm(options);
|
$('#payment-form').ajaxForm(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
// pre-submit callback
|
// pre-submit callback
|
||||||
function showRequest(formData, jqForm, options) {
|
function verifyRequest(formData, jqForm, options) {
|
||||||
// formData is an array; here we use $.param to convert it to a string to display it
|
// formData is an array; here we use $.param to convert it to a string to display it
|
||||||
// but the form plugin does this for you automatically when it submits the data
|
// but the form plugin does this for you automatically when it submits the data
|
||||||
//var_dump(formData);
|
//var_dump(formData);
|
||||||
$('#debug').append('<PRE>'+dump(formData)+'</PRE>');
|
$('#request-debug').html('<PRE>'+dump(formData)+'</PRE>');
|
||||||
return false;
|
//return false;
|
||||||
|
|
||||||
// here we could return false to prevent the form from being submitted;
|
// here we could return false to prevent the form from being submitted;
|
||||||
// returning anything other than false will allow the form submit to continue
|
// returning anything other than false will allow the form submit to continue
|
||||||
@@ -121,10 +147,26 @@ echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
|
|||||||
// if the ajaxForm method was passed an Options Object with the dataType
|
// if the ajaxForm method was passed an Options Object with the dataType
|
||||||
// property set to 'json' then the first argument to the success callback
|
// property set to 'json' then the first argument to the success callback
|
||||||
// is the json data object returned by the server
|
// is the json data object returned by the server
|
||||||
|
|
||||||
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
|
if (statusText == 'success') {
|
||||||
'\n\nThe output div should have already been updated with the responseText.');
|
// get a clean slate
|
||||||
}
|
resetPaymentForm();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert('not successful??');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#response-debug').html('<PRE>'+dump(statusText)+'</PRE>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset payment fields
|
||||||
|
function resetPaymentForm() {
|
||||||
|
// Get a clean slate for our payments
|
||||||
|
$('#payments').html('');
|
||||||
|
$('#payment-id').val(1);
|
||||||
|
addPaymentSource(false);
|
||||||
|
}
|
||||||
|
|
||||||
function addPaymentSource(flash) {
|
function addPaymentSource(flash) {
|
||||||
addDiv('payment-id', 'payment', 'payments', flash,
|
addDiv('payment-id', 'payment', 'payments', flash,
|
||||||
@@ -140,7 +182,7 @@ echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
|
|||||||
|
|
||||||
foreach ($types AS $type => $name) {
|
foreach ($types AS $type => $name) {
|
||||||
$div = '<DIV>';
|
$div = '<DIV>';
|
||||||
$div .= '<INPUT TYPE="radio" NAME="data[Customer][payment][%{id}][type]"';
|
$div .= '<INPUT TYPE="radio" NAME="data[Source][%{id}][type]"';
|
||||||
$div .= ' ONCLICK="switchPaymentType(%{id}, \\\''.$type.'\\\')"';
|
$div .= ' ONCLICK="switchPaymentType(%{id}, \\\''.$type.'\\\')"';
|
||||||
$div .= ' CLASS="payment-type-%{id}" ID="payment-type-'.$type.'-%{id}"';
|
$div .= ' CLASS="payment-type-%{id}" ID="payment-type-'.$type.'-%{id}"';
|
||||||
$div .= ' VALUE="'.$type.'" ' . ($type == 'cash' ? 'CHECKED ' : '') . '/>';
|
$div .= ' VALUE="'.$type.'" ' . ($type == 'cash' ? 'CHECKED ' : '') . '/>';
|
||||||
@@ -154,7 +196,7 @@ echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
|
|||||||
'<DIV ID="payment-amount-div-%{id}" CLASS="input text required">' +
|
'<DIV ID="payment-amount-div-%{id}" CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-amount-%{id}">Amount</LABEL>' +
|
' <LABEL FOR="payment-amount-%{id}">Amount</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="20"' +
|
' <INPUT TYPE="text" SIZE="20"' +
|
||||||
' NAME="data[Customer][payment][%{id}][amount]"' +
|
' NAME="data[Source][%{id}][amount]"' +
|
||||||
' ID="payment-amount-%{id}" />' +
|
' ID="payment-amount-%{id}" />' +
|
||||||
'</DIV>' +
|
'</DIV>' +
|
||||||
|
|
||||||
@@ -191,7 +233,7 @@ function switchPaymentType(paymentid, type) {
|
|||||||
html =
|
html =
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-check-number-'+paymentid+'">Check Number</LABEL>' +
|
' <LABEL FOR="payment-check-number-'+paymentid+'">Check Number</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="6" NAME="data[Customer][payment]['+paymentid+'][check][number]"' +
|
' <INPUT TYPE="text" SIZE="6" NAME="data[Source]['+paymentid+'][check][number]"' +
|
||||||
' ID="payment-check-number-'+paymentid+'" />' +
|
' ID="payment-check-number-'+paymentid+'" />' +
|
||||||
'</DIV>';
|
'</DIV>';
|
||||||
break;
|
break;
|
||||||
@@ -200,7 +242,7 @@ function switchPaymentType(paymentid, type) {
|
|||||||
html =
|
html =
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-moneyorder-number-'+paymentid+'">Money Order Number</LABEL>' +
|
' <LABEL FOR="payment-moneyorder-number-'+paymentid+'">Money Order Number</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="6" NAME="data[Customer][payment]['+paymentid+'][moneyorder][number]"' +
|
' <INPUT TYPE="text" SIZE="6" NAME="data[Source]['+paymentid+'][moneyorder][number]"' +
|
||||||
' ID="payment-moneyorder-number-'+paymentid+'" />' +
|
' ID="payment-moneyorder-number-'+paymentid+'" />' +
|
||||||
'</DIV>';
|
'</DIV>';
|
||||||
break;
|
break;
|
||||||
@@ -209,13 +251,13 @@ function switchPaymentType(paymentid, type) {
|
|||||||
html =
|
html =
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-ach-routing-'+paymentid+'">Routing Number</LABEL>' +
|
' <LABEL FOR="payment-ach-routing-'+paymentid+'">Routing Number</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="9" NAME="data[Customer][payment]['+paymentid+'][ach][routing]"' +
|
' <INPUT TYPE="text" SIZE="9" NAME="data[Source]['+paymentid+'][ach][routing]"' +
|
||||||
' ID="payment-ach-routing-'+paymentid+'" />' +
|
' ID="payment-ach-routing-'+paymentid+'" />' +
|
||||||
'</DIV>' +
|
'</DIV>' +
|
||||||
|
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-ach-account-'+paymentid+'">Account Number</LABEL>' +
|
' <LABEL FOR="payment-ach-account-'+paymentid+'">Account Number</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="17" NAME="data[Customer][payment]['+paymentid+'][ach][account]"' +
|
' <INPUT TYPE="text" SIZE="17" NAME="data[Source]['+paymentid+'][ach][account]"' +
|
||||||
' ID="payment-ach-account-'+paymentid+'" />' +
|
' ID="payment-ach-account-'+paymentid+'" />' +
|
||||||
'</DIV>';
|
'</DIV>';
|
||||||
break;
|
break;
|
||||||
@@ -224,19 +266,19 @@ function switchPaymentType(paymentid, type) {
|
|||||||
html =
|
html =
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-creditcard-account-'+paymentid+'">Account Number</LABEL>' +
|
' <LABEL FOR="payment-creditcard-account-'+paymentid+'">Account Number</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="16" NAME="data[Customer][payment]['+paymentid+'][creditcard][account]"' +
|
' <INPUT TYPE="text" SIZE="16" NAME="data[Source]['+paymentid+'][creditcard][account]"' +
|
||||||
' ID="payment-creditcard-account-'+paymentid+'" />' +
|
' ID="payment-creditcard-account-'+paymentid+'" />' +
|
||||||
'</DIV>' +
|
'</DIV>' +
|
||||||
|
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-creditcard-expiration-'+paymentid+'">Expiration Date</LABEL>' +
|
' <LABEL FOR="payment-creditcard-expiration-'+paymentid+'">Expiration Date</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="10" NAME="data[Customer][payment]['+paymentid+'][creditcard][expiration]"' +
|
' <INPUT TYPE="text" SIZE="10" NAME="data[Source]['+paymentid+'][creditcard][expiration]"' +
|
||||||
' ID="payment-creditcard-expiration-'+paymentid+'" />' +
|
' ID="payment-creditcard-expiration-'+paymentid+'" />' +
|
||||||
' </DIV>' +
|
' </DIV>' +
|
||||||
|
|
||||||
'<DIV CLASS="input text required">' +
|
'<DIV CLASS="input text required">' +
|
||||||
' <LABEL FOR="payment-creditcard-cvv2-'+paymentid+'">CVV2 Code</LABEL>' +
|
' <LABEL FOR="payment-creditcard-cvv2-'+paymentid+'">CVV2 Code</LABEL>' +
|
||||||
' <INPUT TYPE="text" SIZE="10" NAME="data[Customer][payment]['+paymentid+'][creditcard][cvv2]"' +
|
' <INPUT TYPE="text" SIZE="10" NAME="data[Source]['+paymentid+'][creditcard][cvv2]"' +
|
||||||
' ID="payment-creditcard-cvv2-'+paymentid+'" />' +
|
' ID="payment-creditcard-cvv2-'+paymentid+'" />' +
|
||||||
'</DIV>';
|
'</DIV>';
|
||||||
break;
|
break;
|
||||||
@@ -253,6 +295,27 @@ function switchPaymentType(paymentid, type) {
|
|||||||
|
|
||||||
--></script>
|
--></script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
; // align
|
||||||
|
//echo '<DIV ID="dialog">' . "\n";
|
||||||
|
|
||||||
|
echo $this->element('customers',
|
||||||
|
array('caption' => '<A HREF="#" ONCLICK="$(\\\'.HeaderButton\\\').click(); return false;">Select Customer</A>',
|
||||||
|
'limit' => 7,
|
||||||
|
'grid_setup' => $grid_setup,
|
||||||
|
));
|
||||||
|
|
||||||
|
echo ('<H2><SPAN id="payment_customer">' .
|
||||||
|
(isset($customer['Customer']['id'])
|
||||||
|
? 'Receipt for ' . $customer['Customer']['name']
|
||||||
|
: 'Please select customer') .
|
||||||
|
'</SPAN></H2>' . "\n");
|
||||||
|
|
||||||
|
//echo $form->create(null, array('id' => 'payment-form', 'action' => 'other'));
|
||||||
|
echo $form->create(null, array('id' => 'payment-form', 'url' => 'http://localhost/vars.php'));
|
||||||
|
?>
|
||||||
|
<input type="hidden" id="customer-id" name="data[Customer][id]" value="<?php echo $customer['Customer']['id']; ?>">
|
||||||
|
|
||||||
<fieldset CLASS="payment superset">
|
<fieldset CLASS="payment superset">
|
||||||
<legend>Payments</legend>
|
<legend>Payments</legend>
|
||||||
<input type="hidden" id="payment-id" value="1">
|
<input type="hidden" id="payment-id" value="1">
|
||||||
@@ -264,13 +327,22 @@ function switchPaymentType(paymentid, type) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//echo $form->inputs();
|
echo 'Date: <input id="datepicker" name="data[Date]" type="text" /><BR>' . "\n";
|
||||||
echo '<div type="text" id="datepicker"></div>' . "\n";
|
echo 'Comment: <input id="comment" name="data[Comment]" type="text" SIZE=80 /><BR>' . "\n";
|
||||||
echo $form->end('Send');
|
echo $form->end('Post Payment');
|
||||||
|
|
||||||
|
//echo '</DIV>' . "\n"; // End of the dialog DIV
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>
|
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>
|
||||||
<div id="debug"></div>
|
<?php
|
||||||
|
/* <button id="post-payment" class="ui-button ui-state-default ui-corner-all">Create Payment</button> */
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<div><H4>Request</H4><div id="request-debug"></div></div>
|
||||||
|
<div><H4>Response</H4><div id="response-debug"></div></div>
|
||||||
|
<div><H4>Output</H4><div id="output-debug"></div></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -278,7 +350,35 @@ echo $form->end('Send');
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#datepicker").datepicker();
|
$("#datepicker").datepicker()
|
||||||
|
.datepicker('setDate', '+0');
|
||||||
|
|
||||||
|
/* $("#dialog").dialog({ */
|
||||||
|
/* bgiframe: true, */
|
||||||
|
/* autoOpen: false, */
|
||||||
|
/* height: 500, */
|
||||||
|
/* width: 600, */
|
||||||
|
/* modal: true, */
|
||||||
|
/* buttons: { */
|
||||||
|
/* 'Post a Payment': function() { */
|
||||||
|
/* var bValid = true; */
|
||||||
|
/* if (bValid) { */
|
||||||
|
/* $('#debug').append('<H2>POSTED!</H2>'); */
|
||||||
|
/* $(this).dialog('close'); */
|
||||||
|
/* } */
|
||||||
|
/* }, */
|
||||||
|
/* Cancel: function() { */
|
||||||
|
/* $(this).dialog('close'); */
|
||||||
|
/* } */
|
||||||
|
/* }, */
|
||||||
|
/* close: function() { */
|
||||||
|
/* } */
|
||||||
|
/* }); */
|
||||||
|
|
||||||
|
/* $('#post-payment').click(function() { */
|
||||||
|
/* $('#dialog').dialog('open'); */
|
||||||
|
/* }); */
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ $cols['Leases'] = array('index' => 'lease_count', 'width' =>
|
|||||||
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||||
'controller' => 'customers',
|
'controller' => 'customers');
|
||||||
'caption' => isset($caption) ? $caption : null);
|
|
||||||
|
// User requested options have priority
|
||||||
|
$jqGrid_options += compact('caption', 'grid_setup', 'limit');
|
||||||
|
|
||||||
if (isset($customers)) {
|
if (isset($customers)) {
|
||||||
$jqGrid_options += array('custom_ids' =>
|
$jqGrid_options += array('custom_ids' =>
|
||||||
@@ -22,7 +24,9 @@ if (isset($customers)) {
|
|||||||
$customers),
|
$customers),
|
||||||
'limit' => 5);
|
'limit' => 5);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
// Not the long term solution here... just for testing
|
||||||
|
if (isset($searchfields)) {
|
||||||
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
|
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ if (!isset($grid_id))
|
|||||||
if (!isset($search_fields))
|
if (!isset($search_fields))
|
||||||
$search_fields = array();
|
$search_fields = array();
|
||||||
|
|
||||||
|
if (!isset($grid_setup))
|
||||||
|
$grid_setup = array();
|
||||||
|
|
||||||
// Do some prework to bring in the appropriate libraries
|
// Do some prework to bring in the appropriate libraries
|
||||||
$imgpath = '/pmgr/site/css/jqGrid/basic/images';
|
$imgpath = '/pmgr/site/css/jqGrid/basic/images';
|
||||||
@@ -139,10 +141,35 @@ foreach ($jqGridColumns AS &$col) {
|
|||||||
$col = array_merge($default, $col);
|
$col = array_merge($default, $col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the default sort column
|
||||||
reset($jqGridColumns);
|
reset($jqGridColumns);
|
||||||
$sortname = current($jqGridColumns);
|
$sortname = current($jqGridColumns);
|
||||||
$sortname = $sortname['index'];
|
$sortname = $sortname['index'];
|
||||||
|
|
||||||
|
// Configure the grid setup, giving priority to user defined parameters
|
||||||
|
$jqGrid_setup = array_merge
|
||||||
|
(array('mtype' => 'GET',
|
||||||
|
'datatype' => 'xml',
|
||||||
|
'url' => $url,
|
||||||
|
'postData' => $postData,
|
||||||
|
'colNames' => array_keys($jqGridColumns),
|
||||||
|
'colModel' => array('--special' => $jqGridColumns),
|
||||||
|
'height' => $height,
|
||||||
|
'rowNum' => $limit,
|
||||||
|
'rowList' => $limitOptions,
|
||||||
|
'sortname' => $sortname,
|
||||||
|
'caption' => $caption,
|
||||||
|
'imgpath' => $imgpath,
|
||||||
|
'viewrecords' => true,
|
||||||
|
'pager' => $grid_id.'-pager',
|
||||||
|
|
||||||
|
'loadComplete' => array('--special' => "function() {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Query</A><BR>');}"),
|
||||||
|
'loadError' => array('--special' => "function(xhr,st,err) {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Error Query</A><BR>');}"),
|
||||||
|
|
||||||
|
),
|
||||||
|
$grid_setup
|
||||||
|
);
|
||||||
|
//pr(compact('grid_setup', 'jqGrid_setup'));
|
||||||
|
|
||||||
// OK, now that everything is in place, get out of PHP mode,
|
// OK, now that everything is in place, get out of PHP mode,
|
||||||
// and add the javascript code (along with a touch of HTML)
|
// and add the javascript code (along with a touch of HTML)
|
||||||
@@ -165,27 +192,7 @@ jQuery(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
jQuery('#<?php echo $grid_id; ?>').jqGrid(
|
jQuery('#<?php echo $grid_id; ?>').jqGrid(
|
||||||
<?php
|
<?php echo FormatHelper::phpVarToJavascript($jqGrid_setup); ?>
|
||||||
echo FormatHelper::phpVarToJavascript
|
|
||||||
(array('mtype' => 'GET',
|
|
||||||
'datatype' => 'xml',
|
|
||||||
'url' => $url,
|
|
||||||
'postData' => $postData,
|
|
||||||
'colNames' => array_keys($jqGridColumns),
|
|
||||||
'colModel' => array('--special' => $jqGridColumns),
|
|
||||||
'height' => $height,
|
|
||||||
'rowNum' => $limit,
|
|
||||||
'rowList' => $limitOptions,
|
|
||||||
'sortname' => $sortname,
|
|
||||||
'caption' => $caption,
|
|
||||||
'imgpath' => $imgpath,
|
|
||||||
'viewrecords' => true,
|
|
||||||
'pager' => $grid_id.'-pager',
|
|
||||||
|
|
||||||
'loadComplete' => array('--special' => "function() {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Query</A><BR>');}"),
|
|
||||||
'loadError' => array('--special' => "function(xhr,st,err) {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Error Query</A><BR>');}"),
|
|
||||||
//'toolbar' => array(true,"bottom"),
|
|
||||||
)); ?>
|
|
||||||
).navGrid('#<?php echo $grid_id; ?>-pager',
|
).navGrid('#<?php echo $grid_id; ?>-pager',
|
||||||
{ view:false,
|
{ view:false,
|
||||||
edit:false,
|
edit:false,
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ form div.submit {
|
|||||||
border: 0;
|
border: 0;
|
||||||
clear: both;
|
clear: both;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-left: 140px;
|
/* margin-left: 140px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user