Bug 36757: Sync concerns tables
[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 [% PROCESS 'html_helpers/tables/items/catalogue_detail.inc' %]
15 [% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %]
16
17 [% IF Koha.Preference('AmazonAssocTag') %]
18     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
19 [% ELSE %]
20     [% AmazonAssocTag = '' %]
21 [% END %]
22
23 [% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
24
25 [% SET footerjs = 1 %]
26 [% INCLUDE 'doc-head-open.inc' %]
27 <title>[% FILTER collapse %]
28     [% IF ( unknownbiblionumber ) %]
29         [% t("Unknown record") | html %]
30     [% ELSE %]
31         [% title_in_title = INCLUDE 'biblio-title-head.inc' %]
32         [% tx("Details for {title}", { title = title_in_title }) | html %]
33     [% END %] &rsaquo;
34     [% t("Catalog") | html %] &rsaquo;
35     [% t("Koha") | html %]
36 [% END %]</title>
37 [% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
38 [% INCLUDE 'doc-head-close.inc' %]
39 </head>
40
41 <body id="catalog_detail" class="catalog">
42
43 [% WRAPPER 'header.inc' %]
44     [% INCLUDE 'cat-search.inc' %]
45 [% END %]
46
47 [% WRAPPER 'sub-header.inc' %]
48     [% WRAPPER breadcrumbs %]
49         [% WRAPPER breadcrumb_item %]
50             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
51         [% END %]
52
53         [% IF ( unknownbiblionumber ) %]
54             [% WRAPPER breadcrumb_item bc_active= 1 %]
55                 <span>Unknown record</span>
56             [% END %]
57         [% ELSE %]
58             [% WRAPPER breadcrumb_item %]
59                 [% INCLUDE 'biblio-title.inc' link = 1 %]
60             [% END %]
61             [% WRAPPER breadcrumb_item bc_active= 1 %]
62                 <span>Details</span>
63             [% END %]
64         [% END %]
65     [% END #/ WRAPPER breadcrumbs %]
66 [% END #/ WRAPPER sub-header.inc %]
67
68 <div class="main container-fluid">
69     <div class="row">
70         <div class="col-sm-10 col-sm-push-2">
71             <main>
72                 [% INCLUDE 'messages.inc' %]
73                 <div class="row">
74
75 [% IF ( unknownbiblionumber ) %]
76   <div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
77 [% ELSE %]
78
79 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
80 [% CoceProviders   = Koha.Preference('CoceProviders') %]
81 [% CoceHost        = Koha.Preference('CoceHost') %]
82 [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %]
83
84 [% INCLUDE 'cat-toolbar.inc' %]
85     [% IF ( ocoins ) %]
86         <!-- COinS / OpenURL -->
87         <span class="Z3988" title="[% ocoins | html %]"></span>
88     [% END %]
89
90     [% IF ( CoverImagePlugins || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
91         <div id="catalogue_detail_biblio" class="col-xs-9">
92     [% ELSE %]
93         <div id="catalogue_detail_biblio" class="col-xs-12">
94     [% END %]
95         [% IF decoding_error || analytics_error %]
96             <div class="page-section bg-danger">
97                <h1>Errors found</h1>
98                [% IF decoding_error %]
99                    <h2>Encoding errors</h2>
100                    <p class="biberror">There is at least one encoding error with this bibliographic record, the view may be degraded.</p>
101                    <pre class="error">[% decoding_error | html %]</pre>
102                [% END %]
103                [% IF analytics_error %]
104                    <h2>Analytics errors</h2>
105                    <p class="analytics_error">There was an error searching for analytic records, please see the logs for details.</p>
106                [% END %]
107             </div>
108         [% END %]
109
110         <div class="page-section">
111
112         [% XSLTBloc | $raw %]
113
114         [% IF shelves.count %]
115             <span class="results_summary"><span class="label">Lists that include this title: </span>
116             [% FOREACH s IN shelves %]
117                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a>
118                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
119             [% END %]
120             </span>
121         [% END %]
122         [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
123                 <span class="results_summary"><span class="label">Tags:</span>
124                     [% FOREACH TagLoo IN TagLoop %]
125                         [% IF ( CAN_user_tools_moderate_tags ) %]
126                         <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |uri %]">[% TagLoo.term | html %]</a>
127                         [% ELSE %]
128                         [% TagLoo.term | html %]
129                         [% END %]
130                         <span class="weight">([% TagLoo.weight_total | html %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
131                     [% END %]
132                     </span>
133         [% END %]
134         <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>
135         <span id="catalogue_detail_framework" class="results_summary">
136             <span class="label">MARC framework:</span>
137             <span class="frameworkcode">[% Frameworks.GetName(biblio.frameworkcode) | html %]</span>
138         </span>
139         [% IF !item_level_itypes ||  Koha.Preference("BiblioItemtypeInfo") %]
140            <span class="results_summary itemtype"><span class="label">Itemtype:</span>
141           [% IF ( !noItemTypeImages && imageurl ) %]
142               <img src="[% imageurl | html %]" alt="" />
143           [% END %]
144           [% IF ( description ) %]
145               <span class="itypetext">[% description | html %]</span>
146           [% ELSE %]
147               <span class="itypetext">[% itemtype | html %]</span>
148           [% END %]
149           </span>
150         [% END %]
151
152         [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
153             <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>
154         [% END %]
155
156         [% SET record_source = biblio.metadata.record_source %]
157         [% IF ( record_source ) %]
158             <span id="catalogue_detail_record_source" class="results_summary">
159                 <span class="label">Record source:</span>
160                 [% IF record_source.can_be_edited %]
161                     [% record_source.name | html %]
162                 [% ELSE %]
163                     [% record_source.name | html %] <i class="fa fa-lock"></i>
164                 [% END %]
165             </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 Koha.Preference('SeparateHoldings') %]
288         [% IF items_to_display_count - ( other_holdings_count || 0 ) %]
289             <li role="presentation">
290                 [%# FIXME We could build the numbers from DataTable's info %]
291                 <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">[% Branches.GetLoggedInBranchname | html %] holdings ([% items_to_display_count - ( other_holdings_count || 0 ) - ( hidden_count || 0 ) || 0 | html %])</a>
292             </li>
293         [% END %]
294         [% IF other_holdings_count %]
295             <li role="presentation">
296                 <a href="#otherholdings"  aria-controls="otherholdings" role="tab" data-toggle="tab">Other holdings ([% other_holdings_count || 0 | html %])</a>
297             </li>
298         [% END %]
299     [% ELSE %]
300         <li role="presentation">
301             <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">Holdings ([% items_to_display_count || 0 | html %])</a>
302         </li>
303     [% END %]
304     [% IF Koha.Preference('EnableItemGroups') %]
305         <li role="presentation">
306             <a href="#item_groups" aria-controls="item_groups" role="tab" data-toggle="tab">Item groups</a>
307         </li>
308     [% END %]
309 [% 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 %]
310 [% 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 %]
311 [% IF ( subscriptionsnumber ) %]<li role="presentation"><a href="#subscriptions"  aria-controls="subscriptions" role="tab" data-toggle="tab">Subscriptions</a></li>[% END %]
312 [% 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 %]
313 [% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
314 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
315 [% 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 %]
316 [% IF ( LocalCoverImages ) %]
317     <li role="presentation">
318         <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
319     </li>
320 [% END %]
321 [% IF HTML5MediaEnabled && HTML5MediaSets.size %]
322     <li id="media_tab" role="presentation"><a href="#html5media"  aria-controls="html5media" role="tab" data-toggle="tab">Play media</a></li>
323 [% END %]
324 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
325     <li class="NovelistSelect" style="display:none;" role="presentation"><a href="#NovelistSelect"  aria-controls="NovelistSelect" role="tab" data-toggle="tab">NoveList Select</a></li>
326 [% END %]
327 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
328     <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>
329 [% END %]
330 </ul>
331
332 <div class="tab-content">
333 [% IF Koha.Preference('EnableItemGroups') %]
334     <div role="tabpanel" class="tab-pane" id="item_groups">
335         [% IF CAN_user_editcatalogue_manage_item_groups %]
336             <div class="item_groups_table_table_controls">
337                 <a href="#" class="item-group-create btn btn-default btn-xs"><i class="fa fa-plus"></i> New item group</a>
338             </div>
339         [% END %]
340         <table class="items-group-table" id="items-group-table">
341             <thead>
342                 <tr>
343                     <th>Display order</th>
344                     <th>Description</th>
345                     <th class="NoSort">&nbsp;</th>
346                 </tr>
347             </thead>
348         </table>
349     </div>
350 [% END %]
351
352
353 <div role="tabpanel" class="tab-pane" id="holdings">
354
355 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %]
356     <span class="results_summary NovelistSelect" style="display:none;">
357         <span class="label">Novelist Select: </span>
358         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
359     </span>
360 [% END %]
361
362 [% SET hidden_count = all_items_count - items_to_display_count %]
363 [% IF all_items_count %]
364     [% PROCESS items_table tab="holdings" %]
365
366     [% IF hidden_count %]
367         [%# FIXME We could deal with that in JS and prevent a full refresh %]
368         <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&amp;showallitems=1">Show all items ([% hidden_count | html %] hidden)</a>
369     [% END %]
370 [% ELSE %]
371     [% IF ( ALTERNATEHOLDINGS ) %]
372     [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %]
373         <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding | html %]</div>
374     [% END %]
375     [% ELSE %]
376     <div id="noitems">No physical items for this record</div>
377     [% END %]
378 [% END %]
379
380 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'below' ) %]
381     <span class="results_summary NovelistSelect" style="display:none;">
382         <span class="label">Novelist Select: </span>
383         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
384     </span>
385 [% END %]
386     </div>
387
388 [% IF Koha.Preference('SeparateHoldings') %]
389     <div role="tabpanel" class="tab-pane" id="otherholdings">
390         [% PROCESS items_table tab="otherholdings" %]
391     </div>
392 [% END %]
393
394 [% IF ( MARCNOTES ) %]
395
396 <div role="tabpanel" class="tab-pane" id="description">
397 <div class="content_set">
398
399     [% FOREACH MARCNOTE IN MARCNOTES %]
400         <p class="marcnote marcnote-[% MARCNOTE.tag | html %]" id="marcnote-[% MARCNOTE.tag | html %]-[% loop.count | html %]">
401             [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
402                 <a href="[% MARCNOTE.marcnote | url %]">[% MARCNOTE.marcnote | html %]</a>
403             [% ELSE %]
404                 [% MARCNOTE.marcnote | html | html_line_break %]
405             [% END %]
406         </p>
407 [% END %]
408 </div>
409 </div>
410
411 [% END %]
412
413 [% IF ComponentParts && ComponentParts.size %]
414 <div role="tabpanel" class="tab-pane" id="components">
415     <div class="content_set">
416         <table>
417             [% FOR PART IN ComponentParts %]
418             <tr>
419                 <td>
420                     [% PART | $raw %]
421                 </td>
422             </tr>
423             [% END %]
424         </table>
425         [% IF ComponentParts.size == Koha.Preference('MaxComponentRecords')%]
426         <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>
427         [% END %]
428     </div> <!-- /.content_set -->
429 </div> <!-- /#components -->
430
431 [% END %]
432
433 [% IF ( subscriptionsnumber ) %]
434 <div role="tabpanel" class="tab-pane" id="subscriptions">
435 <div id="catalogue_detail_subscriptions">
436     <h2>This is a serial subscription</h2>
437     <p> (There are [% subscriptionsnumber | html %] subscriptions associated with this title).</p> 
438     [% FOREACH subscription IN subscriptions %]
439             [% IF subscription.branchcode %]
440                 <h3>At library: [% Branches.GetName(subscription.branchcode) || subscription.branchcode | html %]</h3>
441             [% END %]
442             [% IF ( subscription.closed ) %]<p>This subscription is closed.</p>[% END %]
443             [% IF ( subscription.location ) %]<p class="subscription_location">Location: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => subscription.location ) | html %]</p>[% END %]
444             [% IF ( subscription.callnumber ) %]<p>Callnumber: [% subscription.callnumber | html %] </p>[% END %]
445             [% IF ( subscription.subscriptionnotes ) %]<p>[% subscription.subscriptionnotes | html | html_line_break %] </p>[% END %]
446             [% IF ( subscription.missinglist ) %]<p>Missing issues: [% subscription.missinglist | html %] </p>[% END %]
447             [% IF ( subscription.librariannote ) %]<p>([% subscription.librariannote | html %])</p>[% END %]
448             [% IF ( subscription.latestserials ) %]
449             <p> The [% subscription.staffdisplaycount | html %] latest issues related to this subscription:</p>
450             <table>
451                 <tr>
452                     <th>Issue #</th>
453                     <th>Date arrived</th>
454                     <th>Date published</th>
455                     <th>Date published (text)</th>
456                     <th>Status</th>
457                     <th>Note</th>
458                 </tr>
459             [% FOREACH latestserial IN subscription.latestserials %]
460                 <tr>
461                     <td>[% latestserial.serialseq | html %]</td>
462                     <td data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td>
463                     <td data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td>
464                     <td>[% latestserial.publisheddatetext | html %]</td>
465                     <td>
466                         [% INCLUDE 'serial-status.inc' serial = latestserial %]
467                     </td>
468                     <td>[% latestserial.notes | html %]</td>
469                 </tr>
470             [% END %]
471             </table>
472             [% END %]
473             [% IF ( CAN_user_serials ) %]
474                 <p>
475                     <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>
476                 </p>
477             [% END %]
478     [% END %]
479 </div>
480 </div>
481 [% END %]
482
483 [% IF Koha.Preference('AcquisitionDetails') %]
484 <div role="tabpanel" class="tab-pane" id="acq_details">
485   [% IF orders.count %]
486     <table id="orders">
487       <thead>
488         <tr>
489           <th>Vendor</th>
490           <th>Invoice</th>
491           <th>Basket group</th>
492           <th>Basket</th>
493           <th>Order number</th>
494           <th>Creation date</th>
495           <th>Receive date</th>
496           <th>Status</th>
497           <th>Quantity</th>
498           <th title="Estimated cost tax incl. while pending, actual cost tax incl. once received">Price</th>
499           <th>Internal note</th>
500           <th>Subscription</th>
501           <th>Subscription call number</th>
502         </tr>
503       </thead>
504       <tbody>
505       [% FOR order IN orders %]
506         [% SET basket = order.basket %]
507         [% SET vendor = basket.bookseller %]
508           <tr>
509             <td>
510                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]" title="Vendor detail page">[% vendor.name | html %]</a>
511             </td>
512             <td>
513             [% IF order.invoiceid %]
514                 [% IF CAN_user_acquisition %]
515                     <div><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]"
516                        title="Invoice detail page">
517                        [% order.invoice.invoicenumber | html %]</a></div>
518                 [% ELSE %]
519                     <div>[% order.invoice.invoicenumber | html %]</div>
520                 [% END %]
521
522                 [% IF ( Koha.Preference('EDIFACT') && CAN_user_acquisition_edi_manage && order.invoice.message_id ) %]
523                     <div><a href="/cgi-bin/koha/acqui/edimsg.pl?id=[% order.invoice.message_id | uri %]" title="EDI INVOICE message">EDI message</a></div>
524                 [% END %]
525             [% END %]
526             </td>
527             <td>
528             [% IF basket.basketgroupid %]
529                 [% SET basket_group = basket.basket_group %]
530                 [% IF CAN_user_acquisition_group_manage %]
531                     <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>
532                 [% ELSE %]
533                     [% basket_group.name | html %] ([% basket_group.id | html %])
534                 [% END %]
535             [% END %]
536             </td>
537             <td>[% IF CAN_user_acquisition_order_manage %]
538                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">[% basket.basketname | html %] ([% basket.basketno | html %])</a>
539             [% ELSE %]
540                 [% basket.basketname | html %] ([% basket.basketno | html %])
541             [% END %]</td>
542             <td>[% order.ordernumber | html %]</td>
543             <td data-order="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</td>
544             <td data-order="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</td>
545             <td>
546               [% SWITCH order.orderstatus %]
547                 [% CASE 'new' %]<span>New</span>
548                 [% CASE 'ordered' %]<span>Ordered</span>
549                 [% CASE 'partial' %]<span>Partial</span>
550                 [% CASE 'complete' %]<span>Complete</span>
551                 [% CASE 'cancelled' %]<span>Cancelled</span>
552               [% END %]
553             </td>
554             <td>[% order.quantity | html %]</td>
555             <td>[% IF ( order.orderstatus == "complete" ) %][% order.unitprice_tax_included | $Price %][% ELSE %][% order.ecost_tax_included | $Price %][% END %]
556             <td>[% order.order_internalnote | html %]</td>
557             <td>
558                 [% IF order.subscriptionid %]
559                     <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% order.subscriptionid | uri %]">[% order.subscriptionid | html %]</a>
560                 [% END %]
561             </td>
562             <td>
563                 [% IF order.subscriptionid %]
564                     [% order.subscription.callnumber | html %]
565                 [% END %]
566             </td>
567           </tr>
568       [% END %]
569       </tbody>
570     </table>
571   [% ELSE %]
572     <span class="noorder">There is no order for this bibliographic record.</span>
573   [% END %]
574 </div>
575 [% END %]
576
577 [% IF suggestions.count %]
578     <div role="tabpanel" class="tab-pane" id="suggestion_details">
579         [% IF nb_archived_suggestions > 0 %]
580             <p>[% tnpx('pluralization', 'There is one archived suggestion.', 'There are {count} archived suggestions.', nb_archived_suggestions, { count = nb_archived_suggestions }) | $raw  %]
581         [% END %]
582         <table id="suggestions" class="sorted">
583             <thead>
584                 <tr>
585                     <th class="NoSort">&nbsp;</th>
586                     <th class="anti-the">Suggestion</th>
587                     <th>Suggested by - on</th>
588                     <th>Managed by - on</th>
589                     <th>Last modification by - on</th>
590                     <th>Library</th>
591                     <th>Fund</th>
592                     <th>Status</th>
593                 </tr>
594             </thead>
595             <tbody>
596             [% FOREACH suggestion IN suggestions %]
597                 <tr>
598                     <td>[% suggestion.suggestionid | html %]</td>
599                     <td>
600                         <a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show" title="suggestion" >
601                             [% suggestion.title | html %][% IF ( suggestion.author ) %], by [% suggestion.author | html %][% END %]</a>
602                         <br />
603                         [% IF ( suggestion.copyrightdate ) %]&copy; [% suggestion.copyrightdate | html %] [% END %]
604                         [% IF ( suggestion.volumedesc ) %]; Volume:<em>[% suggestion.volumedesc | html %]</em> [% END %]
605                         [% 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 %]
606                     </td>
607                     <td>
608                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggestedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.suggester %]</a>
609                         [% IF suggestion.suggesteddate %] - [% suggestion.suggesteddate | $KohaDates %][% END %]
610                     </td>
611                     <td>
612                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.managedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.manager %]</a>
613                         [% IF suggestion.manageddate %] - [% suggestion.manageddate | $KohaDates %][% END %]
614                     </td>
615                     <td>
616                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.lastmodificationby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.last_modifier %]</a>
617                         [% IF suggestion.lastmodificationdate %] - [% suggestion.lastmodificationdate | $KohaDates %][% END %]
618                     </td>
619                     <td>
620                         [% Branches.GetName( suggestion.branchcode ) | html %]
621                     </td>
622                     <td>
623                         [% suggestion.fund.budget_name | html %]
624                     </td>
625                     <td>
626                         [% IF    suggestion.STATUS == 'ASKED'     %]<span>Pending</span>
627                         [% ELSIF suggestion.STATUS == 'ACCEPTED'  %]<span>Accepted</span>
628                         [% ELSIF suggestion.STATUS == 'ORDERED'   %]<span>Ordered</span>
629                         [% ELSIF suggestion.STATUS == 'REJECTED'  %]<span>Rejected</span>
630                         [% ELSIF suggestion.STATUS == 'CHECKED'   %]<span>Checked</span>
631                         [% ELSIF suggestion.STATUS == 'AVAILABLE' %]<span>Available</span>
632                         [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) %]
633                             [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) | html %]
634                         [% ELSE %]<span>Status unknown</span>
635                         [% END %]
636                         [% IF suggestion.reason %]
637                             <br />([% suggestion.reason | html %])
638                         [% END %]
639                     </td>
640                 </tr>
641                 [% END %]
642             </tbody>
643         </table>
644     </div>
645 [% END %]
646
647 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
648 <div role="tabpanel" class="tab-pane" id="editions"><h4>Editions</h4>
649 <table>
650 [% 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 %]
651 [% 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 %]
652 <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 %]
653   [% IF ( XISBN.publishercode ) %]
654 [% 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 %]
655     [% END %]
656                 [% IF ( XISBN.pages ) %] [% END %][% XISBN.pages | html %] [% IF ( XISBN.illus ) %][% XISBN.illus | html %][% END %]
657                 [% IF ( XISBN.size ) %], [% END %][% XISBN.size | html %]
658 </td>
659
660 [% END %]
661 </table></div>[% END %]
662 [% END %]
663
664 [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
665 <div role="tabpanel" class="tab-pane" id="concerns">
666     <fieldset class="action" style="cursor:pointer;">
667         <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a>
668         | <a id="showAll"><i class="fa fa-bars"></i> Show all</a>
669     </fieldset>
670
671     <table id="table_concerns" width="100%">
672         <thead>
673             <tr>
674                 <th>Reported</th>
675                 <th>Details</th>
676                 <th>Title</th>
677                 <th>Status</th>
678                 <th data-class-name="actions noExport">Actions</th>
679             </tr>
680         </thead>
681     </table>
682 </div>
683 [% END %]
684
685 [% IF ( LocalCoverImages ) %]
686     <div role="tabpanel" class="tab-pane" id="images">
687         [% IF localimages.count %]
688             <p>Click on an image to view it in the image viewer</p>
689             <ul class="thumbnails">
690                 [% FOREACH image IN localimages %]
691                     [% IF image %]
692                         <li id="imagenumber-[% image.imagenumber | html %]" class="thumbnail">
693                             <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
694                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" />
695                             </a>
696                             [% IF CAN_user_tools_upload_local_cover_images %]
697                                 <a href="#" class="remove"><i class="fa fa-trash-can"></i> Delete image</a>
698                             [% END %]
699                         </li>
700                     [% END %]
701                 [% END %]
702             </ul>
703         [% ELSE # - No image passed JavaScript takes care %]
704             <span class="noimagesuploaded">No images have been uploaded for this bibliographic record yet.</span>
705         [% END %]
706         [% IF ( CAN_user_tools_upload_local_cover_images ) %]
707             <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>
708             </p>
709         [% END %]
710     </div>
711 [% END %]
712
713 [% IF ( HTML5MediaEnabled ) %]
714 <div role="tabpanel" class="tab-pane" id="html5media">
715           [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
716             <p>
717                 [% IF HTML5MediaSet.is_youtube %]
718                     <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
719                 [% ELSE %]
720                   <[% HTML5MediaParent | html %] controls preload=none>
721                     <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] />
722                     [[% HTML5MediaParent | html %] tag not supported by your browser.]
723                   </[% HTML5MediaParent | html %]>
724                 [% END %]
725             </p>
726           [% END %]
727 </div>
728 [% END %]
729
730
731 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
732     <div role="tabpanel" class="tab-pane" id="NovelistSelect" class="novelistSelect">
733         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
734     </div>
735 [% END %]
736
737 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
738     <div role="tabpanel" class="tab-pane" id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
739         [% plugins_intranet_catalog_biblio_tab.content | $raw %]
740     </div>
741 [% END %]
742
743 </div><!-- /tab-content -->
744 </div><!-- /bibliodetails -->
745
746 <div id="export" style="margin-top: 1em;">
747 <form method="get" action="/cgi-bin/koha/catalogue/export.pl">
748 <table>  <tr>
749       <th>Save record</th>   </tr>
750     <tr><td> Select download format:    <select name="format">
751         <option value="mods">MODS (XML)</option>
752         <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
753         <option value="marcxml">MARCXML</option>
754         <option value="marc8">MARC (non-Unicode/MARC-8)</option>
755         <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
756         <input type="submit" name="save" class="btn btn-primary" value="Download record" /></td>
757   </tr>
758   <tr><td>
759     <input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="[% biblionumber | html %]" />
760   </td></tr>
761 </table>
762 </form>
763 </div>
764
765 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
766     <div class="modal-dialog modal-lg">
767     <div class="modal-content">
768     <div class="modal-header">
769         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
770         <h3 id="marcPreviewLabel">MARC preview</h3>
771     </div>
772     <div class="modal-body">
773         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
774     </div>
775     <div class="modal-footer">
776         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
777     </div>
778     </div>
779     </div>
780 </div>
781
782 <div id="elasticPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="elasticPreviewLabel" aria-hidden="true">
783     <div class="modal-dialog modal-lg">
784     <div class="modal-content">
785     <div class="modal-header">
786         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
787         <h3 id="elasticPreviewLabel">Elasticsearch record</h3>
788     </div>
789     <div class="modal-body">
790         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
791     </div>
792     <div class="modal-footer">
793         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
794     </div>
795     </div>
796     </div>
797 </div>
798
799             </main>
800         </div> <!-- /.col-sm-10.col-sm-push-2 -->
801
802         <div class="col-sm-2 col-sm-pull-10">
803             <aside>
804                 [% INCLUDE 'biblio-view-menu.inc' %]
805             </aside>
806         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
807      </div> <!-- /.row -->
808
809 [% END %]
810
811 <div class="modal fade" id="modal-item-group-create" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-create-label">
812     <div class="modal-dialog">
813         <div class="modal-content">
814             <div class="modal-header">
815                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
816                 <h3 id="modal-item-group-create-label"><i class="fa fa-plus"></i> Create a new item group</h3>
817             </div>
818             <form method="get" id="modal-item-group-create-form" class="validated">
819                 <div class="modal-body">
820                     <fieldset>
821                         <p>
822                             <label for="item_group_description" class="required">Name: </label>
823                             <input name="description" id="modal-item-group-create-form-description" type="text" size="30" required="required" class="required" />
824                             <span class="required">Required</span>
825                         </p>
826                         <p>
827                             <label for="item_group_display_order" class="required">Display order: </label>
828                             <input name="display_order" id="modal-item-group-create-form-display_order" value="0" size="5" required="required" class="required" />
829                             <span class="required">Required</span>
830                             <br/>
831                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
832                         </p>
833                     </fieldset>
834                 </div>
835                 <div class="modal-footer">
836                     <button id="modal-item-group-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button>
837                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
838                 </div>
839             </form>
840         </div>
841     </div>
842 </div>
843
844 <div class="modal fade" id="modal-item-group-edit" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-edit-label">
845     <div class="modal-dialog">
846         <div class="modal-content">
847             <div class="modal-header">
848                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
849                 <h3 id="modal-item-group-edit-label"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit item group</h3>
850             </div>
851             <form method="get" id="modal-item-group-edit-form" class="validated">
852                 <div class="modal-body">
853                     <fieldset>
854                         <p>
855                             <label for="item_group_description" class="required">Name: </label>
856                             <input name="description" id="modal-item-group-edit-form-description" type="text" size="30" required="required" class="required" />
857                             <span class="required">Required</span>
858                         </p>
859                         <p>
860                             <label for="item_group_display_order" class="required">Sort order: </label>
861                             <input name="display_order" id="modal-item-group-edit-form-display_order" size="5" />
862                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
863                         </p>
864                     </fieldset>
865                 </div>
866                 <div class="modal-footer">
867                     <button id="modal-item-group-edit-submit" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Submit</button>
868                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
869                 </div>
870             </form>
871         </div>
872     </div>
873 </div>
874
875 <div class="modal fade" id="modal-item-group-delete" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-delete-label">
876     <div class="modal-dialog">
877         <div class="modal-content">
878             <div class="modal-header">
879                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
880                 <h3 id="modal-item-group-delete-label"><i class='fa fa-trash-can'></i> Delete item group</h3>
881             </div>
882             <div class="modal-body">
883                 Are you sure you want to delete this item group?
884             </div>
885             <div class="modal-footer">
886                 <button id="modal-item-group-delete-submit" class="btn btn-danger"><i class='fa fa-trash-can'></i> Delete</button>
887                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
888             </div>
889         </div>
890     </div>
891 </div>
892
893 <div class="modal fade" id="modal-item-group-set" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-set-label">
894     <div class="modal-dialog">
895         <div class="modal-content">
896             <div class="modal-header">
897                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
898                 <h3 id="modal-item-group-set-label"><i class='fa fa-book'></i> Set item group for items</h3>
899             </div>
900             <form method="get" id="modal-item-group-set-form" class="validated">
901                 <div class="modal-body">
902                     <fieldset>
903                         <p>
904                             <label for="item_group" class="required">Item group: </label>
905                             <select name="item_group" id="item-group-add-form-select">
906                                 [% FOREACH ig IN biblio.item_groups.search({}, {order_by => 'display_order'}) %]
907                                     <option value="[% ig.id | html %]">[% ig.description | html %]</option>
908                                 [% END %]
909                             </select>
910                             <span class="required">Required</span>
911                         </p>
912                     </fieldset>
913                 </div>
914                 <div class="modal-footer">
915                     <button id="modal-item-group-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set item group</button>
916                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
917                 </div>
918             </form>
919         </div>
920     </div>
921 </div>
922
923 <div class="modal fade" id="modal-item-group-unset" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-unset-label">
924     <div class="modal-dialog">
925         <div class="modal-content">
926             <div class="modal-header">
927                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
928                 <h3 id="modal-item-group-unset-label"><i class='fa fa-unlink'></i> Remove item from item group</h3>
929             </div>
930             <div class="modal-body">
931                 Are you sure you want to remove these item(s) from their item group(s)?
932             </div>
933             <div class="modal-footer">
934                 <button id="modal-item-group-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
935                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
936             </div>
937         </div>
938     </div>
939 </div>
940
941     [% IF bundlesEnabled %]
942     <div class="modal" id="addToBundleModal" tabindex="-1" role="dialog" aria-labelledby="addToBundleLabel">
943         <form method="get" id="addToBundleForm" action="">
944             <div class="modal-dialog" role="document">
945                 <div class="modal-content">
946                     <div class="modal-header">
947                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
948                         <h3 id="addToBundleLabel">Add to bundle</h3>
949                     </div>
950                     <div class="modal-body">
951                         <div id="addResult"></div>
952                         <fieldset class="rows">
953                             <ol>
954                                 <li>
955                                     <label class="required" for="external_id">Item barcode: </label>
956                                     <input type="text" id="external_id" name="external_id" required="required">
957                                     <span class="required">Required</span>
958                                 </li>
959                             </ol>
960                         </fieldset>
961                     </div>
962                     <div class="modal-footer">
963                         <button type="submit" class="btn btn-default">Submit</button>
964                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
965                     </div>
966                 </div>
967             </div>
968         </form>
969     </div>
970
971     <div class="modal" id="removeFromBundleModal" tabindex="-1" role="dialog" aria-labelledby="removeFromBundleLabel">
972         <form method="get" id="removeFromBundleForm" action="">
973             <div class="modal-dialog" role="document">
974                 <div class="modal-content">
975                     <div class="modal-header">
976                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
977                         <h3 id="removeFromBundleLabel">Remove from bundle</h3>
978                     </div>
979                     <div class="modal-body">
980                         <div id="removeResult"></div>
981                         <fieldset class="rows">
982                             <ol>
983                                 <li>
984                                     <label class="required" for="external_id">Item barcode: </label>
985                                     <input type="text" id="rm_external_id" name="external_id" required="required">
986                                     <span class="required">Required</span>
987                                 </li>
988                             </ol>
989                         </fieldset>
990                     </div>
991                     <div class="modal-footer">
992                         <button type="submit" class="btn btn-default">Submit</button>
993                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
994                     </div>
995                 </div>
996             </div>
997         </form>
998     </div>
999     [% END %]
1000
1001     [% IF ( Koha.Preference('CatalogConcerns') ) %]
1002     [% INCLUDE 'modals/add_catalog_concern.inc' %]
1003     [% END %]
1004
1005     [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1006     [% INCLUDE 'modals/display_ticket.inc' %]
1007     [% END %]
1008
1009 [% MACRO jsinclude BLOCK %]
1010     [% INCLUDE 'catalog-strings.inc' %]
1011     [% INCLUDE 'calendar.inc' %]
1012     [% INCLUDE 'select2.inc' %]
1013     [% INCLUDE 'js-date-format.inc' %]
1014     [% Asset.js("js/catalog.js") | $raw %]
1015     [% Asset.js("js/recalls.js") | $raw %]
1016     [% Asset.js("js/coce.js") | $raw %]
1017     [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1018     [% IF ( Koha.Preference('CatalogConcerns') ) %]
1019         <script>
1020             /* Set a variable needed by add_catalog_concern.js */
1021             var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1022         </script>
1023         [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1024      [% END %]
1025      [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1026          <script>
1027             $(document).ready(function() {
1028                 var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %];
1029
1030                 var filtered = false;
1031                 let additional_filters = {
1032                     resolved_date: function(){
1033                         if ( filtered ) {
1034                             return { "=": null };
1035                         } else {
1036                             return;
1037                         }
1038                     },
1039                     source: 'catalog',
1040                     biblio_id: [% biblionumber | uri %]
1041                 };
1042
1043                 var tickets_url = '/api/v1/tickets';
1044                 var tickets = $("#table_concerns").kohaTable({
1045                     "ajax": {
1046                         "url": tickets_url
1047                     },
1048                     "embed": [
1049                         "assignee",
1050                         "reporter",
1051                         "resolver",
1052                         "biblio",
1053                         "updates+count",
1054                         "+strings"
1055                     ],
1056                     'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
1057                     "columnDefs": [ {
1058                         "targets": [0,1,2,3],
1059                         "render": function (data, type, row, meta) {
1060                             if ( type == 'display' ) {
1061                                 if ( data != null ) {
1062                                     return data.escapeHtml();
1063                                 }
1064                                 else {
1065                                     return "";
1066                                 }
1067                             }
1068                             return data;
1069                         }
1070                     } ],
1071                     "columns": [
1072                         {
1073                             "data": "reported_date:reporter.firstname",
1074                             "render": function(data, type, row, meta) {
1075                                 let reported = '<span class="date clearfix">' + $datetime(row.reported_date) + '</span>';
1076                                 reported += '<span class="reporter clearfix">' + $patron_to_html(row.reporter, {
1077                                     display_cardnumber: false,
1078                                     url: true
1079                                 }) + '</span>';
1080                                 return reported;
1081                             },
1082                             "searchable": true,
1083                             "orderable": true
1084                         },
1085                         {
1086                             "data": "title:body",
1087                             "render": function(data, type, row, meta) {
1088                                 let resolved = ( row.resolved_date ) ? true : false;
1089                                 let result = '<a role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="' + resolved + '">' + row.title + '</a>';
1090                                 if (row.updates_count) {
1091                                     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>';
1092                                 }
1093                                 result += '<div id="detail_' + row.ticket_id + '" class="hidden">' + row.body + '</div>';
1094                                 return result;
1095                             },
1096                             "searchable": true,
1097                             "orderable": true
1098                         },
1099                         {
1100                             "data": "biblio.title",
1101                             "render": function(data, type, row, meta) {
1102                                 return $biblio_to_html(row.biblio, {
1103                                     link: 1
1104                                 });
1105                             },
1106                             "searchable": true,
1107                             "orderable": true
1108                         },
1109                         {
1110                             "data": "assignee.firstname:assignee.surname:resolver.firstname:resolver.surname:resolved_date:status",
1111                             "render": function(data, type, row, meta) {
1112                                 let result = '';
1113                                 if (row.resolved_date) {
1114                                     result += _("Resolved by:") + ' <span>' + $patron_to_html(row.resolver, {
1115                                         display_cardnumber: false,
1116                                         url: true
1117                                     }) + '</span>';
1118                                     if (row.status) {
1119                                         result += ' ' + _("as") + ' ';
1120                                         result += row._strings.status ? escape_str(row._strings.status.str) : "";
1121                                     }
1122                                     result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
1123                                 } else {
1124                                     if (row.status) {
1125                                         result += row._strings.status ? escape_str(row._strings.status.str) : "";
1126                                     } else {
1127                                         result += _("Open");
1128                                     }
1129                                     if (row.assignee) {
1130                                         result += '<span class="clearfix">' + _("Assigned to: ") + $patron_to_html(row.assignee, {
1131                                             display_cardnumber: false,
1132                                             url: true
1133                                         }) + '</span>';
1134                                     }
1135                                 }
1136                                 return result;
1137                             },
1138                             "searchable": true,
1139                             "orderable": true
1140                         },
1141                         {
1142                             "data": function(row, type, val, meta) {
1143                                 let resolved = ( row.resolved_date ) ? true : false;
1144                                 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 + '" data-assignee="'+$patron_to_html(row.assignee, { display_cardnumber: false, url: false })+'"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>';
1145                                 return result;
1146                             },
1147                             "searchable": false,
1148                             "orderable": false
1149                         },
1150                     ]
1151                 }, table_settings, 0, additional_filters);
1152
1153                 $('#hideResolved').on("click", function() {
1154                     filtered = true;
1155                     tickets.DataTable().draw();
1156                 });
1157
1158                 $('#showAll').on("click", function() {
1159                     filtered = false;
1160                     tickets.DataTable().draw();
1161                 });
1162             });
1163         </script>
1164         [% Asset.js("js/modals/display_ticket.js") | $raw %]
1165     [% END %]
1166     <script>
1167         var interface = "[% interface | html %]";
1168         var theme = "[% theme | html %]";
1169         // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
1170         function verify_cover_images(container) {
1171             // Loop over each container in the template which contains covers
1172             let cover_sliders = container ? container.find('.cover-slider') : $(".cover-slider");
1173             cover_sliders.each(function(){
1174                 var lightbox_descriptions = [];
1175                 var first_shown = 0;
1176                 $(this).find(".cover-image").each( function( index ){
1177                 var div = $(this);
1178                 // Find the image in the container
1179                 var img = div.find("img")[0];
1180                 if( $(img).length > 0 ){
1181                     var description = "";
1182                         // All slides start hidden. If this is the first one, show it.
1183                         if( first_shown == 0 ){
1184                             div.show();
1185                             first_shown = 1;
1186                         }
1187                         // Check if Amazon image is present
1188                         if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1189                             w = img.width;
1190                             h = img.height;
1191                             if ((w == 1) || (h == 1)) {
1192                                 // Amazon returned single-pixel placeholder
1193                                 // Remove the container
1194                                 div.remove();
1195                             } else {
1196                                 lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1197                             }
1198                         } else if( div.attr("id") == "custom-coverimg" ){
1199                             if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1200                                 // No image was loaded via the CustomCoverImages system preference
1201                                 // Remove the container
1202                                 div.remove();
1203                             } else {
1204                                 lightbox_descriptions.push( _("Custom cover image") );
1205                             }
1206                         } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1207                                 lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1208                         }
1209                         else if( div.hasClass("coce-coverimg" ) ){
1210                             // Identify which service's image is being loaded by Coce
1211                             var coce_description;
1212                             if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1213                                 coce_description = _("Coce image from Amazon.com");
1214                             } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1215                                 coce_description = _("Coce image from Google Books");
1216                             } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1217                                 coce_description = _("Coce image from Open Library");
1218                             }
1219                             div.find(".hint").html(coce_description);
1220                             lightbox_descriptions.push(coce_description);
1221                         } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1222                             lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1223                         } else {
1224                             lightbox_descriptions.push(_("Cover image source unknown"));
1225                         }
1226                     }
1227                 });
1228
1229                 // Lightbox for cover images
1230                 Chocolat(this.querySelectorAll('.cover-image a'), {
1231                     description: function(){
1232                         return lightbox_descriptions[this.settings.currentImageIndex];
1233                     }
1234                 });
1235
1236             });
1237
1238             cover_sliders.each(function(){
1239                 var coverSlide = this;
1240                 var coverImages = $(this).find(".cover-image");
1241                 if( coverImages.length > 1 ){
1242                     coverImages.each(function( index ){
1243                         // If more that one image is present, add a navigation link
1244                         // for activating the slide
1245                         var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>");
1246                         if( index == 0 ){
1247                             // Set the first navigation link as active
1248                             $(covernav).addClass("nav-active");
1249                         }
1250                         $(covernav).html("<i class=\"fa fa-circle\"></i>");
1251                         $(coverSlide).append( covernav );
1252                     });
1253                 }
1254
1255                 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
1256                     && $(coverSlide).find(".cover-image:visible").length < 1 ){
1257                     $(coverSlide).remove();
1258                 } else {
1259                     $(coverSlide).addClass("cover-slides");
1260                     var img = $(coverSlide).find(".cover-image:visible").find("img")[0];
1261                     if( $(img).length > 0 && img.complete && img.naturalHeight > 0 ){
1262                         $(".cover-slides").css({"background-image":"none"});
1263                     }
1264                 }
1265             });
1266
1267             $("#editions img").each(function(i){
1268                 if ( this.src.indexOf('amazon.com') >= 0 ) {
1269                     w = this.width;
1270                     h = this.height;
1271                     if ((w == 1) || (h == 1)) {
1272                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1273                     } else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) {
1274                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1275                     }
1276                 }
1277             });
1278         }
1279
1280         let build_items_table_drawncallback = function (table) {
1281             let tab_id = table.parents('.tab-pane').attr('id');
1282             verify_cover_images($("#" + tab_id + '_table'));
1283         };
1284
1285         function removeLocalImage(imagenumber) {
1286             var thumbnail = $("#imagenumber-" + imagenumber );
1287             var copy = thumbnail.html();
1288             thumbnail.find("img").css("opacity", ".2");
1289             thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1290             const client = APIClient.cover_image;
1291             client.cover_images.delete(imagenumber).then(
1292                 success => {
1293                     if ( success.deleted == 1 ) {
1294                         thumbnail.remove();
1295                     } else {
1296                         thumbnail.html( copy );
1297                         alert(_("An error occurred on deleting this image"));
1298                     }
1299                     if ( $('ul.thumbnails > li').length == 0 ) {
1300                         showNoImageMessage();
1301                     }
1302                 },
1303                 error => {
1304                     thumbnail.html( copy );
1305                     alert(_("An error occurred on deleting this image"));
1306                     console.warn("Something wrong happened: %s".format(error));
1307                 }
1308             );
1309         }
1310
1311         function showNoImageMessage() {
1312             var no_images_msg = _("No images have been uploaded for this bibliographic record yet.");
1313             no_images_msg = '<p>' + no_images_msg + '</p>';
1314             [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1315                 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>");
1316                 no_images_msg += "<p id='upload_image'>" + please_upload + '</p>';
1317             [% END %]
1318             $('#images').html(no_images_msg);
1319         }
1320
1321
1322         $(document).ready(function() {
1323             // Pick details tab to display by default
1324             [% IF count == 0 %]
1325                 [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1326                     $(".nav-tabs a[href='#html5media']").tab("show");
1327                 [% ELSIF ComponentParts && ComponentParts.size %]
1328                     $(".nav-tabs a[href='#components']").tab("show");
1329                 [% ELSE %]
1330                     $(".nav-tabs a[href='#holdings']").tab("show");
1331                 [% END %]
1332             [% ELSE %]
1333                 [% IF items_to_display_count - ( other_holdings_count || 0 ) %]
1334                     $(".nav-tabs a[href='#holdings']").tab("show");
1335                 [% ELSE %]
1336                     $(".nav-tabs a[href='#otherholdings']").tab("show");
1337                 [% END %]
1338             [% END %]
1339             $('#search-form').focus();
1340             $('.thumbnails > li > .remove').click(function() {
1341                 var result = confirm(_("Are you sure you want to delete this cover image?"));
1342
1343                 if ( result == true ) {
1344                     var imagenumber = $(this).parent().attr('id').split('-')[1];
1345                     removeLocalImage(imagenumber);
1346                 }
1347
1348                 return false;
1349             });
1350             [% IF ( IntranetCoce && CoceProviders ) %]
1351                 KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
1352             [% END %]
1353
1354             $("body").on("click",".previewMARC", function(e){
1355                 e.preventDefault();
1356                 var page = $(this).attr("href");
1357                 $("#marcPreview .modal-body").load(page + " table");
1358                 $('#marcPreview').modal({show:true});
1359
1360             });
1361
1362            [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
1363             $("body").on("click",".previewElastic", function(e){
1364                 e.preventDefault();
1365                 var pageElastic = $(this).attr("href");
1366                 $("#elasticPreview .modal-body").load(pageElastic, function( response, status, xhr ) {
1367                     if( status == 'error' ){
1368                         $("#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>");
1369                     }
1370                 });
1371                 $('#elasticPreview').modal({show:true});
1372             });
1373            [% END %]
1374
1375             [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1376                 novSelect.loadContentForQuery({
1377                     ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1378                     ISBN : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1379                     version : '2.1'
1380                 },
1381                 '[% Koha.Preference('NovelistSelectStaffProfile') | html %]',
1382                 '[% Koha.Preference('NovelistSelectPassword') | html %]',
1383                 function(d){
1384                     if ( d.length > 0 ){ //If no content
1385                         $(".NovelistSelect").show();
1386                     }
1387                  });
1388              [% END %]
1389              $(".cover-slider").on("click",".cover-nav", function(e){
1390                  e.preventDefault();
1391                 var cover_slider = $(this).parent();
1392                 // Adding click handler for cover image navigation links
1393                 var num = $(this).data("num");
1394                 $(cover_slider).find(".cover-nav").removeClass("nav-active");
1395                 $(this).addClass("nav-active");
1396                 $(cover_slider).find(".cover-image").hide();
1397                 $(cover_slider).find(".cover-image").eq( num ).show();
1398              });
1399         });
1400
1401
1402         [% IF ( IntranetCoce && CoceProviders ) %]
1403             let counter_wait = 0;
1404             function wait_for_images(cb){
1405
1406                 var loaded = 1;
1407                 counter_wait++;
1408
1409                 if ( loaded ) {
1410                     loaded = KOHA.coce.done;
1411                 }
1412
1413                 if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1414                     window.setTimeout(function(){wait_for_images(cb);}, 100);
1415                 } else {
1416                     if (counter_wait >= 50 ) {
1417                         console.log("Could not retrieve the images")
1418                     }
1419                     cb();
1420                 }
1421             }
1422
1423             $(window).load(function() {
1424                 wait_for_images(verify_cover_images);
1425             });
1426         [% ELSE %]
1427             $(window).load(function() {
1428                 verify_cover_images();
1429             });
1430         [% END %]
1431     </script>
1432     [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1433         <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1434     [% END %]
1435     [% INCLUDE 'datatables.inc' %]
1436     [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
1437     [% INCLUDE 'columns_settings.inc' %]
1438     [% INCLUDE 'js-date-format.inc' %]
1439     [% INCLUDE 'js-patron-format.inc' %]
1440     [% INCLUDE 'js-biblio-format.inc' %]
1441     [% Asset.js("js/browser.js") | $raw %]
1442     [% Asset.js("js/table_filters.js") | $raw %]
1443     [% Asset.js("js/modals/place_booking.js") | $raw %]
1444     <script>
1445         var browser;
1446         browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10));
1447         browser.show();
1448
1449         [% IF bundlesEnabled %]
1450         var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1451         var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1452         [% END %]
1453
1454         $(document).ready(function() {
1455
1456             [% IF bundlesEnabled %] // Bundle handling
1457             function createChild ( row, itemnumber, duedate ) {
1458
1459                 // Toolbar
1460                 var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1461                 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>');
1462                 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>');
1463
1464                 // Disable management if there's a duedate
1465                 if(duedate) {
1466                     bundle_toolbar.children('.btn').addClass("disabled");
1467                     bundle_toolbar.attr("title", _("This bundle is checked out, it cannot be modified"));
1468                 }
1469
1470                 // This is the table we'll convert into a DataTable
1471                 var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>');
1472
1473                 // Display it the child row
1474                 row.child( bundle_toolbar.add(bundles_table), 'bundle' ).show();
1475
1476                 // Initialise as a DataTable
1477                 var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?";
1478                 var bundle_table = bundles_table.kohaTable({
1479                     "ajax": {
1480                         "url": bundle_table_url
1481                     },
1482                     "embed": [
1483                         "biblio",
1484                         "return_claim.patron"
1485                     ],
1486                     "order": [[ 1, "asc" ]],
1487                     "columnDefs": [ {
1488                         "targets": [0,1,2,3],
1489                         "render": function (data, type, row, meta) {
1490                             if ( data && type == 'display' ) {
1491                                 return data.escapeHtml();
1492                             }
1493                             return data;
1494                         }
1495                     } ],
1496                     "columns": [
1497                         {
1498                             "data": "biblio.title:biblio.subtitle:biblio.medium",
1499                             "title": _("Title"),
1500                             "searchable": true,
1501                             "orderable": true,
1502                             "render": function(data, type, row, meta) {
1503                                 return $biblio_to_html(row.biblio, { link: 1 });
1504                             }
1505                         },
1506                         {
1507                             "data": "biblio.author",
1508                             "title": _("Author"),
1509                             "searchable": true,
1510                             "orderable": true,
1511                         },
1512                         {
1513                             "data": "callnumber",
1514                             "title": _("Callnumber"),
1515                             "searchable": true,
1516                             "orderable": true,
1517                         },
1518                         {
1519                             "data": "external_id",
1520                             "title": _("Barcode"),
1521                             "searchable": true,
1522                             "orderable": true,
1523                         },
1524                         {
1525                             "data": "lost_status:last_seen_date:return_claim.patron",
1526                             "title": _("Status"),
1527                             "searchable": false,
1528                             "orderable": false,
1529                             "render": function(data, type, row, meta) {
1530                                 if ( row.lost_status == bundle_lost_value ) {
1531                                     let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1532                                     if ( row.return_claim ) {
1533                                         out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1534                                     }
1535                                     return out;
1536                                 }
1537                                 else if ( row.lost_status !== 0 ) {
1538                                     return '<span class="lost">' + _("Lost") + ': ' + row.lost_status + '</span>';
1539                                 }
1540                                 return '<span class="available">' + _("Present") + '</span>';
1541                             }
1542                         },
1543                         {
1544                             "data": function( row, type, val, meta ) {
1545                                 var result;
1546                                 if (duedate) {
1547                                     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"));
1548                                 } else {
1549                                     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';
1550                                 }
1551                                 return result;
1552                             },
1553                             "title": _("Actions"),
1554                             "searchable": false,
1555                             "orderable": false,
1556                             "class": "noExport"
1557                         }
1558                     ]
1559                 }, bundle_settings, 1);
1560                 $(".tbundle").on("click", ".remove:not(.disabled)", function(){
1561                     var bundle_table = $(this).closest('table');
1562                     var host_itemnumber = bundle_table.data('itemnumber');
1563                     var component_itemnumber = $(this).data('itemnumber');
1564                     var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber;
1565                     $.ajax({
1566                         type: "DELETE",
1567                         url: unlink_item_url,
1568                         success: function(){
1569                             bundle_table.DataTable({ 'retrieve': true }).draw(false);
1570                         }
1571                     });
1572                 });
1573
1574                 return;
1575             }
1576
1577             var bundle_changed;
1578             var bundle_form_active;
1579             $("#addToBundleModal").on("shown.bs.modal", function(e){
1580                 var button = $(e.relatedTarget);
1581                 var item_id = button.data('item');
1582                 $("#addResult").replaceWith('<div id="addResult"></div>');
1583                 $("#addToBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items');
1584                 $("#external_id").focus();
1585                 bundle_changed = 0;
1586                 bundle_form_active = item_id;
1587             });
1588
1589             function addToBundle (url, data) {
1590                   /* Send the data using post with external_id */
1591                   var posting = $.post({
1592                       url: url,
1593                       data: JSON.stringify(data),
1594                       contentType: "application/json; charset=utf-8",
1595                       dataType: "json"
1596                   });
1597
1598                   const barcode = data.external_id;
1599
1600                   /* Report the results */
1601                   posting.done(function(data) {
1602                       $('#addResult').replaceWith('<div id="addResult" class="alert alert-success">'+_("Success: Added '%s'").format(barcode)+'</div>');
1603                       $('#external_id').val('').focus();
1604                       bundle_changed = 1;
1605                   });
1606                   posting.fail(function(data) {
1607                       if ( data.status === 409 ) {
1608                           var response = data.responseJSON;
1609                           if ( response.error_code === 'already_bundled' ) {
1610                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1611                           } else if (response.error_code === 'bundle_checkout_out') {
1612                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
1613                           } else if (response.error_code === 'checked_out') {
1614                               const button = $('<button type="button">')
1615                                 .addClass('btn btn-xs')
1616                                 .text(_("Check in and add to bundle"))
1617                                 .on('click', function () {
1618                                     addToBundle(url, { external_id: barcode, force_checkin: true });
1619                                 });
1620                               $('#addResult')
1621                                 .empty()
1622                                 .attr('class', 'alert alert-warning')
1623                                 .append(__x('Warning: Item {barcode} is checked out', { barcode }))
1624                                 .append(' ', button);
1625                           } else if (response.error_code === 'failed_checkin') {
1626                               $('#addResult')
1627                                 .empty()
1628                                 .attr('class', 'alert alert-danger')
1629                                 .append(__x('Failure: Item {barcode} cannot be checked in', { barcode }))
1630                           } else if (response.error_code === 'reserved') {
1631                               const button = $('<button type="button">')
1632                                 .addClass('btn btn-xs')
1633                                 .text(_("Ignore holds and add to bundle"))
1634                                 .on('click', function () {
1635                                     addToBundle(url, { external_id: barcode, ignore_holds: true });
1636                                 });
1637                               $('#addResult')
1638                                 .empty()
1639                                 .attr('class', 'alert alert-warning')
1640                                 .append(__x('Warning: Item {barcode} is on hold', { barcode }))
1641                                 .append(' ', button);
1642                           } else {
1643                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1644                           }
1645                       } else if ( data.status === 404 ) {
1646                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1647                       } else if ( data.status === 400 ) {
1648                           var response = data.responseJSON;
1649                           if ( response.error_code === "failed_nesting" ) {
1650                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' is a bundle and bundles cannot be nested").format(barcode)+'</div>');
1651                           } else {
1652                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details.")+'</div>');
1653                           }
1654                       } else {
1655                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details.")+'</div>');
1656                       }
1657                       $('#external_id').val('').focus();
1658                   });
1659             }
1660
1661             $("#addToBundleForm").submit(function(event) {
1662                   /* stop form from submitting normally */
1663                   event.preventDefault();
1664
1665                   const url = this.action;
1666                   const data = { external_id: this.elements.external_id.value };
1667
1668                   addToBundle(url, data);
1669             });
1670
1671             $("#addToBundleModal").on("hidden.bs.modal", function(e){
1672                 if ( bundle_changed ) {
1673                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1674                 }
1675                 bundle_form_active = 0;
1676                 bundle_changed = 0;
1677             });
1678
1679             $("#removeFromBundleModal").on("shown.bs.modal", function(e){
1680                 var button = $(e.relatedTarget);
1681                 var item_id = button.data('item');
1682                 $("#removeResult").replaceWith('<div id="removeResult"></div>');
1683                 $("#removeFromBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/');
1684                 $("#rm_external_id").focus();
1685                 bundle_changed = 0;
1686                 bundle_form_active = item_id;
1687             });
1688
1689             $("#removeFromBundleForm").submit(function(event) {
1690
1691                 /* stop form from submitting normally */
1692                 event.preventDefault();
1693
1694                 /* get the action attribute from the <form action=""> element */
1695                 var $form = $(this),
1696                 url = $form.attr('action');
1697
1698                 var barcode = $('#rm_external_id').val();
1699
1700                 /* Fetch itemnumber using rm_external_id */
1701                 var itemReq = $.get('/api/v1/items', { q: JSON.stringify({
1702                     external_id: barcode
1703                 }) }, null, "json");
1704
1705                 var itemnumber;
1706                 itemReq.done(function(data) {
1707                     if (data.length === 1) {
1708                         itemnumber = data[0].item_id;
1709
1710                         /* Remove link using fetch itemnumber */
1711                         var deleteReq = $.ajax( url + itemnumber, {
1712                             type : 'DELETE'
1713                         });
1714
1715                         /* Report the results */
1716                         deleteReq.done(function(data) {
1717                             var barcode = $('#rm_external_id').val();
1718                             $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-success">'+_("Success: Removed '%s'").format(barcode)+'</div>');
1719                             $('#rm_external_id').val('').focus();
1720                             bundle_changed = 1;
1721                         });
1722                         deleteReq.fail(function(data) {
1723                             var barcode = $('#rm_external_id').val();
1724                             if ( data.status === 409 ) {
1725                                 var response = data.responseJSON;
1726                                 if (response.error_code === 'bundle_checkout_out') {
1727                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
1728                                 } else if ( response.key === "PRIMARY" ) {
1729                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1730                                 } else {
1731                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1732                                 }
1733                             } else if ( data.status === 404 ) {
1734                                 $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1735                             } else {
1736                                 $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1737                             }
1738                             $('#rm_external_id').val('').focus();
1739                         });
1740                     } else {
1741                         $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Barcode matched more than one item '%s'").format(barcode)+'</div>');
1742                     }
1743                 });
1744                 itemReq.fail(function(data) {
1745                      $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Item not found '%s'").format(barcode)+'</div>');
1746                     $('#rm_external_id').val('').focus();
1747
1748                 });
1749             });
1750
1751             $("#removeFromBundleModal").on("hidden.bs.modal", function(e){
1752                 if ( bundle_changed ) {
1753                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1754                 }
1755                 bundle_form_active = 0;
1756                 bundle_changed = 0;
1757             });
1758             // End bundle handling
1759             [% END %]
1760
1761             let items_tab_ids = [ 'holdings', 'otherholdings' ];
1762             items_tab_ids.forEach( function( tab_id, index ) {
1763                 build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1764
1765                 [% IF bundlesEnabled %]
1766                 // Add event listener for opening and closing bundle details
1767                 $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1768                     var button = $(this);
1769                     var tr = button.closest('tr');
1770                     var dTable = button.closest('table').DataTable({ 'retrieve': true });
1771
1772                     let row = dTable.row( tr );
1773                     let data = row.data();
1774                     let itemnumber = data.item_id;
1775                     let duedate = (data.checkout&&data.checkout.due_date) || null;
1776
1777                     if ( row.child.isShown() ) {
1778                         // This row is already open - close it
1779                         row.child.hide();
1780                         tr.removeClass('shown');
1781                         button.removeClass('active');
1782                     }
1783                     else {
1784                         // Open this row
1785                         createChild(row, itemnumber, duedate);
1786                         tr.addClass('shown');
1787                         button.addClass('active');
1788                     }
1789                 } );
1790                 [% END %]
1791             });
1792
1793             [% IF Koha.Preference('AcquisitionDetails') %]
1794                 var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
1795                 var acquisitiondetails_table = KohaTable("orders", {
1796                     "dom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
1797                     "paginate": false,
1798                     "autoWidth": false,
1799                     "order": [[ 4, "desc" ]],
1800                 }, table_settings);
1801             [% END %]
1802
1803             [% IF suggestions.count %]
1804                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
1805                     "columnDefs": [
1806                         { "orderable": false, "searchable":  false, "targets": [ 'NoSort' ] },
1807                         { "type": "anti-the", "targets":  [ "anti-the" ] }
1808                     ],
1809                     "pagingType": "full"
1810                 }));
1811             [% END %]
1812
1813         });
1814
1815         [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
1816             $(document).ready(function() {
1817                 var search_index = localStorage.getItem("cat_search_pulldown_selection");
1818                 var search_value = localStorage.getItem("searchbox_value");
1819                 if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
1820                 if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
1821             });
1822         [% END %]
1823
1824         [% IF Koha.Preference('EnableItemGroups') %]
1825             // Load item groups table
1826             var itemGroupsTable = $("#items-group-table").kohaTable({
1827                 autoWidth: false,
1828                 dom: '<"top pager"ilp>t<"bottom pager"ip>r',
1829                 columns: [
1830                     {
1831                         data: "display_order",
1832                         title: _("Display order"),
1833                         searchable: true,
1834                         orderable: true,
1835                     },
1836                     {
1837                         data: "description",
1838                         title: _("Description"),
1839                         searchable: true,
1840                         orderable: true,
1841                     },
1842                     {
1843                         data: function( oObj ) {
1844                             [% IF CAN_user_editcatalogue_manage_item_groups %]
1845                                 return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
1846                                     <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
1847                                 </button>`
1848                                 + '&nbsp'
1849                                 + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
1850                                     <i class='fa fa-trash-can'></i> ${('Delete')}
1851                                 </button>`;
1852                             [% ELSE %]
1853                                 return "";
1854                             [% END %]
1855                         },
1856                         searchable: false,
1857                         orderable: false,
1858                     },
1859                 ],
1860                 paginate: false,
1861                 ajax: { url: `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1` },
1862             });
1863
1864             // Create new item groups
1865             $('.item-group-create').on('click', function(){
1866                 $('#modal-item-group-create-form-description').val("");
1867                 $('#modal-item-group-create-submit').removeAttr('disabled');
1868                 $('#modal-item-group-create').modal('show');
1869             });
1870
1871             $("#modal-item-group-create-form").validate({
1872                 submitHandler: function(form) {
1873                     $.ajax({
1874                         url: `/api/v1/biblios/${biblionumber}/item_groups`,
1875                         headers: { "x-koha-embed": "items" },
1876                         success: function(item_groups){
1877                             $('#modal-item-group-create-submit').attr('disabled', 'disabled');
1878
1879                             var settings = {
1880                               "url": `/api/v1/biblios/${biblionumber}/item_groups`,
1881                               "method": "POST",
1882                               "headers": {
1883                                 "Content-Type": "application/json"
1884                               },
1885                               "data": JSON.stringify(
1886                                   {
1887                                       "description": $("#modal-item-group-create-form-description").val(),
1888                                       "display_order": $("#modal-item-group-create-form-display_order").val(),
1889                                   }
1890                               ),
1891                             };
1892
1893                             $.ajax(settings)
1894                             .done(function (response) {
1895                                 $('#item-group-add-form-select').append($('<option>', {
1896                                     value: response.item_group_id,
1897                                     text: response.description
1898                                 }));
1899
1900                                 $('#modal-item-group-create').modal('hide');
1901                                 if ( item_groups.length == 0 ) {
1902                                     // This bib has no previous item groups, reload the page
1903                                     window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
1904                                 } else {
1905                                     // Has other item groups, just reload the table
1906                                     itemGroupsTable.api().ajax.reload();
1907                                 }
1908                             })
1909                             .fail(function(err) {
1910                                 var message = err.responseJSON.error;
1911                                 alert(message);
1912                             });
1913                         }
1914                     });
1915                 }
1916             });
1917
1918             $('#modal-item-group-create').on('shown.bs.modal', function () {
1919                 $('#modal-item-group-create-form-description').focus();
1920             })
1921
1922             // Edit existing item groups
1923             $('body').on( 'click', '.item-group-edit', function(){
1924                 const item_group_id = $(this).data('item-group-id');
1925                 const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
1926                 $.get( url, function( data ) {
1927                     $('#modal-item-group-edit-form-description').val( data.description );
1928                     $('#modal-item-group-edit-form-display_order').val( data.display_order );
1929                     $('#modal-item-group-edit-submit').data('item-group-id', item_group_id );
1930                     $('#modal-item-group-edit-submit').removeAttr('disabled');
1931                     $('#modal-item-group-edit').modal('show');
1932                 });
1933             });
1934
1935             $("#modal-item-group-edit-form").validate({
1936                 submitHandler: function(form) {
1937                     $('#modal-item-group-edit-submit').attr('disabled', 'disabled');
1938
1939                     const item_group_id = $('#modal-item-group-edit-submit').data('item-group-id');
1940                     const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
1941
1942                     var settings = {
1943                       "url": url,
1944                       "method": "PUT",
1945                       "headers": {
1946                         "Content-Type": "application/json"
1947                       },
1948                       "data": JSON.stringify(
1949                           {
1950                               "description": $("#modal-item-group-edit-form-description").val(),
1951                               "display_order": $("#modal-item-group-edit-form-display_order").val(),
1952                           }
1953                       ),
1954                     };
1955
1956                     $.ajax(settings)
1957                     .done(function (response) {
1958                         $('#modal-item-group-edit').modal('hide');
1959                         itemGroupsTable.api().ajax.reload();
1960                     })
1961                     .fail(function(err) {
1962                         var message = err.responseJSON.error;
1963                         alert(message);
1964                     });
1965                 }
1966             });
1967
1968             $('#modal-item-group-edit').on('shown.bs.modal', function () {
1969                 $('#modal-item-group-edit-form-description').focus();
1970             })
1971
1972             // Delete existing item groups
1973             $('body').on( 'click', '.item-group-delete', function(){
1974                 const item_group_id = $(this).data('item-group-id');
1975                 $('#modal-item-group-delete-submit').data('item-group-id', item_group_id );
1976                 $('#modal-item-group-delete-submit').removeAttr('disabled');
1977                 $('#modal-item-group-delete').modal('show');
1978             });
1979             $("#modal-item-group-delete-submit").on('click', function(){
1980                 $('#modal-item-group-delete-submit').attr('disabled', 'disabled');
1981                 const item_group_id = $("#modal-item-group-delete-submit").data('item-group-id');
1982
1983                 $.ajax({
1984                     url: `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
1985                     headers: { "x-koha-embed": "items" },
1986                     success: function(item_group_data){
1987                         $.ajax({
1988                           "url": `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
1989                           "method": "DELETE",
1990                         })
1991                         .done(function (response) {
1992                             $('#modal-item-group-delete').modal('hide');
1993                             $(`#item-group-add-form-select option[value='${item_group_id}']`).remove();
1994                             if ( item_group_data.items === null ) {
1995                                 // No items for this item group, we can just refresh the table
1996                                 itemGroupsTable.api().ajax.reload();
1997                             } else {
1998                                 // This item group had items attached to it, we need to reload the page
1999                                 window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2000                             }
2001                         })
2002                         .fail(function(err) {
2003                             var message = err.responseJSON.error;
2004                             alert(message);
2005                         });
2006                     }
2007                 });
2008             });
2009
2010             // Add item(s) to a item group
2011             $('.itemselection_action_item_group_set').on('click', function(){
2012                 $('#modal-item-group-set').modal('show');
2013             });
2014
2015             $("#modal-item-group-set-form").validate({
2016                 submitHandler: function(form) {
2017                     $('#modal-item-group-set-submit').attr('disabled', 'disabled');
2018
2019                     const item_group_id = $('#item-group-add-form-select').val();
2020
2021                     let itemnumbers = new Array();
2022                     $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2023                         const itemnumber = $(this).val();
2024                         itemnumbers.push( itemnumber );
2025                     });
2026                     if (itemnumbers.length > 0) {
2027                         let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2028                         url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2029                         url += '&biblionumber=[% biblionumber | uri %]';
2030                         url += `&item_group_id=${item_group_id}`;
2031
2032                         window.location.replace(url);
2033                     }
2034
2035                     $('#modal-item-group-set').modal('hide');
2036                 }
2037             });
2038
2039             // Remove item(s) from an item group
2040             $('.itemselection_action_item_group_unset').on('click', function(){
2041                 $('#modal-item-group-unset').modal('show');
2042             });
2043
2044             $("#modal-item-group-unset-submit").on('click', function(){
2045                 $('#modal-item-group-unset-submit').attr('disabled', 'disabled');
2046
2047                 let itemnumbers = new Array();
2048                 $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2049                     const itemnumber = $(this).val();
2050                     itemnumbers.push( itemnumber );
2051                 });
2052                 if (itemnumbers.length > 0) {
2053                     let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2054                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2055                     url += '&biblionumber=[% biblionumber | uri %]';
2056
2057                     window.location.replace(url);
2058                 }
2059
2060                 $('#modal-item-group-unset').modal('hide');
2061
2062             });
2063         [% END %]
2064
2065     </script>
2066
2067     [%# The following PROCESS needs: %]
2068     [%# can_edit_items_from item_type_image_locations %]
2069     [% PROCESS build_items_table_js biblio => biblio %]
2070
2071     [% CoverImagePlugins | $raw %]
2072 [% END %]
2073 [% INCLUDE 'intranet-bottom.inc' %]