<form class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}"/>
        <div class="header-fields">
            <h1 class="charname">
              <input name="name" type="text" value="{{name}}" placeholder="Name"/>
            </h1>
        </div>
    </header>
    {{> systems/fvtt-pegasus-rpg/templates/partial-item-nav.html}}

    {{!-- Sheet Body --}}
    <section class="sheet-body">

      {{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}

        <div class="tab details" data-group="primary" data-tab="details">
          <ul>
            <li class="flexrow"><label class="generic-label">Type</label>
              <select class="competence-base flexrow" type="text" name="system.type" value="{{data.type}}" data-dtype="String">
                {{#select data.type}}
                <option value="mental">Mental</option>
                <option value="physical">Physical</option>
                {{/select}}
              </select> 
            </li>

            <li class="flexrow"><label class="generic-label">Positive/Negative</label>
              <select class="competence-base flexrow" type="text" name="system.genre" value="{{data.genre}}" data-dtype="String">
                {{#select data.genre}}
                <option value="positive">Positive</option>
                <option value="negative">Negative</option>
                {{/select}}
              </select> 
            </li>            

            <li class="flexrow"><label class="generic-label">Effect Level is a Stat?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.effectstatlevel" {{checked data.effectstatlevel}}/></label>
            </li>
            {{#if data.effectstatlevel}}
              <li class="flexrow"><label class="generic-label">Stat to use for Effect Level</label>
                <select class="competence-base flexrow" type="text" name="system.effectstat" value="{{data.effectstat}}" data-dtype="String">
                  {{#select data.effectstat}}
                  {{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=false mr=true all=false}}
                  {{/select}}
                </select> 
              </li>
            {{else}}
              <li class="flexrow"><label class="generic-label">Effect Level</label>
                <input type="text" class="input-numeric-short padd-right" name="system.effectlevel" value="{{data.effectlevel}}" data-dtype="Number"/>
              </li>
              <li class="flexrow"><label class="generic-label">Affect size ?</label>
                <label class="attribute-value checkbox"><input type="checkbox" name="system.affectsize" {{checked data.affectsize}}/></label>
              </li>              
            {{/if}}

            
            <li class="flexrow"><label class="generic-label">One use?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.oneuse" {{checked data.oneuse}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Ignore health penalty?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.ignorehealthpenalty" {{checked data.ignorehealthpenalty}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Display Text when targetted</label>
              <input type="text" class="padd-right" name="system.isthispossible" value="{{data.isthispossible}}" data-dtype="String"/>
            </li>
            <li class="flexrow"><label class="generic-label">Mental disruption ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.mentaldisruption" {{checked data.mentaldisruption}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Physical disruption ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.physicaldisruption" {{checked data.physicaldisruption}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Mental immunity ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.mentalimmunity" {{checked data.mentalimmunity}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Physical immunity ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.physicalimmunity" {{checked data.physicalimmunity}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">No bonus dice ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.nobonusdice" {{checked data.nobonusdice}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">No perks allowed ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.noperksallowed" {{checked data.noperksallowed}}/></label>
            </li>
            <li class="flexrow"><label class="generic-label">Locked (Only GM can change/edit) ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label>
            </li>

            <li class="flexrow"><label class="generic-label">Affect Status?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.affectstatus" {{checked data.affectstatus}}/></label>
            </li>
            {{#if data.affectstatus}}
              <li class="flexrow"><label class="generic-label">Affected status</label>
                <select class="competence-base flexrow" type="text" name="system.affectedstatus" value="{{data.affectedstatus}}" data-dtype="String">
                  {{#select data.affectedstatus}}
                  <option value="health">Health</option>
                  <option value="delirium">Delirium</option>
                  <option value="socialhealth">Social Health</option>
                  <option value="stealthhealth">Stealth Health</option>
                  <option value="nrg">NRG</option>
                  {{/select}}
                </select> 
              </li>
            {{/if}}

            <li class="flexrow"> <label class="generic-label">Affected Specialisations </label></li>
            <li class="flexrow">
              <ul class="ul-level1">
                <li class="flexrow"><div class="drop-effect-specaffected"><label>Drop Specialisations here !</label></div>
                </li>
                {{#each data.specaffected as |spec idx|}}
                  <li class="flexrow">
                    <label name="system.specaffected[{{idx}}].name"><a class="view-subitem" data-type="specaffected" data-index="{{idx}}">{{spec.name}}</a></label>
                    <div class="item-controls padd-left">
                      <a class="item-control delete-subitem padd-left" data-type="specaffected" data-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
                    </div>   
                  </li>
                {{/each}}
              </ul>  
            </li>

            <li class="flexrow"><label class="generic-label">Affected Stat</label>
              <select class="competence-base flexrow" type="text" name="system.stataffected" value="{{data.stataffected}}" data-dtype="String">
                {{#select data.stataffected}}
                {{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=true all=true combat=true vehicle=true power=true}}
                {{/select}}
              </select> 
            </li>

            {{#if (eq data.genre "positive")}}

            <li class="flexrow"><label class="generic-label">Choose one :</label></li>            
            <li class="flexrow"><label class="generic-label">Stat Dice ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.statdice" {{checked data.statdice}}/></label>
            </li>

            <li class="flexrow"><label class="generic-label">Bonus Dice ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.bonusdice" {{checked data.bonusdice}}/></label>
            </li>
            
            <li class="flexrow"><label class="generic-label">Weapon Damage ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.otherdice" {{checked data.otherdice}}/></label>
            </li>

            {{else}}

            <li class="flexrow"><label class="generic-label">Reduce Dice Value ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.reducedicevalue" {{checked data.reducedicevalue}}/></label>
            </li>

            <li class="flexrow"><label class="generic-label">Hindrance ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.hindrance" {{checked data.hindrance}}/></label>
            </li>

            <li class="flexrow"><label class="generic-label">Resisted By</label>
              <select class="competence-base flexrow" type="text" name="system.resistedby" value="{{data.resistedby}}" data-dtype="String">
                {{#select data.resistedby}}
                {{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=false all=false}}
                {{/select}}
              </select> 
            </li>

            <li class="flexrow"><label class="generic-label">Recovery Roll ?</label>
              <label class="attribute-value checkbox"><input type="checkbox" name="system.recoveryroll" {{checked data.recoveryroll}}/></label>
            </li>
            
            {{#if data.recoveryroll}}
            <li class="flexrow"><label class="generic-label">Recovery Stat</label>
              <select class="competence-base flexrow" type="text" name="system.recoveryrollstat" value="{{data.recoveryrollstat}}" data-dtype="String">
                {{#select data.recoveryrollstat}}
                {{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=false all=false}}
                {{/select}}
              </select> 
            </li>
            <li class="flexrow">
              <ul class="ul-level1">
                <li class="flexrow"> 
                  <label class="generic-label">Recovery Specialisations </label>
                </li>
                <li class="flexrow"><div class="drop-effect-spec"><label>Drop Specialisations here !</label></div>
                </li>
                {{#each data.recoveryrollspec as |spec idx|}}
                  <li class="flexrow">
                    <label name="system.recoveryrollspec[{{idx}}].name"><a class="view-subitem" data-type="recoveryrollspec" data-index="{{idx}}">{{spec.name}}</a></label>
                    <div class="item-controls padd-left">
                      <a class="item-control delete-subitem padd-left" data-type="recoveryrollspec" data-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
                    </div>   
                  </li>
                {{/each}}
              </ul>  
            </li>
            {{/if}}

            {{/if}}

          </ul>
        </div>

    </section>
</form>
