<form id="roll-prompt" class="dialog-v2">
  {{PARTIAL "Tooltip"}}
  {{!-- Item Display --}}
  <div class="item-name">
    <div class="name-wrapper item-tooltip" data-item-id="{{item._id}}">
      <img src="{{item.img}}"/>
      <span>{{item.name}}</span>
    </div>
    <div class="action-outcome">
      {{{action-type item}}}
      {{{roll-requests item}}}
      {{{formula-rolls item}}}
    </div>
  </div>

  {{!-- Enhancements --}}
  <div class="enhancements">
    {{#unless item.system.copyEnhancements.hideFromRollMenu}}
    {{#each enhancements as |enhancement key|}}
    {{#unless enhancement.hide}}
    <div class="enh-row" data-enh-key="{{key}}" data-item-id="{{enhancement.sourceItemId}}">
      <div class="column name enh-tooltip" data-enh-key="{{key}}" data-item-id="{{enhancement.sourceItemId}}" title="Source: {{enhancement.sourceItemName}}">
        <img class="enh-img" src="{{enhancement.sourceItemImg}}"/>
        <div class="enh-name margin-left-5">{{enhancement.name}}</div>
      </div>
      <div class="column usage" title="{{localize 'dc20rpg.sheet.itemTable.enhRoll'}}">
        {{{enhancement-mods enhancement}}}
      </div>
      <div class="column usage costs" title="{{localize 'dc20rpg.sheet.itemTable.resources'}}">
        {{{cost-printer enhancement.resources enhancement.enhCosts true}}}
        {{#if enhancement.charges.consume}}
          {{#if enhancement.charges.fromOriginal}} 
            {{#ifCond enhancement.sourceItemId '===' @root.item._id}}
            <i class="fa-solid fa-bolt cost-icon" title="{{localize 'dc20rpg.sheet.itemTable.charges'}}"></i>
            {{else}}
            <i class="fa-solid fa-right-from-bracket cost-icon" title="{{localize 'dc20rpg.sheet.itemTable.chargesFrom'}} {{enhancement.sourceItemName}}"></i>
            {{/ifCond}}
          {{else}}
          <i class="fa-solid fa-bolt cost-icon" title="{{localize 'dc20rpg.sheet.itemTable.charges'}}"></i>
          {{/if}}
        {{/if}}
      </div>
      <div class="column enh-number">
        {{#if @root.rollsHeldAction}}
        <i class="box"><span>{{enhancement.number}}</span></i>
        {{else}}
        <a class="enh-use-number box" data-item-id="{{enhancement.sourceItemId}}" data-path="system.enhancements.{{key}}.number" data-run-check={{#ifCond enhancement.modifications.rollLevelChange '||' enhancement.modifications.addsRange}}"true"{{else}}"false"{{/ifCond}} title="{{localize 'dc20rpg.sheet.itemTable.enhNumber'}}">
          <span>{{enhancement.number}}</span>
        </a>
        {{/if}}
      </div>
    </div>
    {{/unless}}
    {{/each}}
    {{/unless}}
  </div>

  {{!-- Expected Cost --}}
  <div class="expected-cost">
    <div class="cost-label">
      <span>{{localize "dc20rpg.dialog.rollPrompt.expectedCost"}}</span>
    </div>
    <div class="costs">
      {{{cost-printer expectedCosts 1 false}}}
      {{{charges-printer expectedCharges "self"}}}
      {{{charges-printer chargesFromOtherItems "other"}}}

      {{!-- Print Consume other item - non enhancement way --}}
      {{#if otherItemUse}} 
        <div class="cost other-item" title="{{otherItemUse.name}}">
          <img src={{otherItemUse.image}} class="cost-img">
          <span class="margin-right-2">({{item.system.costs.otherItem.amountConsumed}})</span>
          {{#if otherItemUse.consumeCharge}}
          <i class="fa-solid fa-bolt fa-lg" title="{{localize 'dc20rpg.sheet.itemTable.consumeCharge'}}"></i>
          {{else}}
          <i class="fa-solid fa-boxes-stacked fa-lg" title="{{localize 'dc20rpg.sheet.itemTable.consumeQuantity'}}"></i>
          {{/if}}
        </div>
      {{/if}}
    </div>
  </div>

  {{!-- Measured Templates --}}
  {{#if measurementTemplates}}
  <div class="measurement-templates">
    {{#each measurementTemplates as |template key|}}
    <div class="template">
      {{#unless template.selected}}
      <a class="template-side-button fa-solid fa-minus margin-right-2 reduce-template-space" data-key="{{key}}"></a>
      {{/unless}}
      <a class="template-button create-template {{#if template.selected}}selected{{/if}}" data-key="{{key}}">
        {{template.label}}
      </a>
      {{#unless template.selected}}
      <a class="template-side-button fa-solid fa-plus margin-left-2 add-template-space" data-key="{{key}}"></a>
      {{/unless}}
    </div>
    {{/each}}
  </div>
  {{/if}}

  {{!-- Roll Menu --}}
  <div class="roll-menu margin-top-5">
    <div class="column">
      <div class="sub-header">
        <span>{{localize 'dc20rpg.sheet.rollMenu.rollLevel'}}</span>
        <a class="last-roll-level-check fa-solid fa-clipboard-question fa-lg" title="{{localize 'dc20rpg.sheet.rollMenu.lastRollLevelCheck'}}"></a>
      </div>
      <div class="roll-level">
        <div class="toggle" title="{{localize 'dc20rpg.sheet.rollMenu.adv'}}">
          <span>Adv: </span>
          <a class="toggle-numeric adv"
            data-path="flags.dc20rpg.rollMenu.adv">{{item.flags.dc20rpg.rollMenu.adv}}</a>
        </div>
        <div class="absolute-button">
          {{#if rollsHeldAction}}
          <i class="ap-for-adv-disabled square" data-path="flags.dc20rpg.rollMenu.apCost" title="{{localize 'dc20rpg.sheet.rollMenu.apCostDisabled'}}">
            <span class="fa-solid fa-lg fa-dice-d6 dice"></span>
            <div class="value"><span>{{item.flags.dc20rpg.rollMenu.apCost}}</span></div>
          </i>
          {{else}}
          <a class="ap-for-adv square" data-path="flags.dc20rpg.rollMenu.apCost" title="{{localize 'dc20rpg.sheet.rollMenu.apCost'}}">
            <span class="fa-solid fa-lg fa-dice-d6 dice"></span>
            <div class="value"><span>{{item.flags.dc20rpg.rollMenu.apCost}}</span></div>
          </a>
          {{/if}} 
        </div>
        <div class="toggle" title="{{localize 'dc20rpg.sheet.rollMenu.dis'}}">
          <span>Dis: </span>
          <a class="toggle-numeric dis"
            data-path="flags.dc20rpg.rollMenu.dis">{{item.flags.dc20rpg.rollMenu.dis}}</a>
        </div>
      </div>
    </div>

    <div class="mid-column margin-left-20">
      <div class="item-roll-options">
        {{#if item.system.properties.reload.active}}
        <a class="reload-weapon margin-right-10" 
            {{#if item.system.usesWeapon.weaponAttack}}
            data-item-id="{{item.system.usesWeapon.weaponId}}"
            {{else}}
            data-item-id="{{item._id}}"
            {{/if}}
            title="{{#if item.system.properties.reload.loaded}}{{localize 'dc20rpg.sheet.rollMenu.loaded'}}{{else}}{{localize 'dc20rpg.sheet.rollMenu.needToReload'}}{{/if}}">
          <i class="fa-2x fa-registered fa-solid" {{#unless item.system.properties.reload.loaded}}style="color:#f2001c !important"{{/unless}}></i>
        </a>
        {{/if}}
        <a class="item-activable margin-right-10" data-path="flags.dc20rpg.rollMenu.ignoreMCP" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.ignoreMCP'}}">
          <i class="fa-2x fa-dice{{#if item.flags.dc20rpg.rollMenu.ignoreMCP}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        <div class="letter-circle-icon small clickable" title="{{localize 'dc20rpg.sheet.rollMenu.runRollLevelCheck'}}">
          <a class="roll-level-check fa-solid fa-magnifying-glass fa-lg {{#unless rollLevelChecked}}not-used{{/unless}}"></a>    
        </div>
        {{#if item.flags.dc20rpg.rollMenu.rangeType}}
        <a class="roll-range margin-left-5" title="{{varLocalize 'dc20rpg.sheet.rollMenu.rangeType.' item.flags.dc20rpg.rollMenu.rangeType ''}}">
          <i class="fa-2x fa-solid{{#ifCond item.flags.dc20rpg.rollMenu.rangeType '===' "melee"}} fa-gavel{{else}} fa-crosshairs{{/ifCond}}"></i>
        </a>
        {{/if}}
        <a class="item-activable margin-left-10" data-path="flags.dc20rpg.rollMenu.free" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.free'}}">
          <i class="fa-2x fa-piggy-bank{{#if item.flags.dc20rpg.rollMenu.free}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
      </div>
      <div class="item-roll-options">
        {{#if item.system.properties.versatile.active}}
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.versatile" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.versatile'}}">
          <i class="fa-2x fa-hand{{#if item.flags.dc20rpg.rollMenu.versatile}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        {{/if}}
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.flanks" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.flanks'}}">
          <i class="fa-2x fa-left-right{{#if item.flags.dc20rpg.rollMenu.flanks}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.halfCover" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.halfCover'}}">
          <i class="fa-2x fa-shield-halved{{#if item.flags.dc20rpg.rollMenu.halfCover}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.tqCover" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.tqCover'}}">
          <i class="fa-2x fa-shield{{#if item.flags.dc20rpg.rollMenu.tqCover}} fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.autoCrit" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.autoCrit'}}">
          <i class="fa-2x fa-square-up-right{{#if item.flags.dc20rpg.rollMenu.autoCrit}} crit fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
        <a class="item-activable margin-right-2 margin-left-2" data-path="flags.dc20rpg.rollMenu.autoFail" data-item-id="{{item._id}}" title="{{localize 'dc20rpg.sheet.rollMenu.autoFail'}}">
          <i class="fa-2x fa-square-up-right fa-rotate-180{{#if item.flags.dc20rpg.rollMenu.autoFail}} fail fa-solid{{else}} fa-light{{/if}}"></i>
        </a>
      </div>
    </div>

    <div class="column help" title="{{localize 'dc20rpg.sheet.rollMenu.helpDices'}}">
      <div class="sub-header">
        <span>{{localize 'dc20rpg.sheet.rollMenu.helpDices'}}</span>
      </div>
      <div class="help-dices">
        {{!-- d8 --}}
        <a class="toggle-numeric-minus diamond" data-path="flags.dc20rpg.rollMenu.d8"
          title="{{localize 'dc20rpg.sheet.rollMenu.d8'}}">
          <span class="fa-solid fa-diamond dice"></span>
          <div class="value"><span>{{item.flags.dc20rpg.rollMenu.d8}}</span></div>
        </a>
        {{!-- d6 --}}
        <a class="toggle-numeric-minus square" data-path="flags.dc20rpg.rollMenu.d6"
          title="{{localize 'dc20rpg.sheet.rollMenu.d6'}}">
          <span class="fa-solid fa-square dice"></span>
          <div class="value"><span>{{item.flags.dc20rpg.rollMenu.d6}}</span></div>
        </a>
        {{!-- d4 --}}
        <a class="toggle-numeric-minus triangle" data-path="flags.dc20rpg.rollMenu.d4"
          title="{{localize 'dc20rpg.sheet.rollMenu.d4'}}">
          <span class="fa-solid fa-play fa-rotate-270 dice"></span>
          <div class="value"><span>{{item.flags.dc20rpg.rollMenu.d4}}</span></div>
        </a>
      </div>
    </div>
  </div>

  {{!-- Roll Button --}}
  <div class="roll-button-wrapper">
    <button class="close rollable button margin-top-5">{{rollDetails.label}}</button>
    {{#unless rollsHeldAction}}
    <button class="close held-action button margin-top-5" title="{{localize 'dc20rpg.sheet.rollMenu.heldAction'}}"><i class="fa-solid fa-arrow-up-right-from-square fa-lg"></i></button>
    {{/unless}}
  </div>
  
</form>