]>
Commit | Line | Data |
---|---|---|
c7bcb9ca | 1 | {% extends "../base.html" %} |
95b30f84 | 2 | |
9b5ac075 | 3 | {% block title %}{{ _("Donate") }}{% end block %} |
95b30f84 | 4 | |
60b0917c | 5 | {% block container %} |
95b30f84 MT |
6 | {% set amounts = (10, 25, 50, 75, 100, 250) %} |
7 | ||
45cfec9a RH |
8 | <section class="hero is-primary"> |
9 | <div class="hero-body"> | |
10 | <div class="container"> | |
11 | <nav class="breadcrumb is-medium" aria-label="breadcrumbs"> | |
12 | <ul> | |
13 | <li> | |
14 | <a href="/">Home</a> | |
15 | </li> | |
16 | <li class="is-active"> | |
17 | <a href="#" aria-current="page">Donate</a> | |
18 | </li> | |
19 | </ul> | |
20 | </nav> | |
21 | <h1 class="title is-1"> | |
22 | Donate | |
23 | </h1> | |
24 | <p class="subtitle">{{ _("Please support our project with your donation today") }}</p> | |
0ccdfa9d MT |
25 | </div> |
26 | </div> | |
27 | </section> | |
95b30f84 | 28 | |
45cfec9a | 29 | <section class="section"> |
6f151c32 | 30 | <div class="container"> |
45cfec9a RH |
31 | <div class="columns"> |
32 | <div class="column is-8"> | |
3d24a78c | 33 | <form id="donation-form" action="" method="POST"> |
6f151c32 MT |
34 | {% raw xsrf_form_html() %} |
35 | ||
45cfec9a RH |
36 | <h5 class="title is-5">I am an ...</h5> |
37 | ||
38 | <input type="hidden" name="type" value="individual"> | |
6f151c32 | 39 | |
45cfec9a RH |
40 | <div class="block"> |
41 | <div class="control"> | |
42 | <label class="radio"> | |
43 | <input class="custom-control-input" type="radio" | |
44 | name="type-selector" id="type-individual" value="individual" checked> | |
d1f119e3 | 45 | |
45cfec9a RH |
46 | {{ _("Individual") }} |
47 | </label> | |
48 | <label class="custom-control-label" for="type-individual"></label> | |
49 | <label class="radio"> | |
50 | <input class="custom-control-input" type="radio" | |
51 | name="type-selector" id="type-organization" value="organization"> | |
52 | ||
53 | {{ _("Organization") }} | |
54 | </label> | |
55 | <label class="custom-control-label" for="type-organization"></label> | |
56 | </div> | |
57 | </div> | |
58 | ||
59 | <h5 class="title is-5">Frequency</h5> | |
60 | ||
61 | <input type="hidden" name="frequency" value="{{ frequency }}"> | |
62 | ||
63 | <div class="block"> | |
64 | <div class="control"> | |
65 | <label class="radio"> | |
d7a9cbd3 | 66 | <input class="form-check-input" type="radio" name="frequency-selector" id="frequency-one-time" |
6f151c32 | 67 | value="one-time" {% if frequency == "one-time" %}checked{% end %}> |
95b30f84 | 68 | |
45cfec9a RH |
69 | {{ _("One Time") }} |
70 | </label> | |
71 | <label class="form-check-label" for="frequency-one-time"></label> | |
72 | ||
73 | <label class="radio"> | |
d7a9cbd3 | 74 | <input class="form-check-input" type="radio" name="frequency-selector" id="frequency-monthly" |
6f151c32 | 75 | value="monthly" {% if frequency == "monthly" %}checked{% end %}> |
45cfec9a RH |
76 | |
77 | {{ _("Monthly") }} | |
78 | </label> | |
79 | <label class="form-check-label" for="frequency-monthly"></label> | |
f89c578d | 80 | </div> |
6f151c32 | 81 | </div> |
95b30f84 | 82 | |
45cfec9a RH |
83 | <div class="block"> |
84 | <h5 class="title is-5">{{ _("Choose an amount") }}</h5> | |
85 | </div> | |
a41e6d77 | 86 | |
45cfec9a RH |
87 | <input type="hidden" name="currency" value="{{ currency }}"> |
88 | ||
89 | <div class="block"> | |
90 | <div class="buttons" data-toggle="buttons"> | |
91 | <p class="control"> | |
92 | {% for a in amounts %} | |
93 | <label class="button is-outlined is-primary"> | |
94 | <input type="radio" name="amount-selector" value="{{ a }}" {% if amount == a %}checked{% end %} | |
95 | autocomplete="off" class="is-hidden"> <span class="EUR">€</span><span class="USD">$</span>{{ a }} | |
96 | </label> | |
97 | {% end %} | |
98 | </p> | |
99 | </div> | |
100 | </div> | |
a41e6d77 | 101 | |
45cfec9a RH |
102 | <div class="block"> |
103 | <h6 class="title is-6">Or Enter your own</h6> | |
104 | ||
105 | <div class="columns"> | |
106 | <div class="column is-3"> | |
107 | <div class="field"> | |
108 | <p class="control has-icons-left"> | |
109 | <input type="number" class="input" name="amount" min="5" step="0.01" | |
110 | {% if amount %}value="{{ "%.2f" % amount }}"{% end %}> | |
111 | <span class="input-group-text EUR icon is-small is-left"> | |
112 | <i class="fas fa-euro-sign"></i> | |
113 | </span> | |
114 | <span class="input-group-text USD icon is-small is-left"> | |
115 | <i class="fas fa-dollar-sign"></i> | |
116 | </span> | |
117 | </p> | |
118 | </div> | |
119 | </div> | |
6f151c32 | 120 | </div> |
a41e6d77 | 121 | |
45cfec9a RH |
122 | <p class="small text-end"> |
123 | <a class="toggleCurrency EUR" href="#">{{ _("Prefer donating in US Dollar?") }}</a> | |
124 | <a class="toggleCurrency USD" href="#">{{ _("Prefer donating in Euro?") }}</a> | |
6f151c32 | 125 | </p> |
45cfec9a | 126 | </div> |
a6100896 | 127 | |
45cfec9a RH |
128 | <div class="block"> |
129 | <div class="organization organization-required"> | |
130 | <input type="text" class="input" name="organization" | |
131 | placeholder="{{ _("Organization") }}"> | |
132 | </div> | |
133 | </div> | |
134 | <div class="block"> | |
135 | <div class="organization"> | |
136 | <input type="text" class="input" name="vat_number" | |
137 | placeholder="{{ _("VAT Number") }}"> | |
138 | </div> | |
139 | </div> | |
140 | <div class="block"> | |
141 | <div class="organization"> | |
142 | <p class="is-size-6"> | |
143 | If you are an organization in Europe and you are VAT-registered, | |
144 | please provide your VAT number here. | |
145 | It will make your donation VAT free (if applicable) and the project | |
146 | will benefit from more of your help | |
147 | Please see the FAQ below for more details about VAT. | |
148 | </p> | |
149 | </div> | |
150 | </div> | |
6f151c32 | 151 | |
45cfec9a RH |
152 | <div class="columns"> |
153 | <div class="column is-2"> | |
154 | <div class="form-check form-check-inline mb-3"> | |
155 | <input class="form-check-input" type="radio" name="title" id="mr" value="Mr." checked> | |
156 | <label class="form-check-label" for="mr">{{ _("Mr.") }}</label> | |
f89c578d | 157 | </div> |
6f151c32 | 158 | </div> |
45cfec9a RH |
159 | <div class="column is-2"> |
160 | <div class="form-check form-check-inline mb-3"> | |
161 | <input class="form-check-input" type="radio" name="title" id="mrs" value="Mrs."> | |
162 | <label class="form-check-label" for="mrs">{{ _("Mrs.") }}</label> | |
163 | </div> | |
164 | </div> | |
165 | </div> | |
6f151c32 | 166 | |
45cfec9a RH |
167 | <div class="columns"> |
168 | <div class="column"> | |
169 | <input type="text" class="input" name="first_name" | |
170 | placeholder="{{ _("First Name" )}}" required | |
1898a8bb | 171 | {% if current_user %}value="{{ current_user.first_name }}"{% end %}> |
45cfec9a | 172 | </div> |
a41e6d77 | 173 | |
45cfec9a RH |
174 | <div class="column"> |
175 | <input type="text" class="input" name="last_name" | |
176 | placeholder="{{ _("Last Name" )}}" required | |
1898a8bb | 177 | {% if current_user %}value="{{ current_user.last_name }}"{% end %}> |
45cfec9a RH |
178 | </div> |
179 | </div> | |
f89c578d | 180 | |
45cfec9a RH |
181 | <div class="block"> |
182 | <input type="email" class="input" name="email" | |
1898a8bb MT |
183 | placeholder="{{ _("Email Address") }}" required |
184 | {% if current_user %}value="{{ current_user.email }}"{% end %}> | |
45cfec9a | 185 | </div> |
a41e6d77 | 186 | |
1898a8bb MT |
187 | {% set lines = current_user.street.splitlines() if current_user else [] %} |
188 | ||
45cfec9a RH |
189 | <div class="block"> |
190 | <input type="text" class="input" name="street1" | |
1898a8bb MT |
191 | placeholder="{{ _("Address Line 1") }}" required |
192 | {% if lines %}value="{{ lines[0] }}"{% end %}> | |
45cfec9a | 193 | </div> |
f89c578d | 194 | |
45cfec9a RH |
195 | <div class="block"> |
196 | <input type="text" class="input" name="street2" | |
1898a8bb MT |
197 | placeholder="{{ _("Address Line 2") }}" |
198 | {% if lines and len(lines) > 1 %}value="{{ lines[1] }}"{% end %}> | |
45cfec9a | 199 | </div> |
f89c578d | 200 | |
45cfec9a RH |
201 | <div class="columns"> |
202 | <div class="column"> | |
203 | <input type="text" class="input" name="city" | |
1898a8bb MT |
204 | placeholder="{{ _("City") }}" required |
205 | {% if current_user %}value="{{ current_user.city }}"{% end %}> | |
45cfec9a RH |
206 | </div> |
207 | <div class="column"> | |
208 | <input type="text" class="input" name="post_code" | |
1898a8bb MT |
209 | placeholder="{{ _("Post Code") }}" required |
210 | {% if current_user %}value="{{ current_user.postal_code }}"{% end %}> | |
45cfec9a RH |
211 | </div> |
212 | </div> | |
a41e6d77 | 213 | |
45cfec9a RH |
214 | <div class="columns"> |
215 | <div class="column is-half"> | |
216 | <div class="select"> | |
217 | <select name="country_code" required> | |
218 | <option value="">- {{ _("Country") }} -</option> | |
6f151c32 | 219 | |
45cfec9a RH |
220 | {% for c in countries %} |
221 | <option value="{{ c.alpha2 }}" {% if country == c.alpha2 %}selected{% end %}>{{ c.name }}</option> | |
222 | {% end %} | |
223 | </select> | |
f89c578d | 224 | </div> |
6f151c32 | 225 | </div> |
f89c578d | 226 | |
45cfec9a RH |
227 | <div class="column"> |
228 | <input type="text" class="input" name="state" | |
229 | placeholder="{{ _("State (optional)") }}"> | |
230 | </div> | |
231 | </div> | |
232 | ||
233 | <div class="block"> | |
234 | <input type="submit" class="button is-primary is-outlined is-fullwidth is-medium" | |
235 | id="donate" value="{{ _("Donate Now") }}"> | |
236 | </div> | |
237 | ||
238 | <div class="block"> | |
239 | <div class="level"> | |
240 | <div class="level-item has-text-centered"> | |
6f151c32 | 241 | <span class="pf pf-2x pf-american-express"></span> |
45cfec9a RH |
242 | </div> |
243 | <div class="level-item has-text-centered"> | |
6f151c32 | 244 | <span class="pf pf-2x pf-mastercard-alt"></span> |
45cfec9a RH |
245 | </div> |
246 | <div class="level-item has-text-centered"> | |
6f151c32 | 247 | <span class="pf pf-2x pf-visa"></span> |
45cfec9a RH |
248 | </div> |
249 | <div class="level-item has-text-centered"> | |
6f151c32 | 250 | <span class="pf pf-2x pf-sepa"></span> |
f89c578d | 251 | </div> |
45cfec9a RH |
252 | <div class="level-item has-text-centered"> |
253 | <span class="pf pf-2x pf-paypal"></span> | |
ef0d3151 SH |
254 | </div> |
255 | </div> | |
6f151c32 | 256 | </div> |
f89c578d | 257 | |
45cfec9a | 258 | <p class="is-size-6"> |
6f151c32 MT |
259 | The organization you will be donating to is Lightning Wire Labs GmbH who is |
260 | kindly handling donations for the IPFire project. | |
261 | After clicking "Donate Now", you will be redirected to Lightning Wire Labs | |
262 | where you will be able to complete the transaction. | |
263 | </p> | |
264 | </form> | |
d7bbf25f | 265 | </div> |
6f151c32 MT |
266 | </div> |
267 | </div> | |
268 | </section> | |
d7bbf25f | 269 | |
45cfec9a | 270 | <section class="section"> |
6f151c32 | 271 | <div class="container"> |
45cfec9a RH |
272 | <div class="columns"> |
273 | <div class="column is-8"> | |
274 | <div class="block"> | |
275 | <h5 class="title is-5">Why should I donate?</h5> | |
95b30f84 | 276 | |
45cfec9a RH |
277 | <p> |
278 | At IPFire, we are working hard to provide you with a free firewall distribution | |
279 | that is like no other. We release updates regularly and enhance functionality | |
280 | to make IPFire more secure, faster and easier to use. | |
281 | </p> | |
8bc72662 | 282 | |
45cfec9a RH |
283 | <p> |
284 | To achieve our high standards that we have set for ourselves, we need your help. | |
8bc72662 | 285 | |
45cfec9a RH |
286 | Only with your donation, we can get the right tools, people and utilities that |
287 | we need to make our work most efficient and reach our maximum potential. | |
8bc72662 | 288 | |
45cfec9a RH |
289 | Only with your donation, we can achieve our vision to make the Internet a safer |
290 | place that is fair for everyone and giving equal opportunities. | |
291 | </p> | |
292 | </div> | |
8bc72662 | 293 | |
45cfec9a RH |
294 | <div class="block"> |
295 | <h5 class="title is-5">How much should I give?</h5> | |
8bc72662 | 296 | |
45cfec9a RH |
297 | <p> |
298 | We are grateful for every single donation, but of course, we appreciate | |
299 | if you help us as much as you can. | |
300 | </p> | |
8bc72662 | 301 | |
45cfec9a RH |
302 | <p> |
303 | We rely on steady contributions from companies to keep the project healthy | |
304 | and encourage them to set up a monthly donation. | |
305 | </p> | |
306 | </div> | |
8bc72662 | 307 | |
0ba47b0f | 308 | <div class="faq"> |
45cfec9a | 309 | <h5 class="title is-5">Frequently Asked Questions</h5> |
a41e6d77 | 310 | |
45cfec9a RH |
311 | <div class="block"> |
312 | <h6 class="title is-6"> | |
313 | Do you accept bank transfer via SEPA? | |
314 | </h6> | |
a41e6d77 | 315 | |
0ba47b0f MT |
316 | <p> |
317 | We do accept direct transfers through SEPA. These are our bank details: | |
318 | </p> | |
95b30f84 | 319 | |
0ba47b0f | 320 | <dl> |
8c89f8e3 MT |
321 | <dt>Bank Account Owner</dt> |
322 | <dd>IPFire Project</dd> | |
323 | ||
0ba47b0f MT |
324 | <dt>IBAN</dt> |
325 | <dd>DE76 3605 0105 1010 8206 84</dd> | |
a41e6d77 | 326 | |
0ba47b0f MT |
327 | <dt>BIC</dt> |
328 | <dd>SPESDE3EXXX</dd> | |
329 | </dl> | |
330 | </div> | |
8bc72662 | 331 | |
45cfec9a RH |
332 | <div class="block"> |
333 | <h6 class="title is-6"> | |
0ba47b0f | 334 | Why do you need my address in order to process a donation? |
45cfec9a | 335 | </h6> |
8bc72662 | 336 | |
0ba47b0f MT |
337 | <p> |
338 | We understand that your privacy is very important. | |
339 | </p> | |
bddae05d | 340 | |
0ba47b0f MT |
341 | <p> |
342 | We ask for a minimum amount of information required to process | |
343 | credit card donations, including billing addresses. | |
344 | This allows our payment processor to verify your identity, | |
345 | process your payment, and prevent fraudulent charges to your credit card. | |
346 | </p> | |
bddae05d | 347 | |
0ba47b0f MT |
348 | <p> |
349 | We keep your information private - if you have questions, please refer to | |
350 | Lightning Wire Labs' <a href="https://www.lightningwirelabs.com/legal">Privacy Policy</a>. | |
351 | </p> | |
bddae05d | 352 | |
0ba47b0f MT |
353 | <p> |
354 | If you would rather not fill in your information on our online donation form, | |
355 | you can send your donation via SEPA bank transfer. | |
356 | </p> | |
357 | </div> | |
8bc72662 | 358 | |
45cfec9a RH |
359 | <div class="block"> |
360 | <h6 class="title is-6"> | |
a3f22905 | 361 | I am concerned about losing my credit card details |
45cfec9a | 362 | </h6> |
a3f22905 | 363 | |
a3f22905 MT |
364 | <p> |
365 | Credit card fraud is a serious and common problem. | |
366 | To avoid that you and we fall victim of that, we comply with | |
367 | <a href="https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard">PCI DSS</a>, | |
368 | which is mandatory in Europe. | |
369 | </p> | |
370 | ||
371 | <p> | |
372 | That means that we never handle any credit card data | |
373 | or store it on our systems. The entire transaction | |
374 | is securely handled by our payment provider and our | |
375 | systems are regularly audited to ensure that we | |
376 | implement this standard correctly. | |
377 | </p> | |
378 | </div> | |
379 | ||
45cfec9a RH |
380 | <div class="block"> |
381 | <h6 class="title is-6"> | |
0ba47b0f | 382 | Is my donation tax deductible? |
45cfec9a | 383 | </h6> |
8bc72662 | 384 | |
0ba47b0f MT |
385 | <p> |
386 | IPFire is not registered as a charitable organization and therefore donations | |
387 | are not tax deductible in Germany or the European Union. | |
388 | </p> | |
a41e6d77 | 389 | |
0ba47b0f MT |
390 | <p> |
391 | For donors outside of the European Union, please consult your tax advisor | |
392 | about whether your donation is tax deductible. | |
393 | </p> | |
394 | </div> | |
bddae05d | 395 | |
45cfec9a RH |
396 | <div class="block"> |
397 | <h6 class="title is-6"> | |
f04f2e81 | 398 | What will be charged to my credit card? |
45cfec9a | 399 | </h6> |
f04f2e81 | 400 | |
f04f2e81 MT |
401 | <p> |
402 | We are based in Germany. Donations by credit card from other countries | |
593e4b61 | 403 | may be subject to an international payment fee charged by your credit card issuer. |
f04f2e81 MT |
404 | This is usually a small fee around 1%, but please check with your bank |
405 | before donating. | |
406 | </p> | |
407 | ||
408 | <p> | |
409 | If you consider this charge too high, please consider using SEPA direct | |
410 | Debit or Bank Transfer if you can. | |
411 | Even with this charge, it is a lot cheaper than paying the higher processing | |
412 | fees of other payment services like PayPal which keep a lot more of the | |
413 | donation to themselves. | |
414 | </p> | |
415 | </div> | |
416 | ||
45cfec9a RH |
417 | <div class="block"> |
418 | <h6 class="title is-6"> | |
0ba47b0f | 419 | How do I cancel or change my recurring donation? |
45cfec9a | 420 | </h6> |
bddae05d | 421 | |
0ba47b0f MT |
422 | <p> |
423 | Your credit card statements or bank statements will contain a link | |
424 | that you can follow to cancel your donation at any time. | |
425 | </p> | |
426 | </div> | |
bddae05d | 427 | |
45cfec9a RH |
428 | <div class="block"> |
429 | <h6 class="title is-6"> | |
0ba47b0f | 430 | Who can I email directly with questions about donating? |
45cfec9a | 431 | </h6> |
bddae05d | 432 | |
0ba47b0f MT |
433 | <p> |
434 | If you have a question about donating to the IPFire Project, | |
435 | please contact us at <a href="mailto:donate@ipfire.org">donate@ipfire.org</a>. | |
436 | </p> | |
437 | </div> | |
438 | </div> | |
6f151c32 | 439 | </div> |
a41e6d77 | 440 | </div> |
7771acea | 441 | </div> |
6f151c32 | 442 | </section> |
95b30f84 MT |
443 | {% end block %} |
444 | ||
445 | {% block javascript %} | |
446 | <script type="text/javascript"> | |
447 | $(document).ready(function() { | |
45cfec9a | 448 | var type = $("input[name='type']"); |
d1f119e3 MT |
449 | var amount = $("input[name='amount']"); |
450 | var currency = $("input[name='currency']"); | |
451 | var frequency = $("input[name='frequency']"); | |
452 | var submit = $("#donate"); | |
453 | var modal = $("#modal-monthly-suggestions"); | |
3d24a78c | 454 | var form = $("#donation-form"); |
6d151de3 | 455 | |
bd2723d4 | 456 | // Adjust form to default currency |
a6100896 | 457 | if (currency.val() == "EUR") { |
bd2723d4 | 458 | $(".USD").hide(); |
a6100896 | 459 | } else if (currency.val() == "USD") { |
bd2723d4 MT |
460 | $(".EUR").hide(); |
461 | } | |
95b30f84 | 462 | |
a5f94966 | 463 | if (amount.val()) { |
45cfec9a | 464 | //$("#more").collapse("show"); |
a5f94966 MT |
465 | amount.change(); |
466 | } | |
467 | ||
45cfec9a RH |
468 | // Copy selected type |
469 | $("input[name='type-selector']").on("change", function() { | |
470 | var value = $(this).val(); | |
471 | if (value) { | |
472 | type.val(value); | |
473 | type.change(); | |
474 | } | |
475 | }); | |
476 | ||
477 | // Update Organization / Individual on radio-click | |
478 | type.on("change", function() { | |
479 | var value = $(this).val(); | |
480 | ||
481 | if (value == "individual") { | |
482 | $(".organization").hide(); | |
483 | $(".organization-required").find("input").prop("required", false); | |
484 | ||
485 | $(".vat-included").show(); | |
486 | $(".vat-excluded").hide(); | |
487 | } else if (value == "organization") { | |
488 | $(".organization").show(); | |
489 | $(".organization-required").find("input").prop("required", true); | |
490 | ||
491 | $(".vat-included").hide(); | |
492 | $(".vat-excluded").show(); | |
493 | } | |
494 | }); | |
495 | ||
a6100896 MT |
496 | $(".toggleCurrency").click(function(event) { |
497 | event.preventDefault(); | |
498 | ||
499 | if (currency.val() == "EUR") { | |
500 | currency.val("USD"); | |
95b30f84 | 501 | |
95b30f84 MT |
502 | $(".EUR").hide(); |
503 | $(".USD").show(); | |
a6100896 MT |
504 | } else if (currency.val() == "USD") { |
505 | currency.val("EUR"); | |
506 | ||
507 | $(".EUR").show(); | |
508 | $(".USD").hide(); | |
95b30f84 MT |
509 | } |
510 | }); | |
511 | ||
45cfec9a | 512 | |
d1f119e3 | 513 | // Copy amount when clicking on a radio buttons |
6d151de3 MT |
514 | $("input[name='amount-selector']").on("change", function() { |
515 | var value = $(this).val(); | |
516 | if (value) { | |
517 | amount.val(value); | |
9ae712ff | 518 | amount.change(); |
6d151de3 MT |
519 | } |
520 | }); | |
521 | ||
d1f119e3 MT |
522 | // Copy frequency when clicking on a radio buttons |
523 | $("input[name='frequency-selector']").on("change", function() { | |
524 | var value = $(this).val(); | |
525 | if (value) { | |
526 | frequency.val(value); | |
527 | } | |
528 | }); | |
529 | ||
a6100896 | 530 | amount.on("change keyup mouseup", function() { |
6d151de3 | 531 | var value = $(this).val(); |
a5f94966 | 532 | value = parseFloat(value); |
9ae712ff MT |
533 | |
534 | // Enable/disable submit button | |
535 | submit.prop("disabled", !value); | |
536 | ||
6d151de3 | 537 | if (value) { |
a6100896 MT |
538 | // Check matching elements |
539 | $("input[name='amount-selector']").each(function (i, selector) { | |
540 | var s = $(selector); | |
45cfec9a | 541 | var b = s.parent(".button"); |
a5f94966 | 542 | var v = parseFloat(s.val()); |
a6100896 | 543 | |
a5f94966 | 544 | if (value == v) { |
45cfec9a | 545 | b.removeClass("is-outlined"); |
a6100896 | 546 | } else { |
45cfec9a | 547 | b.addClass("is-outlined"); |
a6100896 MT |
548 | } |
549 | }); | |
9ae712ff MT |
550 | |
551 | // Update all amounts | |
552 | $(".amount").html(value); | |
553 | ||
554 | // Update suggestions | |
555 | $(".monthly-amount-suggestion").each(function (i, element) { | |
556 | var factor = $(element).data("factor"); | |
557 | if (!factor) | |
558 | return; | |
559 | ||
560 | var suggested_amount = Math.floor(value / factor); | |
561 | ||
562 | // Update value | |
563 | $(element).data("amount", suggested_amount); | |
564 | ||
565 | // Update text on button | |
566 | $(element).find(".suggested-amount").html(suggested_amount); | |
567 | }); | |
6d151de3 MT |
568 | } |
569 | }); | |
570 | ||
9ae712ff | 571 | submit.click(function (event) { |
d1f119e3 | 572 | if (frequency.val() == "one-time" && amount.val() > 10) { |
95b30f84 | 573 | event.preventDefault(); |
fedb34bf | 574 | |
9ae712ff | 575 | modal.modal("show"); |
95b30f84 MT |
576 | } |
577 | }); | |
9ae712ff | 578 | |
3d24a78c MT |
579 | // Disable all submit buttons after the form has been submitted |
580 | form.one("submit", function() { | |
581 | submit.prop("disabled", true); | |
582 | $(".monthly-amount-suggestion").prop("disabled", true); | |
583 | }); | |
584 | ||
9ae712ff MT |
585 | $(".monthly-amount-suggestion").click(function (event) { |
586 | // Set frequency to monthly | |
d1f119e3 MT |
587 | $("input[name='frequency-selector']").prop("checked", false); |
588 | $("input[name='frequency-selector'][value='monthly']").prop("checked", true); | |
589 | frequency.val("monthly"); | |
9ae712ff MT |
590 | |
591 | // Set amount | |
592 | var value = $(this).data("amount"); | |
593 | amount.val(value); | |
594 | amount.change(); | |
595 | ||
596 | // Hide the modal | |
597 | modal.modal("hide"); | |
598 | }); | |
599 | ||
45cfec9a RH |
600 | // Update everything depending on type |
601 | type.change(); | |
602 | ||
9ae712ff MT |
603 | // Update form with initial amount |
604 | amount.change(); | |
95b30f84 MT |
605 | }); |
606 | </script> | |
1898a8bb | 607 | {% end block %} |