Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyio new files #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fly.toml
.git/
*.sqlite3
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

256 changes: 256 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions .idea/v1.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down
41 changes: 41 additions & 0 deletions apps/dashboard/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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')),
],
),
]
Empty file.
33 changes: 33 additions & 0 deletions apps/dashboard/models.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions apps/dashboard/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from apps.dashboard import views

urlpatterns = [
path('dashboard/<int:company_id>/', views.dashboard_view, name='dashboard'),
]
14 changes: 14 additions & 0 deletions apps/dashboard/views.py
Original file line number Diff line number Diff line change
@@ -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})
9 changes: 6 additions & 3 deletions apps/static/assets/css/argon.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions apps/static/assets/css/dashboard.css
Original file line number Diff line number Diff line change
@@ -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;
}
Binary file added apps/static/assets/img/brand/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/static/assets/img/brand/logo_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading