diff --git a/car_inventory/__pycache__/settings.cpython-311.pyc b/car_inventory/__pycache__/settings.cpython-311.pyc index 92b03f6f..599aa15d 100644 Binary files a/car_inventory/__pycache__/settings.cpython-311.pyc and b/car_inventory/__pycache__/settings.cpython-311.pyc differ diff --git a/car_inventory/__pycache__/urls.cpython-311.pyc b/car_inventory/__pycache__/urls.cpython-311.pyc index 8c3b05d2..a83a2e89 100644 Binary files a/car_inventory/__pycache__/urls.cpython-311.pyc and b/car_inventory/__pycache__/urls.cpython-311.pyc differ diff --git a/car_inventory/urls.py b/car_inventory/urls.py index 7b6399d6..dafe4c8a 100644 --- a/car_inventory/urls.py +++ b/car_inventory/urls.py @@ -24,6 +24,7 @@ urlpatterns += i18n_patterns( path('ledger/', include('django_ledger.urls', namespace='django_ledger')), path("haikalbot/", include("haikalbot.urls")), path('appointment/', include('appointment.urls')), + path('plans/', include('plans.urls')), ) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/inventory/__pycache__/mixins.cpython-311.pyc b/inventory/__pycache__/mixins.cpython-311.pyc index d9fae07d..ed3ed8af 100644 Binary files a/inventory/__pycache__/mixins.cpython-311.pyc and b/inventory/__pycache__/mixins.cpython-311.pyc differ diff --git a/inventory/mixins.py b/inventory/mixins.py index 966a8666..b7762382 100644 --- a/inventory/mixins.py +++ b/inventory/mixins.py @@ -2,16 +2,17 @@ from django import forms from django.utils.translation import get_language + class AddClassMixin: """ - Mixin for adding classes to a model. + Mixin for adding classes to form fields and wrapping them in a div with class 'form-floating'. """ def add_class_to_fields(self): """ - Adds the class to the fields of the model. - :return: class names form-control or form-select + Adds the class to the fields of the form and wraps them in a div with class 'form-floating'. """ for field_name, field in self.fields.items(): + # Add classes to the field if isinstance(field.widget, forms.Select): existing_classes = field.widget.attrs.get('class', '') field.widget.attrs['class'] = f"{existing_classes} form-select form-select-sm".strip() @@ -19,6 +20,23 @@ class AddClassMixin: existing_classes = field.widget.attrs.get('class', '') field.widget.attrs['class'] = f"{existing_classes} form-control form-control-sm".strip() + # Wrap the field in a div with class 'form-floating' + field.widget.attrs['wrapper_class'] = 'form-floating' + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.add_class_to_fields() + + def __getitem__(self, name): + """ + Overrides the __getitem__ method to wrap the field in a div with class 'form-floating'. + """ + field = super().__getitem__(name) + wrapper_class = field.field.widget.attrs.pop('wrapper_class', None) + if wrapper_class: + field = forms.utils.safety.mark_safe(f'
{field}
') + return field + class LocalizedNameMixin: """ diff --git a/templates/mail/change_plan_body.txt b/templates/mail/change_plan_body.txt new file mode 100644 index 00000000..489b5100 --- /dev/null +++ b/templates/mail/change_plan_body.txt @@ -0,0 +1,13 @@ +{% load i18n %}{% autoescape off %} +{% trans "Hi" %} {% firstof user.get_full_name user.username %}, + +{% if userplan.expire != None %} + {% blocktrans with plan_name=plan.name expire=userplan.expire %}Your current plan is {{ plan_name }} and it will expire on {{ expire }}. {% endblocktrans %} +{% else %} + {% blocktrans with plan_name=plan.name %}Your current plan is {{ plan_name }}. {% endblocktrans %} +{% endif %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/mail/change_plan_title.txt b/templates/mail/change_plan_title.txt new file mode 100644 index 00000000..bbec277e --- /dev/null +++ b/templates/mail/change_plan_title.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans with user=user plan=plan.name %}Your account {{ user }} has new plan {{ plan }}{% endblocktrans %} \ No newline at end of file diff --git a/templates/mail/expired_account_body.txt b/templates/mail/expired_account_body.txt new file mode 100644 index 00000000..701ad8f9 --- /dev/null +++ b/templates/mail/expired_account_body.txt @@ -0,0 +1,14 @@ +{% load i18n %}{% autoescape off %} +{% trans "Hi" %} {% firstof user.get_full_name user.username %}, + +{% blocktrans %}Your account has just expired.{% endblocktrans %} + +{% blocktrans with plan_name=userplan.plan.name %}You can restore your current plan {{ plan_name }} here:{% endblocktrans %} +http://{{ site_domain }}{% url 'current_plan' %} +{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %} +http://{{ site_domain }}{% url 'upgrade_plan' %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/mail/expired_account_title.txt b/templates/mail/expired_account_title.txt new file mode 100644 index 00000000..54a3d3a7 --- /dev/null +++ b/templates/mail/expired_account_title.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %} \ No newline at end of file diff --git a/templates/mail/extend_account_body.txt b/templates/mail/extend_account_body.txt new file mode 100644 index 00000000..f7e77e50 --- /dev/null +++ b/templates/mail/extend_account_body.txt @@ -0,0 +1,11 @@ +{% load i18n %}{% autoescape off %} +{% trans "Hi" %} {% firstof user.get_full_name user.username %}, + +{% blocktrans with days=pricing.period plan_name=plan.name expire=userplan.expire %}Your account has just been extended by {{ days }} days. Your current plan is {{ plan_name }} and it will expire on {{ expire }}. {% endblocktrans %} + +{% trans "An invoice will be sent with another e-mail, if billing data was provided." %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/mail/extend_account_title.txt b/templates/mail/extend_account_title.txt new file mode 100644 index 00000000..8a984a5e --- /dev/null +++ b/templates/mail/extend_account_title.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans with user=user days=pricing.period %}Your account {{ user }} has been extended by {{ days }} days{% endblocktrans %} \ No newline at end of file diff --git a/templates/mail/invoice_created_body.txt b/templates/mail/invoice_created_body.txt new file mode 100644 index 00000000..4367230c --- /dev/null +++ b/templates/mail/invoice_created_body.txt @@ -0,0 +1,14 @@ +{% load i18n %}{% autoescape off %} +{% trans "Hi" %} {% firstof user.get_full_name user.username %}, + +{% blocktrans %}We are writing to inform you, that {{ invoice_type }} {{ invoice_number }} has been issued. You can view it and print it at: +http://{{ site_domain }}{{ url }} +{% endblocktrans %} + +{% trans "Details of the order can be see on:" %}: +http://{{ site_domain }}{% url 'order' pk=order %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/mail/invoice_created_title.txt b/templates/mail/invoice_created_title.txt new file mode 100644 index 00000000..3304e800 --- /dev/null +++ b/templates/mail/invoice_created_title.txt @@ -0,0 +1 @@ +{% load i18n %}{% trans 'Order' %} {{ order }} - {% blocktrans with invoice_type=invoice_type invoice_number=invoice_number user=user %}{{ invoice_type }} {{ invoice_number }} has been issued for {{ user }}{% endblocktrans %} \ No newline at end of file diff --git a/templates/mail/remind_expire_body.txt b/templates/mail/remind_expire_body.txt new file mode 100644 index 00000000..e795fcdf --- /dev/null +++ b/templates/mail/remind_expire_body.txt @@ -0,0 +1,15 @@ +{% load i18n %}{% autoescape off %} +{% trans "Hi" %} {% firstof user.get_full_name user.username %}, + +{% blocktrans %}Your account will expire in {{ days }} days.{% endblocktrans %} + +{% blocktrans with plan_name=userplan.plan.name %}You can extend your current plan {{ plan_name }} on page:{% endblocktrans %} +http://{{ site_domain }}{% url 'current_plan' %} + +{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %} +http://{{ site_domain }}{% url 'upgrade_plan' %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/mail/remind_expire_title.txt b/templates/mail/remind_expire_title.txt new file mode 100644 index 00000000..b6863e01 --- /dev/null +++ b/templates/mail/remind_expire_title.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans count days as days %}Your account {{ user }} will expire in {{ days }} day{% plural %}Your account {{ user }} will expire in {{ days }} days{% endblocktrans %} \ No newline at end of file diff --git a/templates/plans/account_activation.html b/templates/plans/account_activation.html new file mode 100644 index 00000000..233f51bf --- /dev/null +++ b/templates/plans/account_activation.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block body %} +

