* finish task #2284.
This commit is contained in:
31
module/productplan/js/edit.js
Normal file
31
module/productplan/js/edit.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Convert a date string like 2011-11-11 to date object in js.
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
function convertStringToDate(dateString)
|
||||
{
|
||||
dateString = dateString.split('-');
|
||||
dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
|
||||
|
||||
return Date.parse(dateString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the end date for productplan.
|
||||
*
|
||||
* @param int $delta
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function computeEndDate(delta)
|
||||
{
|
||||
beginDate = $('#begin').val();
|
||||
if(!beginDate) return;
|
||||
|
||||
endDate = convertStringToDate(beginDate).addDays(parseInt(delta));
|
||||
endDate = endDate.toString('yyyy-M-dd');
|
||||
$('#end').val(endDate);
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/datepicker.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::import($jsRoot . 'misc/date.js');?>
|
||||
<div class='container mw-1400px'>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
@@ -33,11 +34,14 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->begin;?></th>
|
||||
<td><?php echo html::input('begin', $plan->begin, 'class="form-control form-date"');?></td>
|
||||
<td><?php echo html::input('begin', $plan->begin, "class='form-control form-date'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->end;?></th>
|
||||
<td><?php echo html::input('end', $plan->end, 'class="form-control form-date"');?></td>
|
||||
<td>
|
||||
<?php echo html::radio('delta', $lang->productplan->endList , '', "onclick='computeEndDate(this.value)'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->desc;?></th>
|
||||
|
||||
Reference in New Issue
Block a user