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