Make budget/claim IDs more prominent

This commit is contained in:
Yingtong Li 2019-12-29 00:54:44 +11:00
parent b09b8e2660
commit 984ed2432d
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
16 changed files with 71 additions and 31 deletions

View File

@ -60,7 +60,18 @@
</tr>
<tr>
<td>Budget ID</td>
<td>{{ claim.budget_id }}</td>
<td>
{% if budget and budget.budgetrevision_set.reverse()[0].can_view(request.user) %}
<a href="{{ url('budget_view', kwargs={'id': budget.id}) }}">{{ claim.budget_id }}</a>
{% if budget.budgetrevision_set.reverse()[0].state != import('sstreasury.models').BudgetState.APPROVED.value %}
<span data-tooltip="Budget has not been approved"><i class="orange exclamation circle icon"></i></span>
{% endif %}
{% elif request.user.groups.filter(name='Treasury').exists() %}
{{ claim.budget_id }} <span data-tooltip="Budget does not exist"><i class="red times circle icon"></i></span>
{% else %}
{{ claim.budget_id }}
{% endif %}
</td>
</tr>
<tr>
<td>Comments</td>
@ -117,5 +128,7 @@
}
var editing = false;
makeGrid();
print();
</script>
{% endblock %}

View File

@ -88,7 +88,18 @@
</tr>
<tr>
<td>Budget ID</td>
<td>{{ claim.budget_id }}</td>
<td>
{% if budget and budget.budgetrevision_set.reverse()[0].can_view(request.user) %}
<a href="{{ url('budget_view', kwargs={'id': budget.id}) }}">{{ claim.budget_id }}</a>
{% if budget.budgetrevision_set.reverse()[0].state != import('sstreasury.models').BudgetState.APPROVED.value %}
<span data-tooltip="Budget has not been approved"><i class="orange exclamation circle icon"></i></span>
{% endif %}
{% elif request.user.groups.filter(name='Treasury').exists() %}
{{ claim.budget_id }} <span data-tooltip="Budget does not exist"><i class="red times circle icon"></i></span>
{% else %}
{{ claim.budget_id }}
{% endif %}
</td>
</tr>
<tr>
<td>Comments</td>

View File

@ -1,3 +1,3 @@
Your budget titled *{{ revision.name }}* has been reviewed by the committee and **approved**. The expenditure shown in the budget may now commence.
Your budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been reviewed by the committee and **approved**. The expenditure shown in the budget may now commence.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,4 +1,4 @@
{{ comment.author.first_name }} {{ comment.author.last_name }} made a new comment on the budget *{{ revision.name }}*:
{{ comment.author.first_name }} {{ comment.author.last_name }} made a new comment on the budget *{{ revision.name }}* (BU-{{ revision.budget.id }}):
```
{{ comment.content }}

View File

@ -1,3 +1,3 @@
Your budget titled *{{ revision.name }}* has been reviewed and endorsed by Treasury, and referred to the committee. The committee will determine whether or not to approve the budget at its next meeting.
Your budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been reviewed and endorsed by Treasury, and referred to the committee. The committee will determine whether or not to approve the budget at its next meeting.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
A budget titled *{{ revision.name }}* has been endorsed by Treasury and referred to the committee for consideration at its next meeting.
A budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been endorsed by Treasury and referred to the committee for consideration at its next meeting.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
Your budget titled *{{ revision.name }}* has been reviewed by Treasury and returned to you for re-drafting. You should make any requested changes and resubmit the budget.
Your budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been reviewed by Treasury and returned to you for re-drafting. You should make any requested changes and resubmit the budget.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
Your budget titled *{{ revision.name }}* has been reviewed by the committee and returned to you for re-drafting. You should make any requested changes and resubmit the budget.
Your budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been reviewed by the committee and returned to you for re-drafting. You should make any requested changes and resubmit the budget.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
Your budget titled *{{ revision.name }}* has been submitted for Treasury review.
Your budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been submitted for Treasury review.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
A budget titled *{{ revision.name }}* has been submitted for your review.
A budget titled *{{ revision.name }}* (BU-{{ revision.budget.id }}) has been submitted for your review.
{{ baseurl }}{{ url('budget_view', kwargs={'id': revision.budget.id}) }}

View File

@ -1,3 +1,3 @@
Your reimbursement claim titled *{{ claim.purpose }}* has been reviewed and approved by Treasury, and will be paid in the next pay cycle.
Your reimbursement claim titled *{{ claim.purpose }}* (RE-{{ claim.id }}) has been reviewed and approved by Treasury, and will be paid in the next pay cycle.
{{ baseurl }}{{ url('claim_view', kwargs={'id': claim.id}) }}

View File

@ -1,4 +1,4 @@
{{ comment.author.first_name }} {{ comment.author.last_name }} made a new comment on the reimbursement claim *{{ claim.purpose }}*:
{{ comment.author.first_name }} {{ comment.author.last_name }} made a new comment on the reimbursement claim *{{ claim.purpose }}* (RE-{{ claim.id }}):
```
{{ comment.content }}

