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
4b70dbad
Commit
4b70dbad
authored
Apr 18, 2025
by
Natthaphat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ทะเบียนเครื่องมือ > เครื่องมือประเมิน
ทะเบียนหลักสูตร > หลักสูตรการพัฒนา
parent
9fc248ab
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
364 additions
and
661 deletions
+364
-661
development-course.component.html
...tion/development-course/development-course.component.html
+59
-269
development-course.component.ts
...ration/development-course/development-course.component.ts
+117
-57
assessment-tool.component.html
...l-register/assessment-tool/assessment-tool.component.html
+52
-259
assessment-tool.component.ts
...ool-register/assessment-tool/assessment-tool.component.ts
+134
-74
assessment.service.ts
src/app/shared/services/assessment.service.ts
+1
-1
competencycourse.service.ts
src/app/shared/services/competencycourse.service.ts
+1
-1
No files found.
src/app/components/competency-assessment/course-registration/development-course/development-course.component.html
View file @
4b70dbad
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex"
>
<div
class=
"flex"
>
<div
class=
"flex items-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
[(
ngModel
)]="
isDataListChecked
"
>
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
{{numDataListChecked}} Selected
</label>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
id=
"checkbox"
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
</button>
<label
class=
"text-sm text-gray-500 ml-2"
for=
"checkbox"
>
Select All
</label>
</div>
</div>
</div>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
...
@@ -22,7 +9,7 @@
...
@@ -22,7 +9,7 @@
<div
class=
"relative shadow-md"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
style=
"height: 40px;"
>
[(
ngModel
)]="
search
"
style=
"height: 40px;"
>
<div
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
<i
class=
"ri-search-line text-gray"
></i>
...
@@ -40,226 +27,61 @@
...
@@ -40,226 +27,61 @@
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
data-hs-overlay=
"#development-course-modal"
(
click
)="
currentModal=
'add'
;
selectCompetencycourse
()"
>
(
click
)="
currentModal=
'add'
;
selectCompetencycourse
();
openDialog
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay=
"#development-course-alert-modal"
(
click
)="
currentModal=
'delete'
;
deleteDevelopmentCourse
()"
>
(
click
)="
currentModal=
'deleteGroup'
;
selectCompetencycourse
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
</div>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-10 m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<div
class=
"overflow-auto shadow-md rounded-t-md"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
<table
class=
"ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"
>
[
dataSource
]="
competencyCourse
.
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
<thead>
(
sendSelectData
)="
currentModal=
'edit'
;
selectCompetencycourse
($
event
);
openDialog
()"
<tr>
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
<ng-container
</app-datagrid-syncfution>
*
ngFor=
"let item of ['','รหัส','ชื่อหัวข้อ','การจัดการ']; let f = first; let l = last; let i = index"
>
<th
scope=
"col"
class=
"relative px-10px py-10px bg-soft-secondary text-primary !text-center"
>
<span
class=
"font-size-12px font-weight-700"
>
{{ item }}
</span>
<div
class=
"absolute top-1/2 transform -translate-y-1/2 right-0"
*
ngIf=
"!f&&!l"
>
<i
class=
"ti ti-dots-vertical fs-l"
></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"competencyCourse.loading"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<div
*
ngFor=
"let item of [1,2,3]"
class=
"ti-spinner w-8 h-8 text-secondary mx-1"
role=
"status"
aria-label=
"loading"
>
<span
class=
"sr-only"
>
Loading...
</span>
</div>
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!competencyCourse.loading&&!dataListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!competencyCourse.loading&&dataListFilter().length"
>
<tr
*
ngFor=
"let item of dataListFilter()| slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.competencyCourseId}}"
[(
ngModel
)]="
item
.
check
"
(
change
)="
dataListCheck
()"
>
</td>
<td
class=
"text-center"
>
<label
for=
"checkbox-{{item.data.competencyCourseId}}"
>
{{item.data.competencyCourseId}}
</label>
</td>
<td>
{{item.data.tdesc}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
currentModal=
'edit'
;
selectCompetencycourse
(
item
.
data
)"
data-hs-overlay=
"#development-course-modal"
></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
(click)="currentModal='delete' ;selectCompetencycourse(item.data)"
data-hs-overlay="#development-course-alert-modal"></i> -->
</td>
</tr>
</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>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{((currentPage-1) * 10)+1}} to {{dataListFilter().length
<10
?
dataListFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
10
)
-
((
currentPage
*
10
)
-
dataListFilter
().
length
)
)
:
(
currentPage
*
10
)
)
}}
of
{{
dataListFilter
().
length
}}
items
</
span
>
</ul>
</nav>
</div>
</div>
<div
id=
"development-course-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<ng-template
#
developmentCourseModal
let-modal
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
<h3
mat-dialog-title
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
{{currentModal=='add'?'เพิ่มหลักสูตรการพัฒนา':'แก้ไขหลักสูตรการพัฒนา'}}
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าหลักสูตรการพัฒนา
</h5>
</div>
<div
class=
"ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm"
>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2 p-2"
>
<div
class=
"flex rounded-md"
>
<input
#
fileInput
id=
"fileInput"
type=
"file"
(
change
)="
onFileSelected
($
event
)"
hidden
>
<input
type=
"text"
[
value
]="
selectedFileName
"
readonly
(
click
)="
fileInput
.
click
()"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer"
>
<button
type=
"button"
(
click
)="
fileInput
.
click
()"
class=
"inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem "
>
<h1
class=
"cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
text-center text-secondary border-secondary border-b-2 align-items-end"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</h1>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
data-hs-overlay=
"#type-registration-component-upload-modal"
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
<div
id=
"development-course-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='add'"
>
เพิ่มหลักสูตรการพัฒนา
</h3>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='edit'"
>
แก้ไขหลักสูตรการพัฒนา
</h3>
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"w-full flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<div
class=
"absolute flex"
>
data-hs-overlay=
"#development-course-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-center"
>
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
clearData
(
currentModal
)"
>
(
click
)="
selectCompetencycourse
()"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
<i
class=
"ti ti-eraser text-base"
></i>
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
stroke=
"#595BEA"
stroke-width=
"3.84"
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
<g
id=
"SVGRepo_bgCarrier"
stroke-width=
"0"
></g>
<g
id=
"SVGRepo_tracerCarrier"
stroke-linecap=
"round"
stroke-linejoin=
"round"
></g>
<g
id=
"SVGRepo_iconCarrier"
>
<path
d=
"M15 49A24 24 0 0 1 32 8"
></path>
<path
d=
"M49 15a24 24 0 0 1-17 41"
></path>
<polyline
points=
"15.03 40 15.03 48.97 8 48.97"
></polyline>
<polyline
points=
"48.97 24 48.97 15.03 56 15.03"
></polyline>
</g>
</svg>
Clear
Clear
</button>
</button>
</div>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
</div>
</div>
<div
class=
"ti-modal-body mt-1"
>
<mat-dialog-content>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสหลักสูตร
<span
class=
"text-danger"
>
*
<ng-container
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสหลักสูตร
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"checkPrimary()&¤tModal=='add'"
>
รหัสหลักสูตรซ้ำ
รหัสหลักสูตรซ้ำ
</ng-container></span></label>
</ng-container>
</span>
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
competencyCourse
.
select
.
competencyCourseId
"
>
[(
ngModel
)]="
competencyCourse
.
select
.
competencyCourseId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (ไทย)
<span
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-10"
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-10"
[(
ngModel
)]="
competencyCourse
.
select
.
tdesc
"
>
[(
ngModel
)]="
competencyCourse
.
select
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (อังกฤษ)
</label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-10"
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-10"
[(
ngModel
)]="
competencyCourse
.
select
.
edesc
"
>
[(
ngModel
)]="
competencyCourse
.
select
.
edesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
วัตถุประสงค์
</label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
วัตถุประสงค์
</label>
<textarea
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
rows=
"4"
cols=
"50"
<textarea
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
rows=
"4"
cols=
"50"
[(
ngModel
)]="
competencyCourse
.
select
.
courseDetail
"
>
</textarea>
[(
ngModel
)]="
competencyCourse
.
select
.
courseDetail
"
>
</textarea>
...
@@ -268,83 +90,51 @@
...
@@ -268,83 +90,51 @@
[(
ngModel
)]="
competencyCourse
.
select
.
courseTopic
"
>
</textarea>
[(
ngModel
)]="
competencyCourse
.
select
.
courseTopic
"
>
</textarea>
<label
class=
"ti-form-label mt-2rem"
>
Link myLearn
</label>
<label
class=
"ti-form-label mt-2rem"
>
Link myLearn
</label>
<input
type=
"text"
class=
"ti-form-input h-10"
[(
ngModel
)]="
competencyCourse
.
select
.
courseLinkMylearn
"
>
<input
type=
"text"
class=
"ti-form-input h-10"
[(
ngModel
)]="
competencyCourse
.
select
.
courseLinkMylearn
"
>
<div
class=
"flex justify-end mt-3rem mb-1rem space-x-4"
>
</mat-dialog-content
>
<button
type=
"button"
<mat-dialog-actions
align=
"end"
>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
<button
type=
"button"
mat-button
[
mat-dialog-close
]
data-hs-overlay=
"#development-course-modal
"
>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10
"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
(
click
)="
addDevelopmentCourse
()"
data-hs-overlay=
"#development-course-alert-modal"
[
class
.
ti-btn-disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
class
.
ti-btn-disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
[
disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div>
</mat-dialog-actions>
</div>
</ng-template>
</div>
</div>
</div>
<div
id=
"development-course-alert-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"development-course-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content w-full"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<div
class=
"ti-modal-header"
>
<h5
class=
"text-xxl font-bold text-white"
>
<h3
class=
"text-xxl font-bold text-primary"
>
นำเข้าหลักสูตรการพัฒนา
แจ้งเตือน
</h5>
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
data-hs-overlay=
"#development-course-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
data-hs-overlay=
"#development-course-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
</div>
<div
class=
"ti-modal-body "
>
<div
class=
"ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm"
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
ยืนยันการบันทึกข้อมูลหรือไม่
<div
class=
"mt-2 p-2"
>
</p>
<div
class=
"flex rounded-md"
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
<input
#
fileInput
id=
"fileInput"
type=
"file"
(
change
)="
onFileSelected
($
event
)"
hidden
>
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
<input
type=
"text"
[
value
]="
selectedFileName
"
readonly
(
click
)="
fileInput
.
click
()"
<ng-container
*
ngIf=
"numDataListChecked"
>
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer"
>
ยืนยันการลบข้อมูลหรือไม่
<button
type=
"button"
(
click
)="
fileInput
.
click
()"
</ng-container>
class=
"inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm"
>
<ng-container
*
ngIf=
"!numDataListChecked"
>
<i
class=
"ti ti-upload"
></i>
เลือกข้อมูลที่ต้องการลบ
</ng-container>
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#development-course-modal"
>
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-modal"
(
click
)="
updateCompetencyCourse
('
post
')"
>
บันทึกข้อมูล
</a>
</div>
</div>
<div
class=
"flex justify-end mt-2rem mb-1rem"
<div
class=
"flex justify-center mt-2rem "
>
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
<h1
class=
"cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
<button
type=
"button"
text-center text-secondary border-secondary border-b-2 align-items-end"
(
click
)="
downloadFile
()"
>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
ดาวน์โหลดตัวอย่างไฟล์
</h1>
data-hs-overlay=
"#development-course-alert-modal"
>
</div>
ย้อนกลับ
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
data-hs-overlay=
"#type-registration-component-upload-modal"
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-modal"
(
click
)="
updateCompetencyCourse
('
delete
')"
*
ngIf=
"numDataListChecked"
>
ลบข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/components/competency-assessment/course-registration/development-course/development-course.component.ts
View file @
4b70dbad
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
,
ViewChild
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
CompetencyCourseModel
,
MyCompetencyCourseModel
}
from
'src/app/shared/model/competency-course.model'
;
import
{
CompetencyCourseModel
,
MyCompetencyCourseModel
}
from
'src/app/shared/model/competency-course.model'
;
import
{
MyCompetencycourseModel
}
from
'src/app/shared/model/competencycourse.model'
;
import
{
MyCompetencycourseModel
}
from
'src/app/shared/model/competencycourse.model'
;
import
{
CompetencycourseService
}
from
'src/app/shared/services/competencycourse.service'
;
import
{
CompetencycourseService
}
from
'src/app/shared/services/competencycourse.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
@
Component
({
@
Component
({
selector
:
'app-development-course'
,
selector
:
'app-development-course'
,
templateUrl
:
'./development-course.component.html'
,
templateUrl
:
'./development-course.component.html'
,
...
@@ -12,17 +15,40 @@ import { FileService } from 'src/app/shared/services/file.service';
...
@@ -12,17 +15,40 @@ import { FileService } from 'src/app/shared/services/file.service';
export
class
DevelopmentCourseComponent
{
export
class
DevelopmentCourseComponent
{
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
currentModal
:
'add'
|
'edit'
|
'delete'
|
'deleteGroup'
=
"add"
;
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
;
competencyCourse
:
{
loading
:
boolean
,
select
:
CompetencyCourseModel
,
dataList
:
{
check
:
boolean
,
data
:
CompetencyCourseModel
}
[]
}
=
{
loading
:
false
,
select
:
new
MyCompetencyCourseModel
(),
dataList
:
[]
}
competencyCourse
:
{
loading
:
boolean
,
select
:
CompetencyCourseModel
,
dataList
:
CompetencyCourseModel
[]
}
=
{
loading
:
false
,
select
:
new
MyCompetencyCourseModel
(),
dataList
:
[]
}
numDataListChecked
=
0
numDataListChecked
=
0
isDataListChecked
=
false
isDataListChecked
=
false
isDataListCheckedAll
=
false
isDataListCheckedAll
=
false
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
columns
:
ColumnModel
[]
=
[{
field
:
"competencyCourseId"
,
headerText
:
"รหัส"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ชื่อเครื่องมือประเมิน"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'competencyCourseId'
,
'tdesc'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"developmentCourseModal"
)
developmentCourseModal
:
any
;
dialogRef
:
any
constructor
(
private
toastr
:
ToastrService
,
constructor
(
private
toastr
:
ToastrService
,
private
dialog
:
MatDialog
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
competencycourseService
:
CompetencycourseService
,
private
competencycourseService
:
CompetencycourseService
,
private
fileService
:
FileService
private
fileService
:
FileService
...
@@ -80,13 +106,16 @@ export class DevelopmentCourseComponent {
...
@@ -80,13 +106,16 @@ export class DevelopmentCourseComponent {
getCompetencycourseList
()
{
getCompetencycourseList
()
{
this
.
competencyCourse
.
loading
=
true
this
.
competencyCourse
.
loading
=
true
this
.
selectedItems
.
data
.
clear
()
this
.
competencycourseService
.
getList
().
subscribe
({
this
.
competencycourseService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
competencyCourse
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyCompetencyCourseModel
(
x
)
}))
this
.
competencyCourse
.
dataList
=
response
.
map
(
x
=>
{
this
.
selectedItems
.
data
.
set
(
x
.
competencyCourseId
,
false
)
return
new
MyCompetencyCourseModel
(
x
)
})
this
.
selectedItems
.
key
=
'competencyCourseId'
this
.
selectedItems
.
count
=
0
this
.
competencyCourse
.
loading
=
false
this
.
competencyCourse
.
loading
=
false
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
competencyCourse
.
loading
=
false
this
.
competencyCourse
.
loading
=
false
...
@@ -94,85 +123,116 @@ export class DevelopmentCourseComponent {
...
@@ -94,85 +123,116 @@ export class DevelopmentCourseComponent {
}
}
})
})
}
}
searchChange
()
{
this
.
currentPage
=
1
selectCompetencycourse
(
competencyCourse
?:
CompetencyCourseModel
)
{
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
if
(
competencyCourse
)
{
this
.
dataListCheck
()
this
.
competencyCourse
.
select
=
new
MyCompetencyCourseModel
(
competencyCourse
)
}
}
else
if
(
this
.
currentModal
==
'add'
)
{
dataListFilter
()
{
this
.
competencyCourse
.
select
=
new
MyCompetencyCourseModel
()
return
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
{
}
else
if
(
this
.
currentModal
==
'edit'
)
{
const
data
=
x
.
data
this
.
competencyCourse
.
select
=
new
MyCompetencyCourseModel
({
competencyCourseId
:
this
.
competencyCourse
.
select
.
competencyCourseId
})
const
match
=
data
.
competencyCourseId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
return
match
;
});
}
}
selectCompetencycourse
(
data
?:
CompetencyCourseModel
)
{
this
.
competencyCourse
.
select
=
new
MyCompetencyCourseModel
(
data
)
}
}
updateCompetencyCourse
(
typeApi
:
'post'
|
'delete'
)
{
addDevelopmentCourse
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'บันทึกข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
competencyCourse
.
loading
=
true
this
.
competencyCourse
.
loading
=
true
let
body
:
CompetencyCourseModel
|
CompetencyCourseModel
[]
this
.
competencycourseService
.
post
(
this
.
competencyCourse
.
select
).
subscribe
({
switch
(
this
.
currentModal
)
{
next
:
response
=>
{
case
(
'deleteGroup'
):
{
if
(
response
.
success
)
{
body
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyCompetencyCourseModel
(
x
.
data
))
this
.
showAlert
(
response
.
message
,
'success'
)
break
;
this
.
getCompetencycourseList
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
}
}
default
:
{
},
error
:
error
=>
{
body
=
new
MyCompetencyCourseModel
(
this
.
competencyCourse
.
select
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
}
}
})
}
}
this
.
competencycourseService
[
typeApi
]((
body
as
any
)).
subscribe
({
})
}
deleteDevelopmentCourse
()
{
if
(
!
this
.
numSelectItem
())
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่ต้องการลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
competencyCourse
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
competencyCourseId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
competencyCourseId
)).
map
(
x
=>
new
MyCompetencyCourseModel
(
x
))
this
.
competencycourseService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencycourseList
()
this
.
getCompetencycourseList
()
this
.
searchChange
()
this
.
closeDialog
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
this
.
competencyCourse
.
loading
=
false
}
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
this
.
competencyCourse
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
});
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
Swal
.
fire
({
timeOut
:
3000
,
title
:
'แจ้งเตือน'
,
positionClass
:
'toast-top-right'
,
text
:
text
,
})
icon
:
type
,
confirmButtonText
:
'ตกลง'
,
});
}
}
dataListCheckAll
()
{
checkPrimary
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
return
this
.
competencyCourse
.
dataList
.
find
(
x
=>
x
.
competencyCourseId
==
this
.
competencyCourse
.
select
.
competencyCourseId
)
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
competencyCourseId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
return
match
;
}).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
}
dataListCheck
()
{
onSelectItemChange
(
arg
:
any
)
{
const
dataCheck
=
this
.
dataListFilter
();
this
.
selectedItems
=
arg
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
x
.
check
).
length
;
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
}
clearData
(
modalStatus
:
string
)
{
numSelectItem
()
{
if
(
modalStatus
==
'add'
)
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
this
.
selectCompetencycourse
()
const
num
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
competencyCourseId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
competencyCourseId
)).
length
}
else
if
(
modalStatus
==
'edit'
)
{
return
num
this
.
selectCompetencycourse
(
new
MyCompetencyCourseModel
({
competencyCourseId
:
this
.
competencyCourse
.
select
.
competencyCourseId
}))
}
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
developmentCourseModal
,
{
width
:
'500px'
,
disableClose
:
false
,
});
}
}
c
heckPrimary
()
{
c
loseDialog
()
{
return
this
.
competencyCourse
.
dataList
.
find
(
x
=>
x
.
data
.
competencyCourseId
==
this
.
competencyCourse
.
select
.
competencyCourseId
)
this
.
dialogRef
.
close
(
)
}
}
}
}
src/app/components/competency-assessment/tool-register/assessment-tool/assessment-tool.component.html
View file @
4b70dbad
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex"
>
<div
class=
"flex"
>
<div
class=
"flex items-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
[(
ngModel
)]="
isDataListChecked
"
>
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
{{numDataListChecked}} Selected
</label>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
id=
"checkbox"
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
</button>
<label
class=
"text-sm text-gray-500 ml-2"
for=
"checkbox"
>
Select All
</label>
</div>
</div>
</div>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
...
@@ -22,7 +9,7 @@
...
@@ -22,7 +9,7 @@
<div
class=
"relative shadow-md"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
style=
"height: 40px;"
>
[(
ngModel
)]="
search
"
style=
"height: 40px;"
>
<div
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
<i
class=
"ri-search-line text-gray"
></i>
...
@@ -40,7 +27,7 @@
...
@@ -40,7 +27,7 @@
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
data-hs-overlay=
"#assessment-tool-modal"
(
click
)="
currentModal=
'add'
;
selectAssessment
()"
>
(
click
)="
currentModal=
'add'
;
selectAssessment
();
openDialog
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
...
@@ -48,119 +35,68 @@
...
@@ -48,119 +35,68 @@
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay=
"#assessment-tool-alert-modal"
data-hs-overlay=
"#assessment-tool-alert-modal"
(
click
)="
currentModal=
'delete
Group'
;
select
Assessment
()"
>
(
click
)="
currentModal=
'delete
'
;
delete
Assessment
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
</div>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-10 m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<div
class=
"overflow-auto shadow-md rounded-t-md"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
assessment
.
dataList
"
<table
class=
"ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"
>
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
<thead>
(
sendSelectData
)="
currentModal=
'edit'
;
selectAssessment
($
event
);
openDialog
()"
<tr>
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
<ng-container
</app-datagrid-syncfution>
*
ngFor=
"let item of ['','รหัส','ชื่อเครื่องมือประเมิน','ชื่อที่เเสดง','การจัดการ']; let f = first; let l = last; let i = index"
>
</div>
<th
scope=
"col"
class=
"relative px-10px py-10px bg-soft-secondary text-primary !text-center"
>
<span
class=
"font-size-12px font-weight-700"
>
{{ item }}
</span>
<ng-template
#
AssessmentModal
let-modal
>
<div
class=
"absolute top-1/2 transform -translate-y-1/2 right-0"
*
ngIf=
"!f&&!l"
>
<h3
mat-dialog-title
>
<i
class=
"ti ti-dots-vertical fs-l"
></i>
{{currentModal=='add'?'เพิ่มเครื่องมือประเมิน':'แก้ไขเครื่องมือประเมิน'}}
</h3>
<div
class=
"w-full flex justify-end"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectAssessment
()"
>
<i
class=
"ti ti-eraser text-base"
></i>
Clear
</button>
</div>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"assessment.loading"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<div
*
ngFor=
"let item of [1,2,3]"
class=
"ti-spinner w-8 h-8 text-secondary mx-1"
role=
"status"
aria-label=
"loading"
>
<span
class=
"sr-only"
>
Loading...
</span>
</div>
</div>
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!assessment.loading&&!assessmentListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!assessment.loading&&assessmentListFilter().length"
>
<tr
*
ngFor=
"let item of assessmentListFilter()| slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.assessmentId}}"
[(
ngModel
)]="
item
.
check
"
(
ngModelChange
)="
dataListCheck
()"
>
</td>
<td
class=
"text-center"
>
<label
for=
"checkbox-{{item.data.assessmentId}}"
>
{{item.data.assessmentId}}
</label>
</td>
<td>
{{item.data.tdesc}}
</td>
<td
class=
"text-center"
>
{{item.data.shortName}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#assessment-tool-modal"
(
click
)="
currentModal=
'edit'
;
selectAssessment
(
item
.
data
)"
></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
data-hs-overlay="#assessment-tool-alert-modal"
(click)="currentModal='delete';selectAssessment(item.data)"></i> -->
</td>
</tr>
</tbody>
</table>
</div>
</div>
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"page.length"
>
<mat-dialog-content>
<ul
class=
"ti-pagination"
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัส
<li>
<span
class=
"text-danger"
>
*
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
<ng-container
*
ngIf=
"checkPrimary()&¤tModal=='add'"
>
(
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>
</ng-container>
</li>
</span>
<li>
</label>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
(
click
)="
currentPage =
(currentPage
>
page.length-1 ? currentPage: currentPage+1 )">
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
[(
ngModel
)]="
assessment
.
select
.
assessmentId
"
>
</a>
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อเครื่องมือประเมิน (ไทย)
<span
</li>
class=
"text-danger"
>
*
</span></label>
</ul>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
tdesc
"
>
<ul
class=
"nav-tabs mt-3"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อเครื่องมือประเมิน (อังกฤษ)
</label>
<span>
Show {{((currentPage-1) * 10)+1}} to {{assessmentListFilter().length
<10
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
edesc
"
>
?
assessmentListFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
10
)
-
((
currentPage
*
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อที่ใช้เเสดง
<span
class=
"text-danger"
>
*
</span></label>
10
)
-
assessmentListFilter
().
length
)
)
:
(
currentPage
*
10
)
)
}}
of
{{
assessmentListFilter
().
length
}}
<input
type=
"text"
id=
"showname"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
shortName
"
>
items
</
span
>
</mat-dialog-content>
</ul>
<mat-dialog-actions
align=
"end"
>
</nav>
<button
type=
"button"
mat-button
[
mat-dialog-close
]
</div>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
(
click
)="
addAssessment
()"
[
class
.
ti-btn-disabled
]="!
assessment
.
select
.
assessmentId
||!
assessment
.
select
.
tdesc
||!
assessment
.
select
.
shortName
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
assessment
.
select
.
assessmentId
||!
assessment
.
select
.
tdesc
||!
assessment
.
select
.
shortName
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</mat-dialog-actions>
</ng-template>
<div
id=
"assessment-tool-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"assessment-tool-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
...
@@ -197,145 +133,3 @@
...
@@ -197,145 +133,3 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
id=
"assessment-tool-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='add'"
>
เพิ่มเครื่องมือประเมิน
</h3>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='edit'"
>
แก้ไขเครื่องมือประเมิน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#assessment-tool-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-center"
>
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
clearAssessment
(
currentModal
)"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
stroke=
"#595BEA"
stroke-width=
"3.84"
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
<g
id=
"SVGRepo_bgCarrier"
stroke-width=
"0"
></g>
<g
id=
"SVGRepo_tracerCarrier"
stroke-linecap=
"round"
stroke-linejoin=
"round"
></g>
<g
id=
"SVGRepo_iconCarrier"
>
<path
d=
"M15 49A24 24 0 0 1 32 8"
></path>
<path
d=
"M49 15a24 24 0 0 1-17 41"
></path>
<polyline
points=
"15.03 40 15.03 48.97 8 48.97"
></polyline>
<polyline
points=
"48.97 24 48.97 15.03 56 15.03"
></polyline>
</g>
</svg>
Clear
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
<div
class=
"ti-modal-body"
style=
"padding-top: 0px;"
>
<label
for=
"input-label"
class=
"ti-form-label mt-1rem"
>
รหัส
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
รหัสซ้ำ
</ng-container></span></label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
assessment
.
select
.
assessmentId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อเครื่องมือประเมิน (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อเครื่องมือประเมิน (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
edesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อที่ใช้เเสดง
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"showname"
class=
"ti-form-input w-full"
[(
ngModel
)]="
assessment
.
select
.
shortName
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#assessment-tool-modal"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#assessment-tool-alert-modal"
[
class
.
ti-btn-disabled
]="!
assessment
.
select
.
assessmentId
||!
assessment
.
select
.
tdesc
||!
assessment
.
select
.
shortName
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
assessment
.
select
.
assessmentId
||!
assessment
.
select
.
tdesc
||!
assessment
.
select
.
shortName
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
<div
id=
"assessment-tool-alert-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content w-full"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#assessment-tool-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
<div
class=
"flex justify-end"
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#assessment-tool-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
<ng-container
*
ngIf=
"numDataListChecked"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"!numDataListChecked"
>
เลือกข้อมูลที่ต้องการลบ
</ng-container>
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#assessment-tool-modal"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#assessment-tool-alert-modal"
(
click
)="
updateAssessment
('
post
')"
>
บันทึกข้อมูล
</button>
</div>
<div
class=
"flex justify-end mt-2rem mb-1rem"
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#assessment-tool-alert-modal"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-danger"
data-hs-overlay=
"#assessment-tool-alert-modal"
*
ngIf=
"numDataListChecked"
(
click
)="
updateAssessment
('
delete
')"
>
ลบข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/components/competency-assessment/tool-register/assessment-tool/assessment-tool.component.ts
View file @
4b70dbad
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
,
ViewChild
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
AssessmentModel
,
MyAssessmentModel
}
from
'src/app/shared/model/assessment.model'
;
import
{
AssessmentModel
,
MyAssessmentModel
}
from
'src/app/shared/model/assessment.model'
;
import
{
AssessmentService
}
from
'src/app/shared/services/assessment.service'
;
import
{
AssessmentService
}
from
'src/app/shared/services/assessment.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
import
{
data
}
from
'../../../datagrid-syncfution/data'
;
id
:
string
import
Swal
from
'sweetalert2'
;
name
:
string
edesc
:
string
code
:
string
checked
:
boolean
}
@
Component
({
@
Component
({
selector
:
'app-assessment-tool'
,
selector
:
'app-assessment-tool'
,
templateUrl
:
'./assessment-tool.component.html'
,
templateUrl
:
'./assessment-tool.component.html'
,
...
@@ -18,17 +16,46 @@ export interface DataModel {
...
@@ -18,17 +16,46 @@ export interface DataModel {
export
class
AssessmentToolComponent
{
export
class
AssessmentToolComponent
{
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
numDataListChecked
=
0
numDataListChecked
=
0
isDataListChecked
=
false
isDataListChecked
=
false
isDataListCheckedAll
=
false
isDataListCheckedAll
=
false
assessment
:
{
loading
:
boolean
,
select
:
AssessmentModel
,
dataList
:
{
check
:
boolean
,
data
:
AssessmentModel
}[]
}
=
{
loading
:
false
,
select
:
new
MyAssessmentModel
(),
dataList
:
[]
}
assessment
:
{
loading
:
boolean
,
select
:
AssessmentModel
,
dataList
:
AssessmentModel
[]
}
=
{
loading
:
false
,
select
:
new
MyAssessmentModel
(),
dataList
:
[]
}
currentModal
:
'add'
|
'edit'
|
'delete'
|
'deleteGroup'
=
"add"
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
columns
:
ColumnModel
[]
=
[{
field
:
"assessmentId"
,
headerText
:
"รหัส"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ชื่อเครื่องมือประเมิน"
,
type
:
"string"
},
{
field
:
"shortName"
,
headerText
:
"ชื่อที่เเสดง"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'assessmentId'
,
'tdesc'
,
'shortName'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"AssessmentModal"
)
AssessmentModal
:
any
;
dialogRef
:
any
constructor
(
private
toastr
:
ToastrService
,
constructor
(
private
toastr
:
ToastrService
,
private
dialog
:
MatDialog
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
assessmentService
:
AssessmentService
,
private
assessmentService
:
AssessmentService
,
private
fileService
:
FileService
private
fileService
:
FileService
...
@@ -85,104 +112,137 @@ export class AssessmentToolComponent {
...
@@ -85,104 +112,137 @@ export class AssessmentToolComponent {
}
}
getAssessmentList
()
{
getAssessmentList
()
{
this
.
assessment
.
loading
=
true
this
.
assessment
.
loading
=
true
this
.
selectedItems
.
data
.
clear
()
this
.
assessmentService
.
getList
().
subscribe
({
this
.
assessmentService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
assessment
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyAssessmentModel
(
x
)
}))
this
.
assessment
.
dataList
=
response
.
map
(
x
=>
{
this
.
isDataListCheckedAll
=
false
this
.
selectedItems
.
data
.
set
(
x
.
assessmentId
,
false
)
this
.
dataListCheckAll
()
return
new
MyAssessmentModel
(
x
)
})
this
.
selectedItems
.
key
=
'assessmentId'
this
.
selectedItems
.
count
=
0
this
.
assessment
.
loading
=
false
this
.
assessment
.
loading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
assessment
.
loading
=
false
this
.
assessment
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
assessmentListFilter
()
{
return
this
.
assessment
.
dataList
.
filter
(
x
=>
{
selectAssessment
(
assessment
?:
AssessmentModel
)
{
const
data
=
x
.
data
if
(
assessment
)
{
const
match
=
data
.
assessmentId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
this
.
assessment
.
select
=
new
MyAssessmentModel
(
assessment
)
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
}
else
if
(
this
.
currentModal
==
'add'
)
{
data
.
shortName
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
this
.
assessment
.
select
=
new
MyAssessmentModel
()
return
match
}
else
if
(
this
.
currentModal
==
'edit'
)
{
})
this
.
assessment
.
select
=
new
MyAssessmentModel
({
assessmentId
:
this
.
assessment
.
select
.
assessmentId
})
}
selectAssessment
(
data
?:
AssessmentModel
)
{
this
.
assessment
.
select
=
new
MyAssessmentModel
(
data
)
}
}
clearAssessment
(
currentModal
:
string
)
{
if
(
currentModal
==
'add'
)
{
this
.
selectAssessment
()
}
else
if
(
currentModal
==
'edit'
)
{
this
.
selectAssessment
(
new
MyAssessmentModel
({
assessmentId
:
this
.
assessment
.
select
.
assessmentId
}))
}
}
addAssessment
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'บันทึกข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
assessment
.
loading
=
true
this
.
assessmentService
.
post
(
this
.
assessment
.
select
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getAssessmentList
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
assessment
.
loading
=
false
}
}
searchChange
()
{
},
error
:
error
=>
{
this
.
currentPage
=
1
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
assessmentListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
assessment
.
loading
=
false
this
.
dataListCheck
()
}
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
})
}
}
updateAssessment
(
typeApi
:
'post'
|
'delete'
)
{
})
this
.
assessment
.
loading
=
true
let
body
:
AssessmentModel
|
AssessmentModel
[]
switch
(
this
.
currentModal
)
{
case
(
'delete'
):
{
body
=
new
MyAssessmentModel
(
this
.
assessment
.
select
)
break
;
}
case
(
'deleteGroup'
):
{
body
=
this
.
assessment
.
dataList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyAssessmentModel
(
x
.
data
))
break
;
}
default
:
{
body
=
new
MyAssessmentModel
(
this
.
assessment
.
select
)
}
}
deleteAssessment
()
{
if
(
!
this
.
numSelectItem
())
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่ต้องการลบ'
,
'error'
)
return
}
}
this
.
assessmentService
[
typeApi
]((
body
as
any
)).
subscribe
({
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
assessment
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
assessment
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
assessmentId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
assessmentId
)).
map
(
x
=>
new
MyAssessmentModel
(
x
))
this
.
assessmentService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getAssessmentList
()
this
.
getAssessmentList
()
this
.
searchChange
()
this
.
closeDialog
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
assessment
.
loading
=
false
this
.
assessment
.
loading
=
false
}
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
assessment
.
loading
=
false
this
.
assessment
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
dataListCheckAll
()
{
});
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
assessment
.
dataList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
assessmentId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
shortName
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
return
match
}).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
}
dataListCheck
()
{
const
dataCheck
=
this
.
assessmentListFilter
();
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
Swal
.
fire
({
this
.
numDataListChecked
=
this
.
assessment
.
dataList
.
filter
(
x
=>
x
.
check
).
length
;
title
:
'แจ้งเตือน'
,
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
text
:
text
,
icon
:
type
,
confirmButtonText
:
'ตกลง'
,
});
}
}
checkPrimary
()
{
checkPrimary
()
{
return
this
.
assessment
.
dataList
.
find
(
x
=>
x
.
data
.
assessmentId
==
this
.
assessment
.
select
.
assessmentId
)
return
this
.
assessment
.
dataList
.
find
(
x
=>
x
.
assessmentId
==
this
.
assessment
.
select
.
assessmentId
)
}
onSelectItemChange
(
arg
:
any
)
{
this
.
selectedItems
=
arg
}
numSelectItem
()
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
assessment
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
assessmentId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
assessmentId
)).
length
return
num
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
AssessmentModal
,
{
width
:
'500px'
,
disableClose
:
false
,
});
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
}
}
}
src/app/shared/services/assessment.service.ts
View file @
4b70dbad
...
@@ -21,7 +21,7 @@ export class AssessmentService {
...
@@ -21,7 +21,7 @@ export class AssessmentService {
post
(
body
:
AssessmentModel
):
Observable
<
AlertModel
>
{
post
(
body
:
AssessmentModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
}
delete
(
body
:
AssessmentModel
):
Observable
<
AlertModel
>
{
delete
(
body
:
AssessmentModel
|
AssessmentModel
[]
):
Observable
<
AlertModel
>
{
const
options
=
{
const
options
=
{
headers
:
new
HttpHeaders
({
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
...
...
src/app/shared/services/competencycourse.service.ts
View file @
4b70dbad
...
@@ -25,7 +25,7 @@ export class CompetencycourseService {
...
@@ -25,7 +25,7 @@ export class CompetencycourseService {
post
(
body
:
CompetencycourseModel
):
Observable
<
AlertModel
>
{
post
(
body
:
CompetencycourseModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
}
delete
(
body
:
CompetencycourseModel
):
Observable
<
AlertModel
>
{
delete
(
body
:
CompetencycourseModel
|
CompetencycourseModel
[]
):
Observable
<
AlertModel
>
{
const
options
=
{
const
options
=
{
headers
:
new
HttpHeaders
({
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
...
...
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