$(document).ready(function() { component.initFile(); setTimeout(function() { $('.card.card-wizard').addClass('active'); }, 600); $('.lazy').lazy(); $(".imageLoad").each(function() { var val = $(this).val().split(':'); var id = $(this).attr('id') + 'Obj'; $.ajax({ headers: { 'X-CSRF-Token': csrf_token }, type: 'GET', contentType: "application/json; charset=utf-8", url: contextPath + "/resources/download?docMgtId=" + val[0] + "&bucketName=" + val[1], success: function(data) { imageDetails(data.content, data.contentType, id); }, error: function(e) { console.log(e); } }); }); $("a.proj-flow").on('show.bs.tab', function(e) { var val = $(this).closest('li').find('input[type="hidden"]').val(); var reportType = $(this).attr('data-target'); if (val != undefined) { reportType = reportType.replace("#", ""); var attrReport = $("#" + reportType + "_REPORT"); if (attrReport.attr('data') == undefined) { portalUtil.showMainLoading(true); $.ajax({ headers: { 'X-CSRF-Token': csrf_token }, type: 'GET', contentType: "application/json; charset=utf-8", url: contextPath + "/resources/getReportDetails?reportType=" + reportType + "&docMgmtId=" + val, success: function(data) { // always remove attribute first removeAttr(data[0].reportType); reportDetails(data[0].base64image, data[0].docType, data[0].reportType); portalUtil.showMainLoading(false); }, error: function(e) { portalUtil.showMainLoading(false); } }); } } }); $("#hiddenRow").on('click', '.btn-report', function() { var data = $(this).attr('value'); reportDetails(data, 'application/pdf'); }); $("#report").on('change', function() { var reportType = $(this).val(); var wrkrRegId = $("#wrkrRegId").val(); portalUtil.showMainLoading(true); $.ajax({ headers: { 'X-CSRF-Token': csrf_token }, type: 'GET', contentType: "application/json; charset=utf-8", url: contextPath + "/resources/getClearanceReportDetails?reportType=" + reportType + "&wrkrRegId=" + wrkrRegId, success: function(data) { // always remove attribute first removeAttr('reportObj'); // if 1, display immediately the report in screen if (data.length == 1) { reportDetails(data[0].base64image, data[0].docType, 'reportObj'); } else { // if more than 2 create divs by 4 $.each(data, function(i) { appendReport(data, i); }); } portalUtil.showMainLoading(false); }, error: function(e) { portalUtil.showMainLoading(false); } }); }); }); function appendReport(data, i) { var imageName = data[i].imageName.split(".")[0].replace(/ /g, ''); var content = "