<div class="executeQueryMapWidget" style="width: 400px;">
  <div class="row">
    <div class="col-xs-4">
      <label> {{'executQuery.data.selectBD' | translate}} </label>
    </div>

    <div class="col-xs-8">
      <select
        class="form-control"
        ng-model="dbselector.choice"
        style="max-width: 300px; min-width: 150px;"
        ng-change="listFich(dbselector.choice)"
      >
        <option ng-repeat="db in datasources" value="{{db.name}}"
          >{{db.name}}</option
        >
      </select>
    </div>

    <div class="col-xs-12 " ng-show="dbselector.choice">
      <h4>{{'executQuery.data.select' | translate}}</h4>
    </div>

    <div class="col-xs-12 " ng-show="dbselector.choice">
      <div class="col-xs-7">
        <select
          class="form-control"
          data-ng-model="res.value"
          data-animation="am-flip-x"
          ng-change="affichQuery(res.value,dbselector.choice)"
        >
          <option
            name="newValue"
            value="res.newValue"
            data-ng-model="res.newValue"
          >
            {{'executQuery.data.newQuery' | translate}}</option
          >
          <option
            ng-repeat="item in autocompleteglobalsearchinclude | orderBy:'name'"
            ng-selected="{{res.value == item.name}}"
            value="{{item.name}}"
            >{{item.name}}
          </option>
        </select>
      </div>

      <div class="col-xs-5" ng-if="isroot">
        <!-- <button ng-show="res.value && !res.newValue" type="button"
					class="btn btn-default" style="margin-bottom: 8px;"
					ng-click="MAJFichSQL(res.value,exect.requet,dbselector.choice)">{{'executQuery.data.MAJ'
					| translate}}</button> -->
        <button
          ng-show="res.newValue"
          type="button"
          class="btn btn-default"
          style="margin-bottom: 8px;"
          ng-click="createFichSQL(exect.requet,dbselector.choice)"
        >
          {{'executQuery.data.save' | translate}}
        </button>
      </div>
    </div>

    <div class="col-xs-12 " ng-show="dbselector.choice">
      <div
        class="col-xs-8"
        style="width: 350px; height: 200px; margin-bottom: 8px;"
      >
        <textarea
          cols="30"
          id="code"
          name="code"
          ng-model="exect.requet"
        ></textarea>
      </div>
    </div>

    <div class="col-xs-12 " ng-show="dbselector.choice">
      <div class="col-xs-7">
        <button
          ng-show="res.value"
          type="button"
          class="btn btn-default"
          style="margin-bottom: 8px;"
          ng-click="executeFich(exect.requet,dbselector.choice)"
        >
          {{'executQuery.data.Execute' | translate}}
        </button>
      </div>

      <div class="col-xs-5" style="margin-top: 8px;">
        <span ng-show="!test && feat.totalFeatures >=0">
          <span>
            <translate>common.total</translate>: <b>{{feat.totalFeatures}}</b>
          </span>
        </span>
      </div>
    </div>

    <div class="col-xs-12 " ng-repeat="param in exect.params ">
      <div
        class="col-xs-4"
        ng-show="param.table != 'kis_anc_dossier_controle_reponse'"
      >
        <label>{{param.attribut}}</label>
      </div>
      <div
        class="col-xs-4"
        ng-show="param.table === 'kis_anc_dossier_controle_reponse'"
      >
        <label>{{param.alias}}</label>
      </div>
      <div class="col-xs-4">
        <select
          id="id_of_select"
          ng-model="param.operande"
          ng-options="'executQuery.rule.'+ operateur.label  | translate  for operateur in operateurs[param.table+param.attribut]"
        >
          <option value="">{{param.operande.label | translate }}</option>
        </select>
      </div>
      <div class="col-xs-4">
        <div
          id="display"
          form-field
          ng-show="param.operande.key != 'exists' && param.operande.key != 'notexists'   && param.operande.key != 'between'"
          fti="ftisRequete[param.table]"
          attname="param.attribut"
          res="param.valeur"
        ></div>
      </div>
      <div class="col-xs-4">
        <div
          id="display"
          form-field
          ng-show="param.operande.key == 'between'"
          fti="ftisRequete[param.table]"
          attname="param.attribut"
          res="param.valeur"
        ></div>
      </div>

      <div class="col-xs-4">
        <div
          id="display"
          form-field
          class="text-right"
          ng-show="param.operande.key == 'between'"
          fti="ftisRequete[param.table]"
          attname="param.attribut"
          res="param.autreValeur"
        ></div>
      </div>
    </div>
  </div>
</div>
