Files
KittyRec2018-Leak/templates/admin/avatar_items_view.html

103 lines
4.6 KiB
HTML

{% extends 'admin/custom_base.html' %}
{% block body %}
<div class="container-fluid mt-3">
<h4 class="mb-1">Custom Avatar Items</h4>
<p class="text-muted small mb-3">Register new avatar items added to the backend DLL. These are added to the item pool alongside the base game items.</p>
{% if error %}
<div class="alert alert-danger alert-dismissible">{{ error }}<button type="button" class="close" data-dismiss="alert">&times;</button></div>
{% endif %}
{% if success %}
<div class="alert alert-success alert-dismissible">{{ success }}<button type="button" class="close" data-dismiss="alert">&times;</button></div>
{% endif %}
{% if SCOPE_ADMIN in scopes %}
<div class="card mb-4">
<div class="card-header bg-primary text-white"><strong>+ Add New Avatar Item</strong></div>
<div class="card-body">
<form method="POST">
<input type="hidden" name="action_type" value="add">
<div class="form-row align-items-end">
<div class="form-group col-md-4 mb-2">
<label class="small font-weight-bold">Item ID/GUID <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="item_id"
placeholder="e.g. xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or custom-id" required>
<small class="form-text text-muted">Unique identifier matching the DLL.</small>
</div>
<div class="form-group col-md-4 mb-2">
<label class="small font-weight-bold">Friendly Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="friendly_name" placeholder="e.g. Space Helmet" required maxlength="128">
</div>
<div class="form-group col-md-2 mb-2 d-flex align-items-end">
<div class="custom-control custom-switch mb-2">
<input type="checkbox" class="custom-control-input" id="starter-check" name="starter" value="1">
<label class="custom-control-label" for="starter-check">Default / Starter</label>
<small class="form-text text-muted">Unlocked for all new players at level 1.</small>
</div>
</div>
<div class="form-group col-md-2 mb-2">
<button type="submit" class="btn btn-success btn-block">Add Item</button>
</div>
</div>
</form>
</div>
</div>
{% endif %}
<div class="card">
<div class="card-header">
<strong>Registered Custom Items</strong>
<span class="badge badge-secondary ml-1">{{ custom_items|length }}</span>
</div>
<div class="card-body p-0">
<table class="table table-sm table-hover mb-0">
<thead class="thead-dark">
<tr>
<th>Friendly Name</th>
<th>Item ID (AvatarItemDesc)</th>
<th>Default / Starter</th>
{% if SCOPE_ADMIN in scopes %}<th>Actions</th>{% endif %}
</tr>
</thead>
<tbody>
{% if not custom_items %}
<tr><td colspan="4" class="text-center text-muted py-4">No custom items registered yet.</td></tr>
{% else %}
{% for item in custom_items %}
{% set item_guid = item.AvatarItemDesc.split(',')[0] %}
<tr>
<td><strong>{{ item.FriendlyName }}</strong></td>
<td><small class="text-monospace">{{ item.AvatarItemDesc }}</small></td>
<td>
{% if item.get('Starter', false) %}
<span class="badge badge-success">Default</span>
{% else %}
<span class="badge badge-secondary">No</span>
{% endif %}
</td>
{% if SCOPE_ADMIN in scopes %}
<td>
<form method="POST" style="display:inline">
<input type="hidden" name="action_type" value="toggle_starter">
<input type="hidden" name="item_id" value="{{ item_guid }}">
<button type="submit" class="btn btn-xs btn-outline-info">
{% if item.get('Starter', false) %}Remove Default{% else %}Set Default{% endif %}
</button>
</form>
<form method="POST" style="display:inline" onsubmit="return confirm('Delete this item? Players who own it will keep their unlock.')">
<input type="hidden" name="action_type" value="delete">
<input type="hidden" name="item_id" value="{{ item_guid }}">
<button type="submit" class="btn btn-xs btn-outline-danger">Delete</button>
</form>
</td>
{% endif %}
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}