$(document).ready(function() {
var table_settings = [% TablesSettings.GetTableSettings( 'cataloguing', 'concerns', 'table_concerns', 'json' ) | $raw %];
+ var filtered = false;
+ let additional_filters = {
+ resolved_date: function(){
+ if ( filtered ) {
+ return { "=": null };
+ } else {
+ return;
+ }
+ },
+ biblio_id: [% biblionumber | uri %]
+ };
+
var tickets_url = '/api/v1/tickets';
var tickets = $("#table_concerns").kohaTable({
"ajax": {
"orderable": false
},
]
- }, table_settings, 0, { biblio_id: [% biblionumber | uri %]});
+ }, table_settings, 0, additional_filters);
- $('#hideResolved').on( "click", function() {
- // It would be great if we could pass null here but it gets stringified
- concerns.DataTable().columns('3').search('special:undefined').draw();
+ $('#hideResolved').on("click", function() {
+ filtered = true;
+ tickets.DataTable().draw();
});
- $('#showAll').on( "click", function() {
- concerns.DataTable().columns('3').search('').draw();
+ $('#showAll').on("click", function() {
+ filtered = false;
+ tickets.DataTable().draw();
});
});
</script>
var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %];
+ var filtered = false;
+ let additional_filters = {
+ resolved_date: function(){
+ if ( filtered ) {
+ return { "=": null };
+ } else {
+ return;
+ }
+ }
+ };
+
var tickets_url = '/api/v1/tickets';
var tickets = $("#table_concerns").kohaTable({
"ajax": {
"orderable": false
},
]
- }, table_settings, 1);
+ }, table_settings, 1, additional_filters);
$('#hideResolved').on("click", function() {
- // It would be great if we could pass null here but it gets stringified
- tickets.DataTable().columns('3').search('special:undefined').draw();
+ filtered = true;
+ tickets.DataTable().draw();
});
$('#showAll').on("click", function() {
- tickets.DataTable().columns('3').search('').draw();
+ filtered = false;
+ tickets.DataTable().draw();
});
});
</script>
var part = {};
var attr = attributes[i];
let criteria = options.criteria;
- if ( value === 'special:undefined' ) {
- value = null;
+ if ( value.match(/^\^(.*)\$$/) ) {
+ value = value.replace(/^\^/, '').replace(/\$$/, '');
criteria = "exact";
- }
- if ( value !== null ) {
- if ( value.match(/^\^(.*)\$$/) ) {
- value = value.replace(/^\^/, '').replace(/\$$/, '');
- criteria = "exact";
- } else {
- // escape SQL LIKE special characters %
- value = value.replace(/(\%|\\)/g, "\\$1");
- }
+ } else {
+ // escape SQL LIKE special characters %
+ value = value.replace(/(\%|\\)/g, "\\$1");
}
part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact'
? value