<div class="tab identity sheet-part {{#if @root.tabs.identity.active}}active{{/if}}" data-group="sheet" data-tab="identity">
  <section class="community-section">
    <h3>{{ localize 'COMMUNITY.identity' }}</h3>
    <div class="grid grid-2col">
      <div class="form-group">
        <label for="system.identity.theme">{{ localize 'COMMUNITY.theme' }}</label>
        {{#if isEditMode}}
        <input type="text" name="system.identity.theme" value="{{system.identity.theme}}" data-dtype="String" />
        {{else}}
        <span>{{system.identity.theme}}</span>
        {{/if}}
      </div>
      <div class="form-group">
        <label for="system.identity.age">{{ localize 'COMMUNITY.age_label' }}</label>
        {{#if isEditMode}}
        <select name="system.identity.age" data-dtype="String">
          {{#each ageOptions}}
          <option value="{{ this.key }}" {{#ife @root.system.identity.age this.key}}selected{{/ife}}>{{ this.label }}</option>
          {{/each}}
        </select>
        {{else}}
        <span>{{#each ageOptions}}{{#ife @root.system.identity.age this.key}}{{ this.label }}{{/ife}}{{/each}}</span>
        {{/if}}
      </div>
      <div class="form-group">
        <label>{{ localize 'COMMUNITY.instincts' }}</label>
        {{#if isEditMode}}
        <input type="text" name="system.identity.instincts" value="{{system.identity.instincts}}" data-dtype="String" />
        {{else}}
        <span>{{system.identity.instincts}}</span>
        {{/if}}
      </div>
      <div class="form-group">
        <label>{{ localize 'COMMUNITY.prohibits' }}</label>
        {{#if isEditMode}}
        <input type="text" name="system.identity.prohibits" value="{{system.identity.prohibits}}" data-dtype="String" />
        {{else}}
        <span>{{system.identity.prohibits}}</span>
        {{/if}}
      </div>
    </div>
    <div class="form-group">
      <label for="system.identity.notes">{{ localize 'COMMUNITY.notes' }}</label>
      {{formInput systemFields.identity.fields.notes enriched=enrichedNotes value=system.identity.notes name="system.identity.notes" toggled=true}}
    </div>
  </section>

  <section class="community-section">
    <h3>{{ localize 'COMMUNITY.location' }}</h3>
    <div class="grid grid-2col">
      <div class="form-group">
        <label for="system.location.sector">{{ localize 'COMMUNITY.sector' }}</label>
        {{#if isEditMode}}
        <input type="text" name="system.location.sector" value="{{system.location.sector}}" data-dtype="String" />
        {{else}}
        <span>{{system.location.sector}}</span>
        {{/if}}
      </div>
      <div class="form-group">
        <label for="system.location.placeType">{{ localize 'COMMUNITY.placeType' }}</label>
        {{#if isEditMode}}
        <input type="text" name="system.location.placeType" value="{{system.location.placeType}}" data-dtype="String" />
        {{else}}
        <span>{{system.location.placeType}}</span>
        {{/if}}
      </div>
    </div>
    <div class="form-group">
      <label for="system.location.landmarks">{{ localize 'COMMUNITY.landmarks' }}</label>
      {{formInput systemFields.location.fields.landmarks enriched=enrichedLandmarks value=system.location.landmarks name="system.location.landmarks" toggled=true}}
    </div>
    <div class="form-group">
      <label for="system.location.territory">{{ localize 'COMMUNITY.territory' }}</label>
      {{formInput systemFields.location.fields.territory enriched=enrichedTerritory value=system.location.territory name="system.location.territory" toggled=true}}
    </div>
  </section>

  <section class="community-section">
    <h3>{{ localize 'COMMUNITY.history' }}</h3>
    <div class="form-group">
      <label for="system.history.founding">{{ localize 'COMMUNITY.founding' }}</label>
      {{#if isEditMode}}
      <input type="text" name="system.history.founding" value="{{system.history.founding}}" data-dtype="String" />
      {{else}}
      <span>{{system.history.founding}}</span>
      {{/if}}
    </div>
    <div class="form-group">
      <label for="system.history.events">{{ localize 'COMMUNITY.events' }}</label>
      {{formInput systemFields.history.fields.events enriched=enrichedEvents value=system.history.events name="system.history.events" toggled=true}}
    </div>
    <div class="form-group">
      <label for="system.history.relations">{{ localize 'COMMUNITY.history_relations' }}</label>
      {{formInput systemFields.history.fields.relations enriched=enrichedRelations value=system.history.relations name="system.history.relations" toggled=true}}
    </div>
  </section>

  <section class="community-section">
    <h3>{{ localize 'COMMUNITY.objectives' }}</h3>
    <div class="form-group">
      <label for="system.objectives.major">{{ localize 'COMMUNITY.objective_major' }}</label>
      {{#if isEditMode}}
      <input type="text" name="system.objectives.major" value="{{system.objectives.major}}" data-dtype="String" />
      {{else}}
      <span>{{system.objectives.major}}</span>
      {{/if}}
    </div>
    <div class="form-group">
      <label>{{ localize 'COMMUNITY.objectives_minor' }}</label>
      <ol class="items-list">
        {{#each system.objectives.minor as |obj index|}}
        <li class="item flexrow" data-index="{{index}}">
          {{#if @root.isEditMode}}
          <input type="text" name="system.objectives.minor.{{index}}" value="{{obj}}" data-dtype="String" style="flex: 1;" />
          <a data-action="deleteObjective" data-index="{{index}}" title="{{ localize 'VERMINE.delete' }}"><i class="fas fa-trash"></i></a>
          {{else}}
          <span style="flex: 1;">{{obj}}</span>
          {{/if}}
        </li>
        {{/each}}
        {{#if isEditMode}}
        <li class="item flexrow">
          <a data-action="addObjective" title="{{ localize 'VERMINE.add' }}"><i class="fas fa-plus"></i> {{ localize 'COMMUNITY.add_objective' }}</a>
        </li>
        {{/if}}
      </ol>
    </div>
  </section>
</div>
