window.renderCell = function(result, {col, row}) { if(col.name === 'name') { if(row.data.postponed) result[result.length] = {html:'' + row.data.delayInfo + '', className:'flex items-end w-full', style:{flexDirection:"column"}}; return result; } if(col.name === 'budget' && typeof(row.data.exceedBudget) != 'undefined') { let iconSign = ' '; let menu = ''; let dropMenu = menu; dropMenu += '
' + projectBudgetLang + ': ' + row.data.rawBudget + '
'; dropMenu += '
' + remainingBudgetLang + ': ' + row.data.remainingBudget + '
'; dropMenu += '
' + exceededBudgetLang + ': ' + row.data.exceedBudget + '
'; if(row.data.type == 'program') { if(row.data.parent == 0) iconSign = ' '; dropMenu = menu; dropMenu += '
' + programBudgetLang + ': ' + row.data.rawBudget + '
'; dropMenu += '
' + sumSubBudgetLang + ': ' + row.data.subBudget + '
'; dropMenu += '
' + exceededBudgetLang + ': ' + row.data.exceedBudget + '
'; } iconSign = '' + iconSign + ''; result[0] = {html: '
' + row.data.budget + iconSign + dropMenu + '
', className:'flex items-end w-full items-end', style:{flexDirection:"column"}}; return result; } if(col.name === 'invested') { result[0] = {html: '
' + row.data.invested + ' ' + langManDay + '
', className:'flex items-end w-full items-end', style:{flexDirection:"column"}}; return result; } return result; } window.confirmDelete = function(projectID, module, projectName) { var deleteURL = $.createLink(module, 'delete', "projectID=" + projectID); if(module == 'program') deleteURL = $.createLink('program', 'delete', "programID=" + projectID + '&confirm=yes'); zui.Modal.confirm({message: confirmDeleteLang[module].replace('%s', projectName), icon:'icon-info-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) => { if(res) $.ajaxSubmit({url: deleteURL, load: true}); }); } $(document).off('click', '[data-formaction]').on('click', '[data-formaction]', function() { const $this = $(this); const dtable = zui.DTable.query($('#projectviews')); const checkedList = dtable.$.getChecks(); if(!checkedList.length) return; const postData = new FormData(); checkedList.forEach(function(id) { let data = dtable.$.getRowInfo(id).data; if(data.type == 'program') return; postData.append('projectIdList[]', id); }); if($this.data('page') == 'batch') postAndLoadPage($this.data('formaction'), postData); }); window.footerSummary = function(checkedIdList) { if(!checkedIdList.length) return {html: pageSummary, className: 'text-dark'}; const dtable = zui.DTable.query($('#projectviews')); let totalProjects = 0; checkedIdList.forEach(function(id) { if(dtable) { let data = dtable.$.getRowInfo(id).data; if(data.type == 'program') return; } totalProjects++; }); var summary = checkedSummary.replace('%s', totalProjects); return {html: summary}; };