{% if SUCCESSFUL %}{% trans "Activation successful" %}{% else %}{% trans "Activation failed" %}{% endif %}

+ + {% if SUCCESSFUL %} +{# {% include "messages.html" %}#} + {% blocktrans %} + Your panels will be available again soon. + {% endblocktrans %} + {% else %} + {% blocktrans %} + Your account cannot by activated because your account exceeds plan limits. Please adjust usage of limits and then try to activate your account again. + {% endblocktrans %} +{# {% include "messages.html" %}#} + {% endif %} + + + +{% endblock %} \ No newline at end of file diff --git a/templates/plans/base.html b/templates/plans/base.html new file mode 100644 index 00000000..4facf5e1 --- /dev/null +++ b/templates/plans/base.html @@ -0,0 +1,15 @@ + + + + + {% block extra_js %} + {% endblock %} + + +

django-plans

+ {% include "plans/expiration_messages.html" %} + + {% block body %} + {% endblock %} + + diff --git a/templates/plans/billing_info_create_or_update.html b/templates/plans/billing_info_create_or_update.html new file mode 100644 index 00000000..eb32be35 --- /dev/null +++ b/templates/plans/billing_info_create_or_update.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} +{% load i18n crispy_forms_filters %} + + +{% block body %} +
+
+
+ {% block "form-content" %} + {% trans "Provide billing data" %} + {% csrf_token %} + {{ form|crispy }} + {% if object %} + {{ _("Delete") }} + {% endif %} + + {% endblock %} +
+
+
+{% endblock %} diff --git a/templates/plans/billing_info_delete.html b/templates/plans/billing_info_delete.html new file mode 100644 index 00000000..ffe91ce6 --- /dev/null +++ b/templates/plans/billing_info_delete.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block body %} +

