Lines 283-289
Link Here
|
283 |
<a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">Holdings ([% itemloop.size() || 0 | html %])</a> |
283 |
<a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">Holdings ([% itemloop.size() || 0 | html %])</a> |
284 |
</li> |
284 |
</li> |
285 |
[% END %] |
285 |
[% END %] |
286 |
[% IF ( MARCNOTES ) %]<li role="presentation"><a href="#description" aria-controls="description" role="tab" data-toggle="tab">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
286 |
[% IF Koha.Preference('EnableItemGroups') %]<li><a href="#item_groups">Item Groups</a></li>[% END %] |
|
|
287 |
[% IF ( MARCNOTES || notes ) %]<li role="presentation"><a href="#description" aria-controls="description" role="tab" data-toggle="tab">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
287 |
[% IF ComponentParts && ComponentParts.size %]<li id="components_tab" role="presentation"><a href="#components" aria-controls="components" role="tab" data-toggle="tab">Components ([% ComponentParts.size | html %])</a></li>[% END %] |
288 |
[% IF ComponentParts && ComponentParts.size %]<li id="components_tab" role="presentation"><a href="#components" aria-controls="components" role="tab" data-toggle="tab">Components ([% ComponentParts.size | html %])</a></li>[% END %] |
288 |
[% IF ( subscriptionsnumber ) %]<li role="presentation"><a href="#subscriptions" aria-controls="subscriptions" role="tab" data-toggle="tab">Subscriptions</a></li>[% END %] |
289 |
[% IF ( subscriptionsnumber ) %]<li role="presentation"><a href="#subscriptions" aria-controls="subscriptions" role="tab" data-toggle="tab">Subscriptions</a></li>[% END %] |
289 |
[% IF Koha.Preference('AcquisitionDetails') %]<li role="presentation"><a href="#acq_details" aria-controls="acq_details" role="tab" data-toggle="tab">Acquisition details</a></li>[% END %] |
290 |
[% IF Koha.Preference('AcquisitionDetails') %]<li role="presentation"><a href="#acq_details" aria-controls="acq_details" role="tab" data-toggle="tab">Acquisition details</a></li>[% END %] |
Lines 321-326
Link Here
|
321 |
[% IF CAN_user_tools_items_batchmod %] |
322 |
[% IF CAN_user_tools_items_batchmod %] |
322 |
<a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a> |
323 |
<a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a> |
323 |
[% END %] |
324 |
[% END %] |
|
|
325 |
[% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] |
326 |
<a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> |
327 |
<a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a> |
328 |
[% END %] |
324 |
</span> |
329 |
</span> |
325 |
[% END %] |
330 |
[% END %] |
326 |
</div> |
331 |
</div> |
Lines 335-340
Link Here
|
335 |
<th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th> |
340 |
<th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th> |
336 |
<th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th> |
341 |
<th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th> |
337 |
[% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %] |
342 |
[% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %] |
|
|
343 |
[% IF Koha.Preference('EnableItemGroups') %] |
344 |
<th id="[% tab | html %]_item_group" data-colname="[% tab | html %]_item_group">Item group</th> |
345 |
[% END %] |
338 |
<th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th> |
346 |
<th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th> |
339 |
[% IF volinfo %] |
347 |
[% IF volinfo %] |
340 |
<th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th> |
348 |
<th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th> |
Lines 409-414
Note that permanent location is a code, and location may be an authval.
Link Here
|
409 |
</span> |
417 |
</span> |
410 |
</td> |
418 |
</td> |
411 |
[% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %] |
419 |
[% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %] |
|
|
420 |
[% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %] |
412 |
<td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td> |
421 |
<td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td> |
413 |
[% IF ( volinfo ) %] |
422 |
[% IF ( volinfo ) %] |
414 |
[% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %] |
423 |
[% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %] |
Lines 622-628
Note that permanent location is a code, and location may be an authval.
Link Here
|
622 |
|
631 |
|
623 |
[% END %][%# end of block items_table %] |
632 |
[% END %][%# end of block items_table %] |
624 |
|
633 |
|
|
|
634 |
<<<<<<< HEAD |
625 |
<div role="tabpanel" class="tab-pane" id="holdings"> |
635 |
<div role="tabpanel" class="tab-pane" id="holdings"> |
|
|
636 |
======= |
637 |
[% IF Koha.Preference('EnableItemGroups') %] |
638 |
<div id="item_groups"> |
639 |
[% IF CAN_user_editcatalogue_manage_item_groups %] |
640 |
<div class="item_groups_table_table_controls"> |
641 |
<a href="#" class="item-group-create btn btn-default btn-xs"><i class="fa fa-plus"></i> New item group</a> |
642 |
</div> |
643 |
[% END %] |
644 |
<table class="items-group-table" id="items-group-table"> |
645 |
<thead> |
646 |
<tr> |
647 |
<td>Display Order</td> |
648 |
<td>Description</td> |
649 |
<td> </td> |
650 |
</tr> |
651 |
</thead> |
652 |
</table> |
653 |
</div> |
654 |
[% END %] |
655 |
|
656 |
<div id="holdings"> |
657 |
>>>>>>> Bug 24857: Add item group management to detail.pl |
626 |
|
658 |
|
627 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
659 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
628 |
<span class="results_summary NovelistSelect" style="display:none;"> |
660 |
<span class="results_summary NovelistSelect" style="display:none;"> |
Lines 1053-1058
Note that permanent location is a code, and location may be an authval.
Link Here
|
1053 |
|
1085 |
|
1054 |
[% END %] |
1086 |
[% END %] |
1055 |
|
1087 |
|
|
|
1088 |
<div class="modal fade" id="modal-item-group-create" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-create-label"> |
1089 |
<div class="modal-dialog"> |
1090 |
<div class="modal-content"> |
1091 |
<div class="modal-header"> |
1092 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1093 |
<h3 id="modal-item-group-create-label"><i class="fa fa-plus"></i> Create a new item group</h3> |
1094 |
</div> |
1095 |
<form id="modal-item-group-create-form" class="validated"> |
1096 |
<div class="modal-body"> |
1097 |
<fieldset> |
1098 |
<p> |
1099 |
<label for="item_group_description" class="required">Name: </label> |
1100 |
<input name="description" id="modal-item-group-create-form-description" type="text" size="30" required="required" class="required" /> |
1101 |
<span class="required">Required</span> |
1102 |
</p> |
1103 |
<p> |
1104 |
<label for="item_group_display_order" class="required">Display order: </label> |
1105 |
<input name="display_order" id="modal-item-group-create-form-display_order" value="0" size="5" required="required" class="required" /> |
1106 |
<span class="required">Required</span> |
1107 |
<br/> |
1108 |
<span class="hint">Numbers only, item groups will be displayed in counting order</span> |
1109 |
</p> |
1110 |
</fieldset> |
1111 |
</div> |
1112 |
<div class="modal-footer"> |
1113 |
<button id="modal-item-group-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button> |
1114 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1115 |
</div> |
1116 |
</form> |
1117 |
</div> |
1118 |
</div> |
1119 |
</div> |
1120 |
|
1121 |
<div class="modal fade" id="modal-item-group-edit" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-edit-label"> |
1122 |
<div class="modal-dialog"> |
1123 |
<div class="modal-content"> |
1124 |
<div class="modal-header"> |
1125 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1126 |
<h3 id="modal-item-group-edit-label"><i class='fa fa-edit'></i> Edit item group</h3> |
1127 |
</div> |
1128 |
<form id="modal-item-group-edit-form" class="validated"> |
1129 |
<div class="modal-body"> |
1130 |
<fieldset> |
1131 |
<p> |
1132 |
<label for="item_group_description" class="required">Name: </label> |
1133 |
<input name="description" id="modal-item-group-edit-form-description" type="text" size="30" required="required" class="required" /> |
1134 |
<span class="required">Required</span> |
1135 |
</p> |
1136 |
<p> |
1137 |
<label for="item_group_display_order" class="required">Sort order: </label> |
1138 |
<input name="display_order" id="modal-item-group-edit-form-display_order" size="5" /> |
1139 |
<span class="hint">Numbers only, item groups will be displayed in counting order</span> |
1140 |
</p> |
1141 |
</fieldset> |
1142 |
</div> |
1143 |
<div class="modal-footer"> |
1144 |
<button id="modal-item-group-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button> |
1145 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1146 |
</div> |
1147 |
</form> |
1148 |
</div> |
1149 |
</div> |
1150 |
</div> |
1151 |
|
1152 |
<div class="modal fade" id="modal-item-group-delete" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-delete-label"> |
1153 |
<div class="modal-dialog"> |
1154 |
<div class="modal-content"> |
1155 |
<div class="modal-header"> |
1156 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1157 |
<h3 id="modal-item-group-delete-label"><i class='fa fa-trash'></i> Delete item group</h3> |
1158 |
</div> |
1159 |
<div class="modal-body"> |
1160 |
Are you sure you want to delete this item group? |
1161 |
</div> |
1162 |
<div class="modal-footer"> |
1163 |
<button id="modal-item-group-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button> |
1164 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1165 |
</div> |
1166 |
</div> |
1167 |
</div> |
1168 |
</div> |
1169 |
|
1170 |
<div class="modal fade" id="modal-item-group-set" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-set-label"> |
1171 |
<div class="modal-dialog"> |
1172 |
<div class="modal-content"> |
1173 |
<div class="modal-header"> |
1174 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1175 |
<h3 id="modal-item-group-set-label"><i class='fa fa-book'></i> Set item group for items</h3> |
1176 |
</div> |
1177 |
<form id="modal-item-group-set-form" class="validated"> |
1178 |
<div class="modal-body"> |
1179 |
<fieldset> |
1180 |
<p> |
1181 |
<label for="item_group" class="required">Item group: </label> |
1182 |
<select name="item_group" id="item-group-add-form-select"> |
1183 |
[% FOREACH ig IN biblio.item_groups %] |
1184 |
<option value="[% ig.id | html %]">[% ig.description | html %]</option> |
1185 |
[% END %] |
1186 |
</select> |
1187 |
<span class="required">Required</span> |
1188 |
</p> |
1189 |
</fieldset> |
1190 |
</div> |
1191 |
<div class="modal-footer"> |
1192 |
<button id="modal-item-group-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set item group</button> |
1193 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1194 |
</div> |
1195 |
</form> |
1196 |
</div> |
1197 |
</div> |
1198 |
</div> |
1199 |
|
1200 |
<div class="modal fade" id="modal-item-group-unset" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-unset-label"> |
1201 |
<div class="modal-dialog"> |
1202 |
<div class="modal-content"> |
1203 |
<div class="modal-header"> |
1204 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1205 |
<h3 id="modal-item-group-unset-label"><i class='fa fa-unlink'></i> Remove item from item group</h3> |
1206 |
</div> |
1207 |
<div class="modal-body"> |
1208 |
Are you sure you want to remove these item(s) from their item group(s)? |
1209 |
</div> |
1210 |
<div class="modal-footer"> |
1211 |
<button id="modal-item-group-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button> |
1212 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1213 |
</div> |
1214 |
</div> |
1215 |
</div> |
1216 |
</div> |
1217 |
|
1056 |
[% MACRO jsinclude BLOCK %] |
1218 |
[% MACRO jsinclude BLOCK %] |
1057 |
[% INCLUDE 'catalog-strings.inc' %] |
1219 |
[% INCLUDE 'catalog-strings.inc' %] |
1058 |
[% Asset.js("js/catalog.js") | $raw %] |
1220 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1411-1416
Note that permanent location is a code, and location may be an authval.
Link Here
|
1411 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
1573 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
1412 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
1574 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
1413 |
}); |
1575 |
}); |
|
|
1576 |
|
1577 |
[% IF Koha.Preference('EnableItemGroups') %] |
1578 |
// Load item groups table |
1579 |
var itemGroupsTable = KohaTable("items-group-table", { |
1580 |
"bAutoWidth": false, |
1581 |
'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', |
1582 |
"aoColumns": [ |
1583 |
{ |
1584 |
"mDataProp": function( oObj ) { |
1585 |
return oObj.display_order; |
1586 |
}, |
1587 |
}, |
1588 |
{ |
1589 |
"mDataProp": function( oObj ) { |
1590 |
return oObj.description; |
1591 |
}, |
1592 |
}, |
1593 |
{ |
1594 |
"mDataProp": function( oObj ) { |
1595 |
[% IF CAN_user_editcatalogue_manage_item_groups %] |
1596 |
return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'> |
1597 |
<i class='fa fa-edit'></i> ${_("Edit")} |
1598 |
</button>` |
1599 |
+ ' ' |
1600 |
+ `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'> |
1601 |
<i class='fa fa-trash'></i> ${('Delete')} |
1602 |
</button>`; |
1603 |
[% ELSE %] |
1604 |
return ""; |
1605 |
[% END %] |
1606 |
}, |
1607 |
}, |
1608 |
], |
1609 |
"bPaginate": false, |
1610 |
"bProcessing": true, |
1611 |
"bServerSide": false, |
1612 |
"sAjaxSource": `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1`, |
1613 |
"sAjaxDataProp": "", |
1614 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
1615 |
$.getJSON( sSource, aoData, function (json) { |
1616 |
fnCallback(json) |
1617 |
} ); |
1618 |
}, |
1619 |
}); |
1620 |
|
1621 |
// Create new item groups |
1622 |
$('.item-group-create').on('click', function(){ |
1623 |
$('#modal-item-group-create-form-description').val(""); |
1624 |
$('#modal-item-group-create-submit').removeAttr('disabled'); |
1625 |
$('#modal-item-group-create').modal('show'); |
1626 |
}); |
1627 |
|
1628 |
$("#modal-item-group-create-form").validate({ |
1629 |
submitHandler: function(form) { |
1630 |
$.ajax({ |
1631 |
url: `/api/v1/biblios/${biblionumber}/item_groups`, |
1632 |
headers: { "x-koha-embed": "items" }, |
1633 |
success: function(item_groups){ |
1634 |
$('#modal-item-group-create-submit').attr('disabled', 'disabled'); |
1635 |
|
1636 |
var settings = { |
1637 |
"url": `/api/v1/biblios/${biblionumber}/item_groups`, |
1638 |
"method": "POST", |
1639 |
"headers": { |
1640 |
"Content-Type": "application/json" |
1641 |
}, |
1642 |
"data": JSON.stringify( |
1643 |
{ |
1644 |
"description": $("#modal-item-group-create-form-description").val(), |
1645 |
"display_order": $("#modal-item-group-create-form-display_order").val(), |
1646 |
} |
1647 |
), |
1648 |
}; |
1649 |
|
1650 |
$.ajax(settings) |
1651 |
.done(function (response) { |
1652 |
$('#item-group-add-form-select').append($('<option>', { |
1653 |
value: response.item_group_id, |
1654 |
text: response.description |
1655 |
})); |
1656 |
|
1657 |
$('#modal-item-group-create').modal('hide'); |
1658 |
if ( item_groups.length == 0 ) { |
1659 |
// This bib has no previous item groups, reload the page |
1660 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
1661 |
} else { |
1662 |
// Has other item groups, just reload the table |
1663 |
itemGroupsTable.api().ajax.reload(); |
1664 |
} |
1665 |
}) |
1666 |
.fail(function(err) { |
1667 |
var message = err.responseJSON.error; |
1668 |
alert(message); |
1669 |
}); |
1670 |
} |
1671 |
}); |
1672 |
} |
1673 |
}); |
1674 |
|
1675 |
$('#modal-item-group-create').on('shown.bs.modal', function () { |
1676 |
$('#modal-item-group-create-form-description').focus(); |
1677 |
}) |
1678 |
|
1679 |
// Edit existing item groups |
1680 |
$('body').on( 'click', '.item-group-edit', function(){ |
1681 |
const item_group_id = $(this).data('item-group-id'); |
1682 |
const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`; |
1683 |
$.get( url, function( data ) { |
1684 |
$('#modal-item-group-edit-form-description').val( data.description ); |
1685 |
$('#modal-item-group-edit-form-display_order').val( data.display_order ); |
1686 |
$('#modal-item-group-edit-submit').data('item-group-id', item_group_id ); |
1687 |
$('#modal-item-group-edit-submit').removeAttr('disabled'); |
1688 |
$('#modal-item-group-edit').modal('show'); |
1689 |
}); |
1690 |
}); |
1691 |
|
1692 |
$("#modal-item-group-edit-form").validate({ |
1693 |
submitHandler: function(form) { |
1694 |
$('#modal-item-group-edit-submit').attr('disabled', 'disabled'); |
1695 |
|
1696 |
const item_group_id = $('#modal-item-group-edit-submit').data('item-group-id'); |
1697 |
const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`; |
1698 |
|
1699 |
var settings = { |
1700 |
"url": url, |
1701 |
"method": "PUT", |
1702 |
"headers": { |
1703 |
"Content-Type": "application/json" |
1704 |
}, |
1705 |
"data": JSON.stringify( |
1706 |
{ |
1707 |
"description": $("#modal-item-group-edit-form-description").val(), |
1708 |
"display_order": $("#modal-item-group-edit-form-display_order").val(), |
1709 |
} |
1710 |
), |
1711 |
}; |
1712 |
|
1713 |
$.ajax(settings) |
1714 |
.done(function (response) { |
1715 |
$('#modal-item-group-edit').modal('hide'); |
1716 |
itemGroupsTable.api().ajax.reload(); |
1717 |
}) |
1718 |
.fail(function(err) { |
1719 |
var message = err.responseJSON.error; |
1720 |
alert(message); |
1721 |
}); |
1722 |
} |
1723 |
}); |
1724 |
|
1725 |
$('#modal-item-group-edit').on('shown.bs.modal', function () { |
1726 |
$('#modal-item-group-edit-form-description').focus(); |
1727 |
}) |
1728 |
|
1729 |
// Delete existing item groups |
1730 |
$('body').on( 'click', '.item-group-delete', function(){ |
1731 |
const item_group_id = $(this).data('item-group-id'); |
1732 |
$('#modal-item-group-delete-submit').data('item-group-id', item_group_id ); |
1733 |
$('#modal-item-group-delete-submit').removeAttr('disabled'); |
1734 |
$('#modal-item-group-delete').modal('show'); |
1735 |
}); |
1736 |
$("#modal-item-group-delete-submit").on('click', function(){ |
1737 |
$('#modal-item-group-delete-submit').attr('disabled', 'disabled'); |
1738 |
const item_group_id = $("#modal-item-group-delete-submit").data('item-group-id'); |
1739 |
|
1740 |
$.ajax({ |
1741 |
url: `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`, |
1742 |
headers: { "x-koha-embed": "items" }, |
1743 |
success: function(item_group_data){ |
1744 |
$.ajax({ |
1745 |
"url": `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`, |
1746 |
"method": "DELETE", |
1747 |
}) |
1748 |
.done(function (response) { |
1749 |
$('#modal-item-group-delete').modal('hide'); |
1750 |
$(`#item-group-add-form-select option[value='${item_group_id}']`).remove(); |
1751 |
if ( item_group_data.items === null ) { |
1752 |
// No items for this item group, we can just refresh the table |
1753 |
itemGroupsTable.api().ajax.reload(); |
1754 |
} else { |
1755 |
// This item group had items attached to it, we need to reload the page |
1756 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
1757 |
} |
1758 |
}) |
1759 |
.fail(function(err) { |
1760 |
var message = err.responseJSON.error; |
1761 |
alert(message); |
1762 |
}); |
1763 |
} |
1764 |
}); |
1765 |
}); |
1766 |
|
1767 |
// Add item(s) to a item group |
1768 |
$('.itemselection_action_item_group_set').on('click', function(){ |
1769 |
$('#modal-item-group-set').modal('show'); |
1770 |
}); |
1771 |
|
1772 |
$("#modal-item-group-set-form").validate({ |
1773 |
submitHandler: function(form) { |
1774 |
$('#modal-item-group-set-submit').attr('disabled', 'disabled'); |
1775 |
|
1776 |
const item_group_id = $('#item-group-add-form-select').val(); |
1777 |
|
1778 |
let itemnumbers = new Array(); |
1779 |
$("input[name='itemnumber'][type='checkbox']:checked").each(function() { |
1780 |
const itemnumber = $(this).val(); |
1781 |
itemnumbers.push( itemnumber ); |
1782 |
}); |
1783 |
if (itemnumbers.length > 0) { |
1784 |
let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group'; |
1785 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
1786 |
url += '&biblionumber=[% biblionumber | uri %]'; |
1787 |
url += `&item_group_id=${item_group_id}`; |
1788 |
|
1789 |
window.location.replace(url); |
1790 |
} |
1791 |
|
1792 |
$('#modal-item-group-set').modal('hide'); |
1793 |
} |
1794 |
}); |
1795 |
|
1796 |
// Remove item(s) from an item group |
1797 |
$('.itemselection_action_item_group_unset').on('click', function(){ |
1798 |
$('#modal-item-group-unset').modal('show'); |
1799 |
}); |
1800 |
|
1801 |
$("#modal-item-group-unset-submit").on('click', function(){ |
1802 |
$('#modal-item-group-unset-submit').attr('disabled', 'disabled'); |
1803 |
|
1804 |
let itemnumbers = new Array(); |
1805 |
$("input[name='itemnumber'][type='checkbox']:checked").each(function() { |
1806 |
const itemnumber = $(this).val(); |
1807 |
itemnumbers.push( itemnumber ); |
1808 |
}); |
1809 |
if (itemnumbers.length > 0) { |
1810 |
let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group'; |
1811 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
1812 |
url += '&biblionumber=[% biblionumber | uri %]'; |
1813 |
|
1814 |
window.location.replace(url); |
1815 |
} |
1816 |
|
1817 |
$('#modal-item-group-unset').modal('hide'); |
1818 |
}); |
1819 |
[% END %] |
1414 |
</script> |
1820 |
</script> |
1415 |
[% END %] |
1821 |
[% END %] |
1416 |
[% INCLUDE 'intranet-bottom.inc' %] |
1822 |
[% INCLUDE 'intranet-bottom.inc' %] |
1417 |
- |
|
|