Compare commits

...

14 Commits

Author SHA1 Message Date
c028a7980e update 2025-07-03 15:42:46 +03:00
4f2e4d8bb1 update 2025-07-03 14:55:21 +03:00
f52594d6fd update 2025-07-03 14:48:29 +03:00
772db4669f update perms 2025-07-03 14:46:42 +03:00
e5a088324f update permissions 2025-07-03 14:40:28 +03:00
747690a1b6 update 2025-07-03 14:40:27 +03:00
a3e10e02ff Merge branch 'main' of http://10.10.1.136:3000/ismail/haikal into frontend 2025-07-02 18:29:48 +03:00
53445eab83 update 2025-07-02 18:29:33 +03:00
1e50cad90c fix edit lead assigned qs 2025-07-02 18:29:29 +03:00
6328a38d4f update 2025-07-02 17:10:23 +03:00
b1e81ef5f3 update 2025-07-02 17:08:33 +03:00
a987a6bceb fix qs 2025-07-02 17:08:05 +03:00
64e4f225ca Merge branch 'main' of http://10.10.1.136:3000/ismail/haikal into frontend 2025-07-02 16:51:03 +03:00
e680e3aaea fix 2025-07-02 16:50:28 +03:00
25 changed files with 552 additions and 616 deletions

View File

@ -18,6 +18,7 @@ from django_ledger.models import (
ItemModel,
CustomerModel,
JournalEntryModel,
LedgerModel
)
from django_ledger.io.io_core import get_localdate
from django.core.exceptions import ValidationError
@ -2549,11 +2550,21 @@ class CustomGroup(models.Model):
pass
def set_default_permissions(self):
est = ContentType.objects.get_for_model(EstimateModel)
bill = ContentType.objects.get_for_model(BillModel)
Permission.objects.get_or_create(name="Can approve estimate",codename="can_approve_estimate",content_type=est)
Permission.objects.get_or_create(name="Can approve bill",codename="can_approve_bill",content_type=bill)
Permission.objects.get_or_create(name="Can approve estimate",codename="can_approve_estimatemodel",content_type=ContentType.objects.get_for_model(EstimateModel))
Permission.objects.get_or_create(name="Can approve bill",codename="can_approve_billmodel",content_type=ContentType.objects.get_for_model(BillModel))
Permission.objects.get_or_create(name="Can view inventory",codename="can_view_inventory",content_type=ContentType.objects.get_for_model(Car))
Permission.objects.get_or_create(name="Can view sales",codename="can_view_sales",content_type=ContentType.objects.get_for_model(EstimateModel))
Permission.objects.get_or_create(name="Can view crm",codename="can_view_crm",content_type=ContentType.objects.get_for_model(Lead))
Permission.objects.get_or_create(name="Can view financials",codename="can_view_financials",content_type=ContentType.objects.get_for_model(AccountModel))
Permission.objects.get_or_create(name="Can view reports",codename="can_view_reports",content_type=ContentType.objects.get_for_model(LedgerModel))
self.clear_permissions()
######################################
######################################
#MANAGER
######################################
######################################
if self.name == "Manager":
self.set_permissions(
app="inventory",
@ -2568,11 +2579,6 @@ class CustomGroup(models.Model):
"interiorcolors",
"exteriorcolors",
"carreservation",
],
)
self.set_permissions(
app="inventory",
allowed_models=[
"lead",
"customgroup",
"saleorder",
@ -2581,6 +2587,11 @@ class CustomGroup(models.Model):
"schedule",
"activity",
"opportunity",
"vendor",
"customer"
"notes",
"tasks",
"activity",
],
)
self.set_permissions(
@ -2592,10 +2603,20 @@ class CustomGroup(models.Model):
"chartofaccountmodel",
"customermodel",
"billmodel",
"can_approve_estimate"
"can_approve_bill",
"bankaccountmodel",
"itemmodel",
"vendormodel",
"journalentrymodel",
"purchaseordermodel",
],
other_perms=["can_approve_estimatemodel","can_approve_billmodel","can_view_inventory","can_view_sales","can_view_crm","can_view_financials","can_view_reports"],
)
######################################
######################################
#Inventory
######################################
######################################
elif self.name == "Inventory":
self.set_permissions(
app="inventory",
@ -2608,14 +2629,29 @@ class CustomGroup(models.Model):
"carlocation",
"customcard",
"carreservation",
"notes",
"tasks",
"activity",
],
)
self.set_permissions(
app="django_ledger",
allowed_models=[],
other_perms=[
"view_purchaseordermodel",
"can_view_financials",
]
)
######################################
######################################
#Sales
######################################
######################################
elif self.name == "Sales":
self.set_permissions(
app="django_ledger",
allowed_models=["estimatemodel", "invoicemodel", "customermodel"],
)
self.set_permissions(
app="inventory",
allowed_models=[
@ -2627,23 +2663,34 @@ class CustomGroup(models.Model):
"opportunity",
"customer",
"organization",
"notes",
"taska",
"activity",
],
)
self.set_permissions(
app="inventory",
allowed_models=["lead", "salequotation", "salequotationcar"],
other_perms=[
"view_car",
"view_carlocation",
"view_customcard",
"view_carcolors",
"view_cartransfer",
"can_view_inventory",
"can_view_sales",
"can_view_crm",
],
)
######################################
######################################
#Accountant
######################################
######################################
elif self.name == "Accountant":
self.set_permissions(
app="inventory",
allowed_models=["carfinance"],
allowed_models=[
"carfinance",
"notes",
"tasks",
"activity",],
other_perms=[
"view_car",
"view_carlocation",
@ -2651,6 +2698,7 @@ class CustomGroup(models.Model):
"view_carcolors",
"view_cartransfer",
"view_saleorder",
],
)
self.set_permissions(
@ -2659,19 +2707,20 @@ class CustomGroup(models.Model):
"bankaccountmodel",
"accountmodel",
"chartofaccountmodel",
"customcard",
"billmodel",
"itemmodel",
"invoicemodel",
"vendormodel",
"journalentrymodel",
"purchaseordermodel",
"estimatemodel",
"customermodel",
"vendormodel",
"TransactionModel"
],
other_perms=["view_customermodel", "view_estimatemodel","can_approve_estimatemodel","can_approve_billmodel"],
other_perms=["view_customermodel", "view_estimatemodel","can_view_inventory","can_view_sales","can_view_crm","can_view_financials","can_view_reports"],
)
elif self.name == "Agent":
# Todo : set permissions for agent
pass
def set_permissions(self, app="inventory", allowed_models=[], other_perms=[]):
try:
@ -2878,7 +2927,7 @@ class ExtraInfo(models.Model):
on_delete=models.CASCADE,
related_name="extra_info_primary"
)
object_id = models.PositiveIntegerField()
object_id = models.CharField(max_length=255, null=True, blank=True)
content_object = GenericForeignKey('content_type', 'object_id')
# Secondary GenericForeignKey (optional additional link)
@ -2889,7 +2938,7 @@ class ExtraInfo(models.Model):
blank=True,
related_name="extra_info_secondary"
)
related_object_id = models.PositiveIntegerField(null=True, blank=True)
related_object_id = models.CharField(max_length=255, null=True, blank=True)
related_object = GenericForeignKey('related_content_type', 'related_object_id')
# JSON Data Storage

