diff --git a/billing_week.py b/billing_week.py
index 63397ee..cb225ee 100644
--- a/billing_week.py
+++ b/billing_week.py
@@ -292,6 +292,39 @@ def parse_billing_week(billing_week_string):
week,
)
+def next_n_billing_weeks(n, bw, billing_weeks=None):
+ """
+ Takes a number of billing weeks and a starting billing week, and returns
+ a list of billing weeks
+ """
+ if billing_weeks is None:
+ billing_weeks = []
+ if n > len(billing_weeks):
+ billing_weeks.append(bw.next())
+ return next_n_billing_weeks(n, bw.next(), billing_weeks)
+ else:
+ return billing_weeks
+
+def prev_n_billing_weeks(n, bw, billing_weeks=None):
+ if billing_weeks is None:
+ billing_weeks = []
+ if n > len(billing_weeks):
+ billing_weeks.append(bw.prev())
+ return prev_n_billing_weeks(n, bw.prev(), billing_weeks)
+ else:
+ return billing_weeks
+
+
+def next_valid_billing_week(bw, billing_week_strings):
+ """
+ Takes a billing week, and a set of skipped billing weeks, and steps forward
+ until it finds a week that isni't in the skipped set
+ """
+ if str(bw) in billing_week_strings:
+ return next_valid_billing_week(bw.next(), billing_week_strings)
+ else:
+ return bw
+
if __name__ == '__main__':
@@ -539,4 +572,26 @@ def test_billing_weeks_left_in_month(self):
self.assertEqual(len(
billing_weeks_left_in_the_month("2016-06 1")), 4)
+ def test_next_n_billing_weeks_returns_right_no_of_billing_weeks(self):
+ utc = pytz.timezone("UTC")
+ s = utc.localize(datetime.datetime(2016, 9, 2, 0))
+ last_bw_in_aug = get_billing_week(s)
+ self.assertEqual(
+ len(next_n_billing_weeks(5, last_bw_in_aug)), 5)
+
+ def test_prev_n_billing_weeks_returns_next_billing_week(self):
+ utc = pytz.timezone("UTC")
+ s = utc.localize(datetime.datetime(2016, 9, 2, 0))
+ last_bw_in_aug = get_billing_week(s)
+ self.assertNotIn(
+ last_bw_in_aug,
+ prev_n_billing_weeks(5, last_bw_in_aug))
+
+ def test_prev_n_billing_weeks_returns_right_no_of_billing_weeks(self):
+ utc = pytz.timezone("UTC")
+ s = utc.localize(datetime.datetime(2016, 9, 2, 0))
+ last_bw_in_aug = get_billing_week(s)
+ self.assertEqual(
+ len(prev_n_billing_weeks(5, last_bw_in_aug)), 5)
+
unittest.main()
diff --git a/blueworld/settings.py b/blueworld/settings.py
index d75f083..c8153d9 100644
--- a/blueworld/settings.py
+++ b/blueworld/settings.py
@@ -51,6 +51,7 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
+ 'django.contrib.humanize',
'django.contrib.staticfiles',
# The Django sites framework is required for allauth
'django.contrib.sites',
@@ -71,6 +72,7 @@
if DEBUG:
INSTALLED_APPS.append('django_extensions')
+ INSTALLED_APPS.append('debug_toolbar')
RQ_QUEUES = {
diff --git a/blueworld/static/blueworld/application.js b/blueworld/static/blueworld/application.js
index 5d62f30..218d2f4 100644
--- a/blueworld/static/blueworld/application.js
+++ b/blueworld/static/blueworld/application.js
@@ -18995,3 +18995,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Trigger foundation to add the effects we want
$(document).foundation();
+
+
+$(document).ready(function() {
+ $('.collection-point-info .instructions').hide()
+ $('.collection-point-info a').click(function(event) {
+
+ $(this).parent().find('.instructions').slideToggle("fast");
+
+ });
+});
diff --git a/blueworld/static/blueworld/collection-map.js b/blueworld/static/blueworld/collection-map.js
new file mode 100644
index 0000000..da0ae62
--- /dev/null
+++ b/blueworld/static/blueworld/collection-map.js
@@ -0,0 +1,62 @@
+jQuery(document).ready(function($) {
+ var mymap = L.map('collection-map').setView([51.557853, -0.073096], 13);
+ var popup = L.popup();
+
+ L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibXJjaHJpc2FkYW1zIiwiYSI6InFobnRZRzQifQ.jLPeG4HV4RiCL8RVNPBTwg', {
+ attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
+ maxZoom: 18,
+ }).addTo(mymap);
+
+ function showLocation(e) {
+ // update popup to show name
+ var p = this.popup, loc = this.loc, mymap = this.leafletmap;
+ p.setContent("
" + loc.name + "
" + loc.location + "
");
+ p.setLatLng(e.latlng);
+ p.openOn(mymap);
+ }
+
+ // accepts a set of coordinates and returns a leaflet marker if they're
+ // usable
+ function createMarker(loc) {
+
+ // check for None's coming through from django
+ if (loc.longitude === "None" || loc.latitude == "None"){
+ return false
+ }
+ // if we have both coords, we can create a marker
+ if (loc.longitude && loc.latitude) {
+ return L.marker([loc.latitude, loc.longitude])
+ }
+ // otherwise assume we didn't have the required attributes
+ return false
+ }
+
+ GC.markers = {}
+ GC.activeMarker = "";
+
+ $.each(GC.locations, function(k, loc) {
+ // only try to place a marker if we have coords to place with
+ newMarker = createMarker(loc)
+ if (newMarker) {
+ newMarker
+ .addTo(mymap)
+ .bindPopup("" + loc.name + "
" + loc.location + "
");
+ GC.markers[k] = { id: k, marker: newMarker};
+ }
+
+ // add listener on the inputs
+ $('.collection-points ul li').on('mouseover', function(event) {
+ var marker = $(this).find('input').attr('id');
+
+ if (marker !== GC.activeMarker){
+ GC.activeMarker = marker;
+ GC.markers[marker].marker.fire('click');
+ }
+ })
+ })
+
+
+ // add listener to find marker with the `id_collection_point_0` id,
+ // so it is highlighted when selected.
+
+});
diff --git a/blueworld/static/blueworld/style.css b/blueworld/static/blueworld/style.css
index 7e9b26d..e58d5ad 100644
--- a/blueworld/static/blueworld/style.css
+++ b/blueworld/static/blueworld/style.css
@@ -2000,6 +2000,7 @@ select {
display: block;
margin-right: 0; } }
+.errorlist,
.callout {
margin: 0 0 1rem 0;
padding: 1rem;
@@ -3519,7 +3520,7 @@ table.hover tr:nth-of-type(even):hover {
h1, h2, h3, .font-display {
font-family: "GC Display", "Impact", "Arial", sans-serif;
-}
+ text-transform: uppercase; }
.font-text {
font-family: "Domaine Text Regular", "Times New Roman", Georgia, serif;
@@ -3543,6 +3544,9 @@ a {
.global-nav {
margin-bottom: 1rem; }
+#billing-dates li.past p {
+ color: #e6e6e6; }
+
.tagline {
display: inline; }
@@ -3554,13 +3558,14 @@ a {
text-align: center; }
.header .logo {
max-width: 75px;
- margin-right: 30px;
- margin-left: 20px;
- margin-top: 20px; }
+ margin-right: 1rem;
+ margin-left: 1rem;
+ margin-top: 1rem;
+ margin-bottom: 1rem; }
.header h2 {
text-transform: uppercase;
display: inline-block;
- font-size: 200%;
+ font-size: 3rem;
margin-top: 0.5em; }
.header nav .menu {
background-color: #ccc; }
@@ -3573,6 +3578,15 @@ a {
h3.font-text {
max-width: 30em; }
+.current-choice,
+.this_week {
+ background: #EEE;
+ padding: 1rem;
+ margin-bottom: 1rem; }
+
+.next_week {
+ padding: 1rem; }
+
fieldset.collection-points label {
font-size: 120%;
font-weight: bold; }
@@ -3595,6 +3609,26 @@ fieldset.collection-points ul > li.columns:last-child:not(:first-child) {
padding: 0.5rem;
margin-left: 0; }
+.this_week p,
+.this_week h4{
+ font-size: 1.5rem;
+}
+.this_week .instructions p{
+ font-size: 1rem;
+}
+
+.this_week ul li {
+ font-size: 1.5rem; }
+
+.instructions {
+ padding: 1rem;
+ font-size: 1rem;
+ max-width: 40rem;
+ border-top: 1px solid #cacaca;
+ background-color: #e6e6e6; }
+ .instructions p {
+ max-width: 40em; }
+
.callout {
background-color: #e6e6e6; }
@@ -3607,6 +3641,11 @@ fieldset.collection-points ul > li.columns:last-child:not(:first-child) {
margin-right: auto; }
-#billing-dates li.past p{
- color:grey;
+div.skipped h5,
+div.skipped li{
+ color: #999;
+}
+
+.greeting{
+ font-size:2em;
}
diff --git a/blueworld/templates/admin/join/customer/change_list.html b/blueworld/templates/admin/join/customer/change_list.html
new file mode 100644
index 0000000..f344b14
--- /dev/null
+++ b/blueworld/templates/admin/join/customer/change_list.html
@@ -0,0 +1,57 @@
+{% extends "admin/change_list.html" %}
+{% load i18n admin_urls admin_static admin_list %}
+
+{% block content %}
+
+ {% include "partials/dashboard_stats.html" %}
+
+
+
+ {% block object-tools %}
+ {% if has_add_permission %}
+
+ {% endif %}
+ {% endblock %}
+ {% if cl.formset.errors %}
+
+ {% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
+
+ {{ cl.formset.non_form_errors }}
+ {% endif %}
+
+ {% block search %}{% search_form cl %}{% endblock %}
+ {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
+
+ {% block filters %}
+ {% if cl.has_filters %}
+
+
{% trans 'Filter' %}
+ {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
+
+ {% endif %}
+ {% endblock %}
+
+
+
+
+{% endblock %}
diff --git a/blueworld/templates/base.html b/blueworld/templates/base.html
index 4a2128b..a2dd632 100644
--- a/blueworld/templates/base.html
+++ b/blueworld/templates/base.html
@@ -45,8 +45,11 @@
- {% include "partials/footer.html" %}
-
+ {% include "partials/footer.html" %}
+
+ {% block extra_scripts %}
+ {% endblock %}
+