View File

@ -1,3 +1,3 @@
Your reimbursement claim titled *{{ claim.purpose }}* has been reviewed by Treasury and returned to you for re-drafting. You should make any requested changes and resubmit the claim.
Your reimbursement claim titled *{{ claim.purpose }}* (RE-{{ claim.id }}) has been reviewed by Treasury and returned to you for re-drafting. You should make any requested changes and resubmit the claim.
{{ baseurl }}{{ url('claim_view', kwargs={'id': claim.id}) }}

View File

@ -1,3 +1,3 @@
Your reimbursement claim titled *{{ claim.purpose }}* has been submitted for Treasury review.
Your reimbursement claim titled *{{ claim.purpose }}* (RE-{{ claim.id }}) has been submitted for Treasury review.
{{ baseurl }}{{ url('claim_view', kwargs={'id': claim.id}) }}

View File

@ -1,3 +1,3 @@
A reimbursement claim titled *{{ claim.purpose }}* has been submitted for your review.
A reimbursement claim titled *{{ claim.purpose }}* (RE-{{ claim.id }}) has been submitted for your review.
{{ baseurl }}{{ url('claim_view', kwargs={'id': claim.id}) }}

View File

@ -276,10 +276,10 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in User.objects.filter(groups__name='Treasury'):
if user != request.user:
emailer.send_mail([user.email], 'New comment on budget: {}'.format(revision.name), 'sstreasury/email/budget_commented.md', {'revision': revision, 'comment': comment})
emailer.send_mail([user.email], 'New comment on budget: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_commented.md', {'revision': revision, 'comment': comment})
for user in revision.contributors.all():
if user != request.user:
emailer.send_mail([user.email], 'New comment on budget: {}'.format(revision.name), 'sstreasury/email/budget_commented.md', {'revision': revision, 'comment': comment})
emailer.send_mail([user.email], 'New comment on budget: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_commented.md', {'revision': revision, 'comment': comment})
if 'Submit' in actions:
if not revision.can_submit(request.user):
@ -290,9 +290,9 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in User.objects.filter(groups__name='Treasury'):
emailer.send_mail([user.email], 'Action required: Budget submitted: {}'.format(revision.name), 'sstreasury/email/budget_submitted_treasurer.md', {'revision': revision})
emailer.send_mail([user.email], 'Action required: Budget submitted: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_submitted_treasurer.md', {'revision': revision})
for user in revision.contributors.all():
emailer.send_mail([user.email], 'Budget submitted: {}'.format(revision.name), 'sstreasury/email/budget_submitted_drafter.md', {'revision': revision})
emailer.send_mail([user.email], 'Budget submitted: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_submitted_drafter.md', {'revision': revision})
if 'Withdraw' in actions:
if not revision.can_withdraw(user):
@ -310,9 +310,9 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in User.objects.filter(groups__name='Secretary'):
emailer.send_mail([user.email], 'Action required: Budget endorsed: {}'.format(revision.name), 'sstreasury/email/budget_endorsed_secretary.md', {'revision': revision})
emailer.send_mail([user.email], 'Action required: Budget endorsed: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_endorsed_secretary.md', {'revision': revision})
for user in revision.contributors.all():
emailer.send_mail([user.email], 'Budget endorsed, awaiting committee approval: {}'.format(revision.name), 'sstreasury/email/budget_endorsed_drafter.md', {'revision': revision})
emailer.send_mail([user.email], 'Budget endorsed, awaiting committee approval: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_endorsed_drafter.md', {'revision': revision})
if 'Return' in actions:
if not revision.can_return(user):
@ -323,7 +323,7 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in revision.contributors.all():
emailer.send_mail([user.email], 'Action required: Budget returned for re-drafting: {}'.format(revision.name), 'sstreasury/email/budget_returned.md', {'revision': revision})
emailer.send_mail([user.email], 'Action required: Budget returned for re-drafting: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_returned.md', {'revision': revision})
if 'Approve' in actions:
if not revision.can_approve(user):
@ -334,7 +334,7 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in revision.contributors.all():
emailer.send_mail([user.email], 'Budget approved: {}'.format(revision.name), 'sstreasury/email/budget_approved.md', {'revision': revision})
emailer.send_mail([user.email], 'Budget approved: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_approved.md', {'revision': revision})
if 'CmteReturn' in actions:
if not revision.can_cmtereturn(user):
@ -345,7 +345,7 @@ def budget_action(request, budget, revision):
emailer = Emailer()
for user in revision.contributors.all():
emailer.send_mail([user.email], 'Action required: Budget returned for re-drafting: {}'.format(revision.name), 'sstreasury/email/budget_returned_committee.md', {'revision': revision})
emailer.send_mail([user.email], 'Action required: Budget returned for re-drafting: {} (BU-{})'.format(revision.name, budget.id), 'sstreasury/email/budget_returned_committee.md', {'revision': revision})
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
@ -422,8 +422,16 @@ def claim_view(request, claim):
history = list(itertools.chain(claim.claimhistory_set.all(), claim.claimcomment_set.all()))
history.sort(key=lambda x: x.time, reverse=True)
budget = None
if claim.budget_id:
try:
budget = models.Budget.objects.get(id=claim.budget_id.split('-')[-1])
except models.Budget.DoesNotExist:
budget = None
return render(request, 'sstreasury/claim_view.html', {
'claim': claim,
'budget': budget,
'history': history
})
@ -431,8 +439,16 @@ def claim_view(request, claim):
@uses_claim
@claim_viewable
def claim_print(request, claim):
budget = None
if claim.budget_id:
try:
budget = models.Budget.objects.get(id=claim.budget_id.split('-')[-1])
except models.Budget.DoesNotExist:
budget = None
return render(request, 'sstreasury/claim_print.html', {
'claim': claim
'claim': claim,
'budget': budget
})
@login_required
@ -482,9 +498,9 @@ def claim_action(request, claim):
emailer = Emailer()
for user in User.objects.filter(groups__name='Treasury'):
if user != request.user:
emailer.send_mail([user.email], 'New comment on reimbursement claim: {}'.format(claim.purpose), 'sstreasury/email/claim_commented.md', {'claim': claim, 'comment': comment})
emailer.send_mail([user.email], 'New comment on reimbursement claim: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_commented.md', {'claim': claim, 'comment': comment})
if comment.author != request.user:
emailer.send_mail([comment.author], 'New comment on reimbursement claim: {}'.format(revision.name), 'sstreasury/email/claim_commented.md', {'claim': claim, 'comment': comment})
emailer.send_mail([comment.author], 'New comment on reimbursement claim: {} (RE-{})'.format(revision.name, claim.id), 'sstreasury/email/claim_commented.md', {'claim': claim, 'comment': comment})
if 'Submit' in actions:
if not claim.can_submit(request.user):
@ -495,8 +511,8 @@ def claim_action(request, claim):
emailer = Emailer()
for user in User.objects.filter(groups__name='Treasury'):
emailer.send_mail([user.email], 'Action required: Reimbursement claim submitted: {}'.format(claim.purpose), 'sstreasury/email/claim_submitted_treasurer.md', {'claim': claim})
emailer.send_mail([claim.author.email], 'Reimbursement claim submitted: {}'.format(claim.purpose), 'sstreasury/email/claim_submitted_drafter.md', {'claim': claim})
emailer.send_mail([user.email], 'Action required: Reimbursement claim submitted: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_submitted_treasurer.md', {'claim': claim})
emailer.send_mail([claim.author.email], 'Reimbursement claim submitted: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_submitted_drafter.md', {'claim': claim})
if 'Withdraw' in actions:
if not claim.can_withdraw(request.user):
@ -513,7 +529,7 @@ def claim_action(request, claim):
claim.update_state(request.user, models.ClaimState.APPROVED)
emailer = Emailer()
emailer.send_mail([claim.author.email], 'Claim approved, awaiting payment: {}'.format(claim.purpose), 'sstreasury/email/claim_approved.md', {'claim': claim})
emailer.send_mail([claim.author.email], 'Claim approved, awaiting payment: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_approved.md', {'claim': claim})
if 'Return' in actions:
if not claim.can_approve(request.user):
@ -523,6 +539,6 @@ def claim_action(request, claim):
claim.update_state(request.user, models.ClaimState.RESUBMIT)
emailer = Emailer()
emailer.send_mail([claim.author.email], 'Action required: Reimbursement claim returned for re-drafting: {}'.format(claim.purpose), 'sstreasury/email/claim_returned.md', {'claim': claim})
emailer.send_mail([claim.author.email], 'Action required: Reimbursement claim returned for re-drafting: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_returned.md', {'claim': claim})
return redirect(reverse('claim_view', kwargs={'id': claim.id}))