Bug 34112: Replace fa.fa-pencil-alt with fa-solid.fa-pencil in edit buttons
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / detail.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE KohaPlugins %]
6 [% USE AuthorisedValues %]
7 [% USE Branches %]
8 [% USE Biblio %]
9 [% USE Frameworks %]
10 [% USE Price %]
11 [% USE TablesSettings %]
12 [% PROCESS 'i18n.inc' %]
13 [% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %]
14
15 [% IF Koha.Preference('AmazonAssocTag') %]
16     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
17 [% ELSE %]
18     [% AmazonAssocTag = '' %]
19 [% END %]
20
21 [% ShowCourseReserves = 0 | html %]
22 [% IF UseCourseReserves %]
23     [% FOREACH item IN itemloop %]
24        [% IF item.course_reserves %]
25            [% FOREACH r IN item.course_reserves %]
26                [% IF r.course.enabled == 'yes' %]
27                    [% ShowCourseReserves = 1 | html %]
28                [% END %]
29            [% END %]
30         [% END %]
31     [% END %]
32 [% END %]
33
34 [% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
35
36 [% SET footerjs = 1 %]
37 [% INCLUDE 'doc-head-open.inc' %]
38 <title>
39   [% IF ( unknownbiblionumber ) %]
40     Unknown record
41   [% ELSE %]
42     Details for [% INCLUDE 'biblio-title-head.inc' %]
43   [% END %] &rsaquo; Catalog &rsaquo; Koha
44 </title>
45 [% INCLUDE 'doc-head-close.inc' %]
46 [% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
47 </head>
48
49 <body id="catalog_detail" class="catalog">
50
51 [% WRAPPER 'header.inc' %]
52     [% INCLUDE 'cat-search.inc' %]
53 [% END %]
54
55 [% WRAPPER 'sub-header.inc' %]
56     [% WRAPPER breadcrumbs %]
57         [% WRAPPER breadcrumb_item %]
58             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
59         [% END %]
60
61         [% IF ( unknownbiblionumber ) %]
62             [% WRAPPER breadcrumb_item bc_active= 1 %]
63                 <span>Unknown record</span>
64             [% END %]
65         [% ELSE %]
66             [% WRAPPER breadcrumb_item %]
67                 [% INCLUDE 'biblio-title.inc' link = 1 %]
68             [% END %]
69             [% WRAPPER breadcrumb_item bc_active= 1 %]
70                 <span>Details</span>
71             [% END %]
72         [% END %]
73     [% END #/ WRAPPER breadcrumbs %]
74 [% END #/ WRAPPER sub-header.inc %]
75
76 <div class="main container-fluid">
77     <div class="row">
78         <div class="col-sm-10 col-sm-push-2">
79             <main>
80                 <div class="row">
81
82 [% IF ( unknownbiblionumber ) %]
83   <div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
84 [% ELSE %]
85
86 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
87 [% CoceProviders   = Koha.Preference('CoceProviders') %]
88 [% CoceHost        = Koha.Preference('CoceHost') %]
89 [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %]
90
91 [% INCLUDE 'cat-toolbar.inc' %]
92     [% IF decoding_error %]
93         <div>
94            <span class="biberror">
95             There is an error with this bibliographic record, the view may be degraded.</span>
96             <span class="error"><br/> Error: [% decoding_error | html %]</span>
97         </div>
98     [% END %]
99     [% IF analytics_error %]
100         <div>
101            <span class="analytics_error">
102             There was an error searching for analytic records, please see the logs for details.</span>
103         </div>
104     [% END %]
105     [% IF ( ocoins ) %]
106         <!-- COinS / OpenURL -->
107         <span class="Z3988" title="[% ocoins | html %]"></span>
108     [% END %]
109
110     [% IF ( CoverImagePlugins || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
111         <div id="catalogue_detail_biblio" class="col-xs-9">
112     [% ELSE %]
113         <div id="catalogue_detail_biblio" class="col-xs-12">
114     [% END %]
115         <div class="page-section">
116
117         [% XSLTBloc | $raw %]
118
119         [% IF shelves.count %]
120             <span class="results_summary"><span class="label">Lists that include this title: </span>
121             [% FOREACH s IN shelves %]
122                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a>
123                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
124             [% END %]
125             </span>
126         [% END %]
127         [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
128                 <span class="results_summary"><span class="label">Tags:</span>
129                     [% FOREACH TagLoo IN TagLoop %]
130                         [% IF ( CAN_user_tools_moderate_tags ) %]
131                         <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |uri %]">[% TagLoo.term | html %]</a>
132                         [% ELSE %]
133                         [% TagLoo.term | html %]
134                         [% END %]
135                         <span class="weight">([% TagLoo.weight_total | html %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
136                     [% END %]
137                     </span>
138         [% END %]
139         <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html" title="MARC" class="previewMARC">Show</a></span>
140         <span id="catalogue_detail_framework" class="results_summary">
141             <span class="label">MARC framework:</span>
142             <span class="frameworkcode">[% Frameworks.GetName(biblio.frameworkcode) | html %]</span>
143         </span>
144         [% IF !item_level_itypes ||  Koha.Preference("BiblioItemtypeInfo") %]
145            <span class="results_summary itemtype"><span class="label">Itemtype:</span>
146           [% IF ( !noItemTypeImages && imageurl ) %]
147               <img src="[% imageurl | html %]" alt="" />
148           [% END %]
149           [% IF ( description ) %]
150               <span class="itypetext">[% description | html %]</span>
151           [% ELSE %]
152               <span class="itypetext">[% itemtype | html %]</span>
153           [% END %]
154           </span>
155         [% END %]
156
157         [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
158             <span id="catalogue_detail_elastic_record" class="results_summary"><span class="label">Elasticsearch record:</span> <a href="/cgi-bin/koha/catalogue/showelastic.pl?id=[% biblionumber | uri %]" title="Elasticsearch record" class="previewElastic">Show</a></span>
159         [% END %]
160
161         [% IF ( holdcount ) %]
162             <span class="results_summary">
163                 <span class="label">Holds:</span>
164                 <span class="number_box">
165                     [% IF CAN_user_reserveforothers_place_holds %]
166                         <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber | uri %]">[% holdcount | html %]</a>
167                     [% ELSE %]
168                         <span>[% holdcount | html %]</span>
169                     [% END %]
170                 </span>
171             </span>
172         [% END %]
173
174         [% IF illrequests.count %]
175             <span class="results_summary">
176                 <span class="label">ILL requests:</span>
177                 [% IF CAN_user_ill %]
178                     [% FOREACH ill IN illrequests %]
179                         <a href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% ill.illrequest_id | uri %]">Request [% ill.illrequest_id | html %]</a>[% IF ! loop.last %], [% END %]
180                     [% END %]
181                 [% ELSE %]
182                     [% FOREACH ill IN illrequests %]
183                         <span>Request [% ill.illrequest_id | html %]</span>[% IF ! loop.last %], [% END %]
184                     [% END %]
185                 [% END %]
186             </span>
187         [% END %]
188
189         [% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %]
190             <span class="results_summary">
191                 <span class="label">Article requests:</span>
192                 <span class="number_box">
193                     <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% biblionumber | uri %]">[% article_requests_count | html %]</a>
194                 </span>
195             </span>
196         [% END %]
197
198         [% IF course_reserves %]
199             <span class="results_summary"><span class="label">Courses that have reserved this title: </span>
200             [% FOREACH c IN course_reserves %]
201                 <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% c.course_id | uri %]">[% c.course.course_name | html %]</a>
202                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
203             [% END %]
204             </span>
205         [% END %]
206         </div> [%# .page-section %]
207
208         [% IF ( CoverImagePlugins || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
209         </div>
210             <div class="col-xs-3 bookcoverimg">
211                 <div id="biblio-cover-slider" class="cover-slider" data-isbn="[% normalized_isbn | html %]">
212                     [% IF ( LocalCoverImages ) %]
213                         [% IF localimages.count %]
214                             [% FOREACH image IN localimages %]
215                                 <div class="cover-image local-coverimg">
216                                     <a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
217                                         <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
218                                     </a>
219                                     <div class="hint">Local cover image</div>
220                                 </div>
221                             [% END %]
222                         [% END %]
223                     [% END %]
224
225                     [% IF ( AmazonCoverImages && normalized_isbn) %]
226                         <div class="cover-image" id="amazon-bookcoverimg">
227                             <a href="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.LZZZZZZZ.jpg" title="Amazon cover image">
228                                 <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"/>
229                             </a>
230                             <div class="hint">Image from Amazon.com</div>
231                         </div>
232                     [% END %]
233
234                     [% IF ( IntranetCoce && CoceProviders && normalized_isbn ) %]
235                         [% coce_id = normalized_ean || normalized_isbn %]
236                         <div class="cover-image coce-coverimg">
237                             [% IF ( coce_id ) %]
238                                 <a title="Image from Coce" class="[% coce_id | html %]" id="coce-thumbnail-preview"></a>
239                             [% ELSE %]
240                                 <span class="no-image">No cover image available</span>
241                             [% END %]
242                             <div class="hint">Image from Coce</div>
243                         </div>
244                     [% END %]
245
246                     [% IF ( SyndeticsCovers ) %]
247                         [% IF ( content_identifier_exists ) %]
248                         <div class="cover-image" id="syndetics-bookcoverimg">
249                             <a href="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | url %]/LC.GIF&amp;client=[% Koha.Preference('SyndeticsClientCode') | url %]&amp;type=xw10&amp;upc=[% normalized_upc | url %]&amp;oclc=[% normalized_oclc | url %]" title="Syndetics cover image">
250                                 <img src="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | url %]/[% Koha.Preference('SyndeticsCoverImageSize') | url %].GIF&amp;client=[% Koha.Preference('SyndeticsClientCode') | url %]&amp;type=xw10&amp;upc=[% normalized_upc | url %]&amp;oclc=[% normalized_oclc | url %]" alt="" class="thumbnail" />
251                             </a>
252                             <div class="hint">Image from Syndetics</div>
253                         </div>
254                             [% ELSE %]
255                                 <span class="no-image">No cover image available</span>
256                             [% END %]
257                     [% END %]
258
259                     [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
260                         [% SET custom_cover_image_url = biblio.custom_cover_image_url %]
261                         [% IF custom_cover_image_url %]
262                             <div class="cover-image" id="custom-coverimg">
263                                 <a class="custom_cover_image" href="[% custom_cover_image_url | url %]" title="Custom cover image">
264                                     <img id="custom-img" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
265                                 </a>
266                                 <div class="hint">Custom cover image</div>
267                             </div>
268                         [% END %]
269                     [% END %]
270                 </div> <!-- /.cover-slider -->
271             </div> <!-- /.bookcoverimg.col-xs-3 -->
272         [% ELSE %]
273         </div> <!-- /.col-xs-* -->
274         [% END # /IF ( AmazonCoverImages, etc ) %]
275 </div>
276
277 <div id="bibliodetails" class="toptabs">
278
279 <ul class="nav nav-tabs" role="tablist">
280     [% IF (SeparateHoldings) %]
281         <li role="presentation">
282             <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">[% Branches.GetLoggedInBranchname | html %] holdings ([% itemloop.size() || 0 | html %])</a>
283         </li>
284         <li role="presentation">
285             <a href="#otherholdings"  aria-controls="otherholdings" role="tab" data-toggle="tab">Other holdings ([% otheritemloop.size() || 0 | html %])</a>
286         </li>
287     [% ELSE %]
288         <li role="presentation">
289             <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">Holdings ([% itemloop.size() || 0 | html %])</a>
290         </li>
291     [% END %]
292     [% IF Koha.Preference('EnableItemGroups') %]
293         <li role="presentation">
294             <a href="#item_groups" aria-controls="item_groups" role="tab" data-toggle="tab">Item groups</a>
295         </li>
296     [% END %]
297 [% 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 %]
298 [% 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 %]
299 [% IF ( subscriptionsnumber ) %]<li role="presentation"><a href="#subscriptions"  aria-controls="subscriptions" role="tab" data-toggle="tab">Subscriptions</a></li>[% END %]
300 [% 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 %]
301 [% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
302 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
303 [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]<li role="presentation"><a href="#concerns" aria-controls="concerns" role="tab" data-toggle="tab">Concerns ([% biblio.tickets.count | html %])</a></li>[% END %]
304 [% IF ( LocalCoverImages ) %]
305     <li role="presentation">
306         <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
307     </li>
308 [% END %]
309 [% IF HTML5MediaEnabled && HTML5MediaSets.size %]
310     <li id="media_tab" role="presentation"><a href="#html5media"  aria-controls="html5media" role="tab" data-toggle="tab">Play media</a></li>
311 [% END %]
312 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
313     <li class="NovelistSelect" style="display:none;" role="presentation"><a href="#NovelistSelect"  aria-controls="NovelistSelect" role="tab" data-toggle="tab">NoveList Select</a></li>
314 [% END %]
315 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
316     <li role="presentation"><a href="#[% plugins_intranet_catalog_biblio_tab.id | uri %]"  aria-controls="[% plugins_intranet_catalog_biblio_tab.id | uri %]" role="tab" data-toggle="tab">[% plugins_intranet_catalog_biblio_tab.title | html %]</a></li>
317 [% END %]
318 </ul>
319
320 <div class="tab-content">
321 [% items_table_block_iter = 0 %]
322 [% BLOCK items_table %]
323     [% items_table_block_iter = items_table_block_iter + 1 %]
324     <div class="[% tab | html %]_table_table_controls">
325         [% IF (StaffDetailItemSelection) %]
326             | <a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a> |
327             <a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a>
328             <span class="itemselection_actions">
329               | Actions:
330               [% IF CAN_user_tools_items_batchdel %]
331                 <a class="itemselection_action_delete"><i class="fa fa-trash-can"></i> Delete selected items</a>
332               [% END %]
333               [% IF CAN_user_tools_items_batchmod %]
334                 <a class="itemselection_action_modify"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Modify selected items</a>
335               [% END %]
336               [% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %]
337                 <a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a>
338                 <a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a>
339               [% END %]
340             </span>
341         [% END %]
342     </div>
343     <table class="items_table" id="[% tab | html %]_table">
344         <thead>
345             <tr>
346                 [% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %]
347                 [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
348                     <th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th>
349                 [% END %]
350                 [% IF ( item_level_itypes ) %]<th id="[% tab | html %]_itype" data-colname="[% tab | html %]_itype">Item type</th>[% END %]
351                 <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th>
352                 <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
353                 [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
354                 [% IF Koha.Preference('EnableItemGroups') %]
355                     <th id="[% tab | html %]_item_group" data-colname="[% tab | html %]_item_group">Item group</th>
356                 [% END %]
357                 <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
358                 [% IF volinfo %]
359                     <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th>
360                 [% END %]
361                 <th id="[% tab | html %]_status" data-colname="[% tab | html %]_status">Status</th>
362                 <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen">Last seen</th>
363                 <th id="[% tab | html %]_issues" data-colname="[% tab | html %]_issues">Checkouts</th>
364                 <th id="[% tab | html %]_renewals" data-colname="[% tab | html %]_renewals">Renewals</th>
365                 <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned">Date accessioned</th>
366                 <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed">Date last borrowed</th>
367                 <th id="[% tab | html %]_barcode" data-colname="[% tab | html %]_barcode">Barcode</th>
368                 [% IF ( itemdata_uri ) %]<th id="[% tab | html %]_uri" data-colname="[% tab | html %]_uri">URL</th>[% END %]
369                 [% IF ( itemdata_copynumber ) %]<th id="[% tab | html %]_copynumber" data-colname="[% tab | html %]_copynumber">Copy number</th>[% END %]
370                 [% IF ( itemdata_stocknumber ) %]<th id="[% tab | html %]_stocknumber" data-colname="[% tab | html %]_stocknumber">Inventory number</th>[% END %]
371                 [% IF materials %]<th id="[% tab | html %]_materials" data-colname="[% tab | html %]_materials">Materials specified</th>[% END %]
372                 [% IF ( itemdata_itemnotes ) %]<th id="[% tab | html %]_itemnotes" data-colname="[% tab | html %]_itemnotes">Public notes</th>[% END %]
373                 [% IF ( itemdata_nonpublicnotes ) %]<th id="[% tab | html %]_itemnotes_nonpublic" data-colname="[% tab | html %]_itemnotes_nonpublic">Non-public notes</th>[% END %]
374                 [% IF ( hostrecords ) %]<th id="[% tab | html %]_hostrecord" data-colname="[% tab | html %]_hostrecord">Host records</th>[% END %]
375                 [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %]
376                 [% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %]
377                 [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %]
378                 [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport">&nbsp;</th>[% END %]
379             </tr>
380         </thead>
381         <tbody>
382             [% FOREACH item IN items %]
383                 [% SET date_due = item.object.checkout.date_due %]
384                 <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% date_due | html %]">
385                 [% IF (StaffDetailItemSelection) %]
386                     <td style="text-align:center;vertical-align:middle">
387                         [% IF item.can_be_edited %]
388                             <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
389                         [% END %]
390                     </td>
391                 [% END %]
392                     [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
393                         <td class="cover">
394                             <div class="bookcoverimg">
395                                 <div class="cover-slider">
396                                     [% FOREACH image IN item.object.cover_images %]
397                                         <div class="cover-image local-coverimg">
398                                             <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
399                                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
400                                             </a>
401                                         </div>
402                                     [% END %]
403                                 </div>
404                             </div>
405                         </td>
406                     [% END %]
407
408                     [% IF ( item_level_itypes ) %]
409                         <td class="itype">
410                             [% SET itemtype = item.itemtype %]
411                             [% IF !noItemTypeImages && itemtype.image_location('intranet') %]
412                                 <img src="[% itemtype.image_location('intranet') | html %]" alt="[% itemtype.translated_description | html %]" title="[% itemtype.translated_description | html %]" />
413                             [% END %]
414                             <span class="itypedesc itypetext">[% itemtype.translated_description | html %]</span>
415                         </td>
416                     [% END %]
417                     <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.holdingbranch ) | html %] [% END %]</td>
418                     <td class="homebranch">
419                         <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
420                         <span class="shelvingloc">
421                         [%# If permanent location is defined, show description or code and             %]
422                         [%# display current location in parentheses. If not, display current location. %]
423                         [%# Note that permanent location is a code, and location may be an authval.    %]
424                             [% SET item_location = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) %]
425                             [% IF item.permanent_location %]
426                                 [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
427                                 [% permloc_authval | html %]
428                                 [% IF item_location AND item_location != permloc_authval AND item.location != item.permanent_location %]
429                                     ([% item_location | html %])
430                                 [% END %]
431                             [% ELSE %]
432                                 [% item_location | html %]
433                             [% END %]
434                         </span>
435                     </td>
436                     [% IF ( itemdata_ccode ) %]<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>[% END %]
437                     [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
438                     <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
439                     [% IF ( volinfo ) %]
440                         [% SET serial = item.serial %]
441                         [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %]
442                             <td class="enumchron" data-order="[% serial.publisheddate | html %]">
443                         [% ELSE %]
444                             <td class="enumchron">
445                         [% END %]
446                             [% IF ( itemdata_enumchron ) %]
447                                 [% IF item.enumchron && serial.serialseq %]
448                                     <span class="enum">[% item.enumchron | html %]</span>
449                                     [% IF ( serial.serialseq && item.enumchron != serial.serialseq ) %]
450                                         <span class="sep"> -- </span>
451                                         <span class="serialseq">[% serial.serialseq | html %]</span>
452                                     [% END %]
453                                 [% ELSIF item.enumchron %]
454                                     <span class="enum">[% item.enumchron | html %]</span>
455                                 [% ELSIF item.serialseq %]
456                                     <span class="serialseq">[% serial.serialseq | html %]</span>
457                                 [% END %]
458                                 [% IF serial.publisheddate %]
459                                     <span class="pubdate">([% serial.publisheddate | $KohaDates %])</span>
460                                 [% END %]
461                             [% END %]
462                             </span>
463                         </td>
464                     [% END %]
465                     <td class="status">
466
467                         [% IF item.object.checkout %]
468                           [% IF item.object.checkout.onsite_checkout %]
469                             <span>Currently in local use
470                           [% ELSE %]
471                             <span class="datedue">Checked out
472                           [% END %]
473                                 [% IF item.can_be_edited %]
474                                   [% IF item.object.checkout.onsite_checkout %]
475                                     by
476                                   [% ELSE %]
477                                     to
478                                   [% END %]
479                                   [% INCLUDE 'patron-title.inc' patron=item.object.checkout.patron hide_patron_infos_if_needed=1 %]
480                                 [% END %]
481                                 : due [% date_due | $KohaDates as_due_date => 1 %]
482                             </span>
483                         [% ELSIF ( transfer = item.object.get_transfer ) %]
484                             [% IF (transfer.datesent) %]
485                                 <span class="intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span>
486                             [% ELSE %]
487                                 <span class="transitrequested">Transit pending from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
488
489                             [% END %]
490                         [% END %]
491
492                         [% IF ( item.itemlost ) %]
493                             [% SET itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
494                             [% IF itemlostloop %]
495                                 <span class="lost">[% itemlost_description | html %]</span>
496                             [% ELSE %]
497                                 <span class="lost">Unavailable (lost or missing)</span>
498                             [% END %]
499                         [% END %]
500
501                         [% IF ( item.withdrawn ) %]
502                             [% SET withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
503                             [% IF withdrawn_description %]
504                                 <span class="wdn">[% withdrawn_description | html %]</span>
505                             [% ELSE %]
506                                 <span class="wdn">Withdrawn</span>
507                             [% END %]
508                         [% END %]
509
510                         [% IF ( item.damaged ) %]
511                             [% SET damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
512                             [% IF damaged_description %]
513                                 <span class="dmg">[% damaged_description | html %]</span>
514                             [% ELSE %]
515                                 <span class="dmg">Damaged</span>
516                             [% END %]
517                         [% END %]
518
519                         [% IF ( item.notforloan || item.itemtype.notforloan ) %]
520                             <span class="notforloan">Not for loan
521                             [% SET not_for_loan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
522                             [% IF not_for_loan_description %]
523                                 <span class="reason">([% not_for_loan_description | html %])</span>
524                             [% END %]
525                             </span>
526                         [% END %]
527
528                         [% SET hold = item.first_hold %]
529                         [% IF hold %]
530                             [% IF hold.waitingdate %]
531                                 <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %][% IF ( hold.desk_id ) %], [% hold.desk.desk_name | html %][% END %] since [% hold.waitingdate | $KohaDates %].</span>
532                                 [% IF canreservefromotherbranches AND ( hold.waitingdate OR hold.priority == 1 ) %]
533                                     <span class="heldfor">Hold for:</span>
534                                     [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
535                                 [% END %]
536                             [% ELSE %]
537                                 <span class="holdonitem">There is an item level hold on this item (priority = [% hold.priority | html %]).</span>
538                             [% END %]
539                         [% END %]
540
541                         [% IF Koha.Preference('UseRecalls') %]
542                             [% SET recall = item.object.recall %]
543                             [% IF recall %]
544                                 [% IF recall.waiting_date %]
545                                     <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
546                                 [% ELSE %]
547                                     [% patron_link = BLOCK %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.patron_id | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>[% END %]
548                                     <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
549                                 [% END %]
550                             [% END %]
551                         [% END %]
552
553                         [% UNLESS ( item.notforloan || item.itemtype.notforloan || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfer || hold || ( Koha.Preference('UseRecalls') && recall ) ) %]
554                             <span>Available</span>
555                         [% END %]
556
557                         [% IF ( item.restricted ) %]
558                             <span class="restricted">([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %])</span>
559                         [% END %]
560
561                         [% IF ( item.bundle_host ) %]
562                             <span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span>
563                         [% END %]
564
565                     </td>
566                     <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates with_hours => 1 %]</td>
567                     <td class="issues" data-order="[% item.issues || 0 | html %]">[% item.issues || 0 | html %]</td>
568                     <td class="renewals" data-order="[% item.renewals || 0 | html %]">[% item.renewals || 0 | html %]</td>
569                     <td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td>
570                     <td class="datelastborrowed" data-order="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</td>
571                     <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber | uri %]&amp;biblionumber=[% item.biblionumber | uri %]&amp;bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td>
572                     [% IF ( itemdata_uri ) %]
573                         [% IF item.uri.split(' \| ').size > 1 %]
574                             <td class="uri">
575                                 [% FOREACH uri IN item.uri.split(' \| ') %]<a href="[% uri | url %]">[% uri | html %]</a><br>[% END %]
576                             </td>
577                         [% ELSE %]
578                             <td class="uri">
579                                 [% IF item.uri %]
580                                     <a href="[% item.uri | url %]">[% IF Koha.Preference('URLLinkText') %][% Koha.Preference('URLLinkText') | html %][% ELSE %]Link to resource[% END %]</a>
581                                 [% END %]
582                             </td>
583                         [% END %]
584                     [% END %]
585                     [% IF ( itemdata_copynumber ) %]
586                         <td class="copynumber">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.copynumber', authorised_value => item.copynumber ) | html %]</td>
587                     [% END %]
588                     [% IF ( itemdata_stocknumber ) %]
589                         <td class="stocknumber">[% item.stocknumber | html %]</td>
590                     [% END %]
591                     [% IF materials %]
592                         <td class="materials"> [% item.materials | html %] </td>
593                     [% END %]
594                     [% IF ( itemdata_itemnotes ) %]
595                         <td><div class="itemnotes">[% item.object.itemnotes.replace('\n','<br />') | $raw %]</div></td>
596                     [% END %]
597                     [% IF itemdata_nonpublicnotes %]
598                         <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
599                     [% END %]
600                     [% IF ( hostrecords ) %]
601                         <td>[% IF ( item.hostbiblionumber) %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.hostbiblionumber | uri %]" >[% item.hosttitle | html %]</a>[% END %]</td>
602                     [% END %]
603                     [% IF ( analyze ) %]
604                         <td>
605                             [% IF ( item.countanalytics ) %]
606                                 <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=[% item.itemnumber | uri %]">[% item.countanalytics | html %] analytics</a>
607                             [% END %]
608                         </td>
609                     [% END %]
610                     [% IF ( analyze ) %]
611                         <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% item.biblionumber | uri %]&amp;hostitemnumber=[% item.itemnumber | uri %]">Create analytics</a></td>
612                     [% END %]
613
614                 [% IF ShowCourseReserves %]
615                     <td>
616                         [% IF item.course_reserves %]
617                             [% FOREACH r IN item.course_reserves %]
618                                 [% IF r.course.enabled == 'yes' %]
619                                     <p>
620                                       <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% r.course.course_id | uri %]">
621                                          [% r.course.course_name | html %]
622                                          <!--[% IF r.course.course_number %] [% r.course.course_number | html %] [% END %]-->
623                                          [% IF r.course.section %] [% r.course.section | html %] [% END %]
624                                          [% IF r.course.term %] [% AuthorisedValues.GetByCode( 'TERM', r.course.term ) | html %] [% END %]
625                                       </a>
626                                    </p>
627                                [% END %]
628                            [% END %]
629                        [% END %]
630                     </td>
631                 [% END %]
632
633                 [% IF ( SpineLabelShowPrintOnBibDetails ) %]
634                     <td><a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=[% item.barcode | uri %]"><i class="fa fa-print"></i> Print label</a></td>
635                 [% END %]
636
637                 [% IF CAN_user_editcatalogue_edit_items %]
638                     <td class="actions">
639                         [% IF item.can_be_edited %]
640                             [% IF Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %]
641                                 <div class="btn-group">
642                                     <a  class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
643                                     <ul class="dropdown-menu pull-right">
644                                         <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=[% item.itemnumber | uri %]&amp;filetype=image"><i class="fa fa-upload"></i> Upload image</a></li>
645                                     </ul>
646                                 </div>
647                             [% ELSE %]
648                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
649                             [% END %]
650                         [% END %]
651                         [% IF bundlesEnabled %]
652                             <button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle ([% item.bundled | html %]|[% item.bundled_lost | html %])</button>
653                         [% END %]
654                     </td>
655                 [% END %]
656                 </tr>
657             [% END %]
658         </tbody>
659     </table>
660
661 [% END %][%# end of block items_table %]
662
663 [% IF Koha.Preference('EnableItemGroups') %]
664     <div role="tabpanel" class="tab-pane" id="item_groups">
665         [% IF CAN_user_editcatalogue_manage_item_groups %]
666             <div class="item_groups_table_table_controls">
667                 <a href="#" class="item-group-create btn btn-default btn-xs"><i class="fa fa-plus"></i> New item group</a>
668             </div>
669         [% END %]
670         <table class="items-group-table" id="items-group-table">
671             <thead>
672                 <tr>
673                     <td>Display order</td>
674                     <td>Description</td>
675                     <td>&nbsp;</td>
676                 </tr>
677             </thead>
678         </table>
679     </div>
680 [% END %]
681
682
683 <div role="tabpanel" class="tab-pane" id="holdings">
684
685 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %]
686     <span class="results_summary NovelistSelect" style="display:none;">
687         <span class="label">Novelist Select: </span>
688         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
689     </span>
690 [% END %]
691
692 [% IF ( count ) %]
693     [% IF ( showncount ) %]
694         [% PROCESS items_table tab="holdings" items=itemloop %]
695         [% END %]
696                 [% IF ( hiddencount ) %]
697                    <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&amp;showallitems=1">Show all items ([% hiddencount | html %] hidden)</a>
698                 [% END %]               
699                 [% IF ( debug_display ) %]
700                 <br /><br />
701                 <table>
702                         <tr><td>itemdata_enumchron</td><td>[% itemdata_enumchron | html %]</td></tr>
703                         <tr><td>itemdata_copynumber</td><td>[% itemdata_copynumber | html %]</td></tr>
704                         <tr><td>serial</td><td>[% serial | html %]</td></tr>
705                 </table>
706                 [% END %]
707 [% ELSE %]
708     [% IF ( ALTERNATEHOLDINGS ) %]
709     [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %]
710         <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding | html %]</div>
711     [% END %]
712     [% ELSE %]
713     <div id="noitems">No physical items for this record</div>
714     [% END %]
715 [% END %]
716
717 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'below' ) %]
718     <span class="results_summary NovelistSelect" style="display:none;">
719         <span class="label">Novelist Select: </span>
720         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
721     </span>
722 [% END %]
723     </div>
724
725 [% IF (SeparateHoldings) %]
726     <div role="tabpanel" class="tab-pane" id="otherholdings">
727         [% IF (otheritemloop.size) %]
728             [% PROCESS items_table tab="otherholdings" items=otheritemloop %]
729         [% ELSE %]
730             <span class="nootheritems">No other items.</span>
731         [% END %]
732     </div>
733 [% END %]
734
735 [% IF ( MARCNOTES ) %]
736
737 <div role="tabpanel" class="tab-pane" id="description">
738 <div class="content_set">
739
740     [% FOREACH MARCNOTE IN MARCNOTES %]
741         <p>
742         [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
743             <a href="[% MARCNOTE.marcnote | url %]">[% MARCNOTE.marcnote | html %]</a>
744         [% ELSE %]
745             [% MARCNOTE.marcnote | html | html_line_break %]
746         [% END %]
747         </p>
748 [% END %]
749 </div>
750 </div>
751
752 [% END %]
753
754 [% IF ComponentParts && ComponentParts.size %]
755 <div role="tabpanel" class="tab-pane" id="components">
756     <div class="content_set">
757         <table>
758             [% FOR PART IN ComponentParts %]
759             <tr>
760                 <td>
761                     [% PART | $raw %]
762                 </td>
763             </tr>
764             [% END %]
765         </table>
766         [% IF ComponentParts.size == Koha.Preference('MaxComponentRecords')%]
767         <p>Only [% ComponentParts.size | html %] results are shown: <a href="/cgi-bin/koha/catalogue/search.pl?q=[% ComponentPartsQuery | url %]"/>show all component parts</a></p>
768         [% END %]
769     </div> <!-- /.content_set -->
770 </div> <!-- /#components -->
771
772 [% END %]
773
774 [% IF ( subscriptionsnumber ) %]
775 <div role="tabpanel" class="tab-pane" id="subscriptions">
776 <div id="catalogue_detail_subscriptions">
777     <h2>This is a serial subscription</h2>
778     <p> (There are [% subscriptionsnumber | html %] subscriptions associated with this title).</p> 
779     [% FOREACH subscription IN subscriptions %]
780             [% IF subscription.branchcode %]
781                 <h3>At library: [% Branches.GetName(subscription.branchcode) || subscription.branchcode | html %]</h3>
782             [% END %]
783             [% IF ( subscription.closed ) %]<p>This subscription is closed.</p>[% END %]
784             [% IF ( subscription.location ) %]<p class="subscription_location">Location: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => subscription.location ) | html %]</p>[% END %]
785             [% IF ( subscription.callnumber ) %]<p>Callnumber: [% subscription.callnumber | html %] </p>[% END %]
786             [% IF ( subscription.subscriptionnotes ) %]<p>[% subscription.subscriptionnotes | html | html_line_break %] </p>[% END %]
787             [% IF ( subscription.missinglist ) %]<p>Missing issues: [% subscription.missinglist | html %] </p>[% END %]
788             [% IF ( subscription.librariannote ) %]<p>([% subscription.librariannote | html %])</p>[% END %]
789             [% IF ( subscription.latestserials ) %]
790             <p> The [% subscription.staffdisplaycount | html %] latest issues related to this subscription:</p>
791             <table>
792                 <tr>
793                     <th>Issue #</th>
794                     <th>Date arrived</th>
795                     <th>Date published</th>
796                     <th>Date published (text)</th>
797                     <th>Status</th>
798                     <th>Note</th>
799                 </tr>
800             [% FOREACH latestserial IN subscription.latestserials %]
801                 <tr>
802                     <td>[% latestserial.serialseq | html %]</td>
803                     <td data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td>
804                     <td data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td>
805                     <td>[% latestserial.publisheddatetext | html %]</td>
806                     <td>
807                         [% INCLUDE 'serial-status.inc' serial = latestserial %]
808                     </td>
809                     <td>[% latestserial.notes | html %]</td>
810                 </tr>
811             [% END %]
812             </table>
813             [% END %]
814             [% IF ( CAN_user_serials ) %]
815                 <p>
816                     <a class="btn btn-link" href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa fa-list" aria-hidden="true"></i> Subscription details</a>
817                 </p>
818             [% END %]
819     [% END %]
820 </div>
821 </div>
822 [% END %]
823
824 [% IF Koha.Preference('AcquisitionDetails') %]
825 <div role="tabpanel" class="tab-pane" id="acq_details">
826   [% IF orders.count %]
827     <table id="orders">
828       <thead>
829         <tr>
830           <th>Vendor</th>
831           <th>Invoice</th>
832           <th>Basket group</th>
833           <th>Basket</th>
834           <th>Order number</th>
835           <th>Creation date</th>
836           <th>Receive date</th>
837           <th>Status</th>
838           <th>Quantity</th>
839           <th title="Estimated cost tax incl. while pending, actual cost tax incl. once received">Price</th>
840           <th>Internal note</th>
841           <th>Subscription</th>
842           <th>Subscription call number</th>
843         </tr>
844       </thead>
845       <tbody>
846       [% FOR order IN orders %]
847         [% SET basket = order.basket %]
848         [% SET vendor = basket.bookseller %]
849           <tr>
850             <td>
851                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]" title="Vendor detail page">[% vendor.name | html %]</a>
852             </td>
853             <td>
854             [% IF order.invoiceid %]
855                 [% IF CAN_user_acquisition %]
856                     <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]"
857                        title="Invoice detail page">
858                        [% order.invoice.invoicenumber | html %]</a>
859                 [% ELSE %]
860                     [% order.invoice.invoicenumber | html %]
861                 [% END %]
862             [% END %]
863             </td>
864             <td>
865             [% IF basket.basketgroupid %]
866                 [% SET basket_group = basket.basket_group %]
867                 [% IF CAN_user_acquisition_group_manage %]
868                     <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% vendor.id | uri %]&basketgroupid=[% basket_group.id | uri %]">[% basket_group.name | html%] ([% basket_group.id | html %])</a>
869                 [% ELSE %]
870                     [% basket_group.name | html %] ([% basket_group.id | html %])
871                 [% END %]
872             [% END %]
873             </td>
874             <td>[% IF CAN_user_acquisition_order_manage %]
875                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">[% basket.basketname | html %] ([% basket.basketno | html %])</a>
876             [% ELSE %]
877                 [% basket.basketname | html %] ([% basket.basketno | html %])
878             [% END %]</td>
879             <td>[% order.ordernumber | html %]</td>
880             <td data-order="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</td>
881             <td data-order="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</td>
882             <td>
883               [% SWITCH order.orderstatus %]
884                 [% CASE 'new' %]<span>New</span>
885                 [% CASE 'ordered' %]<span>Ordered</span>
886                 [% CASE 'partial' %]<span>Partial</span>
887                 [% CASE 'complete' %]<span>Complete</span>
888                 [% CASE 'cancelled' %]<span>Cancelled</span>
889               [% END %]
890             </td>
891             <td>[% order.quantity | html %]</td>
892             <td>[% IF ( order.unitprice_tax_included > 0 ) %][% order.unitprice_tax_included | $Price %][% ELSE %][% order.ecost_tax_included | $Price %][% END %]
893             <td>[% order.order_internalnote | html %]</td>
894             <td>
895                 [% IF order.subscriptionid %]
896                     <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% order.subscriptionid | uri %]">[% order.subscriptionid | html %]</a>
897                 [% END %]
898             </td>
899             <td>
900                 [% IF order.subscriptionid %]
901                     [% order.subscription.callnumber | html %]
902                 [% END %]
903             </td>
904           </tr>
905       [% END %]
906       </tbody>
907     </table>
908   [% ELSE %]
909     <span class="noorder">There is no order for this bibliographic record.</span>
910   [% END %]
911 </div>
912 [% END %]
913
914 [% IF suggestions.count %]
915     <div role="tabpanel" class="tab-pane" id="suggestion_details">
916         [% IF nb_archived_suggestions > 0 %]
917             <p>[% tnpx('pluralization', 'There is one archived suggestion.', 'There are {count} archived suggestions.', nb_archived_suggestions, { count = nb_archived_suggestions }) | $raw  %]
918         [% END %]
919         <table id="suggestions" class="sorted">
920             <thead>
921                 <tr>
922                     <th class="NoSort">&nbsp;</th>
923                     <th class="anti-the">Suggestion</th>
924                     <th>Suggested by - on</th>
925                     <th>Managed by - on</th>
926                     <th>Last modification by - on</th>
927                     <th>Library</th>
928                     <th>Fund</th>
929                     <th>Status</th>
930                 </tr>
931             </thead>
932             <tbody>
933             [% FOREACH suggestion IN suggestions %]
934                 <tr>
935                     <td>[% suggestion.suggestionid | html %]</td>
936                     <td>
937                         <a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show" title="suggestion" >
938                             [% suggestion.title | html %][% IF ( suggestion.author ) %], by [% suggestion.author | html %][% END %]</a>
939                         <br />
940                         [% IF ( suggestion.copyrightdate ) %]&copy; [% suggestion.copyrightdate | html %] [% END %]
941                         [% IF ( suggestion.volumedesc ) %]; Volume:<em>[% suggestion.volumedesc | html %]</em> [% END %]
942                         [% IF ( suggestion.isbn ) %]; ISBN:<em>[% suggestion.isbn | html %]</em> [% END %][% IF ( suggestion.publishercode ) %]; Published by [% suggestion.publishercode | html %] [% END %][% IF ( suggestion.publicationyear ) %] in <em>[% suggestion.publicationyear | html %]</em> [% END %][% IF ( suggestion.place ) %] in <em>[% suggestion.place | html %]</em> [% END %][% IF ( suggestion.collectiontitle ) %]; [% suggestion.collectiontitle | html %] [% END %][% IF ( suggestion.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestion.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestion.note ) %]<div class="suggestion_note"><i class="fa fa-comment"></i> [% suggestion.note | html %]</div>[% END %]
943                     </td>
944                     <td>
945                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggestedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.suggester %]</a>
946                         [% IF suggestion.suggesteddate %] - [% suggestion.suggesteddate | $KohaDates %][% END %]
947                     </td>
948                     <td>
949                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.managedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.manager %]</a>
950                         [% IF suggestion.manageddate %] - [% suggestion.manageddate | $KohaDates %][% END %]
951                     </td>
952                     <td>
953                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.lastmodificationby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.last_modifier %]</a>
954                         [% IF suggestion.lastmodificationdate %] - [% suggestion.lastmodificationdate | $KohaDates %][% END %]
955                     </td>
956                     <td>
957                         [% Branches.GetName( suggestion.branchcode ) | html %]
958                     </td>
959                     <td>
960                         [% suggestion.fund.budget_name | html %]
961                     </td>
962                     <td>
963                         [% IF    suggestion.STATUS == 'ASKED'     %]<span>Pending</span>
964                         [% ELSIF suggestion.STATUS == 'ACCEPTED'  %]<span>Accepted</span>
965                         [% ELSIF suggestion.STATUS == 'ORDERED'   %]<span>Ordered</span>
966                         [% ELSIF suggestion.STATUS == 'REJECTED'  %]<span>Rejected</span>
967                         [% ELSIF suggestion.STATUS == 'CHECKED'   %]<span>Checked</span>
968                         [% ELSIF suggestion.STATUS == 'AVAILABLE' %]<span>Available</span>
969                         [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) %]
970                             [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) | html %]
971                         [% ELSE %]<span>Status unknown</span>
972                         [% END %]
973                         [% IF suggestion.reason %]
974                             <br />([% suggestion.reason | html %])
975                         [% END %]
976                     </td>
977                 </tr>
978                 [% END %]
979             </tbody>
980         </table>
981     </div>
982 [% END %]
983
984 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
985 <div role="tabpanel" class="tab-pane" id="editions"><h4>Editions</h4>
986 <table>
987 [% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn | html %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
988 [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]<td>[% IF ( noItemTypeImages ) %]<span class="itypetext">[% XISBN.description | html %]</span>[% ELSE %]<img src="[% XISBN.imageurl | html %]" alt="[% XISBN.description | html %]" title="[% XISBN.description | html %]">[% END %]</td>[% END %]
989 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber | uri %]">[% XISBN.title | html %]</a> <span>by</span> [% XISBN.author | html %] &copy;[% XISBN.copyrightdate | html %]
990   [% IF ( XISBN.publishercode ) %]
991 [% XISBN.publishercode | html %] [% IF ( XISBN.place ) %]([% XISBN.place | html %])[% END %] [% IF ( XISBN.publicationyear ) %], [% XISBN.publicationyear | html %][% END %] [% IF ( XISBN.editionstatement ) %][% XISBN.editionstatement | html %][% END %] [% IF ( XISBN.editionresponsibility ) %][% XISBN.editionresponsibility | html %][% END %]
992     [% END %]
993                 [% IF ( XISBN.pages ) %] [% END %][% XISBN.pages | html %] [% IF ( XISBN.illus ) %][% XISBN.illus | html %][% END %]
994                 [% IF ( XISBN.size ) %], [% END %][% XISBN.size | html %]
995 </td>
996
997 [% END %]
998 </table></div>[% END %]
999 [% END %]
1000
1001 [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1002 <div role="tabpanel" class="tab-pane" id="concerns">
1003     <fieldset class="action" style="cursor:pointer;">
1004         <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a>
1005         | <a id="showAll"><i class="fa fa-bars"></i> Show all</a>
1006     </fieldset>
1007
1008     <table id="table_concerns" width="100%">
1009         <thead>
1010             <tr>
1011                 <th>Reported</th>
1012                 <th>Details</th>
1013                 <th>Status</th>
1014                 <th data-class-name="actions noExport">Actions</th>
1015             </tr>
1016         </thead>
1017     </table>
1018 </div>
1019 [% END %]
1020
1021 [% IF ( LocalCoverImages ) %]
1022     <div role="tabpanel" class="tab-pane" id="images">
1023         [% IF localimages.count %]
1024             <p>Click on an image to view it in the image viewer</p>
1025             <ul class="thumbnails">
1026                 [% FOREACH image IN localimages %]
1027                     [% IF image %]
1028                         <li id="imagenumber-[% image.imagenumber | html %]" class="thumbnail">
1029                             <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
1030                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" />
1031                             </a>
1032                             [% IF CAN_user_tools_upload_local_cover_images %]
1033                                 <a href="#" class="remove"><i class="fa fa-trash-can"></i> Delete image</a>
1034                             [% END %]
1035                         </li>
1036                     [% END %]
1037                 [% END %]
1038             </ul>
1039         [% ELSE # - No image passed JavaScript takes care %]
1040             <span class="noimagesuploaded">No images have been uploaded for this bibliographic record yet.</span>
1041         [% END %]
1042         [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1043             <p>Upload an image file: <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber | uri %]&amp;filetype=image"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
1044             </p>
1045         [% END %]
1046     </div>
1047 [% END %]
1048
1049 [% IF ( HTML5MediaEnabled ) %]
1050 <div role="tabpanel" class="tab-pane" id="html5media">
1051           [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
1052             <p>
1053                 [% IF HTML5MediaSet.is_youtube %]
1054                     <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
1055                 [% ELSE %]
1056                   <[% HTML5MediaParent | html %] controls preload=none>
1057                     <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] />
1058                     [[% HTML5MediaParent | html %] tag not supported by your browser.]
1059                   </[% HTML5MediaParent | html %]>
1060                 [% END %]
1061             </p>
1062           [% END %]
1063 </div>
1064 [% END %]
1065
1066
1067 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
1068     <div role="tabpanel" class="tab-pane" id="NovelistSelect" class="novelistSelect">
1069         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
1070     </div>
1071 [% END %]
1072
1073 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
1074     <div role="tabpanel" class="tab-pane" id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
1075         [% plugins_intranet_catalog_biblio_tab.content | $raw %]
1076     </div>
1077 [% END %]
1078
1079 </div><!-- /tab-content -->
1080 </div><!-- /bibliodetails -->
1081
1082 <div id="export" style="margin-top: 1em;">
1083 <form method="get" action="/cgi-bin/koha/catalogue/export.pl">
1084 <table>  <tr>
1085       <th>Save record</th>   </tr>
1086     <tr><td> Select download format:    <select name="format">
1087         <option value="mods">MODS (XML)</option>
1088         <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
1089         <option value="marcxml">MARCXML</option>
1090         <option value="marc8">MARC (non-Unicode/MARC-8)</option>
1091         <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
1092         <input type="submit" name="save" class="btn btn-primary" value="Download record" /></td>
1093   </tr>
1094   <tr><td>
1095     <input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="[% biblionumber | html %]" />
1096   </td></tr>
1097 </table>
1098 </form>
1099 </div>
1100
1101 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
1102     <div class="modal-dialog modal-lg">
1103     <div class="modal-content">
1104     <div class="modal-header">
1105         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1106         <h3 id="marcPreviewLabel">MARC preview</h3>
1107     </div>
1108     <div class="modal-body">
1109         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
1110     </div>
1111     <div class="modal-footer">
1112         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1113     </div>
1114     </div>
1115     </div>
1116 </div>
1117
1118 <div id="elasticPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="elasticPreviewLabel" aria-hidden="true">
1119     <div class="modal-dialog modal-lg">
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="elasticPreviewLabel">Elasticsearch record</h3>
1124     </div>
1125     <div class="modal-body">
1126         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
1127     </div>
1128     <div class="modal-footer">
1129         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1130     </div>
1131     </div>
1132     </div>
1133 </div>
1134
1135             </main>
1136         </div> <!-- /.col-sm-10.col-sm-push-2 -->
1137
1138         <div class="col-sm-2 col-sm-pull-10">
1139             <aside>
1140                 [% INCLUDE 'biblio-view-menu.inc' %]
1141             </aside>
1142         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1143      </div> <!-- /.row -->
1144
1145 [% END %]
1146
1147 <div class="modal fade" id="modal-item-group-create" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-create-label">
1148     <div class="modal-dialog">
1149         <div class="modal-content">
1150             <div class="modal-header">
1151                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1152                 <h3 id="modal-item-group-create-label"><i class="fa fa-plus"></i> Create a new item group</h3>
1153             </div>
1154             <form id="modal-item-group-create-form" class="validated">
1155                 <div class="modal-body">
1156                     <fieldset>
1157                         <p>
1158                             <label for="item_group_description" class="required">Name: </label>
1159                             <input name="description" id="modal-item-group-create-form-description" type="text" size="30" required="required" class="required" />
1160                             <span class="required">Required</span>
1161                         </p>
1162                         <p>
1163                             <label for="item_group_display_order" class="required">Display order: </label>
1164                             <input name="display_order" id="modal-item-group-create-form-display_order" value="0" size="5" required="required" class="required" />
1165                             <span class="required">Required</span>
1166                             <br/>
1167                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
1168                         </p>
1169                     </fieldset>
1170                 </div>
1171                 <div class="modal-footer">
1172                     <button id="modal-item-group-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button>
1173                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1174                 </div>
1175             </form>
1176         </div>
1177     </div>
1178 </div>
1179
1180 <div class="modal fade" id="modal-item-group-edit" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-edit-label">
1181     <div class="modal-dialog">
1182         <div class="modal-content">
1183             <div class="modal-header">
1184                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1185                 <h3 id="modal-item-group-edit-label"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit item group</h3>
1186             </div>
1187             <form id="modal-item-group-edit-form" class="validated">
1188                 <div class="modal-body">
1189                     <fieldset>
1190                         <p>
1191                             <label for="item_group_description" class="required">Name: </label>
1192                             <input name="description" id="modal-item-group-edit-form-description" type="text" size="30" required="required" class="required" />
1193                             <span class="required">Required</span>
1194                         </p>
1195                         <p>
1196                             <label for="item_group_display_order" class="required">Sort order: </label>
1197                             <input name="display_order" id="modal-item-group-edit-form-display_order" size="5" />
1198                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
1199                         </p>
1200                     </fieldset>
1201                 </div>
1202                 <div class="modal-footer">
1203                     <button id="modal-item-group-edit-submit" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Submit</button>
1204                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1205                 </div>
1206             </form>
1207         </div>
1208     </div>
1209 </div>
1210
1211 <div class="modal fade" id="modal-item-group-delete" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-delete-label">
1212     <div class="modal-dialog">
1213         <div class="modal-content">
1214             <div class="modal-header">
1215                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1216                 <h3 id="modal-item-group-delete-label"><i class='fa fa-trash-can'></i> Delete item group</h3>
1217             </div>
1218             <div class="modal-body">
1219                 Are you sure you want to delete this item group?
1220             </div>
1221             <div class="modal-footer">
1222                 <button id="modal-item-group-delete-submit" class="btn btn-danger"><i class='fa fa-trash-can'></i> Delete</button>
1223                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1224             </div>
1225         </div>
1226     </div>
1227 </div>
1228
1229 <div class="modal fade" id="modal-item-group-set" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-set-label">
1230     <div class="modal-dialog">
1231         <div class="modal-content">
1232             <div class="modal-header">
1233                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1234                 <h3 id="modal-item-group-set-label"><i class='fa fa-book'></i> Set item group for items</h3>
1235             </div>
1236             <form id="modal-item-group-set-form" class="validated">
1237                 <div class="modal-body">
1238                     <fieldset>
1239                         <p>
1240                             <label for="item_group" class="required">Item group: </label>
1241                             <select name="item_group" id="item-group-add-form-select">
1242                                 [% FOREACH ig IN biblio.item_groups %]
1243                                     <option value="[% ig.id | html %]">[% ig.description | html %]</option>
1244                                 [% END %]
1245                             </select>
1246                             <span class="required">Required</span>
1247                         </p>
1248                     </fieldset>
1249                 </div>
1250                 <div class="modal-footer">
1251                     <button id="modal-item-group-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set item group</button>
1252                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1253                 </div>
1254             </form>
1255         </div>
1256     </div>
1257 </div>
1258
1259 <div class="modal fade" id="modal-item-group-unset" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-unset-label">
1260     <div class="modal-dialog">
1261         <div class="modal-content">
1262             <div class="modal-header">
1263                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1264                 <h3 id="modal-item-group-unset-label"><i class='fa fa-unlink'></i> Remove item from item group</h3>
1265             </div>
1266             <div class="modal-body">
1267                 Are you sure you want to remove these item(s) from their item group(s)?
1268             </div>
1269             <div class="modal-footer">
1270                 <button id="modal-item-group-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
1271                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1272             </div>
1273         </div>
1274     </div>
1275 </div>
1276
1277     [% IF bundlesEnabled %]
1278     <div class="modal" id="addToBundleModal" tabindex="-1" role="dialog" aria-labelledby="addToBundleLabel">
1279         <form id="addToBundleForm" action="">
1280             <div class="modal-dialog" role="document">
1281                 <div class="modal-content">
1282                     <div class="modal-header">
1283                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1284                         <h3 id="addToBundleLabel">Add to bundle</h3>
1285                     </div>
1286                     <div class="modal-body">
1287                         <div id="addResult"></div>
1288                         <fieldset class="rows">
1289                             <ol>
1290                                 <li>
1291                                     <label class="required" for="external_id">Item barcode: </label>
1292                                     <input type="text" id="external_id" name="external_id" required="required">
1293                                     <span class="required">Required</span>
1294                                 </li>
1295                             </ol>
1296                         </fieldset>
1297                     </div>
1298                     <div class="modal-footer">
1299                         <button type="submit" class="btn btn-default">Submit</button>
1300                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1301                     </div>
1302                 </div>
1303             </div>
1304         </form>
1305     </div>
1306
1307     <div class="modal" id="removeFromBundleModal" tabindex="-1" role="dialog" aria-labelledby="removeFromBundleLabel">
1308         <form id="removeFromBundleForm" action="">
1309             <div class="modal-dialog" role="document">
1310                 <div class="modal-content">
1311                     <div class="modal-header">
1312                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1313                         <h3 id="removeFromBundleLabel">Remove from bundle</h3>
1314                     </div>
1315                     <div class="modal-body">
1316                         <div id="removeResult"></div>
1317                         <fieldset class="rows">
1318                             <ol>
1319                                 <li>
1320                                     <label class="required" for="external_id">Item barcode: </label>
1321                                     <input type="text" id="rm_external_id" name="external_id" required="required">
1322                                     <span class="required">Required</span>
1323                                 </li>
1324                             </ol>
1325                         </fieldset>
1326                     </div>
1327                     <div class="modal-footer">
1328                         <button type="submit" class="btn btn-default">Submit</button>
1329                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1330                     </div>
1331                 </div>
1332             </div>
1333         </form>
1334     </div>
1335     [% END %]
1336
1337     [% IF ( Koha.Preference('CatalogConcerns') ) %]
1338     [% INCLUDE 'modals/add_catalog_concern.inc' %]
1339     [% END %]
1340
1341     [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1342     [% INCLUDE 'modals/display_ticket.inc' %]
1343     [% END %]
1344
1345 [% MACRO jsinclude BLOCK %]
1346     [% INCLUDE 'catalog-strings.inc' %]
1347     [% Asset.js("js/catalog.js") | $raw %]
1348     [% Asset.js("js/recalls.js") | $raw %]
1349     [% Asset.js("js/coce.js") | $raw %]
1350     [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1351     [% IF ( Koha.Preference('CatalogConcerns') ) %]
1352         <script>
1353             /* Set a variable needed by add_catalog_concern.js */
1354             var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1355         </script>
1356         [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1357      [% END %]
1358      [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1359          <script>
1360             $(document).ready(function() {
1361                 var table_settings = [% TablesSettings.GetTableSettings( 'cataloguing', 'concerns', 'table_concerns', 'json' ) | $raw %];
1362
1363                 var filtered = false;
1364                 let additional_filters = {
1365                     resolved_date: function(){
1366                         if ( filtered ) {
1367                             return { "=": null };
1368                         } else {
1369                             return;
1370                         }
1371                     },
1372                     biblio_id: [% biblionumber | uri %]
1373                 };
1374
1375                 var tickets_url = '/api/v1/tickets';
1376                 var tickets = $("#table_concerns").kohaTable({
1377                     "ajax": {
1378                         "url": tickets_url
1379                     },
1380                     "embed": [
1381                         "reporter",
1382                         "resolver",
1383                         "updates+count",
1384                     ],
1385                     'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
1386                     "columnDefs": [ {
1387                         "targets": [0,1,2],
1388                         "render": function (data, type, row, meta) {
1389                             if ( type == 'display' ) {
1390                                 if ( data != null ) {
1391                                     return data.escapeHtml();
1392                                 }
1393                                 else {
1394                                     return "";
1395                                 }
1396                             }
1397                             return data;
1398                         }
1399                     } ],
1400                     "columns": [
1401                         {
1402                             "data": "reported_date:reporter.firstname",
1403                             "render": function(data, type, row, meta) {
1404                                 let reported = '<span class="date clearfix">' + $datetime(row.reported_date) + '</span>';
1405                                 reported += '<span class="reporter clearfix">' + $patron_to_html(row.reporter, {
1406                                     display_cardnumber: false,
1407                                     url: true
1408                                 }) + '</span>';
1409                                 return reported;
1410                             },
1411                             "searchable": true,
1412                             "orderable": true
1413                         },
1414                         {
1415                             "data": "title:body",
1416                             "render": function(data, type, row, meta) {
1417                                 let resolved = ( row.resolved_date ) ? true : false;
1418                                 let result = '<a role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="' + resolved + '">' + row.title + '</a>';
1419                                 if (row.updates_count) {
1420                                     result += '<span class="pull-right"><a role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '"><i class="fa fa-comment" aria-hidden="true"></i> ' + row.updates_count + '</a></span>';
1421                                 }
1422                                 result += '<div id="detail_' + row.ticket_id + '" class="hidden">' + row.body + '</div>';
1423                                 return result;
1424                             },
1425                             "searchable": true,
1426                             "orderable": true
1427                         },
1428                         {
1429                             "data": "resolved_date",
1430                             "render": function(data, type, row, meta) {
1431                                 let result = '';
1432                                 if (row.resolved_date) {
1433                                     result += _("Resolved by:") + ' <span>' + $patron_to_html(row.resolver, {
1434                                         display_cardnumber: false,
1435                                         url: true
1436                                     }) + '</span>';
1437                                     result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
1438                                 } else {
1439                                     result += _("Open");
1440                                 }
1441                                 return result;
1442                             },
1443                             "searchable": true,
1444                             "orderable": true
1445                         },
1446                         {
1447                             "data": function(row, type, val, meta) {
1448                                 let resolved = ( row.resolved_date ) ? true : false;
1449                                 let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="' + resolved + '"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>';
1450                                 return result;
1451                             },
1452                             "searchable": false,
1453                             "orderable": false
1454                         },
1455                     ]
1456                 }, table_settings, 0, additional_filters);
1457
1458                 $('#hideResolved').on("click", function() {
1459                     filtered = true;
1460                     tickets.DataTable().draw();
1461                 });
1462
1463                 $('#showAll').on("click", function() {
1464                     filtered = false;
1465                     tickets.DataTable().draw();
1466                 });
1467             });
1468         </script>
1469         [% Asset.js("js/modals/display_ticket.js") | $raw %]
1470     [% END %]
1471     <script>
1472         var interface = "[% interface | html %]";
1473         var theme = "[% theme | html %]";
1474         // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
1475         function verify_cover_images() {
1476             // Loop over each container in the template which contains covers
1477             $(".cover-slider").each(function(){
1478                 var lightbox_descriptions = [];
1479                 var first_shown = 0;
1480                 $(this).find(".cover-image").each( function( index ){
1481                 var div = $(this);
1482                 // Find the image in the container
1483                 var img = div.find("img")[0];
1484                 if( $(img).length > 0 ){
1485                     var description = "";
1486                         // All slides start hidden. If this is the first one, show it.
1487                         if( first_shown == 0 ){
1488                             div.show();
1489                             first_shown = 1;
1490                         }
1491                         // Check if Amazon image is present
1492                         if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1493                             w = img.width;
1494                             h = img.height;
1495                             if ((w == 1) || (h == 1)) {
1496                                 // Amazon returned single-pixel placeholder
1497                                 // Remove the container
1498                                 div.remove();
1499                             } else {
1500                                 lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1501                             }
1502                         } else if( div.attr("id") == "custom-coverimg" ){
1503                             if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1504                                 // No image was loaded via the CustomCoverImages system preference
1505                                 // Remove the container
1506                                 div.remove();
1507                             } else {
1508                                 lightbox_descriptions.push("Custom cover image");
1509                             }
1510                         } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1511                                 lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1512                         }
1513                         else if( div.hasClass("coce-coverimg" ) ){
1514                             // Identify which service's image is being loaded by Coce
1515                             var coce_description;
1516                             if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1517                                 coce_description = ("Coce image from Amazon.com");
1518                             } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1519                                 coce_description = _("Coce image from Google Books");
1520                             } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1521                                 coce_description = _("Coce image from Open Library");
1522                             }
1523                             div.find(".hint").html(coce_description);
1524                             lightbox_descriptions.push(coce_description);
1525                         } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1526                             lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1527                         } else {
1528                             lightbox_descriptions.push(_("Cover image source unknown"));
1529                         }
1530                     }
1531                 });
1532
1533                 // Lightbox for cover images
1534                 Chocolat(this.querySelectorAll('.cover-image a'), {
1535                     description: function(){
1536                         return lightbox_descriptions[this.settings.currentImageIndex];
1537                     }
1538                 });
1539
1540             });
1541
1542             $(".cover-slider").each(function(){
1543                 var coverSlide = this;
1544                 var coverImages = $(this).find(".cover-image");
1545                 if( coverImages.length > 1 ){
1546                     coverImages.each(function( index ){
1547                         // If more that one image is present, add a navigation link
1548                         // for activating the slide
1549                         var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>");
1550                         if( index == 0 ){
1551                             // Set the first navigation link as active
1552                             $(covernav).addClass("nav-active");
1553                         }
1554                         $(covernav).html("<i class=\"fa fa-circle\"></i>");
1555                         $(coverSlide).append( covernav );
1556                     });
1557                 }
1558
1559                 if( $(coverSlide).attr('id') == 'biblio-cover-slider' // Hide if not visible, but only for the biblio images. Images for items are only local cover images
1560                     && $(coverSlide).find(".cover-image:visible").length < 1 ){
1561                     $(coverSlide).remove();
1562                 } else {
1563                     $(coverSlide).addClass("cover-slides");
1564                     var img = $(coverSlide).find(".cover-image:visible").find("img")[0];
1565                     if( $(img).length > 0 && img.complete && img.naturalHeight > 0 ){
1566                         $(".cover-slides").css({"background-image":"none"});
1567                     }
1568                 }
1569             });
1570
1571             $("#editions img").each(function(i){
1572                 if ( this.src.indexOf('amazon.com') >= 0 ) {
1573                     w = this.width;
1574                     h = this.height;
1575                     if ((w == 1) || (h == 1)) {
1576                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1577                     } else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) {
1578                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1579                     }
1580                 }
1581             });
1582         }
1583
1584         function removeLocalImage(imagenumber) {
1585             var thumbnail = $("#imagenumber-" + imagenumber );
1586             var copy = thumbnail.html();
1587             thumbnail.find("img").css("opacity", ".2");
1588             thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1589             $.ajax({
1590                 url: "/cgi-bin/koha/svc/cover_images?action=delete&imagenumber=" + imagenumber,
1591                 success: function(data) {
1592                     $(data).each( function(i) {
1593                         if ( this.deleted == 1 ) {
1594                             thumbnail.remove();
1595                         } else {
1596                             thumbnail.html( copy );
1597                             alert(_("An error occurred on deleting this image"));
1598                         }
1599                         if ( $('ul.thumbnails > li').length == 0 ) {
1600                             showNoImageMessage();
1601                         }
1602                     });
1603                 },
1604                 error: function(data) {
1605                     thumbnail.html( copy );
1606                     alert(_("An error occurred on deleting this image"));
1607                 }
1608             });
1609         }
1610
1611         function showNoImageMessage() {
1612             var no_images_msg = _("No images have been uploaded for this bibliographic record yet.");
1613             no_images_msg = '<p>' + no_images_msg + '</p>';
1614             [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1615                 var please_upload = _("Upload an image file: %sUpload%s").format("<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=" + biblionumber + "&amp;filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ","</a>");
1616                 no_images_msg += "<p id='upload_image'>" + please_upload + '</p>';
1617             [% END %]
1618             $('#images').html(no_images_msg);
1619         }
1620
1621         [% IF StaffDetailItemSelection %]
1622             function itemSelectionBuildDeleteLink(div) {
1623                 var itemnumbers = new Array();
1624                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1625                     itemnumbers.push($(this).val());
1626                 });
1627                 if (itemnumbers.length > 0) {
1628                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1';
1629                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1630                     url += '&biblionumber=[% biblionumber | uri %]';
1631                     url += '&src=CATALOGUING';
1632                     $('a.itemselection_action_delete').attr('href', url);
1633                 } else {
1634                     return false;
1635                 }
1636                 return true
1637             }
1638
1639             function itemSelectionBuildModifyLink(div) {
1640                 var itemnumbers = new Array();
1641                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1642                     itemnumbers.push($(this).val());
1643                 });
1644                 if (itemnumbers.length > 0) {
1645                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show';
1646                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1647                     url += '&biblionumber=[% biblionumber | uri %]';
1648                     url += '&src=CATALOGUING';
1649                     $('a.itemselection_action_modify').attr('href', url);
1650                 } else {
1651                     return false;
1652                 }
1653                 return true;
1654             }
1655
1656             function itemSelectionBuildActionLinks(tab) {
1657                 var div = $("#" + tab);
1658                 var delete_link_ok = itemSelectionBuildDeleteLink(div);
1659                 var modify_link_ok = itemSelectionBuildModifyLink(div);
1660                 if (modify_link_ok || delete_link_ok) {
1661                     $('.itemselection_actions', div).show();
1662                 } else {
1663                     $('.itemselection_actions', div).hide();
1664                 }
1665             }
1666
1667             $(document).ready(function() {
1668                 $('table.items_table').each(function() {
1669                     var div = $(this).parent().attr("id");
1670                     itemSelectionBuildActionLinks(div);
1671                 });
1672
1673                 $("input[name='itemnumber'][type='checkbox']").change(function() {
1674                     var div = $(this).parents('table').parent().parent().attr("id");
1675                     itemSelectionBuildActionLinks(div);
1676                 });
1677
1678                 $(".SelectAll").on("click",function(e){
1679                     e.preventDefault();
1680                     var tab = $(this).data("tab");
1681                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true);
1682                     itemSelectionBuildActionLinks(tab);
1683                 });
1684
1685                 $(".ClearAll").on("click",function(e){
1686                     e.preventDefault();
1687                     var tab = $(this).data("tab");
1688                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
1689                     itemSelectionBuildActionLinks(tab);
1690                 });
1691             });
1692         [% END %]
1693
1694         $(document).ready(function() {
1695             // Pick details tab to display by default
1696             [% IF count == 0 %]
1697                 [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1698                     $(".nav-tabs a[href='#html5media']").tab("show");
1699                 [% ELSIF ComponentParts && ComponentParts.size %]
1700                     $(".nav-tabs a[href='#components']").tab("show");
1701                 [% ELSE %]
1702                     $(".nav-tabs a[href='#holdings']").tab("show");
1703                 [% END %]
1704             [% ELSE %]
1705                 $(".nav-tabs a[href='#holdings']").tab("show");
1706             [% END %]
1707             $('#search-form').focus();
1708             $('.thumbnails > li > .remove').click(function() {
1709                 var result = confirm(_("Are you sure you want to delete this cover image?"));
1710
1711                 if ( result == true ) {
1712                     var imagenumber = $(this).parent().attr('id').split('-')[1];
1713                     removeLocalImage(imagenumber);
1714                 }
1715
1716                 return false;
1717             });
1718             [% IF ( IntranetCoce && CoceProviders ) %]
1719                 KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
1720             [% END %]
1721
1722             $("body").on("click",".previewMARC", function(e){
1723                 e.preventDefault();
1724                 var page = $(this).attr("href");
1725                 $("#marcPreview .modal-body").load(page + " table");
1726                 $('#marcPreview').modal({show:true});
1727
1728             });
1729
1730            [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
1731             $("body").on("click",".previewElastic", function(e){
1732                 e.preventDefault();
1733                 var pageElastic = $(this).attr("href");
1734                 $("#elasticPreview .modal-body").load(pageElastic, function( response, status, xhr ) {
1735                     if( status == 'error' ){
1736                         $("#elasticPreview .modal-body").html("<h1>"+_("An error has occurred!")+"</h1><h2><em>"+_("Error 404")+"</em></h2><ul><li>"+_("An internal link in the staff interface is broken and the page does not exist")+"</li></ul><h3>"+_("What's next?")+"</h3><ul style='margin-bottom: 1em; padding-bottom: 1em; border-bottom: 1px solid #CCC;'><li>"+_("Use top menu bar to navigate to another part of Koha.")+"</li><li>"+_("To report a broken link or any other issue, please contact the Koha administrator.")+" <a href='mailto:[% Koha.Preference("KohaAdminEmailAddress") | uri %]'>"+_("Send email")+"</a></li></ul>");
1737                     }
1738                 });
1739                 $('#elasticPreview').modal({show:true});
1740             });
1741            [% END %]
1742
1743             [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1744                 novSelect.loadContentForQuery({
1745                     ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1746                     ISBN : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1747                     version : '2.1'
1748                 },
1749                 '[% Koha.Preference('NovelistSelectStaffProfile') | html %]',
1750                 '[% Koha.Preference('NovelistSelectPassword') | html %]',
1751                 function(d){
1752                     if ( d.length > 0 ){ //If no content
1753                         $(".NovelistSelect").show();
1754                     }
1755                  });
1756              [% END %]
1757              $(".print-label").on("click", function(e){
1758                 e.preventDefault();
1759                 link = $(this).attr("href");
1760                 openWindow(link,"Print spine label",400,400);
1761              });
1762              $(".cover-slider").on("click",".cover-nav", function(e){
1763                  e.preventDefault();
1764                 var cover_slider = $(this).parent();
1765                 // Adding click handler for cover image navigation links
1766                 var num = $(this).data("num");
1767                 $(cover_slider).find(".cover-nav").removeClass("nav-active");
1768                 $(this).addClass("nav-active");
1769                 $(cover_slider).find(".cover-image").hide();
1770                 $(cover_slider).find(".cover-image").eq( num ).show();
1771              });
1772         });
1773
1774
1775         [% IF ( IntranetCoce && CoceProviders ) %]
1776             let counter_wait = 0;
1777             function wait_for_images(cb){
1778
1779                 var loaded = 1;
1780                 counter_wait++;
1781
1782                 if ( loaded ) {
1783                     loaded = KOHA.coce.done;
1784                 }
1785
1786                 if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1787                     window.setTimeout(function(){wait_for_images(cb);}, 100);
1788                 } else {
1789                     if (counter_wait >= 50 ) {
1790                         console.log("Could not retrieve the images")
1791                     }
1792                     cb();
1793                 }
1794             }
1795
1796             $(window).load(function() {
1797                 wait_for_images(verify_cover_images);
1798             });
1799         [% ELSE %]
1800             $(window).load(function() {
1801                 verify_cover_images();
1802             });
1803         [% END %]
1804     </script>
1805     [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1806         <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1807     [% END %]
1808     [% INCLUDE 'datatables.inc' %]
1809     [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
1810     [% INCLUDE 'columns_settings.inc' %]
1811     [% INCLUDE 'js-date-format.inc' %]
1812     [% INCLUDE 'js-patron-format.inc' %]
1813     [% INCLUDE 'js-biblio-format.inc' %]
1814     [% Asset.js("js/browser.js") | $raw %]
1815     [% Asset.js("js/table_filters.js") | $raw %]
1816     <script>
1817         var browser;
1818         browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10));
1819         browser.show();
1820
1821         [% IF bundlesEnabled %]
1822         var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1823         var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1824         [% END %]
1825         $(document).ready(function() {
1826
1827             [% IF bundlesEnabled %] // Bundle handling
1828             function createChild ( row, itemnumber, duedate ) {
1829
1830                 // Toolbar
1831                 var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1832                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#addToBundleModal" data-item="' + itemnumber + '"><i class="fa fa-plus"></i> ' + _("Add to bundle") + '</a>');
1833                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#removeFromBundleModal" data-item="' + itemnumber + '"><i class="fa fa-minus"></i> ' + _("Remove from bundle") + '</a>');
1834
1835                 // Disable management if there's a duedate
1836                 if(duedate) {
1837                     bundle_toolbar.children('.btn').addClass("disabled");
1838                 }
1839
1840                 // This is the table we'll convert into a DataTable
1841                 var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>');
1842
1843                 // Display it the child row
1844                 row.child( bundle_toolbar.add(bundles_table), 'bundle' ).show();
1845
1846                 // Initialise as a DataTable
1847                 var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?";
1848                 var bundle_table = bundles_table.kohaTable({
1849                     "ajax": {
1850                         "url": bundle_table_url
1851                     },
1852                     "embed": [
1853                         "biblio",
1854                         "return_claim.patron"
1855                     ],
1856                     "order": [[ 1, "asc" ]],
1857                     "columnDefs": [ {
1858                         "targets": [0,1,2,3],
1859                         "render": function (data, type, row, meta) {
1860                             if ( data && type == 'display' ) {
1861                                 return data.escapeHtml();
1862                             }
1863                             return data;
1864                         }
1865                     } ],
1866                     "columns": [
1867                         {
1868                             "data": "biblio.title:biblio.subtitle:biblio.medium",
1869                             "title": _("Title"),
1870                             "searchable": true,
1871                             "orderable": true,
1872                             "render": function(data, type, row, meta) {
1873                                 return $biblio_to_html(row.biblio, { link: 1 });
1874                             }
1875                         },
1876                         {
1877                             "data": "biblio.author",
1878                             "title": _("Author"),
1879                             "searchable": true,
1880                             "orderable": true,
1881                         },
1882                         {
1883                             "data": "callnumber",
1884                             "title": _("Callnumber"),
1885                             "searchable": true,
1886                             "orderable": true,
1887                         },
1888                         {
1889                             "data": "external_id",
1890                             "title": _("Barcode"),
1891                             "searchable": true,
1892                             "orderable": true,
1893                         },
1894                         {
1895                             "data": "lost_status:last_seen_date:return_claim.patron",
1896                             "title": _("Status"),
1897                             "searchable": false,
1898                             "orderable": true,
1899                             "render": function(data, type, row, meta) {
1900                                 if ( row.lost_status == bundle_lost_value ) {
1901                                     let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1902                                     if ( row.return_claim ) {
1903                                         out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1904                                     }
1905                                     return out;
1906                                 }
1907                                 else if ( row.lost_status !== 0 ) {
1908                                     return '<span class="lost">' + _("Lost") + ': ' + row.lost_status + '</span>';
1909                                 }
1910                                 return '<span class="available">' + _("Present") + '</span>';
1911                             }
1912                         },
1913                         {
1914                             "data": function( row, type, val, meta ) {
1915                                 var result;
1916                                 if (duedate) {
1917                                     result = '<button class="btn btn-default btn-xs remove disabled" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-minus" aria-hidden="true"></i> '+_("Remove")+'</button>\n';
1918                                 } else {
1919                                     result = '<button class="btn btn-default btn-xs remove" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-minus" aria-hidden="true"></i> '+_("Remove")+'</button>\n';
1920                                 }
1921                                 return result;
1922                             },
1923                             "title": _("Actions"),
1924                             "searchable": false,
1925                             "orderable": false,
1926                             "class": "noExport"
1927                         }
1928                     ]
1929                 }, bundle_settings, 1);
1930                 $(".tbundle").on("click", ".remove:not(.disabled)", function(){
1931                     var bundle_table = $(this).closest('table');
1932                     var host_itemnumber = bundle_table.data('itemnumber');
1933                     var component_itemnumber = $(this).data('itemnumber');
1934                     var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber;
1935                     $.ajax({
1936                         type: "DELETE",
1937                         url: unlink_item_url,
1938                         success: function(){
1939                             bundle_table.DataTable({ 'retrieve': true }).draw(false);
1940                         }
1941                     });
1942                 });
1943
1944                 return;
1945             }
1946
1947             var bundle_changed;
1948             var bundle_form_active;
1949             $("#addToBundleModal").on("shown.bs.modal", function(e){
1950                 var button = $(e.relatedTarget);
1951                 var item_id = button.data('item');
1952                 $("#addResult").replaceWith('<div id="addResult"></div>');
1953                 $("#addToBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items');
1954                 $("#external_id").focus();
1955                 bundle_changed = 0;
1956                 bundle_form_active = item_id;
1957             });
1958
1959             function addToBundle (url, data) {
1960                   /* Send the data using post with external_id */
1961                   var posting = $.post({
1962                       url: url,
1963                       data: JSON.stringify(data),
1964                       contentType: "application/json; charset=utf-8",
1965                       dataType: "json"
1966                   });
1967
1968                   const barcode = data.external_id;
1969
1970                   /* Report the results */
1971                   posting.done(function(data) {
1972                       $('#addResult').replaceWith('<div id="addResult" class="alert alert-success">'+_("Success: Added '%s'").format(barcode)+'</div>');
1973                       $('#external_id').val('').focus();
1974                       bundle_changed = 1;
1975                   });
1976                   posting.fail(function(data) {
1977                       if ( data.status === 409 ) {
1978                           var response = data.responseJSON;
1979                           if ( response.error_code === 'already_bundled' ) {
1980                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1981                           } else if (response.error_code === 'bundle_checkout_out') {
1982                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
1983                           } else if (response.error_code === 'checked_out') {
1984                               const button = $('<button type="button">')
1985                                 .addClass('btn btn-xs')
1986                                 .text(__("Check in and add to bundle"))
1987                                 .on('click', function () {
1988                                     addToBundle(url, { external_id: barcode, force_checkin: true });
1989                                 });
1990                               $('#addResult')
1991                                 .empty()
1992                                 .attr('class', 'alert alert-warning')
1993                                 .append(__x('Warning: Item {barcode} is checked out', { barcode }))
1994                                 .append(' ', button);
1995                           } else if (response.error_code === 'failed_checkin') {
1996                               $('#addResult')
1997                                 .empty()
1998                                 .attr('class', 'alert alert-danger')
1999                                 .append(__x('Failure: Item {barcode} cannot be checked in', { barcode }))
2000                           } else if (response.error_code === 'reserved') {
2001                               const button = $('<button type="button">')
2002                                 .addClass('btn btn-xs')
2003                                 .text(__("Ignore holds and add to bundle"))
2004                                 .on('click', function () {
2005                                     addToBundle(url, { external_id: barcode, ignore_holds: true });
2006                                 });
2007                               $('#addResult')
2008                                 .empty()
2009                                 .attr('class', 'alert alert-warning')
2010                                 .append(__x('Warning: Item {barcode} is on hold', { barcode }))
2011                                 .append(' ', button);
2012                           } else {
2013                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
2014                           }
2015                       } else if ( data.status === 404 ) {
2016                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
2017                       } else if ( data.status === 400 ) {
2018                           var response = data.responseJSON;
2019                           if ( response.error_code === "failed_nesting" ) {
2020                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' is a bundle and bundles cannot be nested").format(barcode)+'</div>');
2021                           } else {
2022                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
2023                           }
2024                       } else {
2025                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
2026                       }
2027                       $('#external_id').val('').focus();
2028                   });
2029             }
2030
2031             $("#addToBundleForm").submit(function(event) {
2032                   /* stop form from submitting normally */
2033                   event.preventDefault();
2034
2035                   const url = this.action;
2036                   const data = { external_id: this.elements.external_id.value };
2037
2038                   addToBundle(url, data);
2039             });
2040
2041             $("#addToBundleModal").on("hidden.bs.modal", function(e){
2042                 if ( bundle_changed ) {
2043                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
2044                 }
2045                 bundle_form_active = 0;
2046                 bundle_changed = 0;
2047             });
2048
2049             $("#removeFromBundleModal").on("shown.bs.modal", function(e){
2050                 var button = $(e.relatedTarget);
2051                 var item_id = button.data('item');
2052                 $("#removeResult").replaceWith('<div id="removeResult"></div>');
2053                 $("#removeFromBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/');
2054                 $("#rm_external_id").focus();
2055                 bundle_changed = 0;
2056                 bundle_form_active = item_id;
2057             });
2058
2059             $("#removeFromBundleForm").submit(function(event) {
2060
2061                 /* stop form from submitting normally */
2062                 event.preventDefault();
2063
2064                 /* get the action attribute from the <form action=""> element */
2065                 var $form = $(this),
2066                 url = $form.attr('action');
2067
2068                 var barcode = $('#rm_external_id').val();
2069
2070                 /* Fetch itemnumber using rm_external_id */
2071                 var itemReq = $.get('/api/v1/items', { q: JSON.stringify({
2072                     external_id: barcode
2073                 }) }, null, "json");
2074
2075                 var itemnumber;
2076                 itemReq.done(function(data) {
2077                     if (data.length === 1) {
2078                         itemnumber = data[0].item_id;
2079
2080                         /* Remove link using fetch itemnumber */
2081                         var deleteReq = $.ajax( url + itemnumber, {
2082                             type : 'DELETE'
2083                         });
2084
2085                         /* Report the results */
2086                         deleteReq.done(function(data) {
2087                             var barcode = $('#rm_external_id').val();
2088                             $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-success">'+_("Success: Removed '%s'").format(barcode)+'</div>');
2089                             $('#rm_external_id').val('').focus();
2090                             bundle_changed = 1;
2091                         });
2092                         deleteReq.fail(function(data) {
2093                             var barcode = $('#rm_external_id').val();
2094                             if ( data.status === 409 ) {
2095                                 var response = data.responseJSON;
2096                                 if (response.error_code === 'bundle_checkout_out') {
2097                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
2098                                 } else if ( response.key === "PRIMARY" ) {
2099                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
2100                                 } else {
2101                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
2102                                 }
2103                             } else if ( data.status === 404 ) {
2104                                 $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
2105                             } else {
2106                                 $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
2107                             }
2108                             $('#rm_external_id').val('').focus();
2109                         });
2110                     } else {
2111                         $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Barcode matched more than one item '%s'").format(barcode)+'</div>');
2112                     }
2113                 });
2114                 itemReq.fail(function(data) {
2115                      $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Item not found '%s'").format(barcode)+'</div>');
2116                     $('#rm_external_id').val('').focus();
2117
2118                 });
2119             });
2120
2121             $("#removeFromBundleModal").on("hidden.bs.modal", function(e){
2122                 if ( bundle_changed ) {
2123                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
2124                 }
2125                 bundle_form_active = 0;
2126                 bundle_changed = 0;
2127             });
2128             // End bundle handling
2129             [% END %]
2130
2131             var table_names = [ 'holdings_table', 'otherholdings_table' ];
2132             var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %] ];
2133             var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ];
2134             table_names.forEach( function( table_name, index ) {
2135                 if ( !has_images[index] ) {
2136                     table_settings[index].columns.splice(1,1);
2137                 }
2138                 var dt_parameters = {
2139                     'sDom': 't',
2140                     'bPaginate': false,
2141                     'bAutoWidth': false,
2142                     "bKohaColumnsUseNames": true,
2143                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
2144                 };
2145                 var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' );
2146
2147                 [% IF bundlesEnabled %]
2148                 // Add event listener for opening and closing bundle details
2149                 $('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
2150                     var button = $(this);
2151                     var tr = button.closest('tr');
2152                     var dTable = button.closest('table').DataTable({ 'retrieve': true });
2153
2154                     var itemnumber = tr.data('itemnumber');
2155                     var duedate = tr.data('duedate');
2156                     var row = dTable.row( tr );
2157
2158                     if ( row.child.isShown() ) {
2159                         // This row is already open - close it
2160                         row.child.hide();
2161                         tr.removeClass('shown');
2162                         button.removeClass('active');
2163                     }
2164                     else {
2165                         // Open this row
2166                         createChild(row, itemnumber, duedate);
2167                         tr.addClass('shown');
2168                         button.addClass('active');
2169                     }
2170                 } );
2171                 [% END %]
2172             });
2173
2174             [% IF Koha.Preference('AcquisitionDetails') %]
2175                 var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2176                 var acquisitiondetails_table = KohaTable("orders", {
2177                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
2178                     'bPaginate': false,
2179                     'bAutoWidth': false,
2180                     "aaSorting": [[ 4, "desc" ]],
2181                 }, table_settings);
2182             [% END %]
2183
2184             [% IF suggestions.count %]
2185                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
2186                     "aoColumnDefs": [
2187                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
2188                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
2189                     ],
2190                     "sPaginationType": "full"
2191                 }));
2192             [% END %]
2193
2194         });
2195
2196         function columnsInit(table) {
2197             activate_filters(table.id, false);
2198         }
2199
2200         [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2201             $(document).ready(function() {
2202                 var search_index = localStorage.getItem("cat_search_pulldown_selection");
2203                 var search_value = localStorage.getItem("searchbox_value");
2204                 if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2205                 if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2206             });
2207         [% END %]
2208
2209         [% IF Koha.Preference('EnableItemGroups') %]
2210             // Load item groups table
2211             var itemGroupsTable = KohaTable("items-group-table", {
2212                 "bAutoWidth": false,
2213                 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
2214                 "aoColumns": [
2215                     {
2216                         "mDataProp": function( oObj ) {
2217                             return oObj.display_order;
2218                         },
2219                     },
2220                     {
2221                         "mDataProp": function( oObj ) {
2222                             return oObj.description;
2223                         },
2224                     },
2225                     {
2226                         "mDataProp": function( oObj ) {
2227                             [% IF CAN_user_editcatalogue_manage_item_groups %]
2228                                 return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2229                                     <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
2230                                 </button>`
2231                                 + '&nbsp'
2232                                 + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2233                                     <i class='fa fa-trash-can'></i> ${('Delete')}
2234                                 </button>`;
2235                             [% ELSE %]
2236                                 return "";
2237                             [% END %]
2238                         },
2239                     },
2240                 ],
2241                 "bPaginate": false,
2242                 "bProcessing": true,
2243                 "bServerSide": false,
2244                 "sAjaxSource": `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1`,
2245                 "sAjaxDataProp": "",
2246                 "fnServerData": function ( sSource, aoData, fnCallback ) {
2247                     $.getJSON( sSource, aoData, function (json) {
2248                         fnCallback(json)
2249                     } );
2250                 },
2251             });
2252
2253             // Create new item groups
2254             $('.item-group-create').on('click', function(){
2255                 $('#modal-item-group-create-form-description').val("");
2256                 $('#modal-item-group-create-submit').removeAttr('disabled');
2257                 $('#modal-item-group-create').modal('show');
2258             });
2259
2260             $("#modal-item-group-create-form").validate({
2261                 submitHandler: function(form) {
2262                     $.ajax({
2263                         url: `/api/v1/biblios/${biblionumber}/item_groups`,
2264                         headers: { "x-koha-embed": "items" },
2265                         success: function(item_groups){
2266                             $('#modal-item-group-create-submit').attr('disabled', 'disabled');
2267
2268                             var settings = {
2269                               "url": `/api/v1/biblios/${biblionumber}/item_groups`,
2270                               "method": "POST",
2271                               "headers": {
2272                                 "Content-Type": "application/json"
2273                               },
2274                               "data": JSON.stringify(
2275                                   {
2276                                       "description": $("#modal-item-group-create-form-description").val(),
2277                                       "display_order": $("#modal-item-group-create-form-display_order").val(),
2278                                   }
2279                               ),
2280                             };
2281
2282                             $.ajax(settings)
2283                             .done(function (response) {
2284                                 $('#item-group-add-form-select').append($('<option>', {
2285                                     value: response.item_group_id,
2286                                     text: response.description
2287                                 }));
2288
2289                                 $('#modal-item-group-create').modal('hide');
2290                                 if ( item_groups.length == 0 ) {
2291                                     // This bib has no previous item groups, reload the page
2292                                     window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2293                                 } else {
2294                                     // Has other item groups, just reload the table
2295                                     itemGroupsTable.api().ajax.reload();
2296                                 }
2297                             })
2298                             .fail(function(err) {
2299                                 var message = err.responseJSON.error;
2300                                 alert(message);
2301                             });
2302                         }
2303                     });
2304                 }
2305             });
2306
2307             $('#modal-item-group-create').on('shown.bs.modal', function () {
2308                 $('#modal-item-group-create-form-description').focus();
2309             })
2310
2311             // Edit existing item groups
2312             $('body').on( 'click', '.item-group-edit', function(){
2313                 const item_group_id = $(this).data('item-group-id');
2314                 const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2315                 $.get( url, function( data ) {
2316                     $('#modal-item-group-edit-form-description').val( data.description );
2317                     $('#modal-item-group-edit-form-display_order').val( data.display_order );
2318                     $('#modal-item-group-edit-submit').data('item-group-id', item_group_id );
2319                     $('#modal-item-group-edit-submit').removeAttr('disabled');
2320                     $('#modal-item-group-edit').modal('show');
2321                 });
2322             });
2323
2324             $("#modal-item-group-edit-form").validate({
2325                 submitHandler: function(form) {
2326                     $('#modal-item-group-edit-submit').attr('disabled', 'disabled');
2327
2328                     const item_group_id = $('#modal-item-group-edit-submit').data('item-group-id');
2329                     const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2330
2331                     var settings = {
2332                       "url": url,
2333                       "method": "PUT",
2334                       "headers": {
2335                         "Content-Type": "application/json"
2336                       },
2337                       "data": JSON.stringify(
2338                           {
2339                               "description": $("#modal-item-group-edit-form-description").val(),
2340                               "display_order": $("#modal-item-group-edit-form-display_order").val(),
2341                           }
2342                       ),
2343                     };
2344
2345                     $.ajax(settings)
2346                     .done(function (response) {
2347                         $('#modal-item-group-edit').modal('hide');
2348                         itemGroupsTable.api().ajax.reload();
2349                     })
2350                     .fail(function(err) {
2351                         var message = err.responseJSON.error;
2352                         alert(message);
2353                     });
2354                 }
2355             });
2356
2357             $('#modal-item-group-edit').on('shown.bs.modal', function () {
2358                 $('#modal-item-group-edit-form-description').focus();
2359             })
2360
2361             // Delete existing item groups
2362             $('body').on( 'click', '.item-group-delete', function(){
2363                 const item_group_id = $(this).data('item-group-id');
2364                 $('#modal-item-group-delete-submit').data('item-group-id', item_group_id );
2365                 $('#modal-item-group-delete-submit').removeAttr('disabled');
2366                 $('#modal-item-group-delete').modal('show');
2367             });
2368             $("#modal-item-group-delete-submit").on('click', function(){
2369                 $('#modal-item-group-delete-submit').attr('disabled', 'disabled');
2370                 const item_group_id = $("#modal-item-group-delete-submit").data('item-group-id');
2371
2372                 $.ajax({
2373                     url: `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2374                     headers: { "x-koha-embed": "items" },
2375                     success: function(item_group_data){
2376                         $.ajax({
2377                           "url": `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2378                           "method": "DELETE",
2379                         })
2380                         .done(function (response) {
2381                             $('#modal-item-group-delete').modal('hide');
2382                             $(`#item-group-add-form-select option[value='${item_group_id}']`).remove();
2383                             if ( item_group_data.items === null ) {
2384                                 // No items for this item group, we can just refresh the table
2385                                 itemGroupsTable.api().ajax.reload();
2386                             } else {
2387                                 // This item group had items attached to it, we need to reload the page
2388                                 window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2389                             }
2390                         })
2391                         .fail(function(err) {
2392                             var message = err.responseJSON.error;
2393                             alert(message);
2394                         });
2395                     }
2396                 });
2397             });
2398
2399             // Add item(s) to a item group
2400             $('.itemselection_action_item_group_set').on('click', function(){
2401                 $('#modal-item-group-set').modal('show');
2402             });
2403
2404             $("#modal-item-group-set-form").validate({
2405                 submitHandler: function(form) {
2406                     $('#modal-item-group-set-submit').attr('disabled', 'disabled');
2407
2408                     const item_group_id = $('#item-group-add-form-select').val();
2409
2410                     let itemnumbers = new Array();
2411                     $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2412                         const itemnumber = $(this).val();
2413                         itemnumbers.push( itemnumber );
2414                     });
2415                     if (itemnumbers.length > 0) {
2416                         let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2417                         url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2418                         url += '&biblionumber=[% biblionumber | uri %]';
2419                         url += `&item_group_id=${item_group_id}`;
2420
2421                         window.location.replace(url);
2422                     }
2423
2424                     $('#modal-item-group-set').modal('hide');
2425                 }
2426             });
2427
2428             // Remove item(s) from an item group
2429             $('.itemselection_action_item_group_unset').on('click', function(){
2430                 $('#modal-item-group-unset').modal('show');
2431             });
2432
2433             $("#modal-item-group-unset-submit").on('click', function(){
2434                 $('#modal-item-group-unset-submit').attr('disabled', 'disabled');
2435
2436                 let itemnumbers = new Array();
2437                 $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2438                     const itemnumber = $(this).val();
2439                     itemnumbers.push( itemnumber );
2440                 });
2441                 if (itemnumbers.length > 0) {
2442                     let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2443                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2444                     url += '&biblionumber=[% biblionumber | uri %]';
2445
2446                     window.location.replace(url);
2447                 }
2448
2449                 $('#modal-item-group-unset').modal('hide');
2450
2451             });
2452         [% END %]
2453     </script>
2454     [% CoverImagePlugins | $raw %]
2455 [% END %]
2456 [% INCLUDE 'intranet-bottom.inc' %]