Lines 53-71
$(document).ready(function() {
Link Here
|
53 |
|
53 |
|
54 |
// At the moment, the only prefilter possible is borrowernumber |
54 |
// At the moment, the only prefilter possible is borrowernumber |
55 |
// see ill/ill-requests.pl and members/ill-requests.pl |
55 |
// see ill/ill-requests.pl and members/ill-requests.pl |
56 |
let additional_prefilters = []; |
56 |
let additional_prefilters = {}; |
57 |
if(prefilters){ |
57 |
if(prefilters){ |
58 |
let prefilters_array = prefilters.split("&"); |
58 |
let prefilters_array = prefilters.split("&"); |
59 |
prefilters_array.forEach((prefilter) => { |
59 |
prefilters_array.forEach((prefilter) => { |
60 |
let prefilter_split = prefilter.split("="); |
60 |
let prefilter_split = prefilter.split("="); |
61 |
additional_prefilters.push( { |
61 |
additional_prefilters[prefilter_split[0]] = prefilter_split[1] |
62 |
"key": prefilter_split[0], |
62 |
}); |
63 |
"value": prefilter_split[1] |
|
|
64 |
} ); |
65 |
|
66 |
}); |
67 |
} |
63 |
} |
68 |
|
64 |
|
|
|
65 |
let borrower_prefilter = additional_prefilters['borrowernumber'] || null; |
66 |
|
69 |
let additional_filters = { |
67 |
let additional_filters = { |
70 |
"me.backend": function(){ |
68 |
"me.backend": function(){ |
71 |
let backend = $("#illfilter_backend").val(); |
69 |
let backend = $("#illfilter_backend").val(); |
Lines 78-86
$(document).ready(function() {
Link Here
|
78 |
return { "=": branchcode } |
76 |
return { "=": branchcode } |
79 |
}, |
77 |
}, |
80 |
"me.borrowernumber": function(){ |
78 |
"me.borrowernumber": function(){ |
81 |
let borrowernumber_pre_filter = additional_prefilters.find(e => e.key === 'borrowernumber'); |
79 |
return borrower_prefilter ? { "=": borrower_prefilter } : ""; |
82 |
if ( additional_prefilters.length == 0 || typeof borrowernumber_pre_filter === undefined) return ""; |
|
|
83 |
return { "=": borrowernumber_pre_filter["value"] } |
84 |
}, |
80 |
}, |
85 |
"-or": function(){ |
81 |
"-or": function(){ |
86 |
let patron = $("#illfilter_patron").val(); |
82 |
let patron = $("#illfilter_patron").val(); |
Lines 123-129
$(document).ready(function() {
Link Here
|
123 |
return filters; |
119 |
return filters; |
124 |
}, |
120 |
}, |
125 |
"me.placed": function(){ |
121 |
"me.placed": function(){ |
126 |
if ( additional_prefilters.length != 0 && !additional_prefilters.find(e => e.key === 'placed')) return ""; |
122 |
if ( Object.keys(additional_prefilters).length ) return ""; |
127 |
let placed_start = $('#illfilter_dateplaced_start').get(0)._flatpickr.selectedDates[0]; |
123 |
let placed_start = $('#illfilter_dateplaced_start').get(0)._flatpickr.selectedDates[0]; |
128 |
let placed_end = $('#illfilter_dateplaced_end').get(0)._flatpickr.selectedDates[0]; |
124 |
let placed_end = $('#illfilter_dateplaced_end').get(0)._flatpickr.selectedDates[0]; |
129 |
if (!placed_start && !placed_end) return ""; |
125 |
if (!placed_start && !placed_end) return ""; |
Lines 133-139
$(document).ready(function() {
Link Here
|
133 |
} |
129 |
} |
134 |
}, |
130 |
}, |
135 |
"me.updated": function(){ |
131 |
"me.updated": function(){ |
136 |
if ( additional_prefilters.length != 0 && !additional_prefilters.find(e => e.key === 'updated')) return ""; |
132 |
if (Object.keys(additional_prefilters).length) return ""; |
137 |
let updated_start = $('#illfilter_datemodified_start').get(0)._flatpickr.selectedDates[0]; |
133 |
let updated_start = $('#illfilter_datemodified_start').get(0)._flatpickr.selectedDates[0]; |
138 |
let updated_end = $('#illfilter_datemodified_end').get(0)._flatpickr.selectedDates[0]; |
134 |
let updated_end = $('#illfilter_datemodified_end').get(0)._flatpickr.selectedDates[0]; |
139 |
if (!updated_start && !updated_end) return ""; |
135 |
if (!updated_start && !updated_end) return ""; |
Lines 178-184
$(document).ready(function() {
Link Here
|
178 |
} |
174 |
} |
179 |
}; |
175 |
}; |
180 |
|
176 |
|
181 |
var ill_requests_table = $("#ill-requests").kohaTable({ |
177 |
let table_id = "#ill-requests"; |
|
|
178 |
if (borrower_prefilter) { |
179 |
table_id += "-patron-" + borrower_prefilter; |
180 |
} |
181 |
|
182 |
var ill_requests_table = $(table_id).kohaTable({ |
182 |
"ajax": { |
183 |
"ajax": { |
183 |
"url": '/api/v1/ill/requests' |
184 |
"url": '/api/v1/ill/requests' |
184 |
}, |
185 |
}, |
185 |
- |
|
|