htmx to base and po_card

This commit is contained in:
Faheedkhan 2025-07-22 18:17:15 +03:00
parent 43e8888b8c
commit 71c0f4e405
8 changed files with 25 additions and 23 deletions

View File

@ -7237,7 +7237,7 @@ class ItemServiceListView(LoginRequiredMixin, PermissionRequiredMixin, ListView)
return qs
class ItemExpenseCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
class ItemExpenseCreateView(LoginRequiredMixin, PermissionRequiredMixin,SuccessMessageMixin, CreateView):
"""
Represents a view for creating item expense entries.
@ -7262,6 +7262,7 @@ class ItemExpenseCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateV
form_class = ExpenseItemCreateForm
template_name = "items/expenses/expense_create.html"
success_url = reverse_lazy("item_expense_list")
success_message = "heeeeeeeee"
permission_required = ["django_ledger.add_itemmodel"]
def get_form_kwargs(self):
@ -7402,7 +7403,7 @@ class BillListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
return context
class BillModelCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
class BillModelCreateView(LoginRequiredMixin, PermissionRequiredMixin,SuccessMessageMixin, CreateView):
template_name = "bill/bill_create.html"
PAGE_TITLE = _("Create Bill")
permission_required = "django_ledger.add_billmodel"
@ -7413,6 +7414,7 @@ class BillModelCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateVie
}
for_purchase_order = False
for_estimate = False
success_message = "Bill Created"
# Get user info for logging

View File

@ -38,7 +38,7 @@
<meta name="msapplication-TileImage"
content="{% static 'images/logos/logo-d.png' %}">
<meta name="theme-color" content="#ffffff">
{% comment %} <script src="{% static 'vendors/simplebar/simplebar.min.js' %}"></script> {% endcomment %}
<script src="{% static 'vendors/simplebar/simplebar.min.js' %}"></script>
<script src="{% static 'js/config.js' %}"></script>
<script src="{% static 'js/sweetalert2.all.min.js' %}"></script>
{% comment %} <link href="{% static 'vendors/mapbox-gl/mapbox-gl.css' %}" rel="stylesheet"> {% endcomment %}
@ -81,8 +81,11 @@
{% include "plans/expiration_messages.html" %}
{% block period_navigation %}
{% endblock period_navigation %}
{% block content %}
{% endblock content %}
<div id="main_content" hx-boost="true" hx-target="#main_content" hx-select="#main_content" hx-swap="outerHTML" hx-select-oob="#toast-container" hx-history-elt>
{% block content %}
{% endblock content %}
<script src="{% static 'vendors/popper/popper.min.js' %}"></script>
</div>
{% block body %}
{% endblock body %}
{% include 'footer.html' %}

View File

@ -198,7 +198,7 @@
{% endif %}
</div>
<div class="card-footer p-0">
<div class="d-flex flex-wrap gap-2 mt-2">
<div class="d-flex flex-wrap gap-2 mt-2" hx-boost="false">
<!-- Update Button -->
{% if perms.django_ledger.change_billmodel %}
<button class="btn btn-phoenix-primary"

View File

@ -3,7 +3,7 @@
<nav class="navbar navbar-vertical navbar-expand-lg ">
<div class="collapse navbar-collapse" id="navbarVerticalCollapse">
<div class="navbar-vertical-content d-flex flex-column">
<ul class="navbar-nav flex-column" id="navbarVerticalNav">
<ul class="navbar-nav flex-column" id="navbarVerticalNav" hx-boost="true" hx-target="#main_content" hx-select="#main_content" hx-swap="outerHTML" hx-select-oob="#toast-container">
<li class="nav-item">
<p class="navbar-vertical-label text-primary fs-8 text-truncate">{{request.dealer|default:"Apps"}}</p>
<hr class="navbar-vertical-line" />
@ -441,7 +441,7 @@
</a>
</div>
<ul class="navbar-nav navbar-nav-icons flex-row gap-2">
<ul class="navbar-nav navbar-nav-icons flex-row gap-2" hx-boost="false">
<li class="nav-item">
<div class="theme-control-toggle fa-icon-wait">
<input class="form-check-input ms-0 theme-control-toggle-input" type="checkbox" data-theme-control="phoenixTheme" value="dark" id="themeControlToggleSm" />
@ -464,7 +464,7 @@
{% if user.is_authenticated and request.is_dealer or request.is_staff %}
<li class="nav-item dropdown">
<a class="nav-link lh-1 pe-0" id="navbarDropdownUser" role="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-haspopup="true" aria-expanded="false">
<a hx-boost="false" class="nav-link lh-1 pe-0" id="navbarDropdownUser" role="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-haspopup="true" aria-expanded="false">
<div class="avatar avatar-l text-center align-middle">
{% if request.is_dealer and user.dealer.logo %}
<img class="rounded-circle" src="{{ user.dealer.logo.url }}" alt="" />
@ -526,11 +526,11 @@
{% endif %}
</li>
<li class="nav-item">
<a class="nav-link px-3 d-block" href=""> <span class="me-2 text-body align-bottom" data-feather="help-circle"></span>{{ _("Help Center") }}</a>
<a class="nav-link px-3 d-block" href="#"> <span class="me-2 text-body align-bottom" data-feather="help-circle"></span>{{ _("Help Center") }}</a>
</li>
{% if request.is_staff %}
<li class="nav-item">
<a class="nav-link px-3 d-block" href="{% url 'appointment:get_user_appointments' %}"> <span class="me-2 text-body align-bottom" data-feather="calendar"></span>{{ _("My Calendar") }}</a>
<a hx-boost="false" class="nav-link px-3 d-block" href="{% url 'appointment:get_user_appointments' %}"> <span class="me-2 text-body align-bottom" data-feather="calendar"></span>{{ _("My Calendar") }}</a>
</li>
{% endif %}
<!--<li class="nav-item"><a class="nav-link px-3 d-block" href=""> Language</a></li>-->

View File

@ -15,7 +15,7 @@
document.getElementById('POModalBody').innerHTML = `
<div class="d-flex justify-content-center gap-3 py-3">
<a class="btn btn-phoenix-primary px-4" href="${actionUrl}">
<a hx-boost="true" class="btn btn-phoenix-primary px-4" href="${actionUrl}">
<i class="fas fa-check-circle me-2"></i>${buttonText}
</a>
<button class="btn btn-phoenix-secondary" data-bs-dismiss="modal">
@ -99,7 +99,7 @@
</div>
</div>
</div>
<div class="card-footer bg-light">
<div class="card-footer bg-light" hx-boost="false">
{% 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 %}"

View File

@ -4,7 +4,9 @@
{% block title %}
{{ _("Create Quotation") }}
{% endblock title %}
{% block customCSS %}
{% block content %}
<style>
.disabled{
opacity: 0.5;
@ -119,9 +121,6 @@
width: 0;
}
</style>
{% endblock customCSS %}
<!---->
{% block content %}
<div class="row justify-content-center mt-5 mb-3">
{% if not items %}
<div class="alert alert-outline-warning d-flex align-items-center"
@ -210,10 +209,7 @@
</div>
</div>
{% endblock %}
{% block customJS %}
<script>
document.addEventListener('DOMContentLoaded', function() {
const Toast = Swal.mixin({
@ -366,4 +362,5 @@
});
</script>
{% endblock customJS %}
{% endblock %}

View File

@ -66,7 +66,7 @@
<td class="align-middle white-space-nowrap invoice">
{% if tx.invoice and perms.django_ledger.view_invoicemodel%}
<p class="fw-bo text-body fs-9 mb-0">
<a href="{% url 'invoice_detail' request.dealer.slug tx.invoice.uuid %}">
<a href="{% url 'invoice_detail' request.dealer.slug request.entity.slug tx.invoice.uuid %}">
{{tx.invoice.invoice_number}}
</a><br>
{% if tx.invoice.is_draft %}

View File

@ -1,4 +1,4 @@
<div class="toast-container">
<div id="toast-container" class="toast-container">
<script>
{% if messages %}
{% for message in messages %}