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