| 1 |
{%- import "partials/_ui.html" as ui -%} |
| 2 |
{% if reports.is_empty() %} |
| 3 |
{% call ui::empty_state("", "No reports found.") %} |
| 4 |
{% else %} |
| 5 |
<table class="admin-report-table"> |
| 6 |
<thead> |
| 7 |
<tr> |
| 8 |
<th>Reporter</th> |
| 9 |
<th>Type</th> |
| 10 |
<th>Target</th> |
| 11 |
<th>Owner</th> |
| 12 |
<th>Reason</th> |
| 13 |
<th>Date</th> |
| 14 |
<th>Status</th> |
| 15 |
<th>Actions</th> |
| 16 |
</tr> |
| 17 |
</thead> |
| 18 |
<tbody> |
| 19 |
{% for report in reports %} |
| 20 |
<tr> |
| 21 |
<td>{{ report.reporter_username }}</td> |
| 22 |
<td>{{ report.report_type }}</td> |
| 23 |
<td> |
| 24 |
{% if report.target_type == "project" %} |
| 25 |
<a href="/p/{{ report.target_slug_or_id }}">{{ report.target_title }}</a> |
| 26 |
{% else %} |
| 27 |
<a href="/i/{{ report.target_slug_or_id }}">{{ report.target_title }}</a> |
| 28 |
{% endif %} |
| 29 |
<span class="admin-report-target-type">({{ report.target_type }})</span> |
| 30 |
</td> |
| 31 |
<td>{{ report.target_owner }}</td> |
| 32 |
<td class="admin-report-reason" title="{{ report.reason }}">{{ report.reason }}</td> |
| 33 |
<td class="admin-report-date">{{ report.created_at }}</td> |
| 34 |
<td> |
| 35 |
{% if report.status == "open" %} |
| 36 |
<span class="admin-report-status-open">open</span> |
| 37 |
{% else if report.status == "resolved" %} |
| 38 |
<span class="admin-report-status-closed">resolved</span> |
| 39 |
{% else %} |
| 40 |
<span class="admin-report-status-closed">dismissed</span> |
| 41 |
{% endif %} |
| 42 |
</td> |
| 43 |
<td> |
| 44 |
{% if report.status == "open" %} |
| 45 |
<form class="admin-report-resolve-form" |
| 46 |
hx-post="/api/admin/reports/{{ report.id }}/resolve" |
| 47 |
hx-target="#reports-table" |
| 48 |
hx-swap="innerHTML"> |
| 49 |
<input type="hidden" name="decision" value="resolve"> |
| 50 |
<input type="text" name="admin_notes" placeholder="Notes..."> |
| 51 |
<button type="submit" class="btn-primary small">Resolve</button> |
| 52 |
</form> |
| 53 |
<form class="admin-report-dismiss-form" |
| 54 |
hx-post="/api/admin/reports/{{ report.id }}/resolve" |
| 55 |
hx-target="#reports-table" |
| 56 |
hx-swap="innerHTML"> |
| 57 |
<input type="hidden" name="decision" value="dismiss"> |
| 58 |
<input type="hidden" name="admin_notes" value=""> |
| 59 |
<button type="submit" class="btn-secondary small">Dismiss</button> |
| 60 |
</form> |
| 61 |
{% else if report.admin_notes.is_some() %} |
| 62 |
<span class="admin-report-admin-notes" title="{{ report.admin_notes.as_deref().unwrap_or_default() }}">{{ report.admin_notes.as_deref().unwrap_or_default() }}</span> |
| 63 |
{% endif %} |
| 64 |
</td> |
| 65 |
</tr> |
| 66 |
{% endfor %} |
| 67 |
</tbody> |
| 68 |
</table> |
| 69 |
{% endif %} |
| 70 |
|