diff --git a/module/program/js/common.js b/module/program/js/common.js index 17b3a4acf1..46541b6234 100644 --- a/module/program/js/common.js +++ b/module/program/js/common.js @@ -283,7 +283,7 @@ $(function() if($(this).prop('checked')) { $('#budget').val('').attr('disabled', 'disabled'); - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); } else { @@ -362,14 +362,15 @@ function compareChildDate() var dateTip = ''; if(programBegin > childBegin) { - dateTip = "

" + beginGreateChild + childInfo.minChildBegin + "

" + ignore + "

"; + dateTip = "

" + beginGreateChild + childInfo.minChildBegin + "

" + ignore + "

"; } else if(programEnd < childEnd) { - dateTip = "

" + endLetterChild + childInfo.maxChildEnd + "

" + ignore + "

"; + dateTip = "

" + endLetterChild + childInfo.maxChildEnd + "

" + ignore + "

"; } - $('#dateBox').after(dateTip); + $('#dateBox').parent().parent().after(dateTip); + $('#dateTip').parent().css('line-height', '0'); }); } } @@ -386,7 +387,7 @@ function outOfDateTip() var end = $('#end').val(); var begin = $('#begin').val(); - if($('#dateTip').length > 0) $('#dateTip').remove(); + if($('#dateTip').length > 0) $('#dateTip').parent().parent().remove(); if(end == longTime) end = LONG_TIME; if(end.length > 0 && begin.length > 0) @@ -417,14 +418,15 @@ function outOfDateTip() if(programBegin < parentBegin) { - dateTip = "

" + beginLetterParent + data.selectedProgramBegin + "

" + ignore + "

"; + dateTip = "

" + beginLetterParent + data.selectedProgramBegin + "

" + ignore + "

"; } else if(programEnd > parentEnd) { - dateTip = "

" + endGreaterParent + data.selectedProgramEnd + "

" + ignore + "

"; + dateTip = "

" + endGreaterParent + data.selectedProgramEnd + "

" + ignore + "

"; } - $('#dateBox').after(dateTip); + $('#dateBox').parent().parent().after(dateTip); + $('#dateTip').parent().css('line-height', '0'); }); } } @@ -443,7 +445,7 @@ function budgetOverrunTips() var budget = $('#budget').val(); if(selectedProgramID == 0) { - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); return false; } @@ -453,9 +455,10 @@ function budgetOverrunTips() var data = JSON.parse(data); var tip = ""; - if(budget !=0 && budget !== null && budget > data.availableBudget) var tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget + "

" + ignore + "

" - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); - $('#budgetBox').after(tip); + if(budget !=0 && budget !== null && budget > data.availableBudget) var tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget + "

" + ignore + "

" + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); + $('#budgetBox').parent().parent().after(tip); + $('#beyondBudgetTip').parent().css('line-height', '0'); }); } diff --git a/module/project/js/common.js b/module/project/js/common.js index ce90160378..a0c7b3c6fc 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -2,6 +2,7 @@ window.ignoreTips = { 'beyondBudgetTip' : false, 'dateTip' : false }; +var batchEditDateTips = new Array(); /** * Access rights are equal to private, and the white list settings are displayed. @@ -295,7 +296,7 @@ $(function() if($(this).prop('checked')) { $('#budget').val('').attr('disabled', 'disabled'); - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); } else { @@ -340,7 +341,7 @@ function budgetOverrunTips() if(selectedProgramID == 0) { - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); return false; } @@ -351,9 +352,10 @@ function budgetOverrunTips() if(typeof(data.availableBudget) == 'undefined') return; var tip = ""; - if(budget != 0 && budget !== null && budget > data.availableBudget) tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2) + "

" + ignore + "

" - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); - $('#budgetBox').after(tip); + if(budget != 0 && budget !== null && budget > data.availableBudget) tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2) + "

" + ignore + "

" + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); + $('#budgetBox').parent().parent().after(tip); + $('#beyondBudgetTip').parent().css('line-height', '0'); var placeholder = ''; if(selectedProgramID) placeholder = parentBudget + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2); @@ -365,16 +367,18 @@ function budgetOverrunTips() /** *The date is out of the range of the parent project set, and a prompt is given. * - * @param int $currentID + * @param string $currentID * @access public * @return void */ -function outOfDateTip(currentID = 0) +function outOfDateTip(currentID) { if(window.ignoreTips['dateTip']) return; + if(batchEditDateTips.includes(Number(currentID))) return; + var end = currentID ? $('#ends\\[' + currentID + '\\]').val() : $('#end').val(); var begin = currentID ? $('#begins\\[' + currentID + '\\]').val() : $('#begin').val(); - if($('#dateTip.text-remind').length > 0) $('#dateTip').remove(); + if($('#dateTip.text-remind').length > 0) $('#dateTip').parent().parent().remove(); if(currentID) $('#dateTip\\[' + currentID + '\\]').remove(); if(end == longTime) end = LONG_TIME; @@ -402,20 +406,22 @@ function outOfDateTip(currentID = 0) var dateTip = ""; if(projectBegin < parentBegin) { - dateTip = currentID ? beginLetterParentTip + "'>" + beginLetterParentTip : beginLetterParentTip; + dateTip = currentID ? beginLetterParentTip + "'>

" + beginLetterParentTip : beginLetterParentTip; } else if(projectEnd > parentEnd) { - dateTip = currentID ? endGreaterParentTip + "'>" + endGreaterParentTip : endGreaterParentTip; + dateTip = currentID ? endGreaterParentTip + "'>

" + endGreaterParentTip : endGreaterParentTip; } if(currentID) { - $("#projects\\[" + currentID + "\\]").after("" + ignore + "

"); + $('#dateTip'+ currentID).parent().css('line-height', '0') } else { - $('#dateBox').after("

" + dateTip + "

" + ignore + "

"); + $('#dateRange').parent().after("

" + dateTip + "

" + ignore + "

"); + $('#dateTip').parent().css('line-height', '0') } }); } @@ -425,14 +431,16 @@ function outOfDateTip(currentID = 0) * Make this prompt no longer appear. * * @param string $obj + * @param string $currentID * @access public * @return void */ -function ignoreTip(obj) +function ignoreTip(obj, currentID) { var parentID = obj.parentNode.id; - $('#' + parentID).addClass('hidden'); + currentID ? $('#dateTip' + currentID).parent().parent().remove() : $('#' + parentID).parent().parent().remove(); if(parentID == 'dateTip') window.ignoreTips['dateTip'] = true; + if(parentID == 'dateTip' + currentID) batchEditDateTips.push(currentID); if(parentID == 'beyondBudgetTip') window.ignoreTips['beyondBudgetTip'] = true; }