/
select_payment_method.html.twig
121 lines (105 loc) · 3.46 KB
/
select_payment_method.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{% extends AUTH.current_user.is_logged_in ? 'page_with_sidebar.html.twig' : 'page.html.twig' %}
{% import '@startupapi/error_messages.html.twig' as ERR %}
{% block content %}
{% for msg in message %}
<p class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ msg }}
</p>
{% endfor %}
{% if not fatal %}
<div class="page-header">
<h1>
<a href="{{UserConfig.USERSROOTURL}}/plans.php">Subscription</a> /
{{ plan.name }}
</h1>
</div>
{% if plan.description %}
<p>{{ plan.description }}</p>
{% endif %}
<form action="" method="POST">
<input type="hidden" name="CSRF_NONCE" value="{{ CSRF_NONCE }}"/>
{% if plan.schedules and plan.schedules|length > 0 %}
<style>
.schedules {
max-width: 650px;
}
.schedules .well {
border-color: grey;
}
.schedules .startupapi-payment-schedule-highlighted {
background-color: silver;
}
</style>
<div class="schedules">
{% set n = 0 %}
{% for schedule in plan.schedules %}
{% set engine_slug = "unknown" %}
{% set well_extra_class = '' %}
{% if next_chosen %}
{%if schedule.chosen %}
{% set well_extra_class = ' startupapi-payment-schedule-highlighted' %}
{% endif %}
{% else %}
{% if schedule.current %}
{% set well_extra_class = ' startupapi-payment-schedule-highlighted' %}
{% endif %}
{% endif %}
<div class="well{{ well_extra_class }}">
<div class="pull-right" style="text-align: right">
{% set months_in_period = (schedule.charge_period / 30)|round(0, 'floor') %}
{% set dollars = (schedule.charge_amount / months_in_period)|round(0, 'floor') %}
{% set cents = ((schedule.charge_amount / months_in_period)|round(2, 'ceil') - dollars) * 100 %}
<h2>
${{dollars}}{% if cents > 0 %}<sup><small>{{cents}}</small></sup>{% endif %}
/
month
</h2>
<p style="margin-top: 1em">
{{ schedule.description }}
{% if months_in_period > 1 %}
: ${{ schedule.charge_amount}}
{% endif %}
</p>
{% for engine in payment_engines %}
<button
class="btn btn-success"
type="submit"
name="plan"
id="payment-button-{{plan.slug}}-{{schedule.slug}}-{{engine.slug}}"
value="{{ plan.slug }}.{{ schedule.slug }}.{{ engine.slug }}"
{% if not plan.available
or (engine.requires_pre_payment
and balance < schedule.charge_amount)
%} disabled{% endif %}
>
{{ engine.button_label }}
</button>
{% set engine_slug = engine.slug %}
{% endfor %}
</div>
<label {% if engine|length > 1 %}for="payment-button-{{plan.slug}}-{{schedule.slug}}-{{engine_slug}}"{% endif %}
{% if schedule.current %} class="userbase-account-current-schedule"{% endif %}
>
<span class="userbase-account-schedule-name">{{ schedule.name }}</span>
<br/>
<span class="userbase-account-schedule-details">{{ schedule.description }}</span>
{% if next_chosen %}
<br/>
{%if schedule.current %}
<span class="label label-important">until {{ next_charge|date("M d, Y") }}</span>
{% endif %}
{% if schedule.chosen %}
<span class="label label-success">starting {{ next_charge|date("M d, Y") }}</span>
{% endif %}
{% endif %}
</label>
<div class="clearfix"></div>
</div>
{% set n = n + 1 %}
{% endfor %}
</div>
{% endif %}
</form>
{% endif %}
{% endblock %}