This commit is contained in:
gitea 2025-01-26 15:11:30 +00:00
commit 149c68cfae
36 changed files with 1012 additions and 4 deletions

View File

@ -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)

Binary file not shown.

View File

@ -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'<div class="{wrapper_class}">{field}</div>')
return field
class LocalizedNameMixin:
"""

View File

@ -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 %}

View File

@ -0,0 +1 @@
{% load i18n %}{% blocktrans with user=user plan=plan.name %}Your account {{ user }} has new plan {{ plan }}{% endblocktrans %}

View File

@ -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 %}

View File

@ -0,0 +1 @@
{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %}

View File

@ -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 %}

View File

@ -0,0 +1 @@
{% load i18n %}{% blocktrans with user=user days=pricing.period %}Your account {{ user }} has been extended by {{ days }} days{% endblocktrans %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -0,0 +1,22 @@
{% extends "base.html" %}
{% load i18n %}
{% block body %}
<h1>{% if SUCCESSFUL %}{% trans "Activation successful" %}{% else %}{% trans "Activation failed" %}{% endif %}</h1>
{% 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 %}

15
templates/plans/base.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
{% block extra_js %}
{% endblock %}
</head>
<body>
<h1>django-plans</h1>
{% include "plans/expiration_messages.html" %}
{% block body %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,23 @@
{% extends 'base.html' %}
{% load i18n crispy_forms_filters %}
{% block body %}
<div class="row">
<div class="col-sm-6">
<form action="{% block "action_url" %}{% url 'billing_info' %}{% endblock %}{% if request.GET.next %}?next={{ request.GET.next }}{% endif %}" method="post" class="form">
{% block "form-content" %}
<legend>{% trans "Provide billing data" %}</legend>
{% csrf_token %}
{{ form|crispy }}
{% if object %}
<a class="btn btn-sm btn-phoenix-danger" href="{% url 'billing_info_delete' %}">{{ _("Delete") }}</a>
{% endif %}
<button type="submit" class="btn btn-sm btn-phoenix-primary">
{{ _("Save") }}
</button>
{% endblock %}
</form>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
<h1>Billing data</h1>
<form method="post" action="{% url 'billing_info_delete' %}">
{% csrf_token %}
{% trans "Are you sure to delete billing info?" %}
<p>
<button type="submit" class="btn btn-danger">
<span class="glyphicon glyphicon-trash"></span> Confirm delete
</button>
</form>
{% endblock %}

View File

@ -0,0 +1,77 @@
{% extends 'base.html' %}
{% load i18n crispy_forms_filters%}
{% block body %}
<h3>{% trans "Confirm order" %}</h3>
{% 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 %}
<div class="alert alert-warning">
{% blocktrans %}If you downgrade your plan please remember that new lower limits are used immediately after
finishing the order.{% endblocktrans %}
</div>
<form method="post" action="{% url "change_plan" pk=plan.pk %}">
{% csrf_token %}
<input type="submit" class="btn btn-phoenix-primary" value="{% trans "Continue" %}">
</form>
{% else %}
<form method="post">
{% with object as order %}
{% include "plans/order_detail_table.html" %}
{% endwith %}
<h2>{% trans "Invoice" %}</h2>
{% 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 %}
<p class="alert alert-phoenix-info">
{% blocktrans %}
Invoice for this order will be issued for:
{% endblocktrans %}
<br><br><b>
{{ billing_info.name }}<br>
{{ billing_info.street }}<br>
{{ billing_info.zipcode }}
{{ billing_info.city }},
{{ billing_info.country }}
<br><br>
{% trans "VAT ID" %} {{ billing_info.tax_number }}
</b>
</p>
<p>
{% blocktrans %}
If this data is not correct please <a href="{{ billing_info_url }}">edit billing data</a> before
making an order.
{% endblocktrans %}
</p>
{% else %}
{% block invoice-alert %}
<p class="alert alert-info">
{% blocktrans %}
Invoice will <b>not</b> be issued. If you need an invoice please provide
<a href="{{ billing_info_url }}">billing data</a> before making an order.
{% endblocktrans %}
</p>
{% endblock %}
{% endif %}
{% endwith %}
<p>
<input type="submit" class="btn btn-primary" value="{% trans "Continue" %}">
{{ form|crispy }}
{% csrf_token %}
</form>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,61 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
<!-- Account Details Section -->
<div class="row my-3">
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header">
<h5 class="mb-0">{% trans "Your Account" %}</h5>
</div>
<div class="card-body">
<div class="row mb-0">
<div class="col-sm-2">{% trans "Account" %}:</div>
<div class="col-sm-10">{{ user.dealer.get_local_name }}</div>
<div class="col-sm-2">{% trans "State" %}:</div>
<div class="col-sm-10">
{% if userplan.active %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Active" %}</span>
{% else %}
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Expired" %}</span>
{% endif %}
</div>
<div class="col-sm-2">{% trans "Expire" %}:</div>
<div class="col-sm-10">{{ userplan.expire }}</div>
<div class="col-sm-2">{% trans "Plan" %}:</div>
<div class="col-sm-10">
{{ userplan.plan }}
<a href="{% url 'upgrade_plan' %}" class="btn btn-sm btn-phoenix-primary ml-2">{% trans "Upgrade" %}</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Plan Details Section -->
<div class="row">
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header">
<h5 class="mb-0">{% trans "Plan Details" %}</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-8">
{% include "plans/plan_table.html" %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,31 @@
{% load i18n %}
{% block expiration_messages %}
{% if ACCOUNT_EXPIRED %}
<div class="alert alert-phoenix-danger">
{% blocktrans with url=EXTEND_URL %}Your account has expired.
Please <a href="{{ url }}">extend your account</a>.{% endblocktrans %}
</div>
{% else %}
{% if ACCOUNT_NOT_ACTIVE %}
<div class="alert alert-phoenix-danger">
{% blocktrans with url=ACTIVATE_URL %}
Your account is not active. Possibly you are over some limits.
Try to <a href="{{ url }}">activate your account</a>.
{% endblocktrans %}
</div>
{% endif %}
{% if EXPIRE_IN_DAYS >= 0 and EXPIRE_IN_DAYS <= 14 %}
<div class="alert alert-phoenix-warning">
{% 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 <a href="{{ extend_url }}">extend your account now.</a>
{% endblocktrans %}
</div>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,60 @@
{% load i18n %}
{% block seo_title %}user_plan{% endblock %}
{% block extra_js %}
<script>
$(function(){
$('.pricing').click(function(){
$('#pricing_form input#id_plan_pricing').val($(this).attr('pricing_pk'));
$('#pricing_form').submit();
});
});
</script>
{% endblock %}
{% block body %}
<form method="post" action="{% url 'order_plan' %}" id="pricing_form">
{% csrf_token %}
{{ form.as_p }}
</form>
{% if userplan.plan.available %}
<ul>
<li>{% trans "Plan" %}: {{ userplan.plan.name }}
<li>{% trans "Quotas" %}:
<ul>
{% for quota in quotas %}
<li> {{ quota.quota.name }} ({{ quota.quota.description }}) -
{% if quota.quota.is_boolean %}
{% if quota.value %} {% trans "yes" %} {% else %} {% trans "no" %} {% endif %}
{% else %}
{{ quota.value }} {{ quota.quota.unit }}
{% endif %}
{% endfor %}
</ul>
<li>{% trans "Pricings" %}:
<ul>
{% for pricing in pricings %}
<li>
<a class="pricing" href="#" pricing_pk="{{ pricing.pk }}"> {{ pricing.pricing.name }} ({{ pricing.pricing.period }} {% trans "days" %} ):
{{ pricing.price}}
</a>
{% endfor %}
</ul>
</li>
</ul>
{% else %}
{% url 'upgrade_plan' as upgrade_url %}
{% blocktrans %}
Unfortunately your current plan is not available any more. You need to <a href="{{ upgrade_url }}">upgrade your plan</a>.
{% endblocktrans %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load i18n %}
{% block body %}
<h1>FakePayments™</h1>
<p> Please select desired status after performing payment for an <strong>{{ object }}</strong>. </p>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">
Pay now
</button>
</form>
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block title %}{{ invoice.full_number }}{% endblock %}
{% block body %}
{% include 'plans/invoices/layout.html' %}
{% endblock %}

View File

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
html, body{
font-size: 12px;
font-family: Helvetica;
}
span.en {
font-size: 10px;
color:gray;
}
span.pl {
font-size: 14px;
color: black;
}
table {
border-collapse: collapse;
}
table td, table th {
border: 1px solid black;
padding: 1em;
}
table thead{
text-align: center;
}
#shipping{
text-align: right;
}
table#items thead {
background-color: #EEE;
}
table#items tfoot td{
text-align: right;
font-weight: bold;
font-size: 14px;
}
table td.number{
text-align: right;
}
table td.center{
text-align: center;
}
strong{
font-size: 14px;
}
#full_number , span.invoice_header{
font-size: 26px;
font-weight: bold;
}
label{
display: inline-block;
position: relative;
margin-bottom: .5em;
}
label span.pl {
display: block;
}
label span.en{
position: absolute;
right: .5em;
}
</style>
{% block head %}{% endblock %}
</head>
<body style="width: 960px; margin: 0 auto;" {% if auto_print %}onload="window.print();"{% endif %}>
{% block body %}{% endblock %}
</body>
</html>

View File

@ -0,0 +1,171 @@
{% if logo_url %}
<img src="{{ logo_url }}" alt="company logo">
{% endif %}
<div style="float:right; text-align: right;">
<h1>
<label><span class="en">{% if invoice.type == invoice.INVOICE_TYPES.INVOICE %}Invoice ID{% endif %}{% if invoice.type == invoice.INVOICE_TYPES.PROFORMA %}Order confirmation ID{% endif %}{% if invoice.type == invoice.INVOICE_TYPES.DUPLICATE %}Invoice (duplicate) ID{% endif %}</span></label> <span id="full_number">{{ invoice.full_number }}</span>
</h1>
<h2>{% if not copy %}ORIGINAL{% else %}COPY{% endif %}</h2>
<p> <label> <span class="en">Issued</span></label> {{ invoice.issued|date:"Y-m-d" }}</p>
{% if invoice.type != invoice.INVOICE_TYPES.PROFORMA %}
<p> <label> <span class="en">Date of order</span></label> {{ invoice.selling_date|date:"Y-m-d" }}</p>
{% else %}
<p>&nbsp;</p>
{% endif %}
</div>
<table style="width: 100%; margin-bottom: 40px; font-size: 12px;" >
<tr>
<td style="width: 50%;">
</td>
<td style="width: 50%; padding-right: 4em; font-weight: bold; font-size: 15px;" id="shipping">
<strong> <label><span class="en">Shipping address</span></label></strong><br><br>
{{ invoice.shipping_name }}<br>
{{ invoice.shipping_street }}<br>
{{ invoice.shipping_zipcode }} {{ invoice.shipping_city }}<br>
{{ invoice.buyer_country.code }} - {{ invoice.buyer_country.name }}
</td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top;">
<strong> <label><span class="en">Seller</span></label></strong><br><br>
{{ invoice.issuer_name }}<br>
{{ invoice.issuer_street }}<br>
{{ invoice.issuer_zipcode }} {{ invoice.issuer_city}}<br>
{{ invoice.issuer_country.code }} - {{ invoice.issuer_country.name }}<p>
<label><span class="en">VAT ID</span></label> {{ invoice.issuer_tax_number }}<br>
</td>
<td style="width: 50%; vertical-align: top;">
<strong> <label> <span class="en">Buyer</span></label></strong><br><br>
{{ invoice.buyer_name }}<br>
{{ invoice.buyer_street }}<br>
{{ invoice.buyer_zipcode }} {{ invoice.buyer_city }}<br>
{{ invoice.buyer_country.code }} - {{ invoice.buyer_country.name }}
{% if invoice.buyer_tax_number %}
<p>
<label><span class="en">VAT ID</span></label> {{ invoice.buyer_tax_number }}
</p>
{% endif %}
<br>
</td>
</tr>
</table>
<table style="margin-bottom: 40px; width: 100%;" id="items">
<thead>
<tr>
<td>
</td>
<td>
<span class="en">Description</span>
</td>
<td>
<span class="en">Unit&nbsp;price</span>
</td>
<td>
<span class="en">Qty.</span>
</td>
<td>
</td>
{% if invoice.rebate %}
<td>
<span class="en">Rebate</span>
</td>
{% endif %}
<td>
<span class="en">Subtotal</span>
</td>
<td style="width: 3%;">
<span class="en">VAT</span>
</td>
<td>
<span class="en">VAT&nbsp;Amount</span>
</td>
<td style="width: 8%;">
<span class="en">Subtotal&nbsp;with&nbsp;TAX/VAT</span>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td class="center">{{ invoice.item_description }}</td>
<td class="number">{{ invoice.unit_price_net|floatformat:2 }}&nbsp;{{ invoice.currency }}</td>
<td class="center">{{ invoice.quantity }}</td>
<td class="center"><span class="en">units</span></td>
{% if invoice.rebate %}
<td class="number">{{ invoice.rebate|floatformat:2 }}&nbsp;%</td>
{% endif %}
<td class="number">{{ invoice.total_net|floatformat:2 }}&nbsp;{{ invoice.currency }}</td>
<td class="number">{% if invoice.tax != None %}{{ invoice.tax|floatformat:2 }}&nbsp;%{% else %}<span class="en">n/a</span>{% endif %}</td>
<td class="number">{% if invoice.tax_total != None %}{{ invoice.tax_total|floatformat:2 }}&nbsp;{{ invoice.currency }}{% else %}<span class="en">n/a</span>{% endif %}</td>
<td class="number">{{ invoice.total|floatformat:2 }}&nbsp;{{ invoice.currency }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="{% if invoice.rebate %}6{% else %}5{% endif %}" style="background-color: #EEE;"><label><span class="en">Total</span></label> </td>
<td>{{ invoice.total_net|floatformat:2 }}&nbsp;{{ invoice.currency }}</td>
<td>{% if invoice.tax != None %}{{ invoice.tax|floatformat:2 }}&nbsp;%{% else %}<span class="en">n/a</span>{% endif %}</td>
<td>{% if invoice.tax_total != None %}{{ invoice.tax_total|floatformat:2 }}&nbsp;{{ invoice.currency }}{% else %}<span class="en">n/a</span>{% endif %}</td>
<td>{{ invoice.total|floatformat:2 }}&nbsp;{{ invoice.currency }}</td>
</tr>
</tfoot>
</table>
<div style="width: 100%;">
{% if invoice.type != invoice.INVOICE_TYPES.PROFORMA %}
<strong><label><span class="en">Payment</span></label></strong> <label> <span class="en">electronic payment</span></label><br><br>
{% endif %}
<strong><label><span class="en">Payment till</span></label></strong>
{% if invoice.type == invoice.INVOICE_TYPES.PROFORMA %}
{% else %}
<label> <span class="en"> paid</span></label>
{% endif %}
{{ invoice.payment_date|date:"Y-m-d" }}
<br><br>
<hr>
{% if invoice.type == invoice.INVOICE_TYPES.PROFORMA %}<p><span class="en">This document <strong>is not</strong> an invoice.</span></p> {% endif %}
{% if invoice.tax == None and invoice.is_UE_customer %}
<p>
<span class="en">-Reverse charge.</span>
</p>
{% endif %}
</div>

View File

@ -0,0 +1,94 @@
{% extends "base.html" %}
{% load i18n %}
{% block head %}
<script>
$(function () {
$('a.invoice').click(function () {
event.preventDefault();
window.open($(this).attr('href'), 'plans_invoice_{{ invoice.id }}', 'width=860,resizable=1,location=0,status=0,titlebar=1');
});
});
</script>
{% endblock %}
{% block body %}
<h1>{% blocktrans with object.id as order_id and object.get_status_display as order_status %}Order #{{ order_id }}
(status: {{ order_status }}){% endblocktrans %}</h1>
{# 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 %}
<h2>{% trans "Printable documents" %}</h2>
<ul id="order_printable_documents">
{% for invoice in object.get_all_invoices %}
<li><a href="{{ invoice.get_absolute_url }}"
class="invoice">{{ invoice.get_type_display }} {{ invoice }}</a>
{% endfor %}
</ul>
{% endif %}
<h2>{% trans "Payment" %}</h2>
{% if object.completed %}
<p class="alert alert-phoenix-success">
{% blocktrans with object.completed as completed %}
Payment completed on: {{ completed }}
{% endblocktrans %}
</p>
{% else %}
{% if object.is_ready_for_payment %}
{% block payment_method %}
<p>
Here should go bindings to your payment. We recommend using <a
href="https://github.com/cypreess/django-getpaid">django-getpaid</a> for payment processing.
Use a fake payment below to simulate paying for an order:
</p>
<a class="btn btn-success" role="button" href="{% url "fake_payments" pk=object.id %}">Pay using
FakePayments™ ;)</a>
{# An example code snippet for accepting payments using django-getpaid #}
{# <form action="{% url "getpaid-new-payment" currency=object.currency %}" method="post"#}
{# class="standard_form payment_form">#}
{# {% csrf_token %}#}
{# <ul>{{ payment_form.as_ul }}</ul>#}
{# <p><label>&nbsp;</label><input type="submit" value="{% trans "Pay the order" %}" class="submit_button">#}
{# </p>#}
{# </form>#}
{% endblock %}
{% else %}
<p class="alert alert-phoenix-warning">
{% 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 %}
</p>
{% endif %}
{% endif %}
{% if object.status == object.STATUS.NOT_VALID %}
<p class="alert alert-phoenix-danger">
{% blocktrans %}
This order could not be processed as it is not valid. Please contact with customer service.
{% endblocktrans %}
</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,40 @@
{% load i18n %}
{% block table %}
<div class="table-responsive px-1 scrollbar">
<table class="table fs-9 mb-0 border-top border-translucent">
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Net price" %}</th>
<th>{% trans "VAT" %}</th>
<th>{% trans "VAT total" %}</th>
<th>{% trans "Total" %}</th>
<th>{% trans "Order completed" %}</th>
{% if order.user %}
<th>{% trans "Plan valid from" %}</th>
<th>{% trans "Plan valid until" %}</th>
{% endif %}
</tr>
</thead>
<tbody>
<tr>
<td>{{ order.name }}</td>
<td>{{ order.amount }} {{ order.currency }}</td>
<td>{% if order.tax == None %}n/a{% else %}{{ order.tax }} %{% endif %}</td>
<td>{% if order.tax_total == None %}n/a{% else %}{{ order.tax_total }} {{ order.currency }}{% endif %}</td>
<td class="number total">{{ order.total }} {{ order.currency }}</td>
<td class="date">{{ order.completed|date|default:"-" }}</td>
<td class="date">{{ order.get_plan_extended_from|date|default:"-" }}</td>
<td class="date">{{ order.get_plan_extended_until|date|default:"-" }}</td>
</tr>
</tbody>
</table>
</div>
{% endblock %}
{% if order.tax == None %}
<h2>{% trans "EU VAT" %}</h2>
<div class="alert alert-phoenix-info">
{% blocktrans %} VAT is not applied to order. {% endblocktrans %}
</div>
{% endif %}

View File

@ -0,0 +1,55 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
{% block order_header %}
<h1>{% trans "List of orders" %}</h1>
{% endblock %}
{% if object_list %}
{% block pagination_first %}
{% include "plans/pagination.html" %}
{% endblock %}
{% block order_table %}
<div class="table-responsive">
<table class="table fs-9 mb-0 border-top border-translucent">
<thead>
<tr>
<th>ID</th>
<th>{% trans 'Name' %}</th>
<th>{% trans 'Created' context 'order created' %}</th>
<th>{% trans 'Status' context 'order status' %}</th>
<th>{% trans 'Completed' context 'order completed' %}</th>
<th>{% trans 'Total' context 'total amount, value' %}</th>
<th>{% trans 'Plan valid from' %}</th>
<th>{% trans 'Plan valid until' %}</th>
</tr>
</thead>
<tbody>
{% for order in object_list %}
<tr class="{% if order.status == 2 %}success{% elif order.status == 3 %}danger{% elif order.status == 4 %}warning{% elif order.status == 5 %}info{% endif %}">
<td><a href="{{ order.get_absolute_url }}">{{ order.pk }}</a></td>
<td><a href="{{ order.get_absolute_url }}">{{ order.name }}</a></td>
<td class="date">{{ order.created|date }}</td>
<td class="status">{{ order.get_status_display }}</td>
<td class="date">{{ order.completed|date|default:"-" }}</td>
<td class="number">{{ order.total }}&nbsp;{{ CURRENCY }}</td>
<td class="date">{{ order.plan_extended_from|date|default:"-" }}</td>
<td class="date">{{ order.plan_extended_until|date|default:"-" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
{% block pagination_second %}
{% include "plans/pagination.html" %}
{% endblock %}
{% else %}
{% blocktrans %}You do not have any orders so far.{% endblocktrans %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,22 @@
{% load i18n %}
{% if is_paginated %}
<ul class="pagination">
{% if page_obj.has_previous %}
<li><a class="pagination__prev" href="?page={{ page_obj.previous_page_number }}&query={{ query }}">&laquo;</a></li>
{% else %}
<li class="disabled"><span>&laquo;</span></li>
{% endif %}
{% for page in page_obj.paginator.page_range %}
<li {% if page == page_obj.number %}class="active"{% endif %}>
<a href="?page={{ page }}&query={{ query }}">{{ page }}</a></li>
{% endfor %}
{% if page_obj.has_next %}
<li><a class="pagination__next" href="?page={{ page_obj.next_page_number }}&query={{ query }}">&raquo;</a></li>
{% else %}
<li class="disabled"><span>&raquo;</span></li>
{% endif %}
</ul>
{% endif %}

View File

@ -0,0 +1,112 @@
{% load i18n %}
<div class="table-responsive mt-4">
<table class="plan_table table border-top border-translucent fs-9 mb-4">
<thead class="">
<tr>
<th scope="col"></th>
{% for plan in plan_list %}
<th scope="col" class="plan_header text-center {% if forloop.counter0 == current_userplan_index %}current bg-body-highlight{% endif %}">
{% if plan.url %}<a href="{{ plan.url }}" class="info_link plan text-decoration-none">{% endif %}
<span class="plan_name font-weight-bold">{{ plan.name }}</span>
{% if plan == userplan.plan %}
<span class="current current_plan badge badge-phoenix badge-phoenix-success">{% trans "Current Plan" %}</span>
{% endif %}
{% if plan.url %}</a>{% endif %}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for quota_row in plan_table %}
<tr class="quota_row">
<th scope="row" class="quota_header align-middle">
{% if quota_row.0.url %}<a href="{{ quota_row.0.url }}" class="info_link quota text-decoration-none">{% endif %}
<span class="quota_name fw-bold">{{ quota_row.0.name }}</span>
<small class="quota_description d-block text-muted">{{ quota_row.0.description }}</small>
{% if quota_row.0.url %}</a>{% endif %}
</th>
{% for plan_quota in quota_row.1 %}
<td class="align-middle text-center {% if forloop.counter0 == current_userplan_index %}current bg-body-highlight{% endif %}">
{% if plan_quota != None %}
{% if quota_row.0.is_boolean %}
{% if plan_quota.value %}<i class="fas fa-check text-success"></i>{% else %}<i class="fas fa-times text-danger"></i>{% endif %}
{% else %}
{% if plan_quota.value == None %}{% trans 'No Limit' %}{% else %}{{ plan_quota.value }} {{ quota_row.0.unit }}{% endif %}
{% endif %}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
<tfoot class="">
<tr>
<th scope="col"></th>
<th colspan="{{ plan_list|length }}" class="text-center font-weight-bold py-3">{% trans 'Pricing' %}</th>
</tr>
{% if user.is_authenticated %}
<tr>
<th scope="col"></th>
{% for plan in plan_list %}
<th class="planpricing_footer text-center {% if forloop.counter0 == current_userplan_index %}current bg-body-highlight{% endif %}">
{% if plan != userplan.plan and not userplan.is_expired and not userplan.plan.is_free %}
<a href="{% url 'create_order_plan_change' pk=plan.id %}" class="change_plan btn btn-sm btn-outline-primary">{% trans "Change" %}</a>
{% endif %}
</th>
{% endfor %}
</tr>
{% endif %}
<tr>
<th scope="col"></th>
{% for plan in plan_list %}
<th class="planpricing_footer text-center {% if forloop.counter0 == current_userplan_index %}current bg-body-highlight{% endif %}">
{% if plan.available %}
<ul class="list-unstyled">
{% if not plan.is_free %}
{% for plan_pricing in plan.planpricing_set.all %}
{% if plan_pricing.visible %}
<li class="mb-2">
{% if plan_pricing.pricing.url %}<a href="{{ plan_pricing.pricing.url }}" class="info_link pricing text-decoration-none">{% endif %}
<span class="plan_pricing_name font-weight-bold">{{ plan_pricing.pricing.name }}</span>
<small class="plan_pricing_period d-block text-muted">({{ plan_pricing.pricing.period }} {% trans "days" %})</small>
{% if plan_pricing.pricing.url %}</a>{% endif %}
<span class="plan_pricing_price d-block font-weight-bold">{{ plan_pricing.price }}&nbsp;{{ CURRENCY }}</span>
{% if plan_pricing.plan == userplan.plan or userplan.is_expired or userplan.plan.is_free %}
<a href="{% url 'create_order_plan' pk=plan_pricing.pk %}" class="buy btn btn-sm btn-phoenix-success">{% trans "Buy" %}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% else %}
<li class="mb-2">
<span class="plan_pricing_name font-weight-bold">{% trans "Free" %}</span>
<small class="plan_pricing_period d-block text-muted">({% trans "no expiry" %})</small>
<span class="plan_pricing_price d-block font-weight-bold">0&nbsp;{{ CURRENCY }}</span>
{% if plan != userplan.plan or userplan.is_expired %}
<a href="{% url 'create_order_plan_change' pk=plan.id %}" class="change_plan btn btn-sm btn-phoenix-primary">
{% if userplan.is_expired %}
{% trans "Select" %}
{% else %}
{% trans "Change" %}
{% endif %}
</a>
{% endif %}
</li>
{% endif %}
</ul>
{% else %}
<span class="plan_not_available text-muted">
{% url 'upgrade_plan' as upgrade_url %}
{% blocktrans %}
This plan is not available anymore and cannot be extended.<br>
You need to upgrade your account to any of <a href="{{ upgrade_url }}" class="text-primary">currently available plans</a>.
{% endblocktrans %}
</span>
{% endif %}
</th>
{% endfor %}
</tr>
</tfoot>
</table>
</div>
<p class="text-right fs-9 text-muted mt-3">* {% trans "Net prices" %}</p>

View File

@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
<h3>{% trans "See our great value plans" %}</h3>
{% include "plans/plan_table.html" %}
{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% load i18n %}
{% block body %}
<h2>{% trans "Choose plan" %}</h2>
{% include "plans/plan_table.html" %}
{% endblock %}

View File

@ -4,7 +4,7 @@
{% block content %}
<div class="row">
<h2 class="mb-7">Pricing</h2>
<h2 class="mb-7">{{ _('Pricing') }}</h2>
<div class="row">
<div class="col-xl-12 col-xxl-9 mb-1">
<div class="tabs mb-7">