<div
  class="sm:absolute sm:inset-0 flex flex-col flex-auto min-w-0 sm:overflow-hidden bg-card dark:bg-transparent"
>
  <!-- Header -->
  <div
    class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-8 px-6 md:px-8 border-b"
  >
    <!-- Loader -->
    <div class="absolute inset-x-0 bottom-0" *ngIf="isLoading">
      <mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
    </div>
    <!-- Title -->
    <div class="text-4xl font-extrabold tracking-tight">종목별매출통계</div>
    <!-- Actions -->
    <div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
      <!-- Search -->
      <button mat-icon-button (click)="__onClickSearch()">
        <mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
      </button>
    </div>
  </div>
  <!-- Search -->
  <div
    *ngIf="__isSearchOpened"
    class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
  >
    <!-- Card inception -->
    <!-- <div class="col-span-2 sm:col-span-1">
      <mat-form-field
        class="fuse-mat-no-subscript w-full"
        [floatLabel]="'always'"
      >
        <input
          matInput
          [matDatepicker]="picker1"
          [placeholder]="'Choose a date'"
        />
        <mat-datepicker-toggle
          matSuffix
          [for]="picker1"
        ></mat-datepicker-toggle>
        <mat-datepicker #picker1></mat-datepicker>
      </mat-form-field>
    </div> -->
    <!-- Card expiration -->
    <!-- <div class="col-span-2 sm:col-span-1">
      <mat-form-field
        class="fuse-mat-no-subscript w-full"
        [floatLabel]="'always'"
      >
        <input
          matInput
          [matDatepicker]="picker2"
          [placeholder]="'Choose a date'"
        />
        <mat-datepicker-toggle
          matSuffix
          [for]="picker2"
        ></mat-datepicker-toggle>
        <mat-datepicker #picker2></mat-datepicker>
      </mat-form-field>
    </div> -->
    <!-- Actions -->
    <div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
      <!-- Add user button -->
      <button
        mat-flat-button
        [color]="'primary'"
        fxFlex
        (click)="__createProduct()"
      >
        <mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
        <span class="ml-2 mr-1">Search</span>
      </button>
    </div>

    <div>
      <button mat-flat-button class="bet-mat-small-8" [color]="'primary'">
        어제
      </button>
    </div>
    <div>
      <button mat-flat-button class="bet-mat-small-8" [color]="'primary'">
        오늘
      </button>
    </div>
    <div>
      <button mat-flat-button class="bet-mat-small-8" [color]="'primary'">
        7일
      </button>
    </div>
  </div>

  <!-- Main -->
  <div class="flex flex-auto overflow-hidden">
    <!-- Products list -->
    <div
      class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
    >
      <ng-container *ngIf="statistics$ | async as statistics">
        <ng-container *ngIf="statistics.length > 0; else noStatistics">
          <div class="grid">
            <!-- Header -->
            <div
              class="statistics-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5"
            >
              <div>구분</div>
              <div>이용회원</div>
              <div>유효배팅</div>
              <div>배팅금액</div>
              <div class="hidden sm:block">당첨금액</div>
              <div class="hidden md:block">취소</div>
              <div class="hidden md:block">윈로스(A)</div>
              <div class="hidden md:block">수수료(B)</div>
              <div class="hidden lg:block">뱃윈정산(A-B)</div>
            </div>
            <!-- Rows -->
            <ng-container
              *ngFor="let statistics of statistics; trackBy: __trackByFn"
            >
              <div
                class="statistics-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
              >
                <div>{{ statistics.gameName }}</div>
                <div>{{ statistics.casinoUse }}명</div>
                <div>{{ statistics.casinoAvailable }}원</div>
                <div>{{ statistics.casinoBetting }}원</div>
                <div class="hidden sm:block">
                  {{ statistics.casinoWinning }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoCancel }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoWinLoss }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoCommission }}P
                </div>
                <div class="hidden lg:block">
                  {{ statistics.casinoBetWinCalculate }}원
                </div>

                <div>{{ statistics.gameName }}</div>
                <div>{{ statistics.casinoUse }}명</div>
                <div>{{ statistics.casinoAvailable }}원</div>
                <div>{{ statistics.casinoBetting }}원</div>
                <div class="hidden sm:block">
                  {{ statistics.casinoWinning }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoCancel }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoWinLoss }}원
                </div>
                <div class="hidden md:block">
                  {{ statistics.casinoCommission }}P
                </div>
                <div class="hidden lg:block">
                  {{ statistics.casinoBetWinCalculate }}원
                </div>
              </div>
            </ng-container>
          </div>

          <mat-paginator
            class="sm:absolute sm:inset-x-0 sm:bottom-0 border-b sm:border-t sm:border-b-0 z-10 bg-gray-50 dark:bg-transparent"
            [ngClass]="{ 'pointer-events-none': isLoading }"
            [length]="pagination?.length"
            [pageIndex]="pagination?.page"
            [pageSize]="pagination?.size"
            [pageSizeOptions]="[5, 10, 25, 100]"
            [showFirstLastButtons]="true"
          ></mat-paginator>
        </ng-container>
      </ng-container>

      <ng-template #noStatistics>
        <div
          class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
        >
          There are no data!
        </div>
      </ng-template>
    </div>
  </div>
</div>
