Consolidated the move out/in pages. I'm really not happy with this checkin, as it has actually reduced functionality. We used to be able to click move-out on a customer and be presented with a list of units to move out of. This was the intention, but I've gotten frustrated with the fact that I'm working on non-MUST functionality. Things are working good enough at the moment, so I'm checking in and will have to come back to this later.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@276 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -188,10 +188,11 @@ class CustomersController extends AppController {
|
||||
$this->Customer->recursive = -1;
|
||||
$customer = current($this->Customer->read(null, $id));
|
||||
}
|
||||
$this->set(compact('customer', 'unit'));
|
||||
|
||||
$title = 'Customer Move-In';
|
||||
$this->set(compact('customer', 'unit', 'title'));
|
||||
$this->render('/leases/move_in');
|
||||
$this->set(compact('title'));
|
||||
$this->render('/leases/move');
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +221,8 @@ class CustomersController extends AppController {
|
||||
|
||||
'conditions' => array('Customer.id' => $id),
|
||||
));
|
||||
$this->set('customer', $lease['Customer']);
|
||||
$this->set('unit', array());
|
||||
|
||||
$redirect = array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
@@ -227,7 +230,7 @@ class CustomersController extends AppController {
|
||||
|
||||
$title = $customer['Customer']['name'] . ': Prepare Move-Out';
|
||||
$this->set(compact('title', 'customer', 'redirect'));
|
||||
$this->render('/leases/move_out');
|
||||
$this->render('/leases/move');
|
||||
}
|
||||
|
||||
|
||||
@@ -273,12 +276,12 @@ class CustomersController extends AppController {
|
||||
'url' => array('action' => 'move_in',
|
||||
$id));
|
||||
|
||||
if ($show_moveout) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out',
|
||||
'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
}
|
||||
/* if ($show_moveout) { */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Move-Out', */
|
||||
/* 'url' => array('action' => 'move_out', */
|
||||
/* $id)); */
|
||||
/* } */
|
||||
|
||||
if ($show_payment) {
|
||||
$this->sidemenu_links[] =
|
||||
|
||||
@@ -156,7 +156,6 @@ class LeasesController extends AppController {
|
||||
// For debugging, only if the redirect above have been
|
||||
// commented out, otherwise this section isn't reached.
|
||||
$this->render('/empty');
|
||||
return;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
@@ -198,6 +197,9 @@ class LeasesController extends AppController {
|
||||
array('Lease.close_date' => null),
|
||||
),
|
||||
));
|
||||
$this->set('customer', $lease['Customer']);
|
||||
$this->set('unit', $lease['Unit']);
|
||||
$this->set('lease', $lease['Lease']);
|
||||
|
||||
$redirect = array('controller' => 'leases',
|
||||
'action' => 'view',
|
||||
@@ -206,7 +208,8 @@ class LeasesController extends AppController {
|
||||
$title = ('Lease #' . $lease['Lease']['number'] . ': ' .
|
||||
$lease['Unit']['name'] . ': ' .
|
||||
$lease['Customer']['name'] . ': Prepare Move-Out');
|
||||
$this->set(compact('title', 'lease', 'redirect'));
|
||||
$this->set(compact('title', 'redirect'));
|
||||
$this->render('/leases/move');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class UnitsController extends AppController {
|
||||
|
||||
$title = 'Unit Move-In';
|
||||
$this->set(compact('customer', 'unit', 'title'));
|
||||
$this->render('/leases/move_in');
|
||||
$this->render('/leases/move');
|
||||
}
|
||||
|
||||
|
||||
@@ -187,16 +187,19 @@ class UnitsController extends AppController {
|
||||
),
|
||||
'conditions' => array('Unit.id' => $id),
|
||||
));
|
||||
$this->set('customer', $unit['CurrentLease']['Customer']);
|
||||
$this->set('unit', $unit['Unit']);
|
||||
$this->set('lease', $unit['CurrentLease']);
|
||||
|
||||
$redirect = array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$id);
|
||||
|
||||
$title = ('Lease' . $unit['CurrentLease']['number'] . ': ' .
|
||||
$title = ('Lease #' . $unit['CurrentLease']['number'] . ': ' .
|
||||
$unit['Unit']['name'] . ': ' .
|
||||
$unit['CurrentLease']['Customer']['name'] . ': Prepare Move-Out');
|
||||
$this->set(compact('title', 'unit', 'redirect'));
|
||||
$this->render('/leases/move_out');
|
||||
$this->set(compact('title', 'redirect'));
|
||||
$this->render('/leases/move');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<?php /* -*- mode:PHP -*- */ ?>
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
<div class="move-in input">
|
||||
$move_action = $this->action;
|
||||
//$move_class = preg_replace("/_/", "-", $this->action);
|
||||
//$move_date = preg_replace("/_/", "", $this->action) . "_date";
|
||||
$move_type = preg_replace("/.*_/", "", $this->action);
|
||||
|
||||
?>
|
||||
|
||||
<div class="move-inout input">
|
||||
|
||||
<?php
|
||||
; // Editor alignment
|
||||
@@ -49,10 +56,10 @@ $unit_grid_setup['onHeaderClick'] = array
|
||||
// Reset the form
|
||||
function resetForm() {
|
||||
$("#customer-id").val(0);
|
||||
$("#movein-customer").html("INTERNAL ERROR");
|
||||
$("#move-customer").html("INTERNAL ERROR");
|
||||
$("#unit-id").val(0);
|
||||
$("#movein-unit").html("INTERNAL ERROR");
|
||||
datepickerNow('LeaseMoveinDate', false);
|
||||
$("#move-unit").html("INTERNAL ERROR");
|
||||
datepickerNow('LeaseMoveDate', false);
|
||||
}
|
||||
|
||||
function onRowSelect(grid_id, item_type, item_id) {
|
||||
@@ -62,7 +69,7 @@ function onRowSelect(grid_id, item_type, item_id) {
|
||||
$("#"+item_type+"-id").val(item_id);
|
||||
|
||||
// Get the item name from the grid
|
||||
$("#movein-"+item_type).html($(grid_id).getCell(item_id, cell_name));
|
||||
$("#move-"+item_type).html($(grid_id).getCell(item_id, cell_name));
|
||||
|
||||
// Hide the "no customer" message and show the current customer
|
||||
$("."+item_type+"-selection-invalid").hide();
|
||||
@@ -95,21 +102,23 @@ function onGridState(grid_id, item_type, state) {
|
||||
<?php
|
||||
; // align
|
||||
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $customer_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
if ($move_type !== 'out') {
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $customer_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
}
|
||||
|
||||
echo ('<DIV CLASS="move-in grid-selection-text">' .
|
||||
echo ('<DIV CLASS="move-inout grid-selection-text">' .
|
||||
|
||||
'<DIV CLASS="customer-selection-valid" style="display:none">' .
|
||||
'Customer: <SPAN id="movein-customer"></SPAN>' .
|
||||
'Customer: <SPAN id="move-customer"></SPAN>' .
|
||||
'</DIV>' .
|
||||
|
||||
'<DIV CLASS="customer-selection-invalid" style="display:none">' .
|
||||
@@ -118,22 +127,25 @@ echo ('<DIV CLASS="move-in grid-selection-text">' .
|
||||
|
||||
'</DIV>' . "\n");
|
||||
|
||||
echo $this->element('units', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'units-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#units-list .HeaderButton\').click();'.
|
||||
' return false;">Select Unit</A>'),
|
||||
'grid_setup' => $unit_grid_setup,
|
||||
'action' => 'unoccupied',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
|
||||
echo ('<DIV CLASS="move-in grid-selection-text">' .
|
||||
if ($move_type !== 'out') {
|
||||
echo $this->element('units', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'units-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#units-list .HeaderButton\').click();'.
|
||||
' return false;">Select Unit</A>'),
|
||||
'grid_setup' => $unit_grid_setup,
|
||||
'action' => 'unoccupied',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
}
|
||||
|
||||
echo ('<DIV CLASS="move-inout grid-selection-text">' .
|
||||
|
||||
'<DIV CLASS="unit-selection-valid" style="display:none">' .
|
||||
'Unit: <SPAN id="movein-unit"></SPAN>' .
|
||||
'Unit: <SPAN id="move-unit"></SPAN>' .
|
||||
'</DIV>' .
|
||||
|
||||
'<DIV CLASS="unit-selection-invalid" style="display:none">' .
|
||||
@@ -142,9 +154,9 @@ echo ('<DIV CLASS="move-in grid-selection-text">' .
|
||||
|
||||
'</DIV>' . "\n");
|
||||
|
||||
echo $form->create(null, array('id' => 'move-in-form',
|
||||
echo $form->create(null, array('id' => 'move-inout-form',
|
||||
'url' => array('controller' => 'leases',
|
||||
'action' => 'move_in')));
|
||||
'action' => $move_action)));
|
||||
|
||||
echo $form->input("Lease.customer_id",
|
||||
array('id' => 'customer-id',
|
||||
@@ -156,23 +168,50 @@ echo $form->input("Lease.unit_id",
|
||||
'type' => 'hidden',
|
||||
'value' => 0));
|
||||
|
||||
if ($move_type === 'out') {
|
||||
echo $form->input('Lease.id',
|
||||
array('type' => 'hidden',
|
||||
'value' => $lease['id'],
|
||||
));
|
||||
}
|
||||
|
||||
echo $this->element('form_table',
|
||||
array('class' => "item move-in entry",
|
||||
array('class' => "item move-inout entry",
|
||||
'field_prefix' => 'Lease',
|
||||
'fields' => array
|
||||
("movein_date" => array('opts' => array('type' => 'text'),
|
||||
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'LeaseMoveinDate\', false); return false;">Now</A>',
|
||||
),
|
||||
('move'.$move_type.'_date' =>
|
||||
array('opts' =>
|
||||
array('type' => 'text',
|
||||
'id' => "LeaseMoveDate"),
|
||||
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'LeaseMoveDate\', false); return false;">Now</A>',
|
||||
),
|
||||
"comment" => array('opts' => array('size' => 50)),
|
||||
)));
|
||||
|
||||
echo $form->end('Move In Customer');
|
||||
|
||||
if ($move_type === 'out') {
|
||||
echo('<P><BR>Be sure that you really want to move this customer out of the unit,<BR>' .
|
||||
'select the correct moveout date,' .
|
||||
'and press the "Perform Move Out" button.' . "\n");
|
||||
}
|
||||
|
||||
// Set up a redirect page. I use lower case 'redirect' here
|
||||
// to avoid the model convention, which starts with upper-case.
|
||||
if (isset($redirect)) {
|
||||
foreach ($redirect AS $name => $value) {
|
||||
echo $form->input("redirect.$name",
|
||||
array('type' => 'hidden',
|
||||
'value' => $value,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
echo $form->end('Perform Move ' . ucfirst($move_type));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$(document).ready(function(){
|
||||
$("#LeaseMoveinDate")
|
||||
$("#LeaseMoveDate")
|
||||
.attr('autocomplete', 'off')
|
||||
.datepicker({ constrainInput: true,
|
||||
numberOfMonths: [1, 1],
|
||||
@@ -183,7 +222,7 @@ echo $form->end('Move In Customer');
|
||||
|
||||
<?php if (isset($customer['id'])): ?>
|
||||
$("#customer-id").val(<?php echo $customer['id']; ?>);
|
||||
$("#movein-customer").html("<?php echo $customer['name']; ?>");
|
||||
$("#move-customer").html("<?php echo $customer['name']; ?>");
|
||||
onGridState(null, 'customer', 'hidden');
|
||||
<?php else: ?>
|
||||
onGridState(null, 'customer', 'visible');
|
||||
@@ -191,7 +230,7 @@ echo $form->end('Move In Customer');
|
||||
|
||||
<?php if (isset($unit['id'])): ?>
|
||||
$("#unit-id").val(<?php echo $unit['id']; ?>);
|
||||
$("#movein-unit").html("<?php echo $unit['name']; ?>");
|
||||
$("#move-unit").html("<?php echo $unit['name']; ?>");
|
||||
onGridState(null, 'unit', 'hidden');
|
||||
<?php else: ?>
|
||||
onGridState(null, 'unit', 'visible');
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
$multiple = false;
|
||||
$class = 'move-out';
|
||||
|
||||
if (isset($lease)) {
|
||||
$class .= ' lease';
|
||||
$data = $lease;
|
||||
}
|
||||
elseif (isset($customer) && count($customer['Lease']) == 1) {
|
||||
$class .= ' customer';
|
||||
$data = array_diff_key($customer, array('Lease'=>1));
|
||||
$data['Lease'] = array_diff_key($customer['Lease'][0], array('Unit'=>1));
|
||||
$data['Unit'] = $customer['Lease'][0]['Unit'];
|
||||
}
|
||||
elseif (isset($customer)) {
|
||||
$class .= ' customer';
|
||||
$data = $customer;
|
||||
$multiple = true;
|
||||
}
|
||||
elseif (isset($unit)) {
|
||||
$class .= ' unit';
|
||||
$data = array_diff_key($unit, array('CurrentLease'=>1));
|
||||
$data['Lease'] = array_diff_key($unit['CurrentLease'], array('Customer'=>1));
|
||||
$data['Customer'] = $unit['CurrentLease']['Customer'];
|
||||
}
|
||||
else {
|
||||
die("INTERNAL ERROR");
|
||||
}
|
||||
|
||||
//pr(compact('customer', 'lease', 'unit', 'class', 'multiple', 'data', 'redirect'));
|
||||
|
||||
echo '<div class="'.$class.'">' . "\n";
|
||||
echo('<H2>Move Out: '. $data['Customer']['name'] .
|
||||
(!$multiple ? ': Unit ' . $data['Unit']['name'] : '') .
|
||||
'</H2>' . "\n");
|
||||
echo('<P>Be sure that you really want to move this customer out, ' .
|
||||
($multiple ? 'select the correct unit to move out of, ' : '') .
|
||||
'and press the "Perform Move Out" button.' . "\n");
|
||||
echo '<P><BR>' . "\n";
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
// Reset the form
|
||||
function resetForm() {
|
||||
datepickerNow('LeaseMoveoutDate', false);
|
||||
}
|
||||
--></script>
|
||||
|
||||
<?php
|
||||
|
||||
echo $form->create(null, array('id' => 'move-out-form',
|
||||
'url' => array('controller' => 'leases',
|
||||
'action' => 'move_out')));
|
||||
|
||||
// REVISIT <AP>: 20090702
|
||||
// Ask how to handle the security deposit
|
||||
// (apply to rent, damages, cleaning, etc).
|
||||
// Let user select the next unit status
|
||||
// (DAMAGED, COMPANY, UNAVAILABLE, RESERVED, DIRTY, VACANT)
|
||||
|
||||
|
||||
if ($multiple) {
|
||||
$options = array();
|
||||
foreach ($data['Lease'] AS $lease)
|
||||
$options[$lease['id']] = $lease['Unit']['name'];
|
||||
echo $form->input('Lease.id', array('label' => 'Move Out of Unit: ',
|
||||
'options' => $options));
|
||||
}
|
||||
else {
|
||||
echo $form->input('Lease.id',
|
||||
array('type' => 'hidden',
|
||||
'value' => $data['Lease']['id'],
|
||||
));
|
||||
}
|
||||
|
||||
echo $this->element('form_table',
|
||||
array('class' => "item move-out entry",
|
||||
'field_prefix' => 'Lease',
|
||||
'fields' => array
|
||||
("moveout_date" => array('opts' => array('type' => 'text'),
|
||||
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'LeaseMoveoutDate\', false); return false;">Now</A>',
|
||||
),
|
||||
)));
|
||||
|
||||
// Set up a redirect page. I use lower case 'redirect' here
|
||||
// to avoid the model convention, which starts with upper-case.
|
||||
foreach ($redirect AS $name => $value) {
|
||||
echo $form->input("redirect.$name",
|
||||
array('type' => 'hidden',
|
||||
'value' => $value,
|
||||
));
|
||||
}
|
||||
|
||||
echo $form->end('Perform Move Out');
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$(document).ready(function(){
|
||||
$("#LeaseMoveoutDate")
|
||||
.attr('autocomplete', 'off')
|
||||
.datepicker({ constrainInput: true,
|
||||
numberOfMonths: [1, 1],
|
||||
showCurrentAtPos: 0,
|
||||
dateFormat: 'mm/dd/yy' });
|
||||
|
||||
resetForm();
|
||||
});
|
||||
--></script>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user