Compare commits

...

2 Commits

Author SHA1 Message Date
Flatlogic Bot
d763265cc1 V1 2025-10-25 19:45:38 +00:00
Flatlogic Bot
62acb941dc V1 2025-10-25 17:03:39 +00:00
33 changed files with 322 additions and 206 deletions

View File

@ -33,7 +33,8 @@ ALLOWED_HOSTS = [
CSRF_TRUSTED_ORIGINS = [ CSRF_TRUSTED_ORIGINS = [
origin for origin in [ origin for origin in [
os.getenv("HOST_FQDN", ""), os.getenv("HOST_FQDN", ""),
os.getenv("CSRF_TRUSTED_ORIGIN", "") os.getenv("CSRF_TRUSTED_ORIGIN", ""),
"https://matteo-barresi.dev.flatlogic.app",
] if origin ] if origin
] ]
CSRF_TRUSTED_ORIGINS = [ CSRF_TRUSTED_ORIGINS = [
@ -53,7 +54,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'core', 'core.apps.CoreConfig',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -141,6 +142,9 @@ USE_TZ = True
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles' STATIC_ROOT = BASE_DIR / 'staticfiles'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
STATICFILES_DIRS = [ STATICFILES_DIRS = [
BASE_DIR / 'static', BASE_DIR / 'static',

View File

@ -15,9 +15,14 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path("admin/", admin.site.urls),
path("", include("core.urls")), path("", include("core.urls")),
path("admin/", admin.site.urls),
] ]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -1,3 +1,4 @@
from django.contrib import admin from django.contrib import admin
from .models import Cliente
# Register your models here. admin.site.register(Cliente)

View File

@ -0,0 +1,29 @@
# Generated by Django 5.2.7 on 2025-10-25 19:20
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cliente',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nome', models.CharField(max_length=100, verbose_name='Nome')),
('cognome', models.CharField(max_length=100, verbose_name='Cognome')),
('codice_fiscale', models.CharField(max_length=16, unique=True, verbose_name='Codice Fiscale')),
('email', models.EmailField(max_length=254, verbose_name='Email')),
('telefono', models.CharField(max_length=20, verbose_name='Telefono')),
('data_di_nascita', models.DateField(verbose_name='Data di Nascita')),
('lavoro', models.CharField(max_length=100, verbose_name='Lavoro')),
('stato', models.CharField(choices=[('Cliente', 'Cliente'), ('Prospect', 'Prospect'), ('Ex-Cliente', 'Ex-Cliente')], max_length=20, verbose_name='Stato')),
('categoria', models.CharField(choices=[('Privato', 'Privato'), ('Azienda', 'Azienda')], max_length=20, verbose_name='Categoria')),
],
),
]

View File

