Bug 21803: Redesign authorized values interface
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / authorised_values.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; Authorized values
6 [% IF op == 'add_form' %]
7   [% IF ( action_modify ) %] &rsaquo; Modify authorized value[% END %]
8   [% IF ( action_add_value ) %] &rsaquo;  New authorized value[% END %]
9   [% IF ( action_add_category ) %] &rsaquo; New category[% END %]
10 [% END %]
11 </title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% Asset.css("css/datatables.css") | $raw %]
14
15 <style>
16         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
17     fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
18         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
19     fieldset.rows .ui-tabs-nav { margin-left : 10px; }
20 </style>
21 </head>
22
23 <body id="admin_authorised_values" class="admin">
24 [% INCLUDE 'header.inc' %]
25 [% INCLUDE 'prefs-admin-search.inc' %]
26 <div id="breadcrumbs">
27     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
28     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
29     [% IF op == 'add_form' %]
30         <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a> &rsaquo;
31         [% IF ( action_modify ) %]Modify authorized value[% END %]
32         [% IF ( action_add_value ) %]New authorized value[% END %]
33         [% IF ( action_add_category ) %]New category[% END %]
34     [% ELSIF ( loop ) %]
35         <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a> &rsaquo;
36         Authorized values for category [% category | html %]
37     [% ELSE %]
38         Authorized values
39     [% END %]
40 </div>
41
42 <div class="main container-fluid">
43     <div class="row">
44         <div class="col-sm-10 col-sm-push-2">
45             <main>
46
47 [% IF op == 'add_form' %]
48         <h1>
49            [% IF ( action_modify ) %]Modify authorized value[% END %]
50            [% IF ( action_add_value ) %]New authorized value[% END %]
51            [% IF ( action_add_category ) %]New category[% END %]
52         </h1>
53
54     [% 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 %]
55
56  <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated">
57         <fieldset class="rows"><ol>
58         [% IF action_add_category %]
59             <li>
60                 <label for="category" class="required">Category: </label>
61                 <input type="text" name="category"  id="category" size="32" maxlength="32" class="focus required" />
62                 <span class="required">Required</span>
63                 <input type="hidden" name="op" value="add_category" />
64             </li>
65         [% ELSE %]
66             <li>
67                 <span class="label">Category</span>
68                 <input type="hidden" name="op" value="add" />
69                 <input type="hidden" name="category" value="[% category | html %]" /> [% category | html %]
70             </li>
71         <li>
72             <label for="authorised_value">Authorized value: </label>
73             [% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id | html %]" />[% END %]
74             <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value | html %]" maxlength="80" class="focus" />
75         </li>
76         <li>
77             <label for="lib">Description: </label>
78             <input type="text" name="lib" id="lib" value="[% lib | html %]" maxlength="200" />
79         </li>
80         <li>
81             <label for="lib_opac">Description (OPAC): </label>
82             <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac | html %]" maxlength="200" />
83         </li>
84         <li><label for="branches">Libraries limitation: </label>
85             <select id="branches" name="branches" multiple size="10">
86                 <option value="">All libraries</option>
87                 [% FOREACH branch IN branches_loop %]
88                   [% IF ( branch.selected ) %]
89                     <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
90                   [% ELSE %]
91                     <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
92                   [% END %]
93                 [% END %]
94             </select>
95             <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>
96         </li>
97
98                 </ol>
99         <div id="icons" class="toptabs" style="clear:both">
100         <h5 style="margin-left:10px;">Choose an icon:</h5>
101                         <ul>
102                   <li><a href="#none">None</a></li>
103                                   [% FOREACH imageset IN imagesets %]
104                         [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname | uri %]">[% imageset.imagesetname | html %]</a></li>
105                                   [% END %]
106                         </ul>
107   <div id="none"><ul>
108   <li><label for="noimage">No image: </label><input type="radio" name="imageurl" id="noimage" value="removeImage" /></li>
109   </ul>
110   <br class="clear" /></div>
111   [% FOREACH imageset IN imagesets %]
112   <div id="[% imageset.imagesetname | html %]"><ul>
113   [% FOREACH image IN imageset.images %]
114                         <li style="float: none; display: inline-block; clear : none; width: auto;">
115             <label> [% IF ( image.StaffImageUrl ) %]
116               <img src="[% image.StaffImageUrl | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
117         [% ELSE %]
118         [% END %]
119     [% IF ( image.checked ) %]
120               <input type="radio" name="imageurl" value="[% image.KohaImage | html %]" checked="checked" />
121     [% ELSE %]
122               [% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
123               <input type="radio" name="imageurl" value="[% image.KohaImage | html %]" />
124               [% END %]
125     [% END %]
126             </label>
127                         </li>
128   [% END %]</ul>
129   <br class="clear" />
130   </div>
131   [% END %]
132   </div>
133         [% END %]
134         </fieldset>
135        <fieldset class="action"> <input type="hidden" name="id" value="[% id | html %]" />
136         <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category | url %]">Cancel</a></fieldset>
137     </form>
138 [% END %]
139
140 [% IF op == 'list' %]
141
142 <div id="toolbar" class="btn-toolbar">
143     <a id="addcat" class="btn btn-default btn-sm" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
144     [% IF ( searchfield ) %]
145         <a id="addauth" class="btn btn-default btn-sm" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% category | url %]"><i class="fa fa-plus"> </i> New authorized value for [% category | html %]</a>
146     [% END %]
147 </div>
148
149 [% IF ( searchfield ) %]
150     <h1>Authorized values for category [% category | html %]</h1>
151     [% PROCESS category_descriptions code_category = category %]
152 [% ELSE %]
153     <h1>Authorized values</h1>
154 [% END %]
155
156 [% IF ( searchfield ) %]
157     <div class="note">
158         <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.
159     </div>
160 [% END %]
161
162 [% FOR m IN messages %]
163     <div class="dialog [% m.type | html %]">
164         [% SWITCH m.code %]
165         [% CASE 'error_on_update' %]
166             An error occurred when updating this authorized value. Perhaps the value already exists.
167         [% CASE 'error_on_insert' %]
168             An error occurred when inserting this authorized value. Perhaps the value or the category already exists.
169         [% CASE 'error_on_insert_cat' %]
170             An error occurred when inserting this authorized value category. Perhaps the category name already exists.
171         [% CASE 'error_on_delete' %]
172             An error occurred when deleting this authorized value. Check the logs.
173         [% CASE 'success_on_update' %]
174             Authorized value updated successfully.
175         [% CASE 'success_on_insert' %]
176             Authorized value added successfully.
177         [% CASE 'success_on_insert_cat' %]
178             Authorized value category added successfully.
179         [% CASE 'success_on_delete' %]
180             Authorized value deleted successfully.
181         [% CASE 'already_exists' %]
182             This authorized value already exists.
183         [% CASE 'cat_already_exists' %]
184             This authorized value category already exists.
185         [% CASE 'invalid_category_name' %]
186             The authorized value category 'branches', 'itemtypes' and 'cn_source' are used internally by Koha and are not valid.
187         [% CASE %]
188             [% m.code | html %]
189         [% END %]
190     </div>
191 [% END %]
192
193 [% IF ( searchfield ) %]
194
195     <form action="/cgi-bin/koha/admin/authorised_values.pl" method="get" id="category">
196         <p>
197             <label for="searchfield">Show category: </label>
198             <select name="searchfield" id="searchfield" size="1">
199                 [% FOR c IN categories %]
200                     [% IF c == searchfield %]
201                         <option value="[% c | html %]" selected="selected">[% c | html %]</option>
202                     [% ELSE %]
203                         <option value="[% c | html %]">[% c | html %]</option>
204                     [% END %]
205                 [% END %]
206             </select>
207             <input type="submit" value="Submit" />
208         </p>
209     </form>
210
211     [% IF loop %]
212
213     <table id="table_authorized_values" class="authorized_values_table">
214     <thead><tr>
215         <th>Authorized value</th>
216         <th>Description</th>
217         <th>Description (OPAC)</th>
218         <th>Icon</th>
219         <th>Branches limitations</th>
220         <th>Actions</th>
221         </tr>
222     </thead><tbody>
223     [% FOREACH loo IN loop %]
224     <tr>
225         <td>[% loo.authorised_value | html %]</td>
226         <td>[% loo.lib | html %]</td>
227         <td>[% loo.lib_opac | html %]</td>
228         <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
229         <td>
230             [% IF loo.branches.size > 0 %]
231                 [% branches_str = "" %]
232                 [% FOREACH branch IN loo.branches %]
233                     [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
234                 [% END %]
235                 <span href="#" title="[% branches_str | html %]">
236                     [% IF loo.branches.size > 1 %]
237                         [% loo.branches.size | html %] branches limitations
238                     [% ELSE %]
239                         [% loo.branches.size | html %] branch limitation
240                     [% END %]
241             [% ELSE %]
242                 No limitation
243             [% END %]
244         </td>
245         <td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;id=[% loo.id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
246         <a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/admin/authorised_values.pl?op=delete&amp;searchfield=[% searchfield | uri %]&amp;id=[% loo.id | uri %]"><i class="fa fa-trash"></i> Delete</a></td>
247     </tr>
248     [% END # /FOREACH loop %]
249     </tbody></table>
250     [% ELSE %]
251         <div class="dialog message">
252             <p>There are no authorized values defined for [% category | html %]</p>
253             <form action="/cgi-bin/koha/admin/authorised_values.pl" method="get">
254                 <input type="hidden" name="op" value="add_form" />
255                 <input type="hidden" name="category" value="[% category | html %]" />
256                 <button type="submit"><i class="fa fa-plus"></i> Add a new authorized value</button>
257             </form>
258         </div>
259     [% END %]
260
261 [% ELSE # category was selected %]
262
263     <table id="categoriest" class="authorized_values_table">
264         <thead>
265             <tr>
266                 <th>Category</th>
267                 <th>Description</th>
268                 <th>&nbsp;</th>
269             </tr>
270         </thead>
271         <tbody>
272             [% FOR c IN categories %]
273                 <tr>
274                     <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
275                     <td>
276                         [% PROCESS category_descriptions code_category = c %]
277                     </td>
278                     <td>
279                         <a id="addauth" class="btn btn-default btn-xs" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% c | uri %]"><i class="fa fa-plus"> </i> Add</a>
280                     </td>
281                 </tr>
282             [% END %]
283         </tbody>
284     </table>
285 [% END # /IF ( searchfield  )%]
286
287 [% END # /IF op == 'list' %]
288
289             </main>
290         </div> <!-- /.col-sm-10.col-sm-push-2 -->
291
292         <div class="col-sm-2 col-sm-pull-10">
293             <aside>
294                 [% INCLUDE 'admin-menu.inc' %]
295             </aside>
296         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
297      </div> <!-- /.row -->
298
299 [% MACRO jsinclude BLOCK %]
300     [% Asset.js("js/admin-menu.js") | $raw %]
301     [% INCLUDE 'datatables.inc' %]
302     <script>
303         $(document).ready(function() {
304             $(".authorized_values_table").dataTable($.extend(true, {}, dataTablesDefaults, {
305                 "aoColumnDefs": [
306                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
307                 ],
308                 "aaSorting": [[ 0, "asc" ]],
309                 "sPaginationType": "four_button"
310             }));
311
312             if ( $("#branches option:selected").length < 1 ) {
313                 $("#branches option:first").attr("selected", "selected");
314             }
315             $('#icons').tabs();
316
317             $("a.delete").click(function(){
318                 return confirm(_("Are you sure you want to delete this authorized value?"));
319             });
320             $('#category').find("input:submit").hide();
321             $('#searchfield').change(function() {
322                 $('#category').submit();
323             });
324         });
325     </script>
326 [% END %]
327
328 [% BLOCK category_descriptions %]
329     [% SWITCH code_category %]
330         [% CASE 'Asort1' %]
331             <p>Used for acquisitions statistical purposes</p>
332         [% CASE 'Asort2' %]
333             <p>Used for acquisitions statistical purposes</p>
334         [% CASE 'BOR_NOTES' %]
335             <p>Values for custom patron messages that appear on the circulation screen and the OPAC. The value in the description field should be the message text and is limited to 200 characters</p>
336         [% CASE 'branches' %]
337             <p></p>
338         [% CASE 'Bsort1' %]
339             <p>Values that can be entered to fill in the patron’s sort 2 field</p>
340         [% CASE 'Bsort2' %]
341             <p>An authorized value attached to patrons, that can be used for statistical purposes</p>
342         [% CASE 'CAND' %]
343             <p></p>
344         [% CASE 'CCODE' %]
345             <p>Collection codes (appears when cataloging and working with items)</p>
346         [% CASE 'cn_source' %]
347             <p></p>
348         [% CASE 'CONTROL_NUM_SEQUENCE' %]
349             <p></p>
350         [% CASE 'COUNTRY' %]
351             <p>Used in UNIMARC 102 $a</p>
352         [% CASE 'DAMAGED' %]
353             <p>Descriptions for items marked as damaged (appears when cataloging and working with items)</p>
354         [% CASE 'DEPARTMENT' %]
355             <p>Departments are required by and will be used in the Course Reserves module</p>
356         [% CASE 'ETAT' %]
357             <p>Used in French UNIMARC installations in field 995 $o to identify item status. Similar to NOT_LOAN</p>
358         [% CASE 'HINGS_AS' %]
359             <p>General holdings: acquisition status designator :: This data element specifies acquisition status for the unit at the time of the holdings report.</p>
360         [% CASE 'HINGS_C' %]
361             <p>General holdings: completeness designator</p>
362         [% CASE 'HINGS_PF' %]
363             <p>Physical form designators</p>
364         [% CASE 'HINGS_RD' %]
365             <p>General holdings: retention designator :: This data element specifies the retention policy for the unit at the time of the holdings report.</p>
366         [% CASE 'HINGS_UT' %]
367             <p>General holdings: type of unit designator</p>
368         [% CASE 'HSBND_FREQ' %]
369             <p>Frequencies used by the housebound module. They are displayed on the housebound tab in the patron account in staff.</p>
370         [% CASE 'ITEMTYPECAT' %]
371             <p>Allows multiple Item types to be searched in a category. Categories can be entered into the Authorized value ITEMTYPECAT. To combine Item types to this category, enter this Search category to any Item types</p>
372         [% CASE 'itemtypes' %]
373             <p></p>
374         [% CASE 'LANG' %]
375             <p>ISO 639-2 standard language codes</p>
376         [% CASE 'LOC' %]
377             <p>Shelving location (usually appears when adding or editing an item). LOC maps to items.location in the Koha database.</p>
378         [% CASE 'LOST' %]
379             <p>Descriptions for the items marked as lost (appears when adding or editing an item)</p>
380         [% CASE 'MANUAL_INV' %]
381             <p>Values for manual invoicing types</p>
382         [% CASE 'NOT_LOAN' %]
383             <p>Reasons why a title is not for loan</p>
384         [% CASE 'OPAC_SUG' %]
385             <p>A list of reasons displayed in the suggestion form on the OPAC.</p>
386         [% CASE 'ORDER_CANCELLATION_REASON' %]
387             <p>Reasons why an order might have been cancelled</p>
388         [% CASE 'PAYMENT_TYPE' %]
389             <p>Populates a dropdown list of custom payment types when paying fines</p>
390         [% CASE 'qualif' %]
391             <p>Function codes (author, editor, collaborator, etc.) used in UNIMARC 7XX $4 (French)</p>
392         [% CASE 'RELTERMS' %]
393             <p>French terms of relations</p>
394         [% CASE 'REPORT_GROUP' %]
395             <p>A way to sort and filter your reports, the default values in this category include the Koha modules (Accounts, Acquitisions, Catalog, Circulation, Patrons)</p>
396         [% CASE 'REPORT_SUBGROUP' %]
397             <p>Can be used to further sort and filter your reports. This category is empty by default. Values here need to include the authorized value code from REPORT_GROUP in the Description (OPAC) field to link the subgroup to the appropriate group.</p>
398         [% CASE 'RESTRICTED' %]
399             <p>Restricted status of an item</p>
400         [% CASE 'ROADTYPE' %]
401             <p>Road types to be used in patron addresses</p>
402         [% CASE 'SIP_MEDIA_TYPE' %]
403             <p>Used when creating or editing an item type to assign a SIP specific media type for devices like lockers and sorters.</p>
404         [% CASE 'STACK' %]
405             <p>Shelving control number</p>
406         [% CASE 'SUGGEST' %]
407             <p>List of patron suggestion reject or accept reasons (appears when managing suggestions)</p>
408         [% CASE 'SUGGEST_FORMAT' %]
409             <p>List of Item types to display in a drop down menu on the Purchase suggestion form on the OPAC. When creating the authorized values for SUGGEST_FORMAT, enter a description into this form so it is visible on the OPAC to patrons.</p>
410         [% CASE 'SUGGEST_STATUS' %]
411             <p>A list of additional custom status values for suggestions that can be used in addition to the default values.</p>
412         [% CASE 'TERM' %]
413             <p>Terms to be used in Course Reserves module. Enter terms that will show in the drop down menu when setting up a Course reserve. (For example: Spring, Summer, Winter, Fall).</p>
414         [% CASE 'WITHDRAWN' %]
415             <p>Description of a withdrawn item (appears when adding or editing an item)</p>
416         [% CASE 'YES_NO' %]
417             <p>A generic authorized value field that can be used anywhere you need a simple yes/no pull down menu.</p>
418     [% END %]
419 [% END %]
420
421 [% INCLUDE 'intranet-bottom.inc' %]