Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/enhancement/gh-3474-staff-to-lea…
Browse files Browse the repository at this point in the history
…d' into test
  • Loading branch information
frjo committed Jul 26, 2023
2 parents a972d7a + e665ebe commit fb2a100
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<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.vendor_document_number }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span>{{ invoice.get_status_display }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span>{{ invoice.status_display }}</td>
<td class="flex flex-wrap justify-end py-4 px-0">
<a class="data-block__action-icon-link" href="{{ invoice.get_absolute_url }}" target="_blank">
<svg class="icon icon--project-eye"><use xlink:href="#eye"></use></svg>
Expand Down Expand Up @@ -62,7 +62,7 @@
{% get_invoice_form invoice user as invoice_form %}
{% get_invoice_form_id invoice_form invoice as invoice_form_id %}
<h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
<p>{% trans "Current status" %}: {{ invoice.get_status_display }}</p>
<p>{% trans "Current status" %}: {{ invoice.status_display }}</p>
{% trans "Update Status" as update %}
{% include 'funds/includes/delegated_form_base.html' with form=invoice_form value=update action=invoice.get_absolute_url form_id=invoice_form_id %}
</div>
Expand Down Expand Up @@ -96,7 +96,7 @@ <h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
<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.vendor_document_number }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span>{{ invoice.get_status_display }}</td>
<td class="py-4 px-2.5"><span class="data-block__mobile-label">{% trans "Status" %}: </span>{{ invoice.status_display }}</td>
<td class="flex justify-end py-4 px-0">
<a class="data-block__action-icon-link" href="{{ invoice.get_absolute_url }}" target="_blank">
<svg class="icon icon--project-eye"><use xlink:href="#eye"></use></svg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% if user_can_change_status %}
<div class="modal" id="change-status">
<h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
<p>{% trans "Current status" %}: {{ object.get_status_display }}</p>
<p>{% trans "Current status" %}: {{ object.status_display }}</p>
{% trans "Update Status" as update %}
{% include 'funds/includes/delegated_form_base.html' with form=change_invoice_status value=update %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h5 class="heading heading--no-margin">{% trans "For" %}: {{ object.project.titl
<div class="wrapper--sidebar--inner">

<div class="card card--solid">
<p class="card__text"><b>{% trans "Status" %}:</b> {{ object.get_status_display }}</p>
<p class="card__text"><b>{% trans "Status" %}:</b> {{ object.status_display }}</p>
{% is_vendor_setup request as show_vendor_information %}
{% if show_vendor_information %}
<p class="card__text"><b>{% trans "Vendor" %}:</b> {{ object.project.vendor.name }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,31 @@ <h5 class="heading heading--no-margin">{% trans "For" %}: {{ object.project.titl
<div class="wrapper wrapper--sidebar wrapper--outer-space-medium">
<div class="wrapper--sidebar--inner">
<div class="card card--solid">
<p class="card__text"><b>{% trans "Status" %}:</b> {{ object.get_status_display }}</p>
<p class="card__text"><b>{% trans "Invoice Number" %}:</b> {{ object.vendor_document_number }}</p>
{% is_vendor_setup request as show_vendor_information %}
{% if show_vendor_information %}
<p class="card__text"><b>{% trans "Vendor" %}:</b> {{ object.project.vendor.name }}</p>
{% endif %}
<p class="card__text"><b>{% trans "Invoice Number" %}:</b> {{ object.vendor_document_number }}</p>
<p class="card__text"><b>{% trans "Lead" %}:</b> {{ object.project.lead }}</p>
<p class="card__text"><b>{% trans "Fund" %}:</b> {{ object.project.submission.page }}</p>
</div>
<div class="card card--solid flex" x-data="{ collapsed: true }">
<div class="flex-none">
<p><b>{% trans "Status" %}: </b></p>
</div>
<div class="flex-1 pl-2">
<p>{{ latest_activity.message|extract_status }} ({{ latest_activity.user }})</p>
{% for activity in activities %}
<p x-show="!collapsed">{{ activity.message|extract_status }} ({{ activity.user }})</p>
{% endfor %}
</div>
<div class="flex-1 text-right" x-on:click="collapsed = ! collapsed" role="button">
<p class="font-bold text-light-blue" x-show="collapsed">{% trans "View status history" %}
<svg class="icon icon--arrow-down top-1" aria-hidden=true><use xlink:href="#arrow-down"></use></svg></p>
<p class="font-bold text-light-blue" x-show="!collapsed">{% trans "Hide status history" %}
<svg class="icon icon--arrow-up top-1" aria-hidden=true><use xlink:href="#arrow-up"></use></svg></p>

</div>
</div>

<div class="card card--solid">
Expand All @@ -41,7 +60,7 @@ <h5 class="card__heading">{% trans "Supporting Documents" %}</h5>
<aside class="sidebar">
{% block deliverables %}
{% endblock %}
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions">
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions sticky top-8">
<h5>{% trans "Actions to take" %}</h5>
{% block actions %}
{% can_edit object user as user_can_edit_request %}
Expand Down
5 changes: 5 additions & 0 deletions hypha/apply/projects/templatetags/invoice_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ def get_invoice_form(invoice, user):
@register.simple_tag
def get_invoice_form_id(form, invoice):
return f'{form.name}-{invoice.id}'


@register.filter
def extract_status(invoice_activity_message):
return invoice_activity_message.replace("Updated Invoice status to: ", "").replace(".", "")
8 changes: 5 additions & 3 deletions hypha/apply/projects/views/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ChangeInvoiceStatusView(DelegatedViewMixin, InvoiceAccessMixin, UpdateView
def form_valid(self, form):
response = super().form_valid(form)
if form.cleaned_data['comment']:
invoice_status_change = _('<p>Invoice status updated to: {status}.</p>').format(status=self.object.status_display)
invoice_status_change = _('<p>Invoice status updated to: {status}.</p>').format(status=self.object.get_status_display())
comment = f'<p>{self.object.comment}.</p>'

message = invoice_status_change + comment
Expand Down Expand Up @@ -139,10 +139,12 @@ def get_context_data(self, **kwargs):
invoice = self.get_object()
project = invoice.project
deliverables = project.deliverables.all()
invoice_activities = Activity.actions.filter(related_content_type__model='invoice', related_object_id=invoice.id)
return super().get_context_data(
**kwargs,
deliverables=deliverables,
activities=Activity.actions.filter(related_content_type__model='invoice', related_object_id=invoice.id),
latest_activity=invoice_activities.first(),
activities=invoice_activities[1:],
)


Expand Down Expand Up @@ -252,7 +254,7 @@ def form_valid(self, form):
self.object.save()

if form.cleaned_data['message_for_pm']:
invoice_status_change = _('<p>Invoice status updated to: {status}.</p>').format(status=self.object.status_display)
invoice_status_change = _('<p>Invoice status updated to: {status}.</p>').format(status=self.object.get_status_display())
message_for_pm = f'<p>{form.cleaned_data["message_for_pm"]}</p>'
message = invoice_status_change + message_for_pm

Expand Down
15 changes: 11 additions & 4 deletions hypha/static_src/src/sass/apply/components/_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,18 @@

&--arrow-up {
position: relative;
top: .1em;
align-self: center;
width: 1.4em;
height: 1.4em;
fill: $color--light-blue;
width: 16px;
height: 17px;
stroke: $color--light-blue;
}

&--arrow-down {
position: relative;
align-self: center;
width: 16px;
height: 17px;
stroke: $color--light-blue;
}

&--arrow-up-short-bar {
Expand Down
12 changes: 10 additions & 2 deletions hypha/templates/includes/sprites.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,18 @@
<path d="M15 8.5L8 1.5L1 8.5" stroke-width="2"/>
</symbol>

<symbol id="arrow-up" viewBox="0 0 15 15">
<path fill-rule="evenodd" d="M8 10a.5.5 0 0 0 .5-.5V3.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 3.707V9.5a.5.5 0 0 0 .5.5zm-7 2.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5z"/>
<symbol id="arrow-up" viewBox="0 0 16 17" fill="none">
<path d="M8 16.5L8 2.5" stroke-width="2"/>
<path d="M15 8L8 2L1 8" stroke-width="2"/>
</symbol>


<symbol id="arrow-down" viewBox="0 0 16 17" fill="none">
<path d="M8 0.5L8 14.5" stroke-width="2"/>
<path d="M1 9L8 15L15 9" stroke-width="2"/>
</symbol>


<svg id="arrow-up-short-bar" viewBox="0 0 16 17" fill="none">
<path d="M8 3L8 13" stroke-width="2"/>
<path d="M3 15H13" stroke-width="2"/>
Expand Down

0 comments on commit fb2a100

Please sign in to comment.