mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-04 17:01:56 +02:00
230 lines
12 KiB
HTML
230 lines
12 KiB
HTML
{% extends "admin/fieldset.html" %}
|
|
{% load custom_filters %}
|
|
{% load static url_helpers %}
|
|
|
|
{% comment %}
|
|
This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|
{% endcomment %}
|
|
|
|
{% block field_readonly %}
|
|
{% with all_contacts=original_object.other_contacts.all %}
|
|
{% if field.field.name == "other_contacts" %}
|
|
{% if all_contacts.count > 2 %}
|
|
<div class="readonly">
|
|
{% for contact in all_contacts %}
|
|
<a href="{% url 'admin:registrar_contact_change' contact.id %}">{{ contact.get_formatted_name }}</a>{% if not forloop.last %}, {% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="flex-container dja-detail-list">
|
|
<dl class="usa-list usa-list--unstyled margin-0">
|
|
{% for contact in all_contacts %}
|
|
<dt class="{% if forloop.counter == 1%}margin-top-0{% endif %}">
|
|
Organization contact {{forloop.counter}}
|
|
</dt>
|
|
<dd>
|
|
{% include "django/admin/includes/contact_detail_list.html" with user=contact show_formatted_name=True %}
|
|
</dd>
|
|
{% endfor %}
|
|
</dl>
|
|
</div>
|
|
{% endif %}
|
|
{% elif field.field.name == "requested_domain" %}
|
|
{% with current_path=request.get_full_path %}
|
|
<a class="margin-top-05 padding-top-05" href="{% url 'admin:registrar_draftdomain_change' original.requested_domain.id %}?{{ 'return_path='|add:current_path }}">{{ original.requested_domain }}</a>
|
|
{% endwith%}
|
|
{% elif field.field.name == "current_websites" %}
|
|
{% comment %}
|
|
The "website" model is essentially just a text field.
|
|
It is not useful to be redirected to the object definition,
|
|
rather it is more useful in this scenario to be redirected to the
|
|
actual website (as its just a plaintext string otherwise).
|
|
|
|
This ONLY applies to analysts. For superusers, its business as usual.
|
|
{% endcomment %}
|
|
<div class="readonly">
|
|
{% with total_websites=field.contents|split:", " %}
|
|
{% for website in total_websites %}
|
|
<a href="{{ website }}" target="_blank" class="padding-top-1 current-website__{{forloop.counter}}">{{ website }}</a>{% if not forloop.last %}, {% endif %}
|
|
{# Acts as a <br> #}
|
|
{% if total_websites|length < 5 %}
|
|
<div class="display-block margin-top-1"></div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endwith %}
|
|
</div>
|
|
{% elif field.field.name == "alternative_domains" %}
|
|
<div class="readonly">
|
|
{% with current_path=request.get_full_path %}
|
|
{% for alt_domain in original_object.alternative_domains.all %}
|
|
<a href="{% url 'admin:registrar_website_change' alt_domain.id %}?{{ 'return_path='|add:current_path }}">{{ alt_domain }}</a>{% if not forloop.last %}, {% endif %}
|
|
{% endfor %}
|
|
{% endwith %}
|
|
</div>
|
|
{% else %}
|
|
<div class="readonly">{{ field.contents }}</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% endblock field_readonly %}
|
|
|
|
{% block after_help_text %}
|
|
{% if field.field.name == "status" %}
|
|
<div class="flex-container" id="dja-status-changelog">
|
|
<label aria-label="Status changelog"></label>
|
|
<div>
|
|
<div class="usa-table-container--scrollable collapse--dgsimple collapsed" tabindex="0">
|
|
{% if filtered_audit_log_entries %}
|
|
<table class="usa-table usa-table--borderless">
|
|
<thead>
|
|
<tr>
|
|
<th>Status</th>
|
|
<th>User</th>
|
|
<th>Changed at</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for entry in filtered_audit_log_entries %}
|
|
<tr>
|
|
<td>
|
|
{% if entry.status %}
|
|
{{ entry.status|default:"Error" }}
|
|
{% else %}
|
|
Error
|
|
{% endif %}
|
|
|
|
{% if entry.rejection_reason %}
|
|
- {{ entry.rejection_reason|default:"Error" }}
|
|
{% endif %}
|
|
|
|
{% if entry.action_needed_reason %}
|
|
- {{ entry.action_needed_reason|default:"Error" }}
|
|
{% endif %}
|
|
</td>
|
|
<td>{{ entry.actor|default:"Error" }}</td>
|
|
<td>{{ entry.timestamp|date:"Y-m-d H:i:s" }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<p>No changelog to display.</p>
|
|
{% endif %}
|
|
|
|
{% comment %}
|
|
Store the action needed reason emails in a json-based dictionary.
|
|
This allows us to change the action_needed_reason_email field dynamically, depending on value.
|
|
The alternative to this is an API endpoint.
|
|
|
|
Given that we have a limited number of emails, doing it this way makes sense.
|
|
{% endcomment %}
|
|
{% if action_needed_reason_emails %}
|
|
<script id="action-needed-emails-data" type="application/json">
|
|
{{ action_needed_reason_emails|safe }}
|
|
</script>
|
|
{% endif %}
|
|
<div id="action_needed_reason_email_readonly" class="dja-readonly-textarea-container padding-1 margin-top-2 thin-border display-none">
|
|
<label class="max-full" for="action_needed_reason_email_view_more">
|
|
<strong>Auto-generated email (sent to submitter)</strong>
|
|
</label>
|
|
<textarea id="action_needed_reason_email_view_more" cols="40" rows="20" class="{% if not original_object.action_needed_reason %}display-none{% endif %}" readonly>
|
|
{{ original_object.action_needed_reason_email }}
|
|
</textarea>
|
|
<p id="no-email-message" class="{% if original_object.action_needed_reason %}display-none{% endif %}">No email will be sent.</p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<button type="button" class="collapse-toggle--dgsimple usa-button usa-button--unstyled margin-top-2 margin-bottom-1 margin-left-1">
|
|
<span>Show details</span>
|
|
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
|
<use xlink:href="/public/img/sprite.svg#expand_more"></use>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{% elif field.field.name == "creator" %}
|
|
<div class="flex-container tablet:margin-top-2">
|
|
<label aria-label="Creator contact details"></label>
|
|
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.creator no_title_top_padding=field.is_readonly user_verification_type=original_object.creator.get_verification_type_display%}
|
|
</div>
|
|
{% include "django/admin/includes/user_detail_list.html" with user=original_object.creator no_title_top_padding=field.is_readonly %}
|
|
{% elif field.field.name == "submitter" %}
|
|
<div class="flex-container tablet:margin-top-2">
|
|
<label aria-label="Submitter contact details"></label>
|
|
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.submitter no_title_top_padding=field.is_readonly %}
|
|
</div>
|
|
{% elif field.field.name == "senior_official" %}
|
|
<div class="flex-container">
|
|
<label aria-label="Senior official contact details"></label>
|
|
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.senior_official no_title_top_padding=field.is_readonly %}
|
|
</div>
|
|
{% elif field.field.name == "other_contacts" and original_object.other_contacts.all %}
|
|
{% with all_contacts=original_object.other_contacts.all %}
|
|
{% if all_contacts.count > 2 %}
|
|
<details class="margin-top-1 dja-detail-table" aria-role="button" open>
|
|
<summary class="padding-1 padding-left-0 dja-details-summary">Details</summary>
|
|
<div class="grid-container margin-left-0 padding-left-0 padding-right-0 dja-details-contents">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="4">Other contact information</th>
|
|
<tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for contact in all_contacts %}
|
|
<tr>
|
|
<th class="padding-left-1" scope="row">{{ contact.get_formatted_name }}</th>
|
|
<td class="padding-left-1">{{ contact.title }}</td>
|
|
<td class="padding-left-1">
|
|
{{ contact.email }}
|
|
</td>
|
|
<td class="padding-left-1">{{ contact.phone }}</td>
|
|
<td class="padding-left-1 text-size-small">
|
|
<input aria-hidden="true" class="display-none" value="{{ contact.email }}" />
|
|
<button
|
|
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard usa-button__small-text text-no-underline"
|
|
type="button"
|
|
>
|
|
<svg
|
|
class="usa-icon"
|
|
>
|
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
|
</svg>
|
|
<span>Copy email</span>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% elif field.field.name == "state_territory" %}
|
|
<div class="flex-container margin-top-2">
|
|
<span>
|
|
CISA region:
|
|
{% if original_object.generic_org_type and original_object.generic_org_type != original_object.OrganizationChoices.FEDERAL %}
|
|
{{ original_object.state_territory|get_region }}
|
|
{% else %}
|
|
N/A
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
{% elif field.field.name == "investigator" and not field.is_readonly %}
|
|
<div class="flex-container">
|
|
<label aria-label="Assign yourself as the investigator"></label>
|
|
<button id="investigator__assign_self"
|
|
data-user-name="{{ request.user }}"
|
|
data-user-id="{{ request.user.id }}"
|
|
type="button"
|
|
class="usa-button usa-button--unstyled usa-button--dja-link-color usa-button__small-text text-no-underline margin-top-2 margin-bottom-1 margin-left-1">
|
|
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
|
<use xlink:href="/public/img/sprite.svg#group_add"></use>
|
|
</svg>
|
|
<span>Assign to me</span>
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock after_help_text %}
|