diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b7c39d7c1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +fly.toml +.git/ +*.sqlite3 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..13566b81b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..22f78d204 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..f26fba887 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/v1.iml b/.idea/v1.iml new file mode 100644 index 000000000..fd3580ec6 --- /dev/null +++ b/.idea/v1.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file 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/migrations/0001_initial.py b/apps/dashboard/migrations/0001_initial.py new file mode 100644 index 000000000..10d2f68db --- /dev/null +++ b/apps/dashboard/migrations/0001_initial.py @@ -0,0 +1,41 @@ +# Generated by Django 3.2.6 on 2024-10-11 16:43 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Company', + fields=[ + ('id', models.BigAutoField(primary_key=True, serialize=False)), + ('name', models.CharField(max_length=255)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='Dashboard', + fields=[ + ('id', models.BigAutoField(primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.company')), + ], + ), + migrations.CreateModel( + name='Widget', + fields=[ + ('id', models.BigAutoField(primary_key=True, serialize=False)), + ('widget_type', models.CharField(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)')], max_length=50)), + ('position', models.IntegerField()), + ('data', models.TextField(blank=True, null=True)), + ('dashboard', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.dashboard')), + ], + ), + ] diff --git a/apps/dashboard/migrations/__init__.py b/apps/dashboard/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb 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..0a4760374 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, @@ -5168,7 +5168,7 @@ button.bg-dark:focus { background-color: #0a0c0d !important; } .bg-default { - background-color: #172b4d !important; } + background-color: #ffffff !important; } a.bg-default:hover, a.bg-default:focus, button.bg-default:hover, @@ -10411,6 +10411,8 @@ button.bg-darker:focus { .text-white { color: #fff !important; } + + .text-primary { color: #5e72e4 !important; } @@ -12553,7 +12555,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/static/assets/img/brand/Logo.png b/apps/static/assets/img/brand/Logo.png new file mode 100644 index 000000000..10fad1723 Binary files /dev/null and b/apps/static/assets/img/brand/Logo.png differ diff --git a/apps/static/assets/img/brand/logo_black.png b/apps/static/assets/img/brand/logo_black.png new file mode 100644 index 000000000..603d0f292 Binary files /dev/null and b/apps/static/assets/img/brand/logo_black.png differ diff --git a/apps/templates/home/finances.html b/apps/templates/home/finances.html new file mode 100644 index 000000000..771e2a5c8 --- /dev/null +++ b/apps/templates/home/finances.html @@ -0,0 +1,306 @@ +{% extends 'layouts/base.html' %} + +{% block title %} Dashboard {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + + + + + + + Финансы + + + + Компании + Компания 1 + + + + + Добавить компанию + + + + + + + + + + + + + + + + + Выберите виджет + + + + + + + + + + + + Выберите виджет + + + + + + + + + + + + Выберите виджет + + + + + + + + + + + + Выберите виджет + + + + + + + + + + + + + + + + Выберите график + + + + + + + + + + + + Выберите график + + + + + + + + {% include "includes/footer.html" %} + + + + + + + + Выберите виджет + + + + P&L Отчет + + + Общая выручка + + + Операционная прибыль (EBITDA) + + + Чистая прибыль + + + + Дебиторская и Кредиторская задолженность + + + Дебиторская задолженность + + + Кредиторская задолженность + + + Оборот дебиторской задолженности (дни) + + + Оборот кредиторской задолженности (дни) + + + + Эффективность + + + План/Факт/Отклонение + + + Остаток на счёте + + + Точка безубыточности + + + Производительность сотрудников + + + + CashFlow + + + Операционный денежный поток (OCF) + + + Инвестиционный денежный поток (ICF) + + + + + + + +{% endblock content %} + + +{% block javascripts %} + + + + + + + + +{% endblock javascripts %} diff --git a/apps/templates/home/index.html b/apps/templates/home/index.html index 21c764dc1..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 %} @@ -13,18 +15,18 @@ - Default + Общие - Dashboards - Default + Компании + Компания 1 - New - Filters + Добавить компанию + Выбрать период @@ -35,18 +37,15 @@ Default - Total traffic - 350,897 + Общая выручка + 3,950,897 ₸ - - - 3.48% - Since last month + За этот месяц @@ -57,18 +56,15 @@ Total traffic - New users - 2,356 + План продаж + 87% - - - 3.48% - Since last month + За этот месяц @@ -79,18 +75,15 @@ New users - Sales - 924 + Остаток + 90,124,973 ₸ - - - 3.48% - Since last month + За этот месяц @@ -101,18 +94,15 @@ Sales - Performance + Произв. сотрудников 49,65% - - - 3.48% - Since last month + За этот месяц @@ -130,32 +120,36 @@ Performance - Overview - Sales value - - - - - - Month - M - - - - - Week - W - - - +{# Overview#} + План производства +{# #} +{# #} +{# #} +{# #} +{# Месяц#} +{# M#} +{# #} +{# #} +{# #} +{# #} +{# Неделя#} +{# W#} +{# #} +{# #} +{# #} +{# #} + + Сменить график + - +{# #} + @@ -165,15 +159,16 @@ Sales value - Performance - Total orders + План продаж + Заявки - +{# #} + @@ -408,7 +403,350 @@ Social traffic {% block javascripts %} - - + + + + + + -{% endblock 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/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 @@ - + diff --git a/apps/templates/includes/sidenav.html b/apps/templates/includes/sidenav.html index 3a06e751a..d08db75ed 100644 --- a/apps/templates/includes/sidenav.html +++ b/apps/templates/includes/sidenav.html @@ -2,8 +2,9 @@ - - + +{# #} + @@ -13,91 +14,59 @@ - - Dashboard + Общие - - - Icons + + Финансы - - - Google + + Производство - - - Profile + + Продажи - - - - Tables - - - - - - Login (template) - - - - - - Register (template) - - - - - - - Logout - - +{# #} +{# #} +{# Logout#} +{# #} +{# #} + - Resources + Управление - - Product Page + href="/plans.html"> + Цели и планы - - PRO Version + href="#"> + Сотрудники - - - - AppSeed - - + \ No newline at end of file diff --git a/apps/templates/widgets/total_revenue.html b/apps/templates/widgets/total_revenue.html new file mode 100644 index 000000000..048e87713 --- /dev/null +++ b/apps/templates/widgets/total_revenue.html @@ -0,0 +1,19 @@ + + + + + Общая выручка + 3,950,897 ₸ + + 3.48% + За этот месяц + + + + + + + + + + \ No newline at end of file diff --git a/core/settings.py b/core/settings.py index a03adb58d..42ad3afb1 100644 --- a/core/settings.py +++ b/core/settings.py @@ -18,7 +18,7 @@ DEBUG = config('DEBUG', default=True, cast=bool) # load production server from .env -ALLOWED_HOSTS = ['localhost', '127.0.0.1', config('SERVER', default='127.0.0.1')] +ALLOWED_HOSTS = ['localhost', '127.0.0.1', config('SERVER', default='127.0.0.1'), '6f74-2a00-23c7-a88c-3d01-2d9b-9bf3-5577-f856.ngrok-free.app'] # Application definition @@ -29,7 +29,8 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'apps.home' # Enable the inner home (home) + 'apps.home', # Enable the inner home (home) + 'apps.dashboard' ] MIDDLEWARE = [ diff --git a/core/urls.py b/core/urls.py index bd1a9b68a..295bd8c33 100644 --- a/core/urls.py +++ b/core/urls.py @@ -9,5 +9,6 @@ urlpatterns = [ path('admin/', admin.site.urls), # Django admin route path("", include("apps.authentication.urls")), # Auth routes - login / register - path("", include("apps.home.urls")) # UI Kits Html files + path("", include("apps.home.urls")), + path("", include("apps.dashboard.urls")) ] diff --git a/fly.toml b/fly.toml new file mode 100644 index 000000000..99587ea05 --- /dev/null +++ b/fly.toml @@ -0,0 +1,31 @@ +# fly.toml app configuration file generated for django-dashboard-1 on 2024-11-13T07:58:24Z +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'django-dashboard-1' +primary_region = 'lhr' +console_command = '/code/manage.py shell' + +[build] + +[env] + PORT = '8000' + +[http_service] + internal_port = 8000 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + memory_mb = 1024 + +[[statics]] + guest_path = '/code/static' + url_prefix = '/static/'
3.48% - Since last month + За этот месяц
Цель продаж: 50%
+ 3.48% + За этот месяц +