diff --git a/scipost_django/colleges/models/nomination.py b/scipost_django/colleges/models/nomination.py index ae4cbe0bf5fed5c5d59794cf594f317e4f93ffd8..7468a93812b91989163cc6179e26060bb96ee582 100644 --- a/scipost_django/colleges/models/nomination.py +++ b/scipost_django/colleges/models/nomination.py @@ -436,3 +436,14 @@ class FellowshipInvitation(models.Model): @property def declined(self): return self.response == self.RESPONSE_DECLINED + + @property + def get_response_color(self): + if self.response in [self.RESPONSE_ACCEPTED, self.RESPONSE_POSTPONED]: + return "success" + elif self.response in [self.RESPONSE_DECLINED, self.RESPONSE_NOT_YET_INVITED]: + return "danger" + elif self.response in [self.RESPONSE_UNRESPONSIVE]: + return "warning" + else: + return "primary" diff --git a/scipost_django/colleges/templates/colleges/_hx_nomination_li_contents.html b/scipost_django/colleges/templates/colleges/_hx_nomination_li_contents.html index 02abf696eef6dff4103efc5ba8b38797ec40e28f..7a11578aaf220b02bf59a9eb1dc8d85cf6606140 100644 --- a/scipost_django/colleges/templates/colleges/_hx_nomination_li_contents.html +++ b/scipost_django/colleges/templates/colleges/_hx_nomination_li_contents.html @@ -129,12 +129,45 @@ </div> </div> - <details open class="card"> + <details class="card mb-3"> <summary class="card-header list-triangle">Voting Rounds</summary> <div class="card-body"> <div hx-get="{% url 'colleges:_hx_nomination_voting_rounds_tab' nomination_id=nomination.id round_id=nomination.latest_voting_round.id|default:0 %}" hx-trigger="intersect once"></div> </div> </details> + + {% if "edadmin" in user_roles and nomination.decision.outcome == 'elected' %} + <details open class="card"> + <summary class="card-header d-flex flex-row justify-content-between list-triangle"> + <div>Invitation</div> + <div>{{ nomination.invitation.get_response_display }}</div> + </summary> + <div class="card-body"> + <div class="row mb-0"> + <div class="col-auto"> + <div class="mb-4"> + <h3>Invitation status</h3> + <div class="fs-6 badge bg-{{ nomination.invitation.get_response_color }}"> + {{ nomination.invitation.get_response_display }} + </div> + </div> + <div> + <h3>Checklist</h3> + {% include "colleges/_nominations_invitation_checklist.html" with invitation=nomination.invitation %} + </div> + </div> + <div class="col-12 col-md p-2"> + <h4>Update the response to this invitation:</h4> + <div id="invitation-{{ nomination.invitation.id }}-update-response" + hx-get="{% url 'colleges:_hx_fellowship_invitation_update_response' invitation_id=nomination.invitation.id %}" + hx-trigger="intersect once"></div> + </div> + + </div> + </div> + </details> + {% endif %} + </div>