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