Progress bar on payment form page.
authorRadek Czajka <rczajka@rczajka.pl>
Wed, 23 Dec 2020 11:26:40 +0000 (12:26 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Wed, 23 Dec 2020 11:26:40 +0000 (12:26 +0100)
src/club/static/club/club.scss
src/club/templates/club/membership_form.html
src/club/templatetags/club.py

index 4b3d7d5..892faf4 100644 (file)
@@ -83,6 +83,7 @@
     margin-bottom: 1em;
     border: 1px solid #ddd;
     position: relative;
     margin-bottom: 1em;
     border: 1px solid #ddd;
     position: relative;
+    min-height: 100px;
 }
 .ambassador.with-photo {
     padding-right: 145px;
 }
 .ambassador.with-photo {
     padding-right: 145px;
index f9fe931..fe85c1c 100644 (file)
 
         {% chunk 'club_form_top' %}
 
 
         {% chunk 'club_form_top' %}
 
+        {% club_monthly_since '2020-12-01' as cc %}
+        {% club_monthly_missing_since '2020-12-01' 100 as cm %}
+        <p>Pomóż nam zdobyć 100 nowych Przyjaciół do końca roku. W grudniu stałą wpłatą wsparło nas już <b style="color: #0d7e85">{{ cc }}</b> czytelników i czytelniczek, brakuje  <b style="color: #0d7e85">{{ cm }}</b>.</p>
+        <div class="funding" style="background: none;"><div class="description"><div class="progress" style="text-align: center; background-size: {{ cc }}% 1px;"><span class="piece progress-collected">&nbsp;{{ cc }}</span><span class="piece progress-target">{{ cm }}&nbsp;</span><div style="clear: both"></div></div></div></div>
+
         {% include "club/payment_form.html" %}
 
         {% chunk 'club_form_bottom' %}
         {% include "club/payment_form.html" %}
 
         {% chunk 'club_form_bottom' %}
index 42913fe..d691297 100644 (file)
@@ -66,3 +66,15 @@ def club_active_30day_sum():
         yearly=False, monthly=False,
         payed_at__gte=now() - timedelta(days=30)
     ).aggregate(s=Sum('amount'))['s'] or 0
         yearly=False, monthly=False,
         payed_at__gte=now() - timedelta(days=30)
     ).aggregate(s=Sum('amount'))['s'] or 0
+
+
+@register.simple_tag
+def club_monthly_since(start):
+    return Schedule.objects.filter(
+        monthly=True, payed_at__gte=start).count()
+
+
+@register.simple_tag
+def club_monthly_missing_since(start, target):
+    return target - Schedule.objects.filter(
+        monthly=True, payed_at__gte=start).count()