Lines 206-286
Link Here
|
206 |
[% INCLUDE 'datatables.inc' %] |
206 |
[% INCLUDE 'datatables.inc' %] |
207 |
[% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %] |
207 |
[% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %] |
208 |
[% Asset.js("js/acquisitions-menu.js") | $raw %] |
208 |
[% Asset.js("js/acquisitions-menu.js") | $raw %] |
209 |
<script> |
209 |
[% IF loop_budget %] |
210 |
dt_overwrite_html_sorting_localeCompare(); |
210 |
<script> |
|
|
211 |
dt_overwrite_html_sorting_localeCompare(); |
211 |
|
212 |
|
212 |
$(document).ready(function() { |
213 |
$(document).ready(function() { |
213 |
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'acq_acqui-home', 'accounts', 'json' ) | $raw %]; |
214 |
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'acq_acqui-home', 'accounts', 'json' ) | $raw %]; |
214 |
var oTable = $("#accounts").kohaTable({ |
215 |
var oTable = $("#accounts").kohaTable({ |
215 |
"drawCallback": function ( oSettings ) { |
216 |
"drawCallback": function ( oSettings ) { |
216 |
if ( oSettings.aiDisplay.length == 0 ) |
217 |
if ( oSettings.aiDisplay.length == 0 ) |
217 |
{ |
218 |
{ |
218 |
return; |
219 |
return; |
219 |
} |
220 |
} |
220 |
|
221 |
|
221 |
var nTrs = $('#accounts tbody tr'); |
222 |
var nTrs = $('#accounts tbody tr'); |
222 |
var iColspan = nTrs[0].getElementsByTagName('td').length; |
223 |
var iColspan = nTrs[0].getElementsByTagName('td').length; |
223 |
var sLastGroup = ""; |
224 |
var sLastGroup = ""; |
224 |
for ( var i=0 ; i<nTrs.length ; i++ ) |
225 |
for ( var i=0 ; i<nTrs.length ; i++ ) |
225 |
{ |
|
|
226 |
var iDisplayIndex = oSettings._iDisplayStart + i; |
227 |
var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; |
228 |
if ( sGroup != sLastGroup ) |
229 |
{ |
226 |
{ |
230 |
var nGroup = document.createElement( 'tr' ); |
227 |
var iDisplayIndex = oSettings._iDisplayStart + i; |
231 |
var nCell = document.createElement( 'td' ); |
228 |
var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; |
232 |
nCell.colSpan = iColspan; |
229 |
if ( sGroup != sLastGroup ) |
233 |
nCell.className = "group"; |
230 |
{ |
234 |
nCell.innerHTML = sGroup; |
231 |
var nGroup = document.createElement( 'tr' ); |
235 |
nGroup.appendChild( nCell ); |
232 |
var nCell = document.createElement( 'td' ); |
236 |
nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); |
233 |
nCell.colSpan = iColspan; |
237 |
sLastGroup = sGroup; |
234 |
nCell.className = "group"; |
|
|
235 |
nCell.innerHTML = sGroup; |
236 |
nGroup.appendChild( nCell ); |
237 |
nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); |
238 |
sLastGroup = sGroup; |
239 |
} |
238 |
} |
240 |
} |
239 |
} |
241 |
}, |
240 |
}, |
242 |
"footerCallback": function ( row, data, start, end, display ) { |
241 |
"footerCallback": function ( row, data, start, end, display ) { |
243 |
var api = this.api(), data; |
242 |
var api = this.api(), data; |
244 |
footer_column_sum( api, [ 6, 7, 8, 9 ] ); |
243 |
footer_column_sum( api, [ 6, 7, 8, 9 ] ); |
245 |
}, |
244 |
}, |
246 |
"columnDefs": [ |
245 |
"columnDefs": [ |
247 |
{ "orderable": false, "targets": ["_all"] } |
246 |
{ "orderable": false, "targets": ["_all"] } |
248 |
], |
247 |
], |
249 |
"ordering": true, |
248 |
"ordering": true, |
250 |
"orderFixed": [[ 1, 'asc' ]], |
249 |
"orderFixed": [[ 1, 'asc' ]], |
251 |
"paginate": false, |
250 |
"paginate": false, |
252 |
"autoWidth": false |
251 |
"autoWidth": false |
253 |
}, table_settings ); |
252 |
}, table_settings ); |
254 |
let table_dt = oTable.DataTable(); |
253 |
let table_dt = oTable.DataTable(); |
|
|
254 |
|
255 |
|
255 |
$(oTable).treetable({ |
256 |
$(oTable).treetable({ |
256 |
expandable: true |
257 |
expandable: true |
257 |
}); |
258 |
}); |
258 |
$(oTable).treetable('expandAll'); |
|
|
259 |
$("#expand_all").click(function(e){ |
260 |
e.preventDefault(); |
261 |
$(oTable).treetable('expandAll'); |
259 |
$(oTable).treetable('expandAll'); |
262 |
}); |
260 |
$("#expand_all").click(function(e){ |
263 |
$("#collapse_all").click(function(e){ |
261 |
e.preventDefault(); |
264 |
e.preventDefault(); |
262 |
$(oTable).treetable('expandAll'); |
265 |
$(oTable).treetable('collapseAll'); |
263 |
}); |
266 |
}); |
264 |
$("#collapse_all").click(function(e){ |
|
|
265 |
e.preventDefault(); |
266 |
$(oTable).treetable('collapseAll'); |
267 |
}); |
267 |
|
268 |
|
268 |
$("#hide_inactive").click(function(e){ |
269 |
$("#hide_inactive").click(function(e){ |
269 |
e.preventDefault(); |
270 |
e.preventDefault(); |
270 |
table_dt.columns(0).search(1).draw(); // Show only active=1 |
271 |
table_dt.columns(0).search(1).draw(); // Show only active=1 |
271 |
}); |
272 |
}); |
272 |
$("#show_inactive").click(function(e){ |
273 |
$("#show_inactive").click(function(e){ |
273 |
e.preventDefault(); |
274 |
e.preventDefault(); |
274 |
table_dt.columns(0).search("").draw(); |
275 |
table_dt.columns(0).search("").draw(); |
275 |
}); |
276 |
}); |
276 |
$("#hide_inactive").click(); |
277 |
$("#hide_inactive").click(); |
277 |
|
278 |
|
278 |
$("#library-filter").change(function(){ |
279 |
$("#library-filter").change(function(){ |
279 |
$("#accounts").DataTable().search(this.value); |
280 |
$("#accounts").DataTable().search(this.value); |
280 |
$("#accounts").DataTable().draw(); |
281 |
$("#accounts").DataTable().draw(); |
281 |
}); |
282 |
}); |
282 |
|
283 |
|
283 |
}); |
284 |
}); |
284 |
</script> |
285 |
</script> |
|
|
286 |
[% END %] |
285 |
[% END %] |
287 |
[% END %] |
286 |
[% INCLUDE 'intranet-bottom.inc' %] |
288 |
[% INCLUDE 'intranet-bottom.inc' %] |
287 |
- |
|
|