|
| 1 | +{% extends "sponsors/manage/_base.html" %} |
| 2 | + |
| 3 | +{% block page_title %}Assets | Sponsor Management{% endblock %} |
| 4 | + |
| 5 | +{% with active_tab="more" %} |
| 6 | + |
| 7 | +{% block manage_breadcrumbs %} |
| 8 | +<div class="manage-crumbs"> |
| 9 | + <a href="{% url 'manage_dashboard' %}">Dashboard</a> |
| 10 | + <span class="sep">/</span> |
| 11 | + <span class="current">Assets</span> |
| 12 | +</div> |
| 13 | +{% endblock %} |
| 14 | + |
| 15 | +{% block manage_content %} |
| 16 | + <!-- Filter bar --> |
| 17 | + <div class="manage-filter-bar" style="padding:12px 20px;"> |
| 18 | + <form method="get" style="display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;"> |
| 19 | + <div class="filter-field"> |
| 20 | + <select name="type" onchange="this.form.submit()"> |
| 21 | + <option value="">All types</option> |
| 22 | + {% for val, label in type_choices %} |
| 23 | + <option value="{{ val }}" {% if val == filter_type %}selected{% endif %}>{{ label }}</option> |
| 24 | + {% endfor %} |
| 25 | + </select> |
| 26 | + </div> |
| 27 | + <div class="filter-field"> |
| 28 | + <select name="related" onchange="this.form.submit()"> |
| 29 | + <option value="">All objects</option> |
| 30 | + {% for val, label in content_type_choices %} |
| 31 | + <option value="{{ val }}" {% if val|slugify == filter_related %}selected{% endif %}>{{ label }}</option> |
| 32 | + {% endfor %} |
| 33 | + </select> |
| 34 | + </div> |
| 35 | + <div class="filter-field"> |
| 36 | + <select name="value" onchange="this.form.submit()"> |
| 37 | + <option value="">Any status</option> |
| 38 | + <option value="with" {% if filter_value == "with" %}selected{% endif %}>Submitted</option> |
| 39 | + <option value="without" {% if filter_value == "without" %}selected{% endif %}>Missing</option> |
| 40 | + </select> |
| 41 | + </div> |
| 42 | + <div class="filter-field"> |
| 43 | + <input type="text" name="search" placeholder="Search internal name..." value="{{ filter_search }}" style="width:180px;"> |
| 44 | + </div> |
| 45 | + <div class="filter-actions"> |
| 46 | + <button type="submit" class="btn btn-sm btn-secondary">Go</button> |
| 47 | + {% if filter_type or filter_related or filter_value or filter_search %} |
| 48 | + <a href="{% url 'manage_assets' %}" class="btn btn-sm btn-secondary">Clear</a> |
| 49 | + {% endif %} |
| 50 | + </div> |
| 51 | + <div style="margin-left:auto;font-size:12px;color:#777;"> |
| 52 | + {{ asset_count }} asset{{ asset_count|pluralize }}{% if asset_count >= 200 %} (first 200){% endif %} |
| 53 | + </div> |
| 54 | + </form> |
| 55 | + </div> |
| 56 | + |
| 57 | + {% if assets %} |
| 58 | + <table class="manage-table"> |
| 59 | + <thead> |
| 60 | + <tr> |
| 61 | + <th>Internal Name</th> |
| 62 | + <th>Type</th> |
| 63 | + <th>Belongs To</th> |
| 64 | + <th>Owner</th> |
| 65 | + <th style="text-align:center;">Status</th> |
| 66 | + <th>Value</th> |
| 67 | + </tr> |
| 68 | + </thead> |
| 69 | + <tbody> |
| 70 | + {% for asset in assets %} |
| 71 | + <tr> |
| 72 | + <td style="font-weight:600;font-size:13px;">{{ asset.internal_name }}</td> |
| 73 | + <td> |
| 74 | + <span class="tag tag-gray" style="font-size:10px;">{{ asset.polymorphic_ctype.name|title }}</span> |
| 75 | + </td> |
| 76 | + <td> |
| 77 | + {% if asset.owner_type == "sponsor" %} |
| 78 | + <span class="tag tag-blue" style="font-size:10px;">Sponsor</span> |
| 79 | + {% else %} |
| 80 | + <span class="tag tag-gold" style="font-size:10px;">Sponsorship</span> |
| 81 | + {% endif %} |
| 82 | + </td> |
| 83 | + <td style="font-size:13px;"> |
| 84 | + {% if asset.resolved_owner %} |
| 85 | + {% if asset.owner_type == "sponsor" %} |
| 86 | + <a href="{% url 'manage_sponsor_edit' asset.resolved_owner.pk %}" style="color:#1a1a2e;text-decoration:none;">{{ asset.resolved_owner.name }}</a> |
| 87 | + {% else %} |
| 88 | + <a href="{% url 'manage_sponsorship_detail' asset.resolved_owner.pk %}" style="color:#1a1a2e;text-decoration:none;"> |
| 89 | + {% if asset.resolved_owner.sponsor %}{{ asset.resolved_owner.sponsor.name }}{% else %}#{{ asset.resolved_owner.pk }}{% endif %} |
| 90 | + {% if asset.resolved_owner.package %}<span style="color:#999;font-size:11px;"> ({{ asset.resolved_owner.package.name }})</span>{% endif %} |
| 91 | + </a> |
| 92 | + {% endif %} |
| 93 | + {% else %} |
| 94 | + <span style="color:#ccc;">—</span> |
| 95 | + {% endif %} |
| 96 | + </td> |
| 97 | + <td style="text-align:center;"> |
| 98 | + {% if asset.has_value %} |
| 99 | + <span class="tag tag-green" style="font-size:10px;">Submitted</span> |
| 100 | + {% else %} |
| 101 | + <span class="tag tag-red" style="font-size:10px;">Missing</span> |
| 102 | + {% endif %} |
| 103 | + </td> |
| 104 | + <td style="font-size:12px;color:#555;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"> |
| 105 | + {% if asset.has_value %} |
| 106 | + {% if asset.is_file %} |
| 107 | + <a href="{{ asset.value.url }}" target="_blank" style="color:#3776ab;text-decoration:none;">{{ asset.value.name|truncatechars:40 }}</a> |
| 108 | + {% else %} |
| 109 | + {{ asset.value|truncatechars:60 }} |
| 110 | + {% endif %} |
| 111 | + {% else %} |
| 112 | + <span style="color:#ccc;">—</span> |
| 113 | + {% endif %} |
| 114 | + </td> |
| 115 | + </tr> |
| 116 | + {% endfor %} |
| 117 | + </tbody> |
| 118 | + </table> |
| 119 | + {% else %} |
| 120 | + <div class="empty-state"> |
| 121 | + <div class="empty-icon">📁</div> |
| 122 | + <p>No assets match your filters.</p> |
| 123 | + </div> |
| 124 | + {% endif %} |
| 125 | +{% endblock %} |
| 126 | + |
| 127 | +{% endwith %} |
0 commit comments