Removed the debug portions of receipt entry, and added a checkbox to allow the user to either keep entering receipts, or have the page automatically transition to the customer page.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@521 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
* Javascript
|
||||
*/
|
||||
|
||||
// Warnings _really_ screw up javascript
|
||||
$saved_debug_state = Configure::read('debug');
|
||||
Configure::write('debug', '0');
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
@@ -23,14 +26,8 @@
|
||||
success: showResponse, // post-submit callback
|
||||
|
||||
// other available options:
|
||||
//url: url, // override for form's 'action' attribute
|
||||
//type: 'get', // 'get' or 'post', override for form's 'method' attribute
|
||||
//dataType: null, // 'xml', 'script', or 'json' (expected server response type)
|
||||
//clearForm: true, // clear all form fields after successful submit
|
||||
//resetForm: true, // reset the form after successful submit
|
||||
|
||||
// $.ajax options can be used here too, for example:
|
||||
//timeout: 3000,
|
||||
};
|
||||
|
||||
// bind form using 'ajaxForm'
|
||||
@@ -39,16 +36,7 @@
|
||||
|
||||
// pre-submit callback
|
||||
function verifyRequest(formData, jqForm, options) {
|
||||
// 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
|
||||
//var_dump(formData);
|
||||
//$('#request-debug').html('<PRE>'+dump(formData)+'</PRE>');
|
||||
$('#request-debug').html('Ommitted');
|
||||
//return false;
|
||||
|
||||
$('#response-debug').html('Loading <BLINK>...</BLINK>');
|
||||
$('#output-debug').html('Loading <BLINK>...</BLINK>');
|
||||
|
||||
$('#results').html('Working <BLINK>...</BLINK>');
|
||||
// here we could return false to prevent the form from being submitted;
|
||||
// returning anything other than false will allow the form submit to continue
|
||||
return true;
|
||||
@@ -56,29 +44,32 @@ function verifyRequest(formData, jqForm, options) {
|
||||
|
||||
// post-submit callback
|
||||
function showResponse(responseText, statusText) {
|
||||
// for normal html responses, the first argument to the success callback
|
||||
// is the XMLHttpRequest object's responseText property
|
||||
|
||||
// if the ajaxForm method was passed an Options Object with the dataType
|
||||
// property set to 'xml' then the first argument to the success callback
|
||||
// is the XMLHttpRequest object's responseXML property
|
||||
|
||||
// if the ajaxForm method was passed an Options Object with the dataType
|
||||
// property set to 'json' then the first argument to the success callback
|
||||
// is the json data object returned by the server
|
||||
|
||||
if (statusText == 'success') {
|
||||
var amount = 0;
|
||||
$("input.payment.amount").each(function(i) {
|
||||
amount += $(this).val();
|
||||
});
|
||||
|
||||
$('#results').html('<H3>Receipt Saved<BR>' +
|
||||
$("#receipt-customer-name").html() +
|
||||
' : ' + fmtCurrency(amount) +
|
||||
'</H3>');
|
||||
|
||||
if (!$("#repeat").attr("checked")) {
|
||||
window.location.href =
|
||||
"<?php echo $html->url(array('controller' => 'customers',
|
||||
'action' => 'view')); ?>"
|
||||
+ "/" + $("#customer-id").val();
|
||||
return;
|
||||
}
|
||||
|
||||
// get a clean slate
|
||||
//resetForm();
|
||||
// REVISIT <AP>: 20090806 Add to resetForm()
|
||||
updateCharges($("#customer-id").val());
|
||||
resetForm();
|
||||
}
|
||||
else {
|
||||
alert('not successful??');
|
||||
$('#results').html('<H2>Failed to save receipt!</H2>');
|
||||
alert('Failed to save receipt.');
|
||||
}
|
||||
|
||||
|
||||
$('#response-debug').html('<PRE>'+dump(statusText)+'</PRE>');
|
||||
}
|
||||
|
||||
// Reset the form
|
||||
@@ -86,13 +77,8 @@ function resetForm() {
|
||||
$('#payment-entry-id').val(1);
|
||||
$('#payments').html('');
|
||||
|
||||
$("#receipt-customer-id").html("INTERNAL ERROR");
|
||||
$("#receipt-customer-name").html("INTERNAL ERROR");
|
||||
$("#receipt-balance").html("INTERNAL ERROR");
|
||||
$("#receipt-charges-caption").html("Outstanding Charges");
|
||||
|
||||
addPaymentSource(false);
|
||||
datepickerNow('TransactionStamp');
|
||||
updateCharges($("#customer-id").val());
|
||||
}
|
||||
|
||||
function onRowSelect(grid_id, customer_id) {
|
||||
@@ -174,7 +160,7 @@ function addPaymentSource(flash) {
|
||||
'<DIV ID="payment-amount-div-%{id}" CLASS="input text required">' +
|
||||
' <INPUT TYPE="text" SIZE="20"' +
|
||||
' NAME="data[Entry][%{id}][amount]"' +
|
||||
' CLASS="payment"' +
|
||||
' CLASS="payment amount"' +
|
||||
' ID="payment-amount-%{id}" />' +
|
||||
' <LABEL CLASS="payment" FOR="payment-amount-%{id}">Amount</LABEL>' +
|
||||
'</DIV>' +
|
||||
@@ -220,11 +206,13 @@ function addPaymentSource(flash) {
|
||||
}
|
||||
|
||||
function switchPaymentType(paymentid_base, paymentid, radioid) {
|
||||
$("."+paymentid_base+"-"+paymentid).slideUp();
|
||||
var type_id = $("#"+radioid).val();
|
||||
$("."+paymentid_base+"-"+paymentid+
|
||||
":not(" +
|
||||
"#"+paymentid_base+"-"+paymentid+"-"+type_id +
|
||||
")").slideUp();
|
||||
$("#"+paymentid_base+"-"+paymentid+"-"+type_id).slideDown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateChargesGrid(idlist) {
|
||||
var dynamic_post = new Array();
|
||||
@@ -268,11 +256,12 @@ function updateCharges(id) {
|
||||
}
|
||||
|
||||
|
||||
--></script>
|
||||
--></script>
|
||||
|
||||
<?php
|
||||
; // align
|
||||
//echo '<DIV ID="dialog">' . "\n";
|
||||
// Re-Enable warnings
|
||||
Configure::write('debug', $saved_debug_state);
|
||||
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
@@ -363,6 +352,10 @@ echo $this->element('form_table',
|
||||
),
|
||||
)));
|
||||
|
||||
echo "<BR>\n";
|
||||
echo $form->input('repeat', array('type' => 'checkbox',
|
||||
'id' => 'repeat',
|
||||
'label' => 'Enter Multiple Receipts')) . "\n";
|
||||
echo $form->submit('Generate Receipt') . "\n";
|
||||
?>
|
||||
|
||||
@@ -383,9 +376,13 @@ echo $form->submit('Generate Receipt') . "\n";
|
||||
|
||||
<?php /* echo '</DIV>' . "\n"; // End of the dialog DIV */ ?>
|
||||
|
||||
<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>
|
||||
<div id="results"></div>
|
||||
<div id="output-debug" style="display:none"></div>
|
||||
|
||||
<?php
|
||||
// Warnings _really_ screw up javascript
|
||||
Configure::write('debug', '0');
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$(document).ready(function(){
|
||||
@@ -396,6 +393,13 @@ echo $form->submit('Generate Receipt') . "\n";
|
||||
showCurrentAtPos: 0,
|
||||
dateFormat: 'mm/dd/yy' });
|
||||
|
||||
datepickerNow('TransactionStamp');
|
||||
|
||||
$("#receipt-customer-id").html("INTERNAL ERROR");
|
||||
$("#receipt-customer-name").html("INTERNAL ERROR");
|
||||
$("#receipt-balance").html("INTERNAL ERROR");
|
||||
$("#receipt-charges-caption").html("Outstanding Charges");
|
||||
|
||||
resetForm();
|
||||
|
||||
<?php if (isset($customer['id'])): ?>
|
||||
@@ -413,37 +417,7 @@ echo $form->submit('Generate Receipt') . "\n";
|
||||
onGridState(null, 'visible');
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
/* $("#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>
|
||||
|
||||
</div>
|
||||
|
||||
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>
|
||||
|
||||
Reference in New Issue
Block a user