This commit is contained in:
Faheedkhan 2025-06-25 14:34:17 +03:00
commit 8ab1c24173
73 changed files with 1259 additions and 1099 deletions

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ Makefile
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
**/migrations/
# Gradle
.idea/**/gradle.xml

View File

@ -1,5 +1,7 @@
from django.conf import settings
from inventory.utils import get_user_type
def currency_context(request):
"""

View File

@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand
from inventory.services import get_model, decodevin
from inventory.services import get_make, get_model, decodevin
from bs4 import BeautifulSoup
import requests
@ -24,35 +24,36 @@ class Command(BaseCommand):
)
self.stdout.write(self.style.SUCCESS(f"Generated VIN: {vin}"))
self.stdout.write(self.style.SUCCESS(f"Description: {description}"))
self.stdout.write(
self.style.SUCCESS(
"####################################################################################################"
)
)
self.stdout.write(
self.style.SUCCESS(
"####################################################################################################"
)
)
self.stdout.write(self.style.SUCCESS(f"Decoded VIN: {result}"))
make, model, year_model = result.values()
self.stdout.write(
self.style.SUCCESS(
f"VIN: {vin} - Make {make} - Model {model} - Model Year {year_model}"
)
)
m = get_model(model)
self.stdout.write(self.style.SUCCESS(f"Make: {m.id_car_make} - Model: {m}"))
self.stdout.write(
self.style.SUCCESS(
"####################################################################################################"
)
)
self.stdout.write(
self.style.SUCCESS(
"####################################################################################################"
)
)
# self.stdout.write(
# self.style.SUCCESS(
# "####################################################################################################"
# )
# )
# self.stdout.write(
# self.style.SUCCESS(
# "####################################################################################################"
# )
# )
# self.stdout.write(self.style.SUCCESS(f"Decoded VIN: {result}"))
# make, model, year_model = result.values()
# self.stdout.write(
# self.style.SUCCESS(
# f"VIN: {vin} - Make {make} - Model {model} - Model Year {year_model}"
# )
# )
# make = get_make(make)
# m = get_model(model,make)
# self.stdout.write(self.style.SUCCESS(f"Make: {m.id_car_make} - Model: {m}"))
# self.stdout.write(
# self.style.SUCCESS(
# "####################################################################################################"
# )
# )
# self.stdout.write(
# self.style.SUCCESS(
# "####################################################################################################"
# )
# )
def generate_vin(self):
# url = "https://www.vindecoder.org/vin-decoder"

View File

@ -1,4 +1,7 @@
import logging
from django.http import Http404, HttpResponseForbidden
from django.shortcuts import redirect
from inventory import models
from django.utils import timezone
@ -59,8 +62,11 @@ class InjectParamsMiddleware:
def __call__(self, request):
try:
# request.entity = request.user.dealer.entity
request.dealer = get_user_type(request)
if request.user.is_authenticated:
request.dealer = get_user_type(request)
request.entity = request.dealer.entity
else:
request.dealer = None
except Exception:
pass
response = self.get_response(request)
@ -107,3 +113,19 @@ class InjectDealerMiddleware:
# if request.user.is_authenticated and not request.session.get('otp_verified', False):
# return redirect(reverse('verify_otp'))
# return self.get_response(request)
class DealerSlugMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
return response
def process_view(self, request, view_func, view_args, view_kwargs):
if request.user.is_authenticated:
dealer = get_user_type(request)
if "dealer_slug" not in view_kwargs:
return redirect("home", dealer_slug=dealer.slug, **view_kwargs)
elif view_kwargs["dealer_slug"] != dealer.slug:
raise Http404("Dealer slug mismatch")
return None

View File

@ -1,5 +1,9 @@
from django.http import Http404
from django.shortcuts import redirect
from django.utils.translation import get_language
from inventory.utils import get_user_type
class AddClassMixin:
"""
@ -60,3 +64,13 @@ class LocalizedNameMixin:
# return super().form_valid(form)
# else:
# return form.errors
class DealerSlugMixin:
def dispatch(self, request, *args, **kwargs):
if request.user.is_authenticated:
if "dealer_slug" not in kwargs:
return redirect("home", dealer_slug=request.dealer.slug, **kwargs)
elif kwargs["dealer_slug"] != request.dealer.slug:
raise Http404("Dealer slug mismatch")
return super().dispatch(request, *args, **kwargs)

View File

@ -2482,16 +2482,22 @@ class SaleOrder(models.Model):
item_data = self.invoice.get_itemtxs_data()
if item_data:
return item_data
return [] # Return an empty list if no invoice or no item data
return [] # Return an empty list if no invoice or no item data
@property
def cars(self):
# Check if self.items is not empty before trying to iterate
if self.items.exists() if hasattr(self.items, 'exists') else self.items: # Handle both QuerySet and list
if (
self.items.exists() if hasattr(self.items, "exists") else self.items
): # Handle both QuerySet and list
# Ensure x is an *instance* of ItemTransactionModel
# item_model should be a ForeignKey to your CarModel within ItemTransactionModel
return [x.item_model.car for x in self.items if hasattr(x, 'item_model') and hasattr(x.item_model, 'car')]
return [] # Return an empty list if no items or no associated cars
return [
x.item_model.car
for x in self.items
if hasattr(x, "item_model") and hasattr(x.item_model, "car")
]
return [] # Return an empty list if no items or no associated cars
class CustomGroup(models.Model):

View File

