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
|
* Javascript
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Warnings _really_ screw up javascript
|
||||||
|
$saved_debug_state = Configure::read('debug');
|
||||||
|
Configure::write('debug', '0');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
@@ -23,14 +26,8 @@
|
|||||||
success: showResponse, // post-submit callback
|
success: showResponse, // post-submit callback
|
||||||
|
|
||||||
// other available options:
|
// 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
|
//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:
|
|
||||||
//timeout: 3000,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// bind form using 'ajaxForm'
|
// bind form using 'ajaxForm'
|
||||||
@@ -39,16 +36,7 @@
|
|||||||
|
|
||||||
// pre-submit callback
|
// pre-submit callback
|
||||||
function verifyRequest(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
|
$('#results').html('Working <BLINK>...</BLINK>');
|
||||||
// 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>');
|
|
||||||
|
|
||||||
// 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
|
||||||
return true;
|
return true;
|
||||||
@@ -56,29 +44,32 @@ function verifyRequest(formData, jqForm, options) {
|
|||||||
|
|
||||||
// post-submit callback
|
// post-submit callback
|
||||||
function showResponse(responseText, statusText) {
|
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') {
|
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
|
// get a clean slate
|
||||||
//resetForm();
|
resetForm();
|
||||||
// REVISIT <AP>: 20090806 Add to resetForm()
|
|
||||||
updateCharges($("#customer-id").val());
|
|
||||||
}
|
}
|
||||||
else {
|
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
|
// Reset the form
|
||||||
@@ -86,13 +77,8 @@ function resetForm() {
|
|||||||
$('#payment-entry-id').val(1);
|
$('#payment-entry-id').val(1);
|
||||||
$('#payments').html('');
|
$('#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);
|
addPaymentSource(false);
|
||||||
datepickerNow('TransactionStamp');
|
updateCharges($("#customer-id").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRowSelect(grid_id, customer_id) {
|
function onRowSelect(grid_id, customer_id) {
|
||||||
@@ -174,7 +160,7 @@ function addPaymentSource(flash) {
|
|||||||
'<DIV ID="payment-amount-div-%{id}" CLASS="input text required">' +
|
'<DIV ID="payment-amount-div-%{id}" CLASS="input text required">' +
|
||||||
' <INPUT TYPE="text" SIZE="20"' +
|
' <INPUT TYPE="text" SIZE="20"' +
|
||||||
' NAME="data[Entry][%{id}][amount]"' +
|
' NAME="data[Entry][%{id}][amount]"' +
|
||||||
' CLASS="payment"' +
|
' CLASS="payment amount"' +
|
||||||
' ID="payment-amount-%{id}" />' +
|
' ID="payment-amount-%{id}" />' +
|
||||||
' <LABEL CLASS="payment" FOR="payment-amount-%{id}">Amount</LABEL>' +
|
' <LABEL CLASS="payment" FOR="payment-amount-%{id}">Amount</LABEL>' +
|
||||||
'</DIV>' +
|
'</DIV>' +
|
||||||
@@ -220,11 +206,13 @@ function addPaymentSource(flash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchPaymentType(paymentid_base, paymentid, radioid) {
|
function switchPaymentType(paymentid_base, paymentid, radioid) {
|
||||||
$("."+paymentid_base+"-"+paymentid).slideUp();
|
|
||||||
var type_id = $("#"+radioid).val();
|
var type_id = $("#"+radioid).val();
|
||||||
|
$("."+paymentid_base+"-"+paymentid+
|
||||||
|
":not(" +
|
||||||
|
"#"+paymentid_base+"-"+paymentid+"-"+type_id +
|
||||||
|
")").slideUp();
|
||||||
$("#"+paymentid_base+"-"+paymentid+"-"+type_id).slideDown();
|
$("#"+paymentid_base+"-"+paymentid+"-"+type_id).slideDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateChargesGrid(idlist) {
|
function updateChargesGrid(idlist) {
|
||||||
var dynamic_post = new Array();
|
var dynamic_post = new Array();
|
||||||
@@ -268,11 +256,12 @@ function updateCharges(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--></script>
|
--></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
; // align
|
; // align
|
||||||
//echo '<DIV ID="dialog">' . "\n";
|
// Re-Enable warnings
|
||||||
|
Configure::write('debug', $saved_debug_state);
|
||||||
|
|
||||||
echo $this->element('customers', array
|
echo $this->element('customers', array
|
||||||
('config' => 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";
|
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 */ ?>
|
<?php /* echo '</DIV>' . "\n"; // End of the dialog DIV */ ?>
|
||||||
|
|
||||||
<div><H4>Request</H4><div id="request-debug"></div></div>
|
<div id="results"></div>
|
||||||
<div><H4>Response</H4><div id="response-debug"></div></div>
|
<div id="output-debug" style="display:none"></div>
|
||||||
<div><H4>Output</H4><div id="output-debug"></div></div>
|
|
||||||
|
<?php
|
||||||
|
// Warnings _really_ screw up javascript
|
||||||
|
Configure::write('debug', '0');
|
||||||
|
?>
|
||||||
|
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@@ -396,6 +393,13 @@ echo $form->submit('Generate Receipt') . "\n";
|
|||||||
showCurrentAtPos: 0,
|
showCurrentAtPos: 0,
|
||||||
dateFormat: 'mm/dd/yy' });
|
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();
|
resetForm();
|
||||||
|
|
||||||
<?php if (isset($customer['id'])): ?>
|
<?php if (isset($customer['id'])): ?>
|
||||||
@@ -413,37 +417,7 @@ echo $form->submit('Generate Receipt') . "\n";
|
|||||||
onGridState(null, 'visible');
|
onGridState(null, 'visible');
|
||||||
<?php endif; ?>
|
<?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>
|
--></script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user