dashboard fixed
This commit is contained in:
parent
966633fe3b
commit
f670015e39
@ -10,8 +10,8 @@ urlpatterns = [
|
||||
# main URLs
|
||||
path("", views.WelcomeView, name="welcome"),
|
||||
path("signup/", views.dealer_signup, name="account_signup"),
|
||||
path("", views.HomeView.as_view(), name="home"),
|
||||
path("<slug:dealer_slug>/", views.HomeView.as_view(), name="home"),
|
||||
path("", views.HomeView, name="home"),
|
||||
path("<slug:dealer_slug>/", views.HomeView, name="home"),
|
||||
# Tasks
|
||||
path("legal/", views.terms_and_privacy, name="terms_and_privacy"),
|
||||
# path('tasks/<int:task_id>/detail/', views.task_detail, name='task_detail'),
|
||||
|
||||
@ -362,24 +362,31 @@ def dealer_signup(request):
|
||||
"account/signup-wizard.html",
|
||||
)
|
||||
|
||||
class HomeView(LoginRequiredMixin, TemplateView):
|
||||
"""
|
||||
HomeView class responsible for rendering the home page.
|
||||
# class HomeView(LoginRequiredMixin, TemplateView):
|
||||
# """
|
||||
# HomeView class responsible for rendering the home page.
|
||||
|
||||
This class ensures that only authenticated users can access the home page.
|
||||
Unauthenticated users are redirected to the welcome page. It is built on top of
|
||||
Django's TemplateView and includes additional functionality by inheriting from
|
||||
LoginRequiredMixin. The purpose of this class is to control the accessibility
|
||||
of the main index page of the application and manage context data for frontend
|
||||
rendering.
|
||||
# This class ensures that only authenticated users can access the home page.
|
||||
# Unauthenticated users are redirected to the welcome page. It is built on top of
|
||||
# Django's TemplateView and includes additional functionality by inheriting from
|
||||
# LoginRequiredMixin. The purpose of this class is to control the accessibility
|
||||
# of the main index page of the application and manage context data for frontend
|
||||
# rendering.
|
||||
|
||||
:ivar template_name: The path to the template used for rendering the view's
|
||||
output.
|
||||
:type template_name: str
|
||||
"""
|
||||
# :ivar template_name: The path to the template used for rendering the view's
|
||||
# output.
|
||||
# :type template_name: str
|
||||
# """
|
||||
|
||||
template_name = "index.html"
|
||||
# template_name = "index.html"
|
||||
|
||||
@login_required
|
||||
def HomeView(request,dealer_slug=None):
|
||||
dealer_slug=request.dealer.slug
|
||||
if request.is_sales and not request.is_manager and not request.is_dealer:
|
||||
return redirect('sales_dashboard', dealer_slug=dealer_slug)
|
||||
else:
|
||||
return redirect('general_dashboard',dealer_slug=dealer_slug)
|
||||
|
||||
class TestView(TemplateView):
|
||||
"""
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
<div class="main-content flex-grow-1 container-fluid mt-4 mb-3">
|
||||
<div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center mb-5 pb-3 border-bottom">
|
||||
<h2 class="h3 fw-bold mb-3 mb-md-0">
|
||||
{% if request.is_dealer or request.is_manager%}
|
||||
{% if request.is_dealer %}
|
||||
{% trans "Business Health Dashboard" %}
|
||||
{% endif %}
|
||||
{% if request.is_inventory and not request.is_manager and not request.is_dealer %}
|
||||
{% elif request.is_manger %}
|
||||
{% trans "Manager Dashboard" %}
|
||||
{% elif request.is_inventory %}
|
||||
{% trans "Inventory Dashboard" %}
|
||||
{% endif %}
|
||||
{% if request.is_accountant and not request.is_manager and not request.is_dealer %}
|
||||
{% else %}
|
||||
{% trans "Accountant Dashboard" %}
|
||||
{% endif %}
|
||||
<i class="fas fa-chart-area text-primary ms-2"></i>
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
hx-swap="outerHTML"
|
||||
hx-select-oob="#toast-container"
|
||||
hx-indicator="#spinner">
|
||||
|
||||
<li class="nav-item">
|
||||
{% comment %} <p class="navbar-vertical-label text-primary fs-8 text-truncate">{{request.dealer|default:"Apps"}}</p>
|
||||
<hr class="navbar-vertical-line"> {% endcomment %}
|
||||
@ -439,27 +440,23 @@
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'ticket_list' request.dealer.slug %}">
|
||||
<div class="d-flex align-items-center">
|
||||
{% if user.is_authenticated %}
|
||||
|
||||
<span class="nav-link-icon"><span class="fa-solid fa-car"></span></span>
|
||||
<span class="nav-link-text">{{ request.dealer.user.username }}</span>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-vertical-footer">
|
||||
<button class="btn navbar-vertical-toggle border-0 fw-semibold w-100 white-space-nowrap d-flex align-items-center">
|
||||
<span class="fas fa-angle-double-left fs-8"></span><span class="fas fa-angle-double-right fs-8"></span><span class="navbar-vertical-footer-text ms-2">Collapsed View</span>
|
||||
</button>
|
||||
<a class="nav-link ps-2" href="{% if request.is_dealer%}{% url 'ticket_list' request.dealer.slug %} {% else %}#{%endif%}">
|
||||
<div class="d-flex align-items-center">
|
||||
{% if user.is_authenticated%}
|
||||
|
||||
<span class="nav-link-icon"><span class="fa-solid fa-gear me-1 fs-5"></span></span>
|
||||
<span class="nav-link-text">{{ request.dealer.user.username }}</span>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
<nav class="navbar navbar-top fixed-top navbar-expand" id="navbarDefault">
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
{% extends 'base.html' %}
|
||||
{% comment %} {% extends 'base.html' %}
|
||||
{% load i18n static custom_filters django_ledger %}
|
||||
|
||||
{% block content %}
|
||||
@ -19,5 +19,7 @@
|
||||
<p>Loading dashboard...</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %} {% endcomment %}
|
||||
Loading…
x
Reference in New Issue
Block a user