This commit is contained in:
Faheedkhan 2025-07-31 13:53:00 +03:00
parent 08687340a3
commit 499de137ba
6 changed files with 16 additions and 16 deletions

View File

@ -1032,7 +1032,7 @@ def po_fullfilled_notification(sender, instance, created, **kwargs):
).format(
url=reverse(
"purchase_order_detail",
kwargs={"dealer_slug": dealer.slug, "pk": instance.pk},
kwargs={"dealer_slug": dealer.slug,"entity_slug":instance.entity.slug, "pk": instance.pk},
),
),
)

View File

@ -4798,6 +4798,7 @@ class EstimateDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView
finance_data = calculator.get_finance_data()
invoice_obj = InvoiceModel.objects.all().filter(ce_model=estimate).first()
kwargs["data"] = finance_data
print(kwargs["data"])
kwargs["invoice"] = invoice_obj
try:
car_finances = estimate.get_itemtxs_data()[0].first().item_model.car.finances

View File

@ -84,7 +84,7 @@
{% include "plans/expiration_messages.html" %}
{% block period_navigation %}
{% endblock period_navigation %}
<div id="main_content" class="fade-me-in" hx-boost="true" hx-target="#main_content" hx-select="#main_content" hx-swap="innerHTML transition:true" hx-select-oob="#toast-container" hx-history-elt>
<div id="main_content" class="fade-me-in" hx-boost="false" hx-target="#main_content" hx-select="#main_content" hx-swap="innerHTML 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>

View File

@ -178,9 +178,9 @@
<div class="d-flex flex-wrap justify-content-between mb-2">
<h5 class="mb-0 text-body-highlight me-2">{{ _("Invoice") }}</h5>
</div>
{% if opportunity.estimate.invoice %}
{% if opportunity.estimate.invoicemodel_set.all %}
<a class="dropdown-item"
href="{% url 'invoice_detail' request.dealer.slug request.entity.slug opportunity.estimate.invoice.pk %}">{{ _("View Invoice") }}</a>
href="{% url 'invoice_detail' request.dealer.slug request.entity.slug opportunity.estimate.invoicemodel_set.first.pk %}">{{ _("View Invoice") }}</a>
{% else %}
<p>{{ _("No Invoice") }}</p>
{% endif %}
@ -1020,7 +1020,7 @@
</div>
<div class="tab-pane fade"
id="tab-activity"
hx-get="{% url 'lead_detail' request.dealer.slug lead.slug %}"
hx-get="{% url 'opportunity_detail' request.dealer.slug opportunity.slug %}"
hx-trigger="htmx:afterRequest from:"
hx-select="#tab-activity"
hx-target="this"

View File

@ -240,7 +240,9 @@
<tbody>
{% for item in data.cars %}
<tr>
<td class="align-middle"></td>
<td class="align-middle">
<img src="{{item.logo}}" width="40" height="40" class="ps-2"></img>
</td>
<td class="align-middle">{{ item.make }}</td>
<td class="align-middle">{{ item.model }}</td>
<td class="align-middle">{{ item.year }}</td>
@ -273,7 +275,7 @@
<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>
<span id="">+ {{ data.total_vat_amount }}<span class="icon-saudi_riyal"></span></span>
</td>
</tr>
<tr class="bg-body-secondary total-sum">
@ -336,19 +338,14 @@
{% endblock %}
{% block customJS %}
<script>
// Initialize when page loads and after HTMX swaps
// Initialize when page loads and after HTMX swaps
document.addEventListener('DOMContentLoaded', initEstimateFunctions);
document.addEventListener('htmx:afterSwap', initEstimateFunctions);
function initEstimateFunctions() {
// Initialize calculateTotals if estimate table exists
const estimateTable = document.getElementById('estimate-table');
if (estimateTable) {
calculateTotals();
// Optional: If you need to recalculate when table content changes
estimateTable.addEventListener('change', calculateTotals);
}
// Initialize form action setter if form exists
const confirmForm = document.getElementById('confirmForm');
@ -359,6 +356,7 @@ function initEstimateFunctions() {
button.addEventListener('click', setFormActionHandler);
});
}
htmx.process(confirmForm)
}
function calculateTotals() {
@ -412,6 +410,7 @@ function setFormActionHandler(event) {
function setFormAction(action) {
const form = document.getElementById('confirmForm');
htmx.process(form)
if (!form) return;
const baseUrl = "{% url 'estimate_mark_as' request.dealer.slug estimate.pk %}";

View File

@ -10,7 +10,7 @@
<div class="col-lg-8 col-md-10">
<div class="card shadow-sm border-0 rounded-3">
<div class="card-header bg-gray-200 py-3 border-0 rounded-top-3">
<h3 class="mb-0 fs-4 text-center text-white">
<h3 class="mb-0 fs-4 text-center">
{{ _("Add Invoice") }}<i class="fa-solid fa-receipt ms-2 text-primary"></i>
</h3>
</div>