Skip to content

Commit

Permalink
Swapped for full table updates & included rejected table
Browse files Browse the repository at this point in the history
  • Loading branch information
wes-otf committed Aug 12, 2024
1 parent 11fd75c commit 5afec10
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,32 @@
<th class="data-block__table-update"></th>
</tr>
</thead>
<tbody>
{% for invoice in object.invoices.not_rejected %}
{% invoice_htmx_triggers invoice as htmx_trig %}
<tr hx-get="{% url 'apply:projects:partial-invoice-status' pk=invoice.project.pk invoice_pk=invoice.pk %}" hx-trigger="{{ htmx_trig }}" from:body">
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Date submitted" %}: </span></td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Invoice number" %}: </span></td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span></td>
<td class="flex flex-wrap justify-center py-4 px-0 gap-2 xl:flex-nowrap"></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No active invoices yet." %}</p>
{% endif %}
<tbody hx-get="{% url 'apply:projects:partial-invoice-status' pk=object.pk %}" hx-trigger="invoicesUpdated from:body">
{% include "application_projects/partials/invoice_status.html" with invoices=object.invoices.not_rejected rejected=False %}
</tbody>
</table>
{% else %}
<p>{% trans "No active invoices yet." %}</p>
{% endif %}

{% if object.invoices.rejected %}
<p class="data-block__rejected">
<a class="data-block__rejected-link js-payment-block-rejected-link" href="#">{% trans "Show rejected" %}</a>
</p>
{% if object.invoices.rejected %}
<p class="data-block__rejected">
<a class="data-block__rejected-link js-payment-block-rejected-link" href="#">{% trans "Show rejected" %}</a>
</p>

<table class="data-block__table is-hidden js-payment-block-rejected-table">
<thead>
<tr>
<th class="data-block__table-date">{% trans "Date submitted" %}</th>
<th class="data-block__table-amount">{% trans "Invoice number" %}</th>
<th class="data-block__table-status">{% trans "Status" %}</th>
<th class="data-block__table-update"></th>
</tr>
</thead>
<tbody>
{% for invoice in object.invoices.rejected %}
{% display_invoice_status_for_user user invoice as invoice_status %}
<tr>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Date submitted" %}: </span>{{ invoice.requested_at.date }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Invoice number" %}: </span>{{ invoice.invoice_number }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span>{{ invoice_status }}</td>
<td class="flex justify-end py-4 px-0">
<a class="data-block__action-icon-link" href="{{ invoice.get_absolute_url }}" >
{% heroicon_mini "eye" size=16 aria_hidden=true class="me-1" %}
{% trans "View" %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
<table class="data-block__table is-hidden js-payment-block-rejected-table">
<thead>
<tr>
<th class="data-block__table-date">{% trans "Date submitted" %}</th>
<th class="data-block__table-amount">{% trans "Invoice No." %}</th>
<th class="data-block__table-status">{% trans "Status" %}</th>
<th class="data-block__table-update"></th>
</tr>
</thead>
<tbody id="rejected-invoice-table" hx-get="{% url 'apply:projects:partial-rejected-invoice-status' pk=object.pk %}" hx-trigger="rejectedInvoicesUpdated from:body">
{% include "application_projects/partials/invoice_status.html" with invoices=object.invoices.rejected rejected=True %}
</tbody>
</table>
{% endif %}
</div>
</div>
Loading

0 comments on commit 5afec10

Please sign in to comment.