Lines 38-46
Link Here
|
38 |
|
38 |
|
39 |
<div class="page-section"> |
39 |
<div class="page-section"> |
40 |
<fieldset class="action filters" style="cursor:pointer;"> |
40 |
<fieldset class="action filters" style="cursor:pointer;"> |
41 |
<a id="resolved_filter" class="filtered"><i class="fa fa-bars"></i> Include resolved</a> |
41 |
<a id="resolved_filter"><i class="fa fa-bars"></i> Include resolved</a> |
|
|
42 |
<input type="checkbox" id="hide_resolved_concerns" style="display:none;" /> |
42 |
[% FOR st IN status %] |
43 |
[% FOR st IN status %] |
43 |
| <a id="[% st.authorised_value | html %]_filter"><i class="fa fa-filter"></i> Filter [% st.lib | html %]</a> |
44 |
| <a id="[% st.authorised_value | html %]_filter"><i class="fa fa-filter"></i> Filter [% st.lib | html %]</a> |
|
|
45 |
<input type="checkbox" id="hide_[% st.authorised_value | html %]" style="display:none;" /> |
44 |
[% END %] |
46 |
[% END %] |
45 |
</fieldset> |
47 |
</fieldset> |
46 |
|
48 |
|
Lines 81-90
Link Here
|
81 |
|
83 |
|
82 |
var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %]; |
84 |
var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %]; |
83 |
|
85 |
|
84 |
var filter_resolved = true; |
|
|
85 |
let additional_filters = { |
86 |
let additional_filters = { |
86 |
resolved_date: function(){ |
87 |
resolved_date: function(){ |
87 |
if ( filter_resolved ) { |
88 |
if ( $("#hide_resolved_concerns").is(":checked") ) { |
88 |
return { "=": null }; |
89 |
return { "=": null }; |
89 |
} else { |
90 |
} else { |
90 |
return; |
91 |
return; |
Lines 92-97
Link Here
|
92 |
}, |
93 |
}, |
93 |
source: 'catalog' |
94 |
source: 'catalog' |
94 |
}; |
95 |
}; |
|
|
96 |
let external_filter_nodes = { |
97 |
hide_resolved_concerns: "#hide_resolved_concerns", |
98 |
}; |
95 |
|
99 |
|
96 |
var tickets_url = '/api/v1/tickets'; |
100 |
var tickets_url = '/api/v1/tickets'; |
97 |
var tickets = $("#table_concerns").kohaTable({ |
101 |
var tickets = $("#table_concerns").kohaTable({ |
Lines 204-228
Link Here
|
204 |
$(row).addClass(data.status.toLowerCase()); |
208 |
$(row).addClass(data.status.toLowerCase()); |
205 |
} |
209 |
} |
206 |
}, |
210 |
}, |
207 |
}, table_settings, 1, additional_filters); |
211 |
}, table_settings, 1, additional_filters, undefined, external_filter_nodes); |
208 |
|
212 |
|
209 |
var txtActivefilter = _("Include resolved"); |
213 |
var txtActivefilter = _("Include resolved"); |
210 |
var txtInactivefilter = _("Filter resolved"); |
214 |
var txtInactivefilter = _("Filter resolved"); |
211 |
$('#resolved_filter').on("click", function() { |
215 |
function adjust_filter_label(){ |
212 |
if ($(this).hasClass('filtered')){ |
216 |
if ($("#hide_resolved_concerns").is(":checked")){ |
213 |
filter_resolved = false; |
217 |
$("#resolved_filter").html('<i class="fa fa-filter"></i> '+txtActivefilter); |
214 |
$(this).html('<i class="fa fa-filter"></i> '+txtActivefilter); |
|
|
215 |
} else { |
218 |
} else { |
216 |
filter_resolved = true; |
219 |
$("#resolved_filter").html('<i class="fa fa-bars"></i> '+txtInactivefilter); |
217 |
$(this).html('<i class="fa fa-bars"></i> '+txtInactivefilter); |
|
|
218 |
} |
220 |
} |
|
|
221 |
} |
222 |
$('#resolved_filter').on("click", function() { |
223 |
$("#hide_resolved_concerns").prop("checked", !$("#hide_resolved_concerns").is(":checked")); |
224 |
adjust_filter_label() |
219 |
tickets.DataTable().draw(); |
225 |
tickets.DataTable().draw(); |
220 |
$(this).toggleClass('filtered'); |
|
|
221 |
}); |
226 |
}); |
|
|
227 |
adjust_filter_label(); |
222 |
|
228 |
|
223 |
[% FOR st IN status %] |
229 |
[% FOR st IN status %] |
224 |
$('#[% st.authorised_value | html %]_filter').on("click", function() { |
230 |
$('#[% st.authorised_value | html %]_filter').on("click", function() { |
225 |
if ($(this).hasClass('filtered')){ |
231 |
if ($("#hide_[% st.authorised_value | html %]").is(":checked")){ |
226 |
additional_filters.status.find((o, i) => { |
232 |
additional_filters.status.find((o, i) => { |
227 |
if (o["!="] === '[% st.authorised_value | html %]') { |
233 |
if (o["!="] === '[% st.authorised_value | html %]') { |
228 |
additional_filters.status.splice(i, 1); |
234 |
additional_filters.status.splice(i, 1); |
Lines 240-247
Link Here
|
240 |
additional_filters.status.push({ '!=': "[% st.authorised_value | html %]" }); |
246 |
additional_filters.status.push({ '!=': "[% st.authorised_value | html %]" }); |
241 |
$(this).html('<i class="fa fa-bars"></i> '+_("Include ")+"[% st.lib | html %]"); |
247 |
$(this).html('<i class="fa fa-bars"></i> '+_("Include ")+"[% st.lib | html %]"); |
242 |
} |
248 |
} |
|
|
249 |
$("#hide_[% st.authorised_value | html %]").prop("checked", !$("#hide_[% st.authorised_value | html %]").is(":checked")); |
243 |
tickets.DataTable().draw(); |
250 |
tickets.DataTable().draw(); |
244 |
$(this).toggleClass('filtered'); |
|
|
245 |
}); |
251 |
}); |
246 |
[% END %] |
252 |
[% END %] |
247 |
}); |
253 |
}); |
248 |
- |
|
|