{{#unless options.isOwned}}
{{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs'}}
<div class="tab items" data-group="primary" data-tab="environnement">
  <div class="form-group description-milieu">
    <label>Description du milieu</label>
    <span class="flexrow">
      <input class="attribute-value" type="text" name="system.milieu" value="{{system.milieu}}" data-dtype="String" />
    </span>
  </div>
  <hr>
  <div class="form-group">
    <label>Ajouter un fréquence</label>
    <span class="flexrow">
      <div class="autocomplete">
        <input name="saisie-nouveau-milieu" type="text" class="input-selection-milieu" placeholder="Milieu" data-dtype="String"/>
        {{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs' proposals=milieux className='input-selection-milieu'}}
      </div>
      <a class="milieu-add"><i class="fas fa-plus-circle"></i></a>
    </span>
  </div>
  
  {{#each system.environnement as |env key|}}
  <div class="form-group environnement-milieu" data-milieu="{{env.milieu}}">
    <label>
      {{env.milieu}}
      <a class="milieu-delete" data-tooltip="Supprimer {{env.milieu}}"><i class="fas fa-trash"></i></a>
    </label>
    <span class="flexrow">
      <select name="milieu-{{key}}-rarete" class="environnement-rarete flex-shrink" data-dtype="String">
        {{selectOptions (RDD_CONFIG 'raretes') selected=env.rarete labelAttr="label" valueAttr="value" nameAttr="value"}}
      </select>
      {{rangePicker name="milieu-{{key}}-frequence" value=env.frequence min=(rarete-getChamp env.rarete 'min') max=(rarete-getChamp env.rarete 'max') step=1}}
      <label>[{{rarete-getChamp env.rarete 'min'}}-{{rarete-getChamp env.rarete 'max'}}]</label>
    </span>
  </div>
  {{/each}}
</div>
{{/unless}}