<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">
      <!-- button -->
      <button mat-flat-button [color]="'primary'">15일</button>
      <button mat-flat-button [color]="'primary'">30일</button>
      <button mat-flat-button [color]="'primary'">60일</button>
      <button mat-flat-button [color]="'primary'">90일</button>
      <button mat-flat-button [color]="'primary'">120일</button>
      <button mat-flat-button [color]="'primary'">가입후미접속</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="unconnecteds$ | async as unconnecteds">
        <ng-container *ngIf="unconnecteds.length > 0; else noUnconnected">
          <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 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>
            <!-- Rows -->
            <ng-container *ngIf="unconnecteds$ | async as unconnecteds">
              <ng-container
                *ngFor="let unconnected of unconnecteds; 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">
                    {{ unconnected.rank }}
                  </div>
                  <!-- id -->

                  <div
                    class="hidden sm:block truncate"
                    (click)="viewUserDetail(unconnected.id)"
                  >
                    {{ unconnected.id }}
                  </div>
                  <!-- nickname -->
                  <div class="hidden sm:block truncate">
                    {{ unconnected.nickname }}
                  </div>
                  <!-- accountHolder -->
                  <div class="hidden sm:block truncate">
                    {{ unconnected.accountHolder }}
                  </div>
                  <!-- level -->
                  <div class="hidden sm:block truncate">
                    LV.{{ unconnected.level }}
                  </div>

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

                  <!-- cash -->
                  <div class="hidden sm:block truncate">
                    캐쉬{{ unconnected.cash }}
                  </div>
                  <!-- comp -->
                  <div class="hidden sm:block truncate">
                    comp{{ unconnected.comp }}
                  </div>

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

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

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

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

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

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

                  <!-- message -->
                  <div class="hidden sm:block truncate">
                    <button mat-flat-button [color]="'primary'">
                      <mat-icon svgIcon="heroicons_outline:mail"></mat-icon>
                    </button>
                  </div>

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

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

                  <!-- members -->
                  <div class="hidden sm:block truncate">
                    {{ unconnected.members }}
                  </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 #noUnconnected>
        <div
          class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
        >
          There are no unconnected!
        </div>
      </ng-template>
    </div>
  </div>
</div>