Billing data

+ +
+ {% csrf_token %} + {% trans "Are you sure to delete billing info?" %} +

+ +

+{% endblock %} diff --git a/templates/plans/create_order.html b/templates/plans/create_order.html new file mode 100644 index 00000000..636c1273 --- /dev/null +++ b/templates/plans/create_order.html @@ -0,0 +1,77 @@ +{% extends 'base.html' %} +{% load i18n crispy_forms_filters%} + +{% block body %} +

{% trans "Confirm order" %}

+ {% if FREE_ORDER %} + {# Free order is when user downgrades a plan and there is no additional payment it is handle by special a view. #} + {% with object as order %} + {% include "plans/order_detail_table.html" %} + {% endwith %} + +
+ {% blocktrans %}If you downgrade your plan please remember that new lower limits are used immediately after + finishing the order.{% endblocktrans %} +
+ +
+ {% csrf_token %} + +
+ + {% else %} + +
+ {% with object as order %} + {% include "plans/order_detail_table.html" %} + {% endwith %} + +

{% trans "Invoice" %}

+ {% url "billing_info" as billing_info_url %} + {% with billing_info_url|add:"?next="|add:request.get_full_path as billing_info_url %} + {% if billing_info %} +

+ {% blocktrans %} + Invoice for this order will be issued for: + {% endblocktrans %} + +

+ {{ billing_info.name }}
+ {{ billing_info.street }}
+ {{ billing_info.zipcode }} + {{ billing_info.city }}, + {{ billing_info.country }} +

+ {% trans "VAT ID" %} {{ billing_info.tax_number }} +
+

+

+ {% blocktrans %} + If this data is not correct please edit billing data before + making an order. + {% endblocktrans %} +

+ {% else %} + {% block invoice-alert %} +

+ {% blocktrans %} + Invoice will not be issued. If you need an invoice please provide + billing data before making an order. + {% endblocktrans %} +

+ {% endblock %} + {% endif %} + {% endwith %} + +

+ + + + + {{ form|crispy }} + {% csrf_token %} +

+ + {% endif %} + +{% endblock %} diff --git a/templates/plans/current.html b/templates/plans/current.html new file mode 100644 index 00000000..6286dcfb --- /dev/null +++ b/templates/plans/current.html @@ -0,0 +1,43 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block body %} + + {% block account_details %} +

