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