Bug 34913: Move item groups table to kohaTable

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2023-10-20 14:53:13 +02:00 committed by Katrin Fischer
parent 2447777c22
commit a2a0842892
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -2221,22 +2221,24 @@
[% IF Koha.Preference('EnableItemGroups') %] [% IF Koha.Preference('EnableItemGroups') %]
// Load item groups table // Load item groups table
var itemGroupsTable = KohaTable("items-group-table", { var itemGroupsTable = $("#items-group-table").kohaTable({
"autoWidth": false, autoWidth: false,
"dom": '<"top pager"ilp>t<"bottom pager"ip>r', dom: '<"top pager"ilp>t<"bottom pager"ip>r',
"columns": [ columns: [
{ {
"data": function( oObj ) { data: "display_order",
return oObj.display_order; title: _("Display order"),
}, searchable: true,
orderable: true,
}, },
{ {
"data": function( oObj ) { data: "description",
return oObj.description; title: _("Description"),
}, searchable: true,
orderable: true,
}, },
{ {
"data": function( oObj ) { data: function( oObj ) {
[% IF CAN_user_editcatalogue_manage_item_groups %] [% IF CAN_user_editcatalogue_manage_item_groups %]
return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'> return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
<i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")} <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
@ -2249,18 +2251,12 @@
return ""; return "";
[% END %] [% END %]
}, },
searchable: false,
orderable: false,
}, },
], ],
"paginate": false, paginate: false,
"processing": true, ajax: { url: `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1` },
"serverSide": false,
"ajax": `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1`,
"sAjaxDataProp": "",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
}); });
// Create new item groups // Create new item groups