Bug 35648: (follow-up) Remove sorting from transport columns
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / overduerules.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% PROCESS 'i18n.inc' %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9     [% t("Overdue notice/status triggers") | html %] &rsaquo;
10     [% t("Tools") | html %] &rsaquo;
11     [% t("Koha") | html %]
12 [% END %]</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="tools_overduerules" 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>Overdue notice/status triggers</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                 [% INCLUDE 'messages.inc' %]
37
38         <h1>Defining [% IF ( branch ) %]overdue actions for [% Branches.GetName( branch ) | html %][% ELSE %]default overdue actions[% END %]</h1>
39         <div class="help">
40             <p>Delay is the number of days after a checkout is due before an action is triggered. </p>
41             <p>If you want Koha to trigger an action (send a letter or restrict a member), a delay value is required.</p>
42             <p>Columns must be filled left to right: if the first column is blank, other columns will be ignored. </p>
43         </div>
44             <form method="get" action="/cgi-bin/koha/tools/overduerules.pl" id="selectlibrary">
45             <label for="branch">Select a library:</label>
46                 <select id="branch" name="branch">
47                     <option value="">Default</option>
48                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
49                 </select>
50                 <input type="submit" class="btn btn-primary" value="Select" />
51             </form>
52             [% IF ( ERROR ) %]
53             <div class="dialog alert">
54                 <h3>Data error</h3>
55                 <p>The following errors were found. Please correct them and submit again:</p>
56                 <ul>
57                 [% IF ( ERRORDELAY ) %]
58                     <li>Delay [% ERRORDELAY | html %] for [% BORERR | html %] patron category has some unexpected characters. There should be only numerical characters. </li>
59                 [% END %]
60                 [% IF ( ERRORUSELESSDELAY ) %]
61                     <li>No letter or restriction action specified for delay [% ERRORUSELESSDELAY | html %] for [% BORERR | html %] patron category.  If a delay is supplied, either a letter, restrict action, or both should be specified.</li>
62                 [% END %]
63                 [% IF ( ERRORORDER ) %]
64                     <li>The first notice's delay should be less than the second, which should be less than the third for the <strong>[% BORERR | html %]</strong> patron category </li>
65                 [% END %]
66                 </ul>
67             </div>
68             [% END %]
69             [% IF ( table ) %]
70                 <form method="post" id="overduerulesf" action="/cgi-bin/koha/tools/overduerules.pl">
71                     [% INCLUDE 'csrf-token.inc' %]
72                     <input type="hidden" name="op" value="cud-save" />
73                     <input type="hidden" name="branch" value="[% branch | html %]" />
74                     <h3>Rules for overdue actions: [% IF ( branch ) %][% Branches.GetName( branch ) | html %][% ELSE %] default library [% END %]</h3>
75                         [% IF ( datasaved ) %]<div class="dialog message">Changes saved.</div> [% END %]
76
77                     [% WRAPPER tabs id= "rulestabs" %]
78                         [% WRAPPER tabs_nav %]
79                             [% FOR tab IN tabs %]
80                                 [% WRAPPER tab_item tabname= tab.id %][% END %]
81                             [% END %]
82                         [% END # /WRAPPER tabs_nav %]
83
84                         [% WRAPPER tab_panels %]
85                             [% FOR tab IN tabs %]
86                                 [% WRAPPER tab_panel tabname=tab.id %]
87                                     <table class="overduerulest" id="overduerulest-[% tab.id | html %]">
88                                         <thead>
89                                             <tr>
90                                             <th>Patron category</th>
91                                             <th class="NoSort" scope="col">Delay</th>
92                                             <th class="NoSort" scope="col">Letter</th>
93                                             <th class="NoSort" scope="col">Restrict</th>
94                                                 [% FOREACH mtt IN message_transport_types %]
95                                                     [% NEXT IF mtt == 'itiva' AND !Koha.Preference('TalkingTechItivaPhoneNotification') %]
96                                                     [% NEXT IF mtt == 'phone' AND !Koha.Preference('PhoneNotification') %]
97                                                     <th class="NoSort" scope="col">
98                                                         [% SWITCH mtt %]
99                                                         [% CASE 'email' %]<span>Email</span>
100                                                         [% CASE 'print' %]<span>[% tp('Message transport type', 'Print') | html %]</span>
101                                                         [% CASE 'sms' %]<span>SMS</span>
102                                                         [% CASE 'feed' %]<span>Feed</span>
103                                                         [% CASE 'itiva' %]<span>Phone (i-tiva)</span>
104                                                         [% CASE 'phone' %]<span>Phone</span>
105                                                         [% CASE %]<span>[% mtt | html %]</span>
106                                                         [% END %]
107                                                     </th>
108                                                 [% END %]
109                                             </tr>
110                                         </thead>
111                                         <tbody>
112                                             [% FOREACH value IN tab.values %]
113                                                 <tr>
114                                                     <th scope="row">[% value.line | html %]</th>
115                                                     <td>
116                                                         <input type="text" inputmode="numeric" pattern="[0-9]*" name="delay[% tab.number | html %]-[% value.overduename | html %]" value="[% value.delay | html %]" />
117                                                     </td>
118                                                     <td>
119                                                         <select name="letter[% tab.number | html %]-[% value.overduename | html %]">
120                                                             <option value="">No notice</option>
121                                                             [% FOREACH letter IN letters %]
122                                                                 [% IF letter.code == value.selected_lettercode %]
123                                                                 <option value="[% letter.code | html %]" selected="selected">[% letter.name | html %] ( [% letter.code | html %] )</option>
124                                                                 [% ELSE %]
125                                                                 <option value="[% letter.code | html %]">[% letter.name | html %] ( [% letter.code | html %] )</option>
126                                                                 [% END %]
127                                                             [% END %]
128                                                         </select>
129                                                     </td>
130                                                     <td>
131                                                         [% IF ( value.debarred ) %]
132                                                             <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" checked="checked" value="1" />
133                                                         [% ELSE %]
134                                                             <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" value="1" />
135                                                         [% END %]
136                                                     </td>
137                                                     [% FOREACH mtt IN value.message_transport_types %]
138                                                         [% NEXT IF mtt.value == 'itiva' AND !Koha.Preference('TalkingTechItivaPhoneNotification') %]
139                                                         [% NEXT IF mtt.value == 'phone' AND !Koha.Preference('PhoneNotification') %]
140                                                         <td>
141                                                             [% IF mtt.selected %]
142                                                                 <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" checked="checked" />
143                                                             [% ELSE %]
144                                                                 [% IF mtt.value == "sms" and not Koha.Preference("SMSSendDriver") %]
145                                                                     <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" disabled="disabled" />
146                                                                 [% ELSE %]
147                                                                     <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" />
148                                                                 [% END %]
149                                                             [% END %]
150                                                         </td>
151                                                     [% END # /FOREACH mtt %]
152                                                 </tr>
153                                             [% END # /FOREACH value %]
154                                         </tbody>
155                                     </table>
156                                 [% END # /tab_panel# %]
157                             [% END %]
158                         [% END # /WRAPPER tab_panels %]
159                     [% END # /WRAPPER tabs %]
160
161                     <fieldset class="action"><input type="submit" class="btn btn-primary" value="Save changes" /></fieldset>
162                 </form>
163             [% ELSE %]
164                 <div class="warning">You don't have patron categories defined, or the patron categories are not set to receive overdue notices.</div>
165                 <div class="warning">If this is not what you were expecting, go to <a href="../admin/categories.pl">patron categories</p></div>
166             [% END %]
167
168             </main>
169         </div> <!-- /.col-sm-10.col-sm-push-2 -->
170
171         <div class="col-sm-2 col-sm-pull-10">
172             <aside>
173                 [% INCLUDE 'tools-menu.inc' %]
174             </aside>
175         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
176      </div> <!-- /.row -->
177
178 [% MACRO jsinclude BLOCK %]
179     [% Asset.js("js/tools-menu.js") | $raw %]
180     [% INCLUDE 'datatables.inc' %]
181     <script>
182         var tab_map = { "0" : _("First"), "1" : _("Second"), "2" : _("Third")};
183         $(document).ready(function() {
184             $('#selectlibrary').find("input:submit").hide();
185             $('#branch').change(function() {
186                 $('#selectlibrary').submit();
187             });
188             $("#rulestabs li > a").each( function( i ){
189                 $(this).html(tab_map[ i ]);
190             });
191             if( $("#rulestabs .tab-pane.active").length < 1 ){
192                 $("#rulestabs a:first").tab("show");
193             }
194             $(".overduerulest").dataTable($.extend(true, {}, dataTablesDefaults, {
195                 "aoColumnDefs": [
196                     { "targets": [ "NoSort" ], "orderable": false, "searchable": false },
197                 ],
198                 "dom": '<"top pager"f>rt<"clear">',
199                 "paginate": false,
200             }));
201
202             $("#overduerulesf").on("submit", function(e){
203                 $(".overduerulest").DataTable().search('').draw();
204                 return true;
205             });
206
207         });
208     </script>
209 [% END %]
210
211 [% INCLUDE 'intranet-bottom.inc' %]