Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #172665 feat: Support set of filters in TjReports #214

Open
wants to merge 9 commits into
base: release-1.2.0
Choose a base branch
from
1 change: 1 addition & 0 deletions tjreports/site/assets/css/tjreports.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ div#topFilters div.filter-search {
display: inline-block;
float: left;
margin-right: 5px;
padding: 2px;
}

div#topFilters {
Expand Down
2 changes: 1 addition & 1 deletion tjreports/site/assets/css/tjreports.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 32 additions & 2 deletions tjreports/site/assets/js/tjrContentUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ tjrContentUI.root_url = (typeof root_url == 'undefined') ? '' : root_url;
tjrContentUI.base_url = (typeof root_url == 'undefined') ? '' : root_url;
tjrContentUI.report = tjrContentUI.report ? tjrContentUI.report : {};


addMorefilterCnt = 1;
jQuery.extend(tjrContentUI.report, {
searchToggle: true,
$form: null,
url: 'index.php?option=com_tjreports&view=reports&format=json',
querySaveUrl: 'index.php?option=com_tjreports&format=json',
submitTJRData: function(task) {
submitTJRData: function(task, addMorefilter, removeFilter = '') {

// Set the view layout on the basis of task
task = (typeof task == 'undefined' ) ? 'default' : task;
Expand Down Expand Up @@ -47,6 +47,25 @@ jQuery.extend(tjrContentUI.report, {
this.searchToggle = jQuery('div#topFilters').is(':visible');
tjrContentUI.utility.loadingLayer('show');
this.$form = jQuery('#adminForm');

if (addMorefilterCnt >= 1)
{
if (parseInt(addMorefilter) === 1)
{
addMorefilterCnt++;
}
else if (Number.isInteger(removeFilter))
{
addMorefilterCnt--;
}

jQuery('#tjReportaddMorefilter').remove();
this.$form.append('<input type="hidden" id="tjReportaddMorefilter" name="addMorefilter" value=' + addMorefilterCnt + '>');

jQuery('#tjReportremoveFilter').remove();
this.$form.append('<input type="hidden" id="tjReportremoveFilter" name="removeFilter" value=' + removeFilter + '>');
}

var doProcess = this.validate();
if (!doProcess) {
return false;
Expand Down Expand Up @@ -138,6 +157,7 @@ jQuery.extend(tjrContentUI.report, {
.val('')
.removeAttr('checked')
.removeAttr('selected');
addMorefilterCnt = 1;
tjrContentUI.report.submitTJRData(task);
},
validate: function() {
Expand Down Expand Up @@ -462,6 +482,16 @@ jQuery.extend(tjrContentUI.utility, {
eraseJSCookie:function(name) {
tjrContentUI.utility.setJSCookie(name,"",-1);
},
initiateChznPlaceholders:function(placeHolders)
{
jQuery(document).ready(function () {
for (let i = 0; i < parseInt(addMorefilterCnt); i++) {
for (let x in placeHolders) {
jQuery('#filtersoptions_' + i + x + '_chzn').find('li.search-field input.default').val(placeHolders[x]);
}
}
});
}
});
tjrContentUI.tjreport = tjrContentUI.tjreport ? tjrContentUI.tjreport : {};
jQuery.extend(tjrContentUI.tjreport, {
Expand Down
Loading