<label>Recherche</label>
<div bs-active-pane="tabs.activeTab" ng-model="tabs.activeTab" bs-tabs>
  <div ng-repeat="tab in tabs" title="{{tab.title}}" bs-pane></div>
</div>

<!-- Onglet 1: recherche sur idenification parcellaie -->
<div ng-show="tabs.activeTab == 0">
  <div class="majicSearchFrame">
    <div>
      <table width="100%">
        <tr class="majicSearchInputs">
          <td><label class="majc2identification">Commune</label></td>
          <td><label class="majc2identification">Section</label></td>
          <td><label class="majc2identification">Parcelle</label></td>
          <td
            colspan="2"
            class="majicRightAlign totalAndSelection"
            ng-if="parcelleObjects && parcelleObjects.length >0"
          >
            <span class="totalNumber">
			        <translate>common.total</translate>: <b>{{parcelleObjects.length}}</b>
            </span>
            <span
              ng-if="selectedParcelles && selectedParcelles.length > 0"
              class="totalSelectedElementsNumber"
            >
              <translate>common.selection</translate>:<b>{{selectedParcelles.length}}</b>
            </span>
          </td>
        </tr>
        <tr>
          <td class="majicSearchInputs">
            <select
              id="cbSComm"
              ng-change="InitSection();InitParcelle()"
              ng-model="idcomm"
              ng-options="commune.idcommune as commune.libcom for commune in communes"
            >
              <option value="">-- choisissez --</option>
            </select>
          </td>
          <td class="majicSearchInputs">
            <select
              id="cbSSect"
              ng-change="InitParcelle();InitCommune()"
              ng-model="idsect"
              ng-options="section for section in sections"
            >
              <option value="">-- choisissez --</option>
            </select>
          </td>
          <td class="majicSearchInputs">
            <select
              id="cbSParc"
              ng-change="InitSection();InitCommune()"
              ng-model="idparc"
              ng-options="parcelle for parcelle in parcelles"
            >
              <option value="">-- choisissez --</option>
            </select>
          </td>
          <td width="15%">
            <img src="img/common/wait.gif" ng-if="isSearchingParc" />
            <button
              ng-if="!isSearchingParc"
              type="button"
              class="btn btn-primary"
              ng-click="RechParc()"
              title="Recherche"
            >
              <span class="glyphicon glyphicon-search"></span>
            </button>
          </td>
          <td>
            <label for="allParcellesSelected" ng-show="parcelleObjects.length">
              <input
                type="checkbox"
                name="allParcellesSelected"
                ng-click="toggleSelectionParcelles()"
                ng-model="allParcellesSelected"
                ng-show="parcelleObjects.length"
              />
              <span ng-show="!allParcellesSelected">Tout sélectionner</span>
              <span ng-show="allParcellesSelected">Tout désélectionner</span>
            </label>
          </td>

        </tr>
      </table>
    </div>
    <div>
      <label ng-if="resultMsg !== ''">{{resultMsg}}</label>
    </div>

    <div>
      <table
        ng-table="tableParams"
        class="table"
        ng-show="parcelleObjects.length"
      >
        <tbody>
          <tr
            ng-repeat="object in $data"
            title="{{object.$selected ? 'clic pour désélectionner':'clic pour sélectionner'}}"
            ng-click="object.$selected = !object.$selected; changeParcSelection(object)"
            ng-class="{'active': object.$selected}"
          >
            <td data-title="'Commune'">{{object['Commune']}}</td>
            <td data-title="'Section'">{{object['Section']}}</td>
            <td data-title="'Parcelle'">{{object['numParcelle']}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="resetParc()"
        title="Réinitialiser"
      >
        Réinitialiser
      </button>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="AjoutParc()"
        title="Consulter"
      >
        Consulter
      </button>
    </div>
  </div>
</div>

<!-- Onglet 2: recherche par propriétaire -->
<div ng-show="tabs.activeTab == 1">
  <div class="majicSearchFrame">
    <div>
      <table ng-keypress="($event.charCode==13)?RechProprio():return;" width="100%">
        <tr class="majicSearchInputs">
          <td><label class="majc2identification">Nom d'usage</label></td>
          <td><label class="majc2identification">Nom de naissance</label></td>
          <td><label class="majc2identification">Prénom</label></td>
          <td><label class="majc2identification">Commune</label></td>
          <td
            colspan="2"
            class="majicRightAlign totalAndSelection"
            ng-if="proprioParcelleObjects && proprioParcelleObjects.length >0"
          >
            <span class="totalNumber">
			        <translate>common.total</translate>: <b>{{proprioParcelleObjects.length}}</b>
            </span>
            <span
              ng-if="proprioSelectedParcelles && proprioSelectedParcelles.length > 0"
              class="totalSelectedElementsNumber"
            >
              <translate>common.selection</translate>:<b>{{proprioSelectedParcelles.length}}</b>
            </span>
          </td>
        </tr>
        <tr class="majicSearchInputs">
          <td>
            <input
              class="majc2propInputField"
              pattern="[A-Za-z]+"
              type="text"
              placeholder="Rentrez un nom"
              autocomplete="on"
              ng-model="usageNomInput"
            />
          </td>
          <td>
            <input
                class="majc2propInputField"
                pattern="[A-Za-z]+"
                type="text"
                placeholder="Rentrez un nom"
                autocomplete="on"
                ng-model="nomInput"
            />
          </td>
          <td>
            <input
              class="majc2propInputField"
              pattern="[A-Za-z]+"
              type="text"
              placeholder="Rentrez un prénom"
              autocomplete="on"
              ng-model="prenomInput"
            />
          </td>
          <td class="majicSearchInputs">
            <select
              id="cbSComm"
              ng-change="InitSection();InitParcelle()"
              ng-model="idcomm"
              ng-options="commune.idcommune as commune.libcom for commune in propCommunes"
            >
              <option value="">-- choisissez --</option>
            </select>
          </td>
          <td>
            <img src="img/common/wait.gif" ng-if="isSearchingProprio" />
            <button
              ng-if="!isSearchingProprio"
              type="button"
              title="Recherche"
              class="btn btn-primary"
              ng-click="RechProprio()"
            >
              <span class="glyphicon glyphicon-search"></span>
            </button>
          </td>
          <td>
            <label for="allProprietairesSelected" ng-show="proprioParcelleObjects.length">
              <input
                type="checkbox"
                name="allProprietairesSelected"
                ng-click="toggleSelectionProprietaires()"
                ng-model="allProprietairesSelected"
                ng-show="proprioParcelleObjects.length"
              />
              <span ng-show="!allProprietairesSelected">Tout sélectionner</span>
              <span ng-show="allProprietairesSelected">Tout désélectionner</span>
            </label>
          </td>
        </tr>
      </table>
    </div>
    <div>
      <label ng-if="resultMsg2 != ''">{{resultMsg2}}</label>
    </div>
    <div>
      <table
        ng-show="proprioParcelleObjects.length > 0"
        ng-table="proprioTableParams"
        show-filter="true"
        class="table majc2ng-table-rowselected"
      >
        <thead>
          <tr>
            <th>Nom</th>
            <th>Prénom</th>
            <th>Parcelle</th>
          </tr>
        </thead>
        <tbody>
          <tr
            ng-repeat="object in $data"
            class="majicSearchInputs"
            title="{{object.$selected ? 'clic pour désélectionner':'clic pour sélectionner'}}"
            ng-click="object.$selected = !object.$selected; changeProprioParcSelection(object)"
            ng-class="{'active': object.$selected}"
          >
            <td>{{object['Nom']}}</td>
            <td>{{object['Prenom']}}</td>
            <td>{{object['Parcelle']}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="resetProprioParc()"
        title="Réinitialiser"
      >
        Réinitialiser
      </button>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="AjoutProprioParc()"
        title="Consulter"
      >
        Consulter
      </button>
    </div>
  </div>
</div>

<!-- Onglet 3: recherche par adresse -->
<div ng-show="tabs.activeTab == 2">
  <div class="majicSearchFrame">
    <div>
      <table ng-keypress="($event.charCode==13)?RechAdress():return;" width="100%">
        <tr class="majicSearchInputs">
          <td><label class="majc2identification">Numéro</label></td>
          <td><label class="majc2identification">Répétition</label></td>
          <td><label class="majc2identification">Nom de Rue</label></td>
          <td><label class="majc2identification">Ville</label></td>
          <td
            colspan="2"
            class="majicRightAlign totalAndSelection"
            ng-if="adressParcelleObjects && adressParcelleObjects.length >0"
          >
            <span class="totalNumber">
              <translate>common.total</translate>: <b>{{adressParcelleObjects.length}}</b>
            </span>
            <span
              ng-if="adressSelectedParcelles && adressSelectedParcelles.length > 0"
              class="totalSelectedElementsNumber"
            >
              <translate>common.selection</translate>:<b>{{adressSelectedParcelles.length}}</b>
            </span>
          </td>
        </tr>
        <tr class="majicSearchInputs">
          <td>
            <input
              class="majc2propInputFieldNumero"
              pattern="[0-9]+"
              type="number"
              placeholder="Rentrez un numero"
              title="Rentrez un numero de rue"
              autocomplete="on"
              ng-model="numRueInput"
            />
          </td>
          <td>
            <input
              class="majc2propInputFieldRepetition"
              pattern="[A-Za-z]+"
              type="text"
              placeholder="Rentrez une eventuelle répétition"
              title="Rentrez une eventuelle répétition"
              autocomplete="on"
              ng-model="repetitionInput"
            />
          </td>
          <td>
            <input
              class="majc2propInputFieldNomRue"
              pattern="[A-Za-z0-9]+"
              type="text"
              placeholder="Rentrez un nom de rue"
              title="Rentrez un nom de rue"
              autocomplete="on"
              ng-model="nomRueInput"
            />
          </td>
          <td class="majicSearchInputs">
            <select
              ng-model="villeInput"
              ng-options="ville for ville in villes"
            >
              <option value="">-- choisissez --</option>
            </select>
          </td>
          <td>
            <img src="img/common/wait.gif" ng-if="isSearchingAdress" />
            <button
              ng-if="!isSearchingAdress"
              type="button"
              class="btn btn-primary"
              ng-click="RechAdress()"
              title="Recherche"
            >
              <span class="glyphicon glyphicon-search"></span>
            </button>
          </td>
          <td>
            <label for="allAdressesSelected" ng-show="adressParcelleObjects.length">
              <input
                type="checkbox"
                name="allAdressesSelected"
                ng-click="toggleSelectionAdresses()"
                ng-model="allAdressesSelected"
                ng-show="adressParcelleObjects.length"
              />
              <span ng-show="!allAdressesSelected">Tout sélectionner</span>
              <span ng-show="allAdressesSelected">Tout désélectionner</span>
            </label>
          </td>
        </tr>
      </table>
    </div>
    <div>
      <label ng-if="resultMsg3 != ''">{{resultMsg3}}</label>
    </div>
    <div>
      <table
        ng-show="adressParcelleObjects.length > 0"
        ng-table="adressTableParams"
        show-filter="true"
        class="table majc2ng-table-rowselected"
      >
        <thead>
          <tr>
            <th>Adresse</th>
            <th>Ville</th>
            <th>Parcelle</th>
          </tr>
        </thead>
        <tbody>
          <tr
            ng-repeat="object in $data"
            class="majicSearchInputs"
            title="{{object.$selected ? 'clic pour désélectionner':'clic pour sélectionner'}}"
            ng-click="object.$selected = !object.$selected; changeAdressParcSelection(object)"
            ng-class="{'active': object.$selected}"
          >
            <td>{{object['Adresse']}}</td>
            <td>{{object['Ville']}}</td>
            <td>{{object['Parcelle']}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="resetAdressParc()"
        title="Réinitialiser"
      >
        Réinitialiser
      </button>
      <button
        type="button"
        class="btn btn-primary"
        ng-click="AjoutAdressParc()"
        title="Consulter"
      >
        Consulter
      </button>
    </div>
  </div>
</div>

<!-- Commande de retour àa la visualisation des données MAJIC des parcelles. -->
<div style="float: none;">
  <button
    type="button"
    class="btn btn-primary"
    ng-click="SwitchToConsult()"
    title="Retour"
  >
    Retour
  </button>
</div>
