<div class="row spbrow">
  <div class="col-xs-12">
    <h3>Base d'accès aux données DDC</h3>
  </div>
</div>

<div class="row" ng-repeat="data in availableDatastore track by $index ">
  <div class="col-xs-3 text-left">
    <label class="radio-inline">
      <input
        type="radio"
        name="datastore"
        ng-init="getSelectedCfg()"
        ng-model="selectedDatastore.name"
        value="{{data.name}}"
        ng-disabled="ctrl_clos"
      />
      {{data.name}}
    </label>
  </div>
</div>
<hr />
<div class="row spbrow">
  <div class="col-xs-12">
    <h3>Adresse DDC</h3>
  </div>
</div>
<div class="row spbrow">
  <div class="col-xs-6">
    <input
      type="text"
      class="form-control"
      name=""
      ng-model="selectedDatastore.url"
      placeholder="http://www.operis.com"
    />
  </div>
</div>

<hr />
<div class="row spbrow">
  <div class="col-xs-12">
    <h3>Tables de données DDC</h3>
  </div>
</div>

<div class="row spbrow">
  <div class="col-xs-6">
    <table class="table table-bordered">
      <thead>
        <th colspan="2">
          <div class="col-xs-8 text-left">
            <p>Parcelles DDC</p>
          </div>
          <div class="col-xs-4 text-right">
            <div class="btn btn-sm btn-info" ng-click="configPopup('parcelle')">
              <i class="fa fa-gear"></i>
            </div>
          </div>
        </th>
      </thead>
      <tbody ng-if="selectedDatastore.parcelle.feature">
        <tr align="center">
          <td>Composant sélectionné</td>
          <td
            ng-model="selectedDatastore.parcelle.feature"
            ng-bind="getFeatName('parcelle')"
          ></td>
        </tr>
      </tbody>
      <tbody ng-if="!selectedDatastore.parcelle.feature">
        <tr>
          <th colspan="2">
            <div class="alert alert-danger">
              Veuillez choisir le composant
            </div>
          </th>
        </tr>
      </tbody>
    </table>
  </div>

  <div class="col-xs-6">
    <table class="table table-bordered">
      <thead>
        <th colspan="2">
          <div class="col-xs-8 text-left">
            Dossiers DDC
          </div>
          <div class="col-xs-4 text-right">
            <div class="btn btn-sm btn-info" ng-click="configPopup('dossier')">
              <i class="fa fa-gear"></i>
            </div>
          </div>
        </th>
      </thead>
      <tbody ng-if="selectedDatastore.dossier.feature">
        <tr align="center">
          <td>Composant sélectionné</td>
          <td ng-bind="getFeatName('dossier')"></td>
        </tr>
      </tbody>
      <tbody ng-if="!selectedDatastore.dossier.feature">
        <tr>
          <th colspan="2">
            <div class="alert alert-danger">
              Veuillez choisir le composant
            </div>
          </th>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<div class="row spbrow">
  <div class="col-xs-12">
    <h3>Attributs de requêtes</h3>
  </div>
</div>

<div class="row spbrow">
  <div class="col-xs-6">
    <table class="table table-bordered">
      <thead>
        <th colspan="2">
          <div class="col-xs-8 text-left">
            <p>Attribut de la table Parcelle</p>
          </div>
          <div class="col-xs-4 text-right">
            <div
              class="btn btn-sm btn-info"
              ng-click="configAttrConfig('parcelle')"
            >
              <i class="fa fa-gear"></i>
            </div>
          </div>
        </th>
      </thead>
      <tbody ng-if="selectedDatastore.parcelle.attribut">
        <tr align="center">
          <td>Attribut sélectionné</td>
          <td ng-bind="getAttrAlias('parcelle')"></td>
        </tr>
      </tbody>
      <tbody ng-if="!selectedDatastore.parcelle.attribut">
        <tr>
          <th colspan="2">
            <div class="alert alert-danger">
              Veuillez choisir un attribut
            </div>
          </th>
        </tr>
      </tbody>
    </table>
  </div>

  <div class="col-xs-6">
    <table class="table table-bordered">
      <thead>
        <th colspan="2">
          <div class="col-xs-8 text-left">
            <p>Attribut de relation parcelle > dossier</p>
          </div>
          <div class="col-xs-4 text-right">
            <div
              class="btn btn-sm btn-info"
              ng-click="configAttrConfig('dossier')"
            >
              <i class="fa fa-gear"></i>
            </div>
          </div>
        </th>
      </thead>
      <tbody ng-if="selectedDatastore.dossier.attribut">
        <tr align="center">
          <td>Attribut sélectionné</td>
          <td ng-bind="getAttrAlias('dossier')"></td>
        </tr>
      </tbody>
      <tbody ng-if="!selectedDatastore.dossier.attribut">
        <tr>
          <th colspan="2">
            <div class="alert alert-danger">
              Veuillez choisir un attribut
            </div>
          </th>
        </tr>
      </tbody>
    </table>
  </div>
</div>
<hr />
<div class="row spbrow">
  <div class="col-xs-12">
    <h3>Where clause</h3>
  </div>
</div>
<div class="row spbrow">
  <div class="col-xs-6">
    <table class="table table-bordered">
      <thead>
        <th>
          <div class="col-xs-8 text-left">
            <p>Parcelles KIS - <span ng-bind="renderParcelleName()"></span></p>
          </div>
          <div class="col-xs-4 text-right">
            <div class="btn btn-sm btn-info" ng-click="configWhere()">
              <i class="fa fa-gear"></i>
            </div>
          </div>
        </th>
      </thead>
      <tbody ng-if="parcelleFeature.name">
        <tr align="center">
          <td ng-bind="renderWhereClause()"></td>
        </tr>
      </tbody>
      <tbody ng-if="!parcelleFeature.name">
        <tr>
          <th colspan="2">
            <div class="alert alert-danger">
              Le composant parcelle n'est pas paramétré.
            </div>
          </th>
        </tr>
      </tbody>
    </table>
  </div>
</div>
<div class="row spbrow">
  <div class="col-xs-12 panelSaveAdminBot">
    <div class="btn btn-primary pull-right" ng-click="enregistrerOperisCfg()">
      Enregistrer la configuration Droit de cité
    </div>
  </div>
</div>