@ -1,4 +1,3 @@
from typing import Union
from random import randint
from django import template
@ -442,6 +441,7 @@ def filter_by_role(accounts, role_prefix):
@register.inclusion_tag("purchase_orders/tags/po_item_table.html", takes_context=True)
def po_item_table1(context, queryset):
return {
"dealer_slug": context["view"].kwargs["dealer_slug"],
"entity_slug": context["entity_slug"],
"po_model": context["po_model"],
"po_item_list": queryset,
@ -459,6 +459,7 @@ def po_item_formset_table(context, po_model, itemtxs_formset):
item_role="inventory"
)
return {
"dealer_slug": context["view"].kwargs["dealer_slug"],
"entity_slug": context["view"].kwargs["entity_slug"],
"po_model": po_model,
"itemtxs_formset": itemtxs_formset,
@ -468,6 +469,7 @@ def po_item_formset_table(context, po_model, itemtxs_formset):
@register.inclusion_tag("bill/tags/bill_item_formset.html", takes_context=True)
def bill_item_formset_table(context, item_formset):
return {
"dealer_slug": context["view"].kwargs["dealer_slug"],
"entity_slug": context["view"].kwargs["entity_slug"],
"bill_pk": context["view"].kwargs["bill_pk"],
"total_amount__sum": context["total_amount__sum"],
@ -490,15 +492,15 @@ def transactions_table(
qs = object_type.get_transaction_queryset(annotated=True)
transaction_model_qs = qs.annotate(
debit_credit_sort_order=Case(
When(tx_type='debit', then=Value(0)), # Debits will get sort order 0
When(tx_type='credit', then=Value(1)), # Credits will get sort order 1
default=Value(2), # Fallback for any other tx_type, if applicable
output_field=IntegerField()
When(tx_type="debit", then=Value(0)), # Debits will get sort order 0
When(tx_type="credit", then=Value(1)), # Credits will get sort order 1
default=Value(2), # Fallback for any other tx_type, if applicable
output_field=IntegerField(),
)
).order_by(
'-timestamp', # Primary sort: chronological (oldest first)
'-debit_credit_sort_order', # Secondary sort: Debits (0) before Credits (1)
'pk' # Optional: Tie-breaker for consistent order
"-timestamp", # Primary sort: chronological (oldest first)
"-debit_credit_sort_order", # Secondary sort: Debits (0) before Credits (1)
"pk", # Optional: Tie-breaker for consistent order
)
elif isinstance(object_type, InvoiceModel):
transaction_model_qs = object_type.get_transaction_queryset(

View File

@ -1,13 +1,15 @@
from django.conf.urls import handler403, handler400, handler404, handler500
from django.urls import path
from django_tables2.export.export import TableExport
from inventory.utils import get_user_type
from . import views
from django.urls import path
from django.urls import reverse_lazy
from django.views.generic import RedirectView
from django_tables2.export.export import TableExport
from django.conf.urls import handler403, handler400, handler404, handler500
urlpatterns = [
# main URLs
path("", views.HomeView.as_view(), name="home"),
path("<slug:dealer_slug>/", views.HomeView.as_view(), name="home"),
path("welcome/", views.WelcomeView.as_view(), name="welcome"),
# Accounts URLs
# path("login/", allauth_views.LoginView.as_view(template_name="account/login.html"), name="account_login"),
@ -277,28 +279,56 @@ urlpatterns = [
name="vendor_delete",
),
# Car URLs
path("cars/upload_cars/", views.upload_cars, name="upload_cars"),
path("cars/<uuid:pk>/upload_cars/", views.upload_cars, name="upload_cars"),
path("cars/add/", views.CarCreateView.as_view(), name="car_add"),
path("cars/inventory/", views.CarInventory.as_view(), name="car_inventory_all"),
path("<slug:dealer_slug>/cars/upload_cars/", views.upload_cars, name="upload_cars"),
path(
"cars/inventory/<slug:make_id>/<slug:model_id>/<slug:trim_id>/",
"<slug:dealer_slug>/cars/<uuid:pk>/upload_cars/",
views.upload_cars,
name="upload_cars",
),
path("<slug:dealer_slug>/cars/add/", views.CarCreateView.as_view(), name="car_add"),
path(
"<slug:dealer_slug>/cars/inventory/",
views.CarInventory.as_view(),
name="car_inventory_all",
),
path(
"<slug:dealer_slug>/cars/inventory/<slug:make_id>/<slug:model_id>/<slug:trim_id>/",
views.CarInventory.as_view(),
name="car_inventory",
),
path("cars/inventory/stats", views.inventory_stats_view, name="inventory_stats"),
path("cars/inventory/list", views.CarListView.as_view(), name="car_list"),
path("cars/<slug:slug>/", views.CarDetailView.as_view(), name="car_detail"),
path("cars/<slug:slug>/history/", views.car_history, name="car_history"),
path("cars/<slug:slug>/update/", views.CarUpdateView.as_view(), name="car_update"),
path("cars/<slug:slug>/delete/", views.CarDeleteView.as_view(), name="car_delete"),
path(
"cars/<slug:slug>/finance/create/",
"<slug:dealer_slug>/cars/inventory/stats",
views.inventory_stats_view,
name="inventory_stats",
),
path(
"<slug:dealer_slug>/cars/inventory/list",
views.CarListView.as_view(),
name="car_list",
),
path(
"<slug:dealer_slug>/cars/<slug:slug>/",
views.CarDetailView.as_view(),
name="car_detail",
),
path("cars/<slug:slug>/history/", views.car_history, name="car_history"),
path(
"<slug:dealer_slug>/cars/<slug:slug>/update/",
views.CarUpdateView.as_view(),
name="car_update",
),
path(
"<slug:dealer_slug>/cars/<slug:slug>/delete/",
views.CarDeleteView.as_view(),
name="car_delete",
),
path(
"<slug:dealer_slug>/cars/<slug:slug>/finance/create/",
views.CarFinanceCreateView.as_view(),
name="car_finance_create",
),
path(
"cars/finance/<int:pk>/update/",
"<slug:dealer_slug>/cars/finance/<int:pk>/update/",
views.CarFinanceUpdateView.as_view(),
name="car_finance_update",
),
@ -307,12 +337,16 @@ urlpatterns = [
views.bulk_update_car_price,
name="bulk_update_car_price",
),
path("ajax/", views.AjaxHandlerView.as_view(), name="ajax_handler"),
path(
"cars/<slug:slug>/add-color/", views.CarColorCreate.as_view(), name="add_color"
"<slug:dealer_slug>/ajax/", views.AjaxHandlerView.as_view(), name="ajax_handler"
),
path(
"car/colors/<slug:slug>/update/",
"<slug:dealer_slug>/cars/<slug:slug>/add-color/",
views.CarColorCreate.as_view(),
name="add_color",
),
path(
"<slug:dealer_slug>/car/colors/<slug:slug>/update/",
views.CarColorsUpdateView.as_view(),
name="car_colors_update",
),
@ -353,35 +387,39 @@ urlpatterns = [
),
path("cars/inventory/search/", views.SearchCodeView.as_view(), name="car_search"),
# path('cars/<int:car_pk>/colors/<int:pk>/update/',views.CarColorUpdateView.as_view(),name='color_update'),
path("cars/reserve/<slug:slug>/", views.reserve_car_view, name="reserve_car"),
path(
"reservations/<int:reservation_id>/",
"<slug:dealer_slug>/cars/reserve/<slug:slug>/",
views.reserve_car_view,
name="reserve_car",
),
path(
"<slug:dealer_slug>/reservations/<int:reservation_id>/",
views.manage_reservation,
name="reservations",
),
path(
"cars/<slug:slug>/add-custom-card/",
"<slug:dealer_slug>/cars/<slug:slug>/add-custom-card/",
views.CustomCardCreateView.as_view(),
name="add_custom_card",
),
path(
"cars/<slug:slug>/add-registration/",
"<slug:dealer_slug>/cars/<slug:slug>/add-registration/",
views.CarRegistrationCreateView.as_view(),
name="add_registration",
),
# sales list
path(
"sales/list/",
"<slug:dealer_slug>/sales/list/",
views.sales_list_view,
name="sales_list",
),
path(
"sale_orders/<int:pk>/",
"<slug:dealer_slug>/sale_orders/<int:pk>/",
views.SaleOrderDetailView.as_view(),
name="order_detail",
),
path(
"inventory/<slug:entity_slug>/list/",
"<slug:dealer_slug>/inventory/<slug:entity_slug>/list/",
views.InventoryListView.as_view(),
name="inventort_list",
),
@ -612,142 +650,176 @@ urlpatterns = [
),
# Bank Account
path(
"bank_accounts/", views.BankAccountListView.as_view(), name="bank_account_list"
"<slug:dealer_slug>/bank_accounts/",
views.BankAccountListView.as_view(),
name="bank_account_list",
),
path(
"bank_accounts/<uuid:pk>/",
"<slug:dealer_slug>/bank_accounts/<uuid:pk>/",
views.BankAccountDetailView.as_view(),
name="bank_account_detail",
),
path(
"bank_accounts/create/",
"<slug:dealer_slug>/bank_accounts/create/",
views.BankAccountCreateView.as_view(),
name="bank_account_create",
),
path(
"bank_accounts/<uuid:pk>/update/",
"<slug:dealer_slug>/bank_accounts/<uuid:pk>/update/",
views.BankAccountUpdateView.as_view(),
name="bank_account_update",
),
path(
"bank_accounts/<uuid:pk>/delete/",
"<slug:dealer_slug>/bank_accounts/<uuid:pk>/delete/",
views.bank_account_delete,
name="bank_account_delete",
),
# Account
path("coa_accounts/", views.AccountListView.as_view(), name="account_list"),
path(
"coa_accounts/<uuid:pk>/",
"<slug:dealer_slug>/coa_accounts/",
views.AccountListView.as_view(),
name="account_list",
),
path(
"<slug:dealer_slug>/coa_accounts/<uuid:pk>/",
views.AccountDetailView.as_view(),
name="account_detail",
),
path(
"coa_accounts/create/", views.AccountCreateView.as_view(), name="account_create"
"<slug:dealer_slug>/coa_accounts/create/",
views.AccountCreateView.as_view(),
name="account_create",
),
path(
"coa_accounts/<uuid:pk>/update/",
"<slug:dealer_slug>/coa_accounts/<uuid:pk>/update/",
views.AccountUpdateView.as_view(),
name="account_update",
),
path("coa_accounts/<uuid:pk>/delete/", views.account_delete, name="account_delete"),
# Estimate
path("sales/estimates/", views.EstimateListView.as_view(), name="estimate_list"),
path(
"sales/estimates/<uuid:pk>/",
"<slug:dealer_slug>/coa_accounts/<uuid:pk>/delete/",
views.account_delete,
name="account_delete",
),
#################################################
# Estimate
#################################################
path(
"<slug:dealer_slug>/sales/estimates/",
views.EstimateListView.as_view(),
name="estimate_list",
),
path(
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/",
views.EstimateDetailView.as_view(),
name="estimate_detail",
),
path("sales/estimates/create/", views.create_estimate, name="estimate_create"),
path(
"sales/estimates/create/<slug:slug>/",
"<slug:dealer_slug>/sales/estimates/create/",
views.create_estimate,
name="estimate_create",
),
path(
"<slug:dealer_slug>/sales/estimates/create/<slug:slug>/",
views.create_estimate,
name="estimate_create_from_opportunity",
),
path(
"sales/estimates/<uuid:pk>/estimate_mark_as/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/estimate_mark_as/",
views.estimate_mark_as,
name="estimate_mark_as",
),
path(
"sales/estimates/<uuid:pk>/preview/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/preview/",
views.EstimatePreviewView.as_view(),
name="estimate_preview",
),
path(
"sales/estimates/<uuid:pk>/payment_request/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/payment_request/",
views.PaymentRequest.as_view(),
name="payment_request",
),
path(
"sales/estimates/<uuid:pk>/send_email", views.send_email_view, name="send_email"
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/send_email",
views.send_email_view,
name="send_email",
),
path(
"sales/estimates/<uuid:pk>/sale_order/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/sale_order/",
views.create_sale_order,
name="create_sale_order",
),
path(
"sales/estimates/<uuid:pk>/sale_order/<int:order_pk>/details/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/sale_order/<int:order_pk>/details/",
views.SaleOrderDetail.as_view(),
name="sale_order_details",
),
path(
"sales/estimates/<uuid:pk>/sale_order/preview/",
"<slug:dealer_slug>/sales/estimates/<uuid:pk>/sale_order/preview/",
views.preview_sale_order,
name="preview_sale_order",
),
###############################################
# Invoice
path("sales/invoices/", views.InvoiceListView.as_view(), name="invoice_list"),
###############################################
path(
"sales/invoices/<uuid:pk>/create/", views.invoice_create, name="invoice_create"
"<slug:dealer_slug>/sales/invoices/",
views.InvoiceListView.as_view(),
name="invoice_list",
),
path(
"sales/invoices/<uuid:pk>/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/create/",
views.invoice_create,
name="invoice_create",
),
path(
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/",
views.InvoiceDetailView.as_view(),
name="invoice_detail",
),
path(
"sales/invoices/<uuid:pk>/preview/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/preview/",
views.InvoicePreviewView.as_view(),
name="invoice_preview",
),
path(
"sales/invoices/<uuid:pk>/invoice_mark_as/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/invoice_mark_as/",
views.invoice_mark_as,
name="invoice_mark_as",
),
path(
"sales/invoices/<uuid:pk>/draft_invoice_update/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/draft_invoice_update/",
views.DraftInvoiceModelUpdateFormView.as_view(),
name="draft_invoice_update",
),
path(
"sales/invoices/<uuid:pk>/approved_invoice_update/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/approved_invoice_update/",
views.ApprovedInvoiceModelUpdateFormView.as_view(),
name="approved_invoice_update",
),
path(
"sales/invoices/<uuid:pk>/paid_invoice_update/",
"<slug:dealer_slug>/sales/invoices/<uuid:pk>/paid_invoice_update/",
views.PaidInvoiceModelUpdateFormView.as_view(),
name="paid_invoice_update",
),
# path('sales/estimates/<uuid:pk>/preview/', views.EstimatePreviewView.as_view(), name='estimate_preview'),
# path('send_email/<uuid:pk>', views.send_email, name='send_email'),
# Payment
path("sales/payments/", views.PaymentListView, name="payment_list"),
path(
"sales/payments/<uuid:pk>/create/",
"<slug:dealer_slug>/sales/payments/", views.PaymentListView, name="payment_list"
),
path(
"<slug:dealer_slug>/sales/payments/<uuid:pk>/create/",
views.PaymentCreateView,
name="payment_create",
),
# path("sales/payments/create/", views.PaymentCreateView, name="payment_create"),
path(
"sales/payments/<uuid:pk>/payment_details/",
"<slug:dealer_slug>/sales/payments/<uuid:pk>/payment_details/",
views.PaymentDetailView,
name="payment_details",
),
path(
"sales/payments/<uuid:pk>/payment_mark_as_paid/",
"<slug:dealer_slug>/sales/payments/<uuid:pk>/payment_mark_as_paid/",
views.payment_mark_as_paid,
name="payment_mark_as_paid",
),
@ -787,85 +859,90 @@ urlpatterns = [
name="item_expense_update",
),
# Bills
path("items/bills/", views.BillListView.as_view(), name="bill_list"),
path(
"<slug:dealer_slug>/items/bills/",
views.BillListView.as_view(),
name="bill_list",
),
# path("items/bills/create/", views.BillModelCreateViewView.as_view(), name="bill_create"),
path(
"items/bills/<slug:entity_slug>/create/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/create/",
views.BillModelCreateView.as_view(),
name="bill-create",
),
path(
"items/bills/<slug:entity_slug>/create/purchase-order/<uuid:po_pk>/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/create/purchase-order/<uuid:po_pk>/",
views.BillModelCreateView.as_view(for_purchase_order=True),
name="bill-create-po",
),
path(
"items/bills/<slug:entity_slug>/create/estimate/<uuid:ce_pk>/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/create/estimate/<uuid:ce_pk>/",
views.BillModelCreateView.as_view(for_estimate=True),
name="bill-create-estimate",
),
path(
"items/bills/<slug:entity_slug>/detail/<uuid:bill_pk>/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/detail/<uuid:bill_pk>/",
views.BillModelDetailViewView.as_view(),
name="bill-detail",
),
path(
"items/bills/<slug:entity_slug>/update/<uuid:bill_pk>/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/update/<uuid:bill_pk>/",
views.BillModelUpdateViewView.as_view(),
name="bill-update",
),
path(
"items/bills/<slug:entity_slug>/update/<uuid:bill_pk>/items/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/update/<uuid:bill_pk>/items/",
views.BillModelUpdateViewView.as_view(action_update_items=True),
name="bill-update-items",
),
############################################################
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-draft/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-draft/",
views.BillModelActionMarkAsDraftView.as_view(),
name="bill-action-mark-as-draft",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-review/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-review/",
views.BillModelActionMarkAsInReviewView.as_view(),
name="bill-action-mark-as-review",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-approved/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-approved/",
views.BillModelActionMarkAsApprovedView.as_view(),
name="bill-action-mark-as-approved",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-paid/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-paid/",
views.BillModelActionMarkAsPaidView.as_view(),
name="bill-action-mark-as-paid",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-void/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-void/",
views.BillModelActionVoidView.as_view(),
name="bill-action-mark-as-void",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-canceled/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/mark-as-canceled/",
views.BillModelActionCanceledView.as_view(),
name="bill-action-mark-as-canceled",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/lock-ledger/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/lock-ledger/",
views.BillModelActionLockLedgerView.as_view(),
name="bill-action-lock-ledger",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/unlock-ledger/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/unlock-ledger/",
views.BillModelActionUnlockLedgerView.as_view(),
name="bill-action-unlock-ledger",
),
path(
"items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/force-migration/",
"<slug:dealer_slug>/items/bills/<slug:entity_slug>/actions/<uuid:bill_pk>/force-migration/",
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(),
@ -1039,82 +1116,81 @@ urlpatterns = [
#########
# Purchase Order
path(
"purchase_orders/",
"<slug:dealer_slug>/purchase_orders/",
views.PurchaseOrderListView.as_view(),
name="purchase_order_list",
),
path(
"purchase_orders/new/",
"<slug:dealer_slug>/purchase_orders/new/",
views.PurchaseOrderCreateView,
name="purchase_order_create",
),
path(
"purchase_orders/<uuid:pk>/detail/",
"<slug:dealer_slug>/purchase_orders/<uuid:pk>/detail/",
views.PurchaseOrderDetailView.as_view(),
name="purchase_order_detail",
),
path(
"purchase_orders/<slug:entity_slug>/<uuid:po_pk>/update/",
"<slug:dealer_slug>/purchase_orders/<slug:entity_slug>/<uuid:po_pk>/update/",
views.PurchaseOrderUpdateView.as_view(),
name="purchase_order_update",
),
path(
"purchase_orders/<slug:entity_slug>/update/<uuid:po_pk>/update-items/",
"<slug:dealer_slug>/purchase_orders/<slug:entity_slug>/update/<uuid:po_pk>/update-items/",
views.PurchaseOrderUpdateView.as_view(action_update_items=True),
name="purchase_order_update_items",
),
path(
"purchase_orders/inventory_item/create/",
"<slug:dealer_slug>/purchase_orders/inventory_item/create/",
views.InventoryItemCreateView,
name="inventory_item_create",
),
path(
"purchase_orders/inventory_items_filter/",
"<slug:dealer_slug>/purchase_orders/inventory_items_filter/",
views.inventory_items_filter,
name="inventory_items_filter",
),
path(
"purchase_orders/<slug:entity_slug>/delete/<uuid:po_pk>/",
"<slug:dealer_slug>/purchase_orders/<slug:entity_slug>/delete/<uuid:po_pk>/",
views.PurchaseOrderModelDeleteView.as_view(),
name="po-delete",
),
path(
"purchase_orders/<slug:entity_slug>/<uuid:po_pk>/upload/",
"<slug:dealer_slug>/purchase_orders/<slug:entity_slug>/<uuid:po_pk>/upload/",
view=views.view_items_inventory,
name="view_items_inventory",
),
# Actions....
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-draft/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-draft/",
views.PurchaseOrderMarkAsDraftView.as_view(),
name="po-action-mark-as-draft",
),
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-review/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-review/",
views.PurchaseOrderMarkAsReviewView.as_view(),
name="po-action-mark-as-review",
),
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-approved/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-approved/",
views.PurchaseOrderMarkAsApprovedView.as_view(),
name="po-action-mark-as-approved",
),
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-fulfilled/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-fulfilled/",
views.PurchaseOrderMarkAsFulfilledView.as_view(),
name="po-action-mark-as-fulfilled",
),
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-canceled/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-canceled/",
views.PurchaseOrderMarkAsCanceledView.as_view(),
name="po-action-mark-as-canceled",
),
path(
"<slug:entity_slug>/action/<uuid:po_pk>/mark-as-void/",
"<slug:dealer_slug>/<slug:entity_slug>/action/<uuid:po_pk>/mark-as-void/",
views.PurchaseOrderMarkAsVoidView.as_view(),
name="po-action-mark-as-void",
),
]
handler404 = "inventory.views.custom_page_not_found_view"

View File

@ -222,7 +222,7 @@ def reserve_car(car, request):
except Exception as e:
messages.error(request, f"Error reserving car: {e}")
return redirect("car_detail", slug=car.slug)
return redirect("car_detail", dealer_slug=request.dealer.slug, slug=car.slug)
def calculate_vat_amount(amount):
@ -1011,7 +1011,7 @@ class CarFinanceCalculator:
"make": car_info.get("make"),
"model": car_info.get("model"),
"year": car_info.get("year"),
"logo": item.item_model.car.id_car_make.logo.url,
"logo": getattr(item.item_model.car.id_car_make, "logo", ""),
"trim": car_info.get("trim"),
"mileage": car_info.get("mileage"),
"cost_price": car_finance.get("cost_price"),

File diff suppressed because it is too large Load Diff

View File

@ -63,7 +63,7 @@
{% include 'header.html' %}
<div class="content">
{% include "plans/expiration_messages.html" %}
{% block period_navigation %}

View File

