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