mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make a job model for individual jobs
This follows the pattern of what we’ve done with services, users and events. It gives us a better interface to the data we get back from the API than dealing with the raw JSON directly. Now is a good time to do this because we’re going to be making a bunch of changes to the jobs pages, and those changes will be easier to code and understand with a sesnsible model behind them.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<div class="column-half">
|
||||
<div class="keyline-block">
|
||||
{{ big_number(
|
||||
total,
|
||||
message_count_label(total, 'letter', suffix='')|capitalize,
|
||||
job.notification_count,
|
||||
message_count_label(job.notification_count, 'letter', suffix='')|capitalize,
|
||||
smaller=True
|
||||
)}}
|
||||
</div>
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="column-half">
|
||||
<div class="keyline-block">
|
||||
{{ big_number(
|
||||
delivery_estimate|string|format_date_short,
|
||||
job.letter_timings.earliest_delivery|string|format_date_short,
|
||||
'Estimated delivery date',
|
||||
smaller=True
|
||||
)}}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
<div class="ajax-block-container" aria-labelledby='pill-selected-item'>
|
||||
{% if job.job_status == 'scheduled' %}
|
||||
{% if job.scheduled %}
|
||||
|
||||
<p>
|
||||
Sending
|
||||
<a href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=template.id, version=template_version) }}">{{ template.name }}</a>
|
||||
<a href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=job.template.id, version=job.template_version) }}">{{ job.template.name }}</a>
|
||||
{{ job.scheduled_for|format_datetime_relative }}
|
||||
</p>
|
||||
<div class="page-footer">
|
||||
@@ -28,12 +28,12 @@
|
||||
{% if template.template_type == 'letter' %}
|
||||
<div class="keyline-block bottom-gutter-1-2">
|
||||
{% endif %}
|
||||
{% if percentage_complete < 100 and job.job_status != 'finished' %}
|
||||
<p class="{% if template.template_type != 'letter' %}bottom-gutter{% endif %} hint">
|
||||
Report is {{ "{:.0f}%".format(percentage_complete * 0.99) }} complete…
|
||||
{% if job.percentage_complete < 100 and job.job_status != 'finished' %}
|
||||
<p class="{% if job.template.template_type != 'letter' %}bottom-gutter{% endif %} hint">
|
||||
Report is {{ "{:.0f}%".format(job.percentage_complete * 0.99) }} complete…
|
||||
</p>
|
||||
{% elif notifications %}
|
||||
<p class="{% if template.template_type != 'letter' %}bottom-gutter{% endif %}">
|
||||
<p class="{% if job.template.template_type != 'letter' %}bottom-gutter{% endif %}">
|
||||
<a href="{{ download_link }}" download class="heading-small">Download this report</a>
|
||||
 
|
||||
<span id="time-left">{{ time_left }}</span>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{% if job.scheduled_for %}
|
||||
{% if job.processing_started %}
|
||||
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short }}
|
||||
{% if template_type == "letter" %}
|
||||
{% if job.template.template_type == "letter" %}
|
||||
<p id="printing-info">
|
||||
{{ letter_print_day }}
|
||||
</p>
|
||||
@@ -13,7 +13,7 @@
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
||||
{% if template_type == "letter" %}
|
||||
{% if job.template.template_type == "letter" %}
|
||||
<p id="printing-info">
|
||||
{{ letter_print_day }}
|
||||
</p>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block service_page_title %}
|
||||
{{ uploaded_file_name }}
|
||||
{{ job.original_file_name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
{{ uploaded_file_name }}
|
||||
{{ job.original_file_name }}
|
||||
</h1>
|
||||
|
||||
{% if just_sent %}
|
||||
@@ -21,11 +21,11 @@
|
||||
{{ ajax_block(partials, updates_url, 'counts', finished=finished) }}
|
||||
{{ ajax_block(partials, updates_url, 'notifications', finished=finished) }}
|
||||
|
||||
{% if can_cancel_letter_job %}
|
||||
{% if job.letter_job_can_be_cancelled %}
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
<div class="page-footer">
|
||||
<span class="page-footer-delete-link page-footer-delete-link-without-button">
|
||||
<a href="{{ url_for('main.cancel_letter_job', service_id=current_service.id, job_id=job_id) }}">Cancel sending these letters</a>
|
||||
<a href="{{ url_for('main.cancel_letter_job', service_id=current_service.id, job_id=job.id) }}">Cancel sending these letters</a>
|
||||
</span>
|
||||
{% else %}
|
||||
<div> </div>
|
||||
|
||||
Reference in New Issue
Block a user