Bug 17855: Onboarding tool
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / onboarding / onboardingstep3.tt
1 <!--Includes for creating patron-->
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 [% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
7 [% INCLUDE 'installer-doc-head-close.inc' %]
8 [% INCLUDE 'calendar.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 [% INCLUDE 'js_includes.inc' %]
11
12 <head>
13 <title>Create Koha administrator patron</title>
14 <!--jQuery scripts for creating patron-->
15 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
16 <script type="text/javascript">
17      var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
18      jQuery.validator.addMethod( "password_match", function(value,element){
19         var password = document.getElementById('password').value
20         var confirmpassword = document.getElementById('password2').value
21         if ( password != confirmpassword ){
22                 return false;
23         }
24         else{
25                 return true
26         }
27      },  MSG_PASSWORD_MISMATCH
28 );
29
30 $(document).ready(function(){
31    $("#Submit").click(function(){
32       $("#createpatron").validate({
33         rules: {
34             surname: {
35                 required: true,
36             },
37             firstname: {
38                 required: true,
39             },
40             cardnumber: {
41                 required: true,
42             },
43             password: {
44                  password_match:true
45             }
46         },
47         messages: {
48            password: {
49                  required: MSG_PASSWORD_MISMATCH
50            },
51         }
52       });
53    });
54 });
55 </script>
56 </head>
57
58 <div>
59     <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
60 </div>
61
62
63 [%  IF (nok) %]
64         <form name="errors" method="post" action="onboarding.pl">
65             <input type="hidden" name="step" value="3"/>
66             <h1 align="left">There was an error</h1>
67             <p>Try again </p>
68             <div>
69             <ul>
70             [% IF errorloginexists %]
71                 <li id="ERROR_login_exist">Username/password already exists.</li>
72             [% END %]
73             [% IF errorcardnumberexists %]
74                 <li id="ERROR_cardnumber">Cardnumber already in use.</li>
75             [% END %]
76             [% IF errorcardnumberlength %]
77                 <li id="ERROR_cardnumber">Cardnumber length is incorrect</li>
78             [% END %]
79             [% IF errorshortpassword %]
80                 <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li>
81             [% END %]
82             [% IF errorpasswordmismatch %]
83                 <li id="ERROR_password_mismatch">Passwords do not match.</li>
84             [% END %]
85             </ul>
86
87             </div>
88             <input type="submit" name="step" value="Try again"/>
89         </form>
90
91
92 <!--Create a patron screen 2-->
93 [% ELSIF op == 'add_validate' %]
94           <!--New patron created-->
95         <form name="patrondone" method="post" action="onboarding.pl">
96             <input type="hidden" name="step" value="4"/>
97             <h1 align="left"> Koha administrator patron </h1>
98             <div>
99                  <p> Success: administrator patron created!</p>
100                  <p> To create another patron, go to Patrons -> New Patron. <br>
101                 More -> Set Permissions in a user page to gain superlibrarian permissions.
102             </div>
103             Next up:
104             <input type="submit" name="start" value="Minimal item type setup"/>
105         </form>
106 [% ELSE %]
107 <!--Create a patron screen 1-->
108        <h1 align="left"> Create koha administrator patron</h1>
109         <p>
110         Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
111         </p>
112         <form name="createpatron" id="createpatron" method="post" action="onboarding.pl">
113             <fieldset class="rows">
114                  <input type="hidden" name="step" value="3"/>
115                  <input type="hidden" name="op" value="add_validate" />
116                     <legend id="library_management_lgd">Library management</legend>
117                     <ol>
118                     <h3>Patron identity</h3>
119                         <li>
120                             <label for="surname" class="required">Surname: </label>
121                             <input type="text" id="surname" name="surname" title="Please only enter letters in the surname field" value="[% surname |html %]" class="required" required="required" />
122                             <span class="required">Required</span>
123                         </li>
124                         <li>
125                             <label for="firstname" class="required">First name: </label>
126                             <input  type="text" name="firstname" title="Please only enter letters in the first name field" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
127                             <span class="required">Required</span>
128                         </li>
129                     </ol>
130
131                     <ol>
132                         <li>
133                             <label for="cardnumber" class="required">Card number: </label>
134                             [% IF patrons && patrons > 1 %]
135                                 <input type="text" id="cardnumber" title="Please enter a cardnumber" class="noEnterSubmit valid" name="cardnumber" value="[% newcardnumber | html %]" class="required" required="required">
136                             [% ELSE %]
137                                 <input type="text" id="cardnumber" title="Please enter a cardnumber" name="cardnumber" value="[% cardnumber | html %]" class="required" required="required">
138                             [% END %]
139                             <span class="required">Required</span>
140                         </li>
141                         <li>
142
143                         <!--require a foreach loop to get all the values for the library that the user has either imported (in web installer) or created in the first step of this onboarding tool-->
144                             <label for="libraries" class="required"> Library: </label>
145                             <select name="libraries" size="1" id="libraries">
146
147                              [% FOREACH library IN libraries %]
148                                   <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
149                              [% END %]
150
151                                 </select>
152                             <span class="required"> Required</span>
153                         </li>
154                         <li>
155                             <label for="categorycode_entry" class="required"> Patron category</label>
156                             <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
157                             [% FOREACH category IN categories %]
158                                 <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
159                             [% END %]
160                             </select>
161                             <span class="required">Required</span><br><br>
162                             <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box.
163                         </li>
164                     </ol>
165
166                     <ol>
167                             <h3> Koha administrator patron permissions</h3>
168                             <input type="hidden" name="newflags" value="1"/>
169                             <li>
170                                 <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
171                                 <label name="permissioncode" for="flag-0"> superlibrarian</label>
172                             </li>
173                     </ol>
174                     <ol>
175                     <h3>OPAC/Staff Login</h3>
176                         <li>
177                             <input type="hidden" name="BorrowerMandatoryField" value = "[% BorrowerMandatoryField %]" />
178                             <label for="userid" class="required">Username: </label>
179                             <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
180                             <span class="required">Required</span>
181                         </li>
182                         <li>
183                             <label for="passwordlabel" class="required">Password: </label>
184                             <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
185                             <span class="required">Required</span>
186                         </li>
187                         <li>
188                             <label for="password2" class="required">Confirm password: </label>
189                             <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
190                             <span class="required">Required</span>
191                         </li>
192                     </ol>
193              </fieldset><br>
194                 <input type="submit" id="Submit" class="action" value="Submit"/>
195      </form>
196 [% END %]