window.getItem = function(info)
{
const col = info.col;
const color = info.item.color ? " style='color:" + info.item.color + "'" : '';
const title = info.item.title;
let titleHtml = `${title}`;
info.item.content = [];
if(col.indexOf('epic') != -1 || col.indexOf('requirement') != -1 || col.indexOf('story') != -1)
{
let storyPriList = langStoryPriList[info.item.storyType];
let storyStatusList = langStoryStatusList[info.item.storyType];
let storyStageList = langStoryStageList[info.item.storyType];
if(privs[info.item.storyType]) titleHtml = "" + title + "";
info.item.title = {html: `
${storyPriList[info.item.pri]} ${titleHtml}
`}
info.item.titleAttrs = {'title' : title};
if(storyStatusList[info.item.status]) info.item.content.push({html: `${storyStatusList[info.item.status]}
`});
info.item.content.push({html: `${storyStageList[info.item.stage]}
`})
}
else if(col == 'project' || col == 'execution')
{
let delayHtml = '';
if(info.item.delay > 0) delayHtml = `${langProjectStatusList['delay']}`;
titleHtml = `${title}`;
if(col == 'project' && privs['project']) titleHtml = "" + title + "";
if(col == 'execution' && privs['execution']) titleHtml = "" + title + "";
info.item.title = [];
info.item.title.push({html: `${titleHtml}
`});
info.item.title.push({html: `${delayHtml}
`, 'class': 'delayBox gap-x-2'});
info.item.titleAttrs = {'title' : title, 'class': 'card-title flex'};
info.item.content.push({html: `${langProjectStatusList[info.item.status]}
`});
info.item.content.push({component: 'ProgressCircle', props: {percent: info.item.progress, size: 24}});
}
else if(col == 'task')
{
if(privs['task']) titleHtml = "" + title + "";
if(info.item.isParent == '1') titleHtml = "" + langParent + " " + titleHtml;
if(info.item.parent > 0 && info.item.isParent == '0') titleHtml = "" + langChildren + " " + titleHtml;
info.item.title = {html: `${langTaskPriList[info.item.pri]} ${titleHtml}
`}
info.item.titleAttrs = {'title' : title};
if(info.item.isParent == '1') info.item.content.push({html: `${langChildren} `});
info.item.content.push({html: `${langTaskStatusList[info.item.status]}
`});
if(info.item.assignedTo) info.item.content.push({html: " " + (users[info.item.assignedTo] ? users[info.item.assignedTo] : info.item.assignedTo) + "
"});
info.item.content.push({component: 'ProgressCircle', props: {percent: info.item.progress, size: 24}});
}
else if(col == 'bug')
{
if(privs['bug']) titleHtml = "" + title + "";
info.item.title = {html: `${langBugPriList[info.item.pri]} ${titleHtml}
`}
info.item.titleAttrs = {'title' : title};
severity = info.item.severity;
severityHtml = ``;
if(!langBugSeverityList[severity] || langBugSeverityList[severity] != severity) severityHtml = `${langBugSeverityList[severity]}
`;
info.item.content.push({html: severityHtml});
if(info.item.assignedTo) info.item.content.push({html: " " + (users[info.item.assignedTo] ? users[info.item.assignedTo] : info.item.assignedTo)});
}
else if(col == 'case')
{
if(privs['case']) titleHtml = "" + title + "";
info.item.title = {html: `${langCasePriList[info.item.pri]} ${titleHtml}
`}
info.item.titleAttrs = {'title' : title};
info.item.content.push({html: "" + (langCaseResultList[info.item.lastRunResult] ? langCaseResultList[info.item.lastRunResult] : langUnexecuted) + "
"});
info.item.content.push({html: (users[info.item.lastRunner] ? users[info.item.lastRunner] : info.item.lastRunner)});
}
else if(col == 'design')
{
info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title};
if(privs['design'])
{
info.item.titleUrl = $.createLink('design', 'view', `id=${info.item.id}`);
info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title, 'data-toggle': 'modal', 'data-size': 'lg'};
}
}
else if(col == 'commit')
{
if(privs['commit']) info.item.titleUrl = $.createLink('repo', 'revision', `repoID=${info.item.repo}&objectID=0&revision=${info.item.revision}`);
info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title};
}
}
window.getLaneCol = function(lane, col)
{
if(mergeCells[lane.name])
{
if(mergeCells[lane.name][col.name]) return {laneColClass: 'lane-col-join-with-above'};
return {laneColClass: 'lane-col-shrink-with-above'};
}
}
window.getCol = function(col)
{
if(col.name == storyType) col.subtitle = {html: ``};
}
window.itemRender = function(info)
{
const col = info.col;
if(col == 'task')
{
if(info.item.parent > '0' && tasks[info.item.parent] !== undefined) info.item.className.push('hidden childTask parent-' + info.item.parent);
if(info.item.isParent == '1') info.item.className.push('parentTask');
}
if(config.rawModule == 'projectstory' && (col.indexOf('epic') != -1 || col.indexOf('requirement') != -1 || col.indexOf('story') != -1))
{
if(!storyIdList.includes(parseInt(info.item.id))) info.item.className.push('hidden');
}
}
window.afterRender = function()
{
$orderByIcon = $('.orderByIcon');
if($orderByIcon.length > 0 && !$orderByIcon.hasClass('dropdownInited'))
{
new zui.Dropdown($('.orderByIcon'), {menu: {items: orderByItems}});
$orderByIcon.addClass('dropdownInited');
}
$hasSubCols = $('.kanban-header-cols .kanban-header-col.has-subs');
if($hasSubCols.length > 0)
{
$hasSubCols.each(function()
{
$subCols = $(this).find(".kanban-header-sub-cols .kanban-header-col.is-sub");
if($subCols.length == 1)
{
style = $subCols.attr('style');
$subCols.parent().addClass('hidden');
$(this).removeClass('has-subs').attr('style', style);
}
});
}
}
window.toggleChildren = function(obj, parentID, isExpanded)
{
if(!isExpanded) isExpanded = false;
if(isExpanded || $(obj).hasClass('is-expanded'))
{
$(obj).removeClass('is-expanded').addClass('is-collapsed');
let $parent = $('.parent-' + parentID);
$parent.addClass('hidden');
if($parent.length == 0) return;
let $toggleBtn = $parent.find('.toggle-btn');
if($toggleBtn.length == 0) return;
$toggleBtn.each(function(){ toggleChildren(this, $(this).data('id'), true); });
}
else
{
$(obj).removeClass('is-collapsed').addClass('is-expanded');
$('.parent-' + parentID).removeClass('hidden')
}
}
window.changeProduct = function(e)
{
if(config.rawModule == 'projectstory') loadPage($.createLink(config.rawModule, config.rawMethod, "projectID=" + projectID + "&productID=" + $(e.target).val()));
}