Skip to content

Commit 7ca3d31

Browse files
committed
show unssponsored
1 parent 40fd5f8 commit 7ca3d31

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

apps/sponsors/manage/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ def get_context_data(self, **kwargs):
155155
or 0
156156
)
157157

158+
# Sponsors without a sponsorship for this year
159+
sponsors_with_sponsorship_ids = year_sponsorships.values_list("sponsor_id", flat=True) if selected_year else []
160+
unsponsored = (
161+
Sponsor.objects.exclude(pk__in=sponsors_with_sponsorship_ids).order_by("name")[:20] if selected_year else []
162+
)
163+
158164
context.update(
159165
{
160166
"years": years,
@@ -173,6 +179,7 @@ def get_context_data(self, **kwargs):
173179
"total_revenue": total_revenue,
174180
"needs_review": needs_review,
175181
"pending_contracts": pending_contracts,
182+
"unsponsored": unsponsored,
176183
}
177184
)
178185
return context

apps/sponsors/templates/sponsors/manage/dashboard.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,38 @@ <h2 style="color:#b8860b;">Pending Contracts <span class="badge" style="backgrou
130130
</div>
131131
{% endif %}
132132

133+
<!-- Sponsors without sponsorship this year -->
134+
{% if unsponsored %}
135+
<div class="manage-section">
136+
<div class="manage-section-header collapse-toggle" onclick="this.parentElement.classList.toggle('collapsed')" style="cursor:pointer;user-select:none;">
137+
<h2>
138+
<span class="collapse-arrow">&#9662;</span>
139+
No Sponsorship for {{ selected_year }} <span class="badge" style="background:#999;">{{ unsponsored|length }}</span>
140+
</h2>
141+
</div>
142+
<div class="collapse-body">
143+
<table class="manage-table">
144+
<thead>
145+
<tr>
146+
<th>Sponsor</th>
147+
<th>Location</th>
148+
<th style="width:120px;"></th>
149+
</tr>
150+
</thead>
151+
<tbody>
152+
{% for s in unsponsored %}
153+
<tr>
154+
<td><a href="{% url 'manage_sponsor_edit' s.pk %}" style="font-weight:600;color:#1a1a2e;text-decoration:none;">{{ s.name }}</a></td>
155+
<td style="font-size:12px;color:#777;">{% if s.city %}{{ s.city }}{% endif %}{% if s.country %}, {{ s.country }}{% endif %}</td>
156+
<td style="text-align:right;"><a href="{% url 'manage_composer' %}?new=1&sponsor_id={{ s.pk }}" style="font-size:12px;color:#3776ab;text-decoration:none;font-weight:500;">+ Sponsorship</a></td>
157+
</tr>
158+
{% endfor %}
159+
</tbody>
160+
</table>
161+
</div>
162+
</div>
163+
{% endif %}
164+
133165
<!-- Config overview cards -->
134166
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:28px;">
135167
<div class="sp-card" style="background:#fff;border:1px solid #e8e8e8;border-radius:6px;padding:16px 20px;">

0 commit comments

Comments
 (0)