|
|
|
|
@@ -19,7 +19,12 @@ if (isset($customer['id']))
|
|
|
|
|
|
|
|
|
|
$customer_grid_setup['onSelectRow'] = array
|
|
|
|
|
('--special' =>
|
|
|
|
|
'function(ids) { if (ids != null) { onCustomerRowSelect("#"+$(this).attr("id"), ids); } }'
|
|
|
|
|
'function(ids) { if (ids != null) { onRowSelect("#"+$(this).attr("id"), "customer", ids); } }'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$customer_grid_setup['onHeaderClick'] = array
|
|
|
|
|
('--special' =>
|
|
|
|
|
'function(gridstate) { onGridState("#"+$(this).attr("id"), "customer", gridstate); }'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$unit_grid_setup = array();
|
|
|
|
|
@@ -29,49 +34,58 @@ if (isset($unit['id']))
|
|
|
|
|
|
|
|
|
|
$unit_grid_setup['onSelectRow'] = array
|
|
|
|
|
('--special' =>
|
|
|
|
|
'function(ids) { if (ids != null) { onUnitRowSelect("#"+$(this).attr("id"), ids); } }'
|
|
|
|
|
'function(ids) { if (ids != null) { onRowSelect("#"+$(this).attr("id"), "unit", ids); } }'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$unit_grid_setup['onHeaderClick'] = array
|
|
|
|
|
('--special' =>
|
|
|
|
|
'function(gridstate) { onGridState("#"+$(this).attr("id"), "unit", gridstate); }'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<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());
|
|
|
|
|
// Reset the form
|
|
|
|
|
function resetForm() {
|
|
|
|
|
$("#customer-id").val(0);
|
|
|
|
|
$("#movein-customer").html("INTERNAL ERROR");
|
|
|
|
|
$("#unit-id").val(0);
|
|
|
|
|
$("#movein-unit").html("INTERNAL ERROR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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"));
|
|
|
|
|
function onRowSelect(grid_id, item_type, item_id) {
|
|
|
|
|
cell_name = item_type.charAt(0).toUpperCase() + item_type.substr(1) + "-name";
|
|
|
|
|
|
|
|
|
|
// Set the item id that will be returned with the form
|
|
|
|
|
$("#"+item_type+"-id").val(item_id);
|
|
|
|
|
|
|
|
|
|
// Get the item name from the grid
|
|
|
|
|
$("#movein-"+item_type).html($(grid_id).getCell(item_id, cell_name));
|
|
|
|
|
|
|
|
|
|
// Hide the "no customer" message and show the current customer
|
|
|
|
|
$("#no_customer").hide();
|
|
|
|
|
$("#current_customer").show();
|
|
|
|
|
$("#no-"+item_type).hide();
|
|
|
|
|
$("#current-"+item_type).show();
|
|
|
|
|
|
|
|
|
|
$("#customers-list .HeaderButton").click();
|
|
|
|
|
$("#"+item_type+"s-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();
|
|
|
|
|
function onGridState(grid_id, item_type, state) {
|
|
|
|
|
if (state == 'visible') {
|
|
|
|
|
$("#no-"+item_type).hide();
|
|
|
|
|
$("#current-"+item_type).hide();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//if ($(grid_id).getGridParam("selrow"))
|
|
|
|
|
//alert("id:" + $("#"+item_type+"-id").val());
|
|
|
|
|
if ($("#"+item_type+"-id").val() > 0) {
|
|
|
|
|
$("#current-"+item_type).show();
|
|
|
|
|
$("#no-"+item_type).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$("#current-"+item_type).hide();
|
|
|
|
|
$("#no-"+item_type).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -82,6 +96,7 @@ function onUnitRowSelect(grid_id, unit_id) {
|
|
|
|
|
|
|
|
|
|
echo $this->element('customers',
|
|
|
|
|
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,
|
|
|
|
|
@@ -89,8 +104,14 @@ echo $this->element('customers',
|
|
|
|
|
'limit' => 10,
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
echo ('<H2>' .
|
|
|
|
|
'<SPAN id="current-customer">Customer: <SPAN id="movein-customer"></SPAN></SPAN>' .
|
|
|
|
|
'<SPAN id="no-customer">Please select customer</SPAN>' .
|
|
|
|
|
'</H2>' . "\n");
|
|
|
|
|
|
|
|
|
|
echo $this->element('units',
|
|
|
|
|
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,
|
|
|
|
|
@@ -100,23 +121,8 @@ echo $this->element('units',
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
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>' .
|
|
|
|
|
'<SPAN id="current-unit">Unit: <SPAN id="movein-unit"></SPAN></SPAN>' .
|
|
|
|
|
'<SPAN id="no-unit">Please select unit</SPAN>' .
|
|
|
|
|
'</H2>' . "\n");
|
|
|
|
|
|
|
|
|
|
echo $form->create(null, array('id' => 'move-in-form',
|
|
|
|
|
@@ -126,12 +132,12 @@ echo $form->create(null, array('id' => 'move-in-form',
|
|
|
|
|
echo $form->input("Lease.customer_id",
|
|
|
|
|
array('id' => 'customer-id',
|
|
|
|
|
'type' => 'hidden',
|
|
|
|
|
'value' => isset($customer['id']) ? $customer['id'] : 0));
|
|
|
|
|
'value' => 0));
|
|
|
|
|
|
|
|
|
|
echo $form->input("Lease.unit_id",
|
|
|
|
|
array('id' => 'unit-id',
|
|
|
|
|
'type' => 'hidden',
|
|
|
|
|
'value' => isset($unit['id']) ? $unit['id'] : 0));
|
|
|
|
|
'value' => 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";
|
|
|
|
|
@@ -147,11 +153,26 @@ echo $form->end('Move In Customer');
|
|
|
|
|
dateFormat: 'mm/dd/yy' })
|
|
|
|
|
.datepicker('setDate', '+0');
|
|
|
|
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
|
|
|
|
<?php if (isset($customer['id'])): ?>
|
|
|
|
|
$("#customer-id").val(<?php echo $customer['id']; ?>);
|
|
|
|
|
$("#movein-customer").html("<?php echo $customer['name']; ?>");
|
|
|
|
|
$("#current-customer").show();
|
|
|
|
|
$("#no-customer").hide();
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
$("#current-customer").hide();
|
|
|
|
|
$("#no-customer").hide();
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($unit['id'])): ?>
|
|
|
|
|
$("#unit-id").val(<?php echo $unit['id']; ?>);
|
|
|
|
|
$("#movein-unit").html("<?php echo $unit['name']; ?>");
|
|
|
|
|
$("#current-unit").show();
|
|
|
|
|
$("#no-unit").hide();
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
$("#current-unit").hide();
|
|
|
|
|
$("#no-unit").hide();
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
});
|
|
|
|
|
--></script>
|
|
|
|
|
|