Modified the datepickerNow() function to return results without the time (just date). Updated the move_in datepicker to use it and added a link for the user.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@272 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-09 00:31:56 +00:00
parent 233b08df59
commit 222758b20f
2 changed files with 21 additions and 14 deletions

View File

@@ -52,6 +52,7 @@ function resetForm() {
$("#movein-customer").html("INTERNAL ERROR");
$("#unit-id").val(0);
$("#movein-unit").html("INTERNAL ERROR");
datepickerNow('LeaseMoveinDate', false);
}
function onRowSelect(grid_id, item_type, item_id) {
@@ -159,8 +160,9 @@ echo $this->element('form_table',
array('class' => "item move-in entry",
'field_prefix' => 'Lease',
'fields' => array
("movein_date" => array('opts' => array('type' => 'text',
'id' => 'datepicker')),
("movein_date" => array('opts' => array('type' => 'text'),
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'LeaseMoveinDate\', false); return false;">Now</A>',
),
"comment" => array('opts' => array('size' => 50)),
)));
@@ -170,11 +172,12 @@ 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');
$("#LeaseMoveinDate")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm();

View File

@@ -145,17 +145,21 @@ function fmtCurrency(amount) {
//
// Datepicker helpers
function datepickerNow(id) {
function datepickerNow(id, usetime) {
now = new Date();
// datepicker seems to squash the time portion,
// so we have to pass in a copy of now instead.
$("#"+id).datepicker('setDate', new Date(now));
$("#"+id).val($("#"+id).val()
+ ' '
+ (now.getHours() < 10 ? '0' : '')
+ now.getHours() + ':'
+ (now.getMinutes() < 10 ? '0' : '')
+ now.getMinutes());
if (usetime == null)
usetime = true;
$("#"+id).val($("#"+id).val() +
(usetime
? (' '
+ (now.getHours() < 10 ? '0' : '')
+ now.getHours() + ':'
+ (now.getMinutes() < 10 ? '0' : '')
+ now.getMinutes())
: ''));
}
function datepickerSet(fromid, id, a, b) {