From 75b564026577580ffbc18c01814b5cb98030c486 Mon Sep 17 00:00:00 2001 From: arsenkylysbek Date: Tue, 15 Oct 2024 11:17:09 +0100 Subject: [PATCH 1/3] . --- README.md | 2 +- apps/dashboard/models.py | 33 ++++ apps/dashboard/urls.py | 6 + apps/dashboard/views.py | 14 ++ apps/static/assets/css/argon.css | 5 +- apps/static/assets/css/dashboard.css | 28 ++++ apps/templates/home/finances.html | 200 ++++++++++++++++++++++++ apps/templates/home/index.html | 93 ++++++++--- apps/templates/includes/footer.html | 5 +- apps/templates/includes/navigation.html | 2 +- apps/templates/includes/sidenav.html | 76 +++------ core/settings.py | 5 +- core/urls.py | 3 +- 13 files changed, 383 insertions(+), 89 deletions(-) create mode 100644 apps/dashboard/models.py create mode 100644 apps/dashboard/urls.py create mode 100644 apps/dashboard/views.py create mode 100644 apps/static/assets/css/dashboard.css create mode 100644 apps/templates/home/finances.html diff --git a/README.md b/README.md index f6e7ce141..e43d50910 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ The project is coded using a simple and intuitive structure presented bellow: | | |-- register.html # Register page | | | |-- home/ # UI Kit Pages - | |-- index.html # Index page + | |-- finances.html # Index page | |-- 404-page.html # 404 page | |-- *.html # All other pages | diff --git a/apps/dashboard/models.py b/apps/dashboard/models.py new file mode 100644 index 000000000..12bbc934f --- /dev/null +++ b/apps/dashboard/models.py @@ -0,0 +1,33 @@ +from django.db import models + +class Company(models.Model): + id = models.BigAutoField(primary_key=True) # Explicitly defining primary key + name = models.CharField(max_length=255) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.name + +class Dashboard(models.Model): + id = models.BigAutoField(primary_key=True) # Explicitly defining primary key + company = models.ForeignKey(Company, on_delete=models.CASCADE) + created_at = models.DateTimeField(auto_now_add=True) + +class Widget(models.Model): + id = models.BigAutoField(primary_key=True) # Explicitly defining primary key + dashboard = models.ForeignKey(Dashboard, on_delete=models.CASCADE) + widget_type = models.CharField(max_length=50, choices=[ + ('total_revenue', 'Общая выручка'), + ('variable_expenses', 'Переменные расходы'), + ('fixed_expenses', 'Постоянные расходы'), + ('operating_profit', 'Операционная прибыль (EBITDA)'), + ('net_profit', 'Чистая прибыль за период'), + ('operational_profit_margin', 'Рентабельность по операционной прибыли, %'), + ('debtor_liability', 'Дебиторская задолженность'), + ('creditor_liability', 'Кредиторская задолженность'), + ('turnover_days_debtors', 'Оборочиваемость д.з. (дни)'), + ('turnover_days_creditors', 'Оборочиваемость к.з. (дни)'), + ('cash_flow', 'Операционный денежный поток (OCF)'), + ]) + position = models.IntegerField() + data = models.TextField(blank=True, null=True) diff --git a/apps/dashboard/urls.py b/apps/dashboard/urls.py new file mode 100644 index 000000000..2c969542d --- /dev/null +++ b/apps/dashboard/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from apps.dashboard import views + +urlpatterns = [ + path('dashboard//', views.dashboard_view, name='dashboard'), +] diff --git a/apps/dashboard/views.py b/apps/dashboard/views.py new file mode 100644 index 000000000..787c0afb0 --- /dev/null +++ b/apps/dashboard/views.py @@ -0,0 +1,14 @@ +from django.shortcuts import render +from .models import Dashboard, Widget + + +def dashboard_view(request, company_id=None): + # If no company_id is provided, default to the first company or show an empty page + dashboard = None + widgets = None + + if company_id: + dashboard = Dashboard.objects.filter(company_id=company_id).first() + widgets = Widget.objects.filter(dashboard=dashboard).order_by('position') + + return render(request, 'dashboard.html', {'dashboard': dashboard, 'widgets': widgets}) diff --git a/apps/static/assets/css/argon.css b/apps/static/assets/css/argon.css index 79e1bd454..584c05c4f 100644 --- a/apps/static/assets/css/argon.css +++ b/apps/static/assets/css/argon.css @@ -5104,7 +5104,7 @@ a.close.disabled { vertical-align: text-top !important; } .bg-primary { - background-color: #5e72e4 !important; } + background-color: #0a0c0d; } a.bg-primary:hover, a.bg-primary:focus, button.bg-primary:hover, @@ -12553,7 +12553,8 @@ textarea[resize="horizontal"] { .navbar-vertical .navbar-brand-img, .navbar-vertical .navbar-brand > img { max-width: 100%; - max-height: 2rem; } + /*max-height: 2rem;*/ + } @media (min-width: 768px) { .navbar-vertical .navbar-collapse { margin-left: -1rem; diff --git a/apps/static/assets/css/dashboard.css b/apps/static/assets/css/dashboard.css new file mode 100644 index 000000000..c36b9a32a --- /dev/null +++ b/apps/static/assets/css/dashboard.css @@ -0,0 +1,28 @@ +body { + font-family: Arial, sans-serif; +} + +.dashboard { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-gap: 20px; + padding: 20px; +} + +.widget { + background-color: #f8f9fa; + border-radius: 8px; + padding: 20px; + text-align: center; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); +} + +.widget h3 { + font-size: 1.2em; + margin-bottom: 10px; +} + +.widget p { + font-size: 1em; + color: #6c757d; +} diff --git a/apps/templates/home/finances.html b/apps/templates/home/finances.html new file mode 100644 index 000000000..e26aff3ec --- /dev/null +++ b/apps/templates/home/finances.html @@ -0,0 +1,200 @@ +{% extends 'layouts/base.html' %} + +{% block title %} Dashboard {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + +
+
+
+
+
+
Финансы
+ +
+ +
+
+
+
+ + +
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ + {% include "includes/footer.html" %} + +
+ + + + +{% endblock content %} + + +{% block javascripts %} + + + + + + + + +{% endblock javascripts %} diff --git a/apps/templates/home/index.html b/apps/templates/home/index.html index 21c764dc1..80d2a27b6 100644 --- a/apps/templates/home/index.html +++ b/apps/templates/home/index.html @@ -13,18 +13,17 @@
-
Default
+
Общие
@@ -35,18 +34,19 @@
Default
-
Total traffic
- 350,897 +
Общая выручка
+ 3,950,897 ₸
- +{# #} +

3.48% - Since last month + За этот месяц

@@ -57,8 +57,8 @@
Total traffic
-
New users
- 2,356 +
План продаж
+ 87%
@@ -68,7 +68,7 @@
New users

3.48% - Since last month + За этот месяц

@@ -79,18 +79,19 @@
New users
-
Sales
- 924 +
Остаток
+ 90,124,973 ₸
- +{# #} +

3.48% - Since last month + За этот месяц

@@ -101,7 +102,7 @@
Sales
-
Performance
+
Произв. сотрудников
49,65%
@@ -112,7 +113,7 @@
Performance

3.48% - Since last month + За этот месяц

@@ -130,20 +131,20 @@
Performance
-
Overview
-
Sales value
+{#
Overview
#} +
План производства
@@ -411,4 +413,43 @@

Social traffic

-{% endblock javascripts %} + + +{% endblock javascripts %} \ No newline at end of file diff --git a/apps/templates/includes/footer.html b/apps/templates/includes/footer.html index 1e895ba8b..6b86c44f5 100644 --- a/apps/templates/includes/footer.html +++ b/apps/templates/includes/footer.html @@ -5,14 +5,13 @@
More Dashboards + class="font-weight-bold ml-1" target="_blank">AI ASSIST
© Creative-Tim - - coded by AppSeed + class="font-weight-bold ml-1" target="_blank"> ©Astana Cloud
diff --git a/apps/templates/includes/navigation.html b/apps/templates/includes/navigation.html index 365819373..fcb4395fa 100644 --- a/apps/templates/includes/navigation.html +++ b/apps/templates/includes/navigation.html @@ -8,7 +8,7 @@
- +
- - {% endblock content %} {% block javascripts %} - - - - - - + + + + + + {% endblock javascripts %} diff --git a/apps/templates/home/index.html b/apps/templates/home/index.html index 80d2a27b6..9bdc9386e 100644 --- a/apps/templates/home/index.html +++ b/apps/templates/home/index.html @@ -3,7 +3,9 @@ {% block title %} Dashboard {% endblock title %} -{% block stylesheets %}{% endblock stylesheets %} +{% block stylesheets %} + +{% endblock stylesheets %} {% block content %} @@ -23,7 +25,8 @@
Общие
@@ -38,10 +41,6 @@
Общая выручка< 3,950,897 ₸
-
-{# #} - -

@@ -61,9 +60,6 @@

План продаж
87%
-
- -

@@ -83,10 +79,6 @@

Остаток
90,124,973 ₸
-
-{# #} - -

@@ -106,9 +98,6 @@

Произв. сотруд 49,65%
-
- -

@@ -132,31 +121,35 @@

Произв. сотруд
{#
Overview
#} -
План производства
-
-
- +
План производства
+{#
#} +{# #} +{#
#} +
+ +
- +{# #} +
@@ -410,23 +403,280 @@

Social traffic

{% block javascripts %} - - + + + + {% endblock javascripts %} \ No newline at end of file diff --git a/apps/templates/home/plans.html b/apps/templates/home/plans.html new file mode 100644 index 000000000..321579347 --- /dev/null +++ b/apps/templates/home/plans.html @@ -0,0 +1,114 @@ +{% extends 'layouts/base.html' %} + +{% block title %} Set Goals {% endblock title %} + + +{% block stylesheets %} + +{% endblock stylesheets %} + +{% block content %} + +
+
+
+
+
+
Цели и планы
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+

Установить цели производства и продаж

+
+
+
+
+
+
+ + +
+
+ +
+ +

Цель продаж: 50%

+
+
+ + +
+ +
+
+
+
+
+ + {% include "includes/footer.html" %} +
+{% endblock content %} + + +{% block javascripts %} + + +{% endblock javascripts %} diff --git a/apps/templates/includes/sidenav.html b/apps/templates/includes/sidenav.html index 98f871a72..d08db75ed 100644 --- a/apps/templates/includes/sidenav.html +++ b/apps/templates/includes/sidenav.html @@ -51,8 +51,7 @@