{% trans "Your account" %}

+ +
+
{% trans "Account" %}:
+
{{ user }}
+
{% trans "State" %}:
+
{% if userplan.active %} {% trans "active" %} {% else %} + {% trans "expired" %} {% endif %}
+
{% trans "Expire" %}:
+
{{ userplan.expire }}
+
{% trans "Plan" %}:
+
{{ userplan.plan }} {% trans "upgrade" %}
+
+ {% endblock %} + + {% block plan_details %} +

{% trans "Plan details" %}

+ + +
+
+ {% include "plans/plan_table.html" %} +
+
+ {% endblock %} + + {% block need_more %} +

{% trans "Need more?" %}

+ + {% url 'upgrade_plan' as upgrade_url %} + {% blocktrans %} + Please see other currently available plans. + {% endblocktrans %} + {% endblock %} + + +{% endblock %} diff --git a/templates/plans/expiration_messages.html b/templates/plans/expiration_messages.html new file mode 100644 index 00000000..c0f0c697 --- /dev/null +++ b/templates/plans/expiration_messages.html @@ -0,0 +1,31 @@ +{% load i18n %} + +{% block expiration_messages %} +{% if ACCOUNT_EXPIRED %} + +
+ {% blocktrans with url=EXTEND_URL %}Your account has expired. + Please extend your account.{% endblocktrans %} +
+{% else %} + + {% if ACCOUNT_NOT_ACTIVE %} +
+ {% blocktrans with url=ACTIVATE_URL %} + Your account is not active. Possibly you are over some limits. + Try to activate your account. + {% endblocktrans %} +
+ {% endif %} + + {% if EXPIRE_IN_DAYS >= 0 and EXPIRE_IN_DAYS <= 14 %} +
+ {% blocktrans with extend_url=EXTEND_URL days_to_expire=EXPIRE_IN_DAYS %} + Your account will expire soon (in {{ days_to_expire }} days). + We recommend to extend your account now. + {% endblocktrans %} +
+ {% endif %} + +{% endif %} +{% endblock %} diff --git a/templates/plans/extend.html b/templates/plans/extend.html new file mode 100644 index 00000000..867d4d38 --- /dev/null +++ b/templates/plans/extend.html @@ -0,0 +1,60 @@ +{% load i18n %} + +{% block seo_title %}user_plan{% endblock %} + +{% block extra_js %} + +{% endblock %} + +{% block body %} +
+ {% csrf_token %} + {{ form.as_p }} +
+ +{% if userplan.plan.available %} + +{% else %} + + {% url 'upgrade_plan' as upgrade_url %} + {% blocktrans %} + Unfortunately your current plan is not available any more. You need to upgrade your plan. + {% endblocktrans %} + +{% endif %} + +{% endblock %} diff --git a/templates/plans/fake_payments.html b/templates/plans/fake_payments.html new file mode 100644 index 00000000..aa906660 --- /dev/null +++ b/templates/plans/fake_payments.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block body %} + +

FakePayments™

+

