Initial commit: LeoCRM - Flask CRM with auth, companies, contacts
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LeoCRM</title>
|
||||||
|
<style>
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
body { font-family: Arial, sans-serif; background: #f5f5f5; color: #333; }
|
||||||
|
nav { background: #2c3e50; color: white; padding: 1rem; display: flex; justify-content: space-between; align-items: center; }
|
||||||
|
nav a { color: white; text-decoration: none; margin-left: 1rem; }
|
||||||
|
nav a:hover { text-decoration: underline; }
|
||||||
|
.container { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
|
||||||
|
.flash { padding: 0.75rem; margin-bottom: 1rem; border-radius: 4px; }
|
||||||
|
.flash.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
|
||||||
|
.flash.danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
|
||||||
|
.flash.warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
|
||||||
|
.flash.info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
|
||||||
|
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
|
||||||
|
th, td { padding: 0.5rem; text-align: left; border-bottom: 1px solid #ddd; }
|
||||||
|
th { background: #f8f9fa; }
|
||||||
|
.btn { display: inline-block; padding: 0.4rem 0.8rem; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 0.9rem; }
|
||||||
|
.btn-primary { background: #007bff; color: white; }
|
||||||
|
.btn-danger { background: #dc3545; color: white; }
|
||||||
|
.btn-secondary { background: #6c757d; color: white; }
|
||||||
|
.btn-sm { padding: 0.2rem 0.5rem; font-size: 0.8rem; }
|
||||||
|
form label { display: block; margin-top: 0.5rem; font-weight: bold; }
|
||||||
|
form input, form textarea { width: 100%; padding: 0.4rem; margin-top: 0.2rem; border: 1px solid #ccc; border-radius: 4px; }
|
||||||
|
form textarea { resize: vertical; min-height: 60px; }
|
||||||
|
form button { margin-top: 1rem; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<span><strong>LeoCRM</strong></span>
|
||||||
|
<span>
|
||||||
|
{% if session.username %}
|
||||||
|
<span>{{ session.username }}</span>
|
||||||
|
<a href="{{ url_for('dashboard') }}">Dashboard</a>
|
||||||
|
<a href="{{ url_for('logout') }}">Logout</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ url_for('login') }}">Login</a>
|
||||||
|
<a href="{{ url_for('register') }}">Register</a>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</nav>
|
||||||
|
<div class="container">
|
||||||
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
|
{% if messages %}
|
||||||
|
{% for category, message in messages %}
|
||||||
|
<div class="flash {{ category }}">{{ message }}</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>{% if company %}Firma bearbeiten{% else %}Neue Firma{% endif %}</h2>
|
||||||
|
<form method="post">
|
||||||
|
<label>Name *</label>
|
||||||
|
<input type="text" name="name" value="{{ company.name if company else '' }}" required>
|
||||||
|
<label>Adresse</label>
|
||||||
|
<input type="text" name="address" value="{{ company.address if company else '' }}">
|
||||||
|
<label>Telefon</label>
|
||||||
|
<input type="text" name="phone" value="{{ company.phone if company else '' }}">
|
||||||
|
<label>Email</label>
|
||||||
|
<input type="email" name="email" value="{{ company.email if company else '' }}">
|
||||||
|
<label>Website</label>
|
||||||
|
<input type="text" name="website" value="{{ company.website if company else '' }}">
|
||||||
|
<label>Notizen</label>
|
||||||
|
<textarea name="notes">{{ company.notes if company else '' }}</textarea>
|
||||||
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||||
|
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Abbrechen</a>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>{% if contact %}Kontakt bearbeiten{% else %}Neuer Kontakt{% endif %} – {{ company.name }}</h2>
|
||||||
|
<form method="post">
|
||||||
|
<label>Vorname *</label>
|
||||||
|
<input type="text" name="first_name" value="{{ contact.first_name if contact else '' }}" required>
|
||||||
|
<label>Nachname *</label>
|
||||||
|
<input type="text" name="last_name" value="{{ contact.last_name if contact else '' }}" required>
|
||||||
|
<label>Email</label>
|
||||||
|
<input type="email" name="email" value="{{ contact.email if contact else '' }}">
|
||||||
|
<label>Telefon</label>
|
||||||
|
<input type="text" name="phone" value="{{ contact.phone if contact else '' }}">
|
||||||
|
<label>Position</label>
|
||||||
|
<input type="text" name="position" value="{{ contact.position if contact else '' }}">
|
||||||
|
<label>Notizen</label>
|
||||||
|
<textarea name="notes">{{ contact.notes if contact else '' }}</textarea>
|
||||||
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||||
|
<a href="{{ url_for('contact_list', company_id=company.id) }}" class="btn btn-secondary">Abbrechen</a>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>{{ company.name }} – Kontaktpersonen</h2>
|
||||||
|
<a href="{{ url_for('contact_create', company_id=company.id) }}" class="btn btn-primary">Neuer Kontakt</a>
|
||||||
|
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Zurück</a>
|
||||||
|
{% if contacts %}
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Position</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Telefon</th>
|
||||||
|
<th>Aktionen</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for c in contacts %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ c.first_name }} {{ c.last_name }}</td>
|
||||||
|
<td>{{ c.position or '-' }}</td>
|
||||||
|
<td>{{ c.email or '-' }}</td>
|
||||||
|
<td>{{ c.phone or '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url_for('contact_edit', id=c.id) }}" class="btn btn-sm btn-secondary">Edit</a>
|
||||||
|
<form method="post" action="{{ url_for('contact_delete', id=c.id) }}" style="display:inline;">
|
||||||
|
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Wirklich löschen?')">Del</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>Keine Kontaktpersonen erfasst.</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>Dashboard</h2>
|
||||||
|
<a href="{{ url_for('company_create') }}" class="btn btn-primary">Neue Firma</a>
|
||||||
|
{% if companies %}
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Telefon</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Aktionen</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for c in companies %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{ url_for('contact_list', company_id=c.id) }}">{{ c.name }}</a></td>
|
||||||
|
<td>{{ c.phone or '-' }}</td>
|
||||||
|
<td>{{ c.email or '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url_for('company_edit', id=c.id) }}" class="btn btn-sm btn-secondary">Edit</a>
|
||||||
|
<form method="post" action="{{ url_for('company_delete', id=c.id) }}" style="display:inline;">
|
||||||
|
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Wirklich löschen?')">Del</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>Noch keine Firmen erfasst.</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>Login</h2>
|
||||||
|
<form method="post">
|
||||||
|
<label>Benutzername</label>
|
||||||
|
<input type="text" name="username" required>
|
||||||
|
<label>Passwort</label>
|
||||||
|
<input type="password" name="password" required>
|
||||||
|
<button type="submit" class="btn btn-primary">Anmelden</button>
|
||||||
|
</form>
|
||||||
|
<p style="margin-top:1rem;">Noch kein Konto? <a href="{{ url_for('register') }}">Registrieren</a></p>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>Registrieren</h2>
|
||||||
|
<form method="post">
|
||||||
|
<label>Benutzername</label>
|
||||||
|
<input type="text" name="username" required>
|
||||||
|
<label>Passwort</label>
|
||||||
|
<input type="password" name="password" required>
|
||||||
|
<button type="submit" class="btn btn-primary">Registrieren</button>
|
||||||
|
</form>
|
||||||
|
<p style="margin-top:1rem;">Bereits registriert? <a href="{{ url_for('login') }}">Anmelden</a></p>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# LeoCRM – Requirements
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
A minimal web CRM for managing companies and their contact persons, with user authentication.
|
||||||
|
|
||||||
|
## Functional Requirements
|
||||||
|
|
||||||
|
### FR1: User Authentication
|
||||||
|
- Users can register with username and password
|
||||||
|
- Users can login/logout
|
||||||
|
- Passwords are hashed with bcrypt
|
||||||
|
- Session management via Flask-Login
|
||||||
|
|
||||||
|
### FR2: Company Management
|
||||||
|
- Authenticated users can create, view, edit, and delete companies
|
||||||
|
- Company fields: name, address, phone, email, website, notes
|
||||||
|
- List view with search/filter
|
||||||
|
|
||||||
|
### FR3: Contact Person Management
|
||||||
|
- Each contact person belongs to a company
|
||||||
|
- Fields: first_name, last_name, email, phone, position, notes
|
||||||
|
- CRUD operations, linked to company
|
||||||
|
|
||||||
|
### FR4: Web UI
|
||||||
|
- Jinja2 templates with basic styling
|
||||||
|
- Navigation between sections
|
||||||
|
- Forms with validation
|
||||||
|
|
||||||
|
## Non-Functional Requirements
|
||||||
|
- SQLite database (no external DB needed)
|
||||||
|
- Runs on single server (Flask built-in or gunicorn)
|
||||||
|
- Deployable via Coolify (Docker)
|
||||||
|
- Code in Git (Forgejo)
|
||||||
|
|
||||||
|
## Out of Scope
|
||||||
|
- Multi-tenancy
|
||||||
|
- REST API
|
||||||
|
- Advanced search
|
||||||
|
- File uploads
|
||||||
|
- Email notifications
|
||||||
Reference in New Issue
Block a user