From 10b87e433b8f20de2ddd2426fae2003db2cde73b Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Fri, 28 Jul 2017 14:58:47 +0100
Subject: [PATCH] Add international pricing table
---
app/main/views/index.py | 5 ++++-
app/templates/views/pricing.html | 15 +++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/app/main/views/index.py b/app/main/views/index.py
index edf032324..c0264c62e 100644
--- a/app/main/views/index.py
+++ b/app/main/views/index.py
@@ -35,7 +35,10 @@ def pricing():
return render_template(
'views/pricing.html',
sms_rate=0.0158,
- international_sms_rates=INTERNATIONAL_BILLING_RATES,
+ international_sms_rates=sorted([
+ (cc, country['names'], country['billable_units'])
+ for cc, country in INTERNATIONAL_BILLING_RATES.items()
+ ], key=lambda x: x[0])
)
diff --git a/app/templates/views/pricing.html b/app/templates/views/pricing.html
index 776934527..9b202cc82 100644
--- a/app/templates/views/pricing.html
+++ b/app/templates/views/pricing.html
@@ -60,6 +60,21 @@
times the cost of messages to UK mobile numbers.
+ {% call mapping_table(
+ caption='Letter pricing',
+ field_headings=['Country code', 'Country', 'Cost multipler'],
+ field_headings_visible=True,
+ caption_visible=False
+ ) %}
+ {% for cc, names, billable_units in international_sms_rates %}
+ {% call row() %}
+ {{ text_field('+ '|safe + cc) }}
+ {{ text_field(names[0]) }}
+ {{ text_field('{} ×'.format(billable_units)|safe) }}
+ {% endcall %}
+ {% endfor %}
+ {% endcall %}
+
Letters