Omit currency section if all are disabled

This commit is contained in:
Carlos Fernandez 2025-12-07 19:35:38 -05:00
parent b31ab36029
commit a4899f6598
3 changed files with 24 additions and 40 deletions

View file

@ -89,6 +89,7 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
value: context.source.system.gold[key] value: context.source.system.gold[key]
}; };
} }
context.inventory.hasCurrency = Object.values(context.inventory.currencies).some((c) => c.enabled);
} }
return context; return context;

View file

@ -12,6 +12,7 @@
</a> </a>
</div> </div>
{{#if this.inventory.hasCurrency}}
<div class="currency-section"> <div class="currency-section">
{{#each this.inventory.currencies as | currency |}} {{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}} {{#if currency.enabled}}
@ -22,6 +23,7 @@
{{/if}} {{/if}}
{{/each}} {{/each}}
</div> </div>
{{/if}}
<div class="items-section"> <div class="items-section">
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'

View file

@ -15,6 +15,7 @@
</a> </a>
</div> </div>
{{#if inventory.hasCurrency}}
<div class="currency-section"> <div class="currency-section">
{{#each this.inventory.currencies as | currency |}} {{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}} {{#if currency.enabled}}
@ -24,28 +25,8 @@
</div> </div>
{{/if}} {{/if}}
{{/each}} {{/each}}
{{!-- <div class="input">
<span>{{localize this.inventory.currency.coins}}</span>
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
localize=true toggled=true}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.handfuls}}</span>
{{formInput systemFields.gold.fields.handfuls value=source.system.gold.handfuls
enriched=source.system.gold.handfuls localize=true toggled=true}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.bags}}</span>
{{formInput systemFields.gold.fields.bags value=source.system.gold.bags enriched=source.system.gold.bags
localize=true toggled=true}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.chests}}</span>
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests
enriched=source.system.gold.chests localize=true toggled=true}}
</div> --}}
</div> </div>
{{/if}}
<div class="items-section"> <div class="items-section">
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'