Bug 5917 : Converted templates
[koha.git] / koha-tt / 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 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
9 <script type="text/javascript" id="js">$(document).ready(function() {
10         $("#table_categorie").tablesorter({
11                 sortList: [[0,0]],
12                 headers: { 10: { sorter: false}}
13         }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
14 }); </script>
15 [% INCLUDE 'calendar.inc' %]
16 <script type="text/javascript">
17 //<![CDATA[
18         //
19         function isNotNull(f,noalert) {
20                 if (f.value.length ==0) {
21    return false;
22                 }
23                 return true;
24         }
25         //
26         function toUC(f) {
27                 var x=f.value.toUpperCase();
28                 f.value=x;
29                 return true;
30         }
31         //
32         function isNum(v,maybenull) {
33         var n = new Number(v.value);
34         if (isNaN(n)) {
35                 return false;
36                 }
37         if (maybenull==0 && v.value=='') {
38                 return false;
39         }
40         return true;
41         }
42         //
43         function isDate(f) {
44                 var t = Date.parse(f.value);
45                 if (isNaN(t)) {
46                         return false;
47                 }
48         }
49         // to check if the data are correctly entered.
50         function Check(ff) {
51             var ok=0;
52                 var _alertString=_("Form not submitted because of the following problem(s)");
53                 _alertString +="\n-------------------------------------------------------------------\n\n";
54                 if (ff.categorycode.value.length==0) {
55                     ok=1;
56                         _alertString += _("- categorycode missing") + "\n";
57                 }
58                 if (!(ff.category_type.value)){
59                     ok=1;
60                     _alertString += _("- category type missing") + "\n";
61                 }
62                 if (!(isNotNull(ff.description,1))) {
63                     ok=1;
64                         _alertString += _("- description missing") + "\n";
65                 }
66                 if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
67                     ok=1;
68                         _alertString += _("- upperagelimit is not a number") + "\n";
69                                 
70                 }
71                 if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
72                     ok=1;
73                     _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
74                 }
75                 if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
76                         document.getElementById('enrolmentmessage').className = "error";
77                         return false;
78                 }
79                 
80                 if (ok) { // if there is a problem
81                     alert(_alertString);
82                     return false;
83                 }
84                 // if all is good
85                 ff.submit();
86         }
87         //]]>
88 </script>
89 </head>
90 <body>
91 [% INCLUDE 'header.inc' %]
92 [% INCLUDE 'patrons-admin-search.inc' %]
93
94 <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 %]
95 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Data recorded[% END %]
96 [% 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 %]
97 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Category Deleted[% END %]
98 [% IF ( else ) %]Patron Categories[% END %]</div>
99
100 <div id="doc3" class="yui-t2">
101    
102    <div id="bd">
103         <div id="yui-main">
104         <div class="yui-b">
105
106 [% IF ( add_form ) %]
107         
108
109
110         
111         <form name="Aform" action="[% script_name %]" method="post">
112         <input type="hidden" name="op" value="add_validate" />
113         <input type="hidden" name="checked" value="0" />
114 [% IF ( categorycode ) %]
115                 <h1>Modify category [% categorycode |html %]</h1>
116         [% ELSE %]
117                 <h1>New category</h1>
118         [% END %]
119         <fieldset class="rows">
120         <ol>[% IF ( categorycode ) %]
121         <li><span class="label">Category code</span>[% categorycode |html %]
122                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
123         [% ELSE %]
124         <li><label for="categorycode">Category code: </label> &nbsp; <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
125         [% END %]
126         <li><label for="description">Description: </label> &nbsp; <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
127         <li><label for="enrolmentperiod">Enrollment period: </label> &nbsp; 
128                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months <br />
129                 <label for="enrolmentperioddate">Until date: </label> &nbsp;
130                 <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" /> <img src="[% themelang %]/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
131                 <script type="text/javascript">
132             //<![CDATA[
133                Calendar.setup({
134                     inputField : "enrolmentperioddate",
135                     ifFormat : "[% DHTMLcalendar_dateformat %]",
136                         button : "enrolmentperioddate_button"
137                 });
138                 //]]>
139         </script>
140                 <div id="enrolmentmessage" class="hint">Cannot have "months" and "until date" at the same time</div>
141         </li>
142         <li><label for="dateofbirthrequired">Age required: </label> &nbsp; <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
143         <li><label for="upperagelimit">Upperage limit: </label> &nbsp; <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
144         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
145         <li><label for="overduenoticerequired">Overdue notice required: </label> &nbsp; <select name="overduenoticerequired" id="overduenoticerequired">
146                         [% IF ( overduenoticerequired ) %]
147                                                 <option value="0">No</option>
148                                                 <option value="1" selected="selected">Yes</option>
149                         [% ELSE %]
150                                                 <option value="0" selected="selected">No</option>
151                                                 <option value="1">Yes</option>
152                         [% END %]
153                                         </select></li>
154         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
155         <li><label for="category_type">Category type: </label> &nbsp; <select name="category_type" id="category_type">
156                                                 [% IF ( type_n ) %]<option value="" selected="selected">Select a Category type</option>[% ELSE %]<option value="">Select a Category type</option>[% END %]
157                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
158                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
159                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
160                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
161                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
162                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
163                                         </select>
164         </li></ol>
165 </fieldset>
166
167     [% IF ( EnhancedMessagingPreferences ) %]
168       <fieldset class="rows">
169         <h4>Default messaging preferences for this patron category</h4>
170         [% INCLUDE 'messaging-preference-form.inc' %]
171       </fieldset>
172     [% END %]
173         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
174         </form>
175
176 [% END %]
177
178 [% IF ( add_validate ) %]
179 <h3>Data recorded</h3>
180         <form action="[% script_name %]" method="post">
181                 <input type="submit" value="OK" />
182         </form>
183
184 [% END %]
185
186 [% IF ( delete_confirm ) %]
187         
188         <form action="[% script_name %]" method="post">
189         <fieldset><legend>      
190         [% IF ( totalgtzero ) %]
191         Category [% categorycode |html %] is in use.  Deletion not possible![% ELSE %]
192 Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
193
194 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
195         <table>
196         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
197         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
198         <tr><th scope="row">Enrollment period: </th>
199                 <td>
200                         [% IF ( enrolmentperiod ) %]
201                                 [% enrolmentperiod %] months
202                         [% ELSE %]
203                                 until [% enrolmentperioddate %]
204                         [% END %]
205                 </td>
206         </tr>
207         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
208         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
209         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
210         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
211         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
212 </table>
213                 <fieldset class="action">[% IF ( totalgtzero ) %]
214 <input type="submit" value="OK" /></form>
215                 [% ELSE %]
216                         <input type="hidden" name="op" value="delete_confirmed" />
217                         <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> 
218                 [% END %]</fieldset></fieldset></form>
219 [% END %]
220
221 [% IF ( delete_confirmed ) %]
222 <h3>Category Deleted</h3>
223
224         <form action="[% script_name %]" method="post">
225         <input type="submit" value="OK" />
226         </form>
227 [% END %]
228
229 [% IF ( else ) %]
230
231 <div id="toolbar">
232         <script type="text/javascript">
233         //<![CDATA[
234
235         // prepare DOM for YUI Toolbar
236
237          $(document).ready(function() {
238             yuiToolbar();
239          });
240
241         // YUI Toolbar Functions
242
243         function yuiToolbar() {
244             new YAHOO.widget.Button("newcategory");
245         }
246
247         //]]>
248         </script>
249         <ul class="toolbar">
250         <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New Category</a></li>
251 </ul></div>
252
253 <h2>Patron Category Administration</h2>
254 [% IF ( searchfield ) %]
255                 You Searched for [% searchfield %]</span>
256         [% END %]
257 <span id="pagertable_categorie" class="pager">
258         <form class="formpager">&nbsp;<strong>page(s)</strong>&nbsp;:
259                 <img src="[% interface %]/prog/img/first.png" class="first"/>
260                 <img src="[% interface %]/prog/img/prev.png" class="prev"/>
261                 <input type="text" size="5" class="pagedisplay"/>
262                 <img src="[% interface %]/prog/img/next.png" class="next"/>
263                 <img src="[% interface %]/prog/img/last.png" class="last"/>
264                 , entries/page : 
265                 <select class="pagesize">
266                 <option value="10">10</option>
267                         <option selected="selected" value="20">20</option>
268                         <option value="30">30</option>
269                         <option value="40">40</option>
270                         <option value="50">50</option>
271                         <option value="100">100</option>
272                 </select>
273         </form>
274 </span>
275         <table id="table_categorie">
276                 <thead>
277                         <th scope="col">Code</th>
278                         <th scope="col">Category name</th>
279                         <th scope="col">Type</th>
280                         <th scope="col">Enrollment period</th>
281                         <th scope="col">Age required</th>
282                         <th scope="col">Upper age limit</th>
283                         <th scope="col">Enrollment fee</th>
284                         <th scope="col">Overdue</th>
285                         <th scope="col">Hold fee</th>
286             [% IF ( EnhancedMessagingPreferences ) %]
287             <th scope="col">Messaging</th>
288             [% END %]
289                         <th scope="col" colspan="2">&nbsp; </th>
290                 </thead>
291                 [% FOREACH loo IN loop %]
292                 [% UNLESS ( loop.odd ) %]
293                         <tr class="highlight">
294                 [% ELSE %]
295                         <tr>
296                 [% END %]
297                         <td>[% loo.categorycode |html %]</td>
298                         <td>
299                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
300                         </td>
301                         <td>
302                             [% IF ( loo.type_A ) %]Adult[% END %]
303                             [% IF ( loo.type_C ) %]Child[% END %]
304                             [% IF ( loo.type_P ) %]Prof.[% END %]
305                             [% IF ( loo.type_I ) %]Org.[% END %]
306                             [% IF ( loo.type_S ) %]Staff[% END %]
307                             [% IF ( loo.type_X ) %]Statistical[% END %]
308                         </td>
309                         <td>
310                                 [% IF ( loo.enrolmentperiod ) %]
311                                         [% loo.enrolmentperiod %] months
312                                 [% ELSE %]
313                                         until [% loo.enrolmentperioddate %]
314                                 [% END %]
315                         
316                         </td>
317                         <td>[% loo.dateofbirthrequired %] years</td>
318                         <td>[% loo.upperagelimit %] years</td>
319                         <td>[% loo.enrolmentfee %]</td>
320                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
321                         <td>[% loo.reservefee %]</td>
322                         [% IF ( loo.EnhancedMessagingPreferences ) %]
323                         <td>
324                             [% IF ( loo.messaging_prefs ) %]
325                                 [% FOREACH messaging_pref IN loo.messaging_prefs %]
326                                     <!-- TMPL_IF NAME="Item DUE" -->Item DUE
327                                     <!-- TMPL_ELSIF NAME="Advance Notice" -->Advance Notice
328                                     <!-- TMPL_ELSIF NAME="Upcoming Events" -->Upcoming Events
329                                     <!-- TMPL_ELSIF NAME="Hold Filled" -->Hold Filled
330                                     <!-- TMPL_ELSIF NAME="Item Check-in" -->Item Check-in
331                                     <!-- TMPL_ELSIF NAME="Item Checkout" -->Item Checkout
332                                     [% ELSE %]Unknown [% END %] :
333                                     [% FOREACH transport IN messaging_pref.transports %]
334                                         [% transport.transport %]
335                                     [% END %]
336                                 [% END %]
337                                 <br />
338                             [% ELSE %]
339                                 none
340                             [% END %]
341                         </td>
342                         [% END %]
343                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
344                                                 <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
345                 </tr>
346                 [% END %]
347         </table>
348 [% END %]
349
350 </div>
351 </div>
352 <div class="yui-b">
353 [% INCLUDE 'admin-menu.inc' %]
354 </div>
355 </div>
356 [% INCLUDE 'intranet-bottom.inc' %]