<!--分类-->
<div class="admin-content" id="category-manager">
    <div class="admin-content-body">
        <div>
            <strong class="part-title">分类管理</strong>
            <button nz-button nzGhost="true" nzType="primary" style="margin-left: 30px" (click)="addNewOne()">新增分类
            </button>
        </div>

        <div class="scrollable-horizontal" *ngIf="categoryService.categories">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>分类名称</th>
                    <th>分类文章</th>
                    <th>文章数目</th>
                    <th>管理</th>
                </tr>
                </thead>
                <tbody>
                <tr *ngFor="let category of categoryService.categories">
                    <td>{{category.id}}</td>
                    <td class="text-truncate" style="max-width: 150px">{{category.name}}</td>
                    <td>{{category.articles}}</td>
                    <td><span class="badge badge-success">{{category.articles.length}}</span>
                    </td>
                    <td>

                        <a [href]="'../category?name='+category.name">
                            <i nz-icon nzType="book" nzTheme="twotone"></i> 查看
                        </a>

                        <nz-divider nzType="vertical"></nz-divider>
                        <a nz-dropdown [nzDropdownMenu]="menu" nzPlacement="bottomLeft" nzTrigger="click">
                            更多 <i nz-icon nzType="down" nzTheme="outline"></i>
                        </a>
                        <nz-dropdown-menu #menu="nzDropdownMenu">
                            <ul nz-menu nzSelectable>
                                <li nz-menu-item>
                                    <a class="btn btn-secondary " (click)="edit(category.id,category.name)">编辑</a>
                                </li>
                                <li nz-menu-item>
                                    <a nz-popconfirm nzTitle="是否要删除这个分类?" (nzOnConfirm)="doDel(category.id)">删除
                                    </a>
                                </li>
                            </ul>
                        </nz-dropdown-menu>

                    </td>

                </tr>

                </tbody>
            </table>
        </div>


    </div>

</div>


<nz-modal [(nzVisible)]="showPupup" nzTitle="编辑" (nzOnCancel)="cancel()" (nzOnOk)="submit()">
    <input nz-input style="width: 80%;margin-left: 10%" [(ngModel)]="updateReqBody.name">
</nz-modal>
