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