@ -1,3 +1,31 @@
from django.db import models from django.db import models
# Create your models here. class Cliente(models.Model):
STATO_CHOICES = [
('Cliente', 'Cliente'),
('Prospect', 'Prospect'),
('Ex-Cliente', 'Ex-Cliente'),
]
CATEGORIA_CHOICES = [
('Privato', 'Privato'),
('Azienda', 'Azienda'),
]
nome = models.CharField("Nome", max_length=100)
cognome = models.CharField("Cognome", max_length=100)
codice_fiscale = models.CharField("Codice Fiscale", max_length=16, unique=True)
email = models.EmailField("Email")
telefono = models.CharField("Telefono", max_length=20)
data_di_nascita = models.DateField("Data di Nascita")
lavoro = models.CharField("Lavoro", max_length=100)
stato = models.CharField("Stato", max_length=20, choices=STATO_CHOICES)
categoria = models.CharField("Categoria", max_length=20, choices=CATEGORIA_CHOICES)
@property
def importo_portafoglio_attuale(self):
# This is a calculated field.
# The logic to calculate this value will be implemented later.
return 0.00
def __str__(self):
return f"{self.nome} {self.cognome}"

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title>
{% block head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>

View File

@ -1,14 +0,0 @@
{% extends 'base.html' %}
{% block title %}{{ article.title }}{% endblock %}
{% block content %}
<div class="container mt-5">
<h1>{{ article.title }}</h1>
<p class="text-muted">Published on {{ article.created_at|date:"F d, Y" }}</p>
<hr>
<div>
{{ article.content|safe }}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Finance Hub</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
:root {
--bs-primary: #2196F3;
--bs-primary-rgb: 33, 150, 243;
}
.navbar-brand {
font-weight: bold;
}
.btn-primary {
background-color: var(--bs-primary);
border-color: var(--bs-primary);
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'index' %}">Finance Hub</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{% url 'cliente_list' %}">Clienti</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-4">
{% block content %}
{% endblock %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,12 @@
{% extends 'core/base.html' %}
{% block content %}
<h1>Elimina Cliente</h1>
<p>Sei sicuro di voler eliminare il cliente "{{ object }}"?</p>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger">Conferma Eliminazione</button>
<a href="{% url 'cliente_list' %}" class="btn btn-secondary">Annulla</a>
</form>
{% endblock %}

View File

@ -0,0 +1,50 @@
{% extends 'core/base.html' %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h1>Dettagli Cliente</h1>
<div>
<a href="{% url 'cliente_edit' object.pk %}" class="btn btn-warning">Modifica</a>
<a href="{% url 'cliente_delete' object.pk %}" class="btn btn-danger">Elimina</a>
</div>
</div>
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">{{ object.nome }} {{ object.cognome }}</h5>
<p class="card-text"><strong>Codice Fiscale:</strong> {{ object.codice_fiscale }}</p>
<p class="card-text"><strong>Email:</strong> {{ object.email }}</p>
<p class="card-text"><strong>Telefono:</strong> {{ object.telefono }} <a href="https://wa.me/{{ object.telefono }}" target="_blank">(WhatsApp)</a></p>
<p class="card-text"><strong>Data di Nascita:</strong> {{ object.data_di_nascita }}</p>
<p class="card-text"><strong>Lavoro:</strong> {{ object.lavoro }}</p>
<p class="card-text"><strong>Stato:</strong> {{ object.stato }}</p>
<p class="card-text"><strong>Categoria:</strong> {{ object.categoria }}</p>
<p class="card-text"><strong>Importo Portafoglio Attuale:</strong> €{{ object.importo_portafoglio_attuale }}</p>
</div>
</div>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="portafogli-tab" data-bs-toggle="tab" data-bs-target="#portafogli" type="button" role="tab" aria-controls="portafogli" aria-selected="true">Portafogli</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="attivita-tab" data-bs-toggle="tab" data-bs-target="#attivita" type="button" role="tab" aria-controls="attivita" aria-selected="false">Attività</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="documenti-tab" data-bs-toggle="tab" data-bs-target="#documenti" type="button" role="tab" aria-controls="documenti" aria-selected="false">Documenti</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="portafogli" role="tabpanel" aria-labelledby="portafogli-tab">
<div class="p-3">Contenuto placeholder per i portafogli.</div>
</div>
<div class="tab-pane fade" id="attivita" role="tabpanel" aria-labelledby="attivita-tab">
<div class="p-3">Contenuto placeholder per le attività.</div>
</div>
<div class="tab-pane fade" id="documenti" role="tabpanel" aria-labelledby="documenti-tab">
<div class="p-3">Contenuto placeholder per i documenti.</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,12 @@
{% extends 'core/base.html' %}
{% block content %}
<h1>{% if object %}Modifica Cliente{% else %}Aggiungi Cliente{% endif %}</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type-="submit" class="btn btn-primary">Salva</button>
<a href="{% url 'cliente_list' %}" class="btn btn-secondary">Annulla</a>
</form>
{% endblock %}

View File

@ -0,0 +1,33 @@
{% extends 'core/base.html' %}
{% block content %}
<h1>Clienti</h1>
<a href="{% url 'cliente_new' %}" class="btn btn-primary mb-3">Aggiungi Cliente</a>
<table class="table table-striped">
<thead>
<tr>
<th>Nome</th>
<th>Cognome</th>
<th>Email</th>
<th>Stato</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
{% for cliente in clienti %}
<tr>
<td>{{ cliente.nome }}</td>
<td>{{ cliente.cognome }}</td>
<td>{{ cliente.email }}</td>
<td>{{ cliente.stato }}</td>
<td>
<a href="{% url 'cliente_detail' cliente.pk %}" class="btn btn-sm btn-info">Dettagli</a>
<a href="{% url 'cliente_edit' cliente.pk %}" class="btn btn-sm btn-warning">Modifica</a>
<a href="{% url 'cliente_delete' cliente.pk %}" class="btn btn-sm btn-danger">Elimina</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -1,154 +1,17 @@
{% extends "base.html" %}
{% block title %}{{ project_name }}{% endblock %} {% extends 'core/base.html' %}
{% block head %}
{% if project_description %}
<meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}">
<meta property="twitter:description" content="{{ project_description }}">
{% endif %}
{% if project_image_url %}
<meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% {
background-position: 0% 0%;
}
100% {
background-position: 100% 100%;
}
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2.5rem 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
h1 {
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
font-weight: 700;
margin: 0 0 1.2rem;
letter-spacing: -0.02em;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
opacity: 0.92;
}
.loader {
margin: 1.5rem auto;
width: 56px;
height: 56px;
border: 4px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.runtime code {
background: rgba(0, 0, 0, 0.25);
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
footer {
position: absolute;
bottom: 1rem;
width: 100%;
text-align: center;
font-size: 0.85rem;
opacity: 0.75;
}
</style>
{% endblock %}
{% block content %} {% block content %}
<main> <div class="px-4 py-5 my-5 text-center">
<div class="card"> <h1 class="display-5 fw-bold">Financial Hub</h1>
<h1>Analyzing your requirements and generating your app…</h1> <div class="col-lg-6 mx-auto">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <p class="lead mb-4">Benvenuto nel tuo CRM. Gestisci clienti, portafogli e attività da un unico posto.</p>
<span class="sr-only">Loading…</span> <div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<a href="{% url 'cliente_list' %}" class="btn btn-primary btn-lg px-4 gap-3">Gestisci Clienti</a>
<button type="button" class="btn btn-outline-secondary btn-lg px-4" disabled>Portafogli</button>
<button type="button" class="btn btn-outline-secondary btn-lg px-4" disabled>Attività</button>
<button type="button" class="btn btn-outline-secondary btn-lg px-4" disabled>Documenti</button>
</div>
</div> </div>
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
<p class="runtime">
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
</p>
</div> </div>
</main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
</footer>
{% endblock %} {% endblock %}

View File

@ -1,7 +1,18 @@
from django.urls import path from django.urls import path
from .views import (
from .views import home IndexView,
ClienteListView,
ClienteDetailView,
ClienteCreateView,
ClienteUpdateView,
ClienteDeleteView,
)
urlpatterns = [ urlpatterns = [
path("", home, name="home"), path('', IndexView.as_view(), name='index'),
path('clienti/', ClienteListView.as_view(), name='cliente_list'),
path('clienti/<int:pk>/', ClienteDetailView.as_view(), name='cliente_detail'),
path('clienti/new/', ClienteCreateView.as_view(), name='cliente_new'),
path('clienti/<int:pk>/edit/', ClienteUpdateView.as_view(), name='cliente_edit'),
path('clienti/<int:pk>/delete/', ClienteDeleteView.as_view(), name='cliente_delete'),
] ]

View File

@ -1,25 +1,34 @@
import os from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
import platform from django.urls import reverse_lazy
from .models import Cliente
from django import get_version as django_version class IndexView(ListView):
from django.shortcuts import render model = Cliente
from django.utils import timezone template_name = "core/index.html"
context_object_name = "clienti"
class ClienteListView(ListView):
model = Cliente
template_name = "core/cliente_list.html"
context_object_name = "clienti"
def home(request): class ClienteDetailView(DetailView):
"""Render the landing screen with loader and environment details.""" model = Cliente
host_name = request.get_host().lower() template_name = "core/cliente_detail.html"
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
now = timezone.now()
context = { class ClienteCreateView(CreateView):
"project_name": "New Style", model = Cliente
"agent_brand": agent_brand, fields = '__all__'
"django_version": django_version(), template_name = "core/cliente_form.html"
"python_version": platform.python_version(), success_url = reverse_lazy('cliente_list')
"current_time": now,
"host_name": host_name, class ClienteUpdateView(UpdateView):
"project_description": os.getenv("PROJECT_DESCRIPTION", ""), model = Cliente
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), fields = '__all__'
} template_name = "core/cliente_form.html"
return render(request, "core/index.html", context) success_url = reverse_lazy('cliente_list')
class ClienteDeleteView(DeleteView):
model = Cliente
template_name = "core/cliente_confirm_delete.html"
success_url = reverse_lazy('cliente_list')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

37
static/css/custom.css Normal file
View File

@ -0,0 +1,37 @@
body {
background: linear-gradient(to right, #2196F3, #64b5f6) !important;
color: #212529;
}
.navbar-brand {
font-family: 'Roboto Slab', serif;
}
.card {
background-color: rgba(255, 255, 255, 0.8);
border: none;
color: #212529;
}
.list-group-item {
background-color: transparent;
border-color: rgba(0, 0, 0, 0.125);
color: #212529;
}
a.list-group-item:hover {
background-color: rgba(0, 0, 0, 0.05);
}
.navbar {
background-color: rgba(255, 255, 255, 0.3) !important;
}
.nav-link {
color: #212529 !important;
}
/* Stile per l'intestazione della tabella clienti */
.table > thead {
background-color: #E9ECEF !important; /* Bootstrap light grey */
}