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