<div class="attributes flexrow">
    {{#each attributes as |attribute id|}}
        <div class="attribute stat flex1 flex-group-center {{key}}">
            <label class="stat-label"><a class="rollable" data-roll-type="attribute" data-roll="2d6+@attributes.{{key}}.value" data-adv="0" data-key="{{key}}">{{localize label}}</a></label>
            {{#if attribute.numModifier}}
            <label class="stat-value rounded">{{attribute.numModifier}}</label>
            {{/if}}
            {{#if (count attribute.diceModifier)}}
            <label class="stat-value rounded">{{attribute.diceModifier}}</label>
            {{/if}}
            <br/>
            
            <input class="stat-value rounded" type="text" name="system.attributes.{{key}}.value" value="{{numberFormat value decimals=0 sign=true}}" data-dtype="Number"/>
            <br/>

            <span  class="stat-roll rollable"  title="2d6" data-roll-type="attribute" data-roll="2d6+@attributes.{{key}}.value" data-adv="0" data-key="{{key}}">
              <i class="darkgreen fas fa-dice"></i>
            </span>
            <span class="tooltip-container">
              <span  class="stat-roll rollable" title="XP" data-roll-type="attributexp"  data-key="{{key}}">
                <i class="xp-next fas fa-arrow-up"></i></span>
              <span class="tooltiptext">
                {{#if (eq value -1)}}
                2 XP
                {{else}}
                {{add value (add value 1)}} XP 
                {{/if}}
                </span>
            </span>
        </div>
    {{/each}}
</div>
<hr/>
<div class="aptitudes flexrow">
    {{#each aptitudes as |aptitude id|}}
        <div class="aptitude stat flex1 flex-group-center">
            <label class="stat-label"><a class="rollable" data-roll-type="aptitude" data-roll="2d6+@aptitudes.{{key}}.value" data-adv="0" data-key="{{key}}">{{localize label}}</a></label>
            {{#if aptitude.numModifier}}
            <label class="stat-value rounded">{{aptitude.numModifier}}</label>
            {{/if}}
            {{#if (count aptitude.diceModifier)}}
            <label class="stat-value rounded">{{aptitude.diceModifier}}</label>
            {{/if}}
            <br/>

            <input class="stat-value rounded-border" type="text" name="system.aptitudes.{{key}}.value" value="{{numberFormat value decimals=0 sign=true}}" data-dtype="Number"/><br/>
            
            <span class="stat-roll rollable" title="2d6" data-roll-type="aptitude" data-roll="2d6+@aptitudes.{{key}}.value" data-adv="0" data-key="{{key}}">
              <i class="darkgreen fas fa-dice"></i>
            </span>
            <span class="tooltip-container">
              <span  class="stat-roll rollable" title="XP" data-roll-type="aptitudexp" data-key="{{key}}">
                <i class="xp-next fas fa-arrow-up"></i></span>
              <span class="tooltiptext">
                {{#if (eq value -1)}}
                1 XP
                {{else}}
                {{add value 2}} XP 
                {{/if}}
                </span>
            </span>
        </div>
    {{/each}}
</div>
<hr/>
<div class="resources flexrow">
    {{#each resources as |resource id|}}
      {{#if resource.ismain}}
          <div class="resource stat flex1 flex-group-center">
              <label class="stat-label">{{localize label}}</label><br/>
              <input class="stat-value resources-value" type="text" name="system.resources.{{key}}.value" value="{{numberFormat value decimals=0 sign=false}}" data-dtype="Number"/>
  
              <a class="inc-dec-btns-resource" data-target="{{key}}" data-incr="-1"><i class="fas fa-minus-square"></i></a>&nbsp;
              <a class="inc-dec-btns-resource" data-target="{{key}}" data-incr="1"><i class="fas fa-plus-square"></i></a>&nbsp;

              {{#if (eq @root.charType 'player')}}
                {{#if (exists bonus)}}
                <span class="flexrow"><label class="stat-max bonus-text">Bonus</label><input class="resource-bonus resources-value" type="text" name="system.resources.{{key}}.bonus" value="{{numberFormat bonus decimals=0 sign=false}}" data-dtype="Number"/></span>
                {{else}}
                <span class="flexrow"><label class="stat-max">&nbsp;</label><input class="resource-bonus resources-novalue" type="text" value="" disabled></span>
                {{/if}}
              {{/if}}
              <input class="resources-value" type="text" name="system.resources.{{key}}.max" value="{{numberFormat max decimals=0 sign=false}}" data-dtype="Number"/>
          </div>
      {{/if}}
    {{/each}}
</div>
