Bug 9629 - Replace YUI button on patron category administration page with Bootstrap
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categorie.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
3 [% IF ( add_validate ) %]Data recorded[% END %]
4 [% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
5 [% IF ( delete_confirmed ) %]Category deleted[% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
9 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
10 <script type="text/javascript" id="js">$(document).ready(function() {
11         $("#table_categorie").tablesorter({
12                 sortList: [[0,0]],
13                 widgets: ['zebra'],
14                 headers: { 11: { sorter: false}}
15         }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
16     $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
17
18     if ( $("#branches option:selected").length < 1 ) {
19         $("#branches option:first").attr("selected", "selected");
20     }
21 }); </script>
22 <script type="text/javascript">
23 //<![CDATA[
24         //
25         function isNotNull(f,noalert) {
26                 if (f.value.length ==0) {
27    return false;
28                 }
29                 return true;
30         }
31         //
32         function toUC(f) {
33                 var x=f.value.toUpperCase();
34                 f.value=x;
35                 return true;
36         }
37         //
38         function isNum(v,maybenull) {
39         var n = new Number(v.value);
40         if (isNaN(n)) {
41                 return false;
42                 }
43         if (maybenull==0 && v.value=='') {
44                 return false;
45         }
46         return true;
47         }
48         //
49         function isDate(f) {
50                 var t = Date.parse(f.value);
51                 if (isNaN(t)) {
52                         return false;
53                 }
54         }
55         // to check if the data are correctly entered.
56         function Check(ff) {
57             var ok=0;
58                 var _alertString=_("Form not submitted because of the following problem(s)");
59                 _alertString +="\n-------------------------------------------------------------------\n\n";
60                 ff.categorycode.value = ff.categorycode.value.trim();
61                 if (ff.categorycode.value.length==0) {
62                    ok=1;
63                    _alertString += _("- categorycode missing") + "\n";
64                 }
65                 else{
66                    var patt=/^[a-zA-Z0-9\-_]+$/g;
67                    if ( !patt.test(ff.categorycode.value) ) {
68                       ok=1;
69                       _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n";
70                    }
71                 }
72                 if (!(ff.category_type.value)){
73                     ok=1;
74                     _alertString += _("- category type missing") + "\n";
75                 }
76                 if (!(isNotNull(ff.description,1))) {
77                     ok=1;
78                         _alertString += _("- description missing") + "\n";
79                 }
80                 if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
81                     ok=1;
82                         _alertString += _("- upperagelimit is not a number") + "\n";
83                                 
84                 }
85                 if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
86                     ok=1;
87                     _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
88                 }
89                 if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
90                         document.getElementById('enrolmentmessage').className = "error";
91                         return false;
92                 }
93                 
94                 if (ok) { // if there is a problem
95                     alert(_alertString);
96                     return false;
97                 }
98                 // if all is good
99                 ff.submit();
100         }
101         //]]>
102 </script>
103 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
104 </head>
105 <body id="admin_categorie" class="admin">
106 [% INCLUDE 'header.inc' %]
107 [% INCLUDE 'patrons-admin-search.inc' %]
108
109 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
110 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Data recorded[% END %]
111 [% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( totalgtzero ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
112 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
113 [% IF ( else ) %]Patron categories[% END %]</div>
114
115 <div id="doc3" class="yui-t2">
116    
117    <div id="bd">
118         <div id="yui-main">
119         <div class="yui-b">
120
121 [% IF ( add_form ) %]
122         
123
124
125         
126         <form name="Aform" action="[% script_name %]" method="post">
127         <input type="hidden" name="op" value="add_validate" />
128         <input type="hidden" name="checked" value="0" />
129 [% IF ( categorycode ) %]
130                 <h1>Modify category [% categorycode |html %]</h1>
131         [% ELSE %]
132                 <h1>New category</h1>
133         [% END %]
134         <fieldset class="rows">
135         <ol>[% IF ( categorycode ) %]
136         <li><span class="label">Category code</span>[% categorycode |html %]
137                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
138         [% ELSE %]
139         <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
140         [% END %]
141         <li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
142         <li><label for="enrolmentperiod">Enrollment period: </label>
143         <fieldset>
144         <legend>Choose one</legend>
145         <ol>
146         <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
147                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
148         <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
149         <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" />
150                 <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
151         </li>
152         </ol>
153         </fieldset>
154         </li>
155         <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
156         <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
157         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
158         <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
159                         [% IF ( overduenoticerequired ) %]
160                                                 <option value="0">No</option>
161                                                 <option value="1" selected="selected">Yes</option>
162                         [% ELSE %]
163                                                 <option value="0" selected="selected">No</option>
164                                                 <option value="1">Yes</option>
165                         [% END %]
166                                         </select></li>
167         <li><label for="hidelostitems">Lost items in staff client</label> <select name="hidelostitems" id="hidelostitems">
168                         [% IF ( hidelostitems ) %]
169                                                 <option value="0">Shown</option>
170                                                 <option value="1" selected="selected">Hidden by default</option>
171                         [% ELSE %]
172                                                 <option value="0" selected="selected">Shown</option>
173                                                 <option value="1">Hidden by default</option>
174                         [% END %]
175                                         </select></li>
176         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
177         <li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
178                         [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
179                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
180                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
181                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
182                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
183                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
184                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
185                                         </select>
186     </li>
187     <li><label for="branches">Branches limitation: </label>
188         <select id="branches" name="branches" multiple size="10">
189             <option value="">All branches</option>
190             [% FOREACH branch IN branches_loop %]
191               [% IF ( branch.selected ) %]
192                 <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
193               [% ELSE %]
194                 <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
195               [% END %]
196             [% END %]
197         </select>
198         <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
199         </span>
200     </li>
201     </ol>
202 </fieldset>
203
204     [% IF ( EnhancedMessagingPreferences ) %]
205       <fieldset class="rows">
206         <h4>Default messaging preferences for this patron category</h4>
207         [% INCLUDE 'messaging-preference-form.inc' %]
208       </fieldset>
209     [% END %]
210         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
211         </form>
212
213 [% END %]
214
215 [% IF ( add_validate ) %]
216 <h3>Data recorded</h3>
217         <form action="[% script_name %]" method="post">
218                 <input type="submit" value="OK" />
219         </form>
220
221 [% END %]
222
223 [% IF ( delete_confirm ) %]
224         
225         <form action="[% script_name %]" method="post">
226         <fieldset><legend>      
227         [% IF ( totalgtzero ) %]
228         Category [% categorycode |html %] is in use.  Deletion not possible![% ELSE %]
229 Confirm deletion of category [% categorycode |html %][% END %]</legend>
230
231 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
232         <table>
233         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
234         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
235         <tr><th scope="row">Enrollment period: </th>
236                 <td>
237                         [% IF ( enrolmentperiod ) %]
238                                 [% enrolmentperiod %] months
239                         [% ELSE %]
240                                 until [% enrolmentperioddate %]
241                         [% END %]
242                 </td>
243         </tr>
244         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
245         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
246         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
247         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
248         <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
249         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
250 </table>
251                 <fieldset class="action">[% IF ( totalgtzero ) %]
252 <input type="submit" value="OK" /></form>
253                 [% ELSE %]
254                         <input type="hidden" name="op" value="delete_confirmed" />
255             <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a>
256                 [% END %]</fieldset></fieldset></form>
257 [% END %]
258
259 [% IF ( delete_confirmed ) %]
260 <h3>Category deleted</h3>
261
262         <form action="[% script_name %]" method="post">
263         <input type="submit" value="OK" />
264         </form>
265 [% END %]
266
267 [% IF ( else ) %]
268
269 <div id="toolbar" class="btn-toolbar">
270     <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="icon-plus"></i> New category</a>
271 </div>
272
273 <h2>Patron category administration</h2>
274 [% IF ( searchfield ) %]
275                 You Searched for [% searchfield %]</span>
276         [% END %]
277 [% IF ( loop ) %]
278 <div id="pagertable_categorie">
279 [% INCLUDE 'table-pager.inc' perpage='20' %]
280 </div>
281         <table id="table_categorie">
282                 <thead>
283                         <th scope="col">Code</th>
284                         <th scope="col">Category name</th>
285                         <th scope="col">Type</th>
286                         <th scope="col">Enrollment period</th>
287                         <th scope="col">Age required</th>
288                         <th scope="col">Upper age limit</th>
289                         <th scope="col">Enrollment fee</th>
290                         <th scope="col">Overdue</th>
291             <th scope="col">Lost items</th>
292                         <th scope="col">Hold fee</th>
293             [% IF ( EnhancedMessagingPreferences ) %]
294             <th scope="col">Messaging</th>
295             [% END %]
296             <th scope="col">Branches limitations</th>
297                         <th scope="col" colspan="2">&nbsp; </th>
298                 </thead>
299                 [% FOREACH loo IN loop %]
300                         <tr>
301                         <td>[% loo.categorycode |html %]</td>
302                         <td>
303                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
304                         </td>
305                         <td>
306                             [% IF ( loo.type_A ) %]Adult[% END %]
307                             [% IF ( loo.type_C ) %]Child[% END %]
308                             [% IF ( loo.type_P ) %]Prof.[% END %]
309                             [% IF ( loo.type_I ) %]Org.[% END %]
310                             [% IF ( loo.type_S ) %]Staff[% END %]
311                             [% IF ( loo.type_X ) %]Statistical[% END %]
312                         </td>
313                         <td>
314                                 [% IF ( loo.enrolmentperiod ) %]
315                                         [% loo.enrolmentperiod %] months
316                                 [% ELSE %]
317                                         until [% loo.enrolmentperioddate %]
318                                 [% END %]
319                         
320                         </td>
321                         <td>[% loo.dateofbirthrequired %] years</td>
322                         <td>[% loo.upperagelimit %] years</td>
323                         <td>[% loo.enrolmentfee %]</td>
324                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
325                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
326                         <td>[% loo.reservefee %]</td>
327                         [% IF ( EnhancedMessagingPreferences ) %]
328                         <td style="white-space: nowrap; font-size:80%;">
329                             [% IF ( loo.messaging_prefs ) %]
330                               [% FOREACH prefs IN loo.messaging_prefs %]
331                                         [% FOREACH transport IN prefs.transports %]
332                                          [% IF ( transport.transport ) %]
333                                             [% IF ( prefs.Item_Due ) %]Item due
334                                             [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
335                                             [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
336                                             [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
337                                             [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
338                                             [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
339                                                         [% ELSE %]Unknown
340                                                         [% END %]:
341                                                             <strong>[% transport.transport %]</strong><br />
342                                                          [% ELSE %]None<br />[% END %]
343                                         [% END %]
344                                 [% END %]
345                             [% ELSE %]
346                                 None
347                             [% END %]
348                         </td>
349                         [% END %]
350                         <td>
351                             [% IF loo.branches.size > 0 %]
352                                 [% branches_str = "" %]
353                                 [% FOREACH branch IN loo.branches %]
354                                     [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
355                                 [% END %]
356                                 <span title="[% branches_str %]">
357                                     [% IF loo.branches.size > 1 %]
358                                         [% loo.branches.size %] branches limitations
359                                     [% ELSE %]
360                                         [% loo.branches.size %] branch limitation
361                                     [% END %]
362                                 </span>
363                             [% ELSE %]
364                                 No limitation
365                             [% END %]
366                         </td>
367                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">Edit</a></td>
368                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |uri %]">Delete</a></td>
369                 </tr>
370                 [% END %]
371         </table>
372 [% ELSE %]
373         <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div>
374 [% END %]
375 [% END %]
376
377 </div>
378 </div>
379 <div class="yui-b">
380 [% INCLUDE 'admin-menu.inc' %]
381 </div>
382 </div>
383 [% INCLUDE 'intranet-bottom.inc' %]