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