View File

@ -6,6 +6,7 @@ from django.contrib.auth.models import Group
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import get_user_model
from django_ledger.io import roles
from django_ledger.models import (
@ -989,8 +990,8 @@ def lead_created_notification(sender, instance, created, **kwargs):
@receiver(post_save, sender=EstimateModel)
def estimate_in_review_notification(sender, instance, created, **kwargs):
if instance.is_review():
recipients = models.CustomGroup.objects.filter(dealer=instance.dealer,name="Manager").first().group.user_set.exclude(email=instance.dealer.user.email)
dealer = models.Dealer.objects.get(entity=instance.entity)
recipients = models.CustomGroup.objects.filter(dealer=dealer,name="Manager").first().group.user_set.exclude(email=dealer.user.email)
for recipient in recipients:
models.Notification.objects.create(
user=recipient,
@ -1003,16 +1004,22 @@ def estimate_in_review_notification(sender, instance, created, **kwargs):
@receiver(post_save, sender=EstimateModel)
def estimate_in_approve_notification(sender, instance, created, **kwargs):
if instance.is_approved():
recipients = models.CustomGroup.objects.filter(dealer=instance.dealer,name="Manager").first().group.user_set.exclude(email=instance.dealer.user.email)
dealer = models.Dealer.objects.get(entity=instance.entity)
for recipient in recipients:
models.Notification.objects.create(
user=recipient,
message=f"""
Estimate {instance.estimate_number} is in review.
Please review and approve it at your earliest convenience.
<a href="{reverse('estimate_detail', kwargs={'dealer_slug': dealer.slug, 'pk': instance.pk})}" target="_blank">View</a>
""")
recipient = models.ExtraInfo.objects.filter(
content_type=ContentType.objects.get_for_model(EstimateModel),
related_content_type=ContentType.objects.get_for_model(models.Staff),
object_id=instance.pk,
).first()
models.Notification.objects.create(
user=recipient.related_object.user,
message=f"""
Estimate {instance.estimate_number} has been approved.
<a href="{reverse('estimate_detail', kwargs={'dealer_slug': dealer.slug, 'pk': instance.pk})}" target="_blank">View</a>
"""
)
# @receiver(post_save, sender=models.Lead)
# def lead_created_notification(sender, instance, created, **kwargs):

View File

@ -816,6 +816,8 @@ urlpatterns = [
name="bill-update-items",
),
############################################################
############################################################
#BILL MARK AS
path(
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-draft/",
views.BillModelActionMarkAsDraftView.as_view(),
@ -861,33 +863,7 @@ urlpatterns = [
views.BillModelActionForceMigrateView.as_view(),
name="bill-action-force-migrate",
),
# path("items/bills/create/", views.bill_create, name="bill_create"),
path(
"items/bills/<uuid:pk>/bill_detail/",
views.BillDetailView.as_view(),
name="bill_detail",
),
path("items/bills/<uuid:pk>/delete/", views.BillDeleteView, name="bill_delete"),
path(
"items/bills/<uuid:pk>/in_review/",
views.InReviewBillView.as_view(),
name="in_review_bill",
),
path(
"items/bills/<uuid:pk>/in_approve/",
views.ApprovedBillModelView.as_view(),
name="in_approve_bill",
),
path(
"items/bills/<uuid:pk>/mark_as_approved/",
views.bill_mark_as_approved,
name="bill_mark_as_approved",
),
path(
"items/bills/<uuid:pk>/mark_as_paid/",
views.bill_mark_as_paid,
name="bill_mark_as_paid",
),
# orders
path("orders/", views.OrderListView.as_view(), name="order_list_view"),
# BALANCE SHEET Reports...

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,6 @@
{% block body %}
<div class="main-container">
<div class="body-container">
<form method="post"
action="{% url 'appointment:appointment_client_information' ar.id ar.get_id_request %}"
class="page-body">

View File

@ -12,7 +12,6 @@
{{ page_description }}
{% endblock %}
{% block body %}
<div class="row">
<div class="col-xl-12">
<h3 class="page-title">

View File

@ -89,10 +89,14 @@
<!-- JavaScripts-->
<!-- ===============================================-->
<script src="{% static 'vendors/popper/popper.min.js' %}"></script>
<!--1-->
<script src="{% static 'vendors/bootstrap/bootstrap.min.js' %}"></script>
<script src="{% static 'vendors/anchorjs/anchor.min.js' %}"></script>
<script src="{% static 'vendors/is/is.min.js' %}"></script>
<!--2-->
<script src="{% static 'vendors/fontawesome/all.min.js' %}"></script>
<script src="{% static 'vendors/lodash/lodash.min.js' %}"></script>
<script src="{% static 'vendors/list.js/list.min.js' %}"></script>
<script src="{% static 'vendors/feather-icons/feather.min.js' %}"></script>

View File

@ -172,6 +172,7 @@
<li class="nav-item text-nowrap me-2" role="presentation"><a class="nav-link" id="notes-tab" data-bs-toggle="tab" href="#tab-notes" role="tab" aria-controls="tab-notes" aria-selected="false" tabindex="-1"> <span class="fa-solid fa-clipboard me-2 tab-icon-color fs-8"></span>{{ _("Notes") }}</a></li>
<li class="nav-item text-nowrap me-2" role="presentation"><a class="nav-link" id="emails-tab" data-bs-toggle="tab" href="#tab-emails" role="tab" aria-controls="tab-emails" aria-selected="true"> <span class="fa-solid fa-envelope me-2 tab-icon-color fs-8"></span>{{ _("Emails") }}</a></li>
<li class="nav-item text-nowrap me-2" role="presentation"><a class="nav-link" id="tasks-tab" data-bs-toggle="tab" href="#tab-tasks" role="tab" aria-controls="tab-tasks" aria-selected="true"> <span class="fa-solid fa-envelope me-2 tab-icon-color fs-8"></span>{{ _("Tasks") }}</a></li>
{% if perms.inventory.change_lead%}
<li class="nav-item text-nowrap ml-auto" role="presentation">
<button class="btn btn-phoenix-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#exampleModal"> <i class="fa-solid fa-user-plus me-2"></i> Reassign Lead</button>
<button class="btn btn-phoenix-primary btn-sm" onclick="openActionModal('{{ lead.id }}', '{{ lead.action }}', '{{ lead.next_action }}', '{{ lead.next_action_date|date:"Y-m-d\TH:i" }}')">
@ -199,12 +200,15 @@
</div>
</div>
</li>
{% endif %}
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade" id="tab-activity" role="tabpanel" aria-labelledby="activity-tab">
<div class="mb-1 d-flex justify-content-between align-items-center">
<h3 class="mb-4" id="s crollspyTask">{{ _("Activities") }} <span class="fw-light fs-7">({{ activities.count}})</span></h3>
{% if perms.inventory.change_lead%}
<button class="btn btn-phoenix-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#activityModal"><span class="fas fa-plus me-1"></span>{{ _("Add Activity") }}</button>
{% endif %}
</div>
<div class="row justify-content-between align-items-md-center hover-actions-trigger btn-reveal-trigger border-translucent py-3 gx-0 border-top">
<div class="col-12 col-lg-auto">
@ -252,7 +256,9 @@
<div class="tab-pane fade active show" id="tab-opportunity" role="tabpanel" aria-labelledby="opportunity-tab">
<div class="mb-1 d-flex justify-content-between align-items-center">
<h3 class="mb-4" id="scrollspyTask">{{ _("Opportunities") }} <span class="fw-light fs-7">({{ lead.get_opportunities.count}})</span></h3>
{% if perms.inventory.add_opportunity%}
<a href="{% url 'lead_opportunity_create' request.dealer.slug lead.slug %}" class="btn btn-phoenix-primary btn-sm" type="button"> <i class="fa-solid fa-plus me-2"></i>{{ _("Add Opportunity") }}</a>
{% endif%}
</div>
<div class="border-top border-bottom border-translucent" id="leadDetailsTable">
@ -284,7 +290,9 @@
<div class="tab-pane fade" id="tab-notes" role="tabpanel" aria-labelledby="notes-tab">
<div class="mb-1 d-flex align-items-center justify-content-between">
<h3 class="mb-4" id="scrollspyNotes">{{ _("Notes") }}</h3>
{% if perms.inventory.change_lead%}
<button class="btn btn-phoenix-primary btn-sm" type="button" onclick="reset_form()" data-bs-toggle="modal" data-bs-target="#noteModal"><span class="fas fa-plus me-1"></span>{{ _("Add Note") }}</button>
{% endif %}
</div>
<div class="border-top border-bottom border-translucent" id="leadDetailsTable">
@ -340,12 +348,14 @@
<div class="tab-pane fade" id="tab-emails" role="tabpanel" aria-labelledby="emails-tab">
<div class="mb-1 d-flex justify-content-between align-items-center">
<h3 class="mb-0" id="scrollspyEmails">{{ _("Emails") }}</h3>
{% if perms.inventory.change_lead%}
<a href="{% url 'send_lead_email' request.dealer.slug lead.slug %}">
<button type="button" class="btn btn-sm btn-phoenix-primary">
<span class="fas fa-plus me-1"></span>
{% trans 'Send Email' %}
</button>
</a>
{% endif %}
</div>
<div>
<div class="scrollbar">
@ -462,7 +472,9 @@
<div class="tab-pane fade" id="tab-tasks" role="tabpanel" aria-labelledby="tasks-tab">
<div class="mb-1 d-flex justify-content-between align-items-center">
<h3 class="mb-0" id="scrollspyEmails">{{ _("Tasks") }}</h3>
{% if perms.inventory.change_lead%}
<button class="btn btn-phoenix-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#taskModal"><span class="fas fa-plus me-1"></span>{{ _("Add Task") }}</button>
{% endif %}
</div>
<div>

View File

@ -190,7 +190,7 @@
</td> {% endcomment %}
<td class="align-middle white-space-nowrap text-body-tertiary text-opacity-85 fw-semibold text-body-highlight">
{% if lead.opportunity %}
<a href="{% url 'opportunity_detail' lead.opportunity.slug %}">
<a href="{% url 'opportunity_detail' request.dealer.slug lead.opportunity.slug %}">
<span class="badge badge-phoenix badge-phoenix-success">Opportunity {{ lead.opportunity.lead}} <i class="fa-solid fa-arrow-up-right-from-square"></i></span>
</a>
{% endif %}
@ -212,18 +212,23 @@
{% if perms.inventory.change_lead %}
<a href="{% url 'lead_update' request.dealer.slug lead.slug %}" class="dropdown-item text-success-dark">{% trans "Edit" %}</a>
{% endif %}
{% if perms.inventory.change_lead%}
<button class="dropdown-item text-primary" onclick="openActionModal('{{ lead.pk }}', '{{ lead.action }}', '{{ lead.next_action }}', '{{ lead.next_action_date|date:"Y-m-d\TH:i" }}')">
{% trans "Update Actions" %}
</button>
<a href="{% url 'send_lead_email' request.dealer.slug lead.slug %}" class="dropdown-item text-success-dark">{% trans "Send Email" %}</a>
<a href="{% url 'schedule_lead' request.dealer.slug lead.slug %}" class="dropdown-item text-success-dark">{% trans "Schedule Event" %}</a>
{% endif %}
{% if not lead.opportunity %}
{% if perms.inventory.add_opportunity%}
<a href="{% url 'lead_opportunity_create' request.dealer.slug lead.slug %}" class="dropdown-item text-success-dark">{% trans "Convert to Opportunity" %}</a>
{% endif %}
{% endif %}
<div class="dropdown-divider"></div>
{% if perms.inventory.delete_lead %}
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">{% trans "Delete" %}</button>
{% endif %}
{%endif%}
</div>
</div>
{% endif %}

View File

@ -13,14 +13,22 @@
<ul class="dropdown-menu dropdown-menu-end p-0" style="z-index: 9999;">
<li>
{% if opportunity.estimate %}
{% if perms.django_ledger.view_estimatemodel%}
<a class="dropdown-item" href="{% url 'estimate_detail' request.dealer.slug opportunity.estimate.pk %}">{{ _("View Quotation")}}</a>
{% endif %}
{% else %}
{%if perms.django_ledger.add_estimatemodel%}
<a class="dropdown-item" href="{% url 'estimate_create_from_opportunity' request.dealer.slug opportunity.slug %}">{{ _("Create Quotation")}}</a>
{% endif %}
{% endif %}
</li>
{% if perms.inventory.change_opportunity%}
<li><a class="dropdown-item" href="{% url 'update_opportunity' request.dealer.slug opportunity.slug %}">Update Opportunity</a></li>
<li><a class="dropdown-item" href="{% url 'update_opportunity' request.dealer.slug opportunity.slug %}">Update Stage</a></li>
{% endif %}
{% if perms.inventory.delete_opportunity%}
<li><a class="dropdown-item text-danger" href="">Delete Opportunity</a></li>
{% endif %}
</ul>
</div>
</div>
@ -348,9 +356,11 @@
</form>
</div>
</div>
{%if perms.inventory.change_opportunity%}
<div class="col-auto">
<button class="btn btn-phoenix-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#activityModal"><span class="fas fa-plus me-1"></span>{{ _("Add Activity") }}</button>
</div>
{% endif %}
</div>
{% for activity in opportunity.get_activities %}
<div class="border-bottom border-translucent py-4">
@ -392,11 +402,13 @@
</div>
<div class="tab-pane fade" id="tab-notes" role="tabpanel" aria-labelledby="notes-tab">
<h2 class="mb-4">Notes</h2>
{%if perms.inventory.change_opportunity%}
<form action="{% url 'add_note_to_opportunity' request.dealer.slug opportunity.slug %}" method="post">
{% csrf_token %}
<textarea class="form-control mb-3" id="notes" rows="4" name="notes" required> </textarea>
<button type="submit" class="btn btn-phoenix-primary mb-3">Add Note</button>
</form>
{% endif %}
<div class="row gy-4 note-list">
<div class="col-12 col-xl-auto flex-1">
{% for note in opportunity.get_notes %}
@ -427,9 +439,11 @@
<p class="mb-0 fs-9 text-body-tertiary fw-bold"><span class="fas fa-filter me-1 fw-extra-bold fs-10"></span>23 tasks</p>
<button class="btn btn-link p-0 ms-3 fs-9 text-primary fw-bold text-decoration-none"><span class="fas fa-sort me-1 fw-extra-bold fs-10"></span>Sorting</button>
</div>
{% if perms.inventory.change_opportunity%}
<div class="col-auto">
<a href="{% url 'schedule_lead' request.dealer.slug opportunity.lead.slug %}" class="btn btn-phoenix-primary"><span class="fa-solid fa-plus me-2"></span>Add Meeting </a>
</div>
{% endif %}
</div>
<div class="row g-3">
{% for metting in opportunity.lead.get_meetings %}
@ -454,10 +468,12 @@
<div class="col-auto d-flex flex-1">
<h2 class="mb-0">Call</h2>
</div>
{% if perms.inventory.change_opportunity%}
<div class="col-auto">
<a href="{% url 'schedule_lead' request.dealer.slug opportunity.lead.slug %}" class="btn btn-phoenix-primary"><span class="fa-solid fa-plus me-2"></span>Add Call</a>
</div>
{% endif %}
</div>
<pre>{{opportunity.get_all_notes}}</pre>
<div class="border-top border-bottom border-translucent" id="leadDetailsTable" data-list='{"valueNames":["name","description","create_date","create_by","last_activity"],"page":5,"pagination":true}'>
@ -503,6 +519,7 @@
</div>
<div class="tab-pane fade" id="tab-emails" role="tabpanel" aria-labelledby="emails-tab">
<h2 class="mb-4">Emails</h2>
{% if perms.inventory.change_opportunity%}
<div class="d-flex justify-content-end">
<a href="{% url 'send_lead_email' request.dealer.slug opportunity.lead.slug %}">
<button type="button" class="btn btn-sm btn-phoenix-primary">
@ -511,6 +528,7 @@
</button>
</a>
</div>
{% endif %}
<div>
<div class="scrollbar">
<ul class="nav nav-underline fs-9 flex-nowrap mb-1" id="emailTab" role="tablist">
@ -580,7 +598,9 @@
<div class="tab-pane fade" id="tab-tasks" role="tabpanel" aria-labelledby="tasks-tab">
<div class="mb-1 d-flex justify-content-between align-items-center">
<h3 class="mb-0" id="scrollspyEmails">{{ _("Tasks") }}</h3>
{% if perms.inventory.change_opportunity%}
<button class="btn btn-phoenix-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#taskModal"><span class="fas fa-plus me-1"></span>{{ _("Add Task") }}</button>
{% endif %}
</div>
<div>

View File

@ -119,12 +119,16 @@
</div>
<div class="d-flex gap-2">
{% if perms.inventory.view_opportunity%}
<a class="btn btn-sm btn-phoenix-primary" href="{% url 'opportunity_detail' request.dealer.slug opportunity.slug %}">
<i class="fa-solid fa-eye ms-2"></i>{{ _("View") }}
</a>
{% endif %}
{%if perms.inventory.change_opportunity%}
<a class="btn btn-sm btn-phoenix-success" href="{% url 'update_opportunity' request.dealer.slug opportunity.slug %}">
<i class="fa-solid fa-pen ms-2"></i> {{ _("Update") }}
</a>
{% endif %}
</div>
</div>
</div>

View File

@ -10,7 +10,7 @@
<div class="row g-3 justify-content-between mb-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
{% if perms.django_ledger.add_customermodel %}
{% if perms.inventory.add_customer %}
<div>
<a href="{% url 'customer_create' request.dealer.slug %}" class="btn btn-sm btn-phoenix-primary me-4"><span class="fas fa-plus me-2"></span>{{ _("Add Customer") }}</a>
</div>
@ -68,6 +68,7 @@
<td>
</td>
{% if perms.inventory.view_customer%}
<td class="name align-middle white-space-nowrap ps-0">
<div class="d-flex align-items-center">
<div><a class="fs-8 fw-bold" href="{% url 'customer_detail' request.dealer.slug customer.slug %}">{{ customer.full_name }}</a>
@ -76,6 +77,7 @@
</div>
</div>
</td>
{% endif %}
<td class="email align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent"><a class="text-body-highlight" href="">{{ customer.email }}</a></td>
<td class="phone align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent"><a class="text-body-highlight" href="tel:{{ customer.phone }}">{{ customer.phone_number }}</a></td>
<td class="contact align-middle white-space-nowrap ps-4 border-end border-translucent fw-semibold text-body-highlight">{{ customer.national_id }}</td>
@ -90,12 +92,12 @@
</td>
<td class="date align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 text-body-tertiary">{{ customer.created|date }}</td>
<td class="align-middle white-space-nowrap text-end pe-0 ps-4">
{% if perms.django_ledger.change_customermodel %}
{% if perms.inventory.change_customer %}
<a href="{% url 'customer_update' request.dealer.slug customer.slug %}" class="btn btn-sm btn-phoenix-primary me-2" data-url="{% url 'customer_update' request.dealer.slug customer.slug %}">
<i class="fas fa-pen"></i>
</a>
{% endif %}
{% if perms.django_ledger.delete_customermodel %}
{% if perms.inventory.delete_customer %}
<button class="btn btn-phoenix-danger btn-sm delete-btn"
data-url="{% url 'customer_delete' request.dealer.slug customer.slug %}"
data-message="{{ _("Are you sure you want to delete this customer")}}"

View File

@ -14,22 +14,25 @@
</div>
<div class="col-auto">
<div class="row g-3">
<div class="col-auto">
{% if perms.inventory.change_customer %}
<a href="{% url 'customer_update' request.dealer.slug customer.slug %}" class="btn btn-sm btn-phoenix-primary"><span class="fa-solid fa-pen-to-square me-2"></span>{{_("Update")}}</a>
{% endif %}
</div>
{% if perms.inventory.delete_customer%}
<div class="col-auto">
{% if perms.django_ledger.delete_customermodel %}
<button class="btn btn-phoenix-danger btn-sm delete-btn"
data-url="{% url 'customer_delete' request.dealer.slug customer.slug %}"
data-message="Are you sure you want to delete this customer?"
data-bs-toggle="modal" data-bs-target="#deleteModal">
<i class="fas fa-trash me-1"> </i>{{ _("Delete") }}
</button>
{% endif %}
</div>
{% endif %}
<div class="col-auto">
{% if perms.django_ledger.change_customermodel %}
<a href="{% url 'customer_update' request.dealer.slug customer.slug %}" class="btn btn-sm btn-phoenix-primary"><span class="fa-solid fa-pen-to-square me-2"></span>{{_("Update")}}</a>
{% endif %}
</div>
</div>
</div>
</div>
@ -84,16 +87,14 @@
<div class="col-12">
<div class="card">
<div class="card-body">
{% if perms.inventory.change_customer%}
<div class="d-flex align-items-center justify-content-end">
<a id="addBtn" href="#" class="btn btn-sm btn-phoenix-primary mb-3" data-url="{% url 'add_note_to_customer' request.dealer.slug customer.slug %}" data-bs-toggle="modal" data-bs-target="#noteModal" data-note-title="{{ _("Add") }}<i class='fa fa-plus-circle text-success ms-2'></i>">
<span class="fas fa-plus me-1"></span>
{% trans 'Add Note' %}
</a>
{% comment %} <a id="addBtn" class="btn btn-sm btn-phoenix-primary mb-3" hx-get="{% url 'add_note_to_customer' request.dealer.slug customer.slug %}" hx-target=".modal-body" hx-swap="innerHTML" hx-push-url="false" data-bs-toggle="modal" data-bs-target="#noteModal">
<span class="fas fa-plus me-1"></span>
{% trans 'Add Note' %}
</a> {% endcomment %}
</div>
{% endif %}
<table class="table fs-9 mb-0 table-responsive">
<tr>
<th class="align-middle pe-6 text-start" scope="col">{{ _("Note") }}</th>

View File

@ -10,13 +10,14 @@
<li class="nav-item">
<p class="navbar-vertical-label">Apps</p>
<hr class="navbar-vertical-line" />
{% if perms.inventory.can_view_inventory %}
<div class="nav-item-wrapper">
<a id="inventory-nav" class="nav-link dropdown-indicator label-1 inventory-nav" href="#nv-inventory" role="button" data-bs-toggle="collapse" aria-expanded="false" aria-controls="nv-inventory">
<div class="d-flex align-items-center">
<div class="dropdown-indicator-icon-wrapper"><span class="fas fa-caret-right dropdown-indicator-icon"></span></div>
<span class="nav-link-icon"><span class="fas fa-warehouse"></span></span><span class="nav-link-text">{% trans "Inventory"|capfirst %}</span>
</div>
</a>
</a>
<div class="parent-wrapper label-1">
<ul class="nav collapse parent" data-bs-parent="#navbarVerticalCollapse" id="nv-inventory">
<li class="collapsed-nav-item-title d-none">{% trans "Inventory"|capfirst %}</li>
@ -60,8 +61,9 @@
</ul>
</div>
</div>
{% endif %}
{% if perms.inventory.view_lead or perms.django_ledger.view_invoicemodel %}
{% if perms.django_ledger.can_view_sales %}
<div class="nav-item-wrapper">
<a class="nav-link dropdown-indicator label-1" href="#nv-sales" role="button" data-bs-toggle="collapse" aria-expanded="false" aria-controls="nv-sales">
<div class="d-flex align-items-center">
@ -90,7 +92,7 @@
</a>
</li>
{% endif %}
{%if perms.inventory.view_saleorder%}
<li class="nav-item">
<a class="nav-link" href="{% url 'sales_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
@ -98,6 +100,7 @@
</div>
</a>
</li>
{% endif %}
{% if perms.django_ledger.view_invoicemodel %}
<li class="nav-item">
@ -108,7 +111,7 @@
</a>
</li>
{% endif %}
{% if perms.django_ledger.view_journalentrymodel %}
{% if perms.inventory.view_payment %}
<li class="nav-item">
<a class="nav-link" href="{% url 'payment_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
@ -123,7 +126,7 @@
</div>
{% endif %}
{% if perms.inventory.view_lead %}
{% if perms.inventory.can_view_crm %}
<div class="nav-item-wrapper">
<a class="nav-link dropdown-indicator label-1" href="#nv-crm" role="button" data-bs-toggle="collapse" aria-expanded="false" aria-controls="nv-crm">
<div class="d-flex align-items-center">
@ -197,7 +200,7 @@
</div>
{% endif %}
{% if perms.django_ledger.view_accountmodel %}
{% if perms.django_ledger.can_view_financials %}
<div class="nav-item-wrapper">
<a class="nav-link dropdown-indicator label-1" href="#nv-financial" role="button" data-bs-toggle="collapse" aria-expanded="false" aria-controls="nv-financial">
<div class="d-flex align-items-center">
@ -222,11 +225,12 @@
<a class="nav-link" href="{% url 'bank_account_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span data-feather="credit-card"></span></span><span class="nav-link-text">{% trans 'Bank Accounts'|capfirst %}</span>
</div>
</div>
</a>
</li>
{% endif %}
{% if perms.django_ledger.view_itemmodel %}
{% if perms.django_ledger.view_journalentrymodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'ledger_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
@ -235,6 +239,8 @@
</a>
</li>
{% endif %}
{% if perms.inventory.view_additionalservices %}
<li class="nav-item">
<a class="nav-link" href="{% url 'item_service_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
@ -242,6 +248,8 @@
</div>
</a>
</li>
{% endif %}
{% if perms.django_ledger.view_itemmodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'item_expense_list' request.dealer.slug %}">
@ -270,17 +278,20 @@
</li>
{% endif %}
{% if perms.django_ledger.view_purchaseorder %}
<li class="nav-item">
<a class="nav-link" href="{% url 'purchase_order_list' request.dealer.slug request.dealer.entity.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-warehouse"></span></span><span class="nav-link-text">{% trans "purchase Orders"|capfirst %}</span>
</div>
</a>
<a class="nav-link" href="{% url 'purchase_order_list' request.dealer.slug request.dealer.entity.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-warehouse"></span></span><span class="nav-link-text">{% trans "purchase Orders"|capfirst %}</span>
</div>
</a>
</li>
</ul>
</div>
</div>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% if perms.django_ledger.can_view_reports %}
<div class="nav-item-wrapper">
<a class="nav-link dropdown-indicator label-1" href="#nv-reports" role="button" data-bs-toggle="collapse" aria-expanded="false" aria-controls="nv-reports">
<div class="d-flex align-items-center">
@ -294,7 +305,7 @@
<ul class="nav collapse parent" data-bs-parent="#navbarVerticalCollapse" id="nv-reports">
<li class="nav-item">
{% if request.user.is_authenticated and request.is_dealer %}
<a class="nav-link" href="{% url 'entity-dashboard' request.user.dealer.entity.slug %}">
<a class="nav-link" href="{% url 'entity-dashboard' request.dealer.entity.slug %}">
{% elif request.user.is_authenticated and request.is_staff %}
<a class="nav-link" href="{% url 'entity-dashboard' request.user.staffmember.staff.dealer.entity.slug %}">
{% else %}
@ -335,20 +346,21 @@
</ul>
</div>
{% endif %}
{% endif %}
</div>
</div>
</li>
</ul>
</div>
</ul>
{% endif %}
</div>
</div>
{% endif %}
<div class="navbar-vertical-footer">
<button class="btn navbar-vertical-toggle border-0 fw-semibold w-100 white-space-nowrap d-flex align-items-center">
<span class="uil uil-left-arrow-to-left fs-8"></span><span class="uil uil-arrow-from-right fs-8"></span><span class="navbar-vertical-footer-text ms-2">Collapsed View</span>
</button>
</div>
</nav>
{% endif %}
<nav class="navbar navbar-top fixed-top navbar-expand" id="navbarDefault">
<div class="collapse navbar-collapse justify-content-between">
@ -431,7 +443,7 @@
<ul class="nav d-flex flex-column mb-2 pb-1">
{% if request.is_dealer %}
<li class="nav-item">
<a class="nav-link px-3 d-block" href="{% url 'dealer_detail' request.user.dealer.slug %}"> <span class="me-2 text-body align-bottom" data-feather="user"></span><span>{% translate 'profile'|capfirst %}</span></a>
<a class="nav-link px-3 d-block" href="{% url 'dealer_detail' request.dealer.slug %}"> <span class="me-2 text-body align-bottom" data-feather="user"></span><span>{% translate 'profile'|capfirst %}</span></a>
</li>
{% else %}
<li class="nav-item">
@ -448,7 +460,7 @@
{% endif %}
<li class="nav-item">
{% if request.is_dealer %}
<a class="nav-link px-3 d-block" href="{% url 'dealer_settings' request.user.dealer.slug %}"> <span class="me-2 text-body align-bottom" data-feather="settings"></span>{{ _("Settings") }}</a>
<a class="nav-link px-3 d-block" href="{% url 'dealer_settings' request.dealer.slug %}"> <span class="me-2 text-body align-bottom" data-feather="settings"></span>{{ _("Settings") }}</a>
{% endif %}
</li>
<li class="nav-item">

View File

@ -4,7 +4,7 @@
{% if request.user.is_authenticated %}
<div
id="dashboard-content"
hx-get="{% if request.user.dealer %}{% url 'manager_dashboard' %}{% else %}{% url 'sales_dashboard' %}{% endif %}"
hx-get="{% if request.dealer %}{% url 'manager_dashboard' %}{% else %}{% url 'sales_dashboard' %}{% endif %}"
hx-trigger="load"
hx-target="#dashboard-content"
hx-swap="innerHTML"

View File

@ -255,7 +255,7 @@
async function get_data(){
console.log('{{ request.user }}');
const response = await fetch("{% url 'entity-json-net-receivables' request.user.dealer.entity.slug %}");
const response = await fetch("{% url 'entity-json-net-receivables' request.dealer.entity.slug %}");
data = await response.json();
console.log(data);
const keys = Object.keys(data.results.net_receivable_data);
@ -269,9 +269,9 @@
const end_date = document.getElementById('endDate').value;
let url = ''
if(!start_date || !end_date){
url = "{% url 'entity-json-pnl' request.user.dealer.entity.slug %}";
url = "{% url 'entity-json-pnl' request.dealer.entity.slug %}";
}else{
url = `{% url 'entity-json-pnl' request.user.dealer.entity.slug %}?fromDate=${start_date}&toDate=${end_date}`;
url = `{% url 'entity-json-pnl' request.dealer.entity.slug %}?fromDate=${start_date}&toDate=${end_date}`;
}
try {
const response = await fetch(url);

View File

@ -11,13 +11,17 @@
<li class="list-group-item"><strong>{% trans "Address" %}:</strong> {{ organization.address }}</li>
</ul>
<div class="d-flex">
{% if perms.inventory.change_organization%}
<a href="{% url 'organization_update' request.dealer.slug organization.slug %}" class="btn btn-sm btn-phoenix-primary me-2"><span class="fas fa-edit me-1"></span>{% trans "Edit" %}</a>
{% endif %}
{% if perms.inventory.delete_organization%}
<button class="btn btn-phoenix-danger btn-sm delete-btn"
data-url="{% url 'organization_delete' request.dealer.slug organization.slug %}"
data-message="Are you sure you want to delete this organization?"
data-bs-toggle="modal" data-bs-target="#deleteModal">
<i class="fas fa-trash me-1"></i> {% trans 'Delete' %}
</button>
{% endif %}
</div>
</div>
{% include 'modal/delete_modal.html' %}

View File

@ -16,7 +16,7 @@
<div class="row g-3 justify-content-between mb-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
{% if perms.django_ledger.add_customermodel %}
{% if perms.inventory.add_organization%}
<div>
<a href="{% url 'organization_create' request.dealer.slug %}" class="btn btn-sm btn-phoenix-primary"><span class="fas fa-plus me-2"></span>{% trans 'add organization'|capfirst %}</a>
</div>
@ -106,17 +106,20 @@
<td class="company align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 border-end border-translucent fw-semibold text-body-highlight">{{ org.address }}</td>
<td class="date align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 text-body-tertiary">{{ org.created|date }}</td>
<td class="align-middle white-space-nowrap text-end pe-0 ps-4">
{% if perms.django_ledger.change_customermodel %}
{% if perms.inventory.change_organization or perms.inventory.delete_organization%}
<div class="btn-reveal-trigger position-static">
<button class="btn btn-sm dropdown-toggle dropdown-caret-none transition-none btn-reveal fs-10" type="button" data-bs-toggle="dropdown" data-boundary="window" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"><span class="fas fa-ellipsis-h fs-10"></span></button>
<div class="dropdown-menu dropdown-menu-end py-2">
{% if perms.inventory.change_organization %}
<a href="{% url 'organization_update' request.dealer.slug org.slug %}" class="dropdown-item text-success-dark">{% trans 'Edit' %}</a>
{% if perms.django_ledger.delete_customermodel %}
{% endif %}
{% if perms.inventory.delete_organization %}
<div class="dropdown-divider"></div><button class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">{% trans 'Delete' %}</button>
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}

View File

@ -114,14 +114,14 @@
<label class="form-label" for="phone">{{ _("Phone Number")}}</label>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-phone"></i></span>
<input type="text" name="phone" id="phone" class="form-control form-control-sm" dir="ltr" placeholder="{{ _("Phone Number")}}" value="{{ request.user.dealer.phone_number.raw_input }}" required>
<input type="text" name="phone" id="phone" class="form-control form-control-sm" dir="ltr" placeholder="{{ _("Phone Number")}}" value="{{ request.dealer.phone_number.raw_input }}" required>
</div>
</div>
<div class="col-md-6">
<label class="form-label" for="company">{{ _("Company") }}</label>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-building"></i></span>
<input type="text" name="company" id="company" class="form-control form-control-sm" placeholder="{{ _("Company") }}" value="{{ request.user.dealer.get_local_name }}">
<input type="text" name="company" id="company" class="form-control form-control-sm" placeholder="{{ _("Company") }}" value="{{ request.dealer.get_local_name }}">
</div>
</div>
</div>

View File

@ -161,7 +161,9 @@
</div>
<div class="card-footer bg-light">
{% if perms.django_ledger.change_purchaseordermodel%}
<div class="d-flex flex-wrap gap-2 justify-content-between">
<a href="{% url 'purchase_order_update' dealer_slug=request.dealer.slug entity_slug=entity_slug po_pk=po_model.pk %}"
class="btn btn-phoenix-primary">
<i class="fas fa-edit me-2"></i>{% trans 'Update' %}
@ -200,10 +202,12 @@
{# Danger Action Buttons #}
{% if po_model.can_delete %}
{% if perms.django_ledger.delete_purchaseordermodel%}
<button class="btn btn-outline-danger"
onclick="showPOModal('Delete PO', '{% url 'po-delete' request.dealer.slug entity_slug po_model.pk %}', 'Delete')">
<i class="fas fa-ban me-2"></i>{% trans 'Delete' %}
</button>
{% endif %}
{% endif %}
{% if po_model.can_void %}
@ -222,10 +226,12 @@
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
{% else %}
{% if perms.django_ledger.add_purchaseordermodel%}
<div class="card border-0 shadow-sm text-center py-5">
<div class="card-body">
<a href="{% url 'purchase_order_create' request.dealer.slug request.dealer.entity.slug %}" class="text-decoration-none">
@ -234,4 +240,5 @@
</a>
</div>
</div>
{% endif %}
{% endif %}

View File

@ -21,6 +21,7 @@
<th style="min-width: 600px;" class="d-flex justify-content-between align-items-center">
{% trans 'Item' %}
{% if po_model.is_draft %}
<button type="button"
class="btn btn-sm btn-phoenix-success"
data-bs-toggle="modal"
@ -65,18 +66,23 @@
<span class="currency">{{CURRENCY}}</span>{{ f.instance.po_total_amount | currency_format }}</td>
<td>{{ f.po_item_status|add_class:"form-control" }}</td>
{% if itemtxs_formset.can_delete %}
<td class="text-center">
{{ f.DELETE|add_class:"form-check-input" }}
</td>
{% endif %}
<td class="text-center">
{% if f.instance.can_create_bill %}
{% if perms.djagno_ledger.add_billmodel%}
{{ f.create_bill|add_class:"form-check-input" }}
{% endif %}
{% elif f.instance.bill_model %}
{% if perms.djagno_ledger.view_billmodel%}
<a class="btn btn-sm btn-phoenix-secondary"
href="{% url 'bill-detail' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=f.instance.bill_model_id %}">
{% trans 'View Bill' %}
</a>
{% endif %}
{% endif %}
</td>
<td class="text-center">

View File

@ -18,10 +18,14 @@
<h3 class="">
{{ _("Purchase Orders") |capfirst }}
</h2>
{% if perms.django_ledger.add_purchaseordermodel%}
<div>
<a href="{% url 'purchase_order_create' request.dealer.slug request.dealer.entity.slug %}"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{{ _("Create New PO") }}</a>
{% if perms.django_ledger.add_purchaseordermodel %}
<a href="{% url 'purchase_order_create' request.dealer.slug request.dealer.entity.slug %}"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{{ _("Create New PO") }}</a>
{% endif %}
</div>
{% endif %}
</div>
{% include "partials/search_box.html" %}
@ -65,9 +69,13 @@
<div class="btn-reveal-trigger position-static">
<button class="btn btn-sm dropdown-toggle dropdown-caret-none transition-none btn-reveal fs-10" type="button" data-bs-toggle="dropdown" data-boundary="window" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"><span class="fas fa-ellipsis-h fs-10"></span></button>
<div class="dropdown-menu dropdown-menu-end py-2">
<a href="{% url 'purchase_order_detail' request.dealer.slug request.dealer.entity.slug po.pk %}" class="dropdown-item text-success-dark">{% trans 'Purchase Order Detail' %}</a>
{% if perms.django_ledger.change_purchaseordermodel %}
<a href="{% url 'purchase_order_detail' request.dealer.slug request.dealer.entity.slug po.pk %}" class="dropdown-item text-success-dark">{% trans 'Purchase Order Detail' %}</a>
{% endif %}
{% if po.po_status == 'fulfilled' %}
{% if perms.inventory.add_car %}
<a href="{% url 'view_items_inventory' dealer_slug=request.dealer.slug entity_slug=entity_slug po_pk=po.pk %}" class="dropdown-item text-success-dark">{% trans 'Add Inventory Items' %}</a>
{% endif %}
{% else %}
<button class="dropdown-item text-warning-dark" disabled><span class="fas fa-exclamation-triangle me-1"></span> Fulfill the PO Before Viewing Inventory</button>
{% endif %}

View File

@ -75,35 +75,41 @@
</div>
</div>
<div class="d-flex align-items-center gap-2">
{% if estimate.status == 'draft' %}
{% if perms.django_ledger.change_estimatemodel %}
<button id="mark_as_sent_estimate" class="btn btn-phoenix-secondary" onclick="setFormAction('review')" data-bs-toggle="modal" data-bs-target="#confirmModal"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-check-double"></i> {% trans 'Mark As Review' %}</span></button>
{% endif %}
{% elif estimate.status == 'in_review' %}
{% if perms.django_ledger.can_approve_estimatemodel %}
<button id="accept_estimate" onclick="setFormAction('approved')" class="btn btn-phoenix-secondary" data-bs-toggle="modal" data-bs-target="#confirmModal"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-check-double"></i> {% trans 'Mark As Accept' %}</span></button>
<button id="accept_estimate" onclick="setFormAction('approved')" class="btn btn-phoenix-secondary" data-bs-toggle="modal" data-bs-target="#confirmModal"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-check-double"></i> {% trans 'Mark As Approved' %}</span></button>
{% endif %}
{% elif estimate.status == 'approved' %}
<a href="{% url 'send_email' request.dealer.slug estimate.pk %}" class="btn btn-phoenix-primary me-2"><span class="fa-regular fa-paper-plane me-sm-2"></span><span class="d-none d-sm-inline-block">{% trans 'Send Quotation' %}</span></a>
{% elif estimate.status == 'approved' %}
{% if perms.django_ledger.change_estimatemodel %}
<a href="{% url 'send_email' request.dealer.slug estimate.pk %}" class="btn btn-phoenix-primary me-2"><span class="fa-regular fa-paper-plane me-sm-2"></span><span class="d-none d-sm-inline-block">{% trans 'Send Quotation' %}</span></a>
{% endif %}
{% if estimate.sale_orders.first %}
<!--if sale order exist-->
{% if perms.djagno_ledger.add_invoice %}
{% if perms.django_ledger.add_invoicemodel %}
<a href="{% url 'invoice_create' request.dealer.slug estimate.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-receipt"></i> {% trans 'Create Invoice' %}</span></a>
{% endif %}
{% endif %}
{% if perms.inventory.view_saleorder%}
<a href="{% url 'order_detail' request.dealer.slug estimate.sale_orders.first.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block">{{ _("Preview Sale Order") }}</span></a>
{% endif %}
{% else %}
{% if perms.inventory.add_saleorder%}
<a href="{% url 'create_sale_order' request.dealer.slug estimate.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-file-import"></i> {% trans 'Create Sale Order' %}</span></a>
{% comment %} {% endcomment %}
{% endif %}
{% endif %}
{% elif estimate.status == 'completed' %}
{% if perms.inventory.view_saleorder%}
<a href="{% url 'order_detail' request.dealer.slug estimate.sale_orders.first.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block">{{ _("Preview Sale Order") }}</span></a>
{% endif %}
{% if perms.django_ledger.view_invoicemodel %}
<a href="{% url 'invoice_detail' request.dealer.slug estimate.invoicemodel_set.first.pk %}" class="btn btn-phoenix-primary btn-sm" type="button"><i class="fa-solid fa-receipt"></i>
{{ _("View Invoice")}}</a>
{% endif %}
{% endif %}
{% if estimate.can_cancel %}

View File

@ -20,31 +20,31 @@
</tr>
</thead>
<tbody class="list">
{% for estimate in estimates %}
{% for extra in staff_estimates %}
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="align-middle product white-space-nowrap py-0 px-1">{{ estimate.estimate_number }}</td>
<td class="align-middle product white-space-nowrap">{{ estimate.customer.customer_name }}</td>
<td class="align-middle product white-space-nowrap py-0 px-1">{{ extra.content_object.estimate_number }}</td>
<td class="align-middle product white-space-nowrap">{{ extra.content_object.customer.customer_name }}</td>
<td class="align-middle product white-space-nowrap">
{% if estimate.status == 'draft' %}
{% if extra.content_object.status == 'draft' %}
<span class="badge badge-phoenix badge-phoenix-warning">{% trans "Draft" %}</span>
{% elif estimate.status == 'in_review' %}
{% elif extra.content_object.status == 'in_review' %}
<span class="badge badge-phoenix badge-phoenix-info">{% trans "In Review" %}</span>
{% elif estimate.status == 'approved' %}
{% elif extra.content_object.status == 'approved' %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Approved" %}</span>
{% elif estimate.status == 'declined' %}
{% elif extra.content_object.status == 'declined' %}
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Declined" %}</span>
{% elif estimate.status == 'canceled' %}
{% elif extra.content_object.status == 'canceled' %}
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Canceled" %}</span>
{% elif estimate.status == 'completed' %}
{% elif extra.content_object.status == 'completed' %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Completed" %}</span>
{% elif estimate.status == 'void' %}
{% elif extra.content_object.status == 'void' %}
<span class="badge badge-phoenix badge-phoenix-secondary">{% trans "Void" %}</span>
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">{{ estimate.get_status_action_date }}</td>
<td class="align-middle product white-space-nowrap">{{ estimate.created }}</td>
<td class="align-middle product white-space-nowrap">{{ extra.content_object.get_status_action_date }}</td>
<td class="align-middle product white-space-nowrap">{{ extra.content_object.created }}</td>
<td class="align-middle product white-space-nowrap">
<a href="{% url 'estimate_detail' request.dealer.slug estimate.pk %}"
<a href="{% url 'estimate_detail' request.dealer.slug extra.content_object.pk %}"
class="btn btn-sm btn-phoenix-success">
<i class="fa-regular fa-eye me-1"></i>
{% trans "view"|capfirst %}

View File

@ -86,12 +86,12 @@
<button id="accept_invoice" class="btn btn-phoenix-secondary" data-bs-toggle="modal" data-bs-target="#confirmModal"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-check-double"></i> {% trans 'Accept' %}</span></button>
{% endif %}
{% if invoice.invoice_status == 'approved' %}
<a href="{% url 'payment_create' request.user.dealer.slug invoice.pk %}" class="btn btn-phoenix-success"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-money-bill"></i> {% trans 'Record Payment' %}</span></a>
<a href="{% url 'payment_create' request.dealer.slug invoice.pk %}" class="btn btn-phoenix-success"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-money-bill"></i> {% trans 'Record Payment' %}</span></a>
{% endif %}
{% if not invoice.is_paid %}
<button {% if invoice.is_review or invoice.amount_paid|to_int < invoice.amount_due|to_int %}disabled{% endif %} id="mark_invoice_as_paid" class="btn btn-phoenix-secondary" data-bs-toggle="modal" data-bs-target="#mark_as_paid_Modal"><span class="d-none d-sm-inline-block"><span class="icon-saudi_riyal"></span> {% trans 'Mark as Paid' %}</span></button>
{% endif %}
<a href="{% url 'invoice_preview' request.user.dealer.slug invoice.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block"><i class="fa-regular fa-eye"></i> {% trans 'Preview' %}</span></a>
<a href="{% url 'invoice_preview' request.dealer.slug invoice.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block"><i class="fa-regular fa-eye"></i> {% trans 'Preview' %}</span></a>
</div>
</div>
{{invoice.amount_owned}}