Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee18c536fd |
Binary file not shown.
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from .models import Lead, Call
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Lead)
|
||||
admin.site.register(Call)
|
||||
|
||||
12
core/forms.py
Normal file
12
core/forms.py
Normal file
@ -0,0 +1,12 @@
|
||||
from django import forms
|
||||
from .models import Lead, Call
|
||||
|
||||
class LeadForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Lead
|
||||
fields = ['company', 'contact_name', 'phone', 'notes', 'status']
|
||||
|
||||
class CallForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Call
|
||||
fields = ['call_outcome', 'summary', 'developments', 'requirements_raised', 'actions_taken', 'next_followup_date', 'followup_required']
|
||||
26
core/migrations/0001_initial.py
Normal file
26
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Generated by Django 5.2.7 on 2025-10-28 12:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Lead',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('company', models.CharField(max_length=255)),
|
||||
('contact_name', models.CharField(max_length=255)),
|
||||
('phone', models.CharField(max_length=20)),
|
||||
('notes', models.TextField(blank=True, null=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('last_contacted_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
32
core/migrations/0002_call.py
Normal file
32
core/migrations/0002_call.py
Normal file
@ -0,0 +1,32 @@
|
||||
# Generated by Django 5.2.7 on 2025-10-28 12:12
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Call',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('call_outcome', models.CharField(max_length=255)),
|
||||
('summary', models.TextField()),
|
||||
('developments', models.TextField()),
|
||||
('requirements_raised', models.TextField()),
|
||||
('actions_taken', models.TextField()),
|
||||
('next_followup_date', models.DateTimeField()),
|
||||
('followup_required', models.BooleanField(default=False)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('lead', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='calls', to='core.lead')),
|
||||
('sales_rep', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
||||
18
core/migrations/0003_lead_status.py
Normal file
18
core/migrations/0003_lead_status.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.7 on 2025-10-28 12:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0002_call'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('New', 'New'), ('Contacted', 'Contacted'), ('In Progress', 'In Progress'), ('Proposal Sent', 'Proposal Sent'), ('Closed Won', 'Closed Won'), ('Closed Lost', 'Closed Lost'), ('No Answer', 'No Answer')], default='New', max_length=50),
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
BIN
core/migrations/__pycache__/0002_call.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0002_call.cpython-311.pyc
Normal file
Binary file not shown.
BIN
core/migrations/__pycache__/0003_lead_status.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0003_lead_status.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,37 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Create your models here.
|
||||
class Lead(models.Model):
|
||||
company = models.CharField(max_length=255)
|
||||
contact_name = models.CharField(max_length=255)
|
||||
phone = models.CharField(max_length=20)
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
status = models.CharField(max_length=50, choices=[
|
||||
('New', 'New'),
|
||||
('Contacted', 'Contacted'),
|
||||
('In Progress', 'In Progress'),
|
||||
('Proposal Sent', 'Proposal Sent'),
|
||||
('Closed Won', 'Closed Won'),
|
||||
('Closed Lost', 'Closed Lost'),
|
||||
('No Answer', 'No Answer'),
|
||||
], default='New')
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
last_contacted_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.company
|
||||
|
||||
class Call(models.Model):
|
||||
lead = models.ForeignKey(Lead, related_name='calls', on_delete=models.CASCADE)
|
||||
sales_rep = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
call_outcome = models.CharField(max_length=255)
|
||||
summary = models.TextField()
|
||||
developments = models.TextField()
|
||||
requirements_raised = models.TextField()
|
||||
actions_taken = models.TextField()
|
||||
next_followup_date = models.DateTimeField()
|
||||
followup_required = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Call with {self.lead.contact_name} on {self.created_at}"
|
||||
@ -2,10 +2,20 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Lead Tracker{% endblock %}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Lead Tracker</a>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="container mt-4">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,154 +1,61 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ project_name }}{% endblock %}
|
||||
|
||||
{% 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 %}
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your app…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1>Leads</h1>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createLeadModal">
|
||||
Create Lead
|
||||
</button>
|
||||
</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 class="modal fade" id="createLeadModal" tabindex="-1" aria-labelledby="createLeadModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="createLeadModalLabel">Create New Lead</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||
</footer>
|
||||
<div class="modal-body">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">Save Lead</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<th>Contact Name</th>
|
||||
<th>Phone</th>
|
||||
<th>Created At</th>
|
||||
<th>Last Contacted</th>
|
||||
<th>Status</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for lead in leads %}
|
||||
<tr>
|
||||
<td><a href="{% url 'lead_detail' lead.id %}">{{ lead.company }}</a></td>
|
||||
<td>{{ lead.contact_name }}</td>
|
||||
<td>{{ lead.phone }}</td>
|
||||
<td>{{ lead.created_at|date:"Y-m-d H:i" }}</td>
|
||||
<td>{{ lead.last_contacted_at|date:"Y-m-d H:i" }}</td>
|
||||
<td>{{ lead.status }}</td>
|
||||
<td>{{ lead.notes }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="7" class="text-center">No leads found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
50
core/templates/core/lead_detail.html
Normal file
50
core/templates/core/lead_detail.html
Normal file
@ -0,0 +1,50 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h1 class="mb-4">{{ lead.company }}</h1>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
Lead Details
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><strong>Contact Name:</strong> {{ lead.contact_name }}</p>
|
||||
<p><strong>Phone:</strong> {{ lead.phone }}</p>
|
||||
<p><strong>Notes:</strong> {{ lead.notes }}</p>
|
||||
<p><strong>Created At:</strong> {{ lead.created_at }}</p>
|
||||
<p><strong>Last Contacted At:</strong> {{ lead.last_contacted_at }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
Calls
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% for call in lead.calls.all %}
|
||||
<div class="mb-2">
|
||||
<p><strong>{{ call.created_at }}</strong> - {{ call.summary }}</p>
|
||||
</div>
|
||||
{% empty %}
|
||||
<p>No calls logged yet.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Log a New Call
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">Save Call</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{% url 'index' %}" class="btn btn-secondary mt-4">Back to Leads</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
59
core/templates/core/lead_list.html
Normal file
59
core/templates/core/lead_list.html
Normal file
@ -0,0 +1,59 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1>Leads</h1>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createLeadModal">
|
||||
Create Lead
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="createLeadModal" tabindex="-1" aria-labelledby="createLeadModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="createLeadModalLabel">Create New Lead</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">Save Lead</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<th>Contact Name</th>
|
||||
<th>Phone</th>
|
||||
<th>Created At</th>
|
||||
<th>Last Contacted</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for lead in leads %}
|
||||
<tr>
|
||||
<td>{{ lead.company }}</td>
|
||||
<td>{{ lead.contact_name }}</td>
|
||||
<td>{{ lead.phone }}</td>
|
||||
<td>{{ lead.created_at|date:"Y-m-d H:i" }}</td>
|
||||
<td>{{ lead.last_contacted_at|date:"Y-m-d H:i" }}</td>
|
||||
<td>{{ lead.notes }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">No leads found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,7 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
path('', views.index, name='index'),
|
||||
path('lead/<int:lead_id>/', views.lead_detail, name='lead_detail'),
|
||||
]
|
||||
|
||||
@ -1,25 +1,29 @@
|
||||
import os
|
||||
import platform
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from .models import Lead, Call
|
||||
from .forms import LeadForm, CallForm
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
def index(request):
|
||||
if request.method == 'POST':
|
||||
form = LeadForm(request.POST)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
return redirect('index')
|
||||
else:
|
||||
form = LeadForm()
|
||||
|
||||
leads = Lead.objects.all()
|
||||
return render(request, 'core/index.html', {'form': form, 'leads': leads})
|
||||
|
||||
def home(request):
|
||||
"""Render the landing screen with loader and environment details."""
|
||||
host_name = request.get_host().lower()
|
||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
||||
now = timezone.now()
|
||||
|
||||
context = {
|
||||
"project_name": "New Style",
|
||||
"agent_brand": agent_brand,
|
||||
"django_version": django_version(),
|
||||
"python_version": platform.python_version(),
|
||||
"current_time": now,
|
||||
"host_name": host_name,
|
||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
def lead_detail(request, lead_id):
|
||||
lead = get_object_or_404(Lead, pk=lead_id)
|
||||
if request.method == 'POST':
|
||||
form = CallForm(request.POST)
|
||||
if form.is_valid():
|
||||
call = form.save(commit=False)
|
||||
call.lead = lead
|
||||
call.sales_rep = request.user
|
||||
call.save()
|
||||
return redirect('lead_detail', lead_id=lead.id)
|
||||
else:
|
||||
form = CallForm()
|
||||
return render(request, 'core/lead_detail.html', {'lead': lead, 'form': form})
|
||||
Loading…
x
Reference in New Issue
Block a user