Skip to content

Commit

Permalink
initial web design
Browse files Browse the repository at this point in the history
  • Loading branch information
arnuuv committed Feb 28, 2025
1 parent 8193a87 commit cf3756b
Show file tree
Hide file tree
Showing 22 changed files with 947 additions and 0 deletions.
Empty file.
3 changes: 3 additions & 0 deletions project_design/growth_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions project_design/growth_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class GrowthAppConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "growth_app"
59 changes: 59 additions & 0 deletions project_design/growth_app/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm as DjangoPasswordChangeForm
from django.contrib.auth.models import User
from .models import Business, SalesData, UserProfile

class RegistrationForm(UserCreationForm):
email = forms.EmailField(required=True)

class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')

class BusinessForm(forms.ModelForm):
class Meta:
model = Business
fields = ['name', 'description', 'type', 'logo']
widgets = {
'description': forms.Textarea(attrs={'rows': 4}),
}

class SalesDataForm(forms.ModelForm):
class Meta:
model = SalesData
fields = ['amount', 'date']
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
}

class UserProfileForm(forms.ModelForm):
first_name = forms.CharField(max_length=30, required=False)
last_name = forms.CharField(max_length=30, required=False)
email = forms.EmailField(required=True)

class Meta:
model = UserProfile
fields = ['profile_pic']

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance and self.instance.user:
self.fields['first_name'].initial = self.instance.user.first_name
self.fields['last_name'].initial = self.instance.user.last_name
self.fields['email'].initial = self.instance.user.email

def save(self, commit=True):
profile = super().save(commit=False)
user = profile.user
user.first_name = self.cleaned_data['first_name']
user.last_name = self.cleaned_data['last_name']
user.email = self.cleaned_data['email']
user.save()

if commit:
profile.save()
return profile

class PasswordChangeForm(DjangoPasswordChangeForm):
"""Custom password change form with Bootstrap styling."""
pass
106 changes: 106 additions & 0 deletions project_design/growth_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Generated by Django 5.1.6 on 2025-02-25 14:57

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="Business",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100)),
("description", models.TextField(blank=True, null=True)),
(
"logo",
models.ImageField(
blank=True, null=True, upload_to="business_logos/"
),
),
("type", models.CharField(blank=True, max_length=50, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"owner",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="businesses",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name_plural": "Businesses",
},
),
migrations.CreateModel(
name="SalesData",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("amount", models.DecimalField(decimal_places=2, max_digits=10)),
("date", models.DateField()),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"business",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="sales_data",
to="growth_app.business",
),
),
],
options={
"ordering": ["-date"],
},
),
migrations.CreateModel(
name="UserProfile",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"profile_pic",
models.ImageField(blank=True, null=True, upload_to="profile_pics/"),
),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="profile",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
Empty file.
37 changes: 37 additions & 0 deletions project_design/growth_app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from django.db import models
from django.contrib.auth.models import User

# Create your models here.

class Business(models.Model):
name = models.CharField(max_length=100)
description = models.TextField(blank=True, null=True)
owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='businesses')
logo = models.ImageField(upload_to='business_logos/', blank=True, null=True)
type = models.CharField(max_length=50, blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)

class Meta:
verbose_name_plural = 'Businesses'

def __str__(self):
return self.name

class SalesData(models.Model):
business = models.ForeignKey(Business, on_delete=models.CASCADE, related_name='sales_data')
amount = models.DecimalField(max_digits=10, decimal_places=2)
date = models.DateField()
created_at = models.DateTimeField(auto_now_add=True)

class Meta:
ordering = ['-date']

def __str__(self):
return f"{self.business.name} - {self.amount} on {self.date}"

class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
profile_pic = models.ImageField(upload_to='profile_pics/', blank=True, null=True)

