Summary of Fixes

Issue 1: Slot Name Mismatch
  - Equipment modal used armor, accessory but API uses chest, accessory_1
  - Updated to all 8 API slots: weapon, off_hand, helmet, chest, gloves, boots, accessory_1, accessory_2

  Issue 2: HTMX Request Not Firing (the real blocker)
  - onclick=closeModal() was removing the button from DOM before HTMX could send the request
  - Changed to hx-on::after-request=closeModal() so modal closes after the request completes
This commit is contained in:
2025-11-29 18:25:30 -06:00
parent 72cf92021e
commit 06ef8f6f0b
4 changed files with 27 additions and 376 deletions

View File

@@ -12,14 +12,17 @@ Displays character's equipped gear and inventory summary
{# Modal Body #}
<div class="modal-body">
{# Equipment Grid #}
{# Equipment Grid - All 8 slots matching API #}
<div class="equipment-grid">
{% set slots = [
('weapon', 'Weapon'),
('armor', 'Armor'),
('off_hand', 'Off-Hand'),
('helmet', 'Helmet'),
('chest', 'Chest Armor'),
('gloves', 'Gloves'),
('boots', 'Boots'),
('accessory', 'Accessory')
('accessory_1', 'Accessory 1'),
('accessory_2', 'Accessory 2')
] %}
{% for slot_id, slot_name in slots %}
@@ -34,11 +37,15 @@ Displays character's equipped gear and inventory summary
{# Equipped Item #}
<div class="slot-item">
<div class="slot-icon">
{% if item.item_type == 'weapon' %}⚔️
{% elif item.item_type == 'armor' %}🛡
{% elif item.item_type == 'helmet' %}
{% elif item.item_type == 'boots' %}👢
{% elif item.item_type == 'accessory' %}💍
{# Icon based on slot_id since item_type doesn't distinguish armor slots #}
{% if slot_id == 'weapon' %}
{% elif slot_id == 'off_hand' %}🛡
{% elif slot_id == 'helmet' %}⛑️
{% elif slot_id == 'chest' %}🎽
{% elif slot_id == 'gloves' %}🧤
{% elif slot_id == 'boots' %}👢
{% elif slot_id == 'accessory_1' %}💍
{% elif slot_id == 'accessory_2' %}📿
{% else %}📦{% endif %}
</div>
<div class="slot-details">
@@ -63,10 +70,13 @@ Displays character's equipped gear and inventory summary
<div class="slot-empty">
<div class="slot-icon slot-icon--empty">
{% if slot_id == 'weapon' %}⚔️
{% elif slot_id == 'armor' %}🛡️
{% elif slot_id == 'off_hand' %}🛡️
{% elif slot_id == 'helmet' %}⛑️
{% elif slot_id == 'chest' %}🎽
{% elif slot_id == 'gloves' %}🧤
{% elif slot_id == 'boots' %}👢
{% elif slot_id == 'accessory' %}💍
{% elif slot_id == 'accessory_1' %}💍
{% elif slot_id == 'accessory_2' %}📿
{% else %}📦{% endif %}
</div>
<div class="slot-empty-text">Empty</div>

View File

@@ -96,7 +96,7 @@ Partial template loaded via HTMX when an item is selected
hx-vals='{"item_id": "{{ item.item_id }}"{% if suggested_slot %}, "slot": "{{ suggested_slot }}"{% endif %}}'
hx-target="#character-panel"
hx-swap="innerHTML"
onclick="closeModal()">
hx-on::after-request="closeModal()">
Equip
</button>
{% endif %}