haikal/templates/sales/quotation_detail.html
Marwan Alwali b6486bb657 update
2024-12-25 17:51:07 +03:00

159 lines
7.4 KiB
HTML

{% extends "base.html" %}
{% load custom_filters %}
{% load i18n %}
{% block content %}
<!-- Confirm Modal -->
<div class="modal fade" id="confirmModal" tabindex="-1" aria-labelledby="confirmModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header bg-primary">
<h5 class="modal-title text-light" id="confirmModalLabel">{% trans 'Confirm' %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% trans 'Are you sure' %}
<div class="modal-footer">
<button type="button"
class="btn btn-sm btn-danger"
data-bs-dismiss="modal">
{% trans 'No' %}
</button>
<form method="POST" action="{% url 'confirm_quotation' quotation.id %}" class="d-inline">
{% csrf_token %}
<button type="submit" class="btn btn-success btn-sm">{% trans "Yes" %}</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="card" id="quotation-html">
<div class="card-header">
<h4>{% trans "Quotation Details" %} - {{ quotation.display_quotation_number }}</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h5>{% trans "Customer Details" %}</h5>
<p>
<strong>{% trans "Name" %}:</strong>
{{ quotation.customer.get_full_name }}</p>
<p><strong>{% trans "Address" %}:</strong> {{ quotation.customer.address }}</p>
<p><strong>{% trans "VAT No" %}:</strong> {{ quotation.customer.vat_number }}</p>
</div>
<div class="col-md-6">
<h5>{% trans "Quotation Information" %}</h5>
<p><strong>{% trans "Quotation No" %}:</strong> {{ quotation.display_quotation_number }}</p>
<p><strong>{% trans "Date" %}:</strong> {{ quotation.created_at|date }}</p>
<p><strong>{% trans "Remarks" %}:</strong> {{ quotation.remarks }}</p>
<p><strong>{% trans "Status" %}:</strong>
{% if quotation.status == 'Draft' %}
<span class="badge rounded-pill bg-secondary">{{ quotation.status|capfirst }}</span>
{% elif quotation.status == 'In Review' %}
<span class="badge rounded-pill bg-warning">{{ quotation.status|capfirst }}</span>
{% elif quotation.status == 'Approved' %}
<span class="badge rounded-pill bg-info">{{ quotation.status|capfirst }}</span>
{% elif quotation.status == 'Paid' %}
<span class="badge rounded-pill bg-success"><i class="fas fa-check"></i>{{ quotation.status|capfirst }}</span>
{% endif %}
</p>
</div>
</div>
<h5 class="mt-4">{% trans "Car Details" %}</h5>
<table class="table table-bordered">
<thead>
<tr>
<th>{% trans "VIN" %}</th>
<th>{% trans "Model" %}</th>
<th>{% trans "Year" %}</th>
<th>{% trans "Quantity" %}</th>
<th>{% trans "Price" %}</th>
<th>{% trans "VAT" %}</th>
<th>{% trans "Total" %}</th>
</tr>
</thead>
<tbody>
{% for item in quotation.quotation_cars.all %}
<tr>
<td>{{ item.car.vin }}</td>
<td>{{ item.car.id_car_model.get_local_name }}</td>
<td>{{ item.car.year }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.car.finances.selling_price }}</td>
<td>{{ 0.15|percentage }}</td>
<td>{{ item.total_vat}}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="3">{% trans "Totals" %}</th>
<th>{{ quotation.total_quantity }}</th>
<th>{{ quotation.total }}</th>
<th>{{ vat_amount }}</th>
<th>{{ quotation.total_vat }}</th>
</tr>
</tfoot>
</table>
<h5 class="mt-4">{% trans "Additional Costs" %}</h5>
<table class="table table-bordered">
<thead>
<tr>
<th>{% trans "Additions" %}</th>
<th>{% trans "Cost" %}</th>
<th>{% trans "VAT Amount" %}</th>
<th>{% trans "Total Cost with VAT" %}</th>
</tr>
</thead>
<tbody>
{% for service in services %}
<tr>
<td>{{service.name}}</td>
<td>{{ service.price }}</td>
<td>{{ service.vated }}</td>
<td>{{ service.total_price_vat }}</td>
</tr>
{% endfor %}
<tr>
<td></td>
<td>{{ total_cost }}</td>
<td>{{ total_vat }}</td>
<td>{{ total_cost_vat }}</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer text-end">
<a href="{% url 'quotation_list' %}" class="btn btn-secondary">{% trans "Back to Quotations" %}</a>
<a href="{% url 'quotation_pdf' quotation.pk %}" class="btn btn-primary">Download as PDF</a>
{% if not quotation.is_approved %}
<button type="button"
class="btn btn-success"
data-bs-toggle="modal"
data-bs-target="#confirmModal">
{% trans 'Acccept' %}
</button>
{% endif %}
{% if quotation.status == 'Draft' and not quotation.is_approved %}
<a href="{% url 'confirm_quotation' quotation.pk %}" class="btn btn-secondary">Accept & Approve</a>
{% elif not quotation.date_draft %}
<a href="{% url 'generate_invoice' quotation.pk %}" class="btn btn-secondary">Generate Invoice</a>
{% elif quotation.status == 'Draft' and quotation.is_approved %}
<a href="{% url 'mark_quotation' quotation.pk %}?status=in_review" class="btn btn-secondary">Mark As Review</a>
{% elif quotation.status == 'In Review' %}
<a href="{% url 'mark_quotation' quotation.pk %}?status=approved" class="btn btn-info">Approve Quotation</a>
{% elif quotation.status == 'Approved' %}
<a href="{% url 'payment_create' quotation.pk %}" class="btn btn-success">Pay</a>
{% endif %}
</div>
</div>
{% endblock %}