@ -42,11 +42,11 @@
<div class="col-lg-4">
<div class="card shadow-sm" >
<div class="card-body">
{% include 'bill/includes/card_bill.html' with bill=bill entity_slug=view.kwargs.entity_slug style='bill-detail' %}
{% include 'bill/includes/card_bill.html' with dealer_slug=request.dealer.slug bill=bill entity_slug=view.kwargs.entity_slug style='bill-detail' %}
<hr class="my-4">
{% include 'bill/includes/card_vendor.html' with vendor=bill.vendor %}
<div class="d-grid mt-4">
<a href="{% url 'bill_list' %}"
<a href="{% url 'bill_list' request.dealer.slug %}"
class="btn btn-phoenix-primary">
<i class="fas fa-arrow-left me-1"></i> {% trans 'Bill List' %}
</a>
@ -65,7 +65,7 @@
<div class="border rounded p-3">
<h6 class="text-uppercase text-xs text-muted mb-2">
{% trans 'Cash Account' %}:
<a href="{% url 'account_detail' bill.cash_account.uuid %}"
<a href="{% url 'account_detail' request.dealer.slug bill.cash_account.uuid %}"
class="text-decoration-none ms-1">
{{ bill.cash_account.code }}
</a>
@ -80,7 +80,7 @@
<div class="border rounded p-3">
<h6 class="text-uppercase text-xs text-muted mb-2">
{% trans 'Prepaid Account' %}:
<a href="{% url 'account_detail' bill.prepaid_account.uuid %}"
<a href="{% url 'account_detail' request.dealer.slug bill.prepaid_account.uuid %}"
class="text-decoration-none ms-1">
{{ bill.prepaid_account.code }}
</a>
@ -94,7 +94,7 @@
<div class="border rounded p-3">
<h6 class="text-uppercase text-xs text-muted mb-2">
{% trans 'Accounts Payable' %}:
<a href="{% url 'account_detail' bill.unearned_account.uuid %}"
<a href="{% url 'account_detail' request.dealer.slug bill.unearned_account.uuid %}"
class="text-decoration-none ms-1">
{{ bill.unearned_account.code }}
</a>
@ -185,7 +185,7 @@
<td class="align-items-start white-space-nowrap pe-2">
{% if bill_item.po_model_id %}
<a class="btn btn-sm btn-phoenix-primary"
href="{% url 'purchase_order_detail' bill_item.po_model_id %}">
href="{% url 'purchase_order_detail' request.dealer.slug bill_item.po_model_id %}">
{% trans 'View PO' %}
</a>
{% endif %}

View File

@ -17,9 +17,9 @@
<div class="col-12">
<div class="card mb-4">
<div class="card-body">
{% include 'bill/includes/card_bill.html' with bill=bill_model style='bill-detail' entity_slug=view.kwargs.entity_slug %}
{% include 'bill/includes/card_bill.html' with dealer_slug=request.dealer.slug bill=bill_model style='bill-detail' entity_slug=view.kwargs.entity_slug %}
<form action="{% url 'bill-update' entity_slug=view.kwargs.entity_slug bill_pk=bill_model.uuid %}" method="post">
<form action="{% url 'bill-update' dealer_slug=request.dealer.slug entity_slug=view.kwargs.entity_slug bill_pk=bill_model.uuid %}" method="post">
{% csrf_token %}
<div class="mb-3">
@ -30,12 +30,12 @@
<i class="fas fa-save me-2"></i>{% trans 'Save Bill' %}
</button>
<a href="{% url 'bill-detail' entity_slug=view.kwargs.entity_slug bill_pk=bill_model.uuid %}"
<a href="{% url 'bill-detail' dealer_slug=request.dealer.slug entity_slug=view.kwargs.entity_slug bill_pk=bill_model.uuid %}"
class="btn btn-phoenix-secondary w-100 mb-2">
<i class="fas fa-arrow-left me-2"></i>{% trans 'Back to Bill Detail' %}
</a>
<a href="{% url 'bill_list' %}"
<a href="{% url 'bill_list' request.dealer.slug %}"
class="btn btn-phoenix-info w-100 mb-2">
<i class="fas fa-list me-2"></i>{% trans 'Bill List' %}
</a>

View File

@ -201,48 +201,48 @@
<div class="card-footer p-0">
<div class="d-flex flex-wrap gap-2 mt-2">
<!-- Update Button -->
<a href="{% url 'bill-update' entity_slug=entity_slug bill_pk=bill.uuid %}" class="btn btn-phoenix-primary">
<a href="{% url 'bill-update' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=bill.uuid %}" class="btn btn-phoenix-primary">
<i class="fas fa-edit me-2"></i>{% trans 'Update' %}
</a>
<!-- Mark as Draft -->
{% if bill.can_draft %}
<button class="btn btn-phoenix-success"
onclick="showPOModal('Mark as Draft', '{% url 'bill-action-mark-as-draft' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Draft')">
onclick="showPOModal('Mark as Draft', '{% url 'bill-action-mark-as-draft' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Draft')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Draft' %}
</button>
{% endif %}
<!-- Mark as Review -->
{% if bill.can_review %}
<button class="btn btn-phoenix-warning"
onclick="showPOModal('Mark as Review', '{% url 'bill-action-mark-as-review' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Review')">
onclick="showPOModal('Mark as Review', '{% url 'bill-action-mark-as-review' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Review')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Review' %}
</button>
{% endif %}
<!-- Mark as Approved -->
{% if bill.can_approve %}
<button class="btn btn-phoenix-success"
onclick="showPOModal('Mark as Approved', '{% url 'bill-action-mark-as-approved' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Approved')">
onclick="showPOModal('Mark as Approved', '{% url 'bill-action-mark-as-approved' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Approved')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Approved' %}
</button>
{% endif %}
<!-- Mark as Paid -->
{% if bill.can_pay %}
<button class="btn btn-phoenix-success"
onclick="showPOModal('Mark as Paid', '{% url 'bill-action-mark-as-paid' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Paid')">
onclick="showPOModal('Mark as Paid', '{% url 'bill-action-mark-as-paid' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Paid')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Paid' %}
</button>
{% endif %}
<!-- Void Button -->
{% if bill.can_void %}
<button class="btn btn-phoenix-danger"
onclick="showPOModal('Mark as Void', '{% url 'bill-action-mark-as-void' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Void')">
onclick="showPOModal('Mark as Void', '{% url 'bill-action-mark-as-void' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Void')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Void' %}
</button>
{% endif %}
<!-- Cancel Button -->
{% if bill.can_cancel %}
<button class="btn btn-phoenix-danger"
onclick="showPOModal('Mark as Canceled', '{% url 'bill-action-mark-as-canceled' entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Canceled')">
onclick="showPOModal('Mark as Canceled', '{% url 'bill-action-mark-as-canceled' dealer_slug=request.dealer.slug entity_slug=entity_slug bill_pk=bill.pk %}', 'Mark as Canceled')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Canceled' %}
</button>
{% modal_action_v2 bill bill.get_mark_as_canceled_url bill.get_mark_as_canceled_message bill.get_mark_as_canceled_html_id %}

View File

@ -3,7 +3,7 @@
{% load django_ledger %}
{% load widget_tweaks %}
<form action="{% url 'bill-update-items' entity_slug=entity_slug bill_pk=bill_pk %}" method="post">
<form action="{% url 'bill-update-items' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=bill_pk %}" method="post">
<div class="container-fluid py-4">
<!-- Page Header -->
<div class="row mb-4">
@ -72,7 +72,7 @@
{% currency_symbol %}{{ f.instance.po_total_amount | currency_format }}
</span>
<a class="btn btn-sm btn-phoenix-info mt-1"
href="{% url 'purchase_order_detail' f.instance.po_model_id %}">
href="{% url 'purchase_order_detail' dealer_slug f.instance.po_model_id %}">
{% trans 'View PO' %}
</a>
</div>

View File

@ -17,7 +17,7 @@
</tr>
</thead>
<tbody class="fs-9">
{% for transaction_model in transaction_model_qs %}
<tr>

View File

@ -231,27 +231,27 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% else %}
<tr>
<td colspan="6" class="text-center">{% trans "No Lead Yet" %}</td>
</tr>
{% endif %}
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% else %}
<tr>
<td colspan="6" class="text-center">{% trans "No Lead Yet" %}</td>
</tr>
{% endif %}
</div>
</div>
</div>
{% endblock %}

View File

@ -90,14 +90,14 @@
<div id="opportunities-grid" class="row g-4 px-2 px-lg-4 mt-1">
{% include 'crm/opportunities/partials/opportunity_grid.html' %}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -109,15 +109,15 @@
</tbody>
{% endif %}
</table>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% include 'modal/delete_modal.html' %}
{% endblock %}

View File

@ -27,7 +27,7 @@
</div>
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">
<span class="uil fs-5 lh-1 uil-bill text-info"></span>
<a href="{% url 'invoice_list' %}"><h4 class="fs-6 pt-3">{{ invoices }}</h4></a>
<a href="{% url 'invoice_list' request.dealer.slug %}"><h4 class="fs-6 pt-3">{{ invoices }}</h4></a>
<p class="fs-9 mb-0">{{ _("Invoices")}}</p>
</div>
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">

View File

@ -43,6 +43,6 @@
<div class="error-page">
<h1 class="error-code">{% trans "400" %}</h1>
<p class="error-message">{% trans "Bad Request" %}</p>
<a href="{% url 'inventory_stats' %}" class="error-button">{% trans "Go Back" %}</a>
<a href="{% url 'inventory_stats' request.dealer.slug %}" class="error-button">{% trans "Go Back" %}</a>
</div>
{% endblock content %}

View File

@ -46,13 +46,13 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>

View File

@ -22,44 +22,44 @@
<li class="collapsed-nav-item-title d-none">{% trans "Inventory"|capfirst %}</li>
{% if perms.inventory.add_car %}
<li class="nav-item">
<a id="btn-add-car" class="nav-link btn-add-car" href="{% url 'car_add' %}">
<a id="btn-add-car" class="nav-link btn-add-car" href="{% url 'car_add' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-plus-circle"></span></span><span class="nav-link-text">{% trans "add car"|capfirst %}</span>
</div>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'inventory_item_create' %}">
<a class="nav-link" href="{% url 'inventory_item_create' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-plus-circle"></span></span><span class="nav-link-text">{% trans "add invenotry item"|capfirst %}</span>
</div>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'purchase_order_list' %}">
<a class="nav-link" href="{% url 'purchase_order_list' request.dealer.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>
<li class="nav-item">
<a class="nav-link" href="{% url 'upload_cars' %}">
<a class="nav-link" href="{% url 'upload_cars' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-file-invoice"></span></span><span class="nav-link-text">{% trans "Upload Cars"|capfirst %}</span>
<span class="nav-link-icon"><span class="fas fa-file-import"></span></span><span class="nav-link-text">{% trans "Bulk Upload"|capfirst %}</span>
</div>
</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{% url 'inventory_stats' %}">
<a class="nav-link" href="{% url 'inventory_stats' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-car-side"></span></span><span class="nav-link-text">{% trans 'Cars'|capfirst %}</span>
</div>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'car_list' %}">
<a class="nav-link" href="{% url 'car_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-car-side"></span></span><span class="nav-link-text">{% trans 'Stock'|capfirst %}</span>
</div>
@ -82,7 +82,7 @@
<li class="collapsed-nav-item-title d-none">{% trans 'sales'|capfirst %}</li>
{% if perms.django_ledger.add_estimatemodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'estimate_create' %}">
<a class="nav-link" href="{% url 'estimate_create' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-list-ul"></span></span><span class="nav-link-text">{% trans "create quotation"|capfirst %}</span>
</div>
@ -91,7 +91,7 @@
{% endif %}
{% if perms.django_ledger.view_estimatemodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'estimate_list' %}">
<a class="nav-link" href="{% url 'estimate_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-clipboard-list"></span></span><span class="nav-link-text">{% trans "quotations"|capfirst %}</span>
</div>
@ -109,7 +109,7 @@
{% if perms.django_ledger.view_invoicemodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'invoice_list' %}">
<a class="nav-link" href="{% url 'invoice_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-file-invoice"></span></span><span class="nav-link-text">{% trans "invoices"|capfirst %}</span>
</div>
@ -118,7 +118,7 @@
{% endif %}
{% if perms.django_ledger.view_journalentrymodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'payment_list' %}">
<a class="nav-link" href="{% url 'payment_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-money-check"></span></span><span class="nav-link-text">{% trans "payments"|capfirst %}</span>
</div>
@ -214,7 +214,7 @@
<li class="collapsed-nav-item-title d-none">{% trans 'Financials' %}</li>
{% if perms.django_ledger.view_accountmodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'account_list' %}">
<a class="nav-link" href="{% url 'account_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fas fa-book-open"></span></span><span class="nav-link-text">{% trans 'Chart of Accounts'|capfirst %}</span>
</div>
@ -223,7 +223,7 @@
{% endif %}
{% if perms.django_ledger.view_bankaccountmodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'bank_account_list' %}">
<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>
@ -266,13 +266,13 @@
{% endif %}
{% if perms.django_ledger.view_billmodel %}
<li class="nav-item">
<a class="nav-link" href="{% url 'bill_list' %}">
<a class="nav-link" href="{% url 'bill_list' request.dealer.slug %}">
<div class="d-flex align-items-center">
<span class="nav-link-icon"><span class="fa-solid fa-money-bills"></span></span><span class="nav-link-text">{% trans 'bills'|capfirst %}</span>
</div>
</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
</div>
@ -364,7 +364,7 @@
aria-label="Toggle Navigation">
<span class="navbar-toggle-icon"><span class="toggle-line"></span></span>
</button>
<a class="navbar-brand me-1 me-sm-3" href="{% url 'home' %}">
<a class="navbar-brand me-1 me-sm-3" href="{% url 'home' request.dealer.slug %}">
<div class="d-flex align-items-center">
<img class="logo-img d-dark-none" src="{% static 'images/logos/logo-d.png' %}" alt="haikal" width="27" />
<img class="logo-img d-light-none" src="{% static 'images/logos/logo.png' %}" alt="haikal" width="27" />

View File

@ -15,5 +15,4 @@
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -2,7 +2,7 @@
{% load crispy_forms_filters %}
<form method="post"
id="customCardForm"
action="{% url 'add_custom_card' car.slug %}">
action="{% url 'add_custom_card' request.dealer.slug car.slug %}">
{% csrf_token %}
{{ form|crispy }}
<div class="d-flex gap-1">

View File

