<div id='location' class='gga-tableheader'>
  {{#if isEditing}}
    <div class='header'>
      <div class='headermenu' data-key='system.hitlocations'>
        <span>{{localize 'GURPS.hitLocation'}}</span>
        <i class='fas fa-caret-square-down'></i>
      </div>
      <div class='option'>
        <input id='ignoreinputbodyplan' type='checkbox' {{checked system.additionalresources.ignoreinputbodyplan}}/>
        <label for='ignoreinputbodyplan'>{{localize "GURPS.ignoreBodyPlan"}}</label>
      </div>
    </div>
  {{else}}
    <div class='header'>{{localize 'GURPS.hitLocation'}}</div>
  {{/if}}

  <div class='itemmenu header' readonly></div>
  <div class='roll header flex-center'>{{localize 'GURPS.roll'}}</div>
  <div class='where header'>{{localize 'GURPS.hitLocationWhere'}}</div>
  <div class='penalty header gga-right'>{{localize 'GURPS.hitLocationPenalty'}}</div>
  <div class='dr header gga-right'>{{localize 'GURPS.hitLocationDR'}}</div>

  {{#each system.hitlocations as |this key|}}
    {{#if ../isEditing}}
      <div class='itemmenu hlmenu' data-key='system.hitlocations.{{@key}}'>
        <i class='fas fa-times'></i>
      </div>
    {{else}}
      <div class='itemmenu' readonly></div>
    {{/if}}
    <div class='roll flex-center'>
      {{#if ../isEditing}}
        <input
          name='system.hitlocations.{{@key}}.roll'
          class='gcs-input-4'
          type='text'
          value='{{hitlocationroll where roll parent}}'
        />
      {{else}}
        {{hitlocationroll where roll parent}}
      {{/if}}
    </div>
    <div class='where gurpstippable' {{!data-tooltip='{{DRTooltip}}'>
      {{#if ../isEditing}}
        <input name='system.hitlocations.{{@key}}.where' class='gcs-input-5' type='text' value='{{where}}' />
      {{else}}
        {{localize (concat 'GURPS.hitLocation' where) where}}
      {{/if}}
    </div>
    {{#if ../isEditing}}
      <div class='penalty gga-right'>
        <input
          name='system.hitlocations.{{@key}}.penalty'
          class='gcs-input'
          type='text'
          value='{{hitlocationpenalty where penalty parent}}'
        />
      </div>
    {{else}}
      <div class='penalty gga-right {{gmod penalty}}' data-name='to hit {{where}}' data-otf='{{penalty}} to hit {{where}}'>
        {{{displayNumber (hitlocationpenalty where penalty parent)}}}
      </div>
    {{/if}}
    <div class='dr gga-right {{#if (DRisModified this)}}blue{{/if}}'>
      {{#if ../isEditing}}
        <div style="display: flex; flex-flow: row nowrap">
          <input class='gcs-input' type='text' name='system.hitlocations.{{@key}}.import' value='{{import}}' />
          {{#each split as | this key |}}<span title='{{localize key}}'>/{{this}}{{#if (ne key 'cr')}}*{{/if}}</span>{{/each}}
          <button id="split-{{@key}}" style="padding-bottom: 1px;" data-key='system.hitlocations.{{@key}}'>…</button>
        </div>
      {{else}}
        {{#if ../document.limited}}
          ??
        {{else}}
          {{dr}}{{#each split as | this key |}}<span title='{{localize key}}'>/{{this}}{{#if (ne key 'cr')}}*{{/if}}</span>{{/each}}
        {{/if}}
      {{/if}}
    </div>
  {{/each}}
</div>