Skip to content

Commit f74c682

Browse files
authored
Add internal notes to grants recap (#4533)
1 parent e34c7a8 commit f74c682

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

backend/reviews/admin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ def _review_grants_recap_view(self, request, review_session):
293293
if key.startswith("reimbursementcategory-")
294294
}
295295

296+
notes_updates = {
297+
int(key.split("-")[1]): value
298+
for [key, value] in data.items()
299+
if key.startswith("notes-")
300+
}
301+
296302
grants = list(
297303
review_session.conference.grants.filter(id__in=decisions.keys()).all()
298304
)
@@ -394,6 +400,17 @@ def _review_grants_recap_view(self, request, review_session):
394400
change_message=f"[Review Session] Reimbursement {reimbursement.category.name} added.",
395401
)
396402

403+
# Update internal notes for all grants that have notes changes
404+
if notes_updates:
405+
grants_to_update_notes = review_session.conference.grants.filter(
406+
id__in=notes_updates.keys()
407+
).all()
408+
for grant in grants_to_update_notes:
409+
new_notes = notes_updates.get(grant.id, "")
410+
if grant.internal_notes != new_notes:
411+
grant.internal_notes = new_notes
412+
grant.save(update_fields=["internal_notes"])
413+
397414
messages.success(
398415
request, "Decisions saved. Check the Grants Summary for more info."
399416
)

backend/reviews/templates/grants-recap.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,25 @@
235235
text-decoration: underline;
236236
}
237237

238+
.notes-cell {
239+
position: relative;
240+
min-width: 220px;
241+
}
242+
243+
.notes-textarea {
244+
position: absolute;
245+
top: 8px;
246+
left: 8px;
247+
right: 8px;
248+
bottom: 8px;
249+
width: calc(100% - 16px);
250+
min-height: 80px;
251+
resize: none;
252+
font-size: 12px;
253+
padding: 5px;
254+
box-sizing: border-box;
255+
}
256+
238257
/* Center-align columns */
239258
.results-table th:nth-child(1), /* number column */
240259
.results-table th:nth-child(3), /* score column */
@@ -616,6 +635,12 @@ <h3>
616635
</div>
617636
<div class="clear"></div>
618637
</th>
638+
<th scope="col">
639+
<div class="text">
640+
<span>Notes</span>
641+
</div>
642+
<div class="clear"></div>
643+
</th>
619644
</tr>
620645
</thead>
621646
<tbody>
@@ -816,6 +841,17 @@ <h3>
816841
</ul>
817842
{% else %} No permission to change. {% endif %}
818843
</td>
844+
<td class="notes-cell">
845+
{% if perms.reviews.decision_reviewsession %}
846+
<textarea
847+
name="notes-{{ item.id }}"
848+
class="notes-textarea"
849+
placeholder="Internal notes..."
850+
>{{ item.internal_notes }}</textarea>
851+
{% else %}
852+
{{ item.internal_notes|default:"-" }}
853+
{% endif %}
854+
</td>
819855
</tr>
820856
{% endfor %}
821857
</tbody>

0 commit comments

Comments
 (0)