-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsubscriptions.html
More file actions
249 lines (247 loc) · 11.7 KB
/
Copy pathsubscriptions.html
File metadata and controls
249 lines (247 loc) · 11.7 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
{% extends "saas/base_dashboard.html" %}
{% block saas_title %}{% trans %}Subscriptions{% endtrans %}{% endblock %}
{% block saas_content %}
<subscription-list-container inline-template class="pt-3" id="subscriptions">
<div>
<ul class="nav nav-tabs dashboard-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#active_subscriptions" data-bs-toggle="tab">{% trans %}Active{% endtrans %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#expired_subscriptions" data-bs-toggle="tab">{% trans %}Expired{% endtrans %}</a>
</li>
</ul>
<div class="tab-content">
<subscription-list inline-template id="active_subscriptions"
class="tab-pane active"
role="tabpanel"
@expired="expired">
<div data-trip data-trip-index="1"
data-trip-content="<h2>{% trans %}Subscriptions{% endtrans %}</h2><p>{% trans %}List of all your active subscriptions.{% endtrans %}<br />{% trans %}You can manage all your active subscriptions here.{% endtrans %}</p><em>{% trans %}Use keyboard navigation or click 'Next' to move forward.{% endtrans %}</em>"
data-trip-position="screen-center">
{% if plans %}
<div class="row my-3">
<div class="col-md-8">
<form id="subscribe" @submit.prevent="subscribe({slug: '{{organization.slug}}', full_name: '{{organization.full_name}}'})">
<div class="row">
<div class="col-md-8">
<select class="form-control me-2" name="plan" v-model="plan" aria-label="{% trans %}Select a plan{% endtrans %}">
<option selected
value="{}"
:value="{}">{% trans %}Select a plan...{% endtrans %}</option>
{% for choice in plans %}
<option value='{"slug":"{{choice.slug}}","organization":"{{choice.organization.slug}}"}'
:value='{"slug":"{{choice.slug}}","organization":"{{choice.organization.slug}}"}'>{{choice.title}}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4 text-end">
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-plus"></i> {% trans %}Subscribe{% endtrans %}</button>
</div>
</div>
</div>
</form>
</div>
</div>
{% endif %}
<div id="subscriptions-list-container" class="table-responsive mb-4">
<table class="table" infinite-wrapper>
<thead>
<tr>
<th>
{% trans %}Plan{% endtrans %}
<a class="btn-sort"
href="#"
@click.prevent="sortBy('plan')"
aria-label="{% trans %}Sort by plan{% endtrans %}"
>
<i :class="sortIcon('plan')"></i>
</a>
</th>
<th>
{% trans %}Until{% endtrans %}
<a class="btn-sort"
href="#"
@click.prevent="sortBy('ends_at')"
aria-label="{% trans %}Sort by until{% endtrans %}"
>
<i :class="sortIcon('ends_at')"></i>
</a>
</th>
<th><span class="visually-hidden">{% trans %}Time remaining{% endtrans %}</span></th>
<th><span class="visually-hidden">{% trans %}Actions{% endtrans %}</span></th>
</tr>
</thead>
<tbody>
<tr v-show="!itemsLoaded">
<td colspan="4">
<div class="h3 text-center"><i class="fa-solid fa-refresh fa-spin fa-2x"></i></div>
</td>
</tr>
<tr v-show="itemsLoaded && items.count === 0" v-cloak>
<td colspan="4">
<h3 class="text-center h5"><em>{% trans %}No subcriptions{% endtrans %}<span v-show="params.q"> [[params.q]]</span></em></h3>
</td>
</tr>
</tbody>
<tbody v-show="itemsLoaded && items.results.length > 0" v-cloak>
<tr :id="entry.plan.slug" :class="endsSoon(entry)" v-for="(entry, index) in items.results">
<td>
<a :href="entry.app_url">[[entry.plan.title]]</a>
</td>
<td v-if="entry.editable">
{% include "_entry_ends_at_field.html" %}
</td>
<td v-if="!entry.editable">
[[entry.ends_at ? ($globals.humanizeDate(entry.ends_at)) : "{% trans %}Never{% endtrans %}" ]]
</td>
<td>
[[$globals.humanizeTimeDelta(entry.ends_at, ends_at)]]
</td>
<td class="text-end" v-if="!entry.request_key">
<button class="btn btn-danger unsubscribe"
data-bs-toggle="modal" data-bs-target="#unsubscribe-action"
@click="unsubscribeConfirm(entry.profile.slug, entry.plan.slug)"
v-if="!entry.grant_key">
{% trans %}Unsubscribe Now{% endtrans %}
</button>
<a class="btn btn-primary"
:href="acceptGrantURL(entry.profile.slug, entry.grant_key)"
v-if="entry.grant_key">
{% trans %}Subscribe{% endtrans %}
</a>
<button class="btn btn-danger unsubscribe"
@click="unsubscribe(entry.profile.slug, entry.plan.slug)"
v-if="entry.grant_key">
<i class="fa-solid fa-times"></i>
</button>
</td>
<td class="text-end" v-if="entry.request_key && entry.editable">
<button class="btn btn-danger unsubscribe"
data-bs-toggle="modal" data-bs-target="#unsubscribe-action"
@click="unsubscribeConfirm(entry.profile.slug, entry.plan.slug)">
{% trans %}Deny{% endtrans %}
</button>
<button class="btn btn-primary"
@click="acceptRequest(entry.plan.profile, entry.request_key)">
{% trans %}Accept subscription{% endtrans %}
</button>
</td>
<td class="text-end" v-if="entry.request_key && !entry.editable">
{% trans %}Request pending approval ...{% endtrans %}
</td>
</tr>
</tbody>
</table>
</div>
{% include "_pagination.html" %}
<!-- modal dialog to confirm unsubscribe -->
<div class="modal fade"
id="unsubscribe-action" tabindex="-1" role="dialog"
aria-labelledby="{% trans %}Unsubscribe{% endtrans %}"
aria-hidden="true">
<form class="modal-dialog" method="post" action="." @submit.prevent="unsubscribe">
<input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans %}Unsubscribe{% endtrans %} ...</h5>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<p>
{% trans plan_name="[[toDelete.plan]]" %}You are about to unsubscribe from <em>{{plan_name}}</em>{% endtrans %}.
{% trans %}This operation cannot be reversed.{% endtrans %}
</p>
<p>
{% trans %}Are you sure you want to continue?{% endtrans %}
</p>
<div class="modal-footer">
<button id="cancel-unsubscribe"
class="btn btn-outline-primary"
data-bs-dismiss="modal">
{% trans %}Cancel{% endtrans %}
</button>
<button type="submit" id="unsubscribe-btn"
class="btn btn-danger"
data-bs-dismiss="modal">
{% trans %}Unsubscribe{% endtrans %}
</button>
</div>
</div>
</div>
</form>
</div>
</div><!-- /modal dialog to confirm unsubscribe -->
</subscription-list> <!-- /controller -->
<expired-subscription-list inline-template id="expired_subscriptions"
class="tab-pane" role="tabpanel" ref="expired">
<div>
<div id="expired-subscriptions-list-container"
class="table-responsive mb-4">
<table class="table" infinite-wrapper>
<thead>
<tr>
<th>
{% trans %}Plan{% endtrans %}
<a class="btn-sort"
href="#"
@click.prevent="sortBy('plan')"
aria-label="{% trans %}Sort by plan{% endtrans %}"
>
<i :class="sortIcon('plan')"></i>
</a>
</th>
<th>
{% trans %}Until{% endtrans %}
<a class="btn-sort"
href="#"
@click.prevent="sortBy('ends_at')"
aria-label="{% trans %}Sort by until{% endtrans %}"
>
<i :class="sortIcon('ends_at')"></i>
</a>
</th>
<th><span class="visually-hidden">{% trans %}Time remaining{% endtrans %}</span></th>
<th><span class="visually-hidden">{% trans %}Actions{% endtrans %}</span></th>
</tr>
</thead>
<tbody>
<tr v-show="!itemsLoaded">
<td colspan="4">
<div class="h3 text-center"><i class="fa-solid fa-refresh fa-spin fa-2x"></i></div>
</td>
</tr>
<tr v-show="itemsLoaded && items.count === 0" v-cloak>
<td colspan="4">
<h5 class="text-center"><em>{% trans %}No subcriptions{% endtrans %}<span v-show="params.q"> [[params.q]]</span></em></h5>
</td>
</tr>
</tbody>
<tbody v-show="itemsLoaded && items.results.length > 0" v-cloak>
<tr :class="endsSoon(entry)" v-for="(entry, index) in items.results">
<td>
<a :href="entry.app_url">[[entry.plan.title]]</a>
</td>
<td>
<span class="d-inline-block">
[[entry.ends_at ? $globals.humanizeDate(entry.ends_at) : "{% trans %}Never{% endtrans %}" ]]
</span>
</td>
<td>
[[$globals.humanizeTimeDelta(entry.ends_at, ends_at)]]
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
{% include "_pagination.html" %}
</div> <!-- /controller -->
</expired-subscription-list>
</div>
</div>
</subscription-list-container>
{% endblock %}