<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">Withdraw</div>
    <!-- Actions -->
    <div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
      <!-- Memo -->
      <mat-form-field>
        <input matInput type="text" />
      </mat-form-field>
      <button mat-flat-button [color]="'primary'">메모저장</button>
      <!-- SelectBox -->
      <mat-form-field>
        <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>
      <mat-form-field>
        <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
        class="fuse-mat-dense fuse-mat-no-subscript fuse-mat-rounded min-w-64"
      >
        <mat-icon
          class="icon-size-5"
          matPrefix
          [svgIcon]="'heroicons_solid:search'"
        ></mat-icon>
        <input
          matInput
          [formControl]="searchInputControl"
          [autocomplete]="'off'"
          [placeholder]="'Search'"
        />
      </mat-form-field>
      <!-- Search button -->
      <button
        class="ml-4"
        mat-flat-button
        [color]="'primary'"
        (click)="__createProduct()"
      >
        <!-- <mat-icon [svgIcon]="'heroicons_outline:plus'"></mat-icon> -->
        <span class="ml-2 mr-1">검색하기</span>
      </button>
    </div>
  </div>

  <!-- Main -->
  <div class="flex flex-auto overflow-hidden">
    <div class="hidden sm:block truncate">
      <button mat-flat-button [color]="'primary'">환전 처리</button>
      <button mat-flat-button [color]="'primary'">대기 처리</button>
      <button mat-flat-button [color]="'primary'">환전 취소</button>
    </div>
    <!-- Products list -->
    <div
      class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
    >
      <ng-container *ngIf="withdraws$ | async as withdraws">
        <ng-container *ngIf="withdraws.length > 0; else noWithdraw">
          <div class="grid">
            <!-- Header -->
            <div
              class="inventory-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"
              matSort
              matSortDisableClear
            >
              <div></div>
              <div class="hidden sm:block">등급</div>
              <div class="hidden sm:block">아이디</div>
              <div class="hidden sm:block">닉네임</div>
              <div class="hidden sm:block">정산종류</div>
              <div class="hidden sm:block">회원정보</div>
              <div class="hidden sm:block">비고</div>
              <div class="hidden sm:block">등록날짜</div>
              <div class="hidden sm:block">처리날짜</div>
              <div class="hidden sm:block">입금출금</div>
              <div class="hidden sm:block">상위</div>
              <div class="hidden sm:block">상태</div>
              <div class="hidden sm:block">배팅정보</div>
              <div class="hidden sm:block">삭제</div>
              <!-- <div class="hidden md:block" [mat-sort-header]="'sku'">SKU</div>
              <div [mat-sort-header]="'name'">Name</div>
              <div class="hidden sm:block" [mat-sort-header]="'price'">
                Price
              </div>
              <div class="hidden lg:block" [mat-sort-header]="'stock'">
                Stock
              </div>
              <div class="hidden lg:block" [mat-sort-header]="'active'">
                Active
              </div>
              <div class="hidden sm:block">Details</div> -->
            </div>
            <!-- Rows -->
            <ng-container *ngIf="withdraws$ | async as withdraws">
              <ng-container
                *ngFor="let withdraw of withdraws; trackBy: __trackByFn"
              >
                <div
                  class="inventory-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
                >
                  <!-- rank -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.rank }}
                  </div>

                  <!-- id -->
                  <ng-container *ngIf="users$ | async as users">
                    <ng-container
                      *ngFor="let user of users; trackBy: __trackByFn"
                    >
                      <div class="hidden sm:block truncate">
                        {{ withdraw.id }}
                      </div>
                    </ng-container>
                  </ng-container>

                  <!-- nickname -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.nickname }}
                  </div>

                  <!-- calculateType -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.calculateType }}
                  </div>

                  <!-- accountHolder -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.accountHolder }}
                  </div>

                  <!-- note -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.note }}
                  </div>

                  <!-- registrationDate -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.registrationDate }}
                  </div>

                  <!-- processDate -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.processDate }}
                  </div>

                  <!-- depositWithdrawal -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.deposit }}원 {{ withdraw.withdraw }}원
                    {{ withdraw.total }}원
                  </div>

                  <!-- casinoCash -->
                  <div class="hidden sm:block truncate">
                    <button mat-flat-button [color]="'primary'">
                      게임머니확인
                    </button>
                    <button mat-flat-button [color]="'primary'">
                      게임머니회수
                    </button>
                  </div>

                  <!-- highRank -->
                  <div class="hidden sm:block truncate">
                    <button mat-flat-button [color]="'primary'">
                      {{ withdraw.highRank }}
                    </button>
                  </div>

                  <!-- state -->
                  <div class="hidden sm:block truncate">
                    {{ withdraw.state }}
                  </div>

                  <!-- bettingInformation -->
                  <div class="hidden sm:block truncate">
                    <button mat-flat-button [color]="'primary'">
                      배팅리스트
                    </button>
                  </div>

                  <!-- delete -->
                  <div class="hidden sm:block truncate">
                    <button mat-flat-button [color]="'primary'">취소</button>
                  </div>
                  <!-- Image -->
                  <!-- <div class="flex items-center">
                    <div
                      class="relative flex flex-0 items-center justify-center w-12 h-12 mr-6 rounded overflow-hidden border"
                    >
                      <img
                        class="w-8"
                        *ngIf="user.thumbnail"
                        [alt]="'Product thumbnail image'"
                        [src]="user.thumbnail"
                      />
                      <div
                        class="flex items-center justify-center w-full h-full text-xs font-semibold leading-none text-center uppercase"
                        *ngIf="!user.thumbnail"
                      >
                        NO THUMB
                      </div>
                    </div>
                  </div> -->

                  <!-- SKU -->
                  <!-- <div class="hidden md:block truncate">
                    {{ user.sku }}
                  </div> -->

                  <!-- Name -->
                  <!-- <div class="truncate">
                    {{ user.name }}
                  </div> -->

                  <!-- Price -->
                  <!-- <div class="hidden sm:block">
                    {{ user.price | currency: "USD":"symbol":"1.2-2" }}
                  </div> -->

                  <!-- Stock -->
                  <!-- <div class="hidden lg:flex items-center">
                    <div class="min-w-4">{{ user.stock }}</div> -->
                  <!-- Low stock -->
                  <!-- <div
                      class="flex items-end ml-2 w-1 h-4 bg-red-200 rounded overflow-hidden"
                      *ngIf="user.stock < 20"
                    >
                      <div class="flex w-full h-1/3 bg-red-600"></div>
                    </div> -->
                  <!-- Medium stock -->
                  <!-- <div
                      class="flex items-end ml-2 w-1 h-4 bg-orange-200 rounded overflow-hidden"
                      *ngIf="user.stock >= 20 && user.stock < 30"
                    >
                      <div class="flex w-full h-2/4 bg-orange-400"></div>
                    </div> -->
                  <!-- High stock -->
                  <!-- <div
                      class="flex items-end ml-2 w-1 h-4 bg-green-100 rounded overflow-hidden"
                      *ngIf="user.stock >= 30"
                    >
                      <div class="flex w-full h-full bg-green-400"></div>
                    </div>
                  </div> -->

                  <!-- Active -->
                  <!-- <div class="hidden lg:block">
                    <ng-container *ngIf="user.active">
                      <mat-icon
                        class="text-green-400 icon-size-5"
                        [svgIcon]="'heroicons_solid:check'"
                      ></mat-icon>
                    </ng-container>
                    <ng-container *ngIf="!user.active">
                      <mat-icon
                        class="text-gray-400 icon-size-5"
                        [svgIcon]="'heroicons_solid:x'"
                      ></mat-icon>
                    </ng-container>
                  </div> -->

                  <!-- Details button -->
                  <!-- <div>
                    <button
                      class="min-w-10 min-h-7 h-7 px-2 leading-6"
                      mat-stroked-button
                      (click)="__toggleDetails(user.id)"
                    >
                      <mat-icon
                        class="icon-size-5"
                        [svgIcon]="
                          selectedUser?.id === user.id
                            ? 'heroicons_solid:chevron-up'
                            : 'heroicons_solid:chevron-down'
                        "
                      ></mat-icon>
                    </button>
                  </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 #noWithdraw>
        <div
          class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
        >
          There are no withdraw!
        </div>
      </ng-template>
    </div>
    <div class="hidden sm:block truncate">
      <button mat-flat-button [color]="'primary'">환전 처리</button>
      <button mat-flat-button [color]="'primary'">대기 처리</button>
      <button mat-flat-button [color]="'primary'">환전 취소</button>
    </div>
  </div>
</div>
