Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myAppraisal
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
myAppraisal
Commits
8a0f2a39
Commit
8a0f2a39
authored
Feb 19, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ทะเบียนหลักสูตร
parent
cec1bf1a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
270 additions
and
318 deletions
+270
-318
manage-user.component.html
...s/account-settings/manage-user/manage-user.component.html
+2
-1
course-registration.component.html
...nt/course-registration/course-registration.component.html
+4
-4
development-course.component.html
...tion/development-course/development-course.component.html
+127
-184
development-course.component.ts
...ration/development-course/development-course.component.ts
+121
-118
competency-course.model.ts
src/app/shared/model/competency-course.model.ts
+10
-7
competencycourse.service.ts
src/app/shared/services/competencycourse.service.ts
+6
-4
No files found.
src/app/components/company-components/account-settings/manage-user/manage-user.component.html
View file @
8a0f2a39
...
@@ -62,7 +62,8 @@
...
@@ -62,7 +62,8 @@
<td>
{{item.data.employee.lname}}
</td>
<td>
{{item.data.employee.lname}}
</td>
<td
class=
"text-center"
>
{{item.data.status=='0'?'ไม่ใช้งาน':'ใช้งาน'}}
</td>
<td
class=
"text-center"
>
{{item.data.status=='0'?'ไม่ใช้งาน':'ใช้งาน'}}
</td>
<td
class=
"flex justify-center"
>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectUser
(
item
.
data
)"
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
changePassword=
false;selectUser(item.data)"
data-hs-overlay=
"#manage-user-modal"
></i>
data-hs-overlay=
"#manage-user-modal"
></i>
</td>
</td>
</tr>
</tr>
...
...
src/app/components/competency-assessment/course-registration/course-registration.component.html
View file @
8a0f2a39
...
@@ -10,15 +10,15 @@
...
@@ -10,15 +10,15 @@
<nav
class=
"-mb-0.5 flex space-x-6 rtl:space-x-reverse"
>
<nav
class=
"-mb-0.5 flex space-x-6 rtl:space-x-reverse"
>
<a
class=
"text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
<a
class=
"text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href=
"javascript:void(0);"
id=
"underline-item-1"
data-hs-tab=
"#underline-1"
href=
"javascript:void(0);"
id=
"underline-item-1"
data-hs-tab=
"#underline-1"
aria-controls=
"underline-1"
(
click
)="
pathTitle =
['การประเมินสมรรถนะ','ทะเบียนหลักสูตร','หลักสูตรการพัฒนา']"
>
aria-controls=
"underline-1"
(
click
)="
pathTitle =
['การประเมินสมรรถนะ','ทะเบียนหลักสูตร','หลักสูตรการพัฒนา']"
>
หลักสูตรการพัฒนา
หลักสูตรการพัฒนา
</a>
</a>
</nav>
</nav>
</div>
</div>
<div
class=
"mt-3 px-
3
rem !-mt-3 pt-50px"
>
<div
class=
"mt-3 px-
2
rem !-mt-3 pt-50px"
>
<div
id=
"underline-1"
role=
"tabpanel"
aria-labelledby=
"underline-item-1"
>
<div
id=
"underline-1"
role=
"tabpanel"
aria-labelledby=
"underline-item-1"
>
<app-development-course
[
pathTitle
]="
pathTitle
"
<app-development-course></app-development-course>
(
sendPathTitle
)="
pathTitle=
$event"
></app-development-course>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/components/competency-assessment/course-registration/development-course/development-course.component.html
View file @
8a0f2a39
<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 pr-2"
>
<div
class=
"flex"
>
<!-- Content ของ div แรก -->
<div
class=
"flex items-center"
>
<div
class=
"flex gap-x-6"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
<div
class=
"flex items-center"
>
[(
ngModel
)]="
isDataListChecked
"
>
<label
for=
"hs-checkbox-group-1"
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
{{mockDataSelect.length}}
{{numDataListChecked}} Selected
</label>
Selected
</label>
</div>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
<div
class=
"flex items-center"
>
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
(
click
)="
toggleCheckbox
()"
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
'
:
!
isChecked
,
'
ri-checkbox-multiple-fill
'
:
isChecked
}"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
class=
"ri-checkbox-multiple-line text-gray-500 dark:text-white/70"
></i>
</button>
<label
for=
"hs-checkbox-group-2"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
<label
class=
"text-sm text-gray-500 ml-2"
>
Select All
</label>
(
click
)="
toggleCheckbox
()"
>
Select All
</label>
</div>
</div>
</div>
</div>
</div>
...
@@ -35,28 +32,26 @@
...
@@ -35,28 +32,26 @@
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
<button
type=
"button"
class=
"ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
class=
"ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay=
"#development-course-modal-add"
>
data-hs-overlay=
"#development-course-upload-modal"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
<i
class=
"ti ti-file-plus"
></i>
<i
class=
"ti ti-file-plus"
></i>
import
import
</button>
</button>
</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
-add"
(
click
)="
selectCompetencycourse
()"
>
data-hs-overlay=
"#development-course-modal
"
(
click
)="
currentModal=
'add'
;
selectCompetencycourse
()"
>
<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=
'deleteGroup'
;
selectCompetencycourse
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
<!-- <button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay="#development-course-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button> -->
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-10 m-0 shadow-md"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-10 m-0 shadow-md"
>
...
@@ -85,7 +80,7 @@
...
@@ -85,7 +80,7 @@
</ng-container>
</ng-container>
</tr>
</tr>
</thead>
</thead>
<tbody
*
ngIf=
"
dataL
oading"
>
<tbody
*
ngIf=
"
competencyCourse.l
oading"
>
<tr>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<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"
<div
*
ngFor=
"let item of [1,2,3]"
class=
"ti-spinner w-8 h-8 text-secondary mx-1"
role=
"status"
...
@@ -95,27 +90,31 @@
...
@@ -95,27 +90,31 @@
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
<tbody
*
ngIf=
"!
dataL
oading&&!dataListFilter().length"
>
<tbody
*
ngIf=
"!
competencyCourse.l
oading&&!dataListFilter().length"
>
<tr>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
ไม่พบข้อมูล
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
<tbody
*
ngIf=
"!
dataL
oading&&dataListFilter().length"
>
<tbody
*
ngIf=
"!
competencyCourse.l
oading&&dataListFilter().length"
>
<tr
<tr
*
ngFor=
"let item of dataListFilter()| slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
*
ngFor=
"let item of dataListFilter()| slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.id}}"
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
[(
ngModel
)]="
item
.
checked
"
(
change
)="
checkSelect
()"
>
id=
"checkbox-{{item.data.competencyCourseId}}"
[(
ngModel
)]="
item
.
check
"
<label
for=
"checkbox-{{item.id}}"
>
{{item.id}}
</label>
(
change
)="
dataListCheck
()"
>
<label
for=
"checkbox-{{item.data.competencyCourseId}}"
>
{{item.data.competencyCourseId}}
</label>
</td>
</td>
<td>
{{item.
name
}}
</td>
<td>
{{item.
data.tdesc
}}
</td>
<td
class=
"flex justify-center"
>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectCompetencycourse
(
item
)"
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#development-course-modal-edit"
></i>
(
click
)="
currentModal=
'edit'
;
selectCompetencycourse
(
item
.
data
)"
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
(
click
)="
selectCompetencycourse
(
item
)"
data-hs-overlay=
"#development-course-modal"
></i>
data-hs-overlay=
"#development-course-alert-delete-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>
</td>
</tr>
</tr>
</tbody>
</tbody>
...
@@ -160,91 +159,77 @@
...
@@ -160,91 +159,77 @@
</nav>
</nav>
</div>
</div>
<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 rounded-md"
>
<div
id=
"development-course-modal-add"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<h5
class=
"text-xxl font-bold text-white"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
นำเข้าหลักสูตรการพัฒนา
<div
class=
"ti-modal-header"
>
</h5>
<h3
class=
"text-xxl font-bold text-primary"
>
</div>
เพิ่มหลักสูตรการพัฒนา
<div
class=
"ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm"
>
</h3>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"flex justify-end"
>
<div
class=
"mt-2 p-2"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<div
class=
"flex rounded-md"
>
data-hs-overlay=
"#development-course-modal-add"
>
<input
#
fileInput
id=
"fileInput"
type=
"file"
(
change
)="
onFileSelected
($
event
)"
hidden
>
<span
class=
"sr-only"
>
Close
</span>
<input
type=
"text"
[
value
]="
selectedFileName
"
readonly
(
click
)="
fileInput
.
click
()"
<i
class=
"ti ti-circle-x fs-xxl"
></i>
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>
</button>
</div>
</div>
</div>
<div
class=
"flex justify-center mt-2rem "
>
<div
class=
"ti-modal-center"
>
<h1
class=
"cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
text-center text-secondary border-secondary border-b-2 align-items-end"
(
click
)="
downloadFile
()"
>
<div
class=
"px-1"
>
ดาวน์โหลดตัวอย่างไฟล์
</h1>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
>
<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>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<div
class=
"ti-modal-body mt-1"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสหลักสูตร*
</label>
data-hs-overlay=
"#type-registration-component-upload-modal"
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[(
ngModel
)]="
dataSelect
.
id
"
>
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (ไทย)*
</label>
[
disabled
]="!
selectedFile
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-10"
[(
ngModel
)]="
dataSelect
.
name
"
>
อัปโหลด
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-10"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
<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"
[(
ngModel
)]="
dataSelect
.
detail
"
>
</textarea>
<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"
[(
ngModel
)]="
dataSelect
.
topic
"
>
</textarea>
<label
for=
"input-label"
class=
"ti-form-label"
>
Link myLearn
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input h-10"
[(
ngModel
)]="
dataSelect
.
courseLinkMylearn
"
>
<div
class=
"flex justify-end mt-3rem mb-1rem space-x-4"
>
<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-add"
>
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-add-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
id=
"development-course-modal-edit"
class=
"hs-overlay hidden ti-modal"
>
<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=
"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=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
<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=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#development-course-modal
-edit
"
>
data-hs-overlay=
"#development-course-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
...
@@ -253,7 +238,8 @@
...
@@ -253,7 +238,8 @@
<div
class=
"ti-modal-center"
>
<div
class=
"ti-modal-center"
>
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
<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
)"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
<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"
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)"
>
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
...
@@ -279,30 +265,35 @@
...
@@ -279,30 +265,35 @@
</div>
</div>
<div
class=
"ti-modal-body mt-1"
>
<div
class=
"ti-modal-body mt-1"
>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสหลักสูตร*
</label>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสหลักสูตร*
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 bg-input-readonly"
readonly
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[(
ngModel
)]="
dataSelect
.
id
"
>
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
competencyCourse
.
select
.
competencyCourseId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (ไทย)*
</label>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
ชื่อหลักสูตร (ไทย)*
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-10"
[(
ngModel
)]="
dataSelect
.
name
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-10"
[(
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"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-10"
[(
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
)]="
dataSelect
.
d
etail
"
>
</textarea>
[(
ngModel
)]="
competencyCourse
.
select
.
courseD
etail
"
>
</textarea>
<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
)]="
dataSelect
.
t
opic
"
>
</textarea>
[(
ngModel
)]="
competencyCourse
.
select
.
courseT
opic
"
>
</textarea>
<label
for=
"input-label"
class=
"ti-form-label
"
>
Link myLearn
</label>
<label
class=
"ti-form-label mt-2rem
"
>
Link myLearn
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input h-10"
[(
ngModel
)]="
dataS
elect
.
courseLinkMylearn
"
>
<input
type=
"text"
class=
"ti-form-input h-10"
[(
ngModel
)]="
competencyCourse
.
s
elect
.
courseLinkMylearn
"
>
<div
class=
"flex justify-end mt-3rem mb-1rem space-x-4"
>
<div
class=
"flex justify-end mt-3rem mb-1rem space-x-4"
>
<button
type=
"button"
<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"
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
-edit
"
>
data-hs-overlay=
"#development-course-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#development-course-alert-edit-modal"
>
data-hs-overlay=
"#development-course-alert-modal"
[
class
.
ti-btn-disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
"
[
disabled
]="!
competencyCourse
.
select
.
competencyCourseId
||!
competencyCourse
.
select
.
tdesc
"
>
บันทึกข้อมูล
บันทึกข้อมูล
</
a
>
</
button
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -310,7 +301,7 @@
...
@@ -310,7 +301,7 @@
</div>
</div>
<div
id=
"development-course-alert-
add-
modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"development-course-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=
"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=
"max-h-full overflow-hidden ti-modal-content w-full"
>
<div
class=
"ti-modal-header"
>
<div
class=
"ti-modal-header"
>
...
@@ -319,96 +310,48 @@
...
@@ -319,96 +310,48 @@
</h3>
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#development-course-alert-add-modal"
>
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
data-hs-overlay=
"#development-course-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<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=
"#development-course-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-add-modal"
(
click
)="
addUser
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"development-course-alert-edit-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"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#development-course-alert-edit-modal"
>
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
data-hs-overlay=
"#development-course-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
</div>
</div>
</div>
</div>
<div
class=
"ti-modal-body "
>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
<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'"
>
ยืนยันการลบข้อมูลหรือไม่
</p>
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
<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"
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
-edit
"
>
data-hs-overlay=
"#development-course-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-
edit-modal"
(
click
)="
addUser
(
)"
>
data-hs-overlay=
"#development-course-alert-
modal"
(
click
)="
updateCompetencyCourse
('
post
'
)"
>
บันทึกข้อมูล
บันทึกข้อมูล
</a>
</a>
</div>
</div>
</div>
<div
class=
"flex justify-end mt-2rem mb-1rem"
</div>
*
ngIf=
"currentModal=='delete'||currentModal=='deleteGroup'"
>
</div>
</div>
<div
id=
"development-course-alert-delete-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"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#development-course-alert-delete-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"
>
ยืนยันการลบข้อมูลหรือไม่!
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
<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"
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-alert-
delete-
modal"
>
data-hs-overlay=
"#development-course-alert-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-
success
"
href=
"javascript:void(0);"
<a
class=
"ti-btn ti-btn-
danger
"
href=
"javascript:void(0);"
data-hs-overlay=
"#development-course-alert-
delete-modal"
(
click
)="
deleteUser
(
)"
>
data-hs-overlay=
"#development-course-alert-
modal"
(
click
)="
updateCompetencyCourse
('
delete
'
)"
>
ลบข้อมูล
ลบข้อมูล
</a>
</a>
</div>
</div>
...
...
src/app/components/competency-assessment/course-registration/development-course/development-course.component.ts
View file @
8a0f2a39
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
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'
;
export
interface
DataModel
{
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
id
:
string
name
:
string
edesc
:
string
detail
:
string
topic
:
string
courseLinkMylearn
:
string
checked
:
boolean
}
@
Component
({
@
Component
({
selector
:
'app-development-course'
,
selector
:
'app-development-course'
,
templateUrl
:
'./development-course.component.html'
,
templateUrl
:
'./development-course.component.html'
,
styleUrls
:
[
'./development-course.component.scss'
]
styleUrls
:
[
'./development-course.component.scss'
]
})
})
export
class
DevelopmentCourseComponent
{
export
class
DevelopmentCourseComponent
{
@
Input
()
pathTitle
=
[
'การประเมินสมรรถนะ'
,
'ทะเบียนหลักสูตร'
,
'หลักสูตรการพัฒนา'
];
@
Output
()
sendPathTitle
:
EventEmitter
<
string
[]
>
=
new
EventEmitter
<
string
[]
>
();
activeTab
:
string
=
'tab1'
;
// กำหนด tab เริ่มต้น
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
search
=
""
// ฟังก์ชันในการเปลี่ยนแท็บ
currentModal
:
'add'
|
'edit'
|
'delete'
|
'deleteGroup'
=
"add"
;
changeTab
(
tab
:
{
id
:
string
,
text
:
string
})
{
competencyCourse
:
{
loading
:
boolean
,
select
:
CompetencyCourseModel
,
dataList
:
{
check
:
boolean
,
data
:
CompetencyCourseModel
}[]
}
=
{
loading
:
false
,
select
:
new
MyCompetencyCourseModel
(),
dataList
:
[]
}
this
.
sendPathTitle
.
emit
([
'การประเมินสมรรถนะ'
,
'ตั้งค่าผู้ใช้งาน'
,
tab
.
text
]);
numDataListChecked
=
0
this
.
activeTab
=
tab
.
id
;
isDataListChecked
=
false
}
isDataListCheckedAll
=
false
// การจัดการการเปิดปิด modal
modalOptions
:
{
[
nameModal
:
string
]:
{
isModalOpen
:
boolean
;
modalSize
:
string
;
backdropClose
:
boolean
;
};
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
}
};
openModal
(
name
:
string
,
size
:
string
,
closeOnBackdrop
?:
boolean
)
{
this
.
modalOptions
[
name
].
modalSize
=
size
;
this
.
modalOptions
[
name
].
backdropClose
=
closeOnBackdrop
||
false
;
this
.
modalOptions
[
name
].
isModalOpen
=
true
;
this
.
currentModal
=
name
;
// ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document
.
body
.
style
.
overflow
=
'hidden'
;
}
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
}
isAnyModalOpen
():
boolean
{
selectedFile
:
File
|
null
=
null
;
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
competencycourseService
:
CompetencycourseService
,
private
fileService
:
FileService
)
{
}
ngOnInit
():
void
{
this
.
getCompetencycourseList
()
}
}
onFileSelected
(
event
:
any
)
{
// ฟังก์ชัน toggle checkbox
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
isChecked
:
boolean
=
false
;
// ใช้สำหรับตรวจสอบสถานะของ checkbox
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
toggleCheckbox
()
{
this
.
isChecked
=
!
this
.
isChecked
;
this
.
mockData
.
forEach
((
item
)
=>
{
item
.
checked
=
this
.
isChecked
;
});
this
.
checkSelect
();
}
}
uploadFile
()
{
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
if
(
!
this
.
selectedFile
)
{
addUser
()
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
const
body
=
new
MyCompetencycourseModel
({
competencyCourseId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
courseTopic
:
this
.
dataSelect
.
topic
,
courseDetail
:
this
.
dataSelect
.
detail
,
courseLinkMylearn
:
this
.
dataSelect
.
courseLinkMylearn
})
return
this
.
competencycourseService
.
post
(
body
).
subscribe
((
response
:
any
)
=>
{
}
if
(
response
.
success
)
{
const
formData
=
new
FormData
();
this
.
showSuccess
()
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
getCompetencycourseList
()
this
.
competencyCourse
.
loading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
''
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencycourseList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
deleteUser
()
{
downloadFile
()
{
const
body
=
new
MyCompetencycourseModel
({
competencyCourseId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
courseTopic
:
this
.
dataSelect
.
topic
,
courseDetail
:
this
.
dataSelect
.
detail
,
courseLinkMylearn
:
this
.
dataSelect
.
courseLinkMylearn
})
const
fileName
=
'.xlsx'
this
.
competencycourseService
.
delete
(
body
).
subscribe
((
response
:
any
)
=>
{
this
.
fileService
.
downloadTemplate
(
fileName
).
subscribe
({
if
(
response
.
success
)
{
next
:
response
=>
{
this
.
showSuccessDelete
()
const
url
=
window
.
URL
.
createObjectURL
(
response
);
this
.
getCompetencycourseList
()
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
fileName
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
}
})
})
}
currentModal
=
""
;
mockData
:
DataModel
[]
=
[]
dataLoading
=
false
dataSelect
:
DataModel
=
{
id
:
""
,
name
:
""
,
edesc
:
""
,
topic
:
""
,
detail
:
""
,
courseLinkMylearn
:
""
,
checked
:
false
}
mockDataSelect
:
any
=
[]
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
competencycourseService
:
CompetencycourseService
)
{
}
ngOnInit
():
void
{
this
.
getCompetencycourseList
()
}
}
getCompetencycourseList
()
{
getCompetencycourseList
()
{
this
.
dataL
oading
=
true
this
.
competencyCourse
.
l
oading
=
true
this
.
competencycourseService
.
getList
().
subscribe
({
this
.
competencycourseService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
mockData
=
response
.
map
(
x
=>
({
id
:
x
.
competencyCourseId
,
name
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
topic
:
x
.
courseTopic
,
detail
:
x
.
courseDetail
,
courseLinkMylearn
:
x
.
courseLinkMylearn
,
checked
:
false
}))
this
.
competencyCourse
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyCompetencyCourseModel
(
x
)
}))
this
.
dataLoading
=
false
this
.
competencyCourse
.
loading
=
false
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
searchChange
()
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
dataL
oading
=
false
this
.
competencyCourse
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
...
@@ -133,39 +97,78 @@ export class DevelopmentCourseComponent {
...
@@ -133,39 +97,78 @@ export class DevelopmentCourseComponent {
searchChange
()
{
searchChange
()
{
this
.
currentPage
=
1
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
}
dataListFilter
()
{
dataListFilter
()
{
return
this
.
mockData
.
filter
(
x
=>
{
return
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
{
const
data
=
x
const
data
=
x
.
data
const
match
=
data
.
id
.
includes
(
this
.
search
)
||
data
.
name
.
includes
(
this
.
search
)
const
match
=
data
.
competencyCourseId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
()
)
return
match
;
return
match
;
});
});
}
}
selectCompetencycourse
(
data
?:
Data
Model
)
{
selectCompetencycourse
(
data
?:
CompetencyCourse
Model
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
id
:
""
,
name
:
""
,
edesc
:
""
,
topic
:
""
,
detail
:
""
,
checked
:
false
}));
this
.
competencyCourse
.
select
=
new
MyCompetencyCourseModel
(
data
)
}
}
checkSelect
()
{
updateCompetencyCourse
(
typeApi
:
'post'
|
'delete'
)
{
this
.
mockDataSelect
=
this
.
mockData
.
filter
(
item
=>
item
.
checked
);
this
.
competencyCourse
.
loading
=
true
let
body
:
CompetencyCourseModel
|
CompetencyCourseModel
[]
switch
(
this
.
currentModal
)
{
case
(
'deleteGroup'
):
{
body
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyCompetencyCourseModel
(
x
.
data
))
break
;
}
default
:
{
body
=
new
MyCompetencyCourseModel
(
this
.
competencyCourse
.
select
)
}
}
this
.
competencycourseService
[
typeApi
]((
body
as
any
)).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencycourseList
()
this
.
searchChange
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
competencyCourse
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
}
show
Success
(
)
{
show
Alert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเ
จ้งเตือน'
,
{
this
.
toastr
[
type
](
text
,
'แ
จ้งเตือน'
,
{
timeOut
:
3000
,
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
positionClass
:
'toast-top-right'
,
})
;
})
}
}
showSuccessEdit
()
{
dataListCheckAll
()
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
const
selectAll
=
this
.
isDataListCheckedAll
;
timeOut
:
3000
,
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
{
positionClass
:
'toast-top-right'
,
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
();
}
}
showSuccessDelete
()
{
dataListCheck
()
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
const
dataCheck
=
this
.
dataListFilter
();
timeOut
:
3000
,
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
positionClass
:
'toast-top-right'
,
this
.
numDataListChecked
=
this
.
competencyCourse
.
dataList
.
filter
(
x
=>
x
.
check
).
length
;
});
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
clearData
(
modalStatus
:
string
)
{
if
(
modalStatus
==
'add'
)
{
this
.
selectCompetencycourse
()
}
else
if
(
modalStatus
==
'edit'
)
{
this
.
selectCompetencycourse
(
new
MyCompetencyCourseModel
({
competencyCourseId
:
this
.
competencyCourse
.
select
.
competencyCourseId
}))
}
}
}
}
}
src/app/shared/model/competency-course.model.ts
View file @
8a0f2a39
...
@@ -5,6 +5,7 @@ export interface CompetencyCourseModel {
...
@@ -5,6 +5,7 @@ export interface CompetencyCourseModel {
tdesc
:
string
tdesc
:
string
courseDetail
:
string
courseDetail
:
string
courseTopic
:
string
courseTopic
:
string
courseLinkMylearn
:
string
}
}
export
class
MyCompetencyCourseModel
implements
CompetencyCourseModel
{
export
class
MyCompetencyCourseModel
implements
CompetencyCourseModel
{
competencyCourseId
:
string
competencyCourseId
:
string
...
@@ -13,13 +14,15 @@ export class MyCompetencyCourseModel implements CompetencyCourseModel {
...
@@ -13,13 +14,15 @@ export class MyCompetencyCourseModel implements CompetencyCourseModel {
tdesc
:
string
tdesc
:
string
courseDetail
:
string
courseDetail
:
string
courseTopic
:
string
courseTopic
:
string
constructor
(
data
:
Partial
<
CompetencyCourseModel
>
)
{
courseLinkMylearn
:
string
this
.
competencyCourseId
=
data
.
competencyCourseId
||
""
constructor
(
data
?:
Partial
<
CompetencyCourseModel
>
)
{
this
.
tdesc
=
data
.
tdesc
||
""
this
.
competencyCourseId
=
data
?.
competencyCourseId
||
""
this
.
edesc
=
data
.
edesc
||
""
this
.
tdesc
=
data
?.
tdesc
||
""
this
.
companyId
=
data
.
companyId
||
""
this
.
edesc
=
data
?.
edesc
||
""
this
.
courseDetail
=
data
.
courseDetail
||
""
this
.
companyId
=
data
?.
companyId
||
""
this
.
courseTopic
=
data
.
courseTopic
||
""
this
.
courseDetail
=
data
?.
courseDetail
||
""
this
.
courseTopic
=
data
?.
courseTopic
||
""
this
.
courseLinkMylearn
=
data
?.
courseLinkMylearn
||
""
}
}
}
}
src/app/shared/services/competencycourse.service.ts
View file @
8a0f2a39
...
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
...
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import
{
Observable
}
from
'rxjs'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
CompetencycourseModel
}
from
'../model/competencycourse.model'
;
import
{
CompetencycourseModel
}
from
'../model/competencycourse.model'
;
import
{
AlertModel
}
from
'../model/alert.model'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
})
})
...
@@ -17,16 +18,16 @@ export class CompetencycourseService {
...
@@ -17,16 +18,16 @@ export class CompetencycourseService {
getList
():
Observable
<
CompetencycourseModel
[]
>
{
getList
():
Observable
<
CompetencycourseModel
[]
>
{
return
this
.
http
.
get
<
CompetencycourseModel
[]
>
(
this
.
urlApi
+
"/lists"
)
return
this
.
http
.
get
<
CompetencycourseModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
}
post
(
body
:
CompetencycourseModel
)
{
post
(
body
:
CompetencycourseModel
)
:
Observable
<
AlertModel
>
{
return
this
.
http
.
post
(
this
.
urlApi
,
body
)
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
}
delete
(
body
:
CompetencycourseModel
)
{
delete
(
body
:
CompetencycourseModel
)
:
Observable
<
AlertModel
>
{
const
options
=
{
const
options
=
{
headers
:
new
HttpHeaders
({
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
}),
}),
body
:
body
body
:
body
};
};
return
this
.
http
.
delete
(
this
.
urlApi
,
options
)
return
this
.
http
.
delete
<
AlertModel
>
(
this
.
urlApi
,
options
)
}
}
}
}
\ No newline at end of file
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