Bug 32910: (follow-up) Replace v4 icon names with v6
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batch_extend_due_dates.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% USE Branches %]
5 [% USE Categories %]
6 [% USE KohaDates %]
7 [% USE ItemTypes %]
8 [% PROCESS 'html_helpers.inc' %]
9
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Batch extend due dates &rsaquo; Tools &rsaquo; Koha</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% Asset.css("css/humanmsg.css") | $raw %]
14 </head>
15
16 <body id="tools_batch_extend_due_dates" class="tools">
17     [% WRAPPER 'header.inc' %]
18     [% INCLUDE 'cat-search.inc' %]
19 [% END %]
20
21 [% WRAPPER 'sub-header.inc' %]
22     [% WRAPPER breadcrumbs %]
23         [% WRAPPER breadcrumb_item %]
24             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25         [% END %]
26         [% WRAPPER breadcrumb_item bc_active= 1 %]
27             <span>Batch extend due dates</span>
28         [% END %]
29     [% END #/ WRAPPER breadcrumbs %]
30 [% END #/ WRAPPER sub-header.inc %]
31
32     <div class="main container-fluid">
33         <div class="row">
34             <div class="col-sm-10 col-sm-push-2">
35                 <main>
36
37                     <h1>Batch extend due dates</h1>
38
39                     [% IF ( messages ) %]
40                         <div class="dialog message">
41
42                             [% FOREACH message IN messages %]
43                                 [% IF message.type == 'success' %]
44                                     <div><i class="fa fa-check success"></i>
45                                 [% ELSIF message.type == 'warning' %]
46                                     <div><i class="fa-solid fa-triangle-exclamation warn"></i>
47                                 [% ELSIF message.type == 'error' %]
48                                     <div><i class="fa fa-exclamation error"></i>
49                                 [% END %]
50                                 [% IF message.error %]
51                                     <span>(The error was: [% message.error | html %]. See the Koha logfile for more information).</span>
52                                 [% END %]
53                                 </div>
54                             [% END %]
55
56                         </div> <!-- .dialog.message -->
57                     [% END %]
58
59                     [% IF view == 'form' %]
60                         <form method="post" action="/cgi-bin/koha/tools/batch_extend_due_dates.pl" id="extend_due_dates_form">
61                             <fieldset class="rows">
62                                 <legend>Checkout criteria:</legend>
63                                 <ol>
64                                     <li>
65                                         <label for="categorycodes">Patrons' categories: </label>
66                                         [% SET categories = Categories.all() %]
67                                         <select id="categorycodes" name="categorycodes" multiple="multiple">
68                                             [% FOREACH cat IN categories %]
69                                                 <option value="[% cat.categorycode | html %]">[% cat.description | html %]</option>
70                                             [% END %]
71                                         </select>
72                                     </li>
73
74                                     <li>
75                                         <label for="branchcodes">Libraries: </label>
76                                         <select name="branchcodes" id="branchcodes" multiple="multiple">
77                                             [% PROCESS options_for_libraries libraries => Branches.all() %]
78                                         </select>
79                                     </li>
80
81                                     <li>
82                                         <label for="from_due_date">Due date from: </label>
83                                         <input type="text" size="10" id="from" name="from_due_date" class="flatpickr" data-date_to="to" />
84                                     </li>
85
86                                     <li>
87                                         <label for="to_due_date">Due date to:</label>
88                                         <input type="text" size="10" id="to" name="to_due_date" class="flatpickr" />
89                                     </li>
90                                 </ol>
91                             </fieldset>
92                             <fieldset class="rows">
93                                 <legend>New due date:</legend>
94                                 <ol>
95                                     <li>
96                                         <label for="new_hard_due_date">Hard due date: </label>
97                                         <input type="text" size="10" id="new_hard_due_date" name="new_hard_due_date" class="flatpickr" />
98                                     </li>
99
100                                     <li>
101                                         <label for="due_date_days">Or add number of days:</label>
102                                         <input type="text" size="10" id="due_date_days" name="due_date_days"/>
103                                     </li>
104                                 </ol>
105                             </fieldset>
106                             <fieldset class="rows">
107                                 <legend>Options:</legend>
108                                 <ol>
109                                     <li>
110                                         <label for="preview_results">Preview results:</label>
111                                         <input type="checkbox" name="preview_results" id="preview_results" checked />
112                                         <span class="hint">This is not recommended when changing very large numbers of due dates.</span>
113                                     </li>
114                                 </ol>
115                             </fieldset>
116                             <fieldset class="action">
117                                 <input type="hidden" name="op" value="list" />
118                                 <input type="submit" class="btn btn-primary" value="Continue" />
119                                 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
120                             </fieldset>
121                         </form> <!-- /#extend_due_dates_form -->
122                     [% ELSIF view == 'list' %]
123                         [% IF checkouts.count %]
124                             <form action="/cgi-bin/koha/tools/batch_extend_due_dates.pl" method="post" id="process">
125                                 <div class="page-section">
126                                     <div class="btn-toolbar selections-toolbar">
127                                         <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
128                                         | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
129                                     </div>
130                                     <table id="checkouts">
131                                         <thead>
132                                             <tr>
133                                                 <th>&nbsp;</th>
134                                                 <th>Due date</th>
135                                                 <th>Title</th>
136                                                 <th>Item type</th>
137                                                 <th>Home library</th>
138                                                 <th>Checked out on</th>
139                                                 <th>Checked out from</th>
140                                                 <th>New due date</th>
141                                             </tr>
142                                         </thead>
143                                         <tbody>
144                                             [% FOR checkout IN checkouts %]
145                                                 <tr>
146                                                     <td><input type="checkbox" name="issue_id" value="[% checkout.issue_id | html %]" /></td>
147                                                     <td>[% checkout.date_due | $KohaDates as_due_date => 1 %]</td>
148                                                     <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% checkout.item.biblio.biblionumber | uri %]">[% checkout.item.biblio.title | html %]</a></td>
149                                                     <td>[% ItemTypes.GetDescription( checkout.item.effective_itemtype ) | html %]</td>
150                                                     <td>[% checkout.item.home_branch.branchname | html %]</td>
151                                                     <td>[% checkout.issuedate | $KohaDates %]</td>
152                                                     <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
153                                                     <td>
154                                                         [% new_due_dates.shift | $KohaDates as_due_date => 1 %]
155                                                     </td>
156                                                 </tr>
157                                             [% END %]
158                                         </tbody>
159                                     </table> <!-- /#checkouts -->
160                                 </div> <!-- /.page-section -->
161                                 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected checkouts!</div>
162                                 <fieldset class="action">
163                                     <input type="hidden" name="op" value="modify" />
164                                     <input type="hidden" name="new_hard_due_date" value="[% new_hard_due_date | $KohaDates dateformat => 'iso' %]" />
165                                     <input type="hidden" name="due_date_days" value="[% due_date_days | html %]" />
166                                     <input type="submit" class="btn btn-primary" value="Modify selected checkouts" />
167                                     <a class="cancel" href="/cgi-bin/koha/tools/batch_extend_due_dates.pl">Cancel</a>
168                                 </fieldset>
169                             </form> <!-- /#process -->
170                         [% ELSE %]
171                             <div class="dialog message">
172                                 No checkouts for the selected filters.
173                             </div>
174                         [% END %]
175                     [% ELSIF view == 'report' %]
176                         <div class="dialog message">
177                             Due dates have been modified!
178                         </div>
179
180                         <div class="page-section">
181                             <table id="checkouts_result">
182                                 <thead>
183                                     <tr>
184                                         <th>Due date</th>
185                                         <th>Title</th>
186                                         <th>Item type</th>
187                                         <th>Home library</th>
188                                         <th>Checked out on</th>
189                                         <th>Checked out from</th>
190                                     </tr>
191                                 </thead>
192                                 <tbody>
193                                     [% FOR checkout IN checkouts %]
194                                         <tr>
195                                             <td>[% checkout.date_due | $KohaDates as_due_date => 1 %]</td>
196                                             <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% checkout.item.biblio.biblionumber | uri %]">[% checkout.item.biblio.title | html %]</a></td>
197                                             <td>[% ItemTypes.GetDescription( checkout.item.effective_itemtype ) | html %]</td>
198                                             <td>[% checkout.item.home_branch.branchname | html %]</td>
199                                             <td>[% checkout.issuedate | $KohaDates %]</td>
200                                             <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
201                                         </tr>
202                                     [% END %]
203                                 </tbody>
204                             </table> <!-- /#checkouts_result -->
205                         </div> <!-- /.page-section -->
206                     [% END %]
207                 </main>
208             </div> <!-- /.col-sm-10.col-sm-push-2 -->
209
210             <div class="col-sm-2 col-sm-pull-10">
211                 <aside>
212                     [% INCLUDE 'tools-menu.inc' %]
213                 </aside>
214             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
215         </div> <!-- /.row -->
216
217 [% MACRO jsinclude BLOCK %]
218     [% Asset.js("js/tools-menu.js") | $raw %]
219     [% INCLUDE 'calendar.inc' %]
220     [% INCLUDE 'datatables.inc' %]
221     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
222     <script>
223         $(document).ready(function() {
224
225             $("#selectall").click(function(e){
226                 e.preventDefault();
227                 $("#checkouts input[type='checkbox']").each(function(){
228                     $(this).prop("checked", true);
229                 });
230             });
231
232             $("#clearall").click(function(e){
233                 e.preventDefault();
234                 $("#checkouts input[type='checkbox']").each(function(){
235                     $(this).prop("checked", false);
236                 });
237             });
238
239             $("#selectall").click();
240
241             $("#checkouts").dataTable($.extend(true, {}, dataTablesDefaults, {
242                 "aoColumnDefs": [
243                     { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
244                     { "aTargets": [1], "sType": "num-html" }
245                 ],
246                 "sDom": 't',
247                 "aaSorting": [],
248                 "bPaginate": false
249             }));
250
251             $("#checkouts_result").dataTable($.extend(true, {}, dataTablesDefaults, {
252                 "aoColumnDefs": [
253                     { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
254                     { "aTargets": [1], "sType": "num-html" }
255                 ],
256                 "sDom": 't',
257                 "aaSorting": [],
258                 "bPaginate": false
259             }));
260
261             $("#extend_due_dates_form").on('submit', function(e) {
262                 var new_hard_due_date = $("#new_hard_due_date").val();
263                 var due_date_days = $("#due_date_days").val();
264                 if (new_hard_due_date && due_date_days ) {
265                     e.preventDefault();
266                     alert(_("You must fill only one of the two due date options"));
267                     return false;
268                 } else if ( !new_hard_due_date && !due_date_days ) {
269                     e.preventDefault();
270                     alert(_("You must fill at least one of the two due date options"));
271                     return false;
272                 }
273
274                 return true;
275             });
276
277             $("#process").on('submit', function(e) {
278                 if ($("input[type=checkbox][name='issue_id']:checked").length == 0) {
279                     e.preventDefault();
280                     alert(_("Please select at least one checkout to process"));
281                     return false;
282                 }
283                 return true;
284             });
285
286         });
287     </script>
288 [% END %]
289
290 [% INCLUDE 'intranet-bottom.inc' %]