Bug 30952: Staff interface redesign (header)
[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>Overdue notice/status triggers &rsaquo; Tools &rsaquo; Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="tools_overduerules" class="tools">
13 [% WRAPPER 'header.inc' %]
14     [% INCLUDE 'cat-search.inc' %]
15 [% END %]
16
17 [% WRAPPER 'sub-header.inc' %]
18 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19     <ol>
20         <li>
21             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
22         </li>
23         <li>
24             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25         </li>
26         <li>
27             <a href="#" aria-current="page">
28                 Overdue notice/status triggers
29             </a>
30         </li>
31     </ol>
32 </nav>
33 [% END %]
34
35 <div class="main container-fluid">
36     <div class="row">
37         <div class="col-sm-10 col-sm-push-2">
38             <main>
39
40         <h1>Defining [% IF ( branch ) %]overdue actions for [% Branches.GetName( branch ) | html %][% ELSE %]default overdue actions[% END %]</h1>
41         <div class="help">
42             <p>Delay is the number of days after a checkout is due before an action is triggered. </p>
43             <p>If you want Koha to trigger an action (send a letter or restrict a member), a delay value is required.</p>
44             <p>Columns must be filled left to right: if the first column is blank, other columns will be ignored. </p>
45         </div>
46             <form method="post" action="/cgi-bin/koha/tools/overduerules.pl" id="selectlibrary">
47             <label for="branch">Select a library:</label>
48                 <select id="branch" name="branch">
49                     <option value="">Default</option>
50                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
51                 </select>
52                 <input type="submit" value="Select" />
53             </form>
54             [% IF ( ERROR ) %]
55             <div class="dialog alert">
56                 <h3>Data error</h3>
57                 <p>The following errors were found. Please correct them and submit again:</p>
58                 <ul>
59                 [% IF ( ERRORDELAY ) %]
60                     <li>Delay [% ERRORDELAY | html %] for [% BORERR | html %] patron category has some unexpected characters. There should be only numerical characters. </li>
61                 [% END %]
62                 [% IF ( ERRORUSELESSDELAY ) %]
63                     <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>
64                 [% END %]
65                 [% IF ( ERRORORDER ) %]
66                     <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>
67                 [% END %]
68                 </ul>
69             </div>
70             [% END %]
71             [% IF ( table ) %]
72             <form method="post" action="/cgi-bin/koha/tools/overduerules.pl">
73                 <input type="hidden" name="op" value="save" />
74                 <input type="hidden" name="branch" value="[% branch | html %]" />
75                 <h3>Rules for overdue actions: [% IF ( branch ) %][% Branches.GetName( branch ) | html %][% ELSE %] default library [% END %]</h3>
76                     [% IF ( datasaved ) %]<div class="dialog message">Changes saved.</div> [% END %]
77
78                 <div id="rulestabs" class="toptabs">
79                     <ul class="nav nav-tabs" role="tablist">
80                         [% FOR tab IN tabs %]
81                             <li role="presentation">
82                                 <a href="#[% tab.id | uri %]" class="tab [% tab.id | html %]" data-number="[% tab.number | html %]" aria-controls="[% tab.id | uri %]" role="tab" data-toggle="tab"></a>
83                             </li>
84                         [% END %]
85                     </ul>
86                     <div class="tab-content">
87                         [% FOR tab IN tabs %]
88                             <div id="[% tab.id | html %]" role="tabpanel" class="tab-pane">
89                                 <table>
90                                     <thead>
91                                         <tr>
92                                         <th>&nbsp;</th>
93                                         <th scope="col">Delay</th>
94                                         <th scope="col">Letter</th>
95                                         <th scope="col">Restrict</th>
96                                             [% FOREACH mtt IN message_transport_types %]
97                                                 [% NEXT IF mtt == 'itiva' AND !Koha.Preference('TalkingTechItivaPhoneNotification') %]
98                                                 [% NEXT IF mtt == 'phone' AND !Koha.Preference('PhoneNotification') %]
99                                                 <th scope="col">
100                                                     [% SWITCH mtt %]
101                                                     [% CASE 'email' %]<span>Email</span>
102                                                     [% CASE 'print' %]<span>[% tp('Message transport type', 'Print') | html %]</span>
103                                                     [% CASE 'sms' %]<span>SMS</span>
104                                                     [% CASE 'feed' %]<span>Feed</span>
105                                                     [% CASE 'itiva' %]<span>Phone (i-tiva)</span>
106                                                     [% CASE 'phone' %]<span>Phone</span>
107                                                     [% CASE %]<span>[% mtt | html %]</span>
108                                                     [% END %]
109                                                 </th>
110                                             [% END %]
111                                         </tr>
112                                     </thead>
113                                     <tbody>
114                                         [% FOREACH value IN tab.values %]
115                                             <tr>
116                                                 <th scope="row">[% value.line | html %]</th>
117                                                 <td>
118                                                     <input type="text" inputmode="numeric" pattern="[0-9]*" name="delay[% tab.number | html %]-[% value.overduename | html %]" value="[% value.delay | html %]" />
119                                                 </td>
120                                                 <td>
121                                                     <select name="letter[% tab.number | html %]-[% value.overduename | html %]">
122                                                         <option value="">No notice</option>
123                                                         [% FOREACH letter IN letters %]
124                                                             [% IF letter.code == value.selected_lettercode %]
125                                                             <option value="[% letter.code | html %]" selected="selected">[% letter.name | html %]</option>
126                                                             [% ELSE %]
127                                                             <option value="[% letter.code | html %]">[% letter.name | html %]</option>
128                                                             [% END %]
129                                                         [% END %]
130                                                     </select>
131                                                 </td>
132                                                 <td>
133                                                     [% IF ( value.debarred ) %]
134                                                         <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" checked="checked" value="1" />
135                                                     [% ELSE %]
136                                                         <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" value="1" />
137                                                     [% END %]
138                                                 </td>
139                                                 [% FOREACH mtt IN value.message_transport_types %]
140                                                     [% NEXT IF mtt.value == 'itiva' AND !Koha.Preference('TalkingTechItivaPhoneNotification') %]
141                                                     [% NEXT IF mtt.value == 'phone' AND !Koha.Preference('PhoneNotification') %]
142                                                     <td>
143                                                         [% IF mtt.selected %]
144                                                             <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" checked="checked" />
145                                                         [% ELSE %]
146                                                             [% IF mtt.value == "sms" and not Koha.Preference("SMSSendDriver") %]
147                                                                 <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" disabled="disabled" />
148                                                             [% ELSE %]
149                                                                 <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" />
150                                                             [% END %]
151                                                         [% END %]
152                                                     </td>
153                                                 [% END # /FOREACH mtt %]
154                                             </tr>
155                                         [% END # /FOREACH value %]
156                                     </tbody>
157                                 </table>
158                             </div> <!-- /.tab-pane -->
159                         [% END # /FOR tabs %]
160                     </div> <!-- /.tab-content -->
161                 </div>
162
163                 <fieldset class="action"><input type="submit" value="Save changes" /></fieldset>
164             </form>
165             [% ELSE %]
166                 <div class="warning">You don't have patron categories defined, or the patron categories are not set to receive overdue notices.</div>
167                 <div class="warning">If this is not what you were expecting, go to <a href="../admin/categories.pl">patron categories</p></div>
168             [% END %]
169
170             </main>
171         </div> <!-- /.col-sm-10.col-sm-push-2 -->
172
173         <div class="col-sm-2 col-sm-pull-10">
174             <aside>
175                 [% INCLUDE 'tools-menu.inc' %]
176             </aside>
177         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
178      </div> <!-- /.row -->
179
180 [% MACRO jsinclude BLOCK %]
181     [% Asset.js("js/tools-menu.js") | $raw %]
182     <script>
183         var tab_map = { "1" : _("First"), "2" : _("Second"), "3" : _("Third")};
184         $(document).ready(function() {
185             $('#selectlibrary').find("input:submit").hide();
186             $('#branch').change(function() {
187                 $('#selectlibrary').submit();
188             });
189             $("li>a.tab").each( function(){
190                 var id = $(this).attr("data-number");
191                 $(this).html(tab_map[id]);
192             });
193             if( $("#rulestabs .tab-pane.active").length < 1 ){
194                 $("#rulestabs a:first").tab("show");
195             }
196         });
197     </script>
198 [% END %]
199
200 [% INCLUDE 'intranet-bottom.inc' %]