-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsubscribers.html
More file actions
396 lines (378 loc) · 19.2 KB
/
Copy pathsubscribers.html
File metadata and controls
396 lines (378 loc) · 19.2 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
{% extends "saas/base_dashboard.html" %}
{% block saas_title %}
{% trans %}Subscribers{% endtrans %}
{% endblock %}
{% block help_menus %}
{% if urls.provider and urls.provider.subscribers_activity %}
<li class="divider-vertical"></li>
<li class="nav-item">
<a id="subscribers-activity" class="nav-link{% if request.path == urls.provider.subscribers_activity %} active{% endif %}" href="{{urls.provider.subscribers_activity}}">{% trans %}Subscribers Activity{% endtrans %}</a>
</li>
{% endif %}
{% endblock %}
{% block saas_content %}
<lazy-load-tabs inline-template class="pt-3" id="subscribers">
<div id="subscribers-list-container"
data-trip data-trip-index="1"
data-trip-content="<h2>{% trans %}Active subscribers{% endtrans %}</h2><p>{% trans %}List of all active subscribers.<br />You will find here the list of all active subscribers,<br />with the plans they are subscribed to, the date they first<br />subscribed as well as when their renewal is due.{% endtrans %}</p><em>{% trans %}Use keyboard navigation or click 'Next' to move forward.{% endtrans %}</em>"
data-trip-position="screen-center">
<ul class="nav nav-tabs dashboard-tab" role="tablist">
{% for tab in tabs %}
<li class="nav-item">
<a class="nav-link{% if tab.is_active %} active{% endif %}" href="#{{tab.slug}}" data-bs-toggle="tab" @click="tabClicked('{{tab.slug}}')">{{tab.title}}</a>
</li>
{% endfor %}
</ul>
<div class="tab-content">
{% for tab in tabs %}
{% if tab.slug == 'registered' %}
<registered inline-template id="registered" class="tab-pane"
role="tabpanel" ref="registered">
<div id="registered-tab-container">
<div class="mt-2">
{% include "saas/_filter.html" %}
</div>
<div class="table-responsive">
<table class="table table-sm table-striped w-100" infinite-wrapper>
<thead>
<tr>
<th>
{% trans %}Full name{% endtrans %}
<a href="#" @click.prevent="sortBy('full_name')" aria-label="{% trans %}Sort by full name{% endtrans %}">
<i :class="sortIcon('full_name')" class="ps-2"></i>
</a>
</th>
<th class="text-center">
{% trans %}Created at{% endtrans %}
<a href="#" @click.prevent="sortBy('created_at')" aria-label="{% trans %}Sort by created at{% endtrans %}">
<i :class="sortIcon('created_at')" class="ps-2"></i>
</a>
</th>
<th class="text-center">
{% trans %}Last login{% endtrans %}
<a href="#" @click.prevent="sortBy('last_login')" aria-label="{% trans %}Sort by last login{% endtrans %}">
<i :class="sortIcon('last_login')" class="ps-2"></i>
</a>
</th>
</tr>
</thead>
<tbody v-show="!itemsLoaded">
<tr>
<td colspan="3">
<div class="text-center h3"><i class="fa-solid fa-refresh fa-spin fa-2x"></i></div>
</td>
</tr>
</tbody>
<tbody class="has-no-results" v-show="itemsLoaded && items.results.length == 0" v-cloak>
<tr>
<td colspan="3">
<p class="text-center my-2"><em>{% trans %}No registered users{% endtrans %}<span v-show="params.q"> [[params.q]]</span></em></p>
</td>
</tr>
</tbody>
<tbody class="has-results" v-show="itemsLoaded && items.results.length > 0" v-cloak>
<tr :id="user.slug" v-for="user in items.results">
<td>
{# initially copy/paste of _user_card.html #}
{# to use `user` instead of `item.user` #}
<div class="row">
<div class="col-2">
<div>
<a :href="'{{urls.profile_redirect}}' + user.slug + '/'"><img class="card-img-top rounded-circle" style="width:64px;height:64px;" v-bind:src="user.picture ? user.picture : '{{'/assets/img/default-user.png'|asset}}'" alt="{% trans %}User picture{% endtrans %}"></a>
</div>
</div>
<div class="col-10 align-self-center">
<h5 class="card-title"><a :href="'{{urls.profile_redirect}}' + user.slug + '/'">[[user.printable_name]]</a></h5>
<small class="card-subtitle">[[user.email]]</small>
</div>
</div>
</td>
<td class="text-center">
[[$globals.humanizeDate(user.created_at)]]<br />
<small>([[$globals.humanizeTimeDelta(user.created_at, params.ends_at)]])</small>
</td>
<td class="text-center">
[[$globals.humanizeDate(user.last_login)]]<br />
<small>([[$globals.humanizeTimeDelta(user.last_login, params.ends_at)]])</small>
</td>
</tr>
</tbody>
</table>
</div>
{% include "_pagination.html" %}
</div>
</registered>
{% else %}
<{{tab.slug}} inline-template id="{{tab.slug}}"
class="tab-pane{% if tab.is_active %} active{% endif %}"
role="tabpanel" ref="{{tab.slug}}">
<div id="{{tab.slug}}-tab-container">
<div class="mt-2">
{% include "saas/_filter.html" %}
</div>
<div class="table-responsive">
<table class="table table-sm table-striped" infinite-wrapper>
<thead>
<!-- Sort Organization -->
<tr v-show="sortDir('profile')" class="text-nowrap" v-cloak>
<th>
{% trans %}Subscriber{% endtrans %}
<a href="#" @click.prevent="sortBy('profile')" aria-label="{% trans %}Sort by subscriber{% endtrans %}">
<i :class="sortIcon('profile')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Plan{% endtrans %}
<a href="#" @click.prevent="sortBy('plan')" aria-label="{% trans %}Sort by plan{% endtrans %}">
<i :class="sortIcon('plan')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Since{% endtrans %}
<a href="#" @click.prevent="sortBy('created_at')" aria-label="{% trans %}Sort by created at{% endtrans %}">
<i :class="sortIcon('created_at')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Ends at{% endtrans %}
<a href="#" @click.prevent="sortBy('ends_at')" aria-label="{% trans %}Sort by ends at{% endtrans %}">
<i :class="sortIcon('ends_at')" class="ps-2"></i>
</a>
</th>
<th>{% trans %}Description{% endtrans %}</th>
</tr>
<tr v-show="sortDir('plan')" class="text-nowrap" v-cloak>
<th>
{% trans %}Plan{% endtrans %}
<a href="#" @click.prevent="sortBy('plan')" aria-label="{% trans %}Sort by plan{% endtrans %}">
<i :class="sortIcon('plan')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Subscriber{% endtrans %}
<a href="#" @click.prevent="sortBy('profile')" aria-label="{% trans %}Sort by subscriber{% endtrans %}">
<i :class="sortIcon('profile')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Since{% endtrans %}
<a href="#" @click.prevent="sortBy('created_at')" aria-label="{% trans %}Sort by created at{% endtrans %}">
<i :class="sortIcon('created_at')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Ends At{% endtrans %}
<a href="#" @click.prevent="sortBy('ends_at')" aria-label="{% trans %}Sort by ends at{% endtrans %}">
<i :class="sortIcon('ends_at')" class="ps-2"></i>
</a>
</th>
<th>{% trans %}Description{% endtrans %}</th>
</tr>
<!-- Sort Created At -->
<tr v-show="sortDir('created_at')" class="text-nowrap" v-cloak>
<th>
{% trans %}Since{% endtrans %}
<a href="#" @click.prevent="sortBy('created_at')" aria-label="{% trans %}Sort by created at{% endtrans %}">
<i :class="sortIcon('created_at')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Subscriber{% endtrans %}
<a href="#" @click.prevent="sortBy('profile')" aria-label="{% trans %}Sort by subscriber{% endtrans %}">
<i :class="sortIcon('profile')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Plan{% endtrans %}
<a href="#" @click.prevent="sortBy('plan')" aria-label="{% trans %}Sort by plan{% endtrans %}">
<i :class="sortIcon('plan')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Ends At{% endtrans %}
<a href="#" @click.prevent="sortBy('ends_at')" aria-label="{% trans %}Sort by ends at{% endtrans %}">
<i :class="sortIcon('ends_at')" class="ps-2"></i>
</a>
</th>
<th>{% trans %}Description{% endtrans %}</th>
</tr>
<tr v-show="sortDir('ends_at')" class="text-nowrap" v-cloak>
<th>
{% trans %}Ends At{% endtrans %}
<a href="#" @click.prevent="sortBy('ends_at')" aria-label="{% trans %}Sort by ends at{% endtrans %}">
<i :class="sortIcon('ends_at')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Subscriber{% endtrans %}
<a href="#" @click.prevent="sortBy('profile')" aria-label="{% trans %}Sort by subscriber{% endtrans %}">
<i :class="sortIcon('profile')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Plan{% endtrans %}
<a href="#" @click.prevent="sortBy('plan')" aria-label="{% trans %}Sort by plan{% endtrans %}">
<i :class="sortIcon('plan')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Since{% endtrans %}
<a href="#" @click.prevent="sortBy('created_at')" aria-label="{% trans %}Sort by created at{% endtrans %}">
<i :class="sortIcon('created_at')" class="ps-2"></i>
</a>
</th>
<th>
{% trans %}Description{% endtrans %}
</th>
</tr>
</thead>
<!-- Show Loader -->
<tbody class="fetching-results" v-show="!itemsLoaded" v-cloak>
<tr>
<td colspan="5">
<div class="h3 text-center"><i class="fa-solid fa-refresh fa-spin fa-2x"></i></div>
</td>
</tr>
</tbody>
<!-- Show If No Subscribers -->
<tbody class="has-no-results" v-show="itemsLoaded && items.results.length == 0" v-cloak>
<tr>
<td colspan="5">
<p class="text-center my-2">
<em>{% trans %}No subscribers{% endtrans %} <span v-show="params.q"> {% trans %}with filter:{% endtrans %} '[[params.q]]'</span></em>
</p>
</td>
</tr>
</tbody>
<!-- Sort by subscriber's name -->
<tbody class="has-results" v-for="(group, key) in groupBy(items.results, 'profile.printable_name')"
v-show="sortDir('profile') && itemsLoaded && items.results.length > 0" v-cloak>
<tr v-for="entry in [group[0]]">
<td colspan="5" class="text-nowrap">
<a :id="entry.profile.slug" :href="'{{urls.profile_base}}' + entry.profile.slug + '/subscriptions/'">[[entry.profile.printable_name]]</a>
</td>
</tr>
<tr v-for="entry in group" :class="endsSoon(entry)">
<td></td>
<td>[[entry.plan.title]]</td>
<td>[[$globals.humanizeDate(entry.created_at)]]</td>
<td class="text-nowrap">[[$globals.humanizeDate(entry.ends_at)]]</td>
<td class="description editable" :id="entry.id">
<span>[[entry.description]] <i class="fa-solid fa-pencil"></i></span>
<input type="text"
class="form-control"
@blur="saveDescription(entry)"
@keyup.13="saveDescription(entry)"
v-model="entry.description"
:ref="refId(entry, entry.plan.slug)"
v-show="entry.edit_description">
</td>
</tr>
</tbody>
<!-- Sort by subscription's plan -->
<tbody class="has-results"
v-for="(group, key) in groupBy(items.results, 'plan.title')"
v-show="sortDir('plan') && itemsLoaded && items.results.length > 0" v-cloak>
<tr v-for="entry in [group[0]]">
<td colspan="5">
[[entry.plan.title]]
</td>
</tr>
<tr v-for="entry in group" :class="endsSoon(entry)">
<td></td>
<td class="text-nowrap">
<a :id="entry.profile.slug"
:href="'{{urls.profile_base}}' + entry.profile.slug + '/subscriptions/'">[[entry.profile.printable_name]]</a>
</td>
<td>[[$globals.humanizeDate(entry.created_at)]]</td>
<td class="text-nowrap">[[$globals.humanizeDate(entry.ends_at)]]</td>
<td class="description editable">
<span v-show="!entry.edit_description" @click="editDescription(entry, entry.plan.slug)">
[[entry.description]] <i class="fa-solid fa-pencil"></i>
</span>
<input type="text"
class="form-control"
@blur="saveDescription(entry)"
@keyup.13="saveDescription(entry)"
v-model="entry.description"
:ref="refId(entry, entry.plan.slug)"
v-show="entry.edit_description">
</td>
</tr>
</tbody>
<!-- Sort by subscription `created_at` date -->
<tbody class="has-results"
v-for="(group, key) in groupBy(items.results, 'created_at')"
v-show="sortDir('created_at') && itemsLoaded && items.results.length > 0" v-cloak>
<tr v-for="entry in [group[0]]">
<td colspan="5">
[[$globals.humanizeDate(entry.created_at)]]
</td>
</tr>
<tr v-for="entry in group" :class="endsSoon(entry)">
<td></td>
<td class="text-nowrap">
<a :id="entry.profile.slug" :href="'{{urls.profile_base}}' + entry.profile.slug + '/subscriptions/'">[[entry.profile.printable_name]]</a>
</td>
<td>[[entry.plan.title]]</td>
<td class="text-nowrap">[[$globals.humanizeDate(entry.ends_at)]]</td>
<td class="description editable">
<span v-show="!entry.edit_description" @click="editDescription(entry, entry.plan.slug)">
[[entry.description]] <i class="fa-solid fa-pencil"></i>
</span>
<input type="text"
class="form-control"
@blur="saveDescription(entry)"
@keyup.13="saveDescription(entry)"
v-model="entry.description"
:ref="refId(entry, entry.plan.slug)"
v-show="entry.edit_description">
</td>
</tr>
</tbody>
<!-- Sort by subscription's `ends_at` date -->
<tbody class="has-results"
v-for="(group, key) in groupBy(items.results, 'ends_at')"
v-show="sortDir('ends_at') && itemsLoaded && items.results.length > 0" v-cloak>
<tr v-for="entry in [group[0]]">
<td colspan="5">
[[$globals.humanizeDate(entry.ends_at)]]
</td>
</tr>
<tr v-for="entry in group" :class="endsSoon(entry)">
<td></td>
<td class="text-nowrap">
<a :id="entry.profile.slug" :href="'{{urls.profile_base}}' + entry.profile.slug + '/subscriptions/'">[[entry.profile.printable_name]]</a>
</td>
<td>[[entry.plan.title]]</td>
<td class="text-nowrap">[[$globals.humanizeDate(entry.created_at)]]</td>
<td class="description editable">
<span v-show="!entry.edit_description" @click="editDescription(entry, entry.plan.slug)">
[[entry.description]] <i class="fa-solid fa-pencil"></i>
</span>
<input type="text" class="form-control"
@blur="saveDescription(entry)"
@keyup.13="saveDescription(entry)"
v-model="entry.description"
:ref="refId(entry, entry.plan.slug)"
v-show="entry.edit_description">
</td>
</tr>
</tbody>
</table>
</div>
{% include "_pagination.html" %}
</div>
</{{tab.slug}}>
{% endif %}
{% endfor %}
</div>{# /.tab-content #}
</div>
</lazy-load-tabs>
{% endblock %}
{% block saas_bodyscripts %}
<script type="text/javascript" {{request|csp_nonce}}>
Vue.prototype.$sortDirection = "asc";
Vue.prototype.$sortByField = "profile";
</script>
{% endblock %}