* Render errors to the stage creation page.
This commit is contained in:
@@ -4,3 +4,44 @@ window.onRenderRow = function(row, rowIdx, data)
|
||||
|
||||
row.children('.form-batch-row-actions').children('[data-type=delete]').remove();
|
||||
};
|
||||
|
||||
/**
|
||||
* Add row errors.
|
||||
*
|
||||
* @param array $rowErrors
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
window.addRowErrors = function(rowErrors)
|
||||
{
|
||||
var errorFieldID, errorTip, errorHTML;
|
||||
$('.text-danger.help-text').remove();
|
||||
$('#dataform input').removeClass('has-error');
|
||||
var index = 0;
|
||||
var alterError = '';
|
||||
$('input[name^=name]').each(function()
|
||||
{
|
||||
if($(this).val() == '') return true;
|
||||
|
||||
if(typeof rowErrors[index] == 'object')
|
||||
{
|
||||
for(var errorField in rowErrors[index])
|
||||
{
|
||||
$errorTD = $(this).closest('tr').find('input[name^=' + errorField + ']').closest('td');
|
||||
errorTip = rowErrors[index][errorField];
|
||||
errorHTML = '<div id="help' + errorField + index + '" class="text-danger help-text">' + errorTip + '</div>';
|
||||
$errorTD.append(errorHTML);
|
||||
$errorTD.find('input').addClass('has-error');
|
||||
}
|
||||
}
|
||||
if(typeof rowErrors['percent'] == 'string')
|
||||
{
|
||||
errorFieldID = $(this).closest('tr').find('input[name^=percent]').attr('id');
|
||||
errorHTML = '<div id="help' + errorFieldID + '" class="text-danger help-text">' + rowErrors['percent'] + '</div>';
|
||||
$('#' + errorFieldID).closest('td').append(errorHTML);
|
||||
$('#' + errorFieldID).closest('td').find('input').addClass('has-error');
|
||||
}
|
||||
|
||||
index ++;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -577,10 +577,10 @@ class programplanModel extends model
|
||||
if($setCode) $plan->code = $codes[$key];
|
||||
if($setPercent) $plan->percent = $percents[$key];
|
||||
|
||||
if(!empty($begin[$key])) $plan->begin = $begin[$key];
|
||||
if(!empty($end[$key])) $plan->end = $end[$key];
|
||||
if(!empty($realBegan[$key])) $plan->realBegan = $realBegan[$key];
|
||||
if(!empty($realEnd[$key])) $plan->realEnd = $realEnd[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '' : $end[$key];
|
||||
$plan->realBegan = empty($realBegan[$key]) ? '' : $realBegan[$key];
|
||||
$plan->realEnd = empty($realEnd[$key]) ? '' : $realEnd[$key];
|
||||
|
||||
$plans[] = $plan;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user