Bug 27576: Don't show import recordds table after cleaning a batch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / manage-marc-import.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
7     [% IF ( import_batch_id ) %]
8         &rsaquo; Batch [% import_batch_id | html %]
9     [% END %]
10 </title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("css/humanmsg.css") | $raw %]
13 <style>
14     #jobpanel,#jobstatus,#jobfailed { display : none; }
15     span.change-status { font-style:italic; color:#666; display:none; }
16 </style>
17 </head>
18
19 <body id="tools_manage-marc-import" class="tools">
20     [% INCLUDE 'header.inc' %]
21     [% INCLUDE 'cat-search.inc' %]
22
23     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
24         [% IF ( import_batch_id ) %]
25             &rsaquo;
26             <a href="[% script_name | url %]">Manage staged MARC records</a>
27             &rsaquo; Batch [% import_batch_id | html %]
28         [% ELSE %]
29             &rsaquo; Manage staged MARC records
30         [% END %]
31     </div>
32
33     <div class="main container-fluid">
34         <div class="row">
35             <div class="col-sm-10 col-sm-push-2">
36                 <main>
37                     <h1>Manage staged MARC records
38                         [% IF ( import_batch_id ) %]
39                             &rsaquo; Batch [% import_batch_id | html %]
40                         [% END %]
41                     </h1>
42
43                     [% IF ( label_batch_msg ) %]
44                         [% IF ( alert ) %]
45                             <div class="alert">
46                         [% ELSE %]
47                             <div class="dialog message">
48                         [% END %]
49                             <p><strong>
50                                 [% IF ( label_batch_msg == "error" ) %]
51                                     Error attempting to create label batch. Please ask your system administrator to check the log for more details.
52                                 [% ELSE %]
53                                     Label <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% label_batch_msg | uri %]" >batch #[% label_batch_msg | html %]</a> created.
54                                 [% END %]
55                             </strong></p>
56                         </div>
57                     [% END %]
58
59                     [% IF ( did_clean ) %]
60                         <div class="dialog message">Cleaned import batch #[% import_batch_id | html %]</div>
61                     [% END %]
62
63                     [% IF ( did_delete ) %]
64                         <div class="dialog message">Import batch deleted successfully</div>
65                     [% END %]
66
67                     [% UNLESS ( batch_list ) %]
68                         [% UNLESS ( batch_info ) %]
69                             <div class="dialog message">
70                                 <p>No records have been staged.</p>
71                                 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
72                             </div>
73                         [% END %]
74                     [% END %]
75
76                     [% IF ( batch_info ) %]
77                         [% IF ( can_commit ) %]
78                             <form action="[% script_name | html %]" method="post">
79                                 <input type="hidden" name="op" value="redo-matching" />
80                                 <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
81                                 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id | html %]" />
82                         [% END %]
83
84                         [% IF ( rematch_attempted ) %]
85                             [% IF ( rematch_failed ) %]
86                                 <div class="dialog alert">Failed to apply different matching rule</div>
87                             [% ELSE %]
88                                 <div class="dialog message">Applied different matching rule. Number of records matched now
89                                     [% num_with_matches | html %]
90                                 </div>
91                             [% END %]
92                         [% END %]
93
94                         [% IF ( changed_overlay_action ) %]
95                             <div class="dialog message">Changed action if matching record found</div>
96                         [% END %]
97
98                         [% IF ( changed_nomatch_action ) %]
99                             <div class="dialog message">Changed action if no match found</div>
100                         [% END %]
101
102                         [% IF ( changed_item_action ) %]
103                             <div class="dialog message">Changed item processing option</div>
104                         [% END %]
105
106                         <fieldset class="rows" id="staged-record-matching-rules">
107                             <ol>
108                                 <li><span class="label">File name:</span> [% file_name | html %]</li>
109                                 <li><span class="label">Profile:</span> [% IF (profile) %][% profile | html %][% ELSE %](none)[% END %]</li>
110                                 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments | html %][% ELSE %](none)[% END %]</li>
111                                 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
112                                 <li><span class="label">Staged:</span> [% upload_timestamp | $KohaDates with_hours=1 %]</li>
113                                 <li><span class="label">Status:</span>
114                                     [% IF ( import_status == 'cleaned' ) %]
115                                         Cleaned
116                                     [% ELSIF ( import_status == 'imported' ) %]
117                                         Imported
118                                     [% ELSIF ( import_status == 'importing' ) %]
119                                         Importing
120                                     [% ELSIF ( import_status == 'reverted' ) %]
121                                         Reverted
122                                     [% ELSIF ( import_status == 'reverting' ) %]
123                                         Reverting
124                                     [% ELSIF ( import_status == 'staged' ) %]
125                                         Staged
126                                     [% ELSE %]
127                                         [% import_status | html %]
128                                     [% END %]
129                                 </li>
130                                 <li>
131                                     [% IF ( can_commit ) %]
132                                         <label for="new_matcher_id">Matching rule applied:</label>
133                                         <select name="new_matcher_id" id="new_matcher_id">
134                                             <option value="">Do not look for matching records</option>
135                                             [% FOREACH available_matcher IN available_matchers %]
136                                                 [% IF ( available_matcher.selected ) %]
137                                                     <option value="[% available_matcher.matcher_id | html %]" selected="selected">
138                                                         [% available_matcher.code | html %] ([% available_matcher.description | html %])
139                                                     </option>
140                                                 [% ELSE %]
141                                                     <option value="[% available_matcher.matcher_id | html %]">
142                                                         [% available_matcher.code | html %] ([% available_matcher.description | html %])
143                                                     </option>
144                                                 [% END %]
145                                             [% END %]
146                                         </select>
147                                         <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>
148                                     [% ELSE %]
149                                         <span class="label">Matching rule applied</span>
150                                         [% IF ( current_matcher_id ) %]
151                                             [% current_matcher_code | html %] ([% current_matcher_description | html %])
152                                         [% ELSE %]
153                                             No matching rule in effect
154                                         [% END %]
155                                     [% END %]
156                                 </li>
157                                 <li>
158                                     [% IF ( can_commit ) %]
159                                         <label for="overlay_action">Action if matching record found:</label>
160                                         [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
161                                     [% ELSE %]
162                                         <span class="label">Action if matching record found:</span>
163                                         [% IF ( overlay_action == 'replace' ) %]
164                                             Replace existing record with incoming record
165                                         [% ELSIF ( overlay_action == 'create_new' ) %]
166                                             Add incoming record
167                                         [% ELSIF ( overlay_action == 'ignore' ) %]
168                                             Ignore incoming record (its items may still be processed)
169                                         [% ELSE %]
170                                             [% overlay_action | html %]
171                                         [% END %]
172                                     [% END %]
173                                 </li>
174                                 <li>
175                                     [% IF ( can_commit ) %]
176                                         <label for="nomatch_action">Action if no match found:</label>
177                                         [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
178                                     [% ELSE %]
179                                         <span class="label">Action if no match found:</span>
180                                         [% IF ( nomatch_action == 'create_new' ) %]
181                                             Add incoming record
182                                         [% ELSIF ( nomatch_action == 'ignore' ) %]
183                                             Ignore incoming record (its items may still be processed)
184                                         [% ELSE %]
185                                             [% nomatch_action | html %]
186                                         [% END %]
187                                     [% END %]
188                                 </li>
189                                 [% IF ( record_type == 'biblio' ) %]
190                                     <li>
191                                         [% IF ( can_commit ) %]
192                                             <label for="item_action">Item processing:</label>
193                                             [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
194                                         [% ELSE %]
195                                             <span class="label">Item processing:</span>
196                                             [% IF ( item_action == 'always_add' ) %]
197                                                 Always add items
198                                             [% ELSIF ( item_action == 'add_only_for_matches' ) %]
199                                                 Add items only if matching bib was found
200                                             [% ELSIF ( item_action == 'add_only_for_new' ) %]
201                                                 Add items only if no matching bib was found
202                                             [% ELSIF ( item_action == 'ignore' ) %]
203                                                 Ignore items
204                                             [% ELSE %]
205                                                 [% item_action | html %]
206                                             [% END %]
207                                         [% END %]
208                                     </li>
209                                 [% END %]
210                             </ol>
211                             [% IF ( can_commit ) %]
212                                     <fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset>
213                                 </form>
214                             [% END %]
215                         </fieldset> <!-- /#staged-record-matching-rules -->
216
217                         <div>
218                             [% IF ( can_commit ) %]
219                                 <form action="[% script_name | html %]" method="post" id="import_batch_form">
220                                     <input type="hidden" name="op" value="commit-batch" />
221                                     <input type="hidden" name="runinbackground" value="" />
222                                     <input type="hidden" name="completedJobID" value="" />
223                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
224                                     <fieldset class="action">
225                                         [% IF ( record_type != 'auth' ) %]
226                                             Add new bibliographic records into this framework:
227                                             <select name="framework" id="frameworks">
228                                                 <option value="">Default</option>
229                                                 [% FOREACH framework IN frameworks %]
230                                                     <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
231                                                 [% END %]
232                                             </select>
233                                         [% END %]
234                                         <br />
235                                         <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
236                                     </fieldset>
237                                 </form> <!-- /#import_batch_form -->
238                                 <div id="jobpanel">
239                                     <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
240                                     <div id="jobfailed"></div>
241                                 </div>
242                             [% END # /IF can_commit %]
243                             [% IF ( can_revert ) %]
244                                 <form action="[% script_name | html %]" method="post" id="revert_batch_form">
245                                     <input type="hidden" name="op" value="revert-batch" />
246                                     <input type="hidden" name="runinbackground" value="" />
247                                     <input type="hidden" name="completedJobID" value="" />
248                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
249                                     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
250                                 </form>
251                                 <div id="jobpanel">
252                                     <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
253                                     <div id="jobfailed"></div>
254                                 </div>
255                             [% END # /IF can_revert %]
256                         </div>
257
258                         [% IF ( did_commit ) %]
259                             <div class="dialog message">Completed import of records</div>
260                             <table>
261                                 <tr>
262                                     <td>Number of records added</td>
263                                     <td>[% num_added | html %]</td>
264                                 </tr>
265                                 <tr>
266                                     <td>Number of records updated</td>
267                                     <td>[% num_updated | html %]</td>
268                                 </tr>
269                                 <tr>
270                                     <td>Number of records ignored</td>
271                                     <td>[% num_ignored | html %]</td>
272                                 </tr>
273                                 [% IF ( record_type == 'biblio' ) %]
274                                     <tr>
275                                         <td>Number of items added</td>
276                                         <td>[% num_items_added | html %]</td>
277                                     </tr>
278                                     <tr>
279                                         <td>Number of items replaced</td>
280                                         <td>[% num_items_replaced | html %]</td>
281                                     </tr>
282                                     <tr>
283                                         <td>Number of items ignored because of duplicate barcode</td>
284                                         <td>[% num_items_errored | html %]</td>
285                                     </tr>
286                                 [% END %]
287                             </table>
288                         [% END #/ IF did_commit %]
289
290                         [% IF ( did_revert ) %]
291                             <div class="dialog message">Success: Import reversed</div>
292                             <table>
293                                 <tr>
294                                     <td>Number of records deleted</td>
295                                     <td>[% num_deleted | html %]</td>
296                                 </tr>
297                                 [% IF ( record_type == 'biblio' ) %]
298                                     <tr>
299                                         <td>Number of items deleted</td>
300                                         <td>[% num_items_deleted | html %]</td>
301                                     </tr>
302                                     <tr>
303                                         <td>Number of records not deleted due to items on loan</td>
304                                         <td>[% num_errors | html %]</td>
305                                     </tr>
306                                 [% END %]
307                                 <tr>
308                                     <td>Number of records changed back</td>
309                                     <td>[% num_reverted | html %]</td>
310                                 </tr>
311                                 <tr>
312                                     <td>Number of records ignored</td>
313                                     <td>[% num_ignored | html %]</td>
314                                 </tr>
315                             </table>
316                         [% END  # /IF did_revert%]
317
318                     [% END # /IF batch_info %]
319
320                     <br style="clear:both;" />
321
322                     [% IF ( batch_list ) %]
323                         [% IF ( pages ) %]
324                             [% PROCESS pagination %]
325                         [% END %]
326
327                         <table>
328                             <tr>
329                                 <th>#</th>
330                                 <th>File name</th>
331                                 <th>Profile</th>
332                                 <th>Comments</th>
333                                 <th>Type</th>
334                                 <th>Status</th>
335                                 <th>Staged</th>
336                                 <th># Records</th>
337                                 <th># Items</th>
338                                 <th>Action</th>
339                             </tr>
340                             [% FOREACH batch_lis IN batch_list %]
341                                 <tr>
342                                     <td>[% batch_lis.import_batch_id | html %]</td>
343                                     <td><a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]">[% batch_lis.file_name | html %]</a></td>
344                                     <td>[% batch_lis.profile | html %]</td>
345                                     <td>[% batch_lis.comments | html %]</td>
346                                     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
347                                     <td>
348                                         [% IF ( batch_lis.import_status == 'cleaned' ) %]
349                                             Cleaned
350                                         [% ELSIF ( batch_lis.import_status == 'imported' ) %]
351                                             Imported
352                                         [% ELSIF ( batch_lis.import_status == 'importing' ) %]
353                                             Importing
354                                         [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
355                                             Reverted
356                                         [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
357                                             Reverting
358                                         [% ELSIF ( batch_lis.import_status == 'staged' ) %]
359                                             Staged
360                                         [% ELSE %]
361                                             [% batch_lis.import_status | html %]
362                                         [% END %]
363                                     </td>
364                                     <td>[% batch_lis.upload_timestamp | $KohaDates with_hours=1 %]</td>
365                                     <td>[% batch_lis.num_records | html %]</td>
366                                     <td>[% batch_lis.num_items | html %]
367                                         [% IF ( batch_lis.num_items && batch_lis.import_status == 'imported' ) %]
368                                             (<a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;op=create_labels">Create label batch</a>)
369                                         [% END %]
370                                     </td>
371                                     <td class="actions">
372                                         [% IF ( batch_lis.can_clean ) %]
373                                             <form method="post" action="[% batch_lis.script_name | html %]" name="clean_batch_[% batch_lis.import_batch_id | html %]" id="clean_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_clean">
374                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
375                                                 <input type="hidden" name="op" value="clean-batch" />
376                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
377                                             </form>
378                                         [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
379                                             <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id | html %]" id="delete_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_delete">
380                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
381                                                 <input type="hidden" name="op" value="delete-batch" />
382                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
383                                             </form>
384                                         [% END %]
385                                     </td>
386                                 </tr>
387                             [% END # /FOREACH batch_lis %]
388                         </table>
389
390                         [% IF ( pages ) %]
391                             [% PROCESS pagination %]
392                         [% END %]
393                     [% END # /IF batch_lis %]
394
395                     [% IF import_batch_id && !did_clean %]
396                         <table id="records-table">
397                             <thead>
398                                 <tr>
399                                     <th>#</th>
400                                     <th>Citation</th>
401                                     <th>Status</th>
402                                     <th>Match type</th>
403                                     <th>Match details</th>
404                                     <th><abbr title="Differences between the original bibliographic record and the imported">Diff</abbr></th>
405                                     <th>Record</th>
406                                 </tr>
407                             </thead>
408                         </table>
409
410                         <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
411                             <div class="modal-dialog modal-wide">
412                                 <div class="modal-content">
413                                     <div class="modal-header">
414                                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
415                                         <h3 id="marcPreviewLabel">MARC preview</h3>
416                                     </div>
417                                     <div class="modal-body">
418                                         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
419                                     </div>
420                                     <div class="modal-footer">
421                                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
422                                     </div>
423                                 </div>
424                             </div>
425                         </div> <!-- /#marcPreview -->
426                     [% END # /IF import_batch_id %]
427                 </main>
428
429             </div> <!-- /.col-sm-10.col-sm-push-2 -->
430             <div class="col-sm-2 col-sm-pull-10">
431                 <aside>
432                     [% INCLUDE 'tools-menu.inc' %]
433                 </aside>
434             </div> <!-- .col-sm-2.col-sm-pull-10 -->
435         </div> <!-- /.row -->
436
437 [% MACRO jsinclude BLOCK %]
438     [% Asset.js("js/tools-menu.js") | $raw %]
439     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
440     [% Asset.js("js/background-job-progressbar.js") | $raw %]
441     [% INCLUDE 'datatables.inc' %]
442     <script>
443         $(document).ready(function() {
444             $("#staged-record-matching-rules select").change(function() {
445                 var str = $(this).attr("id");
446                 $("#reset_" + str).parent().show();
447             });
448             $("a.reset").click(function() {
449                 var str = $(this).attr("id");
450                 str = str.replace("reset_", "")
451                 $("#" + str + " option[selected='selected']").attr("selected", "selected");
452                 $(this).parent().hide();
453             });
454
455             [% IF import_batch_id %]
456                 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
457                     "bAutoWidth": false,
458                     "bFilter": false,
459                     "bProcessing": true,
460                     "bServerSide": true,
461                     "sAjaxSource": 'batch_records_ajax.pl',
462                     "sPaginationType": "full_numbers",
463                     "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
464                     "aoColumns": [
465                         { "mDataProp": "import_record_id" },
466                         { "mDataProp": "citation" },
467                         { "mDataProp": "status" },
468                         { "mDataProp": "overlay_status" },
469                         { "mDataProp": "match_citation" },
470                         { "mDataProp": "diff_url" },
471                         { "mDataProp": "matched" }
472                     ],
473                     "fnServerData": function(sSource, aoData, fnCallback) {
474                         aoData.push({ "name": "import_batch_id", "value": [% import_batch_id | html %] });
475
476                         $.ajax({
477                             'dataType': 'json',
478                             'type': 'POST',
479                             'url': sSource,
480                             'data': aoData,
481                             'success': function(json) {
482                                 fnCallback(json);
483                             }
484                         });
485                     },
486                     "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
487                         [% IF(record_type == 'auth') %]
488                             var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
489                         [% ELSE %]
490                             var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
491                         [% END %]
492
493                         var additional_details = "";
494                         if( aData['author'] ){
495                             additional_details += " " + aData['author'] + " ";
496                         }
497
498                         if( aData['isbn'] ){
499                             additional_details += " (" + aData['isbn'] + ") ";
500                         }
501
502                         if( aData['issn'] ){
503                             additional_details += " (" + aData['issn'] + ") ";
504                         }
505
506                         $('td:eq(1)', nRow).html(
507                             '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a> ' + additional_details
508                         );
509
510                         $('td:eq(2)', nRow).html(
511                             aData['status'] == 'imported' ? _("Imported") :
512                             aData['status'] == 'ignored' ? _("Ignored") :
513                             aData['status'] == 'reverted' ? _("Reverted") :
514                             aData['status'] == 'staged' ? _("Staged") :
515                             aData['status'] == 'error' ? _("Error") :
516                             aData['status']
517                         );
518
519                         $('td:eq(3)', nRow).html(
520                             aData['overlay_status'] == 'no_match' ? _("No match") :
521                             aData['overlay_status'] == 'match_applied' ? _("Match applied") :
522                             aData['overlay_status'] == 'auto_match' ? _("Match found") :
523                             aData['overlay_status']
524                         );
525
526                         if (aData['match_id']) {
527                             [% IF(record_type == 'auth') -%]
528                                 var matching_msg = _("Matches authority %s (score=%s):%s");
529                             [%- ELSE -%]
530                                 var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
531                             [%- END %]
532                             $('td:eq(4)', nRow).html(
533                                 matching_msg.format(aData['match_id'], aData['score'],
534                                     '<a target="_blank" href="' + record_details_url
535                                     + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
536                             );
537                         }
538                         if (aData['diff_url']) {
539                             $('td:eq(5)', nRow).html(
540                                 '<a href="' + aData['diff_url'] + '">' + _("View") + '</a>'
541                             );
542                         }
543                         $('td:eq(6)', nRow).html(
544                             '<a target="_blank" href="' + record_details_url
545                             + aData['matched'] + '">' + aData['matched'] + '</a>'
546                         );
547                     },
548                 }));
549                 $("#import_batch_form").on("submit", function() {
550                     return submitBackgroundJob(document.getElementById("import_batch_form"));
551                 });
552                 $("#revert_batch_form").on("submit", function() {
553                     return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")) && submitBackgroundJob(document.getElementById("revert_batch_form"));
554                 });
555             [% END %]
556
557             $("body").on("click", ".previewMARC", function(e) {
558                 e.preventDefault();
559                 var ltitle = $(this).text();
560                 var page = $(this).attr("href");
561                 $("#marcPreviewLabel").text(ltitle);
562                 $("#marcPreview .modal-body").load(page + " table");
563                 $('#marcPreview').modal({ show: true });
564             });
565             $("#marcPreview").on("hidden.bs.modal", function() {
566                 $("#marcPreviewLabel").html("");
567                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
568             });
569             $(".batch_form").on("submit", function() {
570                 if ($(this).hasClass("batch_delete")) {
571                     return confirm(_("Are you sure you want to permanently delete this batch?"));
572                 } else {
573                     return confirm(_("Clear all reservoir records staged in this batch?  This cannot be undone."));
574                 }
575             });
576         });
577
578     </script>
579 [% END %]
580 [% INCLUDE 'intranet-bottom.inc' %]
581 [% BLOCK pagination %]
582     <nav>
583         <ul class="pagination">
584             [% FOREACH page IN pages %]
585                 [% IF ( page.current_page && page.page_number > 1 ) %]
586                     <li><a href="[% page.script_name | url %]?offset=0" class="nav"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li>
587                     <li><a href="[% page.script_name | url %]?offset=[% offset - results_per_page | uri %]"><i class="fa fa-fw fa-angle-left"></i> Previous</a></li>
588                 [% END %]
589             [% END %]
590             [% FOREACH page IN pages %]
591                 [% IF ( page.current_page ) %]
592                     [% SET current_page = page.page_number %]
593                     <li class="active"><span class="current">[% page.page_number | html %]</span></li>
594                 [% ELSE %]
595                     <li><a class="nav" href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a></li>
596                 [% END %]
597             [% END %]
598             [% IF ( current_page < pages.size() ) %]
599                 <li>
600                     <a href="[% page.script_name | url %]?offset=[% offset + results_per_page | uri %]" class="nav">Next <i class="fa fa-fw fa-angle-right"></i></a>
601                 </li>
602                 <li>
603                     <a href="[% page.script_name | url %]?offset=[% ( results_per_page * ( pages.size - 1 ) ) | uri %]" class="nav">Last <i class="fa fa-fw fa-angle-double-right"></i></a>
604                 </li>
605             [% END %]
606         </ul>
607     </nav>
608 [% END %]