git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@204 97e9348a-65ac-dc4b-aefc-98561f571b83
160 lines
4.9 KiB
PHP
160 lines
4.9 KiB
PHP
<?php /* -*- mode:PHP -*- */ ?>
|
|
|
|
<div class="move-in input">
|
|
|
|
<?php
|
|
; // Editor alignment
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
*
|
|
*/
|
|
|
|
$customer_grid_setup = array();
|
|
|
|
if (isset($customer['id']))
|
|
$customer_grid_setup['hiddengrid'] = true;
|
|
|
|
$customer_grid_setup['onSelectRow'] = array
|
|
('--special' =>
|
|
'function(ids) { if (ids != null) { onCustomerRowSelect("#"+$(this).attr("id"), ids); } }'
|
|
);
|
|
|
|
$unit_grid_setup = array();
|
|
|
|
if (isset($unit['id']))
|
|
$unit_grid_setup['hiddengrid'] = true;
|
|
|
|
$unit_grid_setup['onSelectRow'] = array
|
|
('--special' =>
|
|
'function(ids) { if (ids != null) { onUnitRowSelect("#"+$(this).attr("id"), ids); } }'
|
|
);
|
|
|
|
?>
|
|
|
|
<script type="text/javascript"><!--
|
|
|
|
function datepickerNow() {
|
|
now = new Date();
|
|
$("#datepicker").val($.datepicker.formatDate('mm/dd/yy', now)
|
|
+ ' '
|
|
+ (now.getHours() < 10 ? '0' : '')
|
|
+ now.getHours() + ':'
|
|
+ (now.getMinutes() < 10 ? '0' : '')
|
|
+ now.getMinutes());
|
|
}
|
|
|
|
function onCustomerRowSelect(grid_id, cust_id) {
|
|
// Set the customer id that will be returned with the form
|
|
$("#customer-id").val(cust_id);
|
|
|
|
// Get the customer name from the grid
|
|
$("#movein_customer").html($(grid_id).getCell(cust_id, "Customer-name"));
|
|
|
|
// Hide the "no customer" message and show the current customer
|
|
$("#no_customer").hide();
|
|
$("#current_customer").show();
|
|
|
|
$("#customers-list .HeaderButton").click();
|
|
}
|
|
|
|
function onUnitRowSelect(grid_id, unit_id) {
|
|
// Set the unit id that will be returned with the form
|
|
$("#unit-id").val(unit_id);
|
|
|
|
// Get the unit name from the grid
|
|
$("#movein_unit").html($(grid_id).getCell(unit_id, "Unit-name"));
|
|
|
|
// Hide the "no unit" message and show the current unit
|
|
$("#no_unit").hide();
|
|
$("#current_unit").show();
|
|
|
|
$("#units-list .HeaderButton").click();
|
|
}
|
|
|
|
|
|
--></script>
|
|
|
|
<?php
|
|
; // align
|
|
|
|
echo $this->element('customers',
|
|
array('grid_div_id' => 'customers-list',
|
|
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
|
' return false;">Select Customer</A>'),
|
|
'grid_setup' => $customer_grid_setup,
|
|
'nolinks' => true,
|
|
'limit' => 10,
|
|
));
|
|
|
|
echo $this->element('units',
|
|
array('grid_div_id' => 'units-list',
|
|
'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 ('<H2>' .
|
|
'<SPAN id="current_customer" style="display:'.(isset($customer['id'])?"inline":"none").'">' .
|
|
'Customer: ' .
|
|
'<SPAN id="movein_customer">' . (isset($customer['name']) ? $customer['name'] : "") . '</SPAN>' .
|
|
'</SPAN>' .
|
|
'<SPAN id="no_customer" style="display:'.(isset($customer['id'])?"none":"inline").'">' .
|
|
'Please select customer' .
|
|
'</SPAN>' .
|
|
'</H2>' . "\n");
|
|
|
|
echo ('<H2>' .
|
|
'<SPAN id="current_unit" style="display:'.(isset($unit['id'])?"inline":"none").'">' .
|
|
'Unit: ' .
|
|
'<SPAN id="movein_unit">' . (isset($unit['name']) ? $unit['name'] : "") . '</SPAN>' .
|
|
'</SPAN>' .
|
|
'<SPAN id="no_unit" style="display:'.(isset($unit['id'])?"none":"inline").'">' .
|
|
'Please select unit' .
|
|
'</SPAN>' .
|
|
'</H2>' . "\n");
|
|
|
|
echo $form->create(null, array('id' => 'move-in-form',
|
|
'url' => array('controller' => 'leases',
|
|
'action' => 'move_in')));
|
|
|
|
echo $form->input("Lease.customer_id",
|
|
array('id' => 'customer-id',
|
|
'type' => 'hidden',
|
|
'value' => isset($customer['id']) ? $customer['id'] : 0));
|
|
|
|
echo $form->input("Lease.unit_id",
|
|
array('id' => 'unit-id',
|
|
'type' => 'hidden',
|
|
'value' => isset($unit['id']) ? $unit['id'] : 0));
|
|
|
|
echo 'Date: <input id="datepicker" name="data[Lease][movein_date]" type="text" /><BR>' . "\n";
|
|
echo 'Comment: <input id="comment" name="data[Lease][comment]" type="text" SIZE=80 /><BR>' . "\n";
|
|
echo $form->end('Move In Customer');
|
|
|
|
?>
|
|
|
|
<script type="text/javascript"><!--
|
|
$(document).ready(function(){
|
|
$("#datepicker").datepicker({ constrainInput: true,
|
|
numberOfMonths: [1, 1],
|
|
showCurrentAtPos: 0,
|
|
dateFormat: 'mm/dd/yy' })
|
|
.datepicker('setDate', '+0');
|
|
|
|
<?php if (isset($customer['id'])): ?>
|
|
$("#customer-id").val(<?php echo $customer['id']; ?>);
|
|
<?php endif; ?>
|
|
<?php if (isset($unit['id'])): ?>
|
|
$("#unit-id").val(<?php echo $unit['id']; ?>);
|
|
<?php endif; ?>
|
|
});
|
|
--></script>
|
|
|
|
</div>
|