* Finish task #9021.

This commit is contained in:
tianshujie98
2021-01-13 10:15:51 +08:00
parent 9d450de2b8
commit df0113d622
7 changed files with 69 additions and 63 deletions
+12 -10
View File
@@ -333,6 +333,8 @@ class custom extends control
*/
public function estimate()
{
/* Load config and set menu. */
$this->app->loadConfig('project');
$this->lang->custom->menu = $this->lang->subject->menu;
$this->lang->navGroup->custom = 'system';
$key = array_search('custom', $this->lang->noMenuModule);
@@ -340,9 +342,12 @@ class custom extends control
if(strtolower($this->server->request_method) == "post")
{
/* Load module and get the data from the post. */
$this->loadModel('setting');
$data = fixer::input('post')->setIF(!isset($_POST['efficiency']), 'efficiency', 1)->get();
if(isset($_POST['scaleFactor']) and empty($this->post->scaleFactor))
/* Judgment of required items. */
if(isset($_POST['scaleFactor']) and empty($_POST['scaleFactor']))
{
dao::$errors['scaleFactor'] = sprintf($this->lang->error->notempty, $this->lang->custom->convertRelations);
$this->send(array('result' => 'fail', 'message' => dao::getError()));
@@ -354,15 +359,13 @@ class custom extends control
$this->setting->setItem('system.custom.days', $data->days);
$this->setting->setItem('system.project.defaultWorkhours', $data->defaultWorkhours);
/* Update story estimate field. */
if(isset($_POST['scaleFactor']))
{
$stories = $this->dao->select('*')->from(TABLE_STORY)->fetchAll();
foreach($stories as $story)
{
$this->dao->update(TABLE_STORY)
->set('estimate')->eq($story->estimate * $this->post->scaleFactor)
->where('id')->eq($story->id)
->exec();
$this->dao->update(TABLE_STORY)->set('estimate')->eq($story->estimate * $this->post->scaleFactor)->where('id')->eq($story->id)->exec();
}
}
@@ -370,17 +373,16 @@ class custom extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'estimate')));
}
$this->app->loadConfig('project');
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->estimateConfig;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->estimateConfig;
$this->view->unit = zget($this->config->custom, 'hourPoint', '1');
$this->view->cost = zget($this->config->custom, 'cost', '');
$this->view->efficiency = zget($this->config->custom, 'efficiency', '');
$this->view->hours = zget($this->config->project, 'defaultWorkhours', '');
$this->view->days = zget($this->config->custom, 'days', '');
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->estimateConfig;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->estimateConfig;
$this->display();
}
+41
View File
@@ -0,0 +1,41 @@
$(document).ready(function()
{
$('#estimateTab').addClass('btn-active-text');
$('input[name="hourPoint"]').change(function()
{
/* Show or hide conversion relation fields. */
if($(this).val() == unit)
{
$('#convertRelations').addClass('hidden');
}
else
{
$('#convertRelations').removeClass('hidden');
}
if($(this).val() == 0)
{
$('#scaleFactor + span').text(workingHours);
$('#efficiency + span').text(workingHours);
$('#efficiency').val("1");
$('#efficiency').attr('disabled', 'diabled');
}
if($(this).val() == 1 || $(this).val() == 2)
{
$('#efficiency').val('');
$('#efficiency').removeAttr('disabled');
if($(this).val() == 1)
{
$('#scaleFactor + span').text(storyPoint);
$('#efficiency + span').text(efficiency + storyPoint);
}
if($(this).val() == 2)
{
$('#scaleFactor + span').text(functionPoint);
$('#efficiency + span').text(efficiency + functionPoint);
}
}
});
});
+2
View File
@@ -28,6 +28,7 @@ $lang->custom->estimateEfficiency = 'Productivity';
$lang->custom->estimateCost = 'Unit Labour Cost';
$lang->custom->estimateHours = 'Daily Working Hours';
$lang->custom->estimateDays = 'Working Days Per Week';
$lang->custom->convertRelations = 'Convert Relations';
$lang->custom->region = 'Interval';
$lang->custom->tips = 'Tips';
$lang->custom->setTips = 'Set Tips';
@@ -48,6 +49,7 @@ $lang->custom->deleteStoryConcept = "Delete story Concept";
$lang->custom->configureScrum = "Scrum Model Custom";
$lang->custom->URConcept = "UR Concept";
$lang->custom->SRConcept = "SR Concept";
$lang->custom->one = "One";
$lang->custom->unitList['efficiency'] = 'Working Hours/';
$lang->custom->unitList['manhour'] = 'Man-hour/';
+2
View File
@@ -28,6 +28,7 @@ $lang->custom->estimateEfficiency = 'Productivity';
$lang->custom->estimateCost = 'Unit Labour Cost';
$lang->custom->estimateHours = 'Daily Working Hours';
$lang->custom->estimateDays = 'Working Days Per Week';
$lang->custom->convertRelations = 'Convert Relations';
$lang->custom->region = 'Interval';
$lang->custom->tips = 'Tips';
$lang->custom->setTips = 'Set Tips';
@@ -48,6 +49,7 @@ $lang->custom->deleteStoryConcept = "Delete story Concept";
$lang->custom->configureScrum = "Scrum Model Custom";
$lang->custom->URConcept = "UR Concept";
$lang->custom->SRConcept = "SR Concept";
$lang->custom->one = "One";
$lang->custom->unitList['efficiency'] = 'Working Hours/';
$lang->custom->unitList['manhour'] = 'Man-hour/';
+2
View File
@@ -28,6 +28,7 @@ $lang->custom->estimateEfficiency = 'Productivity';
$lang->custom->estimateCost = 'Unit Labour Cost';
$lang->custom->estimateHours = 'Daily Working Hours';
$lang->custom->estimateDays = 'Working Days Per Week';
$lang->custom->convertRelations = 'Convert Relations';
$lang->custom->region = 'Interval';
$lang->custom->tips = 'Tips';
$lang->custom->setTips = 'Set Tips';
@@ -48,6 +49,7 @@ $lang->custom->deleteStoryConcept = "Delete story Concept";
$lang->custom->configureScrum = "Scrum Model Custom";
$lang->custom->URConcept = "UR Concept";
$lang->custom->SRConcept = "SR Concept";
$lang->custom->one = "One";
$lang->custom->unitList['efficiency'] = 'Working Hours/';
$lang->custom->unitList['manhour'] = 'Man-hour/';
+2
View File
@@ -28,6 +28,7 @@ $lang->custom->estimateEfficiency = 'Productivity';
$lang->custom->estimateCost = 'Unit Labour Cost';
$lang->custom->estimateHours = 'Daily Working Hours';
$lang->custom->estimateDays = 'Working Days Per Week';
$lang->custom->convertRelations = 'Convert Relations';
$lang->custom->region = 'Interval';
$lang->custom->tips = 'Tips';
$lang->custom->setTips = 'Set Tips';
@@ -48,6 +49,7 @@ $lang->custom->deleteStoryConcept = "Delete story Concept";
$lang->custom->configureScrum = "Scrum Model Custom";
$lang->custom->URConcept = "UR Concept";
$lang->custom->SRConcept = "SR Concept";
$lang->custom->one = "One";
$lang->custom->unitList['efficiency'] = 'Working Hours/';
$lang->custom->unitList['manhour'] = 'Man-hour/';
+8 -53
View File
@@ -1,4 +1,9 @@
<?php include '../../common/view/header.html.php';?>
<?php js::set('workingHours', $lang->custom->conceptOptions->hourPoint[0]);?>
<?php js::set('storyPoint', $lang->custom->conceptOptions->hourPoint[1]);?>
<?php js::set('functionPoint', $lang->custom->conceptOptions->hourPoint[2]);?>
<?php js::set('efficiency', $lang->custom->unitList['efficiency']);?>
<?php js::set('unit', $unit);?>
<?php
$lang->custom->object = array();
$lang->custom->system = array();
@@ -21,7 +26,7 @@ $lang->custom->system[] = 'estimate';
<td class='w-350px'><?php echo html::radio('hourPoint', $lang->custom->conceptOptions->hourPoint, $unit);?></td>
<td></td>
</tr>
<tr class='hidden' id='storyScale'>
<tr class='hidden' id='convertRelations'>
<th class='w-150px'><?php echo $lang->custom->one . $lang->custom->conceptOptions->hourPoint[$unit];?></th>
<td>
<div class='input-group w-300px'>
@@ -37,14 +42,8 @@ $lang->custom->system[] = 'estimate';
<td>
<div class='input-group w-300px'>
<?php
if($unit == 0)
{
echo html::input('efficiency', $efficiency, "class='form-control' disabled");
}
else
{
echo html::input('efficiency', $efficiency, "class='form-control'");
}
if($unit == 0) echo html::input('efficiency', $efficiency, "class='form-control' disabled");
if($unit != 0) echo html::input('efficiency', $efficiency, "class='form-control'");
?>
<span class='input-group-addon unify-padding'>
<?php
@@ -100,48 +99,4 @@ $lang->custom->system[] = 'estimate';
</form>
</div>
</div>
<?php js::set('workingHours', $lang->custom->conceptOptions->hourPoint[0]);?>
<?php js::set('storyPoint', $lang->custom->conceptOptions->hourPoint[1]);?>
<?php js::set('functionPoint', $lang->custom->conceptOptions->hourPoint[2]);?>
<?php js::set('efficiency', $lang->custom->unitList['efficiency']);?>
<?php js::set('unit', $unit);?>
<script>
$('#estimateTab').addClass('btn-active-text');
$('input[name="hourPoint"]').change(function()
{
if($(this).val() == unit)
{
$('#storyScale').addClass('hidden');
}
else
{
$('#storyScale').removeClass('hidden');
}
if($(this).val() == 0)
{
$('#scaleFactor + span').text(workingHours);
$('#efficiency + span').text(workingHours);
$('#efficiency').val("1");
$('#efficiency').attr('disabled', 'diabled');
}
if($(this).val() == 1 || $(this).val() == 2)
{
$('#efficiency').val('');
$('#efficiency').removeAttr('disabled');
if($(this).val() == 1)
{
$('#scaleFactor + span').text(storyPoint);
$('#efficiency + span').text(efficiency + storyPoint);
}
if($(this).val() == 2)
{
$('#scaleFactor + span').text(functionPoint);
$('#efficiency + span').text(efficiency + functionPoint);
}
}
})
</script>
<?php include '../../common/view/footer.html.php';?>