<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"
  >
    <!-- Actions -->
    <div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
      <!-- SelectBox -->
      <mat-form-field fxFlex class="bet-mat-form-field-wrapper-mb-0 mr-2">
        <mat-select placeholder="전체">
          <mat-option value="">전체</mat-option>
          <mat-option value="">파워볼</mat-option>
          <mat-option value="">카지노</mat-option>
          <mat-option value="">슬롯</mat-option>
        </mat-select>
      </mat-form-field>
      <!-- Search -->
      <mat-form-field
        fxFlex
        class="fuse-mat-rounded min-w-64 bet-mat-form-field-wrapper-mb-0 mr-2"
      >
        <mat-icon
          class="icon-size-5"
          matPrefix
          [svgIcon]="'heroicons_solid:search'"
        ></mat-icon>
        <input
          matInput
          [formControl]="searchInputControl"
          [autocomplete]="'off'"
          [placeholder]="'Search user'"
        />
      </mat-form-field>
      <!-- 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>
        <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'">
          오늘
        </button>
      </div>
      <div>
        <button mat-flat-button class="bet-mat-small-8" [color]="'primary'">
          7일
        </button>
      </div>
      <div>
        <button mat-flat-button class="bet-mat-small-8" [color]="'primary'">
          엑셀저장
        </button>
      </div>
    </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="dailys$ | async as dailys">
        <ng-container *ngIf="dailys.length > 0; else noDaily">
          <div class="grid">
            <!-- Header -->
            <div
              class="daily-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">수동콤프</div>
              <div class="hidden md:block">카-배팅</div>
              <div class="hidden lg:block">카-당첨</div>
              <div class="hidden lg:block">카-윈로스(A)</div>
              <div class="hidden lg:block">카-수수료(B)</div>
              <div class="hidden lg:block">카-벳윈정산(A-B)</div>
              <div class="hidden md:block">슬-배팅</div>
              <div class="hidden lg:block">슬-당첨</div>
              <div class="hidden lg:block">슬-윈로스(D)</div>
              <div class="hidden lg:block">슬-수수료(E)</div>
              <div class="hidden lg:block">슬-벳윈정산(D-E)</div>
              <div class="hidden md:block">파-배팅</div>
              <div class="hidden lg:block">파-당첨</div>
              <div class="hidden lg:block">파-윈로스(H)</div>
              <div class="hidden lg:block">파-수수료(I)</div>
              <div class="hidden lg:block">파-벳윈정산(H-I)</div>
              <div class="hidden lg:block">총벳윈정산</div>
            </div>
            <!-- Rows -->
            <ng-container *ngIf="dailys$ | async as dailys">
              <ng-container *ngFor="let daily of dailys; trackBy: __trackByFn">
                <div
                  class="daily-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
                >
                  <div>{{ daily.processDate }}</div>
                  <div>
                    {{ daily.lastDayHoldingMoney }}
                  </div>
                  <div>
                    충전{{ daily.memberCharge }}
                    <hr style="margin: 7px 0px" />
                    환전{{ daily.memberExchange }}
                    <hr style="margin: 7px 0px" />
                    손익{{ daily.memberProfitLoss }}
                  </div>
                  <div>
                    충전{{ daily.partnerCharge }}
                    <hr style="margin: 7px 0px" />
                    환전{{ daily.partnerExchange }}
                    <hr style="margin: 7px 0px" />
                    손익{{ daily.partnerProfitLoss }}
                  </div>
                  <div class="hidden sm:block">
                    {{ daily.totalProfitLoss }}
                  </div>
                  <div class="hidden md:block">{{ daily.passiveMoney }}</div>
                  <div class="hidden md:block">
                    {{ daily.passiveComp }}
                  </div>
                  <div class="hidden md:block">
                    배팅{{ daily.casinoBetting }}
                    <hr style="margin: 7px 0px" />
                    타이{{ daily.casinoTie }}
                    <hr style="margin: 7px 0px" />
                    취소{{ daily.casinoCancel }}
                    <hr style="margin: 7px 0px" />
                    유효{{ daily.casinoAvailable }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.casinoWinning }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.casinoWinLoss }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.casinoCommission }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.casinoBetWinCalculate }}
                  </div>
                  <div class="hidden md:block">
                    배팅{{ daily.slotBetting }}
                    <hr style="margin: 7px 0px" />
                    취소{{ daily.slotCancel }}
                    <hr style="margin: 7px 0px" />
                    유효{{ daily.slotAvailable }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.slotWinning }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.slotWinLoss }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.slotCommission }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.slotBetWinCalculate }}
                  </div>
                  <div class="hidden md:block">
                    배팅{{ daily.powerballBetting }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.powerballWinning }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.powerballWinLoss }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.powerballCommission }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.powerballBetWinCalculate }}
                  </div>
                  <div class="hidden lg:block">
                    {{ daily.totalBetWinCalculate }}
                  </div>
                </div>
              </ng-container>
            </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 #noDaily>
        <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>
