/** * Author: Thilina Hasantha */ /** * ReportAdapter */ function ReportAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); this._construct(); } ReportAdapter.inherits(AdapterBase); ReportAdapter.method('_construct', function() { this._formFileds = [ [ "id", {"label":"ID","type":"hidden"}], [ "name", {"label":"Name","type":"label","validation":""}], [ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}] ]; this.remoteFieldsExists = false; }); ReportAdapter.method('_initLocalFormFields', function() { this._formFileds = [ [ "id", {"label":"ID","type":"hidden"}], [ "name", {"label":"Name","type":"label","validation":""}], [ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}] ]; }); ReportAdapter.method('setRemoteFieldExists', function(val) { this.remoteFieldsExists = val; }); ReportAdapter.method('getDataMapping', function() { return [ "id", "icon", "name", "details", "parameters" ]; }); ReportAdapter.method('getHeaders', function() { return [ { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "","bSortable":false,"sWidth":"22px"}, { "sTitle": "Name","sWidth":"30%"}, { "sTitle": "Details"}, { "sTitle": "Parameters","bVisible":false}, ]; }); ReportAdapter.method('getFormFields', function() { return this._formFileds; }); ReportAdapter.method('processFormFieldsWithObject', function(object) { var that = this; this._initLocalFormFields(); var len = this._formFileds.length; var fieldIDsToDelete = []; var fieldsToDelete = []; this.remoteFieldsExists = false; for(var i=0;i'); $tempDomObj.attr('id',randomFormId); } $tempDomObj.html(formHtml); $tempDomObj.find('.datefield').datepicker({'viewMode':2}); $tempDomObj.find('.timefield').datetimepicker({ language: 'en', pickDate: false }); $tempDomObj.find('.datetimefield').datetimepicker({ language: 'en' }); $tempDomObj.find('.colorpick').colorpicker(); //$tempDomObj.find('.select2Field').select2(); $tempDomObj.find('.select2Field').each(function() { $(this).select2().select2('val', $(this).find("option:eq(0)").val()); }); $tempDomObj.find('.select2Multi').each(function() { $(this).select2().on("change",function(e){ var parentRow = $(this).parents(".row"); var height = parentRow.find(".select2-choices").height(); parentRow.height(parseInt(height)); }); }); $tempDomObj.find('.signatureField').each(function() { //$(this).data('signaturePad',new SignaturePad($(this))); signatureIds.push($(this).attr('id')); }); for(var i=0;i').parent().html(); //this.showMessage("Edit",tHtml,null,null,true); this.showMessage("Edit","",null,null,true); $("#plainMessageModel .modal-body").html(""); $("#plainMessageModel .modal-body").append($tempDomObj); for(var i=0;iDownload Report '; }else{ link = 'Download Report '; } link = link.replace(/_BASE_/g,this.baseUrl); if(this.currentReport.output == "PDF" || this.currentReport.output == "JSON"){ this.showMessage("Download Report",link); }else{ if(serverData[1].length == 0){ this.showMessage("Empty Report","There were no data for selected filters"); return; } var tableHtml = link+'

'; //Delete existing temp report table $("#tempReportTable").remove(); //this.showMessage("Report",tableHtml); $("#"+this.table).html(tableHtml); $("#"+this.table).show(); $("#"+this.table+"Form").hide(); //Prepare headers var headers = []; for(title in serverData[1]){ headers.push({ "sTitle": serverData[1][title]}); } var data = serverData[2]; var dataTableParams = { "oLanguage": { "sLengthMenu": "_MENU_ records per page" }, "aaData": data, "aoColumns": headers, "bSort": false, "iDisplayLength": 15, "iDisplayStart": 0 }; $("#tempReportTable").dataTable( dataTableParams ); $(".dataTables_paginate ul").addClass("pagination"); $(".dataTables_length").hide(); $(".dataTables_filter input").addClass("form-control"); $(".dataTables_filter input").attr("placeholder","Search"); $(".dataTables_filter label").contents().filter(function(){ return (this.nodeType == 3); }).remove(); $('.tableActionButton').tooltip(); } }); ReportAdapter.method('fillForm', function(object) { var fields = this.getFormFields(); for(var i=0;i