mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-06 01:35:22 +02:00
468 lines
24 KiB
HTML
468 lines
24 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 flex_container_start %}
|
|
{% if field.field.name == "status_history" %}
|
|
<div class="flex-container flex-container--mobile-inline {% if not line.fields|length == 1 %} fieldBox{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}{% elif field.is_checkbox %} checkbox-row{% endif %}">
|
|
{% else %}
|
|
{% comment %} Default flex container element {% endcomment %}
|
|
<div class="flex-container{% if not line.fields|length == 1 %} fieldBox{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}{% elif field.is_checkbox %} checkbox-row{% endif %}">
|
|
{% endif %}
|
|
{% endblock flex_container_start %}
|
|
|
|
{% block field_readonly %}
|
|
{% with all_contacts=original_object.other_contacts.all %}
|
|
{% if field.field.name == "status_history" %}
|
|
{% if filtered_audit_log_entries %}
|
|
<div class="readonly">
|
|
<div class="usa-table-container--scrollable collapse--dgsimple collapsed margin-top-0" tabindex="0">
|
|
<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>
|
|
</div>
|
|
<button type="button" class="collapse-toggle--dgsimple usa-button usa-button--unstyled margin-top-0">
|
|
<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>
|
|
{% else %}
|
|
<div class="readonly">
|
|
No changelog to display.
|
|
</div>
|
|
{% endif %}
|
|
{% elif field.field.name == "portfolio_senior_official" %}
|
|
<div class="readonly">
|
|
{% if original_object.portfolio.senior_official %}
|
|
<a href="{% url 'admin:registrar_seniorofficial_change' original_object.portfolio.senior_official.id %}">{{ field.contents }}</a>
|
|
{% else %}
|
|
No senior official found.<br>
|
|
{% endif %}
|
|
</div>
|
|
{% elif 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" id="id_requested_domain" 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:", " %}
|
|
{% if total_websites|length == 1 %}
|
|
<p class="margin-y-0 padding-y-0">
|
|
<a href="{{ total_websites.0 }}" target="_blank">
|
|
{{ total_websites.0 }}
|
|
</a>
|
|
</p>
|
|
{% elif total_websites|length > 1 %}
|
|
<ul class="margin-top-0 margin-left-0 padding-left-0{% if total_websites|length > 5 %} admin-list-inline{% endif %}">
|
|
{% for website in total_websites %}
|
|
{% comment %}White space matters: do NOT reformat the following line{% endcomment %}
|
|
<li><a href="{{ website }}" target="_blank">{{ website }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</div>
|
|
{% elif field.field.name == "alternative_domains" %}
|
|
<div class="readonly">
|
|
{% with current_path=request.get_full_path %}
|
|
{% if original_object.alternative_domains.all|length == 1 %}
|
|
<p class="margin-y-0 padding-y-0">
|
|
<a href="{% url 'admin:registrar_website_change' original_object.alternative_domains.all.0.id %}?{{ 'return_path='|add:current_path }}" target="_blank">{{ original_object.alternative_domains.all.0 }}</a>
|
|
</p>
|
|
{% elif original_object.alternative_domains.all|length > 1 %}
|
|
<ul class="margin-top-0 margin-left-0 padding-left-0 admin-list-inline">
|
|
{% for alt_domain in original_object.alternative_domains.all %}
|
|
{% comment %}White space matters: do NOT reformat the following line{% endcomment %}
|
|
<li><a href="{% url 'admin:registrar_website_change' alt_domain.id %}?{{ 'return_path='|add:current_path }}" target="_blank">{{alt_domain}}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</div>
|
|
{% elif field.field.name == "domain_managers" or field.field.name == "invited_domain_managers" %}
|
|
<div class="readonly">{{ field.contents|safe }}</div>
|
|
{% elif field.field.name == "display_members" %}
|
|
<div class="readonly">
|
|
{% if display_members_summary %}
|
|
{{ display_members_summary }}
|
|
{% else %}
|
|
<p>No additional members found.</p>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="readonly">{{ field.contents }}</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% endblock field_readonly %}
|
|
|
|
{% block field_other %}
|
|
{% if field.field.name == "action_needed_reason_email" %}
|
|
{{ field.field }}
|
|
|
|
<div class="margin-top-05 text-faded custom-email-placeholder">
|
|
–
|
|
</div>
|
|
|
|
<button
|
|
aria-label="Edit email in textarea"
|
|
type="button"
|
|
class="usa-button usa-button--unstyled usa-button--dja-link-color usa-button__small-text margin-left-1 text-no-underline flex-align-self-start edit-email-button"
|
|
><img src="/public/admin/img/icon-changelink.svg" alt="Change"> Edit email</button
|
|
>
|
|
<a
|
|
href="#action-needed-email-already-sent-modal"
|
|
class="usa-button usa-button--unstyled usa-button--dja-link-color usa-button__small-text text-no-underline margin-left-1 edit-button-modal-trigger flex-align-self-start"
|
|
aria-controls="action-needed-email-already-sent-modal"
|
|
data-open-modal
|
|
><img src="/public/admin/img/icon-changelink.svg" alt="Change"> Edit email</a
|
|
>
|
|
<div
|
|
class="usa-modal"
|
|
id="action-needed-email-already-sent-modal"
|
|
aria-labelledby="Are you sure you want to edit this email?"
|
|
aria-describedby="The creator of this request already received an email"
|
|
>
|
|
<div class="usa-modal__content">
|
|
<div class="usa-modal__main">
|
|
<h2 class="usa-modal__heading">
|
|
Are you sure you want to edit this email?
|
|
</h2>
|
|
<div class="usa-prose">
|
|
<p>
|
|
The creator of this request already received an email for this status/reason:
|
|
</p>
|
|
<ul>
|
|
<li class="font-body-sm">Status: <b>Action needed</b></li>
|
|
<li class="font-body-sm">Reason: <b>{{ original_object.get_action_needed_reason_display }}</b></li>
|
|
</ul>
|
|
<p>
|
|
If you edit this email's text, <b>the system will send another email</b> to
|
|
the creator after you “save” your changes. If you do not want to send another email, click “cancel” below.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="usa-modal__footer">
|
|
<ul class="usa-button-group">
|
|
<li class="usa-button-group__item">
|
|
<button
|
|
type="submit"
|
|
id="action-needed-reason__confirm-edit-email"
|
|
class="usa-button"
|
|
data-close-modal
|
|
>
|
|
Yes, continue editing
|
|
</button>
|
|
</li>
|
|
<li class="usa-button-group__item">
|
|
<button
|
|
type="button"
|
|
class="usa-button usa-button--unstyled padding-105 text-center"
|
|
name="_cancel_edit_email"
|
|
data-close-modal
|
|
>
|
|
Cancel
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="usa-button usa-modal__close"
|
|
aria-label="Close this window"
|
|
data-close-modal
|
|
>
|
|
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img">
|
|
<use xlink:href="{%static 'img/sprite.svg'%}#close"></use>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
{% if original_object.action_needed_reason_email %}
|
|
<input id="last-sent-action-needed-email-content" class="display-none" value="{{original_object.action_needed_reason_email}}">
|
|
{% else %}
|
|
<input id="last-sent-action-needed-email-content" class="display-none" value="None">
|
|
{% endif %}
|
|
|
|
{% elif field.field.name == "rejection_reason_email" %}
|
|
{{ field.field }}
|
|
|
|
<div class="margin-top-05 text-faded custom-email-placeholder">
|
|
–
|
|
</div>
|
|
|
|
<button
|
|
aria-label="Edit email in textarea"
|
|
type="button"
|
|
class="usa-button usa-button--unstyled usa-button--dja-link-color usa-button__small-text margin-left-1 text-no-underline flex-align-self-start edit-email-button"
|
|
><img src="/public/admin/img/icon-changelink.svg" alt="Change"> Edit email</button
|
|
>
|
|
<a
|
|
href="#rejection-reason-email-already-sent-modal"
|
|
class="usa-button usa-button--unstyled usa-button--dja-link-color usa-button__small-text text-no-underline margin-left-1 edit-button-modal-trigger flex-align-self-start"
|
|
aria-controls="rejection-reason-email-already-sent-modal"
|
|
data-open-modal
|
|
><img src="/public/admin/img/icon-changelink.svg" alt="Change"> Edit email</a
|
|
>
|
|
<div
|
|
class="usa-modal"
|
|
id="rejection-reason-email-already-sent-modal"
|
|
aria-labelledby="Are you sure you want to edit this email?"
|
|
aria-describedby="The creator of this request already received an email"
|
|
>
|
|
<div class="usa-modal__content">
|
|
<div class="usa-modal__main">
|
|
<h2 class="usa-modal__heading">
|
|
Are you sure you want to edit this email?
|
|
</h2>
|
|
<div class="usa-prose">
|
|
<p>
|
|
The creator of this request already received an email for this status/reason:
|
|
</p>
|
|
<ul>
|
|
<li class="font-body-sm">Status: <b>Rejected</b></li>
|
|
<li class="font-body-sm">Reason: <b>{{ original_object.get_rejection_reason_display }}</b></li>
|
|
</ul>
|
|
<p>
|
|
If you edit this email's text, <b>the system will send another email</b> to
|
|
the creator after you “save” your changes. If you do not want to send another email, click “cancel” below.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="usa-modal__footer">
|
|
<ul class="usa-button-group">
|
|
<li class="usa-button-group__item">
|
|
<button
|
|
type="submit"
|
|
id="rejection-reason__confirm-edit-email"
|
|
class="usa-button"
|
|
data-close-modal
|
|
>
|
|
Yes, continue editing
|
|
</button>
|
|
</li>
|
|
<li class="usa-button-group__item">
|
|
<button
|
|
type="button"
|
|
class="usa-button usa-button--unstyled padding-105 text-center"
|
|
name="_cancel_edit_email"
|
|
data-close-modal
|
|
>
|
|
Cancel
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="usa-button usa-modal__close"
|
|
aria-label="Close this window"
|
|
data-close-modal
|
|
>
|
|
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img">
|
|
<use xlink:href="{%static 'img/sprite.svg'%}#close"></use>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
{% if original_object.rejection_reason_email %}
|
|
<input id="last-sent-rejection-email-content" class="display-none" value="{{original_object.rejection_reason_email}}">
|
|
{% else %}
|
|
<input id="last-sent-rejection-email-content" class="display-none" value="None">
|
|
{% endif %}
|
|
{% elif field.field.name == "requested_suborganization" %}
|
|
{{ field.field }}
|
|
<div class="requested-suborganization--clear-button">
|
|
<button
|
|
id="clear-requested-suborganization"
|
|
class="usa-button--dja usa-button usa-button__small-text usa-button--unstyled"
|
|
type="button"
|
|
>
|
|
<svg
|
|
class="usa-icon"
|
|
>
|
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#close"></use>
|
|
</svg>
|
|
Clear requested suborganization
|
|
</button>
|
|
</div>
|
|
{% else %}
|
|
{{ field.field }}
|
|
{% endif %}
|
|
{% endblock field_other %}
|
|
|
|
{% block after_help_text %}
|
|
{% if 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>
|
|
{% if not skip_additional_contact_info %}
|
|
{% include "django/admin/includes/user_detail_list.html" with user=original_object.creator no_title_top_padding=field.is_readonly %}
|
|
{% endif%}
|
|
{% 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 == "portfolio_senior_official" %}
|
|
<div class="flex-container">
|
|
<label aria-label="Senior official contact details"></label>
|
|
{% comment %}fields_always_present=True will shortcut the contact_detail_list template when
|
|
1. Senior official field should be hidden on domain request because no portfoloio is selected, which is desirable
|
|
2. A portfolio is selected but there is no senior official on the portfolio, where the shortcut is not desirable
|
|
To solve 2, we use an else No additional contact information found on field.field.name == "portfolio_senior_official"
|
|
and we hide the placeholders from detail_table_fieldset in JS{% endcomment %}
|
|
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.portfolio.senior_official no_title_top_padding=field.is_readonly fields_always_present=True %}
|
|
</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>
|
|
<th>Action</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">
|
|
{% if contact.email %}
|
|
<input aria-hidden="true" class="display-none" value="{{ contact.email }}" />
|
|
<button
|
|
class="
|
|
usa-button--dja
|
|
usa-button
|
|
usa-button__small-text
|
|
usa-button--unstyled
|
|
padding-right-1
|
|
padding-top-0
|
|
padding-bottom-0
|
|
usa-button--icon
|
|
copy-to-clipboard
|
|
text-no-underline"
|
|
type="button"
|
|
>
|
|
<svg
|
|
class="usa-icon"
|
|
>
|
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
|
</svg>
|
|
<!-- the span is targeted in JS, do not remove -->
|
|
<span>Copy email</span>
|
|
</button>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% elif field.field.name == "state_territory" and original_object|model_name_lowercase != 'portfolio' %}
|
|
<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 %}
|