Please select desired status after performing payment for an {{ object }}.

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/plans/invoices/PL_EN.html b/templates/plans/invoices/PL_EN.html new file mode 100644 index 00000000..9a3003bd --- /dev/null +++ b/templates/plans/invoices/PL_EN.html @@ -0,0 +1,5 @@ +{% extends 'base.html' %} +{% block title %}{{ invoice.full_number }}{% endblock %} +{% block body %} +{% include 'plans/invoices/layout.html' %} +{% endblock %} \ No newline at end of file diff --git a/templates/plans/invoices/invoice_base.html b/templates/plans/invoices/invoice_base.html new file mode 100644 index 00000000..172f2c16 --- /dev/null +++ b/templates/plans/invoices/invoice_base.html @@ -0,0 +1,83 @@ + + + + {% block title %}{% endblock %} + + + + {% block head %}{% endblock %} + + + +{% block body %}{% endblock %} + + \ No newline at end of file diff --git a/templates/plans/invoices/layout.html b/templates/plans/invoices/layout.html new file mode 100644 index 00000000..f17fe96a --- /dev/null +++ b/templates/plans/invoices/layout.html @@ -0,0 +1,171 @@ + {% if logo_url %} + company logo + {% endif %} + +
+

+ {{ invoice.full_number }} +

+

{% if not copy %}ORIGINAL{% else %}COPY{% endif %}

+

{{ invoice.issued|date:"Y-m-d" }}

+ {% if invoice.type != invoice.INVOICE_TYPES.PROFORMA %} +

{{ invoice.selling_date|date:"Y-m-d" }}

+ {% else %} +

 

+ {% endif %} +
+ + + + + + + + + + +
+ +

+ + {{ invoice.shipping_name }}
+ {{ invoice.shipping_street }}
+ {{ invoice.shipping_zipcode }} {{ invoice.shipping_city }}
+ {{ invoice.buyer_country.code }} - {{ invoice.buyer_country.name }} + + +
+ +

+ {{ invoice.issuer_name }}
+ {{ invoice.issuer_street }}
+ {{ invoice.issuer_zipcode }} {{ invoice.issuer_city}}
+ {{ invoice.issuer_country.code }} - {{ invoice.issuer_country.name }}

+ {{ invoice.issuer_tax_number }}
+

+ +

+ {{ invoice.buyer_name }}
+ {{ invoice.buyer_street }}
+ {{ invoice.buyer_zipcode }} {{ invoice.buyer_city }}
+ {{ invoice.buyer_country.code }} - {{ invoice.buyer_country.name }} + + {% if invoice.buyer_tax_number %} +

+ + {{ invoice.buyer_tax_number }} + +

+ {% endif %} +
+
+ + + + + + + + + + + {% if invoice.rebate %} + + + {% endif %} + + + + + + + + + + + + + + + {% if invoice.rebate %} + + {% endif %} + + + + + + + + + + + + + + + +
+ + + + Description + + + + Unit price + + + + + Qty. + + + + Rebate + + + + Subtotal + + VAT + + + VAT Amount + + + + Subtotal with TAX/VAT +
+ 1 + {{ invoice.item_description }}{{ invoice.unit_price_net|floatformat:2 }} {{ invoice.currency }}{{ invoice.quantity }}units{{ invoice.rebate|floatformat:2 }} %{{ invoice.total_net|floatformat:2 }} {{ invoice.currency }}{% if invoice.tax != None %}{{ invoice.tax|floatformat:2 }} %{% else %}n/a{% endif %}{% if invoice.tax_total != None %}{{ invoice.tax_total|floatformat:2 }} {{ invoice.currency }}{% else %}n/a{% endif %}{{ invoice.total|floatformat:2 }} {{ invoice.currency }}
{{ invoice.total_net|floatformat:2 }} {{ invoice.currency }}{% if invoice.tax != None %}{{ invoice.tax|floatformat:2 }} %{% else %}n/a{% endif %}{% if invoice.tax_total != None %}{{ invoice.tax_total|floatformat:2 }} {{ invoice.currency }}{% else %}n/a{% endif %}{{ invoice.total|floatformat:2 }} {{ invoice.currency }}
+
+ + {% if invoice.type != invoice.INVOICE_TYPES.PROFORMA %} +

