Merge branch 'sprint/222_zhouxudong_62852' into 'sprint/222'

Sprint/222 zhouxudong 62852

See merge request easycorp/zentaopms!4782
This commit is contained in:
王怡栋
2022-08-04 02:43:25 +00:00
11 changed files with 83 additions and 14 deletions
+29
View File
@@ -718,6 +718,35 @@ class program extends control
echo number_format($budgetLeft, 2);
}
/**
* Ajax get available budget.
*
* @param int $programID
* @param int $selectedProgramID
* @param int $budget
* @access public
* @return void
*/
public function ajaxGetAvailableBudget($programID, $selectedProgramID, $budget)
{
if(!empty($programID))
{
$program = $this->program->getByID($programID);
$selectedProgram = $this->program->getByID($selectedProgramID);
$budgetLeft = $this->program->getBudgetLeft($selectedProgram);
$availableBudget = $program->parent == $selectedProgramID ? $budgetLeft + $program->budget : $budgetLeft;
}
else
{
$selectedProgram = $this->program->getByID($selectedProgramID);
$availableBudget = $this->program->getBudgetLeft($selectedProgram);
}
$tips = '';
if($budget != 0 && $budget !== null && $budget > $availableBudget) $tips = "<span id='beyondBudgetTip' class='text-remind'>" . $this->lang->program->budgetOverrun . zget($this->lang->project->currencySymbol, $selectedProgram->budgetUnit) . $availableBudget . "</span>";
echo json_encode($tips);
}
/**
* Update program order.
*
+1
View File
@@ -1,2 +1,3 @@
.future {display: inline-block;}
.c-number {overflow: hidden; text-align: right !important; text-overflow: ellipsis; white-space: nowrap;}
.text-remind {color: #ffa34d;}
+3 -1
View File
@@ -1,4 +1,6 @@
#budget {border-right: 0px;}
#budgetUnit {border-left: 0px;}
#dateRange {vertical-align: top; padding-top: 13px;}
#dateRange, .futureBox {vertical-align: top !important; padding-top: 13px !important;}
#endList {vertical-align: top; padding-top: 13px;}
[lang^=en] #endList {vertical-align: top; padding-top: 20px;}
#dataform th {vertical-align: top; padding-top: 13px;}
+2 -1
View File
@@ -1,4 +1,5 @@
#budget {border-right: 0px;}
#budgetUnit {border-left: 0px;}
#dateRange {vertical-align: top; padding-top: 13px;}
#dateRange, .futureBox {vertical-align: top !important; padding-top: 13px !important;}
#endList {vertical-align: top; padding-top: 13px;}
#dataform th {vertical-align: top; padding-top: 13px;}
+34 -4
View File
@@ -276,6 +276,7 @@ $(function()
if($(this).prop('checked'))
{
$('#budget').val('').attr('disabled', 'disabled');
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
}
else
{
@@ -291,13 +292,13 @@ $(function()
* @access public
* @return void
*/
function setBudgetTipsAndAclList(programID)
function setBudgetTipsAndAclList(parentID)
{
if(programID != 0)
if(parentID != 0)
{
$.get(createLink('program', 'ajaxGetBudgetLeft', "ProgramID=" + programID), function(budgetLeft)
$.get(createLink('program', 'ajaxGetBudgetLeft', "ProgramID=" + parentID), function(budgetLeft)
{
parentProgram = programList[programID];
parentProgram = programList[parentID];
programBudget = parentProgram.budget;
PGMBudgetUnit = currencySymbol[parentProgram.budgetUnit];
@@ -311,4 +312,33 @@ function setBudgetTipsAndAclList(programID)
$('#budget').removeAttr('placeholder');
$('.aclBox').html($('#PGMAcl').html());
}
if(typeof(programID) == 'undefined') programID = 0;
budgetOverrunTips(programID);
}
/**
* Append prompt when the budget exceeds the parent project set.
*
* @access public
* @return void
*/
function budgetOverrunTips()
{
var selectedProgramID = $('#parent').val();
var budget = $('#budget').val();
if(selectedProgramID == 0)
{
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
return false;
}
if(typeof(programID) == 'undefined') programID = 0;
$.get(createLink('program', 'ajaxGetAvailableBudget', 'programID=' + programID + "&selectedProgramID=" + selectedProgramID + "&budget=" + budget), function(data)
{
var data = JSON.parse(data);
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
$('#budgetBox').after(data);
});
}
+1
View File
@@ -113,6 +113,7 @@ $lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->accessDenied = 'You have no access to the program.';
$lang->program->beyondParentBudget = 'The remaining budget of the owned program has been exceeded.';
$lang->program->checkedProjects = 'Seleted %s items';
$lang->program->budgetOverrun = "The program's budget has exceeded the remaining budget of the parent program:";
$lang->program->endList[31] = 'One month';
$lang->program->endList[93] = 'Trimester';
+1
View File
@@ -113,6 +113,7 @@ $lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->accessDenied = 'You have no access to the program.';
$lang->program->beyondParentBudget = 'The remaining budget of the owned program has been exceeded.';
$lang->program->checkedProjects = 'Seleted %s items';
$lang->program->budgetOverrun = "The program's budget has exceeded the remaining budget of the parent program:";
$lang->program->endList[31] = 'One month';
$lang->program->endList[93] = 'Trimester';
+1
View File
@@ -113,6 +113,7 @@ $lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->accessDenied = 'You have no access to the program.';
$lang->program->beyondParentBudget = 'The remaining budget of the owned program has been exceeded.';
$lang->program->checkedProjects = "Pour s électionner l'élément% s";
$lang->program->budgetOverrun = "Le budget du programme a dépassé le budget restant du programme parent:";
$lang->program->endList[31] = 'One month';
$lang->program->endList[93] = 'Trimester';
+1
View File
@@ -113,6 +113,7 @@ $lang->program->readjustTime = '重新调整项目集起止时间';
$lang->program->accessDenied = '你无权访问该项目集';
$lang->program->beyondParentBudget = '已超出所属项目集的剩余预算';
$lang->program->checkedProjects = '已选择%s项';
$lang->program->budgetOverrun = '项目集的预算已超出父项目集的剩余预算:';
$lang->program->endList[31] = '一个月';
$lang->program->endList[93] = '三个月';
+4 -4
View File
@@ -69,9 +69,9 @@
<tr>
<th><?php echo $lang->program->budget;?></th>
<td>
<div class='input-group'>
<?php $placeholder = $parentProgram ? 'placeholder=' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $budgetLeft : '';?>
<?php echo html::input('budget', '', "class='form-control' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . $placeholder);?>
<div id='budgetBox' class='input-group'>
<?php $placeholder = $parentProgram ? 'placeholder="' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $budgetLeft . '"' : '';?>
<?php echo html::input('budget', '', "class='form-control' onchange='budgetOverrunTips()' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . $placeholder);?>
<?php if($parentProgram):?>
<span class='input-group-addon fix-border'><?php echo zget($budgetUnitList, $parentProgram->budgetUnit);?></span>
<?php else:?>
@@ -80,7 +80,7 @@
<?php endif;?>
</div>
</td>
<td>
<td class='futureBox'>
<div class='checkbox-primary future w-70px'>
<input type='checkbox' id='future' name='future' value='1' />
<label for='future'><?php echo $lang->project->future;?></label>
+6 -4
View File
@@ -15,6 +15,7 @@
<?php js::set('weekend', $config->execution->weekend);?>
<?php js::set('longTime', $lang->program->longTime);?>
<?php js::set('currencySymbol', $lang->project->currencySymbol);?>
<?php js::set('PGMParentBudget', $lang->program->parentBudget);?>
<?php js::set('parentBudget', $lang->program->parentBudget);?>
<?php js::set('future', $lang->project->future);?>
<?php js::set('programList', $programList);?>
@@ -23,6 +24,7 @@
<?php js::set('exRateNotEmpty', sprintf($lang->error->notempty, $lang->program->exchangeRate));?>
<?php js::set('exRateNum', sprintf($lang->error->float, $lang->program->exchangeRate));?>
<?php js::set('exRateNotNegative', $lang->program->exRateNotNegative);?>
<?php js::set('programID', $program->id);?>
<?php $aclList = $program->parent ? $lang->program->subAclList : $lang->program->aclList;?>
<?php $requiredFields = $config->program->edit->requiredFields;?>
<div id='mainContent' class='main-content'>
@@ -48,9 +50,9 @@
<tr>
<th><?php echo $lang->program->budget;?></th>
<td>
<div class='input-group'>
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder=' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget : '';?>
<?php echo html::input('budget', $program->budget != 0 ? $program->budget : '', "class='form-control' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . ($program->budget == 0 ? 'disabled ' : '') . $placeholder);?>
<div id='budgetBox' class='input-group'>
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder="' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget . '"' : '';?>
<?php echo html::input('budget', $program->budget != 0 ? $program->budget : '', "class='form-control' onchange='budgetOverrunTips()' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . ($program->budget == 0 ? 'disabled ' : '') . $placeholder);?>
<?php if($parentProgram):?>
<span class='input-group-addon'><?php echo zget($budgetUnitList, $program->budgetUnit);?></span>
<?php else:?>
@@ -61,7 +63,7 @@
<?php endif;?>
</div>
</td>
<td>
<td class='futureBox'>
<div class='checkbox-primary future w-70px'>
<input type='checkbox' id='future' name='future' value='1' <?php if($program->budget == 0) echo 'checked';?> />
<label for='future'><?php echo $lang->project->future;?></label>