<div class="col-md-12">
  <div class="col-md-12">
    <div class="maintitlehpo row">
      <h2 translate>common.configuration</h2>
    </div>
  </div>

  <div class="col-md-12 gcDatatableCrud marginTop">
    <div class="row">
      <div class="col-xs-12 nopadding">
        <save-and-get-template-hpo
          config-name="configName"
          data="statistic"
          run-return="getReturnedTemplate"
          exclude-properties="propertiestoexclude"
        >
        </save-and-get-template-hpo>

        <div
          class="btn btn-success btn-sm  pull-right"
          ng-click="applyConfig()"
          ng-disabled="disableConfigButton()"
        >
          <translate>common.apply</translate>
        </div>
      </div>
    </div>
  </div>

  <div class="row marginBottom">
    <div class="col-md-12">
      <div class="row">
        <div class="col-md-3">
          <div class="panel panel-primary panel-hpo">
            <h4 class="adjust-positions text-left" translate>
              hpo.common.selectmode
            </h4>
            <!-- <div class="row nomargin">
                <div class="col-md-12">
                  <div class="alert alert-hpo-info nomarginBottom">
                      <translate>hpo.data.analyse.onlyonemap</translate>
                  </div>
                </div>
              </div> -->
            <div
              class="row adjust-positions"
              css-manipulate='{"mh":"350px","ovy":"auto"}'
            >
              <div
                class="col-md-12"
                ng-repeat="mode in modes track by $index | orderBy:'label' "
              >
                <input
                  type="radio"
                  ng-model="statistic.mode"
                  ng-value="mode.id"
                  ng-change="changedMode()"
                />
                {{ mode.label | translate }}
              </div>
            </div>
            <br />
          </div>
        </div>

        <div class="col-md-3">
          <div class="panel panel-primary panel-hpo">
            <h4 class="adjust-positions text-left">
              <translate>hpo.common.components</translate>
              <button
                type="button"
                class="btn btn-default btn-sm pull-right marginRight"
                ng-click="statistic.selectall = !statistic.selectall;selectAll()"
                ng-show="statistic.mode === 'map'"
                title="{{ !statistic.selectall ? ( 'importexportwidget.selectAll' | translate ) : ( 'importexportwidget.unselectAll' | translate ) }}"
              >
                <i
                  class="fa"
                  ng-class="{ 'fa-check-square-o' : !statistic.selectall , 'fa-square-o' : statistic.selectall }"
                ></i>
              </button>
            </h4>
            <div class="row marginTop">
              <div class="col-md-12">
                <div class="col-md-12">
                  <div class="search">
                    <span class="fa fa-filter"></span>
                    <input
                      type="text"
                      ng-model="filtercomponents"
                      class="form-control"
                      placeholder="{{ 'hpo.data.prepare.filter' | translate }}"
                      ng-keydown="filtercomponents = $event.keyCode === 27 ? '' : filtercomponents "
                    />
                    <a
                      ng-show="filtercomponents.length > 0"
                      ng-click="filtercomponents = ''"
                    >
                      <span class="fa fa-times-circle"></span>
                    </a>
                  </div>
                </div>
              </div>
            </div>
            <div
              class="row adjust-positions"
              css-manipulate='{ "mh":"350px","ovy":"auto" }'
            >
              <div
                class="col-md-12"
                ng-hide="!fti || !filterFunc(filtercomponents,fti.alias)"
                ng-repeat="fti in ftis track by $index "
              >
                <input
                  type="radio"
                  ng-model="statistic.tableselected"
                  ng-value="fti"
                  ng-show="statistic.mode === 'table' || statistic.mode === 'graphe'"
                />
                <input
                  type="checkbox"
                  ng-model="statistic.selectedftis[fti.uid]"
                  ng-value="fti.uid"
                  ng-show="statistic.mode === 'map' || statistic.mode === 'counts'"
                />
                {{ fti.alias }}
              </div>
            </div>
            <br />
          </div>
        </div>

        <div
          class="col-md-1"
          ng-show="statistic.mode === 'counts'"
        >
          <button ng-click='addCountsComponentGroup()'>&gt;&gt;
          </button>
        </div>
        <div
          class="col-md-5"
          ng-if="statistic.mode === 'counts'"
        >
          <counts-group ng-repeat="countGrp in counts.groups track by $index" count-grp='countGrp' res='countGrp' index='$index'>
          </counts-group>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="col-md-12">
  <div class="col-md-12">
    <div class="maintitlehpo row">
      <h2>
        <translate>hpo.common.prev</translate>
        <div
          class="btn btn-success btn-sm  pull-right"
          ng-if="filterShowPosibilities()"
          ng-click="addToDashboard()"
          ng-disabled="!canCreateMap && statistic.mode === 'map'"
        >
          <translate>hpo.data.analyse.addtodashboard</translate>
        </div>
      </h2>
    </div>
  </div>

  <div class="row marginBottom">
    <div
      class="col-md-12"
      ng-switch
      on="statistic.mode"
      ng-if="filterShowPosibilities()"
    >
      <liste-data-hpo
        ng-switch-when="table"
        fti="statistic.tableselected"
        operands="statistic"
        use-operands="true"
        show-toastr="false"
        res="statistic"
        hide-crud="true"
        show-advanced-filter="false"
      ></liste-data-hpo>
      <hpo-map
        ng-switch-when="map"
        ftis="statistic.ftis"
        hidefilterbtn="true"
        res="statistic.result"
        config-user="statistic.configName"
        savedconfig="statistic.savedconfig"
        configid="statistic.configid"
        special-dashboard="true"
      ></hpo-map>
      <div
        chart-viewer
        fti="statistic.tableselected"
        authorised-attributes="authorisedAttributes"
        where="statistic.clauseWhere"
        selected="false"
        options="statistic.chartoptions"
        config="statistic.chartconfig"
        attrchoice="statistic.attrchoice"
        runcalc="true"
        ng-switch-when="graphe"
        ctrltype="'configDashboard'"
      ></div>
      <div hpo-statistics-counts
        ng-switch-when="counts"
        counts='statistic.counts'
        class="statistic-section one-page-section full-height">
      </div>
    </div>
  </div>
  <div class="row full-height nomargin" ng-if="!filterShowPosibilities()">
    <div class="alert alert-hpo-info">
      <translate>hpo.data.analyse.selectelement</translate>
    </div>
  </div>
</div>


