2021-10-18 15:09:57 -04:00
|
|
|
{% load helpers %}
|
|
|
|
|
|
|
|
<div class="card">
|
|
|
|
<h5 class="card-header">Contacts</h5>
|
|
|
|
<div class="card-body">
|
|
|
|
{% with contacts=object.contacts.all %}
|
|
|
|
{% if contacts.exists %}
|
|
|
|
<table class="table table-hover">
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Role</th>
|
|
|
|
<th>Priority</th>
|
2022-08-10 13:22:58 +02:00
|
|
|
<th>Phone</th>
|
|
|
|
<th>Email</th>
|
2021-10-18 15:09:57 -04:00
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
{% for contact in contacts %}
|
|
|
|
<tr>
|
2022-03-22 14:51:20 -04:00
|
|
|
<td>{{ contact.contact|linkify }}</td>
|
2021-10-18 15:09:57 -04:00
|
|
|
<td>{{ contact.role|placeholder }}</td>
|
|
|
|
<td>{{ contact.get_priority_display|placeholder }}</td>
|
2022-08-10 13:22:58 +02:00
|
|
|
<td>
|
|
|
|
{% if contact.contact.phone %}
|
|
|
|
<a href="tel:{{ contact.contact.phone }}">{{ contact.contact.phone }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ ''|placeholder }}
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{% if contact.contact.email %}
|
|
|
|
<a href="mailto:{{ contact.contact.email }}">{{ contact.contact.email }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ ''|placeholder }}
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
2021-10-18 15:09:57 -04:00
|
|
|
<td class="text-end noprint">
|
|
|
|
{% if perms.tenancy.change_contactassignment %}
|
2021-11-04 14:09:12 -04:00
|
|
|
<a href="{% url 'tenancy:contactassignment_edit' pk=contact.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-warning btn-sm lh-1" title="Edit">
|
2021-10-18 15:09:57 -04:00
|
|
|
<i class="mdi mdi-pencil" aria-hidden="true"></i>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{% if perms.tenancy.delete_contactassignment %}
|
2021-11-04 14:09:12 -04:00
|
|
|
<a href="{% url 'tenancy:contactassignment_delete' pk=contact.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-danger btn-sm lh-1" title="Delete">
|
2021-10-18 15:09:57 -04:00
|
|
|
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
{% else %}
|
|
|
|
<div class="text-muted">None</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endwith %}
|
|
|
|
</div>
|
|
|
|
{% if perms.tenancy.add_contactassignment %}
|
|
|
|
<div class="card-footer text-end noprint">
|
2021-11-09 17:08:28 -05:00
|
|
|
<a href="{% url 'tenancy:contactassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm">
|
2021-10-18 15:09:57 -04:00
|
|
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a contact
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|