def __str__(self):
return self.user.username
85 changes: 85 additions & 0 deletions project_design/growth_app/templates/growth_app/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Growth Business Analytics{% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
{% load static %}
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="container">
<div class="d-flex justify-content-between align-items-center py-3">
<div class="logo d-flex align-items-center">
<img src="{% static 'images/growth-logo.png' %}" alt="Growth" width="40" height="40">
<span class="ml-2 font-weight-bold">Growth</span>
</div>
<nav>
<ul class="nav">
<li class="nav-item"><a href="{% url 'dashboard' %}" class="nav-link">Dashboard</a></li>
<li class="nav-item"><a href="{% url 'businesses_list' %}" class="nav-link">Businesses</a></li>
<li class="nav-item"><a href="{% url 'contact' %}" class="nav-link">Contact</a></li>
<li class="nav-item"><a href="{% url 'about_us' %}" class="nav-link">About Us</a></li>
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown">
{% if user.profile.profile_pic %}
<img src="{{ user.profile.profile_pic.url }}" alt="Profile" class="rounded-circle" width="30" height="30">
{% else %}
<img src="{% static 'images/default-profile.png' %}" alt="Profile" class="rounded-circle" width="30" height="30">
{% endif %}
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="{% url 'user_settings' %}">Settings</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'logout' %}">Logout</a>
</div>
</li>
{% else %}
<li class="nav-item"><a href="{% url 'signin' %}" class="nav-link">Sign In</a></li>
<li class="nav-item"><a href="{% url 'register' %}" class="nav-link">Register</a></li>
{% endif %}
</ul>
</nav>
</div>
</div>
</header>

<!-- Main Content -->
<main>
{% block content %}{% endblock %}
</main>

<!-- Footer -->
<footer class="bg-white mt-5 py-4">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="logo mb-3">
<img src="{% static 'images/growth-logo.png' %}" alt="Growth" width="40" height="40">
</div>
</div>
<div class="col-md-9">
<h5>Sections</h5>
<ul class="list-unstyled">
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'businesses_list' %}">Businesses</a></li>
<li><a href="{% url 'contact' %}">Contact</a></li>
<li><a href="{% url 'about_us' %}">About Us</a></li>
</ul>
</div>
</div>
</div>
</footer>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="{% static 'js/main.js' %}"></script>
{% block scripts %}{% endblock %}
</body>
</html>
33 changes: 33 additions & 0 deletions project_design/growth_app/templates/growth_app/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'growth_app/base.html' %}

{% block title %}Dashboard - Growth{% endblock %}

{% block content %}
<div class="container py-4">
<h2 class="mb-4">Sales</h2>
<p class="text-muted">All Businesses Graphs</p>

<div class="row mb-5">
{% for i in '1234'|make_list %}
<div class="col-md-6 mb-4">
<div class="bg-light p-3">
<img src="https://via.placeholder.com/400x200" alt="Sales Chart" class="img-fluid w-100">
</div>
</div>
{% endfor %}
</div>

<h2 class="mb-4">Predictions</h2>
<p class="text-muted">All Businesses Graphs</p>

<div class="row">
{% for i in '1234'|make_list %}
<div class="col-md-6 mb-4">
<div class="bg-light p-3">
<img src="https://via.placeholder.com/400x200" alt="Prediction Chart" class="img-fluid w-100">
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
59 changes: 59 additions & 0 deletions project_design/growth_app/templates/growth_app/landing_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{% extends 'growth_app/base.html' %}

{% block title %}Growth - A powerful solution for your business{% endblock %}

{% block content %}
<div class="container py-5">
<!-- Hero Section -->
<div class="row py-5">
<div class="col-lg-7">
<h1 class="display-4 font-weight-bold">A powerful solution to analyze and grow your business. Fast!</h1>
<p class="lead mt-3 mb-4">Track performance, gain insights, and make data-driven decisions with our all-in-one business analytics platform.</p>
<div class="mt-4">
<a href="{% url 'register' %}" class="btn btn-dark px-4 py-2 mr-2">Get Started</a>
<a href="#" class="btn btn-outline-secondary px-4 py-2">Book Demo</a>
</div>
</div>
<div class="col-lg-5">
<div class="row">
<div class="col-md-6 mb-4">
<div class="bg-light rounded p-4" style="height: 200px;"></div>
</div>
<div class="col-md-6 mb-4">
<div class="bg-light rounded p-4" style="height: 200px;"></div>
</div>
<div class="col-md-6 mb-4">
<div class="bg-light rounded p-4" style="height: 200px;"></div>
</div>
<div class="col-md-6 mb-4">
<div class="bg-light rounded p-4" style="height: 200px;"></div>
</div>
</div>
</div>
</div>

<!-- Features Section -->
<div class="py-5">
<h2 class="mb-3">What do we offer</h2>
<p class="text-muted">Subheading</p>

<div class="row mt-4">
{% for i in '123456'|make_list %}
<div class="col-md-4 mb-4">
<div class="d-flex">
<div class="mr-3">
<div class="rounded-circle bg-dark text-white d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
<span>{{ forloop.counter }}</span>
</div>
</div>
<div>
<h5>Title</h5>
<p class="text-muted">Body text for whatever you'd like to say. Add main takeaway points, quotes, anecdotes, or even a very short story.</p>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}
Loading

0 comments on commit cf3756b

Please sign in to comment.