-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(contribution): added option to change the amount of the subscrip…
…tion.
- Loading branch information
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
templates/user/contribution/automatic-collection-change.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{% extends 'user/layout/members.html.twig' %} | ||
|
||
{% block scripts %} | ||
{{ parent() }} | ||
<script> | ||
function updateContribution() { | ||
let other = document.querySelector('.other-amount'); | ||
if (document.querySelector('.choice :checked').value !== 0) { | ||
other.value = ''; | ||
} | ||
} | ||
function updateOtherAmount() { | ||
let other = document.querySelector('.other-amount'); | ||
if (other.value != '') | ||
{ | ||
document.querySelector('.choice [value="0"]').checked = true; | ||
} | ||
} | ||
document.addEventListener('change', e => { | ||
if (e.target.closest) { | ||
if (e.target.closest('.other-amount')) { | ||
updateOtherAmount(); | ||
} else if (e.target.closest('.choices')) { | ||
updateContribution(); | ||
} | ||
} | ||
}) | ||
</script> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="main-content"> | ||
<h1>Automatische incasso</h1> | ||
<p> | ||
Contributie zal elk kwartaal automatisch van je rekening afgeschreven worden via automatisch incasso. | ||
Hoeveel je hierbij betaalt hangt af van je inkomen. | ||
</p> | ||
|
||
{% if contribution.tiers|length > 2 %} | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Maandinkomen</th> | ||
<th>Contributie</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for tier in contribution.tiers %} | ||
{% if tier.amount is not same as(null) %} | ||
<tr> | ||
<td>{{ tier.description }}</td> | ||
<td>€{{ (tier.amount / 100)|number_format(2, ',') }} per kwartaal (€{{ (tier.amount / 100 / 3)|number_format(2, ',') }} per maand)</td> | ||
</tr> | ||
{% endif %} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endif %} | ||
|
||
{% if form.vars.submitted and not form.vars.valid %} | ||
<div class="error"> | ||
{{ form_errors(form) }} | ||
</div> | ||
{% endif %} | ||
|
||
<p> | ||
Selecteer wat er voor jou van toepassing is: | ||
</p> | ||
{{ form_start(form, { attr: { class: 'incomes' }}) }} | ||
{{ form_row(form._token) }} | ||
|
||
<div class="choices"> | ||
{% for option in form.contributionAmount %} | ||
<div class="choice"> | ||
{{ form_widget(option) }} | ||
<div class="choice-text"> | ||
{{ form_label(option, null, { required: false }) }} | ||
{% if option.vars.value == 0 %} | ||
<br /> | ||
{{ form_widget(form.otherAmount, { attr: { class: 'other-amount' } }) }} per kwartaal | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
<button type="submit" class="button submit-button">Incasso bedrag aanpassen</button> | ||
{{ form_end(form, {render_rest: false}) }} | ||
|
||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters