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