Bug 15758: Koha::Libraries - Remove GetBranchesLoop
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / authorised_values.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Authorized values
3 [% IF op == 'add_form' %]
4   [% IF ( action_modify ) %] &rsaquo; Modify authorized value[% END %]
5   [% IF ( action_add_value ) %] &rsaquo;  New authorized value[% END %]
6   [% IF ( action_add_category ) %] &rsaquo; New category[% END %]
7 [% END %]
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10
11 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
12 [% INCLUDE 'datatables.inc' %]
13 <script type="text/javascript">
14 //<![CDATA[
15  $(document).ready(function() {
16     $("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
17         "aoColumnDefs": [
18             { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
19         ],
20         "aaSorting": [[ 1, "asc" ]],
21         "sPaginationType": "four_button"
22     }));
23
24     if ( $("#branches option:selected").length < 1 ) {
25         $("#branches option:first").attr("selected", "selected");
26     }
27     $('#icons').tabs();
28
29     $("a.delete").click(function(){
30         return confirm(_("Are you sure you want to delete this authorized value?"));
31     });
32 });
33 //]]>
34 </script>
35
36 [% IF op == 'list' %]
37 <script type="text/javascript">
38 //<![CDATA[
39 $(document).ready(function() {
40     $('#category').find("input:submit").hide();
41     $('#searchfield').change(function() {
42         $('#category').submit();
43     });
44 });
45 //]]>
46 </script>
47 [% END %]
48
49 <style type="text/css">
50         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
51     fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
52         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
53     fieldset.rows .ui-tabs-nav { margin-left : 10px; }
54 </style>
55 </head>
56 <body id="admin_authorised_values" class="admin">
57 [% INCLUDE 'header.inc' %]
58 [% INCLUDE 'cat-search.inc' %]
59 <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 op == 'add_form' %] <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a> &rsaquo; [% IF ( action_modify ) %]Modify authorized value[% END %]
60            [% IF ( action_add_value ) %]New authorized value[% END %]
61            [% IF ( action_add_category ) %]New category[% END %][% END %]
62 [% IF op == 'list' %]Authorized values[% END %]</div>
63
64 <div id="doc3" class="yui-t2">
65    
66    <div id="bd">
67         <div id="yui-main">
68         <div class="yui-b">
69
70 [% IF op == 'add_form' %]
71         <h1>
72            [% IF ( action_modify ) %]Modify authorized value[% END %]
73            [% IF ( action_add_value ) %]New authorized value[% END %]
74            [% IF ( action_add_category ) %]New category[% END %]
75         </h1>
76
77     [% IF ( action_modify ) %]<div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>[% END %]
78
79  <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated">
80     <input type="hidden" name="op" value="add" />
81         <fieldset class="rows"><ol>
82         <li>
83         [% IF ( action_add_category ) %]
84             <label for="category" class="required">Category: </label>
85             <input type="text" name="category"  id="category" size="32" maxlength="32" class="focus required" />
86             <span class="required">Required</span>
87                          [% ELSE %]<span class="label">Category</span>
88                 <input type="hidden" name="category" value="[% category %]" />   [% category %]
89                          [% END %]
90         </li>
91         <li>
92             <label for="authorised_value">Authorized value: </label>
93      [% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
94             [% IF ( action_add_category ) %]
95             <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" />
96             [% ELSE %]
97             <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" />
98             [% END %]
99         </li>
100         <li>
101             <label for="lib">Description: </label>
102             <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="200" />
103         </li>
104         <li>
105             <label for="lib_opac">Description (OPAC): </label>
106             <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac %]" maxlength="200" />
107         </li>
108         <li><label for="branches">Libraries limitation: </label>
109             <select id="branches" name="branches" multiple size="10">
110                 <option value="">All libraries</option>
111                 [% FOREACH branch IN branches_loop %]
112                   [% IF ( branch.selected ) %]
113                     <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
114                   [% ELSE %]
115                     <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
116                   [% END %]
117                 [% END %]
118             </select>
119             <span>Select 'All libraries' if this authorized value must be displayed all the time. Otherwise select libraries you want to associate with this value.</span>
120         </li>
121
122                 </ol>
123         <div id="icons" class="toptabs" style="clear:both">
124         <h5 style="margin-left:10px;">Choose an icon:</h5>
125                         <ul>
126                   <li><a href="#none">None</a></li>
127                                   [% FOREACH imageset IN imagesets %]
128                         [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
129                                   [% END %]
130                         </ul>
131   <div id="none"><ul>
132   <li><label for="noimage">No image: </label><input type="radio" name="imageurl" id="noimage" value="removeImage" /></li>
133   </ul>
134   <br class="clear" /></div>
135   [% FOREACH imageset IN imagesets %]
136   <div id="[% imageset.imagesetname %]"><ul>
137   [% FOREACH image IN imageset.images %]
138                         <li style="float: none; display: inline-block; clear : none; width: auto;">
139             <label> [% IF ( image.StaffImageUrl ) %]
140               <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
141         [% ELSE %]
142         [% END %]
143     [% IF ( image.checked ) %]
144               <input type="radio" name="imageurl" value="[% image.KohaImage %]" checked="checked" />
145     [% ELSE %]
146               [% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
147               <input type="radio" name="imageurl" value="[% image.KohaImage %]" />
148               [% END %]
149     [% END %]
150             </label>
151                         </li>
152   [% END %]</ul>
153   <br class="clear" />
154   </div>
155   [% END %]
156   </div>
157         </fieldset>
158        <fieldset class="action"> <input type="hidden" name="id" value="[% id %]" />
159         <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category %]">Cancel</a></fieldset>
160     </form>
161 [% END %]
162
163
164 [% IF op == 'list' %]
165
166 <div id="toolbar" class="btn-toolbar">
167     <a id="addauth" class="btn btn-small" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% category %]"><i class="fa fa-plus"> </i> New authorized value for [% category %]</a>
168     <a id="addcat" class="btn btn-small" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
169 </div>
170
171 <h1>Authorized values</h1>
172 <div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>
173
174 [% FOR m IN messages %]
175     <div class="dialog [% m.type %]">
176         [% SWITCH m.code %]
177         [% CASE 'error_on_update' %]
178             An error occurred when updating this authorized value. Perhaps the value already exists.
179         [% CASE 'error_on_insert' %]
180             An error occurred when inserting this authorized value. Perhaps the value or the category already exists.
181         [% CASE 'error_on_delete' %]
182             An error occurred when deleting this authorized value. Check the logs.
183         [% CASE 'success_on_update' %]
184             Authorized value updated successfully.
185         [% CASE 'success_on_insert' %]
186             Authorized value added successfully.
187         [% CASE 'success_on_delete' %]
188             Authorized value deleted successfully.
189         [% CASE 'already_exists' %]
190             This authorized value already exists.
191         [% CASE %]
192             [% m.code %]
193         [% END %]
194     </div>
195 [% END %]
196
197 <form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category">
198   <label for="searchfield">Show category: </label>
199   <select name="searchfield" id="searchfield" size="1">
200   [% FOR c IN categories %]
201     [% IF c == searchfield %]
202       <option value="[% c %]" selected="selected">[% c %]</option>
203     [% ELSE %]
204       <option value="[% c %]">[% c %]</option>
205     [% END %]
206   [% END %]
207   <input type="submit" value="Submit" />
208 </form>
209 [% IF ( category == 'Bsort1' ) %]
210     <p>An authorized value attached to patrons, that can be used for stats purposes</p>
211 [% END %]
212 [% IF ( category == 'Bsort2' ) %]
213     <p>An authorized value attached to patrons, that can be used for stats purposes</p>
214 [% END %]
215 [% IF ( category == 'Asort1' ) %]
216     <p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
217 [% END %]
218 [% IF ( category == 'Asort2' ) %]
219     <p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
220 [% END %]
221 [% IF ( category == 'SUGGEST' ) %]
222     <p>Reasons to reject or accept patron suggestions</p>
223 [% END %]
224 [% IF ( category == 'DAMAGED' ) %]
225     <p>Statuses to describe a damaged item</p>
226 [% END %]
227 [% IF ( category == 'LOST' ) %]
228    <p>Statuses to describe a lost item</p>
229 [% END %]
230 [% IF ( category == 'MANUAL_INV' ) %]
231     <p>Additional values for manual invoice types</p>
232 [% END %]
233 [% IF ( category == 'BOR_NOTES' ) %]
234     <p>Values for custom patron notes</p>
235 [% END %]
236 [% IF ( category == 'LOC' ) %]
237     <p>Values for shelving locations</p>
238 [% END %]
239 [% IF ( category == 'CCODE' ) %]
240     <p>Values for collection codes</p>
241  [% END %]
242  [% IF ( category == 'NOT_LOAN' ) %]
243     <p>Statuses to describe why an item is not for loan</p>
244  [% END %]
245 <h3>Authorized values for category [% category %]:</h3>
246
247 [% IF ( loop ) %]<div id="pagertable_authorized_values">
248 </div>[% END %]
249
250 [% IF ( loop ) %]<table id="table_authorized_values">
251 <thead><tr>
252         <th>Authorized value</th>
253         <th>Description</th>
254         <th>Description (OPAC)</th>
255         <th>Icon</th>
256     <th>Branches limitations</th>
257     <th>Actions</th>
258         </tr>
259 </thead><tbody>
260 [% FOREACH loo IN loop %]
261 [% UNLESS ( loop.odd ) %]
262 <tr>
263 [% ELSE %]
264 <tr>
265 [% END %]
266         <td>[% loo.authorised_value %]</td>
267         <td>[% loo.lib %]</td>
268         <td>[% loo.lib_opac %]</td>
269         <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
270     <td>
271         [% IF loo.branches.size > 0 %]
272             [% branches_str = "" %]
273             [% FOREACH branch IN loo.branches %]
274                 [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
275             [% END %]
276             <span href="#" title="[% branches_str %]">
277                 [% IF loo.branches.size > 1 %]
278                     [% loo.branches.size %] branches limitations
279                 [% ELSE %]
280                     [% loo.branches.size %] branch limitation
281                 [% END %]
282         [% ELSE %]
283             No limitation
284         [% END %]
285     </td>
286     <td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;id=[% loo.id %]" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a>
287     <a class="delete btn btn-mini" href="/cgi-bin/koha/admin/authorised_values.pl?op=delete&amp;searchfield=[% searchfield %]&amp;id=[% loo.id %]"><i class="fa fa-trash"></i> Delete</a></td>
288 </tr>
289 [% END %]
290 </tbody></table>[% ELSE %]
291 <div class="dialog message">There are no authorized values defined for [% category %]</div>
292 [% END %]
293
294 [% IF ( isprevpage ) %]
295 <form class="inline" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
296 <input type="hidden" name="searchfield" value="[% searchfield %]" />
297         <input type="submit" value="&lt;&lt; Previous" /></form>
298 [% END %] 
299
300 [% END %]
301
302 </div>
303 </div>
304 <div class="yui-b">
305 [% INCLUDE 'admin-menu.inc' %]
306 </div>
307 </div>
308 [% INCLUDE 'intranet-bottom.inc' %]