Bug 35241: Fix markup errors in point of sale template
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batch_delete_records.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% PROCESS 'authorities-search-results.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8     [% IF op == 'list' %]
9         [% t("Confirm selection") | html %] &rsaquo;
10     [% END %]
11     [% IF op == 'enqueued' %]
12         [% t("Job enqueued") | html %] &rsaquo;
13     [% END %]
14     [% t("Batch record deletion") | html %] &rsaquo;
15     [% t("Cataloging") | html %] &rsaquo;
16     [% t("Koha") | html %]
17 [% END %]</title>
18 [% INCLUDE 'doc-head-close.inc' %]
19 </head>
20
21 <body id="tools_batch_delete_records" class="tools">
22 [% WRAPPER 'header.inc' %]
23     [% INCLUDE 'cat-search.inc' %]
24 [% END %]
25
26 [% WRAPPER 'sub-header.inc' %]
27     [% WRAPPER breadcrumbs %]
28         [% WRAPPER breadcrumb_item %]
29             <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
30         [% END %]
31         [% IF op == 'list' || op == 'enqueued' %]
32             [% WRAPPER breadcrumb_item %]
33                 <a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a>
34             [% END %]
35         [% END %]
36         [% IF op == 'list' %]
37             [% WRAPPER breadcrumb_item bc_active= 1 %]
38                 [% t("Confirm selection") | html %]
39             [% END %]
40         [% ELSIF OP == 'enqueued' %]
41             [% WRAPPER breadcrumb_item bc_active= 1 %]
42                 [% t("Job enqueued") | html %]
43             [% END %]
44         [% ELSE %]
45             [% WRAPPER breadcrumb_item bc_active= 1 %]
46                 <span>Batch record deletion</span>
47             [% END %]
48         [% END %]
49     [% END #/ WRAPPER breadcrumbs %]
50 [% END #/ WRAPPER sub-header.inc %]
51
52 <div class="main container-fluid">
53     <div class="row">
54         <div class="col-sm-10 col-sm-push-2">
55             <main>
56
57   <h1>Batch record deletion</h1>
58   [% FOREACH message IN messages %]
59     [% IF message.type == 'success' %]
60       <div class="dialog message">
61     [% ELSIF message.type == 'warning' %]
62       <div class="dialog alert">
63     [% ELSIF message.type == 'error' %]
64       <div class="dialog alert" style="margin:auto;">
65     [% END %]
66     [% IF message.code == 'biblio_not_exists' %]
67       <span>The biblionumber [% message.biblionumber | html %] does not exist in the database.</span>
68     [% ELSIF message.code == 'authority_not_exists' %]
69       <span>The authority ID [% message.authid | html %] does not exist in the database.</span>
70     [% ELSIF message.code == 'cannot_enqueue_job' %]
71         <span>Cannot enqueue this job.</span>
72     [% ELSIF message.code == 'biblio_not_exists' %]
73         <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
74     [% ELSIF message.code == 'authority_not_exists' %]
75         <span>Authority record [% message.authid | html %] does not exist in the database.</span>
76     [% END %]
77
78     [% IF message.error %]
79       <span>(The error was: [% message.error | html %], see the Koha log file for more information).</span>
80     [% END %]
81     </div>
82   [% END %]
83   [% IF op == 'form' %]
84     <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
85       <fieldset class="rows">
86         <legend>Record type</legend>
87         <ol>
88           <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
89           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
90         </ol>
91       </fieldset>
92
93         [% WRAPPER tabs id= "batch_del_form" %]
94             [% WRAPPER tabs_nav %]
95                 [% WRAPPER tab_item tabname= "uploadfile_tab" bt_active= 1 %] <span>Upload a file</span> [% END %]
96                 [% IF lists.count %]
97                     [% WRAPPER tab_item tabname= "shelves_tab" %] <span>Select a list of records</span> [% END %]
98                 [% END %]
99                 [% WRAPPER tab_item tabname= "enterlist_tab" %] <span>Enter a list of record numbers</span> [% END %]
100             [% END # /WRAPPER tabs_nav %]
101
102             [% WRAPPER tab_panels %]
103                 [% WRAPPER tab_panel tabname="uploadfile_tab" bt_active= 1 %]
104                     <fieldset class="rows">
105                         <ol>
106                         <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
107                         </ol>
108                     </fieldset>
109                 [% END # /WRAPPER tab_panel %]
110
111                 [% IF lists.count %]
112                     [% WRAPPER tab_panel tabname="shelves_tab" %]
113                         <fieldset class="rows">
114                             <ol>
115                                 <li>
116                                     <label for="shelf_number">List: </label>
117                                     <select name="shelf_number" id="shelf_number">
118                                         <option value="">Select a list</option>
119                                         [% FOREACH list IN lists %]
120                                             <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
121                                         [% END %]
122                                     </select>
123                                 </li>
124                             </ol>
125                         </fieldset>
126                     [% END # /WRAPPER tab_panel %]
127                 [% END # /IF lists.count %]
128
129                 [% WRAPPER tab_panel tabname="enterlist_tab" %]
130                     <fieldset class="rows">
131                         <ol>
132                             <li>
133                                 <label for="recordnumber_list">IDs: </label>
134                                 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
135                                 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
136                             </li>
137                         </ol>
138                     </fieldset>
139                 [% END # /WRAPPER tab_panel %]
140             [% END # /WRAPPER tab_panels %]
141         [% END # /WRAPPER tabs %]
142
143       <fieldset class="action">
144         <input type="hidden" name="op" value="list" />
145         <input type="submit" class="btn btn-primary" value="Continue" />
146         <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a>
147       </fieldset>
148     </form>
149   [% ELSIF op == 'list' %]
150     [% IF records %]
151       [% IF recordtype == 'biblio' %]
152         <div class="btn-toolbar selections-toolbar">
153           <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
154           | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
155           | <a id="selectwithoutitems" href="#">Select without items</a>
156           | <a id="selectnotreserved" href="#">Select without holds</a>
157           | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</a>
158         </div>
159
160         <div class="page-section">
161         <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
162           <table id="biblios" class="records">
163             <thead>
164               <tr>
165                 <th></th>
166                 <th>Biblionumber</th>
167                 <th>Title</th>
168                 <th>Items</th>
169                 <th>Holds</th>
170                 <th>Checkouts</th>
171                 <th>Subscriptions</th>
172               </tr>
173             </thead>
174             <tbody>
175               [% FOR biblio IN records %]
176                 <tr>
177                   <td><input type="checkbox" name="record_id" id="record_id_[% biblio.biblionumber | html %]" value="[% biblio.biblionumber | html %]" data-items="[% biblio.itemnumbers.size | html %]" data-issues="[% biblio.issues_count | html %]" data-reserves="[% biblio.holds_count | html %]" data-subscriptions="[% biblio.subscriptions_count | html %]" /></td>
178                   <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
179                   <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
180                   <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
181                   <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
182                   <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
183                   <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
184                 </tr>
185               [% END %]
186             </tbody>
187           </table>
188           <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected bibliographic records, attached subscriptions, existing holds, and attached items!</div>
189       [% ELSE %]
190         <div class="btn-toolbar selections-toolbar">
191           <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
192           | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
193           | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
194         </div>
195         <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
196           <table id="authorities" class="records">
197             <thead>
198               <tr>
199                 <th></th>
200                 <th>AuthID</th>
201                 <th>Summary</th>
202                 <th>Used in</th>
203               </tr>
204             </thead>
205             <tbody>
206               [% FOR authority IN records %]
207                 <tr>
208                   <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
209                   <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
210                   <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
211                   <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;idx=an,phr&amp;q=[% authority.authid | uri %]">[% authority.count_usage | html %] record(s)</a></td>
212                 </tr>
213               [% END %]
214             </tbody>
215           </table>
216           <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
217       [% END %]
218         <fieldset class="action">
219           <input type="hidden" name="op" value="delete" />
220           <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
221           <input type="submit" class="btn btn-primary" value="Delete selected records" />
222           <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
223         </fieldset>
224       </form>
225       </div>
226     [% ELSE %]
227       There are no record IDs defined.
228     [% END %]
229   [% ELSIF op == 'enqueued' %]
230     <div class="dialog message">
231         <h1>The job has been enqueued!</h1>
232         <p>It will be processed as soon as possible.</p>
233       <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a>
234       | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
235     </div>
236   [% ELSE %]
237     No action defined for the template.
238   [% END %]
239
240             </main>
241         </div> <!-- /.col-sm-10.col-sm-push-2 -->
242
243         <div class="col-sm-2 col-sm-pull-10">
244             <aside>
245                 [% INCLUDE 'cat-menu.inc' %]
246             </aside>
247         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
248      </div> <!-- /.row -->
249
250 [% MACRO jsinclude BLOCK %]
251     [% INCLUDE 'datatables.inc' %]
252     <script>
253         var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
254         $(document).ready(function() {
255
256             $("input[type='radio']").click(function() {
257                 if ($(this).attr('id') == 'authority_type') {
258                     $("a[href='#shelves_tab_panel']").parent().hide();
259                 } else if ($(this).attr('id') == 'biblio_type') {
260                     $("a[href='#shelves_tab_panel']").parent().show();
261                 }
262             });
263
264             $("#selectall").click(function(e){
265                 e.preventDefault();
266                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
267                     $(this).prop("checked", true);
268                 });
269             });
270
271             $("#clearall").click(function(e){
272                 e.preventDefault();
273                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
274                     $(this).prop("checked", false);
275                 });
276             });
277
278             $("#selectwithoutitems").click(function(e){
279                 e.preventDefault();
280                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
281                     if( $(this).data("items") == 0 ){
282                         $(this).prop("checked", true );
283                     } else {
284                         $(this).prop("checked", false );
285                     }
286                 });
287             });
288
289             $("#selectnotreserved").click(function(e){
290                 e.preventDefault();
291                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
292                     if( $(this).data("reserves") == 0 ){
293                         $(this).prop("checked", true );
294                     } else {
295                         $(this).prop("checked", false );
296                     }
297                 });
298             });
299
300             $("#selectwithoutsubscriptions").click(function(e){
301                 e.preventDefault();
302                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
303                     if( $(this).data("subscriptions") == 0 ){
304                         $(this).prop("checked", true );
305                     } else {
306                         $(this).prop("checked", false );
307                     }
308                 });
309             });
310
311             $("#clearlinkedtobiblio").click(function(e){
312                 e.preventDefault();
313                 $(".records input[type='checkbox']:not(:disabled)").each(function(){
314                     if( $(this).data("usage") == 0 ){
315                         $(this).prop("checked", true );
316                     } else {
317                         $(this).prop("checked", false );
318                     }
319                 });
320             });
321
322           $("#selectall").click();
323
324           //Show a red cross if a biblio cannot be deleted
325           [% IF recordtype == 'biblio' %]
326             $(".records input:checkbox[data-issues!='0']").each(function(){
327               $(this).parents('tr').find('td').css('background-color', '#ffff99')
328               $(this).replaceWith("<span class='error'><i class='fa fa-times fa-lg'></i></span>")
329               $(".records i").attr('title', MSG_CANNOT_BE_DELETED)
330             });
331           [% END %]
332
333           $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
334             "aoColumnDefs": [
335               { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
336               { "aTargets": [ 3, 4 ], "sType": "num-html" }
337             ],
338             "sDom": 't',
339             "aaSorting": [],
340             "bPaginate": false
341           }));
342
343           $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
344             "aoColumnDefs": [
345               { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
346               { "aTargets": [ 3 ], "sType": "num-html" }
347             ],
348             "sDom": 't',
349             "aaSorting": [],
350             "bPaginate": false
351           }));
352
353           $("#selectrecords").on("submit",function(){
354             var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
355             if (nb_checked == 0){
356               alert(_("No records have been selected."));
357               return false;
358             }
359           });
360
361           $("#selectauths").on("submit",function(){
362             var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
363             if (checked == 0) {
364               alert(_("No authorities have been selected."));
365               return false;
366             }
367           });
368
369           $("#record_ids_selection").on("submit", function(e){
370             var tab = $(this).find('#batch_del_form:active:first a').attr('href');
371             if ( tab == '#uploadfile_tab' ) {
372                 $("#shelf_number").empty('');
373                 $("#recordnumber_list").val('');
374             } else if ( tab == '#shelves_tab' ) {
375                 $("#uploadfile").val('')
376                 $("#recordnumber_list").val('');
377             } else { // enterlist
378                 $("#uploadfile").val('')
379                 $("#shelf_number").empty('');
380             }
381           });
382
383         });
384     </script>
385 [% END %]
386
387 [% INCLUDE 'intranet-bottom.inc' %]