diff --git a/controllers/customers_controller.php b/controllers/customers_controller.php
index 88523d4..d0a1238 100644
--- a/controllers/customers_controller.php
+++ b/controllers/customers_controller.php
@@ -148,6 +148,8 @@ class CustomersController extends AppController {
$this->sidemenu_links[] =
array('name' => 'Operations', 'header' => true);
+ $this->sidemenu_links[] =
+ array('name' => 'Payment', 'url' => array('action' => 'payment', $id));
$this->sidemenu_links[] =
array('name' => 'Move-Out', 'url' => array('controller' => 'units', 'action' => 'move-out'));
@@ -172,12 +174,12 @@ class CustomersController extends AppController {
/* $this->redirect(array('action'=>'index')); */
/* } */
- if ($this->RequestHandler->isPost()) {
- pr($this->data);
- //$this->redirect(array('action'=>'index'));
- $customer = $this->data;
- }
- elseif (isset($id)) {
+/* if ($this->RequestHandler->isPost()) { */
+/* pr($this->data); */
+/* //$this->redirect(array('action'=>'index')); */
+/* $customer = $this->data; */
+/* } */
+ if (isset($id)) {
$customer = $this->Customer->details($id);
unset($customer['deposits']['Entries']);
}
diff --git a/views/customers/payment.ctp b/views/customers/payment.ctp
index b3c2b88..78151bb 100644
--- a/views/customers/payment.ctp
+++ b/views/customers/payment.ctp
@@ -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);
-echo ("
" . $customer['Customer']['name'] . "
\n");
+//echo ('Get grid code
');
// Customer
// Outstanding balance
@@ -63,8 +93,6 @@ echo ("" . $customer['Customer']['name'] . "
\n");
// How to apply (even split, oldest charges first, etc)
-echo $form->create(null, array('id' => 'payment-form', 'action' => 'payment'));
-
?>
+' . "\n";
+
+echo $this->element('customers',
+ array('caption' => 'Select Customer',
+ 'limit' => 7,
+ 'grid_setup' => $grid_setup,
+ ));
+
+echo ('' .
+ (isset($customer['Customer']['id'])
+ ? 'Receipt for ' . $customer['Customer']['name']
+ : 'Please select customer') .
+ '
' . "\n");
+
+ //echo $form->create(null, array('id' => 'payment-form', 'action' => 'other'));
+ echo $form->create(null, array('id' => 'payment-form', 'url' => 'http://localhost/vars.php'));
+?>
+
+