Bug 32910: (follow-up) Replace v4 icon names with v6
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / patron-attr-types.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE AuthorisedValues %]
5 [% USE Branches %]
6 [% USE scalar %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>
10 [% IF ( attribute_type_form ) %]
11     [% IF ( edit_attribute_type ) %]
12         Modify patron attribute type &rsaquo; [% ELSE %]
13         Add patron attribute type &rsaquo; [% END %]
14 [% END %]
15
16 [% IF ( delete_attribute_type_form ) %]
17     Confirm deletion of patron attribute type &quot;[% code | html %]&quot; &rsaquo; [% END %]
18
19 Patron attribute types &rsaquo; Administration &rsaquo; Koha
20 </title>
21 [% INCLUDE 'doc-head-close.inc' %]
22 </head>
23
24 <body id="admin_patron-attr-types" class="admin">
25 [% WRAPPER 'header.inc' %]
26     [% INCLUDE 'prefs-admin-search.inc' %]
27 [% END %]
28
29 [% WRAPPER 'sub-header.inc' %]
30     [% WRAPPER breadcrumbs %]
31         [% WRAPPER breadcrumb_item %]
32             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
33         [% END %]
34
35         [% IF ( attribute_type_form || delete_attribute_type_form ) %]
36             [% WRAPPER breadcrumb_item %]
37                 <a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a>
38             [% END %]
39         [% END %]
40
41         [% IF ( attribute_type_form ) %]
42             [% WRAPPER breadcrumb_item bc_active= 1 %]
43                 [% IF ( edit_attribute_type ) %]
44                     <span>Modify patron attribute type</span>
45                 [% ELSE %]
46                     <span>Add patron attribute type</span>
47                 [% END %]
48             [% END %]
49
50         [% ELSIF ( delete_attribute_type_form ) %]
51             [% WRAPPER breadcrumb_item bc_active= 1 %]
52                 <span>Confirm deletion of patron attribute type '[% code | html %]'</span>
53             [% END %]
54
55         [% ELSE %]
56             [% WRAPPER breadcrumb_item bc_active= 1 %]
57                 <span>Patron attribute types</span>
58             [% END %]
59         [% END %]
60     [% END #/ WRAPPER breadcrumbs %]
61 [% END #/ WRAPPER sub-header.inc %]
62
63 <div class="main container-fluid">
64     <div class="row">
65         <div class="col-sm-10 col-sm-push-2">
66             <main>
67
68 [% IF ( WARNING_extended_attributes_off ) %]
69 <div class="dialog message">Because the 'ExtendedPatronAttributes` system preference is currently not enabled, extended patron attributes cannot be given to patron records.  <br/>Go to the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=ExtendedPatronAttributes">ExtendedPatronAttributes</a> system preference if you wish to enable this feature.</div>
70 [% END %]
71
72 [% IF ( attribute_type_form ) %]
73   [% IF ( edit_attribute_type ) %]
74 <h1>Modify patron attribute type</h1>
75   [% ELSE %]
76 <h1>Add patron attribute type</h1>
77   [% END %]
78 [% IF ( duplicate_code_error ) %]
79 <div class="dialog message">Could not add patron attribute type &quot;[% duplicate_code_error | html %]&quot; 
80     &mdash; one with that code already exists.
81 </div>
82 [% END %]
83 <form action="[% script_name | html %]" class="validated" method="post">
84   <input type="hidden" name="op" value="[% confirm_op | html %]" />
85   <fieldset class="rows">
86     <ol>
87       <li>
88           [% IF attribute_type %]
89             <span class="label">Patron attribute type code: </span>
90             <input type="hidden" name="code" value="[% attribute_type.code |html %]" />
91             [% attribute_type.code |html %]
92           [% ELSE %]
93               <label for="code" class="required">Patron attribute type code: </label>
94               <input type="text" id="code" name="code" required="required" class="required focus" size="10" maxlength="10" />
95               <span class="required">Required</span>
96           [% END %]
97        </li>
98        <li><label for="description" class="required">Description: </label>
99            <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
100            <span class="required">Required</span>
101        </li>
102
103         [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
104             <li aria-disabled="true">
105         [% ELSE %]
106             <li>
107         [% END %]
108             <label for="repeatable">Repeatable: </label>
109             [% IF attribute_type %]
110                 [% IF attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
111                     <input type="checkbox" id="repeatable" name="repeatable" checked="checked" disabled="disabled" title="At least one patron has more than one value for this attribute" />
112                     <input type="hidden" name="repeatable" value="1" />
113                 [% ELSIF attribute_type.repeatable %]
114                     <input type="checkbox" id="repeatable" name="repeatable" checked="checked" />
115                 [% ELSE %]
116                     <input type="checkbox" id="repeatable" name="repeatable" />
117                 [% END %]
118             [% ELSE %]
119                 <input type="checkbox" id="repeatable" name="repeatable" />
120             [% END %]
121             <span class="hint">Check to let a patron record have multiple values of this attribute.</span>
122         </li>
123
124         [% IF attribute_type AND not can_be_set_to_unique %]
125             <li aria-disabled="true">
126         [% ELSE %]
127             <li>
128         [% END %]
129             <label for="unique_id">Unique identifier: </label>
130             [% IF attribute_type %]
131                 [% IF attribute_type.unique_id %]
132                     <input type="checkbox" id="unique_id" name="unique_id" checked="checked" />
133                 [% ELSIF can_be_set_to_unique %]
134                     <input type="checkbox" id="unique_id" name="unique_id" />
135                 [% ELSE %]
136                     <input type="checkbox" id="unique_id" name="unique_id" disabled="disabled" title="At least two patrons have the same value for this attribute" />
137                     <input type="hidden" name="unique_id" value="0" />
138                 [% END %]
139             [% ELSE %]
140                 <input type="checkbox" id="unique_id" name="unique_id" />
141             [% END %]
142             <span class="hint">If checked, attribute will be a unique identifier. If a value is given to a patron record, the same value
143                   cannot be given to a different record.</span>
144         </li>
145
146        <li><label for="opac_display">Display in OPAC: </label>
147           [% IF attribute_type AND attribute_type.opac_display %]
148             <input type="checkbox" id="opac_display" name="opac_display" checked="checked" />
149           [% ELSE %]
150             <input type="checkbox" id="opac_display" name="opac_display" />
151           [% END %]
152             <span class="hint">Check to display this attribute on a patron's details page in the OPAC.</span>
153        </li>
154        <li><label for="opac_editable">Editable in OPAC: </label>
155           [% IF attribute_type AND attribute_type.opac_editable %]
156             <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
157           [% ELSE %]
158             <input type="checkbox" id="opac_editable" name="opac_editable" />
159           [% END %]
160             <span class="hint">Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above)</span>
161        </li>
162        <li><label for="staff_searchable">Searchable: </label>
163           [% IF attribute_type AND attribute_type.staff_searchable %]
164             <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
165           [% ELSE %]
166             <input type="checkbox" id="staff_searchable" name="staff_searchable" />
167           [% END %]
168             <span class="hint">Check to make this attribute staff_searchable in the staff patron search.</span>
169        </li>
170        <li><label for="mandatory">Mandatory: </label>
171           [% IF attribute_type AND attribute_type.mandatory %]
172             <input type="checkbox" id="mandatory" name="mandatory" checked="checked" />
173           [% ELSE %]
174             <input type="checkbox" id="mandatory" name="mandatory" />
175           [% END %]
176             <span class="hint">Check to make this attribute mandatory when creating or editing a patron.</span>
177        </li>
178        <li><label for="display_checkout">Display in patron's brief information: </label>
179             [% IF attribute_type AND attribute_type.display_checkout %]
180                 <input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
181             [% ELSE %]
182                 <input type="checkbox" id="display_checkout" name="display_checkout" />
183             [% END %]
184             <span class="hint">Check to show this attribute in the brief information panel in the patron's record (staff interface).</span>
185        </li>
186
187         [% IF Koha.Preference('Pseudonymization') %]
188             <li>
189                 <label for="keep_for_pseudonymization">Keep for pseudonymization: </label>
190                 [% IF attribute_type AND attribute_type.keep_for_pseudonymization %]
191                     <input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" checked="checked" />
192                 [% ELSE %]
193                     <input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" />
194                 [% END %]
195                 <span class="hint">Check to make this attribute copied to the patron's pseudonymized attributes.</span>
196             </li>
197         [% END %]
198
199         <li><label for="authorised_value_category">Authorized value category: </label>
200             <select name="authorised_value_category" id="authorised_value_category">
201                 <option value=""></option>
202                 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => attribute_type.authorised_value_category ) %]
203             </select>
204             <div class="hint">If one is selected, the patron record input page will only allow values to be chosen from the authorized value list.  However, an authorized value list is not enforced during batch patron import.</div>
205         </li>
206         <li><label for="branches">Library limitation: </label>
207             <select id="branches" name="branches" multiple size="10">
208                 <option value="">All libraries</option>
209                 [% PROCESS options_for_libraries libraries => Branches.all( selected => attribute_type.library_limits ) %]
210             </select>
211             <div class="hint">Select "All libraries" if this attribute type should always be displayed. Otherwise select libraries you want to associate with this value.
212             </div>
213         </li>
214         <li>
215             <label for="category">Category: </label>
216             <select name="category_code" id="category">
217                 <option value=""></option>
218                 [% FOREACH cat IN categories %]
219                     [% IF ( cat.categorycode == attribute_type.category_code ) %]<option value="[% cat.categorycode | html %]" selected="selected">[% cat.description |html %]</option>[% ELSE %]<option value="[% cat.categorycode | html %]">[% cat.description |html %]</option>[% END %]
220                 [% END %]
221             </select>
222             <div class="hint">Choose one to limit this attribute to one patron type. Please leave blank if you want these attributes to be available for all types of patrons.</div>
223         </li>
224         <li>
225             <label for="class">Class: </label>
226             [% PROCESS 'av-build-dropbox.inc' name="class", category="PA_CLASS" default=attribute_type.class empty=1 %]
227             <div class="hint">
228                 [% IF ( CAN_user_parameters_manage_auth_values ) %]
229                     Group attributes types with a block title (based on <a target="_blank" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=PA_CLASS">authorized values category 'PA_CLASS'</a>)
230                 [% ELSE %]
231                     Group attributes types with a block title (based on authorized values category 'PA_CLASS')
232                 [% END %]
233             </div>
234         </li>
235     </ol>
236   </fieldset>
237   <fieldset class="action">
238       <input type="submit" class="btn btn-primary" value="Save" />
239     <a class="cancel" href="/cgi-bin/koha/admin/patron-attr-types.pl">Cancel</a>
240   </fieldset>
241 </form>
242 [% END %]
243
244 [% IF ( delete_attribute_type_form ) %]
245     <div class="dialog alert">
246         <h1>Confirm deletion of patron attribute type <span class="ex">'[% code | html %]' ([% description | html %])</span>?</h1>
247         <form action="[% script_name | html %]" name="Aform" method="post">
248             <input type="hidden" name="op" value="[% confirm_op | html %]" />
249             <input type="hidden" name="code" value="[% code | html %]" />
250             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete patron attribute type</button>
251         </form>
252         <form action="[% script_name | html %]" method="get">
253             <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
254         </form>
255     </div>
256 [% END %]
257
258 [% IF ( display_list ) %]
259
260 <div id="toolbar" class="btn-toolbar">
261     <a class="btn btn-default" id="newrule" href="[% script_name | url %]?op=add_attribute_type"><i class="fa fa-plus"></i> New patron attribute type</a>
262 </div>
263
264 <h1>Patron attribute types</h1>
265 [% IF ( added_attribute_type ) %]
266 <div class="dialog message">Added patron attribute type &quot;[% added_attribute_type | html %]&quot;</div>
267 [% END %]
268 [% IF ( edited_attribute_type ) %]
269 <div class="dialog message">Modified patron attribute type &quot;[% edited_attribute_type | html %]&quot;</div>
270 [% END %]
271 [% IF ( deleted_attribute_type ) %]
272 <div class="dialog message">Deleted patron attribute type &quot;[% deleted_attribute_type | html %]&quot;</div>
273 [% END %]
274 [% IF ( ERROR_delete_in_use ) %]
275 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_in_use | html %]&quot; 
276     &mdash; it is in use by [% ERROR_num_patrons | html %] patron records</div>
277 [% END %]
278 [% IF ( ERROR_delete_not_found ) %]
279 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_not_found | html %]&quot; 
280     &mdash; it was already absent from the database.</div>
281 [% END %]
282 [% IF ( available_attribute_types ) %]
283     [% FOREACH attribute IN available_attribute_types %]
284     <div class="page-section">
285     [% IF attribute.class %]
286         <h2>[% attribute.lib | html %]</h2>
287     [% ELSE %]
288         <h2>Unclassified types</h2>
289     [% END %]
290         <table class="patron_attributes_types" id="patron_attr[% attribute.class | html %]">
291           <thead>
292             <tr>
293               <th>Code</th>
294               <th>Description</th>
295               <th>Library limitation</th>
296               <th>Authorized value category</th>
297               <th>Mandatory</th>
298               <th class="NoSort noExport">Actions</th>
299             </tr>
300           </thead>
301           <tbody>
302             [% FOREACH item IN attribute.items %]
303               <tr>
304                 <td>[% item.code | html %]</td>
305                 <td>[% item.description | html %]</td>
306                 <td>
307                     [% SET libraries = item.library_limits %]
308                     [% IF ( libraries && libraries.count > 0 ) %]
309                         [% branches_str = "" %]
310                         [% FOREACH branch IN libraries %]
311                             [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
312                         [% END %]
313                         <span title="[% branches_str | html %]">
314                             [% IF libraries.count > 1 %]
315                                 <span>[% libraries.count | html %] library limitations</span>
316                             [% ELSE %]
317                                 <span>[% libraries.count | html %] library limitation</span>
318                             [% END %]
319                         </span>
320                     [% ELSE %]
321                         No limitation
322                     [% END %]
323                 </td>
324                 <td>
325                     [% IF ( CAN_user_parameters_manage_auth_values ) %]
326                         <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% item.authorised_value_category | uri %]">[% item.authorised_value_category | html %]</a></td>
327                     [% ELSE %]
328                         [% item.authorised_value_category | html %]
329                     [% END %]
330                 <td>
331                     [% IF ( item.mandatory ) -%]
332                        <span>Yes</span>
333                     [% ELSE -%]
334                        <span>No</span>
335                     [% END %]
336                 </td>
337                 <td class="actions">
338                   <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-pencil-alt"></i> Edit</a>
339                   <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
340                 </td>
341               </tr>
342             [% END %]
343           </tbody>
344         </table>
345     </div><!-- ./page-section -->
346   [% END %]
347 [% ELSE %]
348   <p>There are no saved patron attribute types.</p>
349 [% END %]
350
351 <div class="pages">[% pagination_bar | $raw %]</div>
352
353 [% END %]
354
355             </main>
356         </div> <!-- /.col-sm-10.col-sm-push-2 -->
357
358         <div class="col-sm-2 col-sm-pull-10">
359             <aside>
360                 [% INCLUDE 'admin-menu.inc' %]
361             </aside>
362         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
363      </div> <!-- /.row -->
364
365 [% MACRO jsinclude BLOCK %]
366     [% Asset.js("js/admin-menu.js") | $raw %]
367     [% INCLUDE 'datatables.inc' %]
368     [% INCLUDE 'columns_settings.inc' %]
369     <script>
370         $(document).ready(function() {
371             if ( $("#branches option:selected").length < 1 ) {
372                 $("#branches option:first").attr("selected", "selected");
373             }
374
375             $("#opac_display").change( function() {
376                 if ( this.checked ) {
377                     $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
378                 } else {
379                     $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
380                 }
381             } ).change();
382
383             $(".patron_attributes_types").each(function(){
384                 var tableid = $(this).attr("id");
385                 KohaTable( tableid, {
386                     "bPaginate": false,
387                     'autoWidth': false,
388                 }, null );
389             });
390         });
391     </script>
392 [% END %]
393 [% INCLUDE 'intranet-bottom.inc' %]