<section class="flexcol">
    <div class="final-value">{{ dnd5e-numberFormat data.value }} / {{ dnd5e-numberFormat data.effectiveMax }}</div>
    <fieldset class="card">
        <legend>{{ localize "DND5E.HitPointsMax" }}</legend>
        {{#if showCalculation}}
        {{#if showMaxInCalculation}}
        {{ formField fields.max value=source.max localize=true }}
        {{> ".effects" effects=effects.max }}
        {{/if}}
        {{#with fields.bonuses.fields.overall as |field|}}
        {{ formField field value=../source.bonuses.overall localize=true }}
        {{> ".effects" effects=../effects.overall }}
        {{/with}}
        {{#each classes}}
        <div class="form-group">
            <label>{{{ anchor }}}</label>
            <div class="form-fields">
                {{{ dnd5e-numberParts total signDisplay="always" }}}
            </div>
        </div>
        {{/each}}
        {{#if ability}}
        <div class="form-group">
            <label>{{ ability.name }}</label>
            <div class="form-fields">
                {{{ dnd5e-numberParts ability.mod signDisplay="always" }}}
                {{{ @root.levelMultiplier }}}
            </div>
        </div>
        {{/if}}
        {{#with fields.bonuses.fields.level as |field|}}
        <div class="form-group">
            <label>{{ localize field.label }}</label>
            <div class="form-fields">
                <span class="plusSign">+</span>
                {{ formInput field value=../source.bonuses.level }}
                {{{ @root.levelMultiplier }}}
            </div>
        </div>
        {{> ".effects" effects=../effects.bonuses multiplier=@root.levelMultiplier }}
        {{/with}}
        <hr>
        {{/if}}
        {{#unless showMaxInCalculation}}
        {{ formField fields.max value=source.max localize=true }}
        {{> ".effects" effects=effects.max }}
        {{/unless}}
        {{ formField fields.tempmax value=source.tempmax localize=true }}
        {{#if fields.formula}}
        <div class="form-group">
            <label>{{ localize fields.formula.label }}</label>
            <div class="form-fields">
                {{ formInput fields.formula value=source.formula }}
                <button type="button" class="unbutton" data-action="roll" data-tooltip="DND5E.Roll"
                        aria-label="{{ localize 'DND5E.Roll' }}">
                    <i class="fa-solid fa-dice-d20" inert></i>
                </button>
            </div>
        </div>
        {{/if}}
    </fieldset>
    <fieldset class="card">
        <legend>{{ localize "DND5E.HitPointsCurrent" }}</legend>
        {{ formField fields.value value=source.value localize=true }}
        {{ formField fields.temp value=source.temp localize=true }}
    </fieldset>
</section>

{{#*inline ".effects"}}
{{#each effects}}
<div class="form-group">
    <label>{{{ anchor }}}</label>
    <div class="form-fields">
        <span class="plusSign">+</span>
        <span class="integer">{{ value }}</span>
        {{{ ../multiplier }}}
    </div>
</div>
{{/each}}
{{/inline}}
