Merge branch 'new/bug11216' into 3.14.x
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / member.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Patrons [% IF ( searching ) %]&rsaquo; Search results[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript">
6 //<![CDATA[
7 $(document).ready(function() {
8     $('#add_to_patron_list_submit').attr('disabled', 'disabled');
9     $('#new_patron_list').hide();
10
11     $('#add_to_patron_list').change(function() {
12         var value = $('#add_to_patron_list').val();
13         if ( value == 'new' ) {
14             $('#new_patron_list').val('')
15             $('#new_patron_list').show();
16             $('#new_patron_list').focus();
17         } else if ( value ) {
18             $('#new_patron_list').hide();
19             $('#add_to_patron_list_submit').removeAttr('disabled');
20         } else {
21             $('#new_patron_list').hide();
22             $('#add_to_patron_list_submit').attr('disabled', 'disabled');
23         }
24
25     });
26
27     $('#new_patron_list').on('input', function() {
28         if ( $('#new_patron_list').val() ) {
29             $('#add_to_patron_list_submit').removeAttr('disabled');
30         } else {
31             $('#add_to_patron_list_submit').attr('disabled', 'disabled');
32         }
33     });
34 });
35
36 function CheckForm() {
37     if ( $('#add_to_patron_list').val() == 'new' ) {
38         if ( $('#new_patron_list').val() ) {
39             var exists = false;
40             $("#add_to_patron_list option").each(function() {
41                 if ( $(this).text() == $('#new_patron_list').val() ) {
42                     exists = true;
43                     return false;
44                 }
45             });
46
47             if ( exists ) {
48                 alert( _("You already have a list with that name!") );
49                 return false;
50             }
51         } else {
52             alert( _("You must give your new patron list a name!") );
53             return false;
54         }
55     }
56
57     if ( $('#add_to_patron_list_which').val() == 'all' ) {
58         return confirm( _("Are you sure you want to add the entire set of patron results to this list ( including results on other pages )?") );
59     } else {
60          if ( $("#add-patrons-to-list-form input:checkbox:checked").length == 0 ) {
61              alert( _("You have not selected any patrons to add to a list!") );
62              return false;
63          }
64     }
65
66     return true;
67 }
68 //]]>
69 </script>
70
71 </head>
72 <body id="pat_member" class="pat">
73 [% INCLUDE 'header.inc' %]
74 [% INCLUDE 'patron-search.inc' %]
75
76 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; [% IF ( searching ) %]<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Search results[% ELSE %]Patrons[% END %]</div>
77
78 <div id="doc2" class="yui-t7">
79
80    <div id="bd">
81                 <div id="yui-main">
82                     <div class="yui-b">
83                                 <div class="yui-g">
84
85                 [% IF patron_list %]
86                     <div class="dialog alert">
87                         Added [% patrons_added_to_list.size %] patrons to <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% patron_list.patron_list_id %]">[% patron_list.name %]</a>.
88                     </div>
89                 [% END %]
90
91                                 [% INCLUDE 'patron-toolbar.inc' %]
92
93         [% IF ( no_add ) %]<div class="dialog alert"><h3>Cannot add patron</h3>
94                 [% IF ( no_branches ) %]<p>There are <strong>no libraries defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/branches.pl">add a library</a>.[% ELSE %]An administrator must define at least one library.[% END %]</p>[% END %]
95                 [% IF ( no_categories ) %]<p>There are <strong>no patron categories defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/categorie.pl">add a patron category</a>.[% ELSE %]An administrator must define at least one patron category.[% END %]</p>[% END %]</div>
96         [% END %]
97
98                                                 <div class="browse">
99                                                         Browse by last name:
100                             [% FOREACH letter IN alphabet.split(' ') %]
101                                 <a href="/cgi-bin/koha/members/member.pl?quicksearch=1&amp;surname=[% letter %]">[% letter %]</a>
102                                                         [% END %]
103                                                 </div>
104
105                     [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
106                         <div class="pending-info" id="patron_updates_pending">
107                             <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
108                             <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
109                         </div>
110                     [% END %]
111
112                     [% IF ( resultsloop ) %]
113                     [% IF (CAN_user_tools_manage_patron_lists) %]
114                     <form id="add-patrons-to-list-form" method="post" action="member.pl" onsubmit="return CheckForm()">
115                     [% END %]
116                         <div id="searchheader">
117                             <h3>Results [% from %] to [% to %] of [% numresults %] found for [% IF ( member ) %]'<span class="ex">[% member %]</span>'[% END %][% IF ( surname ) %]'<span class="ex">[% surname %]</span>'[% END %]</h3>
118
119                             [% IF (CAN_user_tools_manage_patron_lists) %]
120                             <div>
121                                 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
122                                 |
123                                 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
124                                 |
125                                 <span>
126                                     <label for="add_to_patron_list_which">Add:</label>
127                                     <select id="add_to_patron_list_which" name="add_to_patron_list_which">
128                                         <option value="selected">Selected patrons</option>
129                                         <option value="all">All resultant patrons</option>
130                                     </select>
131
132                                     <label for="add_to_patron_list">to:</label>
133                                     <select id="add_to_patron_list" name="add_to_patron_list">
134                                         <option value=""></option>
135                                         [% IF patron_lists %]
136                                             <optgroup label="Patron lists:">
137                                                 [% FOREACH pl IN patron_lists %]
138                                                     <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
139                                                 [% END %]
140                                             </optgroup>
141                                         [% END %]
142
143                                         <option value="new">[ New list ]</option>
144                                     </select>
145
146                                     <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
147
148                                     [% FOREACH key IN search_parameters.keys %]
149                                         <input type="hidden" name="[% key %]" value="[% search_parameters.$key %]" />
150                                     [% END %]
151
152                                     <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
153                                 </span>
154                             </div>
155                             [% END %]
156                         </div>
157                                                 <div class="searchresults">
158
159                                                         <table id="memberresultst">
160                                                         <thead>
161                                                         <tr>
162                             [% IF (CAN_user_tools_manage_patron_lists) %]
163                             <th>&nbsp</th>
164                             [% END %]
165                                                         <th>Card</th>
166                                                         <th>Name</th>
167                                                         <th>Cat</th>
168                                                         <th>Library</th>
169                                                         <th>Expires on</th>
170                                                         <th>OD/Checkouts</th>
171                                                         <th>Fines</th>
172                                                         <th>Circ note</th>
173                                                         <th>&nbsp;</th>
174                                                         </tr>
175                                                         </thead>
176                                                         <tbody>
177                                                         [% FOREACH resultsloo IN resultsloop %]
178                                                         [% IF ( resultsloo.overdue ) %]
179                                                         <tr class="problem">
180                                                         [% ELSE %]
181                                                         [% UNLESS ( loop.odd ) %]
182                                                         <tr class="highlight">
183                                                         [% ELSE %]
184                                                         <tr>
185                                                         [% END %]
186                                                         [% END %]
187                             [% IF (CAN_user_tools_manage_patron_lists) %]
188                             <td><input type="checkbox" class="selection" name="borrowernumber" value="[% resultsloo.borrowernumber %]" /></td>
189                             [% END %]
190                                                         <td>[% resultsloo.cardnumber %]</td>
191                             <td style="white-space: nowrap;">
192                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resultsloo.borrowernumber %]">
193                             [% INCLUDE 'patron-title.inc' borrowernumber = resultsloo.borrowernumber category_type = resultsloo.category_type firstname = resultsloo.firstname surname = resultsloo.surname othernames = resultsloo.othernames cardnumber = resultsloo.cardnumber invert_name = 1%]
194                             </a> <br />
195                             [% IF ( resultsloo.streetnumber ) %][% resultsloo.streetnumber %] [% END %][% resultsloo.address %][% IF ( resultsloo.address2 ) %]<br />[% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]<br />[% resultsloo.city %][% IF ( resultsloo.state ) %],[% END %][% END %][% IF ( resultsloo.state ) %] [% resultsloo.state %][% END %] [% IF ( resultsloo.zipcode ) %]  [% resultsloo.zipcode %][% END %][% IF ( resultsloo.country ) %], [% resultsloo.country %][% END %]</td>
196                                                         <td>[% resultsloo.category_description %] ([% resultsloo.category_type %])</td>
197                                                         <td>[% resultsloo.branchname %]</td>
198                                                         <td>[% resultsloo.dateexpiry %]</td>
199                                                         <td>[% IF ( resultsloo.overdues ) %]<span class="overdue"><strong>[% resultsloo.overdues %]</strong></span>[% ELSE %][% resultsloo.overdues %][% END %]/[% resultsloo.issues %]</td>
200                                                         <td>[% IF ( resultsloo.fines < 0 ) %]<span class="credit">[% resultsloo.fines %]</span> [% ELSIF resultsloo.fines > 0 %] <span class="debit"><strong>[% resultsloo.fines %]</strong></span> [% ELSE %] [% resultsloo.fines %] [% END %]</td>
201                                                         <td>[% resultsloo.borrowernotes %]</td>
202                                                         <td>[% IF ( resultsloo.category_type ) %]
203                                                                         <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;category_type=[% resultsloo.category_type %]">Edit</a>
204                                                 [% ELSE %] <!-- try with categorycode if no category_type -->
205                                                         [% IF ( resultsloo.categorycode ) %]
206                                                                         <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;categorycode=[% resultsloo.categorycode %]">Edit</a>
207                                                         [% ELSE %] <!-- if no categorycode, set category_type to A by default -->
208                                                                         <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;category_type=A">Edit</a>
209                                                         [% END %]
210                                                 [% END %]</td>
211                                                         </tr>
212                                                         [% END %]
213                                                         </tbody>
214                                                         </table>
215                                                         <div class="pages">[% IF ( multipage ) %][% paginationbar %][% END %]</div>
216                                                 </div>
217                     [% IF (CAN_user_tools_manage_patron_lists) %]
218                     </form>
219                     [% END %]
220                     [% ELSE %]
221                         [% IF ( searching ) %]
222                             <div class="dialog alert">No results found</div>
223                         [% END %]
224                     [% END %]
225
226                                         </div>
227                                 </div>
228
229                                 <div class="yui-g">
230                                 [% INCLUDE 'members-menu.inc' %]
231                         </div>
232
233     </div>
234 </div>
235 [% INCLUDE 'intranet-bottom.inc' %]