Skip to content

Commit

Permalink
Fix UI, add missing management check
Browse files Browse the repository at this point in the history
  • Loading branch information
GovernmentPlates committed Jun 14, 2024
1 parent da15e3c commit a895e85
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,15 @@

{% macro render_receipts_list(registration, from_management=false) %}
{% set receipts = registration.receipt_files if from_management else registration.published_receipts %}
{% set can_get_document = registration.registration_form.has_templates() %}
{% set can_get_document = from_management and registration.registration_form.has_templates() %}

{% if receipts or can_get_document %}
<div class="regform-done">
<div class="i-box-header">
{% if receipts %}
<div class="i-box-title">
{% trans %}Documents{% endtrans %}
</div>
{% endif %}
<div class="i-box-title">
{% trans %}Documents{% endtrans %}
</div>
{% if can_get_document %}
<div class="i-box-title">
{% trans %}There are no documents yet{% endtrans %}
</div>
<a href="#" class="i-button accept icon-agreement"
data-callback="printReceipts"
data-params="{{ {'registration_id': [registration.id|string],
Expand All @@ -166,51 +162,60 @@
{% endif %}
</div>
<div class="i-box-content">
<table class="registration-info">
{% for receipt in receipts | sort(attribute='file.filename') %}
{% set filename = receipt.file.filename %}
<tr class="{{ 'unpublished-receipt' if not receipt.is_published }}">
<th class="regform-done-caption">{{ receipt.template.type.title if receipt.template.type else '' }}</th>
<td class="regform-done-data">
<a href="{{ url_for('.download_receipt', receipt.locator.filename) if from_management else receipt.registrant_download_url }}">
{{ filename }}
</a>
{% if not receipt.is_published -%}
<span class="unpublished-receipt-warning">({% trans %}not published{% endtrans %})</span>
{% endif %}
</td>
{% if from_management -%}
<td class="actions-column">
<div class="group right entry-action-buttons">
{% if receipt.is_published %}
<a href="#" class="icon-eye-blocked"
title="{% trans %}Unpublish document{% endtrans %}"
data-title="{% trans name=receipt.file.filename %}Unpublish '{{ name }}' to the registrant{% endtrans %}"
data-href="{{ url_for('.unpublish_receipt', receipt) }}"
data-method="POST"
data-update="#receipts-list"
data-confirm="{% trans name=filename %}Are you sure you want to unpublish the document '{{ name }}' to the registrant?{% endtrans %}"></a>
{% else %}
<a href="#" class="icon-eye js-dialog-action"
title="{% trans %}Publish document{% endtrans %}"
data-title="{% trans name=receipt.file.filename %}Publish '{{ name }}' to the registrant{% endtrans %}"
data-href="{{ url_for('.publish_receipt', receipt) }}"
data-update="#receipts-list"
data-ajax-dialog></a>
{% endif %}
<a href="#" class="icon-remove js-delete"
data-title="{% trans name=receipt.file.filename %}Delete the document '{{ name }}'?{% endtrans %}"
title="{% trans %}Delete document{% endtrans %}"
data-confirm="{% trans name=filename %}Are you sure you want to completely delete the document '{{ name }}'?{% endtrans %}"
data-update="#receipts-list"
data-method="DELETE"
data-href="{{ url_for('.delete_receipt', receipt) }}"></a>
</div>
{%- if receipts %}
<table class="registration-info">
{% for receipt in receipts | sort(attribute='file.filename') %}
{% set filename = receipt.file.filename %}
<tr class="{{ 'unpublished-receipt' if not receipt.is_published }}">
<th class="regform-done-caption">{{ receipt.template.type.title if receipt.template.type else '' }}</th>
<td class="regform-done-data">
<a href="{{ url_for('.download_receipt', receipt.locator.filename) if from_management else receipt.registrant_download_url }}">
{{ filename }}
</a>
{% if not receipt.is_published -%}
<span class="unpublished-receipt-warning">({% trans %}not published{% endtrans %})</span>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{% if from_management -%}
<td class="actions-column">
<div class="group right entry-action-buttons">
{% if receipt.is_published %}
<a href="#" class="icon-eye-blocked"
title="{% trans %}Unpublish document{% endtrans %}"
data-title="{% trans name=receipt.file.filename %}Unpublish '{{ name }}' to the registrant{% endtrans %}"
data-href="{{ url_for('.unpublish_receipt', receipt) }}"
data-method="POST"
data-update="#receipts-list"
data-confirm="{% trans name=filename %}Are you sure you want to unpublish the document '{{ name }}' to the registrant?{% endtrans %}"></a>
{% else %}
<a href="#" class="icon-eye js-dialog-action"
title="{% trans %}Publish document{% endtrans %}"
data-title="{% trans name=receipt.file.filename %}Publish '{{ name }}' to the registrant{% endtrans %}"
data-href="{{ url_for('.publish_receipt', receipt) }}"
data-update="#receipts-list"
data-ajax-dialog></a>
{% endif %}
<a href="#" class="icon-remove js-delete"
data-title="{% trans name=receipt.file.filename %}Delete the document '{{ name }}'?{% endtrans %}"
title="{% trans %}Delete document{% endtrans %}"
data-confirm="{% trans name=filename %}Are you sure you want to completely delete the document '{{ name }}'?{% endtrans %}"
data-update="#receipts-list"
data-method="DELETE"
data-href="{{ url_for('.delete_receipt', receipt) }}"></a>
</div>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{%- else -%}
<div class="no-data-message">
<i class="icon-agreement"></i>
<span>
{% trans %}There are no documents yet.{% endtrans %}
</span>
</div>
{%- endif %}
</div>
</div>
{% endif %}
Expand Down
18 changes: 18 additions & 0 deletions indico/web/client/styles/modules/_registrationform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,21 @@
max-width: 100%;
max-height: 450px;
}

.no-data-message {
display: flex;
align-items: center;
flex-direction: column;
gap: 15px;
padding: 10px;

i {
font-size: 3em;
color: $dark-gray;
}

span {
font-size: 1.5em;
color: $dark-gray;
}
}

0 comments on commit a895e85

Please sign in to comment.