admin.component.html 1.16 KB
<app-loading [condition]="isLoading"></app-loading>

<app-toast [message]="toast.message"></app-toast>

<div class="card" *ngIf="!isLoading">
  <h4 class="card-header">สมาชิก ({{users.length}})</h4>
  <div class="card-block">
    <table class="table table-bordered table-striped">
      <thead class="thead-default">
        <tr>
          <th>ชื่อผู้ใช้งาน</th>
          <th>อีเมลล์</th>
          <th>สถานะ</th>
          <th>ลบ</th>
        </tr>
      </thead>
      <tbody *ngIf="users.length === 0">
        <tr>
          <td colspan="4">ไม่มีรายชื่อสมาชิกอยู่ในฐานข้อมูล.</td>
        </tr>  
      </tbody>
      <tbody>
        <tr *ngFor="let user of users">
          <td>{{user.username}}</td>
          <td>{{user.email}}</td>
          <td>{{user.role}}</td>
          <td>
            <button class="btn btn-sm btn-danger" (click)="deleteUser(user)" [disabled]="auth.currentUser._id === user._id">
              <i class="fa fa-trash"></i>
            </button>
          </td>
        </tr>  
      </tbody>
    </table>
  </div>
</div>