11{% load i18n project_tags heroicons %}
2+ {% load can from permission_tags %}
23
3- {% user_can_update_project_reports object user as can_update_project_reports %}
4- {% if can_update_project_reports %}
5- < section class ="docs-block wrapper--outer-space-large ">
6- < div class ="docs-block__header ">
7- < h2 class ="m-0 text-lg font-semibold ">
8- {% trans "Reports" %}
9- </ h2 >
4+ {% can "update_project_report" object as can_update_project_reports %}
105
11- {% user_can_update_report_config object user as can_update_report_config %}
12- {% if can_update_report_config %}
13- < p class ="m-0 text-fg-muted ">
14-
15- {{ object.report_config.get_frequency_display }} ·
6+ < section class =" docs-block wrapper--outer-space-large " >
7+ < header class =" docs-block__header " >
8+ < h2 class ="m-0 text-lg font-semibold ">
9+ {% trans "Reports" %}
10+ </ h2 >
1611
17- < a
18- class ="font-semibold "
19- href ="{% url 'apply:projects:report_frequency_update' pk=object.submission.id %} "
20- hx-get ="{% url 'apply:projects:report_frequency_update' pk=object.submission.id %} "
21- hx-target ="#htmx-modal "
22- >
23- {% if object.report_config.disable_reporting %}
24- {% trans "Enable" %}
25- {% else %}
26- {% trans "Update" %}
27- {% endif %}
28- </ a >
29- </ p >
30- {% endif %}
31- </ div >
12+ {% user_can_update_report_config object user as can_update_report_config %}
13+ {% if can_update_report_config %}
14+ < p class ="m-0 text-fg-muted ">
15+ {{ object.report_config.get_frequency_display }} ·
16+ < a
17+ class ="font-semibold "
18+ href ="{% url 'apply:projects:report_frequency_update' pk=object.submission.id %} "
19+ hx-get ="{% url 'apply:projects:report_frequency_update' pk=object.submission.id %} "
20+ hx-target ="#htmx-modal "
21+ >
22+ {% if object.report_config.disable_reporting %}
23+ {% trans "ENABLE" %}
24+ {% else %}
25+ {% trans "Update" %}
26+ {% endif %}
27+ </ a >
28+ </ p >
29+ {% endif %}
30+ </ header >
3231
33- < div class ="docs-block__inner ">
32+ < div class ="p-4 ">
33+ {% if can_update_project_reports %}
3434 < ul class ="data-block__list ">
3535 {% for report in object.report_config.past_due_reports %}
3636 {% include "reports/includes/report_line.html" with report=report %}
@@ -41,67 +41,65 @@ <h2 class="m-0 text-lg font-semibold">
4141 {% endif %}
4242 {% endwith %}
4343 </ ul >
44- </ div >
45- </ section >
46- {% endif %}
44+ {% endif %}
4745
48- < section class ="docs-block wrapper--outer-space-large ">
49- < h2 class ="m-0 text-lg font-semibold docs-block__header ">
50- {% trans "Past reports" %}
51- </ h2 >
52- < div class ="docs-block__inner ">
53- < table class ="data-block__table js-past-reports-table ">
54- < thead >
55- < tr >
56- < th class ="data-block__table-date "> {% trans "Period End" %}</ th >
57- < th class ="data-block__table-date "> {% trans "Submitted" %}</ th >
58- < th class ="data-block__table-update "> </ th >
59- </ tr >
60- </ thead >
61- < tbody >
62- {% for report in object.reports.done %}
63- < tr {% if forloop.counter > 8 %}class="hidden"{% endif %}>
64- < td class ="py-4 px-2.5 ">
65- < span class ="data-block__mobile-label "> {% trans "Period End" %}: </ span > {{ report.end_date }}
66- </ td >
67- < td class ="py-4 px-2.5 ">
68- < span class ="data-block__mobile-label "> {% trans "Submitted" %}: </ span > {{ report.submitted_date|default:"Skipped" }}
69- </ td >
70- < td class ="flex gap-2 py-4 px-2.5 md:justify-end ">
71- {% if not report.skipped %}
72- {% user_can_view_report report user as can_view_report %}
73- {% if can_view_report %}
74- < a class ="data-block__action-icon-link " href ="{% url "apply:projects:reports:detail " pk=report.pk %} ">
75- {% heroicon_micro "eye" class="inline w-4 h-4 me-1" aria_hidden=true %}
76- {% trans "View" %}
77- </ a >
78- {% endif %}
7946
80- {% user_can_update_report report user as can_update_report %}
81- {% if can_update_report %}
82- < a class ="data-block__action-icon-link " href ="{% url "apply:projects:reports:edit " pk=report.pk %} ">
83- {% heroicon_micro "pencil-square" class="inline me-1" aria_hidden=true %}
84- {% trans "Edit" %}
85- </ a >
86- {% endif %}
87- {% else %}
88- {% if can_update_project_reports %}
89- < button type ="button " class ="btn data-block__action-link " hx-post ="{% url "apply:projects:reports:skip " pk=report.pk %} "> {% trans "Unskip" %}</ button >
90- {% endif %}
91- {% endif %}
92- </ td >
93- </ tr >
94- {% empty %}
47+ {% if object.reports.done %}
48+ < table class ="data-block__table js-past-reports-table ">
49+ < thead >
9550 < tr >
96- < td colspan ="3 "> {% trans "No reports submitted" %}</ td >
51+ < th class ="data-block__table-date "> {% trans "Period End" %}</ th >
52+ < th class ="data-block__table-date "> {% trans "Submitted" %}</ th >
53+ < th class ="data-block__table-update "> </ th >
9754 </ tr >
98- {% endfor %}
99- </ tbody >
100- </ table >
101- {% if object.reports.done.count > 4 %}
102- < p class ="text-center ">
103- < a class ="font-semibold js-data-block-pagination " href ="# "> {% trans "Show more" %}</ a >
104- </ p >
55+ </ thead >
56+ < tbody >
57+ {% for report in object.reports.done %}
58+ < tr {% if forloop.counter > 8 %}class="hidden"{% endif %}>
59+ < td class ="py-4 px-2.5 ">
60+ < span class ="data-block__mobile-label "> {% trans "Period End" %}: </ span > {{ report.end_date }}
61+ </ td >
62+ < td class ="py-4 px-2.5 ">
63+ < span class ="data-block__mobile-label "> {% trans "Submitted" %}: </ span > {{ report.submitted_date|default:"Skipped" }}
64+ </ td >
65+ < td class ="flex gap-2 py-4 px-2.5 md:justify-end ">
66+ {% if not report.skipped %}
67+ {% user_can_view_report report user as can_view_report %}
68+ {% if can_view_report %}
69+ < a class ="data-block__action-icon-link " href ="{% url "apply:projects:reports:detail " pk=report.pk %} ">
70+ {% heroicon_micro "eye" class="inline w-4 h-4 me-1" aria_hidden=true %}
71+ {% trans "View" %}
72+ </ a >
73+ {% endif %}
74+
75+ {% user_can_update_report report user as can_update_report %}
76+ {% if can_update_report %}
77+ < a class ="data-block__action-icon-link " href ="{% url "apply:projects:reports:edit " pk=report.pk %} ">
78+ {% heroicon_micro "pencil-square" class="inline me-1" aria_hidden=true %}
79+ {% if report.draft %}
80+ {% trans "Continue editing" %}
81+ {% else %}
82+ {% trans "Edit" %}
83+ {% endif %}
84+ </ a >
85+ {% endif %}
86+ {% else %}
87+ {% if can_update_project_reports %}
88+ < button type ="button " class ="btn data-block__action-link " hx-post ="{% url "apply:projects:reports:skip " pk=report.pk %} "> {% trans "Unskip" %}</ button >
89+ {% endif %}
90+ {% endif %}
91+ </ td >
92+ </ tr >
93+ {% endfor %}
94+ </ tbody >
95+ </ table >
96+ {% if object.reports.done.count > 4 %}
97+ < p class ="text-center ">
98+ < a class ="font-semibold js-data-block-pagination " href ="# "> {% trans "Show more" %}</ a >
99+ </ p >
100+ {% endif %}
101+ {% else %}
102+ < p > {% trans "No reports submitted yet." %}</ p >
105103 {% endif %}
106104 </ div >
107105</ section >
0 commit comments