introduce message field in lead form
This commit is contained in:
parent
5eb40ffc4f
commit
ddec9d1126
7 changed files with 46 additions and 5 deletions
|
@ -5,12 +5,13 @@ from .models import Lead, Plan, PlanPrice
|
|||
class LeadForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Lead
|
||||
fields = ["name", "company", "email", "phone"]
|
||||
fields = ["name", "company", "email", "phone", "message"]
|
||||
widgets = {
|
||||
"name": forms.TextInput(attrs={"class": "form-control"}),
|
||||
"company": forms.TextInput(attrs={"class": "form-control"}),
|
||||
"email": forms.EmailInput(attrs={"class": "form-control"}),
|
||||
"phone": forms.TextInput(attrs={"class": "form-control"}),
|
||||
"message": forms.Textarea(attrs={"class": "form-control", "rows": 4}),
|
||||
}
|
||||
|
||||
|
||||
|
|
18
hub/services/migrations/0004_lead_message.py
Normal file
18
hub/services/migrations/0004_lead_message.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.1.5 on 2025-01-31 16:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("services", "0003_serviceoffering_status"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="lead",
|
||||
name="message",
|
||||
field=models.TextField(blank=True, max_length=1000),
|
||||
),
|
||||
]
|
|
@ -273,6 +273,7 @@ class Lead(models.Model):
|
|||
company = models.CharField(max_length=200)
|
||||
email = models.EmailField()
|
||||
phone = models.CharField(max_length=50)
|
||||
message = models.TextField(blank=True, max_length=1000)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
odoo_lead_id = models.IntegerField(null=True, blank=True)
|
||||
|
||||
|
|
|
@ -86,7 +86,11 @@ class OdooAPI:
|
|||
"partner_name": lead.company,
|
||||
"email_from": lead.email,
|
||||
"phone": lead.phone,
|
||||
"description": "<br/>".join(service_details),
|
||||
"description": (
|
||||
f"{lead.message}<br/><br/>" + "<br/>".join(service_details)
|
||||
if lead.message
|
||||
else "<br/>".join(service_details)
|
||||
),
|
||||
"type": "lead",
|
||||
"campaign_id": settings.ODOO_CONFIG["campaign_id"],
|
||||
"source_id": settings.ODOO_CONFIG["source_id"],
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title mb-4">Order {{ service.name }}</h2>
|
||||
<h2 class="card-title mb-4">Interested in {{ service.name }}</h2>
|
||||
|
||||
{% if selected_offering %}
|
||||
<div class="mb-4">
|
||||
<h5>Service Details</h5>
|
||||
{% if selected_offering %}
|
||||
|
@ -24,6 +25,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
|
@ -76,6 +78,16 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.message.id_for_label }}" class="form-label">Message (Optional)</label>
|
||||
{{ form.message }}
|
||||
{% if form.message.errors %}
|
||||
<div class="invalid-feedback d-block">
|
||||
{{ form.message.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'services:service_detail' service.slug %}" class="btn btn-secondary">Cancel</a>
|
||||
|
|
|
@ -97,8 +97,9 @@
|
|||
</div>
|
||||
{% empty %}
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info">
|
||||
No offerings available yet.
|
||||
<div class="alert alert-info d-flex justify-content-between align-items-center">
|
||||
<span>No offerings available yet.</span>
|
||||
<a href="{% url 'services:create_lead' service.slug %}" class="btn btn-success">Show Interest</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -116,6 +116,10 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{% url 'services:create_lead' service.slug %}" class="btn btn-success">
|
||||
Show Interest
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue