{% extends "base.html" %} {% load static erp_tags labels crm_tags %} {% block title %}{{ party.display_name }} — {% label "parties.party" %}{% endblock %} {% block chat_context %} {% endblock %} {% block stylesheets %} {% endblock %} {% block content %} {% if party.merged_into_id %}
Merged into {{ party.merged_into.display_name }}{% if party.merged_at %} on {{ party.merged_at|date:"M j, Y" }}{% endif %}.
{% endif %} {% if party.erased_at %}
Erased on {{ party.erased_at|date:"M j, Y" }}.
{% endif %} {# Header #}

{{ party.display_name }}

{% if party.kind == "organisation" %}{% label "parties.organisation" %}{% else %}{% label "parties.person" %}{% endif %} {% if party.owner %} · Owner: {{ party.owner|profile_name }}{% if party.owner_team %} · {{ party.owner_team.name }}{% if not party.owner_team.is_active %} (archived team){% endif %}{% endif %}{% endif %}

{% for role in open_roles %}{{ role.label }}{% endfor %} {% if lifecycle_label %}Lifecycle: {{ lifecycle_label }}{% endif %} {% if contact_type_label %}Contact type: {{ contact_type_label }}{% endif %}
    {% if primary_email %}
  • {{ primary_email.email }}
  • {% endif %} {% if primary_phone %}
  • {{ primary_phone.display }}
  • {% endif %}
{% if suppressions %}Suppressed{% endif %}
{% if editable %} Edit {% if can_add_role %} Add role {% endif %} {% endif %}
{# 1. Contact points #}

Contact points

{% if editable %} {% endif %}

Emails

    {% for row in emails %}
  • {{ row.email }} {% if row.is_primary %}Primary{% endif %} {{ row.get_purpose_display }} {% if row.verified_at %}Verified{% endif %} {% if row.status == "bounced" %}Bounced{% elif row.status == "obsolete" %}Obsolete{% endif %} {% if row.mirrored %}
    {% if row.mirror_customer %}From {% label "customers.customer" case="lower" %} account {{ row.mirror_customer }}{% else %}Mirrored from {{ row.source }}{% endif %}
    {% endif %}
    {% if not row.mirrored and editable %}
    Edit
    {% csrf_token %}
    {% endif %}
  • {% empty %}
  • No email addresses.
  • {% endfor %}

Phones

    {% for row in phones %}
  • {{ row.display }}{% if row.extension %} ext. {{ row.extension }}{% endif %} {% if row.is_primary %}Primary{% endif %} {{ row.get_purpose_display }} {% if row.line_type != "unknown" %}{{ row.get_line_type_display }}{% endif %} {% if row.verified_at %}Verified{% endif %} {% if not row.number_e164 %}Not a full number{% endif %} {% if row.mirrored %}
    {% if row.mirror_customer %}From {% label "customers.customer" case="lower" %} account {{ row.mirror_customer }}{% else %}Mirrored from {{ row.source }}{% endif %}
    {% endif %}
    {% if not row.mirrored and editable %}
    Edit
    {% csrf_token %}
    {% endif %}
  • {% empty %}
  • No phone numbers.
  • {% endfor %}

Addresses

    {% for row in addresses %}
  • {% if row.label %}{{ row.label }}
    {% endif %} {{ row.address_line_1 }}{% if row.address_line_2 %}, {{ row.address_line_2 }}{% endif %}
    {{ row.city }}, {{ row.state_province }} {{ row.postal_code }} · {{ row.country }}
    {% if row.is_primary %}Primary{% endif %} {{ row.get_purpose_display }} {% if row.valid_to %}Moved away {{ row.valid_to|date:"M j, Y" }}{% endif %}
    {% if row.mirrored %}
    From {% label "customers.customer" case="lower" %} account {{ row.mirror_customer }}
    {% endif %}
    {% if not row.mirrored and editable %}
    Edit
    {% csrf_token %}
    {% endif %}
  • {% empty %}
  • No addresses.
  • {% endfor %}
{# Side column #}
{# 2. Next actions and engagements (phase4-fields.md 5.2) #}

Next actions

{% if editable %} {% label "crm.engagement" %}{% endif %}
    {% for task in next_actions %}
  • {{ task.title }} · {{ task.kind_label }} · {{ task.assignee|profile_name }} {% if task.engagement %}· {{ task.engagement.number }}{% endif %} {% if task.due_at %}{% if task.overdue %}Overdue: {% else %}Due {% endif %}{{ task.due_at|date:"M j" }}{% else %}No due date{% endif %}
  • {% empty %}
  • No open {% label "crm.task" plural=True case="lower" %}.
  • {% endfor %}

{% label "crm.engagement" plural=True %}

    {% for eng in party_engagements %}
  • {{ eng.number }} {{ eng.title }} {% if eng.as_contact %}· as a contact{% endif %} {% if eng.status == "open" %}{{ eng.stage.name|default:"Open" }}{% else %}{{ eng.get_status_display }}{% endif %} · {{ eng.owner|profile_name }}
  • {% empty %}
  • No {% label "crm.engagement" plural=True case="lower" %}.
  • {% endfor %}
{# 3. Profile #}

Profile

{% if editable %}Edit{% endif %}
Lifecycle stage
{% if lifecycle_label %}{{ lifecycle_label }}{% if party.lifecycle_stage_changed_at %} since {{ party.lifecycle_stage_changed_at|date:"M j, Y" }}{% endif %}{% else %}unknown{% endif %}
Contact type
{% if contact_type_label %}{{ contact_type_label }}{% else %}not set{% endif %}
{% include "erp/_definition_groups.html" with groups=definition_groups %}
{# 4. Relationships #}

Relationships

{% if editable %} Relationship {% endif %}
{% for label_text, rels in relationship_groups %}

{{ label_text }}

    {% for rel in rels %}
  • {{ rel.other.display_name }} {% if rel.title %} · {{ rel.title }}{% endif %} {% if rel.is_primary %}Primary{% endif %} {% if rel.valid_from %} · since {{ rel.valid_from|date:"M j, Y" }}{% endif %} {% if not rel.system and editable %}Edit{% endif %}
  • {% endfor %}
{% empty %}

No current relationships.

{% endfor %} {% if past_relationships %}
Past relationships ({{ past_relationships|length }})
{% endif %}
{# 5. Commerce #} {% if commerce_accounts %}

Commerce

{% for account in commerce_accounts %} {% endfor %}
{% label "customers.customer" %} accounts
{% label "customers.customer" %} account Pricing tier Last order Open {% label "orders.quote" plural=True case="lower" %}
{{ account }}{% if not account.is_active %} Inactive{% endif %} {{ account.get_pricing_tier_display }} {{ account.last_order_at|date:"M j, Y"|default:"—" }} {{ account.open_quotes }}
{% if recent_orders %}

Recent {% label "orders.order" plural=True case="lower" %}

    {% for order in recent_orders %}
  • {{ order.order_number }} · {{ order.created_at|date:"M j, Y" }} · {{ order.get_status_display }} · {{ order.grand_total|money }}
  • {% endfor %}
{% endif %}
{% endif %} {# Leads (with commerce: how the party arrived) #} {% if leads %}

{% label "crm.lead" plural=True %}

    {% for lead in leads %}
  • {{ lead.lead_number }} {{ lead.get_status_display }} {{ lead.created_at|date:"M j, Y" }}
  • {% endfor %}
{% endif %} {# 6. Timeline (party scope) #}

Timeline

    {% for c in party_timeline %}
  1. {{ c.occurred_at|date:"M j, Y H:i" }} · {{ c.subject|default:c.kind_label }} · {{ c.kind_label }} · {{ c.get_direction_display }}{% if c.performed_by %} · {{ c.performed_by|profile_name }}{% endif %} {% if c.engagement %}· {{ c.engagement.number }}{% endif %} {% if c.summary %}
    {{ c.summary|truncatechars:160 }}
    {% endif %}
  2. {% empty %}
  3. No communications yet.
  4. {% endfor %}
{# 7. Consent #}
{% endblock %} {% block javascripts %} {% endblock %}