Files
pmgr/site/views/leases/move_out.ctp
abijah a796e9e82d Added some revisit comments for move-out.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@203 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-07-02 20:05:56 +00:00

81 lines
2.4 KiB
PHP

<?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";
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).
// Possibly provide a move-out date.
// 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'],
));
}
// 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');
// End page div
echo '</div>' . "\n";