+ {% endif %} + + + + + {% if invoice.type == invoice.INVOICE_TYPES.PROFORMA %} + + + {% else %} + + {% endif %} + + {{ invoice.payment_date|date:"Y-m-d" }} +

+
+ + {% if invoice.type == invoice.INVOICE_TYPES.PROFORMA %}

This document is not an invoice.

{% endif %} + + {% if invoice.tax == None and invoice.is_UE_customer %} +

+ -Reverse charge. +

+ {% endif %} + + +
diff --git a/templates/plans/order_detail.html b/templates/plans/order_detail.html new file mode 100644 index 00000000..1e7e77f9 --- /dev/null +++ b/templates/plans/order_detail.html @@ -0,0 +1,94 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block head %} + +{% endblock %} + + +{% block body %} +

{% blocktrans with object.id as order_id and object.get_status_display as order_status %}Order #{{ order_id }} + (status: {{ order_status }}){% endblocktrans %}

+ + {# You should provide displaying django messages in this template #} + + {% with object as order %} + {% include "plans/order_detail_table.html" %} + {% endwith %} + + {% if object.get_all_invoices.count %} +

{% trans "Printable documents" %}

+ + {% endif %} + + + +

{% trans "Payment" %}

+ {% if object.completed %} + +

+ {% blocktrans with object.completed as completed %} + Payment completed on: {{ completed }} + {% endblocktrans %} +

+ {% else %} + + {% if object.is_ready_for_payment %} + {% block payment_method %} + +

+ Here should go bindings to your payment. We recommend using django-getpaid for payment processing. + Use a fake payment below to simulate paying for an order: +

+ + Pay using + FakePayments™ ;) + + {# An example code snippet for accepting payments using django-getpaid #} + + {#
#} + {# {% csrf_token %}#} + {# #} + {#

#} + {#

#} + {#
#} + + {% endblock %} + {% else %} + +

+ {% blocktrans %} + This order is expired. It will accept an incoming payment made earlier, but new payment cannot be + initialized. Please make a new order if necessary. + {% endblocktrans %} +

+ + {% endif %} + + {% endif %} + + {% if object.status == object.STATUS.NOT_VALID %} +

+ {% blocktrans %} + This order could not be processed as it is not valid. Please contact with customer service. + {% endblocktrans %} +

+ {% endif %} + +{% endblock %} \ No newline at end of file diff --git a/templates/plans/order_detail_table.html b/templates/plans/order_detail_table.html new file mode 100644 index 00000000..61f64ce0 --- /dev/null +++ b/templates/plans/order_detail_table.html @@ -0,0 +1,40 @@ +{% load i18n %} + +{% block table %} +
+ + + + + + + + + + {% if order.user %} + + + {% endif %} + + + + + + + + + + + + + + +
{% trans "Name" %}{% trans "Net price" %}{% trans "VAT" %}{% trans "VAT total" %}{% trans "Total" %}{% trans "Order completed" %}{% trans "Plan valid from" %}{% trans "Plan valid until" %}
{{ order.name }}{{ order.amount }} {{ order.currency }}{% if order.tax == None %}n/a{% else %}{{ order.tax }} %{% endif %}{% if order.tax_total == None %}n/a{% else %}{{ order.tax_total }} {{ order.currency }}{% endif %}{{ order.total }} {{ order.currency }}{{ order.completed|date|default:"-" }}{{ order.get_plan_extended_from|date|default:"-" }}{{ order.get_plan_extended_until|date|default:"-" }}
+
+{% endblock %} +{% if order.tax == None %} +

{% trans "EU VAT" %}

+
+ {% blocktrans %} VAT is not applied to order. {% endblocktrans %} +
+{% endif %} diff --git a/templates/plans/order_list.html b/templates/plans/order_list.html new file mode 100644 index 00000000..90a81c3b --- /dev/null +++ b/templates/plans/order_list.html @@ -0,0 +1,55 @@ +{% extends 'base.html' %} +{% load i18n %} + + +{% block body %} + {% block order_header %} +

{% trans "List of orders" %}

+ {% endblock %} + + {% if object_list %} + {% block pagination_first %} + {% include "plans/pagination.html" %} + {% endblock %} + + {% block order_table %} +
+ + + + + + + + + + + + + + + {% for order in object_list %} + + + + + + + + + + + {% endfor %} + +
ID{% trans 'Name' %}{% trans 'Created' context 'order created' %}{% trans 'Status' context 'order status' %}{% trans 'Completed' context 'order completed' %}{% trans 'Total' context 'total amount, value' %}{% trans 'Plan valid from' %}{% trans 'Plan valid until' %}
{{ order.pk }}{{ order.name }}{{ order.created|date }}{{ order.get_status_display }}{{ order.completed|date|default:"-" }}{{ order.total }} {{ CURRENCY }}{{ order.plan_extended_from|date|default:"-" }}{{ order.plan_extended_until|date|default:"-" }}
+
+ {% endblock %} + + {% block pagination_second %} + {% include "plans/pagination.html" %} + {% endblock %} + + {% else %} + {% blocktrans %}You do not have any orders so far.{% endblocktrans %} + {% endif %} +{% endblock %} diff --git a/templates/plans/pagination.html b/templates/plans/pagination.html new file mode 100644 index 00000000..0388649a --- /dev/null +++ b/templates/plans/pagination.html @@ -0,0 +1,22 @@ +{% load i18n %} +{% if is_paginated %} + +{% endif %} diff --git a/templates/plans/plan_table.html b/templates/plans/plan_table.html new file mode 100644 index 00000000..d6603577 --- /dev/null +++ b/templates/plans/plan_table.html @@ -0,0 +1,127 @@ +{% load i18n %} +
+ + + + + {% for plan in plan_list %} + + {% endfor %} + + + + + {% for quota_row in plan_table %} + + + + + {% for plan_quota in quota_row.1 %} + + + {% endfor %} + + + {% endfor %} + + + + + + + + {% if user.is_authenticated %} + + + + {% for plan in plan_list %} + + {% endfor %} + + + {% endif %} + + + + {% for plan in plan_list %} + + {% endfor %} + + + +
+ {% if plan.url %}{% endif %} + {{ plan.name }} + + {% if plan == userplan.plan %} + {% trans "your current plan" %} + {% endif %} + {% if plan.url %}{% endif %} +
+ {% if quota_row.0.url %}{% endif %} + {{ quota_row.0.name }} + {{ quota_row.0.description }} + {% if quota_row.0.url %}{% endif %} + + {% if plan_quota != None %} + {% if quota_row.0.is_boolean %} + {% if plan_quota.value %} + {% else %} - {% endif %} + {% else %} + {% if plan_quota.value == None %}{% trans 'no limit' %}{% else %}{{ plan_quota.value }} {{ quota_row.0.unit }}{% endif %} + {% endif %} + {% endif %} +
{% trans 'Pricing' %}
+ {% if plan != userplan.plan and not userplan.is_expired and not userplan.plan.is_free %} + {% trans "Change" %}{% endif %} +
+ {% if plan.available %} + + + {% else %} + + {% url 'upgrade_plan' as upgrade_url %} + {% blocktrans %} + This plan is not available anymore and cannot be extended.

+ You need to upgrade your account to any of currently available plans. + {% endblocktrans %} + + + {% endif %} +

+
+

+ {% trans "Net prices" %} + +

diff --git a/templates/plans/pricing.html b/templates/plans/pricing.html new file mode 100644 index 00000000..b66a22fc --- /dev/null +++ b/templates/plans/pricing.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block body %} +

{% trans "See our great value plans" %}

+ {% include "plans/plan_table.html" %} +{% endblock %} diff --git a/templates/plans/upgrade.html b/templates/plans/upgrade.html new file mode 100644 index 00000000..12c2eb7b --- /dev/null +++ b/templates/plans/upgrade.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block body %} +

{% trans "Choose plan" %}

+ {% include "plans/plan_table.html" %} +{% endblock %}