@ -166,7 +166,11 @@
<button type="button"
class="btn btn-sm btn-phoenix-success"
data-bs-toggle="modal"
data-bs-target="#customCardModal">{% trans 'Add' %}</button>
data-bs-target="#mainModal"
hx-get="{% url 'add_custom_card' request.dealer.slug car.slug %}"
hx-target=".main-modal-body"
hx-swap="innerHTML"
>{% trans 'Add' %}</button>
</td>
</tr>
{% endif %}
@ -188,7 +192,12 @@
<button type="button"
class="btn btn-sm btn-phoenix-success"
data-bs-toggle="modal"
data-bs-target="#registrationModal">{% trans 'Add' %}</button>
data-bs-target="#mainModal"
hx-get="{% url 'add_registration' request.dealer.slug car.slug %}"
hx-target=".main-modal-body"
hx-swap="innerHTML"
>{% trans 'Add' %}</button>
</td>
</tr>
{% endif %}
@ -219,7 +228,7 @@
<div>
{% if not car.get_transfer %}
{% if perms.inventory.change_car %}
<a href="{% url 'car_update' car.slug %}"
<a href="{% url 'car_update' request.dealer.slug car.slug %}"
class="btn btn-phoenix-warning btn-sm mt-1">{% trans "Edit" %}</a>
<a href="{% url 'transfer' car.slug %}"
class="btn btn-phoenix-danger btn-sm">
@ -277,7 +286,7 @@
<tr>
<td colspan="2">
{% if not car.get_transfer %}
<a href="{% url 'car_finance_update' car.finances.pk %}"
<a href="{% url 'car_finance_update' request.dealer.slug car.finances.pk %}"
class="btn btn-phoenix-warning btn-sm mb-3">{% trans "Edit" %}</a>
{% else %}
<span class="badge bg-danger">{% trans "Cannot Edit, Car in Transfer." %}</span>
@ -285,7 +294,7 @@
{% else %}
<p>{% trans "No finance details available." %}</p>
{% if perms.inventory.add_carfinance %}
<a href="{% url 'car_finance_create' car.slug %}"
<a href="{% url 'car_finance_create' request.dealer.slug car.slug %}"
class="btn btn-phoenix-success btn-sm mb-3">{% trans "Add" %}</a>
{% endif %}
</td>
@ -327,7 +336,7 @@
<tr>
<td colspan="2">
{% if not car.get_transfer %}
<a href="{% url 'car_colors_update' car.slug %}"
<a href="{% url 'car_colors_update' request.dealer.slug car.slug %}"
class="btn btn-phoenix-warning btn-sm mb-3">{% trans "Edit" %}</a>
{% else %}
<span class="badge bg-danger">{% trans "Cannot Edit, Car in Transfer." %}</span>
@ -340,7 +349,7 @@
<td colspan="2">
<p>{% trans "No color details available." %}</p>
{% if perms.inventory.add_carcolors %}
<a class="btn btn-phoenix-success btn-sm mb-3" href="{% url 'add_color' car.slug %}">{{ _("Add Color") }}</a>
<a class="btn btn-phoenix-success btn-sm mb-3" href="{% url 'add_color' request.dealer.slug car.slug %}">{{ _("Add Color") }}</a>
{% endif %}
</td>
</tr>
@ -372,7 +381,7 @@
<td>{{ reservation.reserved_until }}</td>
<td>
{% if reservation.is_active %}
<form method="post" action="{% url 'reservations' reservation.id %}">
<form method="post" action="{% url 'reservations' request.dealer.slug reservation.id %}">
{% csrf_token %}
<div class="btn-group">
<button type="submit"
@ -495,22 +504,22 @@
</div>
</div>
</div>
<!-- Registration Modal -->
<!-- Main Modal -->
<div class="modal fade"
id="registrationModal"
id="mainModal"
tabindex="-1"
aria-labelledby="registrationModalLabel"
aria-labelledby="mainModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="registrationModalLabel">{% trans 'Registration' %}</h5>
<h5 class="modal-title" id="mainModalLabel">{% trans 'Registration' %}</h5>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="main-modal-body" style="padding: 20px;">
<!-- Content will be loaded here via AJAX -->
</div>
</div>
@ -532,7 +541,7 @@
aria-label="Close"></button>
</div>
<div class="modal-body">{% trans 'Are you sure you want to reserve this car?' %}</div>
<form method="POST" action="{% url 'reserve_car' car.slug %}" class="form ">
<form method="POST" action="{% url 'reserve_car' request.dealer.slug car.slug %}" class="form">
{% csrf_token %}
<div class="p-1">
<div class="d-flex gap-1">
@ -577,52 +586,11 @@
<script>
document.addEventListener("DOMContentLoaded", function () {
const csrftoken = getCookie("csrftoken");
const ajaxUrl = "{% url 'ajax_handler' %}";
const ajaxUrl = "{% url 'ajax_handler' request.dealer.slug %}";
const customCardModal = document.getElementById("customCardModal");
const modalBody = customCardModal.querySelector(".modal-body");
// When the modal is triggered, load the form
customCardModal.addEventListener("show.bs.modal", function () {
const url = "{% url 'add_custom_card' car.slug %}";
fetch(url)
.then((response) => response.text())
.then((html) => {
modalBody.innerHTML = html;
})
.catch((error) => {
modalBody.innerHTML = '<p class="text-danger">Error loading form. Please try again later.</p>';
console.error("Error loading form:", error);
});
});
customCardModal.addEventListener("hidden.bs.modal", function () {
modalBody.innerHTML = "";
});
const registrationModal = document.getElementById("registrationModal");
const modalBody_r = registrationModal.querySelector(".modal-body");
// When the modal is triggered, load the form
registrationModal.addEventListener("show.bs.modal", function () {
const url = "{% url 'add_registration' car.slug %}";
fetch(url)
.then((response) => response.text())
.then((html) => {
modalBody_r.innerHTML = html;
})
.catch((error) => {
modalBody_r.innerHTML = '<p class="text-danger">{{_("Error loading form. Please try again later")}}.</p>';
console.error("Error loading form:", error);
});
});
registrationModal.addEventListener("hidden.bs.modal", function () {
modalBody_r.innerHTML = "";
});
const showSpecificationButton = document.getElementById("specification-btn");
const specificationsContent = document.getElementById("specificationsContent");
@ -689,7 +657,7 @@
document.querySelectorAll(".reserve-btn").forEach((button) => {
button.addEventListener("click", async function () {
try {
const response = await fetch(`{% url 'reserve_car' car.slug %}`, {
const response = await fetch(`{% url 'reserve_car' request.dealer.slug car.slug %}`, {
method: "POST",
headers: {
"X-CSRFToken": csrfToken,

View File

@ -29,13 +29,6 @@
{{ form|crispy }}
</div>
</div>
{% comment %} <div class="row g-1">
<div class="btn-group">
<button type="submit" class="btn btn-sm btn-success me-1"><i class="fa-solid fa-floppy-disk"></i>{% trans "Save" %}</button>
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-sm btn-danger"><i class="fa-solid fa-ban"></i>{% trans "Cancel" %}</a>
</div>
</div> {% endcomment %}
<div class="d-flex justify-content-center">
<button class="btn btn-sm btn-phoenix-success me-2" type="submit">
<i class="fa-solid fa-floppy-disk me-1"></i>

View File

@ -346,7 +346,7 @@
const optionsContent = document.getElementById("optionsContent")
const generationContainer = document.getElementById("generation-div")
const ajaxUrl = "{% url 'ajax_handler' %}";
const ajaxUrl = "{% url 'ajax_handler' request.dealer.slug %}";
const closeButton = document.querySelector(".btn-close");
const scanVinBtn = document.getElementById("scan-vin-btn");

View File

@ -330,7 +330,7 @@
const optionsContent = document.getElementById("optionsContent")
const generationContainer = document.getElementById("generation-div")
const ajaxUrl = "{% url 'ajax_handler' %}";
const ajaxUrl = "{% url 'ajax_handler' request.dealer.slug %}";
const closeButton = document.querySelector(".btn-close");
const scanVinBtn = document.getElementById("scan-vin-btn");

View File

@ -93,7 +93,7 @@
{% endif %}
</td>
<td class="align-middle white-space-nowrap text-start">
<a class="fs-9 fw-bold" href="{% url 'car_detail' car.slug %}">{{ car.vin }}</a>
<a class="fs-9 fw-bold" href="{% url 'car_detail' request.dealer.slug car.slug %}">{{ car.vin }}</a>
</td>
<td class="align-middle white-space-nowrap text-center fw-bold">{{ car.year }}</td>
{% if car.colors %}
@ -147,14 +147,14 @@
</td>
<td class="align-middle white-space-nowrap text-end pe-0 ps-4">
<a class="btn btn-sm btn-phoenix-success"
href="{% url 'car_detail' car.slug %}">{% trans "view"|capfirst %}</a>
href="{% url 'car_detail' request.dealer.slug car.slug %}">{% trans "view"|capfirst %}</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="7" class="d-flex flex-column align-items-center">
<p class="text-muted">{% trans "No cars available." %}</p>
<a href="{% url 'add_car' %}" class="btn btn-phoenix-primary">{% trans "Add a Car" %}</a>
<a href="{% url 'add_car' request.dealer.slug %}" class="btn btn-phoenix-primary">{% trans "Add a Car" %}</a>
</td>
</tr>
{% endfor %}

View File

@ -25,88 +25,88 @@
{% endblock customCSS %}
{% block content %}
<div class="container-fluid" id="projectSummary">
<div class="container-fluid" id="projectSummary">
<div class="row g-3 justify-content-between align-items-end mb-4">
<div class="col-12 col-sm-auto">
<h2 class="text-body-emphasis fw-bold mb-0">{{ _("Inventory") }}</h2>
</div>
<div class="col-12 col-sm-auto">
<h2 class="text-body-emphasis fw-bold mb-0">{{ _("Inventory") }}</h2>
</div>
</div>
<div class="row g-3 justify-content-between align-items-end mb-2">
<div class="col-4 col-sm-auto">
<ul
class="nav nav-links mx-n2"
hx-boost="true"
hx-push-url="false"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()">
<li class="nav-item">
<a class="nav-link px-2 py-1 active" aria-current="page" href="{% url 'car_list' %}"><span>{{ _("All") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.all }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' %}?status=available"><span>{{ _("Available") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.available }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' %}?status=reserved"><span>{{ _("Reserved") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.reserved }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' %}?status=transfer"><span>{{ _("Transfer") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.transfer }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' %}?status=sold"><span>{{ _("Sold") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.sold }})</span></a>
</li>
<li class="nav-item">
<button hx-on:click="toggle_filter()" class="btn btn-sm btn-phoenix-primary px-2 py-1">
<span><span class="fa fa-filter me-1"></span>{{ _("Filter") }}</span>
<span class="fas fa-caret-down fs-9 ms-1 filter-icon"></span>
</button>
</li>
</ul>
</div>
<div class="col-4 col-sm-auto">
<form hx-boost="true" action="{% url 'bulk_update_car_price' %}" method="post" hx-include=".car-checkbox" class="update-price-form d-flex flex-row align-items-center ms-auto d-none" style="float: right;">
{% csrf_token %}
<div class="input-group">
<input class="form-control" type="number" placeholder='{{ _("Price") }}' name="price" aria-label="Price" id="price" />
<button class="btn btn-sm btn-phoenix-primary" type="submit">{{ _("Update") }}</button>
</div>
<div class="col-4 col-sm-auto">
<ul
class="nav nav-links mx-n2"
hx-boost="true"
hx-push-url="false"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()">
<li class="nav-item">
<a class="nav-link px-2 py-1 active" aria-current="page" href="{% url 'car_list' request.dealer.slug %}"><span>{{ _("All") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.all }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' request.dealer.slug %}?status=available"><span>{{ _("Available") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.available }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' request.dealer.slug %}?status=reserved"><span>{{ _("Reserved") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.reserved }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' request.dealer.slug %}?status=transfer"><span>{{ _("Transfer") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.transfer }})</span></a>
</li>
<li class="nav-item">
<a class="nav-link px-2 py-1" href="{% url 'car_list' request.dealer.slug %}?status=sold"><span>{{ _("Sold") }}</span><span class="text-body-tertiary fw-semibold">({{ stats.sold }})</span></a>
</li>
<li class="nav-item">
<button hx-on:click="toggle_filter()" class="btn btn-sm btn-phoenix-primary px-2 py-1">
<span><span class="fa fa-filter me-1"></span>{{ _("Filter") }}</span>
<span class="fas fa-caret-down fs-9 ms-1 filter-icon"></span>
</button>
</li>
</ul>
</div>
<div class="col-4 col-sm-auto">
<form hx-boost="true" action="{% url 'bulk_update_car_price' %}" method="post" hx-include=".car-checkbox" class="update-price-form d-flex flex-row align-items-center ms-auto d-none" style="float: right;">
{% csrf_token %}
<div class="input-group">
<input class="form-control" type="number" placeholder='{{ _("Price") }}' name="price" aria-label="Price" id="price" />
<button class="btn btn-sm btn-phoenix-primary" type="submit">{{ _("Update") }}</button>
</div>
</form>
</div>
<div class="col-4 col-sm-auto">
<div class="d-flex align-items-center">
<div class="spinner-border mx-3 htmx-indicator" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="search-box me-3">
<form class="position-relative">
<input
class="form-control search-input search"
name="search"
type="search"
placeholder="Search"
aria-label="Search"
hx-get="{% url 'car_list' request.dealer.slug %}"
hx-trigger="keyup changed delay:500ms"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()"
/>
<span class="fas fa-search search-box-icon"></span>
</form>
</div>
<div class="col-4 col-sm-auto">
<div class="d-flex align-items-center">
<div class="spinner-border mx-3 htmx-indicator" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="search-box me-3">
<form class="position-relative">
<input
class="form-control search-input search"
name="search"
type="search"
placeholder="Search"
aria-label="Search"
hx-get="{% url 'car_list' %}"
hx-trigger="keyup changed delay:500ms"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()"
/>
<span class="fas fa-search search-box-icon"></span>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="d-flex align-items-center d-none filter">
<select
hx-get="{% url 'car_list' %}"
hx-get="{% url 'car_list' request.dealer.slug %}"
name="make"
hx-target=".model-select"
hx-select=".model-select"
@ -122,7 +122,7 @@
{% endfor %}
</select>
<select
hx-get="{% url 'car_list' %}"
hx-get="{% url 'car_list' request.dealer.slug %}"
hx-include=".make"
name="model"
hx-target=".year"
@ -153,7 +153,7 @@
</select>
<button
id="search"
hx-get="{% url 'car_list' %}"
hx-get="{% url 'car_list' request.dealer.slug %}"
hx-include=".make,.model,.year,.car_status"
hx-indicator=".htmx-indicator"
hx-target=".table-responsive"
@ -165,149 +165,147 @@
{{ _("Search") }}
</button>
</div>
<div class="table-responsive scrollbar">
<div class="d-flex flex-wrap align-items-center justify-content-between py-3 pe-0 fs-9">
<div
class="d-flex"
hx-boost="true"
hx-push-url="false"
hx-include=".make,.model,.year,.car_status"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()">
<div class="table-responsive scrollbar">
<div class="d-flex flex-wrap align-items-center justify-content-between py-3 pe-0 fs-9">
<div
class="d-flex"
hx-boost="true"
hx-push-url="false"
hx-include=".make,.model,.year,.car_status"
hx-target=".table-responsive"
hx-select=".table-responsive"
hx-swap="innerHTML show:window:top"
hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()"></div>
<div class="w-100 list table-responsive" >
<div class="form-check">
<input class="form-check-input ms-4" type="checkbox" id="select-all" /> <span class="ms-1 text-body-tertiary">{{ _("Select All") }}</span>
</div>
<table class="table fs-9 mb-0 border-top border-translucent">
<thead>
<tr>
<th class="sort white-space-nowrap align-middle" scope="col">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="select-all" />
</div>
</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("VIN") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col" data-sort="make">{{ _("Make") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col" data-sort="model">{{ _("Model") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col" data-sort="year">{{ _("Year") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Trim") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Color") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Date Received") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col" data-sort="car_status">{{ _("Status") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Inventory Ready") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col"></th>
</tr>
</thead>
<tbody class="list" id="project-list-table-body">
{% for car in cars %}
<tr class="position-static">
<td class="align-middle time white-space-nowrap">
<div class="form-check">
<input class="form-check-input car-checkbox"
type="checkbox"
name="car"
value="{{ car.pk }}"
id="car-{{car.pk}}" />
</div>
</td>
<td class="align-middle white-space-nowrap assignees">
<a class="fw-bold" href="{% url 'car_detail' car.slug %}">{{ car.vin }}</a>
</td>
<td class="align-middle white-space-nowrap make">
<p class="mb-0 fs-9 text-body">{{ car.id_car_make.get_local_name|default:car.id_car_make.name }}</p>
</td>
<td class="align-middle white-space-nowrap model">
<p class="mb-0 fs-9 text-body">{{ car.id_car_model.get_local_name|default:car.id_car_model.name }}</p>
</td>
<td class="align-middle white-space-nowrap year">
<p class="fw-bo text-body fs-9 mb-0">{{ car.year }}</p>
</td>
<td class="align-middle white-space-nowrap">
<p class="text-body-secondary fs-10 mb-0">{{ car.id_car_trim }}</p>
</td>
<td class="align-middle white-space-nowrap">
<div class="d-flex flex-row align-items-center">
<div class="d-flex flex-column align-items-center">
<span class="color-div"
style="background: linear-gradient(90deg, rgba({{ car.colors.exterior.rgb }},1) 10%, rgba({{ car.colors.exterior.rgb }},0.10) 100%)"
title="{{ car.colors.exterior.get_local_name }}"></span><span>{{ car.colors.exterior.get_local_name }}</span>
</div>
<div class="d-flex flex-column align-items-center">
<span class="color-div"
style="background: linear-gradient(90deg, rgba({{ car.colors.interior.rgb }},1) 10%, rgba({{ car.colors.interior.rgb }},0.10) 100%)"
title="{{ car.colors.interior.get_local_name }}"></span><span>{{ car.colors.interior.get_local_name }}</span>
</div>
</div>
</td>
<td class="align-middle white-space-nowrap">
<p class="fw-bold text-body mb-0">{{ car.receiving_date|naturalday|capfirst }}</p>
</td>
<td class="align-middle white-space-nowrap statuses">
{% if car.status == "available" %}
<span class="badge badge-phoenix fs-11 badge-phoenix-success">{{ _("Available") }}</span>
{% elif car.status == "reserved" %}
<span class="badge badge-phoenix fs-11 badge-phoenix-danger">{{ _("Reserved") }}</span>
{% elif car.status == "sold" %}
<span class="badge badge-phoenix fs-11 badge-phoenix-info">{{ _("Sold") }}</span>
{% elif car.status == "transfer" %}
<span class="badge badge-phoenix fs-11 badge-phoenix-warning">{{ _("Transfer") }}</span>
{% endif %}
</td>
<td class="align-middle white-space-nowrap">
{% if not car.ready %}
<span class="text-danger"> {{ _("NO") }} </span>
{%else%}
<span class="text-success"> {{ _("YES") }} </span>
{%endif%}
</td>
<td class="align-middle text-end white-space-nowrap pe-0 action">
<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 class="dropdown-item" href="{% url 'car_detail' car.slug %}">{{ _("View") }}</a>
<a class="dropdown-item" href="#!">{{ _("Export") }}</a>
</div>
</div>
</td>
</tr>
{% empty %}
<div class="col-12">
<div class="text-center py-5">
<div class="text-body-secondary">
<i class="fas fa-car fa-4x mb-3 opacity-50"></i>
<h4 class="text-body-secondary">{{ _("No vehicles found") }}</h4>
<p class="text-body-tertiary">{{ _("Try adjusting your search criteria or filters") }}</p>
</div>
</div>
{% for car in cars %}
<div class="card border mb-3 py-0 px-0" id="project-list-table-body">
<div class="card-body">
<div class="row align-items-center">
<div class="col-auto">
<div class="form-check">
<input class="form-check-input car-checkbox" type="checkbox" name="car" value="{{ car.pk }}" id="car-{{car.pk}}" />
</div>
</div>
<!-- Vehicle Image/Icon -->
<div class="col-auto">
<div class="avatar avatar-3xl">
<img class="rounded-soft shadow shadow-lg" src="{% static 'images/cars/' %}{{ car.vin }}.png" alt="{{ car.vin }}" />
</div>
</div>
<!-- Vehicle Details -->
<div class="col">
<div class="row">
<!-- Make/Model/Specs -->
<div class="col-md-4">
<h5 class="text-body-emphasis fw-bold">{{ car.year }}</h5>
<p class="text-body-emphasis fw-bold">
<a href="{% url 'car_detail' request.dealer.slug car.slug %}" class="text-decoration-none text-body-emphasis">
{{ car.id_car_make.get_local_name }}
</a>
<small>{{ car.id_car_model.get_local_name }}</small>
</p>
<small class="text-body-secondary" dir="ltr">
{{ car.id_car_trim }}
</small>
</div>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
<!-- Color and Date -->
<div class="col-md-3">
<p class="text-body mb-1">
{{ car.colors.exterior.get_local_name }}
</p>
<small class="text-body-secondary">
{{ car.receiving_date|naturalday|capfirst }}
</small>
</div>
<!-- Status Badge -->
<div class="col-md-3">
{% if car.status == "available" %}
<span class="badge badge-phoenix fs-10 badge-phoenix-success text-uppercase px-3 py-2">{{ _("Available") }}</span>
{% elif car.status == "reserved" %}
<span class="badge badge-phoenix fs-10 badge-phoenix-warning text-uppercase px-3 py-2">{{ _("Reserved") }}</span>
{% elif car.status == "sold" %}
<span class="badge badge-phoenix fs-10 badge-phoenix-danger text-uppercase px-3 py-2">{{ _("Sold") }}</span>
{% elif car.status == "transfer" %}
<span class="badge badge-phoenix fs-10 badge-phoenix-info text-uppercase px-3 py-2">{{ _("Transfer") }}</span>
{% endif %}
</div>
<!-- Ready Status -->
<div class="col-md-2">
<div class="d-flex align-items-center">
<span class="fs-10 fw-light me-2">{{ _("Inventory Ready") }}</span>
{% if car.ready %}
<span class="badge bg-success rounded-circle p-1 me-2">
<span class="visually-hidden">Ready</span>
</span>
<span class="text-success fw-bold">{{ _("Yes") }}</span>
{% else %}
<span class="badge bg-danger rounded-circle p-1 me-2">
<span class="visually-hidden">Not Ready</span>
</span>
<span class="text-danger fw-bold">{{ _("No") }}</span>
{% endif %}
</div>
</div>
</div>
</div>
<!-- Action Menu -->
<div class="col-auto">
<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 class="dropdown-item" href="{% url 'car_detail' request.dealer.slug car.slug %}"> <span class="fas fa-eye me-2"></span>{{ _("View") }} </a>
<a class="dropdown-item" href="{% url 'car_update' request.dealer.slug car.slug %}"> <span class="fas fa-edit me-2"></span>{{ _("Edit") }} </a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'car_delete' request.dealer.slug car.slug %}"> <span class="fas fa-trash me-2"></span>{{ _("Remove") }} </a>
</div>
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% empty %}
<div class="text-center py-5">
<div class="text-body-secondary">
<span class="fas fa-car fa-4x mb-3 opacity-50"></span>
<h4 class="text-body-secondary">{{ _("No vehicles found") }}</h4>
<p class="text-body-tertiary">{{ _("Try adjusting your search criteria or filters") }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block customJS %}

View File

@ -3,7 +3,7 @@
<div class="w-100 g-3">
<form method="post"
id="registrationForm"
action="{% url 'add_registration' car.slug %}">
action="{% url 'add_registration' request.dealer.slug car.slug %}">
{% csrf_token %}
{{ form|crispy }}
<div class="d-flex gap-1">

View File

@ -67,7 +67,7 @@
<ul>
{% for trim in model.trims %}
<li>
<a href="{% url 'car_inventory' make_id=make.slug model_id=model.slug trim_id=trim.slug %}">{{ trim.trim_name }}</a>&nbsp;-&nbsp;{% trans "Total" %}:
<a href="{% url 'car_inventory' dealer_slug=request.dealer.slug make_id=make.slug model_id=model.slug trim_id=trim.slug %}">{{ trim.trim_name }}</a>&nbsp;-&nbsp;{% trans "Total" %}:
<strong>{{ trim.total_cars }}</strong>
</li>
{% empty %}
@ -86,15 +86,15 @@
{% endfor %}
</div>
{% if is_paginated %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -13,12 +13,12 @@
</tr>
</thead>
<tbody>
{% for i in inventory_list %}
<tr class="hover-actions-trigger">
<td class="ps-2 fw-medium">{{ i.item_model__name }}</td>
<td class="ps-2 fw-medium">{{ i.item_model__name }}</td>
<td class="ps-2 fw-medium">{{ i.item_model__name }}</td>
<td class="text-center">{{ i.item_model__uom__name }}</td>
<td class="text-end pe-3">{{ i.total_quantity | floatformat:3 }}</td>

View File

@ -61,16 +61,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
{% endblock %}

View File

@ -62,16 +62,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
{% endblock %}

View File

@ -52,14 +52,14 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% endif %}

View File

@ -14,7 +14,7 @@
<div class="row mt-4">
<div class="d-flex justify-content-between mb-2">
<h3 class="">{% trans "Bills" %}</h3>
<a href="{% url 'bill-create' entity.slug %}" class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{% trans 'New Bill' %}</a>
<a href="{% url 'bill-create' request.dealer.slug entity.slug %}" class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{% trans 'New Bill' %}</a>
</div>
<div class="col-12">
@ -81,7 +81,7 @@
<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 'bill-detail' entity_slug=entity.slug bill_pk=bill.pk %}" class="dropdown-item text-success-dark">{% trans 'View Bill detail' %}</a>
<a href="{% url 'bill-detail' dealer_slug=request.dealer.slug entity_slug=entity.slug bill_pk=bill.pk %}" class="dropdown-item text-success-dark">{% trans 'View' %}</a>
</div>
</div>
</td>
@ -96,16 +96,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -17,7 +17,7 @@
<div class="btn-group">
<button type="button" class="btn btn-sm btn-phoenix-secondary" data-bs-dismiss="modal">{% trans 'No' %}</button>
<div class="btn btn-sm btn-phoenix-danger">
<form action="{% url 'account_delete' account.pk %}" method="post">
<form action="{% url 'account_delete' request.dealer.slug account.pk %}" method="post">
{% csrf_token %}
<button type="submit" class="btn btn-sm btn-phoenix-danger">{% trans 'Yes' %}</button>
</form>
@ -99,7 +99,7 @@
<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 class="dropdown-item text-success" href="{% url 'payment_details' tx.journal_entry.pk %}">{% trans 'View Transacrions'|capfirst %}</a>
<a class="dropdown-item" href="{% url 'payment_details' request.dealer.slug tx.journal_entry.pk %}">{% trans 'view'|capfirst %}</a>
</div>
</div>
</td>
@ -135,7 +135,7 @@
</div>
<div class="mt-3 d-flex">
<a class="btn btn-sm btn-phoenix-primary me-1" href="{% url 'account_update' account.pk %}">
<a class="btn btn-sm btn-phoenix-primary me-1" href="{% url 'account_update' request.dealer.slug account.pk %}">
<!-- <i class="bi bi-pencil-square"></i> -->
<i class="fa-solid fa-pen-to-square"></i> {{ _('Edit') }}
</a>
@ -143,7 +143,7 @@
<!-- <i class="bi bi-trash-fill"></i> -->
<i class="fa-solid fa-trash"></i> {{ _('Delete') }}
</a>
<a class="btn btn-sm btn-phoenix-secondary" href="{% url 'account_list' %}">
<a class="btn btn-sm btn-phoenix-secondary" href="{% url 'account_list' request.dealer.slug %}">
<!-- <i class="bi bi-arrow-left-square-fill"></i> -->
<i class="fa-regular fa-circle-left"></i> {% trans 'Back to List' %}
</a>

View File

@ -11,7 +11,7 @@
<div class="row mt-4">
<div class="d-flex justify-content-between mb-2">
<h3 class=""><i class="fa-solid fa-book"></i> {% trans "Accounts" %}</h3>
<a href="{% url 'account_create' %}" class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{% trans 'New Account' %}</a>
<a href="{% url 'account_create' request.dealer.slug %}" class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{% trans 'New Account' %}</a>
</div>
<!-- Account Type Tabs -->

View File

@ -38,8 +38,8 @@
<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 'account_detail' account.uuid %}" class="dropdown-item text-success-dark">
{% trans "View Journal Entries" %}
<a href="{% url 'account_detail' request.dealer.slug account.uuid %}" class="dropdown-item text-success-dark">
{% trans "View" %}
</a>
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">{% trans "Delete" %}</button>

View File

@ -113,16 +113,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
<!--test-->

View File

@ -42,14 +42,14 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>

View File

@ -121,15 +121,15 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -88,11 +88,11 @@
{% endif %}
{% for bill in bills %}
<div class="col">
{% include 'django_ledger/bills/includes/card_bill.html' with bill=bill entity_slug=entity.slug style='dashboard' %}
{% include 'django_ledger/bills/includes/card_bill.html' with dealer_slug=request.dealer.slug bill=bill entity_slug=entity.slug style='dashboard' %}
</div>
{% endfor %}
<div class="col">
{% include 'django_ledger/bills/includes/card_bill.html' with create_bill=True entity_slug=entity.slug style='dashboard' %}
{% include 'django_ledger/bills/includes/card_bill.html' with dealer_slug=request.dealer.slug create_bill=True entity_slug=entity.slug style='dashboard' %}
</div>
</div>
</div>

View File

@ -24,9 +24,9 @@
</div>
</div>
<div class="col-auto">
<div class="d-flex">
{% include 'partials/search_box.html' %}
</div>
<div class="d-flex">
{% include 'partials/search_box.html' %}
</div>
</div>
</div>
@ -123,16 +123,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
</section>
{% endblock %}

View File

@ -1,90 +1,90 @@
{% load i18n static %}
<div class="d-flex justify-content-between align-items-center mt-4">
<div class="text-body-secondary">
{{ _("Showing") }} {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}
{{ _("of") }} {{ page_obj.paginator.count }} {{ _("results") }}
</div>
<nav aria-label="Page navigation">
<ul class="pagination mb-0">
<div class="text-body-secondary">
{{ _("Showing") }} {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}
{{ _("of") }} {{ page_obj.paginator.count }} {{ _("results") }}
</div>
<nav aria-label="Page navigation">
<ul class="pagination mb-0">
{# First Page Link #}
{% if page_obj.has_previous %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page=1{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'First' %}">
<span class="fas fa-angle-double-left" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-angle-double-left" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{% if page_obj.has_previous %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page=1{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'First' %}">
<span class="fas fa-angle-double-left" aria-hidden="true"></span>
{# Previous Page Link #}
{% if page_obj.has_previous %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.previous_page_number }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Previous' %}">
<span class="fas fa-chevron-left" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-chevron-left" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{# Page Numbers #}
{% for num in page_obj.paginator.page_range %}
{% if num == 1 or num == page_obj.paginator.num_pages or num >= page_obj.number|add:-2 and num <= page_obj.number|add:2 %}
<li class="page-item {% if num == page_obj.number %}active{% endif %}">
<a class="page-link" {% if num == page_obj.number %}aria-current="page"{% endif %}
href="?page={{ num }}{% if q %}&q={{q}}{% endif %}">
{{ num }}
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-angle-double-left" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{% endfor %}
{# Previous Page Link #}
{% if page_obj.has_previous %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.previous_page_number }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Previous' %}">
<span class="fas fa-chevron-left" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-chevron-left" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{# Page Numbers #}
{% for num in page_obj.paginator.page_range %}
{% if num == 1 or num == page_obj.paginator.num_pages or num >= page_obj.number|add:-2 and num <= page_obj.number|add:2 %}
<li class="page-item {% if num == page_obj.number %}active{% endif %}">
<a class="page-link" {% if num == page_obj.number %}aria-current="page"{% endif %}
href="?page={{ num }}{% if q %}&q={{q}}{% endif %}">
{{ num }}
</a>
</li>
{% endif %}
{% endfor %}
{# Next Page Link #}
{% if page_obj.has_next %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.next_page_number }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Next' %}">
<span class="fas fa-chevron-right" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-chevron-right" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{% if page_obj.has_next %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.next_page_number }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Next' %}">
<span class="fas fa-chevron-right" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-chevron-right" aria-hidden="true"></span>
</span>
</li>
{% endif %}
{# Last Page Link #}
{% if page_obj.has_next %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.paginator.num_pages }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Last' %}">
<span class="fas fa-angle-double-right" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-angle-double-right" aria-hidden="true"></span>
</span>
</li>
{% endif %}
</ul>
</nav>
{% if page_obj.has_next %}
<li class="page-item rounded-md overflow-hidden">
<a class="page-link px-3 py-2 border border-gray-300 bg-white text-blue-600 hover:bg-gray-100 transition-colors duration-200" href="?page={{ page_obj.paginator.num_pages }}{% if q %}&q={{q}}{% endif %}" aria-label="{% trans 'Last' %}">
<span class="fas fa-angle-double-right" aria-hidden="true"></span>
</a>
</li>
{% else %}
<li class="page-item disabled rounded-md overflow-hidden">
<span class="page-link px-3 py-2 border border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed">
<span class="fas fa-angle-double-right" aria-hidden="true"></span>
</span>
</li>
{% endif %}
</ul>
</nav>
</div>

View File

@ -56,7 +56,7 @@
<div class="mt-3">
<button type="submit" class="btn btn-phoenix-primary">Save</button>
<a href="{% url 'purchase_order_list' %}" class="btn btn-phoenix-secondary">Cancel</a>
<a href="{% url 'purchase_order_list' request.dealer.slug %}" class="btn btn-phoenix-secondary">Cancel</a>
</div>
</form>
</div>

View File

@ -11,11 +11,11 @@
<h3>{% trans "Provide billing data"|upper %}</h3>
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-sm btn-phoenix-success me-2">
<i class="fa fa-save me-1"></i>{{ _("Save") }}
</button>
{% if object %}
{% if object %}
<a class="btn btn-sm btn-phoenix-danger " href="{% url 'billing_info_delete' %}"><i class="fa-solid fa-trash me-1"></i> {{ _("Delete") }}</a>
{% endif %}

View File

@ -162,7 +162,7 @@
<div class="card-footer bg-light">
<div class="d-flex flex-wrap gap-2 justify-content-between">
<a href="{% url 'purchase_order_update' entity_slug=entity_slug po_pk=po_model.pk %}"
<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' %}
</a>
@ -171,28 +171,28 @@
{# Status Action Buttons #}
{% if po_model.can_draft %}
<button class="btn btn-phoenix-secondary"
onclick="showPOModal('Draft PO', '{% url 'po-action-mark-as-draft' entity_slug po_model.pk %}', 'Mark As Draft')">
onclick="showPOModal('Draft PO', '{% url 'po-action-mark-as-draft' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Draft')">
<i class="fas fa-file me-2"></i>{% trans 'Mark as Draft' %}
</button>
{% endif %}
{% if po_model.can_review %}
<button class="btn btn-phoenix-warning"
onclick="showPOModal('Review PO', '{% url 'po-action-mark-as-review' entity_slug po_model.pk %}', 'Mark As Review')">
onclick="showPOModal('Review PO', '{% url 'po-action-mark-as-review' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Review')">
<i class="fas fa-search me-2"></i>{% trans 'Mark as Review' %}
</button>
{% endif %}
{% if po_model.can_approve %}
<button class="btn btn-phoenix-success"
onclick="showPOModal('Approve PO', '{% url 'po-action-mark-as-approved' entity_slug po_model.pk %}', 'Mark As Approved')">
onclick="showPOModal('Approve PO', '{% url 'po-action-mark-as-approved' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Approved')">
<i class="fas fa-check-circle me-2"></i>{% trans 'Mark as Approved' %}
</button>
{% endif %}
{% if po_model.can_fulfill %}
<button class="btn btn-phoenix-primary"
onclick="showPOModal('Fulfill PO', '{% url 'po-action-mark-as-fulfilled' entity_slug po_model.pk %}', 'Mark As Fulfilled')">
onclick="showPOModal('Fulfill PO', '{% url 'po-action-mark-as-fulfilled' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Fulfilled')">
<i class="fas fa-truck me-2"></i>{% trans 'Mark as Fulfilled' %}
</button>
@ -201,21 +201,21 @@
{# Danger Action Buttons #}
{% if po_model.can_delete %}
<button class="btn btn-outline-danger"
onclick="showPOModal('Cancel PO', '{% url 'po-delete' entity_slug po_model.pk %}', 'Mark As Cancelled')">
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 %}
{% if po_model.can_void %}
<button class="btn btn-outline-danger"
onclick="showPOModal('Void PO', '{% url 'po-action-mark-as-void' entity_slug po_model.pk %}', 'Mark As Void')">
onclick="showPOModal('Void PO', '{% url 'po-action-mark-as-void' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Void')">
<i class="fas fa-times-circle me-2"></i>{% trans 'Void' %}
</button>
{% endif %}
{% if po_model.can_cancel %}
<button class="btn btn-outline-danger"
onclick="showPOModal('Cancel PO', '{% url 'po-action-mark-as-canceled' entity_slug po_model.pk %}', 'Mark As Cancelled')">
onclick="showPOModal('Cancel PO', '{% url 'po-action-mark-as-canceled' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Cancelled')">
<i class="fas fa-ban me-2"></i>{% trans 'Cancel' %}
</button>
@ -228,7 +228,7 @@
{% else %}
<div class="card border-0 shadow-sm text-center py-5">
<div class="card-body">
<a href="{% url 'purchase_order_create' %}" class="text-decoration-none">
<a href="{% url 'purchase_order_create' request.dealer.slug %}" class="text-decoration-none">
<span class="text-muted mb-3 d-inline-block">{% icon "ic:baseline-add-circle-outline" 48 %}</span>
<h3 class="h4 text-muted">{% trans 'New Purchase Order' %}</h3>
</a>

View File

@ -3,7 +3,7 @@
{% block content %}
<form action="{% url 'inventory_item_create' po_model.pk %}" method="post">
<form action="{% url 'inventory_item_create' request.dealer.slug po_model.pk %}" method="post">
{% csrf_token %}
{% include "purchase_orders/partials/po-select.html" with name="make" target="model" data=make_data pk=po_model.pk %}
{% include "purchase_orders/partials/po-select.html" with name="model" target="serie" data=model_data pk=po_model.pk %}

View File

@ -4,7 +4,7 @@
{% load custom_filters %}
{% load widget_tweaks %}
<form action="{% url 'purchase_order_update_items' entity_slug=entity_slug po_pk=po_model.uuid %}"
<form action="{% url 'purchase_order_update_items' dealer_slug=dealer_slug entity_slug=entity_slug po_pk=po_model.uuid %}"
method="post">
<div class="row g-3">
<div class="col-12">
@ -60,7 +60,7 @@
{{ f.create_bill|add_class:"form-check-input" }}
{% elif f.instance.bill_model %}
<a class="btn btn-sm btn-phoenix-secondary"
href="{% url 'bill-detail' entity_slug=entity_slug bill_pk=f.instance.bill_model_id %}">
href="{% url 'bill-detail' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=f.instance.bill_model_id %}">
{% trans 'View Bill' %}
</a>
{% endif %}

View File

@ -3,7 +3,7 @@
<select class="form-control"
name="{{name}}" id="{{name}}"
{% if name != "trim" %}
hx-get="{% url 'inventory_items_filter' %}"
hx-get="{% url 'inventory_items_filter' request.dealer.slug %}"
hx-target="#form-{{target}}"
hx-select="#form-{{target}}"
hx-swap="outerHTML"

View File

@ -6,7 +6,7 @@
{% block content %}
<div class="row justify-content-center">
<div class="col-md-6">
<form action="{% url 'po-delete' entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
<form action="{% url 'po-delete' dealer_slug=request.dealer.slug entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
method="post">
{% csrf_token %}
<div class="card shadow">
@ -15,10 +15,10 @@
Purchase Order {{ po_model.po_number }}?</h2>
<p class="card-text text-muted mb-4">All transactions associated with this Purchase Order will be deleted.
If you want to void the PO instead, <a href="{% url 'purchase_order_detail' entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}" class="text-decoration-none">click here</a></p>
If you want to void the PO instead, <a href="{% url 'purchase_order_detail' dealer_slug=request.dealer.slug pk=po_model.uuid %}" class="text-decoration-none">click here</a></p>
<div class="d-flex justify-content-center gap-3 mt-4">
<a href="{% url 'purchase_order_update' entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
<a href="{% url 'purchase_order_update' dealer_slug=request.dealer.slug entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
class="btn btn-phoenix-primary px-4">{% trans 'Go Back' %}</a>
<button type="submit" class="btn btn-phoenix-danger px-4">{% trans 'Delete' %}</button>
</div>

View File

@ -7,19 +7,28 @@
{% block content %}
<div class="container-fluid mt-4">
<div class="row g-1">
<div class="col-lg-12">
<div class="d-flex flex-column gap-3">
<!-- PO Card -->
<div class="card">
<div class="card-body">
{% include 'purchase_orders/includes/card_po.html' with po_model=po_model entity_slug=entity_slug style='po-detail' %}
{% include 'purchase_orders/includes/card_po.html' with dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug style='po-detail' %}
</div>
</div>
<!-- PO Stats Card-->
<div class="card mb-4">
<!-- PO List Button -->
<a class="btn btn-phoenix-primary w-100 py-2"
href="{% url 'purchase_order_list' request.dealer.slug %}">
<i class="fas fa-list me-2"></i>{% trans 'PO List' %}
</a>
</div>
</div>
<!-- Main Content -->
<div class="col-lg-8">
<!-- Stats Cards -->
<div class="card mb-4">
<div class="card-body">
<div class="row text-center">
<div class="col-md-6 border-end">
@ -41,29 +50,29 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-12">
<!-- PO Details -->
<div class="card">
<div class="card-body">
<h3 class="h4 fw-light mb-2">{{ po_model.po_title }}</h3>
<div class="card">
<div class="card-body">
<h3 class="h4 fw-light mb-2">{{ po_model.po_title }}</h3>
<!-- PO Items Table -->
<div class="table-responsive">
{% po_item_table1 po_items %}
</div>
<div class="table-responsive">
{% po_item_table1 po_items %}
</div>
</div>
<!--POS list-->
<a class="btn btn-phoenix-primary w-100 py-2 mt-2"
href="{% url 'purchase_order_list' %}">
<i class="fas fa-list me-2"></i>{% trans 'PO List' %}
</a>
</div>
<!--POS list-->
<a class="btn btn-phoenix-primary w-100 py-2 mt-2"
href="{% url 'purchase_order_list' %}">
<i class="fas fa-list me-2"></i>{% trans 'PO List' %}
</a>
</div>
</div>
</div>
{% include "purchase_orders/includes/mark_as.html" %}
{% endblock %}

View File

@ -19,9 +19,9 @@
{{ _("Purchase Orders") |capfirst }}
</h2>
<div>
<a href="{% url 'purchase_order_create' %}"
<a href="{% url 'purchase_order_create' request.dealer.slug %}"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{{ _("Create New PO") }}</a>
<a href="{% url 'inventory_item_create' %}?for_po=1"
<a href="{% url 'inventory_item_create' request.dealer.slug %}?for_po=1"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{{ _("Create Inventory Item for PO") }}</a>
</div>
</div>
@ -67,8 +67,8 @@
<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' po.pk %}" class="dropdown-item text-success-dark">{% trans 'PO Detail' %}</a>
<a href="{% url 'view_items_inventory' entity_slug=entity_slug po_pk=po.pk %}" class="dropdown-item text-success-dark">{% trans 'View Inventory Items' %}</a>
<a href="{% url 'purchase_order_detail' request.dealer.slug po.pk %}" class="dropdown-item text-success-dark">{% trans 'Detail' %}</a>
<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 'View Inventory Items' %}</a>
</div>
</div>
</td>
@ -82,16 +82,16 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
{% endif %}
</div>
{% endif %}
</div>
{% include 'modal/delete_modal.html' %}
{% endblock %}

View File

@ -12,12 +12,12 @@
<div class="row g-4">
<div class="col-12">
{% include 'purchase_orders/includes/card_po.html' with style='po-detail' po_model=po_model entity_slug=entity_slug %}
{% include 'purchase_orders/includes/card_po.html' with style='po-detail' dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug %}
</div>
<div class="col-12">
<div class="card shadow-sm">
<div class="card-body">
<form action="{% url 'purchase_order_update' entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
<form action="{% url 'purchase_order_update' dealer_slug=request.dealer.slug entity_slug=view.kwargs.entity_slug po_pk=po_model.uuid %}"
method="post">
<div class="row g-3">
<div class="col-12">
@ -26,9 +26,9 @@
<button type="submit"
class="btn btn-phoenix-success w-100 my-2">{% trans 'Save PO' %}
</button>
<a href="{% url 'purchase_order_detail' po_model.uuid %}"
<a href="{% url 'purchase_order_detail' request.dealer.slug po_model.uuid %}"
class="btn btn-phoenix-secondary w-100 my-2">{% trans 'Back to PO Detail' %}</a>
<a href="{% url 'purchase_order_list' %}"
<a href="{% url 'purchase_order_list' request.dealer.slug %}"
class="btn btn-phoenix-info
info w-100 my-2">{% trans 'PO List' %}</a>
</div>

View File

@ -57,14 +57,14 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
<div>
{% endblock content %}

View File

@ -28,7 +28,7 @@
</td>
<td class="has-text-centered">{% if item.bill_model_id %}
<a class="is-small is-info button"
href="{% url 'bill-detail' entity_slug=entity_slug bill_pk=item.bill_model_id %}">View
href="{% url 'bill-detail' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=item.bill_model_id %}">View
Bill</a>{% endif %}
</td>
</tr>

View File

@ -16,7 +16,7 @@
<p>{% trans "Are you sure you want to Cancel this Estimate?" %}</p>
</div>
<div class="modal-footer flex justify-content-center border-top-0">
<a type="button" class="btn btn-sm btn-phoenix-danger w-100" href="{% url 'estimate_mark_as' estimate.pk %}?mark=canceled">
<a type="button" class="btn btn-sm btn-phoenix-danger w-100" href="{% url 'estimate_mark_as' request.dealer.slug estimate.pk %}?mark=canceled">
<i class="fa-solid fa-circle-check"></i> {% trans "Yes" %}
</a>
</div>
@ -40,7 +40,7 @@
<div class="modal-body">
{% trans 'Are you sure ?' %}
<div class="modal-footer flex justify-content-center border-top-0">
<form id="confirmForm" method="POST" action="{% url 'estimate_mark_as' estimate.pk %}?mark=approved" class="form">
<form id="confirmForm" method="POST" action="{% url 'estimate_mark_as' request.dealer.slug estimate.pk %}?mark=approved" class="form">
{% csrf_token %}
<div class="container-fluid m-0 p-0">
<button type="button" class="btn btn-phoenix-danger btn-sm" data-bs-dismiss="modal"><i class="fa-solid fa-ban"></i> {% trans 'No' %}</button>
@ -74,32 +74,28 @@
</div>
</div>
<div class="d-flex align-items-center gap-2">
{% if estimate.status == 'draft' %}
<a href="{% url 'send_email' 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>
{% if estimate.invoicemodel_set.first %}
<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>
<button class="btn btn-phoenix-primary" data-bs-toggle="modal" data-bs-target="#POModal"><span class="d-none d-sm-inline-block"><i class="fa-solid fa-receipt"></i> {% trans 'View Purchase Order' %}</span></button>
{% endif %}
{% if estimate.status == 'draft' %}
<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>
<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 Sent' %}</span></button>
{% elif estimate.status == 'in_review' %}
<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>
{% elif estimate.status == 'approved' %}
{% if estimate.sale_orders.first %}
<!--if there is a sales order for an estimate-->
<!--View sales Order-->
<a href="{% url 'order_detail' estimate.sale_orders.first.pk %}" class="btn btn-phoenix-primary btn-sm" type="button"><i class="fa-solid fa-cart-shopping"></i>
{{ _("View Sales Order")}}
</a>
{% if estimate.sale_orders.first.invoice %}
<a href="{% url 'invoice_detail' estimate.invoicemodel_set.first.pk %}" class="btn btn-phoenix-primary btn-sm" type="button"><i class="fa-solid fa-receipt"></i>
{{ _("View Invoice")}}</a>
{% else %}
<!--if there is no invoice for a sale order create invoice -->
<a href="{% url 'invoice_create' 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 %}
<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>
<a href="{% url 'preview_sale_order' request.dealer.slug estimate.pk %}" class="btn btn-phoenix-primary"><span class="d-none d-sm-inline-block">{{ _("Preview Sale Order") }}</span></a>
{% else %}
<!--if no sales order for the estimate Create sales order-->
<a href="{% url 'create_sale_order' 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>
<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 %}
{% elif estimate.status == 'in_review' %}
<a href="{% url 'estimate_preview' estimate.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 'estimate_preview' request.dealer.slug estimate.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>
{% endif %}
{% if estimate.can_cancel %}
{% if perms.django_ledger.change_estimatemodel %}
@ -109,42 +105,42 @@
</div>
</div>
<div class="container bg-body dark__bg-gray-1100 p-4 mb-4 rounded-2">
<div class="row">
<div class="col mb-2">
<h6><i class="fa-solid fa-hashtag"></i> {% trans 'Quotation Number' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.estimate_number}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-calendar-days"></i> {% trans 'Quotation Date' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.created}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-user"></i> {% trans 'Customer' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.customer.customer_name}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-envelope"></i> {% trans 'Email' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.customer.email}}</p>
</div>
<div class="col">
<h6><i class="fa-solid fa-list"></i> {% trans "Quotation Status" %}:</h6>
<div class="fs-9 text-body-secondary fw-semibold mb-0">
{% if estimate.status == 'draft' %}
<span class="badge text-bg-warning">{% trans "Draft" %}</span>
{% elif estimate.status == 'in_review' %}
<span class="badge text-bg-info">{% trans "In Review" %}</span>
{% elif estimate.status == 'approved' %}
<span class="badge text-bg-success">{% trans "Approved" %}</span>
{% elif estimate.status == 'completed' %}
<span class="badge text-bg-success">{% trans "Completed" %}</span>
{% elif estimate.status == 'canceled' %}
<span class="badge text-bg-danger">{% trans "Canceled" %}</span>
{% endif %}
</div>
</div>
<div class="row">
<div class="col mb-2">
<h6><i class="fa-solid fa-hashtag"></i> {% trans 'Quotation Number' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.estimate_number}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-calendar-days"></i> {% trans 'Quotation Date' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.created}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-user"></i> {% trans 'Customer' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.customer.customer_name}}</p>
</div>
<div class="col mb-2">
<h6><i class="fa-solid fa-envelope"></i> {% trans 'Email' %}:</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{estimate.customer.email}}</p>
</div>
<div class="col">
<h6><i class="fa-solid fa-list"></i> {% trans "Quotation Status" %}:</h6>
<div class="fs-9 text-body-secondary fw-semibold mb-0">
{% if estimate.status == 'draft' %}
<span class="badge text-bg-warning">{% trans "Draft" %}</span>
{% elif estimate.status == 'in_review' %}
<span class="badge text-bg-info">{% trans "In Review" %}</span>
{% elif estimate.status == 'approved' %}
<span class="badge text-bg-success">{% trans "Approved" %}</span>
{% elif estimate.status == 'completed' %}
<span class="badge text-bg-success">{% trans "Completed" %}</span>
{% elif estimate.status == 'canceled' %}
<span class="badge text-bg-danger">{% trans "Canceled" %}</span>
{% endif %}
</div>
</div>
</div>
</div>
<div class="px-0">
<div class="table-responsive scrollbar">
<table id="estimate-table" class="table fs-9 text-body mb-0">
@ -245,7 +241,7 @@
// Get the form element
const form = document.getElementById('confirmForm');
// Set the form action with the query parameter
form.action = "{% url 'estimate_mark_as' estimate.pk %}?mark=" + action;
form.action = "{% url 'estimate_mark_as' request.dealer.slug estimate.pk %}?mark=" + action;
}
</script>

View File

@ -17,14 +17,14 @@
{% if not items %}
<div class="alert alert-outline-warning d-flex align-items-center" role="alert">
<i class="fa-solid fa-circle-info fs-6"></i>
<p class="mb-0 flex-1">{{ _("Please add at least one car before creating a quotation.") }}<a class="ms-3 text-body-primary fs-9" href="{% url 'car_add' %}"> {{ _("Add Car") }} </a></p>
<p class="mb-0 flex-1">{{ _("Please add at least one car before creating a quotation.") }}<a class="ms-3 text-body-primary fs-9" href="{% url 'car_add' request.dealer.slug %}"> {{ _("Add Car") }} </a></p>
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
{% if not customer_count %}
<div class="alert alert-outline-warning d-flex align-items-center" role="alert">
<i class="fa-solid fa-circle-info fs-6"></i>&nbsp;&nbsp;
<p class="mb-0 flex-1"> {{ _("Please add at least one customer before creating a quotation.") }}<a class="ms-3 text-body-primary fs-9" href="{% url 'customer_create' %}"> {{ _("Add Customer") }} </a></p>
<p class="mb-0 flex-1"> {{ _("Please add at least one customer before creating a quotation.") }}<a class="ms-3 text-body-primary fs-9" href="{% url 'customer_create' request.dealer.slug %}"> {{ _("Add Customer") }} </a></p>
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
@ -163,7 +163,7 @@
try {
// Send data to the server using fetch
const response = await fetch("{% url 'estimate_create' %}", {
const response = await fetch("{% url 'estimate_create' request.dealer.slug %}", {
method: 'POST',
headers: {
'X-CSRFToken': formData.csrfmiddlewaretoken,

View File

@ -44,7 +44,7 @@
<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' estimate.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 %}
@ -60,11 +60,11 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -23,7 +23,7 @@
</div>
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex">
<a href="{% url 'estimate_detail' estimate.pk %}" class="btn btn-sm btn-phoenix-secondary text-body fs-10 me-1">{{ _("Cancel") }}</a>
<a href="{% url 'estimate_detail' request.dealer.slug estimate.pk %}" class="btn btn-sm btn-phoenix-secondary text-body fs-10 me-1">{{ _("Cancel") }}</a>
<button class="btn btn-sm btn-phoenix-primary fs-10" type="submit">{{ _("Send") }}<span class="fa-solid fa-paper-plane ms-1"></span></button>
</div>
</div>

View File

@ -172,7 +172,7 @@
<!-- Form Actions -->
<div class="form-actions mt-4">
<div class="d-flex justify-content-between">
<a href="{% url 'estimate_detail' estimate.pk %}" type="button" class="btn btn-phoenix-secondary">
<a href="{% url 'estimate_detail' request.dealer.slug estimate.pk %}" type="button" class="btn btn-phoenix-secondary">
<i class="fas fa-times me-2"></i> Cancel
</a>
<div>

View File

@ -26,7 +26,7 @@
class="btn btn-sm btn-phoenix-danger"
data-bs-dismiss="modal"><i class="fa-solid fa-ban"></i> {% trans 'No' %}
</button>
<form id="confirmForm" method="POST" action="{% url 'invoice_mark_as' invoice.pk %}?mark=accept" class="d-inline">
<form id="confirmForm" method="POST" action="{% url 'invoice_mark_as' request.dealer.slug invoice.pk %}?mark=accept" class="d-inline">
{% csrf_token %}
<button type="submit" class="btn btn-phoenix-success btn-sm"><i class="fa-solid fa-circle-check"></i> {% trans "Yes" %}</button>
</form>
@ -35,7 +35,7 @@
</div>
</div>
</div>
<!-- ============================================-->
<!-- ============================================-->
<div class="modal fade" id="mark_as_paid_Modal" tabindex="-1" aria-labelledby="confirmModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
@ -51,7 +51,7 @@
data-bs-dismiss="modal">
<i class="fa-solid fa-ban"></i> {% trans 'No' %}
</button>
<form id="confirmForm" method="POST" action="{% url 'payment_mark_as_paid' invoice.pk %}" class="d-inline">
<form id="confirmForm" method="POST" action="{% url 'payment_mark_as_paid' request.dealer.slug invoice.pk %}" class="d-inline">
{% csrf_token %}
<button type="submit" class="btn btn-phoenix-success btn-sm"><i class="fa-solid fa-circle-check"></i> {% trans "Yes" %}</button>
</form>
@ -60,7 +60,7 @@
</div>
</div>
</div>
<!-- ============================================-->
<!-- ============================================-->
<!-- <section> begin ============================-->
<section class="pt-5 pb-9 bg-body-emphasis dark__bg-gray-1200 border-top">
<div class="row-small mt-3 mx-3">
@ -82,40 +82,21 @@
</div>
</div>
<div class="d-flex align-items-center gap-2">
{# Accept Invoice Button #}
{% if invoice.invoice_status == 'in_review' %}
<button id="accept_invoice" class="btn btn-phoenix-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#confirmModal">
<i class="fa-solid fa-check-double me-1 me-sm-0 me-md-1"></i> {# Icon always visible, adjusted margin #}
<span class="d-none d-sm-inline-block">{% trans 'Accept' %}</span> {# Text hidden on xs, shown on sm+ #}
</button>
{% endif %}
{# Record Payment Button #}
{% if invoice.invoice_status == 'approved' %}
<a href="{% url 'payment_create' invoice.pk %}" class="btn btn-phoenix-success btn-sm">
<i class="fa-solid fa-money-bill me-1 me-sm-0 me-md-1"></i> {# Icon always visible, adjusted margin #}
<span class="d-none d-sm-inline-block">{% trans 'Record Payment' %}</span> {# Text hidden on xs, shown on sm+ #}
</a>
{% endif %}
{# Mark as Paid Button #}
{% 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 btn-sm" data-bs-toggle="modal" data-bs-target="#mark_as_paid_Modal">
<span class="icon-saudi_riyal me-1 me-sm-0 me-md-1"></span> {# Icon always visible, adjusted margin #}
<span class="d-none d-sm-inline-block">{% trans 'Mark as Paid' %}</span> {# Text hidden on xs, shown on sm+ #}
</button>
{% endif %}
{# Preview Button #}
<a href="{% url 'invoice_preview' invoice.pk %}" class="btn btn-phoenix-primary btn-sm">
<i class="fa-regular fa-eye me-1 me-sm-0 me-md-1"></i> {# Icon always visible, adjusted margin #}
<span class="d-none d-sm-inline-block">{% trans 'Preview' %}</span> {# Text hidden on xs, shown on sm+ #}
</a>
</div>
{% if invoice.invoice_status == 'in_review' %}
<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>
{% 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>
</div>
</div>
{{invoice.amount_owned}}
<!-- ============================================-->
<!-- ============================================-->
<div class="card mb-5 {% if invoice.is_review %}disabled{% endif %}">
<div class="card-body">
<div class="row g-4 g-xl-1 g-xxl-3 justify-content-between">
@ -190,42 +171,42 @@
<!-- <section> begin ============================-->
<div class="container bg-body dark__bg-gray-1100 p-4 mb-4 rounded-2 text-body-tertiary {% if invoice.is_review %}disabled{% endif %}">
<!---->
<div class="row">
<div class="col mb-2">
<h6 class="mb-0 me-3"><i class="fa-solid fa-hashtag"></i> {% trans "Invoice Number" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.invoice_number}}</p>
</div>
<div class="col mb-2">
<h6 class="me-3"><i class="fa-solid fa-calendar-days"></i> {% trans "Invoice Date" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.created}}</p>
</div>
<div class="col mb-2">
<h6 class="mb-2 me-3"><i class="fa-solid fa-user"></i> {% trans "Customer Name" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.customer.customer_name}}</p>
</div>
<div class="col mb-2">
<h6 class="mb-2"><i class="fa-solid fa-envelope"></i> {% trans "Customer Email" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.customer.email}}</p>
</div>
<div class="col">
<h6 class="mb-2"><i class="fa-solid fa-list"></i> {% trans "Invoice Status" %} :</h6>
<div class="fs-9 text-body-secondary fw-semibold mb-0">
{% if invoice.invoice_status == 'draft' %}
<span class="badge text-bg-warning">{% trans "Draft" %}</span>
{% elif invoice.invoice_status == 'in_review' %}
<span class="badge text-bg-info">{% trans "In Review" %}</span>
{% elif invoice.invoice_status == 'approved' %}
<span class="badge text-bg-info">{% trans "Approved" %}</span>
{% elif invoice.invoice_status == 'declined' %}
<span class="badge text-bg-danger">{% trans "Declined" %}</span>
{% elif invoice.invoice_status == 'paid' %}
<span class="badge text-bg-success">{% trans "Paid" %}</span>
{% endif %}
</div>
</div>
<div class="row">
<div class="col mb-2">
<h6 class="mb-0 me-3"><i class="fa-solid fa-hashtag"></i> {% trans "Invoice Number" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.invoice_number}}</p>
</div>
<div class="col mb-2">
<h6 class="me-3"><i class="fa-solid fa-calendar-days"></i> {% trans "Invoice Date" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.created}}</p>
</div>
<div class="col mb-2">
<h6 class="mb-2 me-3"><i class="fa-solid fa-user"></i> {% trans "Customer Name" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.customer.customer_name}}</p>
</div>
<div class="col mb-2">
<h6 class="mb-2"><i class="fa-solid fa-envelope"></i> {% trans "Customer Email" %} :</h6>
<p class="fs-9 text-body-secondary fw-semibold mb-0">{{invoice.customer.email}}</p>
</div>
<div class="col">
<h6 class="mb-2"><i class="fa-solid fa-list"></i> {% trans "Invoice Status" %} :</h6>
<div class="fs-9 text-body-secondary fw-semibold mb-0">
{% if invoice.invoice_status == 'draft' %}
<span class="badge text-bg-warning">{% trans "Draft" %}</span>
{% elif invoice.invoice_status == 'in_review' %}
<span class="badge text-bg-info">{% trans "In Review" %}</span>
{% elif invoice.invoice_status == 'approved' %}
<span class="badge text-bg-info">{% trans "Approved" %}</span>
{% elif invoice.invoice_status == 'declined' %}
<span class="badge text-bg-danger">{% trans "Declined" %}</span>
{% elif invoice.invoice_status == 'paid' %}
<span class="badge text-bg-success">{% trans "Paid" %}</span>
{% endif %}
</div>
</div>
</div>
</div>
<div class="px-0 {% if invoice.is_review %}disabled{% endif %}">
<div class="table-responsive scrollbar">

View File

@ -4,7 +4,6 @@
{% block title %}{{ _("Invoices") }}{% endblock title %}
{% block content %}
<div class="row mt-4">
<h3 class="mb-3"><i class="fa-solid fa-receipt"></i> {% trans "Invoices" %}</h3>
@ -55,7 +54,7 @@
</td>
<td class="align-middle product white-space-nowrap">{{ invoice.created }}</td>
<td class="align-middle product white-space-nowrap">
<a href="{% url 'invoice_detail' invoice.pk %}"
<a href="{% url 'invoice_detail' request.dealer.slug invoice.pk %}"
class="btn btn-sm btn-phoenix-success">
<i class="fa-regular fa-eye me-1"></i>
{% trans "View" %}
@ -71,12 +70,12 @@
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -29,7 +29,7 @@
<td class="align-middle product white-space-nowrap">{{ journal. }}</td>
<td class="align-middle product white-space-nowrap">{{ journal. }}</td>
<td class="text-center">
<a href="{% url 'invoice_detail' invoice.pk %}"
<a href="{% url 'invoice_detail' request.dealer.slug invoice.pk %}"
class="btn btn-sm btn-phoenix-success">
{% trans "view" %}
</a>
@ -44,11 +44,11 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1%}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -53,11 +53,11 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1%}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>

View File

@ -23,7 +23,7 @@
{% endif %}
<div class="card-body">
{% if model %}
<form method="post" action="{% url 'payment_create' pk=model.pk %}">
<form method="post" action="{% url 'payment_create' request.dealer.slug model.pk %}">
{% endif %}
{% csrf_token %}
{{ form|crispy }}

View File

@ -30,11 +30,11 @@
<td class="align-middle product white-space-nowrap py-0">{{ journal.je_number }}</td>
{% if journal.ledger.invoicemodel %}
<td class="align-middle product white-space-nowrap py-0">
<a href="{% url 'invoice_detail' journal.ledger.invoicemodel.pk %}"><i class="fa-solid fa-receipt"></i> {{ journal.ledger.invoicemodel }}</a>
<a href="{% url 'invoice_detail' request.dealer.slug journal.ledger.invoicemodel.pk %}"><i class="fa-solid fa-receipt"></i> {{ journal.ledger.invoicemodel }}</a>
</td>
{% elif journal.ledger.billmodel %}
<td class="align-middle product white-space-nowrap py-0">
<a href="{% url 'bill_detail' journal.ledger.billmodel.pk %}"><i class="fa-solid fa-money-bill"></i> {{ journal.ledger.billmodel }}</a>
<a href="{% url 'bill-detail' request.dealer.slug request.dealer.entity.slug journal.ledger.billmodel.pk %}"><i class="fa-solid fa-money-bill"></i> {{ journal.ledger.billmodel }}</a>
</td>
{% else %}
<td class="align-middle product white-space-nowrap py-0"></td>
@ -42,7 +42,7 @@
<td class="align-middle product white-space-nowrap py-0">{{ journal.timestamp }}</td>
<td class="align-middle product white-space-nowrap py-0">{{ journal.description }}</td>
<td class="align-middle product white-space-nowrap">
<a href="{% url 'payment_details' journal.pk %}" class="btn btn-sm btn-phoenix-primary"><i class="fa-solid fa-eye me-1"></i> {% trans "View Tranactions"|capfirst %}</a>
<a href="{% url 'payment_details' request.dealer.slug journal.pk %}" class="btn btn-sm btn-phoenix-primary"><i class="fa-solid fa-eye me-1"></i> {% trans "View Tranactions"|capfirst %}</a>
</td>
</tr>
{% empty %}
@ -54,11 +54,11 @@
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -247,19 +247,19 @@
</div>
<div class="card-footer text-end">
<a href="{% url 'sales_list' %}" class="btn btn-phoenix-secondary">
<a href="{% url 'sales_list' request.dealer.slug %}" class="btn btn-phoenix-secondary">
{% trans "Back to List" %}
</a>
<!-- Add links to view full estimate and invoice if they exist -->
{% if sale_order.estimate %}
<a href="{% url 'estimate_detail' sale_order.estimate.pk %}" class="btn btn-phoenix-info ms-2">
<a href="{% url 'estimate_detail' request.dealer.slug sale_order.estimate.pk %}" class="btn btn-info ms-2">
{% trans "View Full Estimate" %}
</a>
{% endif %}
{% if sale_order.invoice %}
<a href="{% url 'invoice_detail' sale_order.invoice.pk %}" class="btn btn-phoenix-info ms-2">
<a href="{% url 'invoice_detail' request.dealer.slug sale_order.invoice.pk %}" class="btn btn-info ms-2">
{% trans "View Full Invoice" %}
</a>
{% endif %}

View File

@ -47,7 +47,7 @@
<div class="spinner-border mx-3 htmx-indicator" role="status"><span class="visually-hidden">Loading...</span></div>
<div class="search-box me-3">
<form class="position-relative">
<input class="form-control search-input search" name='search' type="search" placeholder="{{ _("Search") }}" aria-label="Search" hx-get="{% url 'car_list' %}" hx-trigger='keyup changed delay:500ms' hx-target='.table-responsive' hx-select='.table-responsive' hx-swap="innerHTML show:window:top" hx-indicator=".htmx-indicator"
<input class="form-control search-input search" name='search' type="search" placeholder="{{ _("Search") }}" aria-label="Search" hx-get="{% url 'car_list' request.dealer.slug %}" hx-trigger='keyup changed delay:500ms' hx-target='.table-responsive' hx-select='.table-responsive' hx-swap="innerHTML show:window:top" hx-indicator=".htmx-indicator"
hx-on::before-request="on_before_request()"
hx-on::after-request="on_after_request()"
/>
@ -58,7 +58,7 @@
</div>
</div>
<div class="d-flex align-items-center d-none filter">
<select hx-get="{% url 'car_list' %}" name="make" hx-target='.model-select' hx-select='.model-select' hx-swap="outerHTML show:window:top" hx-indicator=".htmx-indicator" class="form-select make" aria-label="Default select example"
<select hx-get="{% url 'car_list' request.dealer.slug %}" name="make" hx-target='.model-select' hx-select='.model-select' hx-swap="outerHTML show:window:top" hx-indicator=".htmx-indicator" class="form-select make" aria-label="Default select example"
hx-on::before-request="filter_before_request()"
hx-on::after-request="filter_after_request()"
>
@ -67,7 +67,7 @@
<option value="{{ m.pk }}">{{ m.name }}</option>
{% endfor %}
</select>
<select hx-get="{% url 'car_list' %}" hx-include=".make" name="model" hx-target='.year' hx-select='.year' hx-swap="outerHTML show:window:top" hx-indicator=".htmx-indicator" class="form-select model-select" aria-label="Default select example"
<select hx-get="{% url 'car_list' request.dealer.slug %}" hx-include=".make" name="model" hx-target='.year' hx-select='.year' hx-swap="outerHTML show:window:top" hx-indicator=".htmx-indicator" class="form-select model-select" aria-label="Default select example"
hx-on::before-request="filter_before_request()"
hx-on::after-request="filter_after_request()"
>
@ -89,7 +89,7 @@
<option value="sold">Sold</option>
<option value="transfer">Transfer</option>
</select>
<button id="search" hx-get="{% url 'car_list' %}" hx-include=".make,.model,.year,.car_status" hx-indicator=".htmx-indicator" hx-target='.table-responsive' hx-select='.table-responsive' hx-swap="outerHTML show:window:top" class="btn btn-sm btn-phoenix-primary"
<button id="search" hx-get="{% url 'car_list' request.dealer.slug %}" hx-include=".make,.model,.year,.car_status" hx-indicator=".htmx-indicator" hx-target='.table-responsive' hx-select='.table-responsive' hx-swap="outerHTML show:window:top" class="btn btn-sm btn-phoenix-primary"
hx-on::before-request="filter_before_request()"
hx-on::after-request="filter_after_request()">Search</button>
</div>
@ -149,7 +149,7 @@
<td class="align-middle white-space-nowrap quotation">
{% if tx.estimate %}
<p class="fw-bo text-body fs-9 mb-0">
<a href="{% url 'estimate_detail' tx.estimate.uuid %}">
<a href="{% url 'estimate_detail' request.dealer.slug tx.estimate.uuid %}">
{{tx.estimate.estimate_number}}
</a><br>
{% if tx.estimate.status == "draft" %}
@ -167,7 +167,7 @@
<td class="align-middle white-space-nowrap invoice">
{% if tx.invoice %}
<p class="fw-bo text-body fs-9 mb-0">
<a href="{% url 'invoice_detail' tx.invoice.uuid %}">
<a href="{% url 'invoice_detail' request.dealer.slug tx.invoice.uuid %}">
{{tx.invoice.invoice_number}}
</a><br>
{% if tx.invoice.is_draft %}
@ -204,7 +204,7 @@
<td class="align-middle text-end white-space-nowrap pe-0 action">
<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 class="dropdown-item text-success-dark" href="{% url 'order_detail' tx.pk %}">{{ _("View Sales Order Detail") }}</a>
<div class="dropdown-menu dropdown-menu-end py-2"><a class="dropdown-item text-success-dark" href="{% url 'order_detail' request.dealer.slug tx.pk %}">{{ _("View Sales Order Detail") }}</a>
</div>
</div>
</td>

View File

@ -32,7 +32,7 @@
<input class="d-none" id="emailPhotos" type="file" accept="image/*" />
</div>
<div class="d-flex">
<a href="{% url 'estimate_detail' estimate.pk %}" class="btn btn-link text-body fs-10 text-decoration-none">Discard</a>
<a href="{% url 'estimate_detail' request.dealer.slug estimate.pk %}" class="btn btn-link text-body fs-10 text-decoration-none">Discard</a>
<button class="btn btn-phoenix-primary fs-10" type="submit">Send<span class="fa-solid fa-paper-plane ms-1"></span></button>
</div>
</div>