<div class="uk-section-default uk-section uk-section-small uk-padding-remove-bottom" style="min-height: 325px">

  <!-- MARGIN-TOP  -->
  <div class="uk-sticky-placeholder" style="height: 84px; margin: 0px;" aria-hidden="true"></div>
  <div class="uk-container uk-container-large">

    <div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
      <div class="uk-width-1-1@m uk-first-column">

        <h1 class="uk-h2">{{ piwik ? piwik.repositoryName : 'Metrics'}}</h1>

        <!-- TOP HELP CONTENT -->
        <help-content #topHelperContent [position]="'top'"
                      [ngClass]="topHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
        </help-content>

        <div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
          <div class="uk-grid">

            <!-- LEFT HELP CONTENT -->
            <aside-help-content #leftHelperContent [position]="'left'"
                                [ngClass]="leftHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
            </aside-help-content>

            <!-- MIDDLE -->
            <div class=" uk-width-expand@m">

              <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
              <div *ngIf="loadingMessage" class="loading-big">
                <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
                  {{ loadingMessage }}
                </div>
                <div class="whiteFilm"></div>
              </div>
              <div *ngIf="repoMetrics">
                <div class="uk-grid">
                  <div class="uk-width-1-1 uk-margin-bottom">
                    <div class="uk-float-right">
                      <a class="uk-button uk-button-primary"
                         [routerLink]="['/getImpact/usagestats',repoId]" title="">Get statistics report</a>
                    </div>
                  </div>
                  <div class="uk-width-1-1 uk-margin-medium-bottom">
                    <div>
                      <div class="uk-child-width-1-3@m uk-grid-small uk-grid-match uk-grid" uk-grid="">
                        <div class="metrics-openaire uk-first-column">
                          <div class="uk-tile uk-tile-default uk-padding-small">
                            <div class="uk-text-center">   {{ pageViews }}</div>
                            <div class="uk-text-center"> views in OpenAIRE</div>
                          </div>
                        </div>
                        <div class="metrics-views">
                          <div class="uk-tile uk-tile-muted uk-padding-small">
                            <div class="uk-text-center">  {{ totalViews }}
                              <span *ngIf="repoMetrics.metricsNumbers.total_openaire_views">( {{ repoMetrics.metricsNumbers.total_openaire_views }} from OpenAIRE )</span>
                            </div>
                            <div class="uk-text-center">views in local repository</div>
                          </div>
                        </div>
                        <div class="metrics-downloads">
                          <div class="uk-tile uk-tile-primary uk-padding-small">
                            <div class="uk-text-center">  {{ totalDownloads }}
                              <span *ngIf="repoMetrics.metricsNumbers.total_openaire_downloads">( {{ repoMetrics.metricsNumbers.total_openaire_downloads }} from OpenAIRE )</span></div>
                            <div class="uk-text-center">downloads in local repository</div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="uk-width-1-1 uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium uk-margin-bottom uk-padding">
                    <iframe class="statsFrame" [src]="viewsUrl"></iframe>
                  </div>
                  <div class="uk-width-1-1 uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium uk-margin-bottom uk-padding">
                    <iframe class="statsFrame" [src]="downloadsUrl"></iframe>
                  </div>
                </div>
              </div>

            </div>

            <!-- RIGHT HELP CONTENT -->
            <aside-help-content #rightHelperContent [position]="'right'"
                                [ngClass]="rightHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
            </aside-help-content>

          </div>
        </div>


        <!-- BOTTOM HELP CONTENT -->
        <help-content #bottomHelperContent [position]="'bottom'"
                      [ngClass]="bottomHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
        </help-content>


      </div>
    </div>
  </div>
</div>

