]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2
LP#1778972: Tweaks and fixes to Bootstrap 4 template
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / main_payment_form.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     WRAPPER "opac/parts/myopac/base.tt2";
4     myopac_page = "main";
5     myopac_main_page = "payment_form";
6
7     last_chance = CGI.param("last_chance");
8
9     IF myopac_main_page == "payment_form" AND
10         ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.stripe.enabled') AND ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.default') == 'Stripe';
11         ctx.use_stripe = 1;
12     END %]
13
14 <a name="payment"> </a>
15 <h3 class="sr-only">[% l('Pay Charges') %]</h3>
16 [% IF ctx.fines.balance_owed <= 0 %]
17 <div>
18     [% l("The minimum amount you can pay is \$0.01.") %]
19 </div>
20 [% ELSE %]
21 [% IF ctx.use_stripe %]
22 <noscript>
23     [% l("Your browser does not have Javascript enabled, and we cannot " _
24         "process credit card payments without it.  Please change your " _
25         "browser settings and try again.") %]
26 </noscript>
27 [% END %]
28 <div class="container">
29 <hr>
30 <div id="pay_fines_now"[% IF ctx.use_stripe %] class="hide_me"[% END %]>
31      [% IF last_chance %]
32     <h3>[% l("Confirm Payment") %]</h3>
33
34     <form action="[% ctx.opac_root %]/myopac/main_pay_init" method="post">
35         [% FOR k IN CGI.Vars;
36             NEXT UNLESS k;
37             FOR val IN CGI.param(k) %]
38         <input type="hidden" name="[% k | html %]" value="[% val | html %]" />
39         [% END; END %]
40
41         <button type="submit" class="btn btn-confirm"><i class="fas fa-check"></i> [% l('Confirm') %]</button>
42         <a href="[% mkurl(ctx.opac_root _ '/myopac/main#selected_fines', {}, 1) %]" class="btn btn-deny"><i class="fas fa-ban"></i> [% l('Cancel') %]</a>
43     <p class="my-2"><big>[% l("Are you sure you are ready to charge ") %]
44          <strong> [% l("[_1] ", money(ctx.fines.balance_owed))%]</strong>
45         [% l("to your credit card?") %]</big></p>
46      <table title="[% l('List of Transactions') %]" id="acct_fines_confirm_header"
47         class="table my-2">
48    <thead>
49       <tr>
50         <th>[% l('Charge/Fee') %]</th>
51         <th class="text-right"><span>[% l('Amount') %]</th>
52      </tr>
53    </thead>
54    <tbody>
55       [%
56        FOR f IN ctx.fines.circulation;
57          NEXT IF CGI.param('xact').size &&
58             !CGI.param('xact').grep(f.xact.id).size;
59          attrs = {marc_xml => f.marc_xml};
60          IF f.marc_xml;
61              PROCESS get_marc_attrs args=attrs;
62          ELSIF f.xact.reservation;
63               attrs.title = f.xact.reservation.target_resource_type.name;
64          END %]
65          <tr>
66             <td>[% attrs.title | html %]</td>
67             <td class="text-right">[% money(f.xact.balance_owed) %]</td>
68          </tr>
69           [%
70           END;
71           FOR f IN ctx.fines.grocery;
72               NEXT IF CGI.param('xact_misc').size &&
73                   !CGI.param('xact_misc').grep(f.xact.id).size %]
74               <tr>
75                  <td>[% f.xact.last_billing_type | html %]</td>
76                  <td class="text-right">[% money(f.xact.balance_owed) %]</td>
77             </tr>
78         [% END %]
79      </tbody>
80    </table>
81
82        [% ELSE %]
83
84     <form method="post" id="payment_form" action='#payment'
85     [% IF ctx.use_stripe %]
86     onsubmit="return stripe_onsubmit();"
87     [% END %]
88     >
89         <input type="hidden" name="last_chance" value="1" />
90         [% FOR xact IN CGI.param('xact') %]
91         <input type="hidden" name="xact" value="[% xact | html %]" />
92         [% END %]
93         [% FOR xact IN CGI.param('xact_misc') %]
94         <input type="hidden" name="xact_misc" value="[% xact | html %]" />
95         [% END %]
96         [% IF ctx.use_stripe %]
97         <input type="hidden" name="stripe_token" id="stripe_token" />
98         [% END %]
99
100          <table id="billing_info_table" class="table table-hover">
101          <thead>
102           <th colspan='2'><strong>[% l('Billing Information') %]</strong></th>
103          </thead>
104           <tbody>
105
106                <tr>
107                 <td><label for="payment-first-name">[% l('First Name') %]</label></td>
108                     <td><input name="given-name" type="text"  name="billing_first" id="payment-first-name"
109                         value="[% ctx.user.first_given_name | html %]" class="form-control"/></td>
110                 </tr>
111                 <tr>
112                     <td><label for="payment-last-name">[% l('Last Name') %]</label></td>
113                     <td><input name="family-name" type="text" name="billing_last" id="payment-last-name"
114                         value="[% ctx.user.family_name | html %]" class="form-control"/></td>
115                 </tr>
116
117                 <tr>
118                     <td><label for="payment-email-addr">[% l('Email Address') %]</label></td>
119                     <td>
120
121                         <input id="payment-email-addr" type="text"
122                              value="[% ctx.user.email | html %]" disabled="disabled"
123                             readonly="readonly" class="form-control" name="email"/>
124                         <a title="[% l('Update Email Address') %]"
125                             href="[% ctx.opac_root %]/myopac/update_email?return_to_referer=1">[% l("Update") %]</a>
126                     </td
127                 </tr>
128                 <tr>
129                     <td><label for="payment-billing-address">[% l('Street Address') %]</label></td>
130                     <td><input type="text" name="billing_address" id="payment-billing-address"
131                         value="[% ctx.user.billing_address.street1 _ ctx.user.billing_address.street2 | html %]" class="form-control"/></td>
132                 </tr>
133                 <tr>
134                     <td><label for="payment-billing-city">[% l('City' )%]</label></td>
135                     <td><input type="text" name="billing_city" id="payment-billing-city"
136                         value="[% ctx.user.billing_address.city | html %]" class="form-control"/></td>
137                 </tr>
138                 <tr>
139                     <td><label for="payment-billing-state">[% l('State or Province') %]</label></td>
140                     <td><input type="text" name="billing_state" id="payment-billing-state"
141                         value="[% ctx.user.billing_address.state | html %]" class="form-control" /></td>
142                 </tr>
143                 <tr>
144                     <td><label for="paymenet-billing-zip">[% l('Postal Code') %]</label></td>
145                     [% USE zip=String(ctx.user.billing_address.post_code) %]
146                     <td><input type="tel" pattern="[/^[a-zA-Z0-9 _-]{7}$/]*" maxlength="7" size="7" name="billing_zip" id="paymenet-billing-zip"
147                         value="[% zip.truncate(5)  %]" class="form-control"/></td>
148                 </tr>
149                </tbody>
150                </table>
151
152                <table id="credit_card_info_table" class="table">
153                <thead>
154                    <th colspan='2'><strong>[% l('Credit Card Information') %]</strong></th>
155                </thead>
156                <tbody>
157
158                 <tr>
159                     <td><label for="payment-credit-card">[% l('Credit Card #') %]</label></td>
160
161                      <!-- Make type tel, which prompts for numbers in mobile -->
162                     <td><input class="form-control" type="tel" pattern="[0-9]*" maxlength="16" id="payment-credit-card" required
163                     [% IF ctx.use_stripe %]
164                     data-stripe="number"
165                     [% ELSE %]
166                     name="number"
167                     [% END %]
168                     /></td>
169                 </tr>
170                 <tr>
171                     <td><label for="payment-security-code">[% l('Security Code') %]</label></td>
172                     <td>
173                          <!-- Make type tel, which prompts for numbers in mobile -->
174                         <input class="form-control" type="tel" pattern="[0-9]*" size="4" maxlength="5" id="payment-security-code"
175                         [% IF ctx.use_stripe %]
176                         data-stripe="cvc"
177                         [% ELSE %]
178                         name="cvv2"
179                         [% END %]
180                         /></td>
181                 </tr>
182                 <tr>
183                     <td><label for="payment-expire-month">[% l('Expiration Month') %]</label></td>
184                     <td>
185                         <select class="form-control" id="payment-expire-month" required
186                         [% IF ctx.use_stripe %]
187                         data-stripe="exp_month"
188                         [% ELSE %]
189                         name="expire_month"
190                         [% END %]
191                         >
192                             <option value="-1"></option>
193                             <option value="01">[% l("January (1)") %]</option>
194                             <option value="02">[% l("February (2)") %]</option>
195                             <option value="03">[% l("March (3)") %]</option>
196                             <option value="04">[% l("April (4)") %]</option>
197                             <option value="05">[% l("May (5)") %]</option>
198                             <option value="06">[% l("June (6)") %]</option>
199                             <option value="07">[% l("July (7)") %]</option>
200                             <option value="08">[% l("August (8)") %]</option>
201                             <option value="09">[% l("September (9)") %]</option>
202                             <option value="10">[% l("October (10)") %]</option>
203                             <option value="11">[% l("November (11)") %]</option>
204                             <option value="12">[% l("December (12)") %]</option>
205                         </select>
206                     </td>
207                 </tr>
208                 <tr>
209                     <td><label for="payment-expire-year">[% l('Expiration Year') %]</label></td>
210                     <td>
211                         <select class="form-control" id="payment-expire-year"
212                         [%- IF ctx.use_stripe %]
213                         data-stripe="exp_year"
214                         [% ELSE %]
215                         name="expire_year"
216                         [% END -%]
217                         >
218                         [% year = date.format(date.now, '%Y');
219                         y = year;
220                         WHILE y < year + 10; # show ten years starting now %]
221                             <option value="[% y %]">[% y %]</option>
222                         [% y = y + 1; END %]
223                         </select>
224                     </td>
225                 </tr>
226                 <tr>
227                    <td colspan='2'>
228                        <div id="payment_actions">
229                           [% l('Total amount:') %]
230                            <strong>[% money(ctx.fines.balance_owed) %]</strong><br />
231
232                          <button type="submit" id="payment_submit" class="btn btn-confirm"><i class="fas fa-arrow-circle-right"></i> [% l('Next') %]</button>
233                          <a href="[% mkurl(ctx.opac_root _ '/myopac/main', {}, 1) %]" class="btn btn-deny"><i class="fas fa-ban"></i> [% l('Cancel') %]</a>
234                          <br/>
235                          </div>
236                    </td>
237                 </tr>
238
239           </tbody>
240         </table>
241          [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %]
242
243     [% END %]
244     </form>
245 </div></div>
246
247 [% END %]
248 [% END %]