Bug 17222: Use jQuery selector instead
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-memberentry.tt
blob77e17e31c714946088527189ed710d172fcb3804
1 [% USE Categories %]
2 [% USE Koha %]
3 [% USE Branches %]
4 [% USE KohaDates %]
5 [% SET userupdateview = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8     <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF action == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %][% END %]
11 </head>
13 [% IF action == 'edit' %]
14 [% INCLUDE 'bodytag.inc' bodyid='opac-patron-update' %]
15 [% ELSE %]
16 <body id="opac-patron-registration" class="opac">
17 [% END %]
18 [% INCLUDE 'masthead.inc' %]
20 <div class="main">
21     <ul class="breadcrumb">
22         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
23         [% IF action == 'edit' %]
24             <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
25             <li><a href="#">Your personal details</a></li>
26         [% ELSE %]
27             <li><a href="#">Register a new account</a></li>
28         [% END %]
29     </ul>
31     <div class="container-fluid">
32         <div class="row-fluid">
33             <div class="span2">
34                 <div id="navigation">
35                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
36                 </div>
37             </div>
38             <div class="span10">
39                 [% IF action == 'edit' %]
40                     <div id="update-account">
41                 [% ELSE %]
42                     <div id="add-account">
43                 [% END %]
45                 [% IF action == 'edit' %]
46                     [% UNLESS OPACPatronDetails %]
47                         <div class="alert alert-info">To make changes to your record please contact the library.</div>
48                     [% END %]
49                     [% IF nochanges %]
50                         <div class="alert alert-error">No changes were made.</div>
51                     [% END %]
52                 [% END %]
54                 [% IF empty_mandatory_fields %]
55                     <div class="alert">You have not filled out all required fields. Please fill in all missing fields and resubmit.</div>
56                 [% END %]
58                 [% IF invalid_form_fields %]
59                     <div class="alert alert-error"><strong>The following fields contain invalid information:</strong>
60                         <ul>
61                             [% FOREACH field IN invalid_form_fields %]
62                                 [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
63                                 [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
64                                 [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
65                                 [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
66                                 [% IF field == "password_invalid" %]<li>Password does not meet minimum requirements! <a href="#password">password</a></li>[% END %]
67                                 [% IF field == "password_spaces" %]<li>Password contains leading and/or trailing spaces! <a href="#password">password</a></li>[% END %]
68                             [% END %]
69                         </ul>
70                         Please correct the errors and resubmit.
71                     </div>
72                 [% END %]
74                 [% IF cardnumber_wrong_length || cardnumber_already_exists %]
75                     <div class="alert alert-error">
76                         [% IF cardnumber_wrong_length %]
77                         <a href="#borrower_cardnumber"><strong>The entered card number is the wrong length.</strong></a>
78                         [% ELSIF cardnumber_already_exists %]
79                         <a href="#borrower_cardnumber"><strong>The entered card number is already in use.</strong></a>
80                         [% END %]
81                         Please correct this and resubmit.
82                     </div>
83                 [% END %]
85                 [% IF failed_captcha %]
86                     <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
87                 [% END %]
89                 [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
90                     <fieldset class="rows" id="memberentry_privacy">
91                         <legend id="privacy_legend">Privacy</legend>
92                         <ol>
93                             <li>
94                                 <label>Allow your guarantor to view your current checkouts?</label>
95                                 <select id="privacy_guarantor_checkouts">
96                                     <option value="0">No</option>
97                                     [% IF borrower.privacy_guarantor_checkouts %]
98                                         <option value="1" selected="selected">Yes</option>
99                                     [% ELSE %]
100                                         <option value="1">Yes</option>
101                                     [% END %]
102                                 </select>
103                                 <span class="hint">
104                                     <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
105                                     <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
106                                 </span>
107                                 <span class="hint">
108                                     Your guarantor is <i>[% guarantor.firstname %] [% guarantor.surname %]</i>
109                                 </span>
110                             </li>
111                         </ol>
112                     </fieldset>
113                 [% END %]
115                 <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form">
117                 [% UNLESS
118                     ( hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) ) &&
119                     hidden.defined('dateexpiry') && hidden.defined('branchcode') && hidden.defined('categorycode')
120                 %]
121                     <fieldset class="rows" id="memberentry_library">
123                         <legend id="library_legend">Library</legend>
124                             <ol>
125                                 [% UNLESS hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) %]
126                                 <li>
127                                     [% IF mandatory.defined('cardnumber') %]
128                                         <label for="borrower_cardnumber" class="required">
129                                     [% ELSE %]
130                                         <label for="borrower_cardnumber">
131                                     [% END %]
132                                     Library card number:
133                                     </label>
134                                     [% IF borrower %]
135                                         [% borrower.cardnumber %]
136                                     [% ELSE %]
137                                         <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" value="[% borrower.cardnumber %]" />
138                                         [% IF mandatory.defined('cardnumber') %]<span class="required">Required</span>[% END %]
139                                     [% END %]
140                                 </li>
141                                 [% END %]
143                                 [% UNLESS hidden.defined('dateexpiry') %]
144                                 <li>
145                                     <label>Expiration date:</label>
146                                     [% borrower.dateexpiry | $KohaDates  %]
147                                 </li>
148                                 [% END %]
150                                 [% UNLESS hidden.defined('branchcode') %]
151                                     <li>
152                                         [% IF mandatory.defined('branchcode') %]
153                                             <label for="borrower_branchcode" class="required">
154                                         [% ELSE %]
155                                             <label for="borrower_branchcode">
156                                         [% END %]
157                                         Home library:</label>
159                                         <select id="borrower_branchcode" name="borrower_branchcode">
160                                             [% PROCESS options_for_libraries libraries => Branches.all( selected => borrower.branchcode ) %]
161                                         </select>
162                                     </li>
163                                 [% END %]
165                                 [% UNLESS hidden.defined('categorycode') %]
166                                     <li>
167                                         <label for="borrower_categorycode">
168                                         Category:</label>
170                                         [% IF borrower %]
171                                             [% Categories.GetName( borrower.categorycode ) %]
172                                             <input type="hidden" name="borrower_categorycode" value="[% borrower.categorycode %]" />
173                                         [% ELSE %]
174                                             <select id="borrower_categorycode" name="borrower_categorycode">
175                                                 [% FOREACH c IN Categories.all() %]
176                                                     [% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]
177                                                         <option value="[% c.categorycode %]" selected="selected">[% c.description %]</option>
178                                                     [% ELSE %]
179                                                         <option value="[% c.categorycode %]">[% c.description %]</option>
180                                                     [% END %]
181                                                 [% END %]
182                                             </select>
183                                         [% END %]
184                                     </li>
185                                 [% END %]
186                             </ol>
187                         </fieldset>
188                 [% END # / defined 'branchcode' %]
190                 [% UNLESS
191                     hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') &&
192                     hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') &&
193                     hidden.defined('sex')
194                 %]
195                     <div class="row-fluid">
196                         [% IF ( display_patron_image ) %]
197                             <div class="span8">
198                         [% ELSE %]
199                             <div class="span12">
200                         [% END %]
201                             <fieldset class="rows" id="memberentry_identity">
202                                 <legend id="identity_legend">Identity</legend>
204                                 <ol>
205                                     [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %]
206                                         <li>
207                                             [% IF mandatory.defined('title') %]
208                                                 <label for="borrower_title" class="required">
209                                             [% ELSE %]
210                                                 <label for="borrower_title">
211                                             [% END %]
212                                             Salutation:</label>
214                                             <select id="borrower_title" name="borrower_title">
215                                                 <option value=""></option>
216                                                 [% FOREACH mt IN Koha.Preference('BorrowersTitles').split('\|') %]
217                                                     [% IF mt == borrower.title %]
218                                                         <option value="[% mt %]" selected="selected">[% mt %]</option>
219                                                     [% ELSE %]
220                                                         <option value="[% mt %]">[% mt %]</option>
221                                                     [% END %]
222                                                 [% END %]
223                                             </select>
224                                         </li>
225                                     [% END %]
227                                     [% UNLESS hidden.defined('surname') %]
228                                         <li>
229                                             [% IF mandatory.defined('surname') %]
230                                                 <label for="borrower_surname" class="required">
231                                             [% ELSE %]
232                                                 <label for="borrower_surname">
233                                             [% END %]
234                                             Surname:</label>
236                                             <input type="text" id="borrower_surname" name="borrower_surname" value="[% borrower.surname %]" />
237                                             [% IF mandatory.defined('surname') %]<span class="required">Required</span>[% END %]
238                                         </li>
239                                     [% END %]
241                                     [% UNLESS hidden.defined('firstname') %]
242                                         <li>
243                                             [% IF mandatory.defined('firstname') %]
244                                                 <label for="borrower_firstname" class="required">
245                                             [% ELSE %]
246                                                 <label for="borrower_firstname">
247                                             [% END %]
248                                             First name:</label>
250                                             <input type="text" id="borrower_firstname" name="borrower_firstname" value="[% borrower.firstname %]" />
251                                             [% IF mandatory.defined('firstname') %]<span class="required">Required</span>[% END %]
252                                         </li>
253                                     [% END %]
255                                     [% UNLESS hidden.defined('dateofbirth') %]
256                                         <li>
257                                             [% IF mandatory.defined('dateofbirth') %]
258                                                 <label for="borrower_dateofbirth" class="required">
259                                             [% ELSE %]
260                                                 <label for="borrower_dateofbirth">
261                                             [% END %]
262                                             Date of birth:</label>
264                                             <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" size="10" />
266                                             [% UNLESS action == 'edit' && !OPACPatronDetails %]
267                                                 [% UNLESS ( mandatory.defined('dateofbirth') ) %]
268                                                     <a href="#" style="font-size:85%;text-decoration:none;" class="cleardate">Clear date</a>
269                                                 [% END %]
270                                             [% END %]
272                                             [% IF mandatory.defined('dateofbirth') %]<span class="required">Required</span>[% END %]
273                                         </li>
274                                     [% END %]
276                                     [% UNLESS hidden.defined('initials') %]
277                                         <li>
278                                             [% IF mandatory.defined('initials') %]
279                                                 <label for="borrower_initials" class="required">
280                                             [% ELSE %]
281                                                 <label for="borrower_initials">
282                                             [% END %]
283                                             Initials:</label>
285                                             <input type="text" id="borrower_initials" name="borrower_initials" value="[% borrower.initials %]" />
286                                             [% IF mandatory.defined('initials') %]<span class="required">Required</span>[% END %]
287                                         </li>
288                                     [% END %]
290                                     [% UNLESS hidden.defined('othernames') %]
291                                         <li>
292                                             [% IF mandatory.defined('othernames') %]
293                                                 <label for="borrower_othernames" class="required">
294                                             [% ELSE %]
295                                                 <label for="borrower_othernames">
296                                             [% END %]
297                                             Other names:</label>
299                                             <input type="text" id="borrower_othernames" name="borrower_othernames" value="[% borrower.othernames %]" />
300                                             [% IF mandatory.defined('othernames') %]<span class="required">Required</span>[% END %]
301                                         </li>
302                                     [% END %]
304                                     [% UNLESS hidden.defined('sex') %]
305                                         <li class="lradio">
306                                             <label for="sex-female" class="radio inline">Female:</label>
307                                             [% IF borrower.sex == 'F' %]
308                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" checked="checked" />
309                                             [% ELSE %]
310                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" />
311                                             [% END %]
313                                             <label for="sex-male" class="radio inline">Male:</label>
314                                             [% IF borrower.sex == 'M' %]
315                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" checked="checked" />
316                                             [% ELSE %]
317                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" />
318                                             [% END %]
320                                             <label for="sex-none" class="radio inline">None specified: </label>
321                                             [% IF borrower.sex == '' %]
322                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" checked="checked" />
323                                             [% ELSE %]
324                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" />
325                                             [% END %]
327                                             [% IF mandatory.defined('sex') %]<span class="required">Required</span>[% END %]
328                                         </li>
329                                     [% END %]
330                                 </ol>
331                             </fieldset>
332                            </div>
333                         [% IF ( display_patron_image ) %]
334                             <div class="span4">
335                                 <p class="patronimage">
336                                    <img src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
337                                 </p>
338                             </div>
339                         [% END %]
340                     </div>
341                 [% END # /UNLESS fields hidden %]
343                 [% UNLESS
344                     hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') &&
345                     hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') &&
346                     hidden.defined('country')
347                 %]
348                     <fieldset class="rows" id="memberentry_mainaddress">
349                         <legend id="mainaddress_legend">Main address</legend>
351                         <ol>
352                             [% UNLESS hidden.defined('streetnumber') %]
353                                 <li>
354                                     [% IF mandatory.defined('streetnumber') %]
355                                         <label for="borrower_streetnumber" class="required">
356                                     [% ELSE %]
357                                         <label for="borrower_streetnumber">
358                                     [% END %]
359                                     Street number:</label>
361                                     <input type="text" id="borrower_streetnumber" name="borrower_streetnumber" value="[% borrower.streetnumber %]" />
362                                     [% IF mandatory.defined('streetnumber') %]<span class="required">Required</span>[% END %]
363                                 </li>
364                             [% END %]
366                             [% UNLESS hidden.defined('address') %]
367                                 <li>
368                                     [% IF mandatory.defined('address') %]
369                                         <label for="borrower_address" class="required">
370                                     [% ELSE %]
371                                         <label for="borrower_address">
372                                     [% END %]
373                                     Address:</label>
375                                     <input type="text" id="borrower_address" name="borrower_address" value="[% borrower.address %]" />
376                                     [% IF mandatory.defined('address') %]<span class="required">Required</span>[% END %]
377                                 </li>
378                             [% END %]
380                             [% UNLESS hidden.defined('address2') %]
381                                 <li>
382                                     [% IF mandatory.defined('address2') %]
383                                         <label for="borrower_address2" class="required">
384                                     [% ELSE %]
385                                         <label for="borrower_address2">
386                                     [% END %]
387                                     Address 2:</label>
389                                     <input type="text" id="borrower_address2" name="borrower_address2" value="[% borrower.address2 %]" />
390                                     [% IF mandatory.defined('address2') %]<span class="required">Required</span>[% END %]
391                                 </li>
392                             [% END %]
394                             [% UNLESS hidden.defined('city') %]
395                                 <li>
396                                     [% IF mandatory.defined('city') %]
397                                         <label for="borrower_city" class="required">
398                                     [% ELSE %]
399                                         <label for="borrower_city">
400                                     [% END %]
401                                     City:</label>
403                                     <input type="text" id="borrower_city" name="borrower_city" value="[% borrower.city %]" />
404                                     [% IF mandatory.defined('city') %]<span class="required">Required</span>[% END %]
405                                 </li>
406                             [% END %]
408                             [% UNLESS hidden.defined('state') %]
409                                 <li>
410                                     [% IF mandatory.defined('state') %]
411                                         <label for="borrower_state" class="required">
412                                     [% ELSE %]
413                                         <label for="borrower_state">
414                                     [% END %]
415                                     State:</label>
417                                     <input type="text" id="borrower_state" name="borrower_state" value="[% borrower.state %]" />
418                                     [% IF mandatory.defined('state') %]<span class="required">Required</span>[% END %]
419                                 </li>
420                             [% END %]
422                             [% UNLESS hidden.defined('zipcode') %]
423                                 <li>
424                                     [% IF mandatory.defined('zipcode') %]
425                                         <label for="borrower_zipcode" class="required">
426                                     [% ELSE %]
427                                         <label for="borrower_zipcode">
428                                     [% END %]
429                                     ZIP/Postal code:</label>
431                                     <input type="text" id="borrower_zipcode" name="borrower_zipcode" value="[% borrower.zipcode %]" />
432                                     [% IF mandatory.defined('zipcode') %]<span class="required">Required</span>[% END %]
433                                 </li>
434                             [% END %]
436                             [% UNLESS hidden.defined('country') %]
437                                 <li>
438                                     [% IF mandatory.defined('country') %]
439                                         <label for="borrower_country" class="required">
440                                     [% ELSE %]
441                                         <label for="borrower_country">
442                                     [% END %]
443                                     Country:</label>
445                                     <input type="text" id="borrower_country" name="borrower_country" value="[% borrower.country %]" />
446                                     [% IF mandatory.defined('country') %]<span class="required">Required</span>[% END %]
447                                 </li>
448                             [% END %]
450                         </ol>
451                     </fieldset>
452                 [% END %]
454                 [% UNLESS
455                     hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') &&
456                     hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax')
457                 %]
458                     <fieldset class="rows" id="memberentry_contact">
459                         <legend id="contact_legend">Contact information</legend>
461                         <ol>
462                             [% UNLESS hidden.defined('phone') %]
463                                 <li>
464                                     [% IF mandatory.defined('phone') %]
465                                         <label for="borrower_phone" class="required">
466                                     [% ELSE %]
467                                         <label for="borrower_phone">
468                                     [% END %]
469                                     Primary phone:</label>
471                                     <input type="text" id="borrower_phone" name="borrower_phone" value="[% borrower.phone %]" />
472                                     [% IF mandatory.defined('phone') %]<span class="required">Required</span>[% END %]
473                                 </li>
474                             [% END %]
476                             [% UNLESS hidden.defined('phonepro') %]
477                                 <li>
478                                     [% IF mandatory.defined('phonepro') %]
479                                         <label for="borrower_phonepro" class="required">
480                                     [% ELSE %]
481                                         <label for="borrower_phonepro">
482                                     [% END %]
483                                     Secondary phone:</label>
485                                     <input type="text" id="borrower_phonepro" name="borrower_phonepro" value="[% borrower.phonepro %]" />
486                                     [% IF mandatory.defined('phonepro') %]<span class="required">Required</span>[% END %]
487                                 </li>
488                             [% END %]
490                             [% UNLESS hidden.defined('mobile') %]
491                                 <li>
492                                     [% IF mandatory.defined('mobile') %]
493                                         <label for="borrower_mobile" class="required">
494                                     [% ELSE %]
495                                         <label for="borrower_mobile">
496                                     [% END %]
497                                     Other phone:</label>
499                                     <input type="text" id="borrower_mobile" name="borrower_mobile" value="[% borrower.mobile %]" />
500                                     [% IF mandatory.defined('mobile') %]<span class="required">Required</span>[% END %]
501                                 </li>
502                             [% END %]
504                             [% UNLESS hidden.defined('email') %]
505                                 <li>
506                                     [% IF mandatory.defined('email') %]
507                                         <label for="borrower_email" class="required">
508                                     [% ELSE %]
509                                         <label for="borrower_email">
510                                     [% END %]
511                                     Primary email:</label>
513                                     <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email %]" />
514                                     [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
515                                 </li>
516                             [% END %]
518                             [% UNLESS hidden.defined('emailpro') %]
519                                 <li>
520                                     [% IF mandatory.defined('emailpro') %]
521                                         <label for="borrower_emailpro" class="required">
522                                     [% ELSE %]
523                                         <label for="borrower_emailpro">
524                                     [% END %]
525                                     Secondary email:</label>
527                                     <input type="text" id="borrower_emailpro" name="borrower_emailpro" value="[% borrower.emailpro %]" />
528                                     [% IF mandatory.defined('emailpro') %]<span class="required">Required</span>[% END %]
529                                 </li>
530                             [% END %]
532                             [% UNLESS hidden.defined('fax') %]
533                                 <li>
534                                     [% IF mandatory.defined('fax') %]
535                                         <label for="borrower_fax" class="required">
536                                     [% ELSE %]
537                                         <label for="borrower_fax">
538                                     [% END %]
539                                     Fax:</label>
541                                     <input type="text" id="borrower_fax" name="borrower_fax" value="[% borrower.fax %]" />
542                                     [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
543                                 </li>
544                             [% END %]
545                         </ol>
546                     </fieldset>
547                 [% END %]
549                 [% UNLESS
550                     hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') &&
551                     hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') &&
552                     hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote')
553                 %]
554                     <fieldset class="rows" id="memberentry_alternateaddress">
555                         <legend id="alternateaddress_legend">Alternate address</legend>
557                         <ol>
558                             [% UNLESS hidden.defined('B_address') %]
559                                 <li>
560                                     [% IF mandatory.defined('B_address') %]
561                                         <label for="borrower_B_address" class="required">
562                                     [% ELSE %]
563                                         <label for="borrower_B_address">
564                                     [% END %]
565                                     Address:</label>
567                                     <input type="text" id="borrower_B_address" name="borrower_B_address" value="[% borrower.B_address %]" />
568                                     [% IF mandatory.defined('B_address') %]<span class="required">Required</span>[% END %]
569                                 </li>
570                             [% END %]
572                             [% UNLESS hidden.defined('B_address2') %]
573                                 <li>
574                                     [% IF mandatory.defined('B_address2') %]
575                                         <label for="borrower_B_address2" class="required">
576                                     [% ELSE %]
577                                         <label for="borrower_B_address2">
578                                     [% END %]
579                                     Address 2:</label>
581                                     <input type="text" id="borrower_B_address2" name="borrower_B_address2" value="[% borrower.B_address2 %]" />
582                                     [% IF mandatory.defined('B_address2') %]<span class="required">Required</span>[% END %]
583                                 </li>
584                             [% END %]
586                             [% UNLESS hidden.defined('B_city') %]
587                                 <li>
588                                     [% IF mandatory.defined('B_city') %]
589                                         <label for="borrower_B_city" class="required">
590                                     [% ELSE %]
591                                         <label for="borrower_B_city">
592                                     [% END %]
593                                     City:</label>
595                                     <input type="text" id="borrower_B_city" name="borrower_B_city" value="[% borrower.B_city %]" />
596                                     [% IF mandatory.defined('B_city') %]<span class="required">Required</span>[% END %]
597                                 </li>
598                             [% END %]
600                             [% UNLESS hidden.defined('B_state') %]
601                                 <li>
602                                     [% IF mandatory.defined('B_state') %]
603                                         <label for="borrower_B_state" class="required">
604                                     [% ELSE %]
605                                         <label for="borrower_B_state">
606                                     [% END %]
607                                     State:</label>
609                                     <input type="text" id="borrower_B_state" name="borrower_B_state" value="[% borrower.B_state %]" />
610                                     [% IF mandatory.defined('B_state') %]<span class="required">Required</span>[% END %]
611                                 </li>
612                             [% END %]
614                             [% UNLESS hidden.defined('B_zipcode') %]
615                                 <li>
616                                     [% IF mandatory.defined('B_zipcode') %]
617                                         <label for="borrower_B_zipcode" class="required">
618                                     [% ELSE %]
619                                         <label for="borrower_B_zipcode">
620                                     [% END %]
621                                     ZIP/Postal code:</label>
623                                     <input type="text" id="borrower_B_zipcode" name="borrower_B_zipcode" value="[% borrower.B_zipcode %]" />
624                                     [% IF mandatory.defined('B_zipcode') %]<span class="required">Required</span>[% END %]
625                                 </li>
626                             [% END %]
628                             [% UNLESS hidden.defined('B_country') %]
629                                 <li>
630                                     [% IF mandatory.defined('B_country') %]
631                                         <label for="borrower_B_country" class="required">
632                                     [% ELSE %]
633                                         <label for="borrower_B_country">
634                                     [% END %]
635                                     Country:</label>
637                                     <input type="text" id="borrower_B_country" name="borrower_B_country" value="[% borrower.B_country %]" />
638                                     [% IF mandatory.defined('B_country') %]<span class="required">Required</span>[% END %]
639                                 </li>
640                             [% END %]
642                             [% UNLESS hidden.defined('B_phone') %]
643                                 <li>
644                                     [% IF mandatory.defined('B_phone') %]
645                                         <label for="borrower_B_phone" class="required">
646                                     [% ELSE %]
647                                         <label for="borrower_B_phone">
648                                     [% END %]
649                                     Phone:</label>
651                                     <input type="text" id="borrower_B_phone" name="borrower_B_phone" value="[% borrower.B_phone %]" />
652                                     [% IF mandatory.defined('B_phone') %]<span class="required">Required</span>[% END %]
653                                 </li>
654                             [% END %]
656                             [% UNLESS hidden.defined('B_email') %]
657                                 <li>
658                                     [% IF mandatory.defined('B_email') %]
659                                         <label for="borrower_B_email" class="required">
660                                     [% ELSE %]
661                                         <label for="borrower_B_email">
662                                     [% END %]
663                                     Email:</label>
665                                     <input type="text" id="borrower_B_email" name="borrower_B_email" value="[% borrower.B_email %]" />
666                                     [% IF mandatory.defined('B_email') %]<span class="required">Required</span>[% END %]
667                                 </li>
668                             [% END %]
670                             [% UNLESS hidden.defined('contactnote') %]
671                                 <li>
672                                     [% IF mandatory.defined('contactnote') %]
673                                         <label for="borrower_contactnote" class="required">
674                                     [% ELSE %]
675                                         <label for="borrower_contactnote">
676                                     [% END %]
677                                     Contact note:</label>
679                                     <textarea id="borrower_contactnote" name="borrower_contactnote" cols="30" rows="2">[% borrower.contactnote %]</textarea>
680                                     [% IF mandatory.defined('contactnote') %]<span class="required">Required</span>[% END %]
681                                 </li>
682                             [% END %]
684                         </ol>
685                     </fieldset>
686                 [% END %]
688                 [% UNLESS
689                     hidden.defined('altcontactsurname') && hidden.defined('altcontactfirstname') && hidden.defined('altcontactaddress1') &&
690                     hidden.defined('altcontactaddress2') && hidden.defined('altcontactaddress3') && hidden.defined('altcontactstate') &&
691                     hidden.defined('altcontactzipcode') && hidden.defined('altcontactcountry') && hidden.defined('altcontactphone')
692                 %]
693                     <fieldset class="rows" id="memberentry_alternatecontact">
694                         <legend id="alternatecontact_legend">Alternate contact</legend>
696                         <ol>
697                             [% UNLESS hidden.defined('altcontactsurname') %]
698                                 <li>
699                                     [% IF mandatory.defined('altcontactsurname') %]
700                                         <label for="borrower_altcontactsurname" class="required">
701                                     [% ELSE %]
702                                         <label for="borrower_altcontactsurname">
703                                     [% END %]
704                                     Surname:</label>
706                                     <input type="text" id="borrower_altcontactsurname" name="borrower_altcontactsurname" value="[% borrower.altcontactsurname %]" />
707                                     [% IF mandatory.defined('altcontactsurname') %]<span class="required">Required</span>[% END %]
708                                 </li>
709                             [% END %]
711                             [% UNLESS hidden.defined('altcontactfirstname') %]
712                                 <li>
713                                     [% IF mandatory.defined('altcontactfirstname') %]
714                                         <label for="borrower_altcontactfirstname" class="required">
715                                     [% ELSE %]
716                                         <label for="borrower_altcontactfirstname">
717                                     [% END %]
718                                     First name:</label>
720                                     <input type="text" id="borrower_altcontactfirstname" name="borrower_altcontactfirstname" value="[% borrower.altcontactfirstname %]" />
721                                     [% IF mandatory.defined('altcontactfirstname') %]<span class="required">Required</span>[% END %]
722                                 </li>
723                             [% END %]
725                             [% UNLESS hidden.defined('altcontactaddress1') %]
726                                 <li>
727                                     [% IF mandatory.defined('altcontactaddress1') %]
728                                         <label for="borrower_altcontactaddress1" class="required">
729                                     [% ELSE %]
730                                         <label for="borrower_altcontactaddress1">
731                                     [% END %]
732                                     Address:</label>
734                                     <input type="text" id="borrower_altcontactaddress1" name="borrower_altcontactaddress1" value="[% borrower.altcontactaddress1 %]" />
735                                     [% IF mandatory.defined('altcontactaddress1') %]<span class="required">Required</span>[% END %]
736                                 </li>
737                             [% END %]
739                             [% UNLESS hidden.defined('altcontactaddress2') %]
740                                 <li>
741                                     [% IF mandatory.defined('altcontactaddress2') %]
742                                         <label for="borrower_altcontactaddress2" class="required">
743                                     [% ELSE %]
744                                         <label for="borrower_altcontactaddress2">
745                                     [% END %]
746                                     Address 2:</label>
748                                     <input type="text" id="borrower_altcontactaddress2" name="borrower_altcontactaddress2" value="[% borrower.altcontactaddress2 %]" />
749                                     [% IF mandatory.defined('altcontactaddress2') %]<span class="required">Required</span>[% END %]
750                                 </li>
751                             [% END %]
753                             [% UNLESS hidden.defined('altcontactaddress3') %]
754                                 <li>
755                                     [% IF mandatory.defined('altcontactaddress3') %]
756                                         <label for="borrower_altcontactaddress3" class="required">
757                                     [% ELSE %]
758                                         <label for="borrower_altcontactaddress3">
759                                     [% END %]
760                                     City:</label>
762                                     <input type="text" id="borrower_altcontactaddress3" name="borrower_altcontactaddress3" value="[% borrower.altcontactaddress3 %]" />
763                                     [% IF mandatory.defined('altcontactaddress3') %]<span class="required">Required</span>[% END %]
764                                 </li>
765                             [% END %]
767                             [% UNLESS hidden.defined('altcontactstate') %]
768                                 <li>
769                                     [% IF mandatory.defined('altcontactstate') %]
770                                         <label for="borrower_altcontactstate" class="required">
771                                     [% ELSE %]
772                                         <label for="borrower_altcontactstate">
773                                     [% END %]
774                                     State:</label>
776                                     <input type="text" id="borrower_altcontactstate" name="borrower_altcontactstate" value="[% borrower.altcontactstate %]" />
777                                     [% IF mandatory.defined('altcontactstate') %]<span class="required">Required</span>[% END %]
778                                 </li>
779                             [% END %]
781                             [% UNLESS hidden.defined('altcontactzipcode') %]
782                                 <li>
783                                     [% IF mandatory.defined('altcontactzipcode') %]
784                                         <label for="borrower_altcontactzipcode" class="required">
785                                     [% ELSE %]
786                                         <label for="borrower_altcontactzipcode">
787                                     [% END %]
788                                     ZIP/Postal code:</label>
790                                     <input type="text" id="borrower_altcontactzipcode" name="borrower_altcontactzipcode" value="[% borrower.altcontactzipcode %]" />
791                                     [% IF mandatory.defined('altcontactzipcode') %]<span class="required">Required</span>[% END %]
792                                 </li>
793                             [% END %]
795                             [% UNLESS hidden.defined('altcontactcountry') %]
796                                 <li>
797                                     [% IF mandatory.defined('altcontactcountry') %]
798                                         <label for="borrower_altcontactcountry" class="required">
799                                     [% ELSE %]
800                                         <label for="borrower_altcontactcountry">
801                                     [% END %]
802                                     Country:</label>
804                                     <input type="text" id="borrower_altcontactcountry" name="borrower_altcontactcountry" value="[% borrower.altcontactcountry %]" />
805                                     [% IF mandatory.defined('altcontactcountry') %]<span class="required">Required</span>[% END %]
806                                 </li>
807                             [% END %]
809                             [% UNLESS hidden.defined('altcontactphone') %]
810                                 <li>
811                                     [% IF mandatory.defined('altcontactphone') %]
812                                         <label for="borrower_altcontactphone" class="required">
813                                     [% ELSE %]
814                                         <label for="borrower_altcontactphone">
815                                     [% END %]
816                                     Phone:</label>
818                                     <input type="text" id="borrower_altcontactphone" name="borrower_altcontactphone" value="[% borrower.altcontactphone %]" />
819                                     [% IF mandatory.defined('altcontactphone') %]<span class="required">Required</span>[% END %]
820                                 </li>
821                             [% END %]
822                         </ol>
823                     </fieldset>
824                 [% END %]
826                 [% UNLESS action == 'edit' || hidden.defined('password') %]
827                     <fieldset class="rows" id="memberentry_password">
828                         <legend id="contact_legend">Password</legend>
829                         [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
830                             <div class="alert alert-info">
831                                 [% IF Koha.Preference('minPasswordLength') %]
832                                     <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
833                                 [% END %]
834                                 [% UNLESS mandatory.defined('password') %]
835                                     If you do not enter a password a system generated password will be created.
836                                 [% END %]
837                             </div>
838                         [% END %]
840                         [% IF mandatory.defined('password') %]
841                             <ol>
842                                 <li><label for="borrower_password" class="required">Password</label>
843                                     <input type="text" name="borrower_password" id="password" />
844                                     <span class="required">Required</span>
845                                 </li>
846                                 <li><label for="borrower_password2" class="required">Confirm password</label>
847                                     <input type="text" name="borrower_password2" id="password2" />
848                                     <span class="required">Required</span>
849                                 </li>
850                             </ol>
851                         [% ELSE %]
852                             <ol>
853                                 <li><label for="borrower_password">Password</label>
854                                     <input type="text" name="borrower_password" id="password" />
855                                 </li>
856                                 <li><label for="borrower_password2">Confirm password</label>
857                                     <input type="text" name="borrower_password2" id="password2" />
858                                 </li>
859                             </ol>
860                         [% END %]
861                     </fieldset>
862                [% END %]
864                [% UNLESS action == 'edit' %]
865                     <fieldset class="rows" id="memberentry_captcha">
866                         <ol>
868                             <li>
869                                 <label for="captcha" class="required">Verification:</label>
871                                 <input type="text" name="captcha" id="captcha" />
872                                 <input type="hidden" name="captcha_digest" value="[% captcha_digest %]" />
874                                 <span class="hint">Please type the following characters into the preceding box: <strong>[% captcha %]</strong></span>
875                             </li>
876                         </ol>
877                     </fieldset>
878                 [% END %]
880                 [% IF ( borrower.ExtendedPatronAttributes ) %]
881                     <fieldset class="rows">
882                         <legend>Additional information</legend>
883                         <ol>
884                             [% FOREACH patron_attribute IN borrower.patron_attributes %]
885                                 <li>
886                                     <label>[% patron_attribute.description %]:</label>
887                                     [% IF ( patron_attribute.value_description ) %]
888                                         [% patron_attribute.value_description %]
889                                     [% ELSE %]
890                                         [% patron_attribute.value |html_line_break %]
891                                     [% END %]
892                                 </li>
893                             [% END %]
894                         </ol>
895                     </fieldset>
896                 [% END %]
898                 [% IF action == 'edit' %]
899                     [% IF OPACPatronDetails %]
900                         <fieldset class="action">
901                             <input type="hidden" name="action" value="update" />
902                             <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
903                             <input type="submit" class="btn" value="Submit update request" />
904                         </fieldset>
905                     [% END %]
906                 [% ELSE %]
907                     <fieldset class="action">
908                         <input type="hidden" name="action" value="create" />
909                         <input type="submit" class="btn" value="Submit" />
910                     </fieldset>
911                 [% END %]
913                 </form>
915                     </div><!--/div id="update-account" -->
916                 </div>
917             </div>
918         </div>
919     </div>
921 [% INCLUDE 'opac-bottom.inc' %]
922 [% BLOCK jsinclude %]
923     <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.validate.min.js"></script>
924     <script type="text/javascript">
925         //<![CDATA[
926         $(document).ready(function() {
927             [% IF action == 'edit' && !OPACPatronDetails %]
928                 $("#memberentry-form :input").attr('readonly', true);
929                 $("#borrower_branchcode").attr('disabled',true);
930                 $("#borrower_title").attr('disabled',true);
931                 $('#memberentry-form :radio').attr('disabled',true);
932                 $('span.required').remove();
933                 $('label.required').removeClass('required');
934             [% ELSE %]
935                 $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
936             [% END %]
938             $("#memberentry-form").validate({
939                 rules: {
940                     borrower_email: {
941                         email: true
942                     },
943                     borrower_emailpro: {
944                         email: true
945                     },
946                     borrower_B_email: {
947                         email: true
948                     }
949                 },
950                 submitHandler: function(form) {
951                     if (form.beenSubmitted) {
952                         return false;
953                     }
954                     else {
955                         form.beenSubmitted = true;
956                         form.submit();
957                     }
958                 },
959                 errorPlacement: function(error, element) {
960                     offset = element.offset();
961                     error.insertAfter(element)
962                     error.addClass('error');  // add a class to the wrapper
963                     error.css('position', 'absolute');
964                     error.css('left', offset.left + element.outerWidth() + 10);
965                     error.css('top', offset.top);
966                     error.css('width', 'auto');
967                 }
968             });
970             [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
971                 $('#update_privacy_guarantor_checkouts').click( function() {
972                     $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
973                      .done(function( data ) {
974                          var message;
975                          if ( data.success ) {
976                              message = _("Your setting has been updated!");
977                          } else {
978                              message = _("Unable to update your setting!");
979                          }
981                          $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
982                      });
983                 });
984             [% END %]
985         });
987     $(".cleardate").on("click", function(){
988         $('#borrower_dateofbirth').val('');
989         return false;
990     });
991     //]]>
992     </script>
993 [% INCLUDE 'calendar.inc' %]
994 [% END %]