Bug 27356: Don't hide the SMTP servers table when last displayed is deleted
[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        <li><label for="repeatable">Repeatable: </label>
81             [% IF attribute_type %]
82                 [% IF attribute_type.repeatable %]
83                     <input type="checkbox" id="repeatable" name="repeatable" checked="checked" disabled="disabled" />
84                 [% ELSE %]
85                     <input type="checkbox" id="repeatable" name="repeatable" disabled="disabled" />
86                 [% END %]
87             [% ELSE %]
88                 <input type="checkbox" id="repeatable" name="repeatable" />
89             [% END %]
90             <span>Check to let a patron record have multiple values of this attribute.
91                   This setting cannot be changed after an attribute is defined.</span>
92        </li>
93        <li><label for="unique_id">Unique identifier: </label>
94             [% IF attribute_type %]
95                 [% IF attribute_type.unique_id %]
96                     <input type="checkbox" id="unique_id" name="unique_id" checked="checked" disabled="disabled" />
97                 [% ELSE %]
98                     <input type="checkbox" id="unique_id" name="unique_id" disabled="disabled" />
99                 [% END %]
100             [% ELSE %]
101                 <input type="checkbox" id="unique_id" name="unique_id" />
102             [% END %]
103             <span>If checked, attribute will be a unique identifier &mdash; if a value is given to a patron record, the same value
104                   cannot be given to a different record.  This setting cannot be changed after an attribute is defined.</span>
105        </li>
106        <li><label for="opac_display">Display in OPAC: </label>
107           [% IF attribute_type AND attribute_type.opac_display %]
108             <input type="checkbox" id="opac_display" name="opac_display" checked="checked" />
109           [% ELSE %]
110             <input type="checkbox" id="opac_display" name="opac_display" />
111           [% END %]
112             <span>Check to display this attribute on a patron's details page in the OPAC.</span>
113        </li>
114        <li><label for="opac_editable">Editable in OPAC: </label>
115           [% IF attribute_type AND attribute_type.opac_editable %]
116             <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
117           [% ELSE %]
118             <input type="checkbox" id="opac_editable" name="opac_editable" />
119           [% END %]
120             <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> if set.)</span>
121        </li>
122        <li><label for="staff_searchable">Searchable: </label>
123           [% IF attribute_type AND attribute_type.staff_searchable %]
124             <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
125           [% ELSE %]
126             <input type="checkbox" id="staff_searchable" name="staff_searchable" />
127           [% END %]
128             <span>Check to make this attribute staff_searchable in the staff patron search.</span>
129        </li>
130        <li><label for="mandatory">Mandatory: </label>
131           [% IF attribute_type AND attribute_type.mandatory %]
132             <input type="checkbox" id="mandatory" name="mandatory" checked="checked" />
133           [% ELSE %]
134             <input type="checkbox" id="mandatory" name="mandatory" />
135           [% END %]
136             <span>Check to make this attribute mandatory when creating or editing a patron.</span>
137        </li>
138        <li><label for="display_checkout">Display in patron's brief information: </label>
139             [% IF attribute_type AND attribute_type.display_checkout %]
140                 <input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
141             [% ELSE %]
142                 <input type="checkbox" id="display_checkout" name="display_checkout" />
143             [% END %]
144             <span>Check to show this attribute in the brief information panel in the patron's record (staff interface).</span>
145        </li>
146
147         [% IF Koha.Preference('Pseudonymization') %]
148             <li>
149                 <label for="keep_for_pseudonymization">Keep for pseudonymization: </label>
150                 [% IF attribute_type AND attribute_type.keep_for_pseudonymization %]
151                     <input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" checked="checked" />
152                 [% ELSE %]
153                     <input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" />
154                 [% END %]
155                 <span>Check to make this attribute copied to the patron's pseudonymized attributes.</span>
156             </li>
157         [% END %]
158
159         <li><label for="authorised_value_category">Authorized value category: </label>
160             <select name="authorised_value_category" id="authorised_value_category">
161                 <option value=""></option>
162                 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => attribute_type.authorised_value_category ) %]
163             </select>
164             <span>Authorized value category; if one is selected, the patron record input page will only allow values 
165                   to be chosen from the authorized value list.  However, an authorized value list is not 
166                   enforced during batch patron import.</span>
167         </li>
168         <li><label for="branches">Branches limitation: </label>
169             <select id="branches" name="branches" multiple size="10">
170                 <option value="">All branches</option>
171                 [% PROCESS options_for_libraries libraries => Branches.all( selecteds => attribute_type.library_limits ) %]
172             </select>
173             <span>Select All if this attribute type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
174             </span>
175         </li>
176         <li>
177             <label for="category">Category: </label>
178             <select name="category_code" id="category">
179                 <option value=""></option>
180                 [% FOREACH cat IN categories %]
181                     [% 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 %]
182                 [% END %]
183             </select>
184             <span>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.</span>
185         </li>
186         <li>
187             <label for="class">Class: </label>
188             [% PROCESS 'av-build-dropbox.inc' name="class", category="PA_CLASS" default=attribute_type.class %]
189             <span>Group attributes types with a block title (based on authorized values category 'PA_CLASS')</span>
190         </li>
191     </ol>
192   </fieldset>
193   <fieldset class="action">
194       <input type="submit" value="Save" />
195     <a class="cancel" href="/cgi-bin/koha/admin/patron-attr-types.pl">Cancel</a>
196   </fieldset>
197 </form>
198 [% END %]
199
200 [% IF ( delete_attribute_type_form ) %]
201     <div class="dialog alert">
202         <h3>Confirm deletion of patron attribute type <span class="ex">'[% code | html %]' ([% description | html %])</span>?</h3>
203         <form action="[% script_name | html %]" name="Aform" method="post">
204             <input type="hidden" name="op" value="[% confirm_op | html %]" />
205             <input type="hidden" name="code" value="[% code | html %]" />
206             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete patron attribute type</button>
207         </form>
208         <form action="[% script_name | html %]" method="get">
209             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
210         </form>
211     </div>
212 [% END %]
213
214 [% IF ( display_list ) %]
215
216 <div id="toolbar" class="btn-toolbar">
217     <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>
218 </div>
219
220 <h2>Patron attribute types</h2>
221 [% IF ( added_attribute_type ) %]
222 <div class="dialog message">Added patron attribute type &quot;[% added_attribute_type | html %]&quot;</div>
223 [% END %]
224 [% IF ( edited_attribute_type ) %]
225 <div class="dialog message">Modified patron attribute type &quot;[% edited_attribute_type | html %]&quot;</div>
226 [% END %]
227 [% IF ( deleted_attribute_type ) %]
228 <div class="dialog message">Deleted patron attribute type &quot;[% deleted_attribute_type | html %]&quot;</div>
229 [% END %]
230 [% IF ( ERROR_delete_in_use ) %]
231 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_in_use | html %]&quot; 
232     &mdash; it is in use by [% ERROR_num_patrons | html %] patron records</div>
233 [% END %]
234 [% IF ( ERROR_delete_not_found ) %]
235 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_not_found | html %]&quot; 
236     &mdash; it was already absent from the database.</div>
237 [% END %]
238 [% IF ( available_attribute_types ) %]
239   [% FOREACH attribute IN available_attribute_types %]
240     [% IF attribute.class %]
241         <h4>[% attribute.lib | html %]</h4>
242     [% END %]
243     <table class="patron_attributes_types">
244       <thead>
245         <tr>
246           <th>Code</th>
247           <th>Description</th>
248           <th>Branches limitation</th>
249           <th>Actions</th>
250         </tr>
251       </thead>
252       <tbody>
253         [% FOREACH item IN attribute.items %]
254           <tr>
255             <td>[% item.code | html %]</td>
256             <td>[% item.description | html %]</td>
257             <td>
258                 [% SET libraries = item.library_limits %]
259                 [% IF ( libraries && libraries.count > 0 ) %]
260                     [% branches_str = "" %]
261                     [% FOREACH branch IN libraries %]
262                         [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
263                     [% END %]
264                     <span title="[% branches_str | html %]">
265                         [% IF libraries.count > 1 %]
266                             [% libraries.count | html %] branches limitations
267                         [% ELSE %]
268                             [% libraries.count | html %] branch limitation
269                         [% END %]
270                     </span>
271                 [% ELSE %]
272                     No limitation
273                 [% END %]
274             </td>
275             <td class="actions">
276               <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>
277               <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>
278             </td>
279           </tr>
280         [% END %]
281       </tbody>
282     </table>
283   [% END %]
284 [% ELSE %]
285   <p>There are no saved patron attribute types.</p>
286 [% END %]
287
288 <div class="pages">[% pagination_bar | $raw %]</div>
289
290 [% END %]
291
292             </main>
293         </div> <!-- /.col-sm-10.col-sm-push-2 -->
294
295         <div class="col-sm-2 col-sm-pull-10">
296             <aside>
297                 [% INCLUDE 'admin-menu.inc' %]
298             </aside>
299         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
300      </div> <!-- /.row -->
301
302 [% MACRO jsinclude BLOCK %]
303     [% Asset.js("js/admin-menu.js") | $raw %]
304     <script>
305         $(document).ready(function() {
306             if ( $("#branches option:selected").length < 1 ) {
307                 $("#branches option:first").attr("selected", "selected");
308             }
309
310             $("#opac_display").change( function() {
311                 if ( this.checked ) {
312                     $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
313                 } else {
314                     $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
315                 }
316             } ).change();
317         });
318     </script>
319 [% END %]
320 [% INCLUDE 'intranet-bottom.inc' %]