From 1aeb757e2282bb7e0017b0887332814d722170df Mon Sep 17 00:00:00 2001 From: Amal Elshihaby Date: Fri, 13 Aug 2021 10:06:13 +0200 Subject: [PATCH] Task #9530 bills that include vat per month in html or pdf format --- .../static/matrixhosting/css/theme.css | 8 +- .../static/matrixhosting/js/payment.js | 8 +- .../templates/matrixhosting/bills.html | 196 ++++++++++++++++++ .../templates/matrixhosting/cards.html | 16 +- .../matrixhosting/includes/_navbar.html | 6 +- .../templates/matrixhosting/invoice.html | 2 +- .../matrixhosting/order_details.html | 2 +- .../templates/matrixhosting/payments.html | 7 +- matrixhosting/urls.py | 3 +- matrixhosting/views.py | 36 +++- requirements.txt | 1 + uncloud/.env | 2 +- uncloud/settings.py | 1 + .../0027_alter_stripecreditcard_card_name.py | 18 ++ uncloud_pay/migrations/0028_bill_currency.py | 18 ++ uncloud_pay/models.py | 11 +- uncloud_pay/views.py | 2 +- 17 files changed, 298 insertions(+), 39 deletions(-) create mode 100644 matrixhosting/templates/matrixhosting/bills.html create mode 100644 uncloud_pay/migrations/0027_alter_stripecreditcard_card_name.py create mode 100644 uncloud_pay/migrations/0028_bill_currency.py diff --git a/matrixhosting/static/matrixhosting/css/theme.css b/matrixhosting/static/matrixhosting/css/theme.css index d642d70..a65e777 100644 --- a/matrixhosting/static/matrixhosting/css/theme.css +++ b/matrixhosting/static/matrixhosting/css/theme.css @@ -1325,7 +1325,7 @@ body, html { } .transaction-title { - background-color: #f1f5f6; + background-color: #d8e4e6; border-top: 1px solid #e9eff0; border-bottom: 1px solid #e9eff0; } @@ -1795,7 +1795,7 @@ body, html { position: relative; } .accordion:not(.accordion-alternate) .card-header a { - background-color: #e41d25; + background-color: #2b343c; color: #fff; } .accordion:not(.accordion-alternate) .card-header a.collapsed { @@ -1826,8 +1826,10 @@ body, html { } .accordion .card-body { line-height: 26px; - padding: 1rem 0 1rem 2.25rem; + border-left: 4px solid #2b343c; + background-color: #f9f9f9; } + .accordion.arrow-right .card-header a { padding-left: 1.25rem; } diff --git a/matrixhosting/static/matrixhosting/js/payment.js b/matrixhosting/static/matrixhosting/js/payment.js index 0e81695..3494d5e 100644 --- a/matrixhosting/static/matrixhosting/js/payment.js +++ b/matrixhosting/static/matrixhosting/js/payment.js @@ -17,7 +17,7 @@ function fetch_pricing() { if(data['total'] > balance) { $('#has-enough-balance').hide(); $('#cards-section').show(); - window.cardNumberElement = loadStripe(stripe); + window.cardNumberElement = loadStripe(window.stripe); } else { $('#cards-section').hide(); $('#has-enough-balance').show(); @@ -44,7 +44,7 @@ function incrementValue(e) { }; $(document).ready(function () { - var stripe = Stripe(window.stripeKey); + window.stripe = Stripe(window.stripeKey); if ($('#pricing_name') != undefined) { fetch_pricing(); @@ -56,7 +56,7 @@ $(document).ready(function () { var hasCreditcard = window.hasCreditcard || false; if (hasCreditcard) { - window.cardNumberElement = loadStripe(stripe); + window.cardNumberElement = loadStripe(window.stripe); } function submitBillingForm(pmId) { @@ -76,7 +76,7 @@ $(document).ready(function () { $('#id_payment_method').val(paymentMethod.id); submitBillingForm(paymentMethod.id); } - stripe.createPaymentMethod({ + window.stripe.createPaymentMethod({ type: 'card', card: window.cardNumberElement, }) diff --git a/matrixhosting/templates/matrixhosting/bills.html b/matrixhosting/templates/matrixhosting/bills.html new file mode 100644 index 0000000..f0f31ec --- /dev/null +++ b/matrixhosting/templates/matrixhosting/bills.html @@ -0,0 +1,196 @@ +{% extends "matrixhosting/base.html" %} + +{% load static i18n compress mathfilters %} + +{% block title %} Bills {% endblock %} + +{% block content %} +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+

{% trans "Bills"%}

+ +
+
+ +
+
+
+
+
+ + + +
+ +
+
+
{% trans "Bill No."%}
+
{% trans "Creation Date"%}
+
{% trans "Amount"%}
+
{% trans "Due Date"%}
+
{% trans "Closed"%}
+
{% trans "Download"%}
+
+
+ + + +
+
+ {% for bill in object_list %} +
+ +
+
+
Bill Lines:
+
+ + + + + + + + + + + + + {% for record in bill.bill_records.all %} + + + + + + + + + {% endfor %} + +
OrderDescriptionStart DateEnd DateSubtotalTotal
#{{record.order.id}}{{record.description}}{{record.starting_date|date:"Y-m-d"}}{{record.ending_date|date:"Y-m-d"}}{{record.subtotal}}{{record.sum}}
+
+
+
+
+
+
+

{% trans "Subtotal" %}

+
+
+

{{bill.subtotal}}

+
+
+
+
+

{{bill.billing_address.get_country_display}} VAT {{ bill.vat_rate|mul:100 }}%

+
+
+

{{bill.vat_amount}}

+
+
+
+
+
+
+
+
+
+

{% trans "Total" %}

+
+
+

{{bill.sum|floatformat:2}} CHF

+
+
+
+
+
+
+
+ {%endfor%} +
+
+ + + + + + +
+ +
+
+
+
+
+
+
+{% endblock %} +{% block js_extra %} + + +{% endblock js_extra %} \ No newline at end of file diff --git a/matrixhosting/templates/matrixhosting/cards.html b/matrixhosting/templates/matrixhosting/cards.html index 569b9b9..52356b1 100644 --- a/matrixhosting/templates/matrixhosting/cards.html +++ b/matrixhosting/templates/matrixhosting/cards.html @@ -2,16 +2,17 @@ {% load static i18n compress %} -{% block title %} Payments {% endblock %} +{% block title %} Payment Methods {% endblock %} {% block content %}
-
+
@@ -23,8 +24,8 @@
@@ -34,7 +35,6 @@

{% trans "Credit or Debit Cards"%} ({% trans "for payments"%})

-
{% for card in object_list %}
@@ -44,7 +44,7 @@ thru
{{card.expiry_date|date:"m"}}/{{card.expiry_date|date:"y"}} {% if card.active %}{% trans "Primary"%}{%endif%}

{{card.card_name}} visa

- +
{% endfor %} diff --git a/matrixhosting/templates/matrixhosting/includes/_navbar.html b/matrixhosting/templates/matrixhosting/includes/_navbar.html index 83f4153..f59c589 100644 --- a/matrixhosting/templates/matrixhosting/includes/_navbar.html +++ b/matrixhosting/templates/matrixhosting/includes/_navbar.html @@ -17,6 +17,7 @@ {% url 'matrix:index' as index_url %} + {% url 'matrix:orders' as orders_url %} {% url 'matrix:billing' as payments_url %}