margin fix
This commit is contained in:
parent
4815ae4f6a
commit
e9ee330162
@ -589,7 +589,7 @@ class AdditionalServices(models.Model, LocalizedNameMixin):
|
||||
verbose_name_plural = _("Additional Services")
|
||||
|
||||
def __str__(self):
|
||||
return self.name + " - " + str(self.price)
|
||||
return self.name + " - " + str(self.price_)
|
||||
|
||||
|
||||
class Car(Base):
|
||||
|
||||
@ -4446,7 +4446,9 @@ class EstimateListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
related_content_type=ContentType.objects.get_for_model(models.Staff),
|
||||
related_object_id=self.request.staff.pk,
|
||||
)
|
||||
context["staff_estimates"] = qs
|
||||
# context["staff_estimates"] = qs
|
||||
print(qs)
|
||||
context["staff_estimates"] = EstimateModel.objects.filter(pk__in=[x.content_object.pk for x in qs])
|
||||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
@ -4457,6 +4459,7 @@ class EstimateListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
if status:
|
||||
queryset = queryset.filter(status=status)
|
||||
search_query = self.request.GET.get('q', None)
|
||||
|
||||
if search_query:
|
||||
queryset = queryset.filter(
|
||||
Q(estimate_number__icontains=search_query)
|
||||
@ -4821,7 +4824,7 @@ def create_sale_order(request, dealer_slug, pk):
|
||||
estimate.save()
|
||||
for item in estimate.get_itemtxs_data()[0].all():
|
||||
try:
|
||||
item.item_model.additional_info["car_info"]["status"] = "sold"
|
||||
# item.item_model.additional_info["car_info"]["status"] = "sold"
|
||||
item.item_model.save()
|
||||
logger.debug(
|
||||
f"Car status updated to 'sold' for item.item_model PK: {getattr(item.item_model, 'pk', 'N/A')}."
|
||||
@ -7170,8 +7173,8 @@ class ItemServiceCreateView(
|
||||
dealer = get_user_type(self.request)
|
||||
vat = models.VatRate.objects.get(dealer=dealer, is_active=True)
|
||||
form.instance.dealer = dealer
|
||||
if form.instance.taxable:
|
||||
form.instance.price = (form.instance.price * vat.rate) + form.instance.price
|
||||
# if form.instance.taxable:
|
||||
# form.instance.price = (form.instance.price * vat.rate) + form.instance.price
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
@ -7219,8 +7222,8 @@ class ItemServiceUpdateView(
|
||||
dealer = get_user_type(self.request)
|
||||
vat = models.VatRate.objects.get(dealer=dealer, is_active=True)
|
||||
form.instance.dealer = dealer
|
||||
if form.instance.taxable:
|
||||
form.instance.price = (form.instance.price * vat.rate) + form.instance.price
|
||||
# if form.instance.taxable:
|
||||
# form.instance.price = (form.instance.price * vat.rate) + form.instance.price
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
rel="stylesheet"
|
||||
id="user-style-default">
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script src="{% static 'js/main.js' %}"></script>
|
||||
<script src="{% static 'js/jquery.min.js' %}"></script>
|
||||
@ -82,7 +83,7 @@
|
||||
{% include "plans/expiration_messages.html" %}
|
||||
{% block period_navigation %}
|
||||
{% endblock period_navigation %}
|
||||
<div id="main_content" class="fade-me-in" hx-boost="false" hx-target="#main_content" hx-select="#main_content" hx-swap="outerHTML transition:true" hx-select-oob="#toast-container" hx-history-elt>
|
||||
<div id="main_content" class="fade-me-in" hx-boost="true" hx-target="#main_content" hx-select="#main_content" hx-swap="outerHTML transition:true" hx-select-oob="#toast-container" hx-history-elt>
|
||||
<div id="spinner" class="htmx-indicator spinner-bg">
|
||||
<img src="{% static 'spinner.svg' %}" width="100" height="100" alt="">
|
||||
</div>
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-0 g-md-4 g-xl-6">
|
||||
<div class="row g-0 g-md-4 g-xl-6 mb-3">
|
||||
<div class="col-md-5 col-lg-5 col-xl-4">
|
||||
<div class="sticky-leads-sidebar">
|
||||
<div class="lead-details" data-breakpoint="md">
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{% endblock title %}
|
||||
{% block content %}
|
||||
<div class="row my-4">
|
||||
<h2>{{ organization.get_local_name }}</h2>
|
||||
<h2 class="mb-2">{{ organization.get_local_name }}</h2>
|
||||
<ul class="list-group mb-4">
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "CRN" %}:</strong> {{ organization.crn }}
|
||||
|
||||
@ -250,12 +250,7 @@
|
||||
<td class="align-middle text-body-tertiary fw-semibold">{{ item.total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr class="bg-body-secondary total-sum">
|
||||
<td class="align-middle ps-4 fw-semibold text-body-highlight" colspan="7">{% trans "Vat" %} ({{ data.vat }})</td>
|
||||
<td class="align-middle text-start fw-semibold">
|
||||
<span id="grand-total">+ {{ data.total_vat_amount|floatformat }}<span class="icon-saudi_riyal"></span></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="bg-body-secondary total-sum">
|
||||
<td class="align-middle ps-4 fw-semibold text-body-highlight" colspan="7">{% trans "Discount Amount" %}</td>
|
||||
<td class="align-middle text-start text-danger fw-semibold">
|
||||
@ -275,6 +270,12 @@
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bg-body-secondary total-sum">
|
||||
<td class="align-middle ps-4 fw-semibold text-body-highlight" colspan="7">{% trans "Vat" %} ({{ data.vat }})</td>
|
||||
<td class="align-middle text-start fw-semibold">
|
||||
<span id="grand-total">+ {{ data.total_vat_amount|floatformat }}<span class="icon-saudi_riyal"></span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bg-body-secondary total-sum">
|
||||
<td class="align-middle ps-4 fw-semibold text-body-highlight" colspan="7">{% trans "Additional Services" %}</td>
|
||||
<td class="align-middle text-start fw-semibold">
|
||||
|
||||
@ -30,31 +30,31 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list">
|
||||
{% for extra in staff_estimates %}
|
||||
{% for estimate 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">{{ 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 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">
|
||||
{% if extra.content_object.status == 'draft' %}
|
||||
{% if estimate.status == 'draft' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-warning">{% trans "Draft" %}</span>
|
||||
{% elif extra.content_object.status == 'in_review' %}
|
||||
{% elif estimate.status == 'in_review' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-info">{% trans "In Review" %}</span>
|
||||
{% elif extra.content_object.status == 'approved' %}
|
||||
{% elif estimate.status == 'approved' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Approved" %}</span>
|
||||
{% elif extra.content_object.status == 'declined' %}
|
||||
{% elif estimate.status == 'declined' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Declined" %}</span>
|
||||
{% elif extra.content_object.status == 'canceled' %}
|
||||
{% elif estimate.status == 'canceled' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Canceled" %}</span>
|
||||
{% elif extra.content_object.status == 'completed' %}
|
||||
{% elif estimate.status == 'completed' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Completed" %}</span>
|
||||
{% elif extra.content_object.status == 'void' %}
|
||||
{% elif estimate.status == 'void' %}
|
||||
<span class="badge badge-phoenix badge-phoenix-secondary">{% trans "Void" %}</span>
|
||||
{% endif %}
|
||||
</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">{{ 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">
|
||||
<a href="{% url 'estimate_detail' request.dealer.slug extra.content_object.pk %}"
|
||||
<a href="{% url 'estimate_detail' request.dealer.slug estimate.pk %}"
|
||||
class="btn btn-sm btn-phoenix-success">
|
||||
<i class="fa-regular fa-eye me-1"></i>
|
||||
{% trans "view"|capfirst %}
|
||||
|
||||
@ -3,206 +3,23 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
<h1>{% trans 'Sale Order' %}</h1>
|
||||
{% endblock %}
|
||||
{{ _("Sale Order") }}
|
||||
{% endblock title %}
|
||||
{% block content %}
|
||||
<link rel="stylesheet" href="{% static 'flags/sprite.css' %}" />
|
||||
<div class="row">
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-6 col-md-8">
|
||||
<div class="d-sm-flex justify-content-between">
|
||||
<h3 class="mb-3">
|
||||
{% if customer.created %}
|
||||
{{ _('Edit Sale Order') }}
|
||||
{% else %}
|
||||
{{ _('Add Sale Order') }}
|
||||
{% endif %}
|
||||
<span class="fas fa-shopping-cart text-primary ms-2"></span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-xl-12 col-xxl-12">
|
||||
<div class="px-xl-12">
|
||||
<div class="row mx-0 mx-sm-3 mx-lg-0 px-lg-0">
|
||||
<div class="col-sm-12 col-xxl-6 py-3">
|
||||
<table class="w-100 table-stats ">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
<div class="d-inline-flex align-items-center">
|
||||
<div class="d-flex bg-success-subtle rounded-circle flex-center me-3" style="width:24px; height:24px">
|
||||
<span class="text-success-dark" data-feather="user" style="width:16px; height:16px"></span>
|
||||
</div>
|
||||
<p class="fw-bold mb-0">{{ _("Customer Name")}}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 d-none d-sm-block pe-sm-2">:</td>
|
||||
<td class="py-2">
|
||||
<p class="ps-6 ps-sm-0 fw-semibold mb-0 mb-0 pb-3 pb-sm-0">{{ estimate.customer.customer_name }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="d-flex bg-success-subtle rounded-circle flex-center me-3" style="width:24px; height:24px">
|
||||
<span class="text-success-dark" data-feather="mail" style="width:16px; height:16px"></span>
|
||||
</div>
|
||||
<p class="fw-bold mb-0">{{ _("Email") }}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 d-none d-sm-block pe-sm-2">:</td>
|
||||
<td class="py-2">
|
||||
<p class="ps-6 ps-sm-0 fw-semibold mb-0">{{ estimate.customer.email }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="d-flex bg-success-subtle rounded-circle flex-center me-3" style="width:24px; height:24px">
|
||||
<span class="text-success-dark" data-feather="map-pin" style="width:16px; height:16px"></span>
|
||||
</div>
|
||||
<p class="fw-bold mb-0">{{ _("Address") }}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 d-none d-sm-block pe-sm-2">:</td>
|
||||
<td class="py-2">
|
||||
<p class="ps-6 ps-sm-0 fw-semibold mb-0">{{ estimate.customer.address_1 }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="d-flex bg-success-subtle rounded-circle flex-center me-3" style="width:24px; height:24px">
|
||||
<span class="text-success-dark" data-feather="trending-down" style="width:16px; height:16px"></span>
|
||||
</div>
|
||||
<p class="fw-bold mb-0">{{ _("Total Discount")}}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 d-none d-sm-block pe-sm-2">:</td>
|
||||
<td class="py-2">
|
||||
<p class="ps-6 ps-sm-0 fw-semibold mb-0">{{ data.total_discount }} <span class="icon-saudi_riyal"></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="d-flex bg-success-subtle rounded-circle flex-center me-3" style="width:24px; height:24px">
|
||||
<span class="text-success-dark" data-feather="briefcase" style="width:16px; height:16px"></span>
|
||||
</div>
|
||||
<p class="fw-bold mb-0">{{ _("Total Amount")}}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 d-none d-sm-block pe-sm-2">:</td>
|
||||
<td class="py-2">
|
||||
<p class="ps-6 ps-sm-0 fw-semibold mb-0">{{ data.grand_total }} <span class="icon-saudi_riyal"></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="border-top border-bottom border-translucent mt-10" id="leadDetailsTable">
|
||||
<div class="table-responsive scrollbar mx-n1 px-1">
|
||||
<table class="table fs-9 mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="white-space-nowrap fs-9 align-middle ps-0" style="width:26px;">
|
||||
<div class="form-check mb-0 fs-8">
|
||||
<input class="form-check-input" type="checkbox" />
|
||||
</div>
|
||||
</th>
|
||||
<th class="sort white-space-nowrap align-middle pe-3 ps-0 text-uppercase" scope="col" data-sort="name" style="width:20%; min-width:100px">
|
||||
{{ _("VIN") }}</th>
|
||||
<th class="sort align-middle pe-6 text-uppercase" scope="col" data-sort="description" style="width:20%; max-width:60px">
|
||||
{{ _("Make") }}</th>
|
||||
<th class="sort align-middle text-start text-uppercase" scope="col" data-sort="create_date" style="width:20%; min-width:115px">
|
||||
{{ _("Model") }}</th>
|
||||
<th class="sort align-middle text-start text-uppercase" scope="col" data-sort="create_by" style="width:20%; min-width:150px">
|
||||
{{ _("Year") }}</th>
|
||||
<th class="sort align-middle text-start text-uppercase" scope="col" data-sort="create_by" style="width:20%; min-width:150px">
|
||||
{{ _("Unit Price")}}</th>
|
||||
<th class="align-middle pe-0 text-end" scope="col" style="width:15%;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list" id="lead-details-table-body">
|
||||
{% for car in data.cars %}
|
||||
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
|
||||
<td class="fs-9 align-middle px-0 py-3">
|
||||
<div class="form-check mb-0 fs-8">
|
||||
<input class="form-check-input" type="checkbox" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="name align-middle white-space-nowrap py-2 ps-0">
|
||||
<a class="d-flex align-items-center text-body-highlight" href="#!">
|
||||
{% comment %} <div class="avatar avatar-m me-3 status-online">
|
||||
<img class="rounded-circle" src="" alt="" />
|
||||
</div> {% endcomment %}
|
||||
<h6 class="mb-0 text-body-highlight fw-bold">{{ car.vin }}</h6>
|
||||
</a>
|
||||
</td>
|
||||
<td class="description align-middle white-space-nowrap text-start fw-bold text-body-tertiary py-2 pe-6">
|
||||
{{ car.make }}
|
||||
</td>
|
||||
<td class="create_by align-middle white-space-nowrap fw-semibold text-body-highlight">{{ car.model }}</td>
|
||||
<td class="create_by align-middle white-space-nowrap fw-semibold text-body-highlight">{{ car.year }}</td>
|
||||
<td class="last_activity align-middle text-center py-2">
|
||||
<div class="d-flex align-items-center flex-1">
|
||||
<span class="fw-bold fs-9 text-body">{{ car.total }} <span class="icon-saudi_riyal"></span></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mx-0">
|
||||
<form method="post" class="form row g-3 needs-validation" novalidate>
|
||||
<div class="row">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ _("Sale Order") }}</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{% url 'create_sale_order' request.dealer.slug estimate.pk %}">
|
||||
{% csrf_token %}
|
||||
<div class="col-md-6">
|
||||
<label for="id_estimate" class="form-label">{% trans "Quotation" %}</label>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
id="id_estimate"
|
||||
name="estimate"
|
||||
value="{{ form.estimate.value|default_if_none:'' }}"
|
||||
readonly>
|
||||
<div class="invalid-feedback">{% trans "Please provide an estimate." %}</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="id_payment_method" class="form-label">{% trans "Payment Method" %}</label>
|
||||
<select class="form-select form-select-sm"
|
||||
id="id_payment_method"
|
||||
name="payment_method"
|
||||
required>
|
||||
{% for value, label in form.payment_method.field.choices %}
|
||||
<option value="{{ value }}"
|
||||
{% if form.payment_method.value == value %}selected{% endif %}>{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="invalid-feedback">{% trans "Please select a payment method." %}</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="id_comments" class="form-label">{% trans "Comments" %}</label>
|
||||
<textarea class="form-control" id="id_comments" name="comments" rows="3">{{ form.comments.value|default_if_none:'' }}</textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button class="btn btn-phoenix-primary" type="submit">{% trans 'Save' %}</button>
|
||||
</div>
|
||||
{{ form|crispy }}
|
||||
<button type="submit" class="btn btn-phoenix-primary">{% trans 'Save' %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
{% endblock content %}
|
||||
{% endblock content %}
|
||||
Loading…
x
Reference in New Issue
Block a user