From 1189418511b116d488d603771ce83216d616b396 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 7 Aug 2025 14:34:07 +0300 Subject: [PATCH] email internationalization and dealer plan active condition --- inventory/models.py | 2 +- inventory/views.py | 13 +- templates/403.html | 300 +++++++++++------- templates/dealers/dealer_detail.html | 10 +- templates/emails/expiration_reminder_ar.html | 2 +- templates/emails/expiration_reminder_ar.txt | 2 +- templates/emails/expiration_reminder_en.html | 2 +- templates/emails/expiration_reminder_en.txt | 2 +- templates/emails/invoice_past_due.txt | 2 +- .../emails/invoice_past_due_reminder.txt | 2 +- templates/emails/schedule_reminder.html | 20 +- templates/emails/schedule_reminder.txt | 22 +- templates/footer.html | 74 ++++- templates/ledger/reports/car_sale_report.html | 2 +- templates/mail/change_plan_body.txt | 2 +- templates/mail/expired_account_body.txt | 2 +- templates/mail/expired_account_title.txt | 4 +- templates/mail/extend_account_body.txt | 2 +- templates/mail/invoice_created_body.txt | 2 +- templates/mail/remind_expire_body.txt | 7 +- templates/staff/staff_detail.html | 13 +- 21 files changed, 313 insertions(+), 174 deletions(-) diff --git a/inventory/models.py b/inventory/models.py index a5af10d4..367861e5 100644 --- a/inventory/models.py +++ b/inventory/models.py @@ -3079,7 +3079,7 @@ class CustomGroup(models.Model): "view_saleorder", "view_leads", "view_opportunity", - "view_customers", + "view_customer", ], ) self.set_permissions( diff --git a/inventory/views.py b/inventory/views.py index 5988b394..8a1a3dd1 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -9477,10 +9477,15 @@ def ledger_unpost_all_journals(request, dealer_slug, entity_slug, pk): @login_required @permission_required("inventory.change_dealer", raise_exception=True) def pricing_page(request, dealer_slug): - get_object_or_404(models.Dealer, slug=dealer_slug) - plan_list = PlanPricing.objects.all() - form = forms.PaymentPlanForm() - return render(request, "pricing_page.html", {"plan_list": plan_list, "form": form}) + dealer=get_object_or_404(models.Dealer, slug=dealer_slug) + if not dealer.active_plan: + plan_list = PlanPricing.objects.all() + form = forms.PaymentPlanForm() + return render(request, "pricing_page.html", {"plan_list": plan_list, "form": form}) + else: + messages.info(request,_("You already have an plan!!")) + return redirect('home',dealer_slug=dealer_slug) + @login_required diff --git a/templates/403.html b/templates/403.html index b1d559c8..0f572060 100644 --- a/templates/403.html +++ b/templates/403.html @@ -1,123 +1,177 @@ -{% load static i18n %} - - - - - Access Forbidden - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
- -
-
- -

Access Forbidden!

-

- Halt! Thou art endeavouring to trespass upon a realm not granted unto thee. -
- granted unto thee. -

- Go Home -
-
-
-
-
-
- - - - - - - - - - - - - - +{% load i18n %} + + + + + + 403 - Access Forbidden + + + + + +
+ +
+

403

+

{% trans "Access Forbidden" %}

+

{% trans "You do not have permission to view this page."%}

+

{% trans "Powered By Tenhal, Riyadh Saudi Arabia"%}

+ {% trans "Go Home" %} +
+ + + + + + \ No newline at end of file diff --git a/templates/dealers/dealer_detail.html b/templates/dealers/dealer_detail.html index 45a078b9..e7c504ba 100644 --- a/templates/dealers/dealer_detail.html +++ b/templates/dealers/dealer_detail.html @@ -61,7 +61,7 @@
-
{% trans 'last login'|capfirst %}
+
{% trans 'last login'|capfirst %}

{{ dealer.user.last_login|date:"D M d, Y H:i" }}

@@ -80,12 +80,12 @@
-

{% trans 'Default Address' %}

+

{% trans 'Contact Information' %}

-
{% trans 'Address' %}
+
{% trans 'Address' %}
  • {{ dealer.address }}

    @@ -95,13 +95,13 @@
    -
    {% trans 'Email' %}
    +
    {% trans 'Email' %}
  • {{ dealer.user.email }}
    -
    {% trans 'Phone' %}
    +
    {% trans 'Phone' %}
  • {{ dealer.phone_number }}
    diff --git a/templates/emails/expiration_reminder_ar.html b/templates/emails/expiration_reminder_ar.html index 421aea38..0f9b3d27 100644 --- a/templates/emails/expiration_reminder_ar.html +++ b/templates/emails/expiration_reminder_ar.html @@ -13,6 +13,6 @@

    مع أطيب التحيات،
    - فريق {{ SITE_NAME }}

    + فريق تنحل

    \ No newline at end of file diff --git a/templates/emails/expiration_reminder_ar.txt b/templates/emails/expiration_reminder_ar.txt index 28d5e3bf..38fa6de9 100644 --- a/templates/emails/expiration_reminder_ar.txt +++ b/templates/emails/expiration_reminder_ar.txt @@ -5,4 +5,4 @@ جدد اشتراكك الآن: {{ RENEWAL_URL }} مع أطيب التحيات، -فريق {{ SITE_NAME }} \ No newline at end of file +فريق تنحل \ No newline at end of file diff --git a/templates/emails/expiration_reminder_en.html b/templates/emails/expiration_reminder_en.html index 515fd007..3ad866ae 100644 --- a/templates/emails/expiration_reminder_en.html +++ b/templates/emails/expiration_reminder_en.html @@ -9,6 +9,6 @@

    Renew now to continue service.

    Best regards,
    - The {{ SITE_NAME }} Team

    + The Team at Tenhal

    \ No newline at end of file diff --git a/templates/emails/expiration_reminder_en.txt b/templates/emails/expiration_reminder_en.txt index 65d5dc2a..9053b9c2 100644 --- a/templates/emails/expiration_reminder_en.txt +++ b/templates/emails/expiration_reminder_en.txt @@ -5,4 +5,4 @@ Your {{ plan.name }} subscription will expire in {{ days_until_expire }} days on Renew now: {{ RENEWAL_URL }} Best regards, -{{ SITE_NAME }} Team \ No newline at end of file +The Team at Tenhal \ No newline at end of file diff --git a/templates/emails/invoice_past_due.txt b/templates/emails/invoice_past_due.txt index fe38285a..3d1eb082 100644 --- a/templates/emails/invoice_past_due.txt +++ b/templates/emails/invoice_past_due.txt @@ -7,4 +7,4 @@ Please settle your outstanding balance of {{ amount_due }} . If you have already paid, please disregard this notice. Best regards, -{{ SITE_NAME }} Team +The Team at Tenhal \ No newline at end of file diff --git a/templates/emails/invoice_past_due_reminder.txt b/templates/emails/invoice_past_due_reminder.txt index fc1710cc..3b1b40da 100644 --- a/templates/emails/invoice_past_due_reminder.txt +++ b/templates/emails/invoice_past_due_reminder.txt @@ -7,5 +7,5 @@ Please settle your outstanding balance of {{ amount_due }} before the due date t If you have already paid, please disregard this notice. Best regards, -{{ SITE_NAME }} Team +The Team at Tenhal diff --git a/templates/emails/schedule_reminder.html b/templates/emails/schedule_reminder.html index 23768aec..bee4b19d 100644 --- a/templates/emails/schedule_reminder.html +++ b/templates/emails/schedule_reminder.html @@ -14,19 +14,21 @@

    Hello {{ user_name }},

    -

    This is a friendly reminder for your upcoming schedule:

    +

    {% trans "This is a friendly reminder for your upcoming schedule" %}:

    - Purpose: {{ schedule_purpose }}
    - Scheduled At: {{ scheduled_at }}
    - Type: {{ schedule_type }}
    - {% if customer_name != 'N/A' %}Customer: {{ customer_name }}
    {% endif %} - {% if notes %}Notes: {{ notes }}
    {% endif %} + {% trans "Purpose" %}: {{ schedule_purpose }}
    + {% trans "Scheduled At" %}: {{ scheduled_at }}
    + {% trans "Type" %}: {{ schedule_type }}
    + {% if customer_name != 'N/A' %}{% trans "Customer" %}: {{ customer_name }}
    {% endif %} + {% if notes %}{% trans "Notes" %}: {{ notes }}
    {% endif %}

    -

    Please be prepared for your schedule.

    -

    Thank you!

    +

    {% trans "Please be prepared for your schedule" %}.

    +

    {% trans "Thank you" %}!

    +

    {% trans "The team at Tenhal" %}.

    +
    \ No newline at end of file diff --git a/templates/emails/schedule_reminder.txt b/templates/emails/schedule_reminder.txt index d27d9e3d..622c4565 100644 --- a/templates/emails/schedule_reminder.txt +++ b/templates/emails/schedule_reminder.txt @@ -1,16 +1,16 @@ -Hello {{ user_name }}, +{% trans "Hello" %} {{ user_name }}, -This is a friendly reminder for your upcoming schedule: +{% trans "This is a friendly reminder for your upcoming schedule" %}: -Purpose: {{ schedule_purpose }} -Scheduled At: {{ scheduled_at }} -Type: {{ schedule_type }} -{% if customer_name != 'N/A' %}Customer: {{ customer_name }}{% endif %} -{% if notes %}Notes: {{ notes }}{% endif %} +{% trans "Purpose" %}: {{ schedule_purpose }} +{% trans "Scheduled At" %}: {{ scheduled_at }} +{% trans "Type" %}: {{ schedule_type }} +{% if customer_name != 'N/A' %}{% trans "Customer" %}: {{ customer_name }}{% endif %} +{% if notes %}{% trans "Notes" %}: {{ notes }}{% endif %} -Please be prepared for your schedule. - -Thank you! +{% trans "Please be prepared for your schedule" %}. +{% trans "Thank you" %}! --- -This is an automated reminder. Please do not reply to this email. \ No newline at end of file +{% trans " The Team at Tenhal" %} +{% trans "This is an automated reminder. Please do not reply to this email" %}. \ No newline at end of file diff --git a/templates/footer.html b/templates/footer.html index 1c0203ac..ccaf3d23 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -33,7 +33,7 @@
    {% endcomment %} -
    +{% comment %}
    © 2025 {{ _("All right reserved")}} @@ -50,4 +50,74 @@
    -
    +
    {% endcomment %} + + + + + + + + + + + diff --git a/templates/ledger/reports/car_sale_report.html b/templates/ledger/reports/car_sale_report.html index 4f1c12a8..533bcfa4 100644 --- a/templates/ledger/reports/car_sale_report.html +++ b/templates/ledger/reports/car_sale_report.html @@ -180,7 +180,7 @@ {{ car.invoice.date_paid|date|default_if_none:"-" }} {{ car.finances.cost_price }} {{ car.finances.marked_price }} - {{ car.finances.discount_amount }} + {{ car.finances.total_discount }} {{ car.finances.selling_price }} {{ car.finances.vat_amount }} {{ car.invoice.invoice_number }} diff --git a/templates/mail/change_plan_body.txt b/templates/mail/change_plan_body.txt index 489b5100..65a2135d 100644 --- a/templates/mail/change_plan_body.txt +++ b/templates/mail/change_plan_body.txt @@ -9,5 +9,5 @@ {% trans "Thank you" %} -- -{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% blocktrans %}The Team at Tenhal{% endblocktrans %} {% endautoescape %} diff --git a/templates/mail/expired_account_body.txt b/templates/mail/expired_account_body.txt index 701ad8f9..bab40b78 100644 --- a/templates/mail/expired_account_body.txt +++ b/templates/mail/expired_account_body.txt @@ -10,5 +10,5 @@ http://{{ site_domain }}{% url 'upgrade_plan' %} {% trans "Thank you" %} -- -{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% blocktrans %}The Team at Tenhal{% endblocktrans %} {% endautoescape %} diff --git a/templates/mail/expired_account_title.txt b/templates/mail/expired_account_title.txt index 54a3d3a7..e5e3cc6c 100644 --- a/templates/mail/expired_account_title.txt +++ b/templates/mail/expired_account_title.txt @@ -1 +1,3 @@ -{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %} \ No newline at end of file +{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %} + + diff --git a/templates/mail/extend_account_body.txt b/templates/mail/extend_account_body.txt index f7e77e50..53deeba1 100644 --- a/templates/mail/extend_account_body.txt +++ b/templates/mail/extend_account_body.txt @@ -7,5 +7,5 @@ {% trans "Thank you" %} -- -{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% blocktrans %}The Team at Tenhal{% endblocktrans %} {% endautoescape %} diff --git a/templates/mail/invoice_created_body.txt b/templates/mail/invoice_created_body.txt index 4367230c..96beb55c 100644 --- a/templates/mail/invoice_created_body.txt +++ b/templates/mail/invoice_created_body.txt @@ -10,5 +10,5 @@ http://{{ site_domain }}{% url 'order' pk=order %} {% trans "Thank you" %} -- -{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %} +{% blocktrans %}The Team at Tenhal{% endblocktrans %} {% endautoescape %} diff --git a/templates/mail/remind_expire_body.txt b/templates/mail/remind_expire_body.txt index 040dd7d8..6a17286a 100644 --- a/templates/mail/remind_expire_body.txt +++ b/templates/mail/remind_expire_body.txt @@ -7,4 +7,9 @@ http://{{ site_domain }}{% url 'current_plan' %} {% blocktrans %}or you can upgrade your plan here:{% endblocktrans %} -http://{{ site_domain }}{% url 'upgrade_plan' %} \ No newline at end of file +http://{{ site_domain }}{% url 'upgrade_plan' %} + +{% trans "Thank you" %} +-- +{% blocktrans %}The Team at Tenhal{% endblocktrans %} +{% endautoescape %} diff --git a/templates/staff/staff_detail.html b/templates/staff/staff_detail.html index e1d423cb..85549624 100644 --- a/templates/staff/staff_detail.html +++ b/templates/staff/staff_detail.html @@ -46,7 +46,7 @@

    {{ staff.get_local_name }}

    - {% trans 'Role' %}: +

  • {% trans 'Role' %}: {% for group in staff.groups%}  {{group}} {% endfor %} @@ -55,10 +55,11 @@
    +
    -
    {% trans 'last login'|capfirst %}
    +
    {% trans 'last login'|capfirst %}

    {{ staff.user.last_login|date:"D M d, Y H:i" }}

    @@ -70,12 +71,12 @@
    -

    {% trans 'Default Address' %}

    +

    {% trans 'Contact Information' %}

    -
    {% trans 'Address' %}
    +
    {% trans 'Address' %}
  • {{ staff.address }}

    @@ -85,13 +86,13 @@
    -
    {% trans 'Email' %}
    +
    {% trans 'Email' %}
  • {{ staff.user.email }}
    -
    {% trans 'Phone' %}
    +
    {% trans 'Phone' %}
  • {{ staff.phone_number }}