Add export tab to admin reports

This commit is contained in:
gamonoid
2017-10-08 16:52:10 +02:00
parent 9f7831bafe
commit 10403e280c
2 changed files with 25 additions and 15 deletions

View File

@@ -1,38 +1,48 @@
<?php <?php
$moduleName = 'Reports'; $moduleName = 'Reports';
define('MODULE_PATH',dirname(__FILE__)); define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php'; include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php'; include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9"> ?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;"> <ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabReport" href="#tabPageReport"><?=t('Reports')?></a></li> <li class="active"><a id="tabReport" href="#tabPageReport"><?=t('Reports')?></a></li>
<li class=""><a id="tabExports" href="#tabPageExports"><?=t('Exports')?></a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="tabPageReport"> <div class="tab-pane active" id="tabPageReport">
<div id="Report" class="reviewBlock" data-content="List" style="padding-left:5px;"> <div id="Report" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div> </div>
<div id="ReportForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;"> <div id="ReportForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div> </div>
</div> </div>
<div class="tab-pane" id="tabPageExports">
<div id="Exports" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="ExportsForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div> </div>
</div> </div>
<script> <script>
var modJsList = new Array(); var modJsList = new Array();
modJsList['tabReport'] = new ReportAdapter('Report','Report','','report_group'); modJsList['tabReport'] = new ReportAdapter('Report','Report','{"type":"Reports"}','report_group');
modJsList['tabReport'].setShowAddNew(false); modJsList['tabReport'].setShowAddNew(false);
modJsList['tabReport'].setRemoteTable(true); modJsList['tabReport'].setRemoteTable(true);
modJsList['tabExports'] = new ReportAdapter('Report','Exports','{"type":"Exports"}','report_group');
modJsList['tabExports'].setShowAddNew(false);
modJsList['tabExports'].setRemoteTable(true);
var modJs = modJsList['tabReport']; var modJs = modJsList['tabReport'];
</script> </script>
<?php include APP_BASE_PATH.'footer.php';?> <?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -78,17 +78,17 @@ ReportAdapter.method('processFormFieldsWithObject', function(object) {
that.remoteFieldsExists = true; that.remoteFieldsExists = true;
} }
}); });
} }
} }
var tempArray = []; var tempArray = [];
that._formFileds.forEach(function(entry) { that._formFileds.forEach(function(entry) {
if(jQuery.inArray(entry[0], fieldsToDelete) < 0){ if(jQuery.inArray(entry[0], fieldsToDelete) < 0){
tempArray.push(entry); tempArray.push(entry);
} }
}); });
that._formFileds = tempArray; that._formFileds = tempArray;
}); });
@@ -107,7 +107,7 @@ ReportAdapter.method('renderForm', function(object) {
} }
this.currentReport = object; this.currentReport = object;
}); });
ReportAdapter.method('renderFormNew', function(object) { ReportAdapter.method('renderFormNew', function(object) {
@@ -284,8 +284,8 @@ ReportAdapter.method('addSuccessCallBack', function(callBackData,serverData) {
link = '<a href="'+modJs.getCustomActionUrl("download",{'file':fileName})+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>'; link = '<a href="'+modJs.getCustomActionUrl("download",{'file':fileName})+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
} }
link = link.replace(/_BASE_/g,this.baseUrl); link = link.replace(/_BASE_/g,this.baseUrl);
if(this.currentReport.output == "PDF"){ if(this.currentReport.output == "PDF" || this.currentReport.output == "JSON"){
this.showMessage("Download Report",link); this.showMessage("Download Report",link);
@@ -352,7 +352,7 @@ ReportAdapter.method('fillForm', function(object) {
}else{ }else{
$("#"+this.getTableName()+'Form #'+fields[i][0]).val(object[fields[i][0]]); $("#"+this.getTableName()+'Form #'+fields[i][0]).val(object[fields[i][0]]);
} }
} }
}); });