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