Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

3.4 KB
Raw Blame
<div class="d-flex justify-content-end">
  <a
    color="primary"
    i18n
    mat-flat-button
    [queryParams]="{ createPlatformDialog: true }"
    [routerLink]="[]"
  >
    Add Platform
  </a>
</div>
<div class="overflow-x-auto">
  <table
    class="gf-table w-100"
    mat-table
    matSort
    matSortActive="name"
    matSortDirection="asc"
    [dataSource]="dataSource"
  >
    <ng-container matColumnDef="icon" sticky>
      <th *matHeaderCellDef class="px-1" mat-header-cell></th>
      <td *matCellDef="let element" class="px-1 text-center" mat-cell>
        <gf-entity-logo
          [hasPlaceholder]="true"
          [tooltip]="element.name"
          [url]="element.url"
        />
      </td>
    </ng-container>

    <ng-container matColumnDef="name">
      <th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header="name">
        <ng-container i18n>Name</ng-container>
      </th>
      <td *matCellDef="let element" class="px-1 text-nowrap" mat-cell>
        {{ element.name }}
      </td>
    </ng-container>

    <ng-container matColumnDef="url">
      <th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header="url">
        <ng-container i18n>Url</ng-container>
      </th>
      <td *matCellDef="let element" class="px-1 text-nowrap" mat-cell>
        {{ element.url }}
      </td>
    </ng-container>

    <ng-container matColumnDef="accounts">
      <th
        *matHeaderCellDef
        class="justify-content-end px-1"
        mat-header-cell
        mat-sort-header="accountCount"
      >
        <ng-container i18n>Accounts</ng-container>
      </th>
      <td *matCellDef="let element" class="px-1 text-end" mat-cell>
        <gf-value
          class="d-inline-block justify-content-end"
          [locale]="locale()"
          [value]="element.accountCount"
        />
      </td>
    </ng-container>

    <ng-container matColumnDef="actions" stickyEnd>
      <th *matHeaderCellDef class="px-1 text-center" mat-header-cell></th>
      <td *matCellDef="let element" class="px-1 text-center" mat-cell>
        <button
          class="mx-1 no-min-width px-2"
          mat-button
          [matMenuTriggerFor]="platformMenu"
          (click)="$event.stopPropagation()"
        >
          <ion-icon name="ellipsis-horizontal" />
        </button>
        <mat-menu #platformMenu="matMenu" xPosition="before">
          <button mat-menu-item (click)="onUpdatePlatform(element)">
            <span class="align-items-center d-flex">
              <ion-icon class="me-2" name="create-outline" />
              <span><ng-container i18n>Edit</ng-container>...</span>
            </span>
          </button>
          <hr class="m-0" />
          <button
            mat-menu-item
            [disabled]="element.accountCount > 0"
            (click)="onDeletePlatform(element.id)"
          >
            <span class="align-items-center d-flex">
              <ion-icon class="me-2" name="trash-outline" />
              <span i18n>Delete</span>
            </span>
          </button>
        </mat-menu>
      </td>
    </ng-container>

    <tr *matHeaderRowDef="displayedColumns" mat-header-row></tr>
    <tr *matRowDef="let row; columns: displayedColumns" mat-row></tr>
  </table>
</div>

@if (isLoading) {
  <ngx-skeleton-loader
    animation="pulse"
    class="px-4 py-3"
    [theme]="{
      height: '1.5rem',
      width: '100%'
    }"
  />
}

<mat-paginator
  [class.d-none]="dataSource.data.length <= pageSize"
  [hidePageSize]="true"
  [pageSize]="pageSize"
/>