var DBG = DBG || false var DBG_FAKE_ANIM = DBG_FAKE_ANIM || false if (!URL_FETCH_BI_AUDIT_PROGRESS) throw "Missing URL_FETCH_BI_AUDIT_PROGRESS" if (!jQuery('#last-raport-state').length) return; // 'URL_BI_AUDIT_RESULT' => Router::getRoute('UrlAction_BiAuditGenerate')->getLink(''), // 'ID_ARG_BI_AUDIT_RESULT' => 'ID_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA' // index.php?_route=UrlAction_BiAuditGenerate&ID_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA=102 var IS_STARTED = false var DBG_COUNTER = 0; function updateLastRaportView(respJson) { if (!respJson.body || !respJson.body.ids || !respJson.body.progress) return; if (!jQuery('#last-raport-state').length) return; if(DBG)console.log('DBG:updateLastRaportView', {respJson: respJson, tblStruct: tblStruct}); var idx = 0; var respId = respJson.body.ids[idx] var progress = respJson.body.progress[idx] var percent = Math.round(100 * progress) if (DBG_FAKE_ANIM && percent > 0 && percent < 100) percent += (DBG_COUNTER * 10) var status = (respJson.body.statuses[idx]) ? respJson.body.statuses[idx] : '' if (DBG_FAKE_ANIM) status = (percent < 100) ? 'IN_PROGRES' : 'DONE' var statusInfo = (respJson.body.statusesInfo[idx]) ? respJson.body.statusesInfo[idx] : '' jQuery('#last-raport-state').get(0).innerHTML = ''; var el = jQuery('' + status + ''); jQuery('#last-raport-state').append(el); if ('GENERATED' === status) { var resultLink = URL_BI_AUDIT_RESULT + '&' + ID_ARG_BI_AUDIT_RESULT + '=' + respId; jQuery('#last-raport-state').append('Wyniki'); } jQuery('#last-raport-state').append(' '+statusInfo+' '); if(DBG)console.log('DBG:updateLastRaportView loop ('+idx+', el)', {el: el, progress: progress, pr: percent }); updatePercentView(el, { percent: percent, status: status, }) } function updatePercentView(el, props) { var hrNode = jQuery(el).find('hr') if (!hrNode.length) hrNode = jQuery('