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