Commit 2a0bfb2d by Natthaphat

แก้ panation

parent 81d51eb9
......@@ -114,9 +114,6 @@
</tr>
</thead>
<tbody>
<tr *ngIf="listCourse.length == 0">
<td colspan="9" class="!text-center">ไม่พบข้อมูล</td>
</tr>
<tr
*ngFor="let data of filterListCourse() | slice: page * pageSize : (page+1) * pageSize ; let i = index">
<td class="!text-center">{{i+1}}</td>
......@@ -127,7 +124,8 @@
<td>{{data.courseType}}</td>
<td class="!text-center"><i class="ri-links-line text-base font-bold cursor-pointer hover:text-primary"
(click)="openLink(data.link1)"></i></td>
<td class="!text-center"> <i class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
<td class="!text-center"> <i
class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
(click)="downloadFile(data.logId)"></i></td>
<td class="!text-center">
<span class="fa-stack rt_anim" *ngIf="data.status == 0" ngbTooltip="รออนุมัติ" container="body"
......@@ -151,23 +149,36 @@
</td>
<td>
<div class="flex space-x-2 justify-center">
<button type="button" class="bg-success hover:bg-success text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<button type="button"
class="bg-success hover:bg-success text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="onApprove(data)"><i class="fa fa-check"></i></button>
<button type="button" class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<button type="button"
class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="onCancelApprove(data)"><i class="fas fa-times"></i></button>
<button type="button" class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<button type="button"
class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="deleteFile(data)" placement="top" ngbTooltip="ลบ">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</td>
</tr>
<tr *ngIf="filterListCourse().length === 0">
<td [attr.colspan]="9" class="!text-center py-4">
<ng-container *ngIf="listCourse.length === 0">
<p>ไม่พบข้อมูล</p>
</ng-container>
<ng-container *ngIf="listCourse.length > 0 && search">
<p>ไม่พบข้อมูลที่ค้นหา...</p>
</ng-container>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="box-footer">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListCourse().filter.length > 0">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListCourse().length > 0">
<div class="d-flex justify-content-end p-2">
<select class="custom-select m-r-5 border-color-gray-full-focus" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="page">
......@@ -196,12 +207,12 @@
1}}</a>
</li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 1) * pageSize < filterListCourse().filter.length"
*ngIf="(page + 1) * pageSize < filterListCourse().length"
(click)="page = page + 1; updatePagedItems()">{{page + 2}}</a></li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 2) * pageSize < filterListCourse().filter.length"
*ngIf="(page + 2) * pageSize < filterListCourse().length"
(click)="page = page + 2; updatePagedItems()">{{page + 3}}</a></li>
<li *ngIf="(page + 1) * pageSize < filterListCourse().filter.length" class="page-item"><a
<li *ngIf="(page + 1) * pageSize < filterListCourse().length" class="page-item"><a
class="page-link px-3 py-[0.375rem] cursor-pointer"
(click)="page = page + 1; updatePagedItems()">{{'Next' | translate}}</a>
</li>
......
......@@ -37,8 +37,6 @@ export class ApproveCourseComponent implements OnInit {
listCourse: CourseModel[] = []
search: string = ''
pagedItems: CourseModel[] = [];
pageIndex: number = 0;
itemsPerPage: number = 10;
constructor(private modalService: NgbModal, private courseService: CourseService) {
}
get totalItems(): number {
......@@ -48,7 +46,7 @@ export class ApproveCourseComponent implements OnInit {
}
get totalPages(): number {
return Math.ceil(this.totalItems / this.itemsPerPage);
return Math.ceil(this.totalItems / this.pageSize);
}
get totalPagesArray(): number[] {
......@@ -57,13 +55,13 @@ export class ApproveCourseComponent implements OnInit {
goToPage(index: number): void {
if (index < 0 || index >= this.totalPages) return;
this.pageIndex = index;
this.page = index;
this.updatePagedItems();
}
updatePagedItems() {
const data: CourseModel[] = this.search === '' ? this.listCourse : this.filterListCourse();
const start = this.pageIndex * this.itemsPerPage;
const end = start + this.itemsPerPage;
const start = this.page * this.pageSize;
const end = start + this.pageSize;
this.pagedItems = data.slice(start, end);
}
openEmployeeModal(image: string) {
......
......@@ -117,11 +117,7 @@
</tr>
</thead>
<tbody>
<tr *ngIf="listDoc.length == 0">
<td colspan="8" class="!text-center">ไม่พบข้อมูล</td>
</tr>
<tr
*ngFor="let data of filterListDoc() | slice: page * pageSize : (page+1) * pageSize ; let i = index">
<tr *ngFor="let data of filterListDoc() | slice: page * pageSize : (page+1) * pageSize ; let i = index">
<td class="!text-center">{{i+1}}</td>
<td><img width="100" class="border p-1" src="{{data.getImage()}}"
(click)="openEmployeeModal(data.getImage())"></td>
......@@ -130,9 +126,11 @@
<td>{{ data.thDesc }}</td>
<td class="!text-center"><i class="ri-links-line text-base font-bold cursor-pointer hover:text-primary"
(click)="openLink(data.link1)"></i></td>
<td class="!text-center"> <i class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
<td class="!text-center"> <i
class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
(click)="downloadFile(data.logId,'tha')"></i></td>
<td class="!text-center"> <i class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
<td class="!text-center"> <i
class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
(click)="downloadFile(data.logId,'eng')"></i></td>
<td class="!text-center">
<span class="fa-stack rt_anim" *ngIf="data.status == 0" ngbTooltip="รออนุมัติ" container="body"
......@@ -170,12 +168,22 @@
</div>
</td>
</tr>
<tr *ngIf="filterListDoc().length === 0">
<td [attr.colspan]="9" class="!text-center py-4">
<ng-container *ngIf="listDoc.length === 0">
<p>ไม่พบข้อมูล</p>
</ng-container>
<ng-container *ngIf="listDoc.length > 0 && search">
<p>ไม่พบข้อมูลที่ค้นหา...</p>
</ng-container>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="box-footer">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListDoc().filter.length > 0">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListDoc().length > 0">
<div class="d-flex justify-content-end p-2">
<select class="custom-select m-r-5 border-color-gray-full-focus" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="page">
......@@ -204,12 +212,12 @@
1}}</a>
</li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 1) * pageSize < filterListDoc().filter.length"
*ngIf="(page + 1) * pageSize < filterListDoc().length"
(click)="page = page + 1; updatePagedItems()">{{page + 2}}</a></li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 2) * pageSize < filterListDoc().filter.length"
*ngIf="(page + 2) * pageSize < filterListDoc().length"
(click)="page = page + 2; updatePagedItems()">{{page + 3}}</a></li>
<li *ngIf="(page + 1) * pageSize < filterListDoc().filter.length" class="page-item"><a
<li *ngIf="(page + 1) * pageSize < filterListDoc().length" class="page-item"><a
class="page-link px-3 py-[0.375rem] cursor-pointer"
(click)="page = page + 1; updatePagedItems()">{{'Next' | translate}}</a>
</li>
......
......@@ -37,8 +37,6 @@ export class ApproveDocComponent implements OnInit {
listDoc: DocumentModel[] = []
search: string = ''
pagedItems: DocumentModel[] = [];
pageIndex: number = 0;
itemsPerPage: number = 10;
constructor(private modalService: NgbModal, private documentService: DocumentService) {
}
get totalItems(): number {
......@@ -48,7 +46,7 @@ export class ApproveDocComponent implements OnInit {
}
get totalPages(): number {
return Math.ceil(this.totalItems / this.itemsPerPage);
return Math.ceil(this.totalItems / this.pageSize);
}
get totalPagesArray(): number[] {
......@@ -57,13 +55,13 @@ export class ApproveDocComponent implements OnInit {
goToPage(index: number): void {
if (index < 0 || index >= this.totalPages) return;
this.pageIndex = index;
this.page = index;
this.updatePagedItems();
}
updatePagedItems() {
const data: DocumentModel[] = this.search === '' ? this.listDoc : this.filterListDoc();
const start = this.pageIndex * this.itemsPerPage;
const end = start + this.itemsPerPage;
const start = this.page * this.pageSize;
const end = start + this.pageSize;
this.pagedItems = data.slice(start, end);
}
openEmployeeModal(image: string) {
......
<app-page-header [title]="'อนุมัติ Excel'" [activeTitle]="'รายการเอกสารรอการอนุมัติ'" [title1]="'อนุมัติ Excel'"></app-page-header>
<app-page-header [title]="'อนุมัติ Excel'" [activeTitle]="'รายการเอกสารรอการอนุมัติ'"
[title1]="'อนุมัติ Excel'"></app-page-header>
<!-- <div class="row">
<div class="col-12">
<div class="card card-body">
......@@ -120,9 +121,6 @@
</tr>
</thead>
<tbody>
<tr *ngIf="listExcel.length == 0">
<td colspan="8" class="!text-center">ไม่พบข้อมูล</td>
</tr>
<tr
*ngFor="let data of filterListExcel() | slice: page * pageSize : (page+1) * pageSize ; let i = index">
<td class="text-center">{{i+1}}</td>
......@@ -131,8 +129,10 @@
<!-- <td >{{data.id}}</td> -->
<td>{{ data.thName }}</td>
<td>{{ data.thDesc }}</td>
<td class="text-center"><i class="ri-links-line text-base font-bold cursor-pointer hover:text-primary" (click)="openLink(data.link1)"></i></td>
<td class="text-center"> <i class="fa fa-download text-base font-bold cursor-pointer hover:text-primary" (click)="downloadFile(data.logId)"></i></td>
<td class="text-center"><i class="ri-links-line text-base font-bold cursor-pointer hover:text-primary"
(click)="openLink(data.link1)"></i></td>
<td class="text-center"> <i class="fa fa-download text-base font-bold cursor-pointer hover:text-primary"
(click)="downloadFile(data.logId)"></i></td>
<td class="text-center">
<span class="fa-stack rt_anim" *ngIf="data.status == 0" ngbTooltip="รออนุมัติ" container="body"
tooltipClass="myhrcolor-1">
......@@ -154,12 +154,27 @@
</td>
<td>
<button type="button" class="bg-success hover:bg-success text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<div class="flex space-x-2 justify-center">
<button type="button"
class="bg-success hover:bg-success text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="onApprove(data)"><i class="fa fa-check"></i></button>
<button type="button" class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<button type="button"
class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="onCancelApprove(data)"><i class="fa fa-times"></i></button>
<button type="button" class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
<button type="button"
class="bg-danger hover:bg-danger text-white text-sm ml-5 w-10 h-10 flex items-center justify-center rounded-full"
(click)="deleteFile(data)" placement="top" ngbTooltip="ลบ"><i class="fa fa-trash"></i></button>
</div>
</td>
</tr>
<tr *ngIf="filterListExcel().length === 0">
<td [attr.colspan]="9" class="!text-center py-4">
<ng-container *ngIf="listExcel.length === 0">
<p>ไม่พบข้อมูล</p>
</ng-container>
<ng-container *ngIf="listExcel.length > 0 && search">
<p>ไม่พบข้อมูลที่ค้นหา...</p>
</ng-container>
</td>
</tr>
</tbody>
......@@ -167,7 +182,7 @@
</div>
</div>
<div class="box-footer">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListExcel().filter.length > 0">
<div class="flex items-center flex-wrap overflow-auto" *ngIf="filterListExcel().length > 0">
<div class="d-flex justify-content-end p-2">
<select class="custom-select m-r-5 border-color-gray-full-focus" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="page">
......@@ -196,12 +211,12 @@
1}}</a>
</li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 1) * pageSize < filterListExcel().filter.length"
*ngIf="(page + 1) * pageSize < filterListExcel().length"
(click)="page = page + 1; updatePagedItems()">{{page + 2}}</a></li>
<li class="page-item"><a class="page-link px-3 py-[0.375rem]" href="javascript:void(0);"
*ngIf="(page + 2) * pageSize < filterListExcel().filter.length"
*ngIf="(page + 2) * pageSize < filterListExcel().length"
(click)="page = page + 2; updatePagedItems()">{{page + 3}}</a></li>
<li *ngIf="(page + 1) * pageSize < filterListExcel().filter.length" class="page-item"><a
<li *ngIf="(page + 1) * pageSize < filterListExcel().length" class="page-item"><a
class="page-link px-3 py-[0.375rem] cursor-pointer"
(click)="page = page + 1; updatePagedItems()">{{'Next' | translate}}</a>
</li>
......
......@@ -38,8 +38,6 @@ export class ApproveExcelComponent implements OnInit {
listExcel: ExcelModel[] = []
search: string = ''
pagedItems: ExcelModel[] = [];
pageIndex: number = 0;
itemsPerPage: number = 10;
constructor(private modalService: NgbModal, private excelService: ExcelService) {
}
get totalItems(): number {
......@@ -49,7 +47,7 @@ export class ApproveExcelComponent implements OnInit {
}
get totalPages(): number {
return Math.ceil(this.totalItems / this.itemsPerPage);
return Math.ceil(this.totalItems / this.pageSize);
}
get totalPagesArray(): number[] {
......@@ -58,13 +56,13 @@ export class ApproveExcelComponent implements OnInit {
goToPage(index: number): void {
if (index < 0 || index >= this.totalPages) return;
this.pageIndex = index;
this.page = index;
this.updatePagedItems();
}
updatePagedItems() {
const data: ExcelModel[] = this.search === '' ? this.listExcel : this.filterListExcel();
const start = this.pageIndex * this.itemsPerPage;
const end = start + this.itemsPerPage;
const start = this.page * this.pageSize;
const end = start + this.pageSize;
this.pagedItems = data.slice(start, end);
}
openEmployeeModal(image: string) {
......@@ -143,6 +141,8 @@ export class ApproveExcelComponent implements OnInit {
}
ngOnInit() {
this.getListExcel();
console.log('search:', this.search, 'length:', this.search?.length)
}
deleteFile(item: ExcelModel) {
const modalRef = this.modalService.open(ConfirmModalComponent, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment