Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mySkill-x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angular
mySkill-x
Commits
26805bd3
Commit
26805bd3
authored
Mar 17, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE pagination
parent
02e510c8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
46 deletions
+104
-46
dashboard.module.ts
src/app/components/dashboard/dashboard.module.ts
+4
-1
import-data.component.html
...-detail-management/import-data/import-data.component.html
+1
-45
import-data.component.ts
...ob-detail-management/import-data/import-data.component.ts
+1
-0
pagination.component.html
src/app/components/pagination/pagination.component.html
+42
-0
pagination.component.scss
src/app/components/pagination/pagination.component.scss
+0
-0
pagination.component.ts
src/app/components/pagination/pagination.component.ts
+56
-0
No files found.
src/app/components/dashboard/dashboard.module.ts
View file @
26805bd3
...
...
@@ -159,6 +159,8 @@ import { TimeAttendanceComponent } from '../performance-management-evaluation/ti
import
{
PmsWorkingTimeService
}
from
'src/app/shared/services/pms-working-time.service'
;
import
{
EvaluationIdpService
}
from
'src/app/shared/services/evaluation-Idp.service'
;
import
{
EmpStatusService
}
from
'src/app/shared/services/emp-status.service'
;
import
{
PaginationComponent
}
from
'../pagination/pagination.component'
;
export
const
MY_DATE_FORMATS
=
{
parse
:
{
...
...
@@ -283,7 +285,8 @@ export class CustomDateAdapter extends NativeDateAdapter {
PmsGroupGradeComponent
,
PmsSubGradeRegistrationComponent
,
DayTypeRegistryComponent
,
TimeAttendanceComponent
TimeAttendanceComponent
,
PaginationComponent
],
imports
:
[
CommonModule
,
...
...
src/app/components/job-detail-components/job-detail-management/import-data/import-data.component.html
View file @
26805bd3
...
...
@@ -102,51 +102,7 @@
</tbody>
</table>
</div>
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"page.length"
>
<ul
class=
"ti-pagination"
>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage-1
||
1
)"
>
<i
class=
"ri-arrow-left-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<li
*
ngFor=
"let item of page;let f = first;let l = last"
>
<ng-container
*
ngIf=
"item==3&¤tPage!=1&¤tPage!=2&¤tPage!=3"
>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
><i
class=
"ri-more-line"
></i>
</a>
</ng-container>
<ng-container
*
ngIf=
"(f||l)||(item==currentPage-1||item==currentPage||item==currentPage+1)"
>
<a
class=
"page-link"
href=
"javascript:void(0);"
[
class
.
active
]="
item=
=currentPage"
(
click
)="
currentPage=
item"
>
{{item}}
</a>
</ng-container>
<ng-container
*
ngIf=
"item==page.length-2&¤tPage!=page.length&¤tPage!=page.length-1&¤tPage!=page.length-2"
>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
><i
class=
"ri-more-line"
></i>
</a>
</ng-container>
</li>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage
>
page.length-1 ? currentPage: currentPage+1 )">
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<li>
<select
class=
"ti-form-select"
[(
ngModel
)]="
pageSize
"
(
ngModelChange
)="
searchChange
()"
>
<option
[
value
]="
10
"
>
10
</option>
<option
[
value
]="
20
"
>
20
</option>
<option
[
value
]="
50
"
>
50
</option>
<option
[
value
]="
100
"
>
100
</option>
</select>
</li>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{((currentPage-1) * pageSize)+1}} to {{(jobcodeFilter().length
<
pageSize
)
?
jobcodeFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
pageSize
)
-
((
currentPage
*
pageSize
)
-
jobcodeFilter
().
length
)
)
:
(
currentPage
*
pageSize
)
)
}}
of
{{
jobcodeFilter
().
length
}}
items
</
span
>
</ul>
</nav>
<app-pagination
[
totalItems
]="
jobcodeFilter
().
length
"
[
pageSize
]="
pageSize
"
(
pageChange
)="
currentPage =
$event"
(
pageSizeChange
)="
pageSize =
$event;currentPage
=
1
"
></app-pagination>
</div>
...
...
src/app/components/job-detail-components/job-detail-management/import-data/import-data.component.ts
View file @
26805bd3
...
...
@@ -441,4 +441,5 @@ export class ImportDataComponent {
modal
.
classList
.
add
(
"hidden"
);
// ซ่อน Modal
}
}
}
src/app/components/pagination/pagination.component.html
0 → 100644
View file @
26805bd3
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"totalItems > 0"
>
<ul
class=
"ti-pagination"
>
<!-- ปุ่มย้อนกลับ -->
<li>
<a
aria-label=
"Previous"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
changePage
(
currentPage
-
1
)"
>
<i
class=
"ri-arrow-left-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<!-- แสดงหมายเลขหน้า -->
<li
*
ngFor=
"let item of visiblePages"
>
<ng-container
*
ngIf=
"item === '...'"
>
<a
aria-label=
"More"
class=
"page-link"
href=
"javascript:void(0);"
>
<i
class=
"ri-more-line"
></i>
</a>
</ng-container>
<ng-container
*
ngIf=
"item !== '...'"
>
<a
class=
"page-link"
href=
"javascript:void(0);"
[
class
.
active
]="
item =
==
currentPage
"
(
click
)="
changePage
(
item
)"
>
{{ item }}
</a>
</ng-container>
</li>
<!-- ปุ่มถัดไป -->
<li>
<a
aria-label=
"Next"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
changePage
(
currentPage
+
1
)"
>
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<!-- ตัวเลือกจำนวนรายการต่อหน้า -->
<li>
<select
class=
"ti-form-select"
[(
ngModel
)]="
pageSize
"
(
ngModelChange
)="
onPageSizeChange
()"
>
<option
*
ngFor=
"let size of pageSizes"
[
value
]="
size
"
>
{{ size }}
</option>
</select>
</li>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{ (currentPage - 1) * pageSize + 1 }} to {{ getEndIndex() }} of {{ totalItems }} items
</span>
</ul>
</nav>
src/app/components/pagination/pagination.component.scss
0 → 100644
View file @
26805bd3
src/app/components/pagination/pagination.component.ts
0 → 100644
View file @
26805bd3
import
{
Component
,
Input
,
Output
,
EventEmitter
}
from
'@angular/core'
;
@
Component
({
selector
:
'app-pagination'
,
templateUrl
:
'./pagination.component.html'
,
styleUrls
:
[
'./pagination.component.scss'
]
})
export
class
PaginationComponent
{
@
Input
()
totalItems
=
0
;
@
Input
()
pageSize
=
10
;
@
Output
()
pageChange
=
new
EventEmitter
<
number
>
();
@
Output
()
pageSizeChange
=
new
EventEmitter
<
number
>
();
currentPage
=
1
;
pageSizes
=
[
10
,
20
,
50
,
100
];
get
totalPages
():
number
{
return
Math
.
ceil
(
this
.
totalItems
/
this
.
pageSize
);
}
get
visiblePages
():
(
number
|
string
)[]
{
const
total
=
this
.
totalPages
;
const
current
=
this
.
currentPage
;
const
pages
:
(
number
|
string
)[]
=
[];
if
(
total
<=
7
)
{
return
Array
.
from
({
length
:
total
},
(
_
,
i
)
=>
i
+
1
);
}
pages
.
push
(
1
);
if
(
current
>
3
)
pages
.
push
(
'...'
);
const
middlePages
=
[
current
-
1
,
current
,
current
+
1
].
filter
(
p
=>
p
>
1
&&
p
<
total
);
pages
.
push
(...
middlePages
);
if
(
current
<
total
-
2
)
pages
.
push
(
'...'
);
pages
.
push
(
total
);
return
pages
;
}
changePage
(
newPage
:
any
)
{
if
(
newPage
>=
1
&&
newPage
<=
this
.
totalPages
&&
newPage
!==
this
.
currentPage
)
{
this
.
currentPage
=
newPage
;
this
.
pageChange
.
emit
(
this
.
currentPage
);
}
}
onPageSizeChange
()
{
this
.
pageSizeChange
.
emit
(
this
.
pageSize
);
}
getEndIndex
():
number
{
return
Math
.
min
(
this
.
currentPage
*
this
.
pageSize
,
this
.
totalItems
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment