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
779e05b7
Commit
779e05b7
authored
Apr 16, 2025
by
Natthaphat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ตาราง ทะเบียนกำหนดชื่อ > ประเภทสมรรถนะ
parent
63c6a8ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
215 deletions
+118
-215
competency-topic.component.ts
...gistration/competency-topic/competency-topic.component.ts
+27
-3
type-registration.component.html
...ration/type-registration/type-registration.component.html
+31
-144
type-registration.component.ts
...stration/type-registration/type-registration.component.ts
+60
-68
No files found.
src/app/components/competency-assessment/name-registration/competency-topic/competency-topic.component.ts
View file @
779e05b7
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
MyCompetencytopicModel
}
from
'src/app/shared/model/competencytopic.model'
;
import
{
MyCompetencytopicModel
}
from
'src/app/shared/model/competencytopic.model'
;
import
{
MyCompetencytypeModel
}
from
'src/app/shared/model/competencytype.model'
;
import
{
MyCompetencytypeModel
}
from
'src/app/shared/model/competencytype.model'
;
...
@@ -30,7 +31,6 @@ export interface DataModel2 {
...
@@ -30,7 +31,6 @@ export interface DataModel2 {
export
class
CompetencyTopic
{
export
class
CompetencyTopic
{
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
currentPageModal
=
1
currentPageModal
=
1
pageModal
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
pageModal
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
...
@@ -39,7 +39,7 @@ export class CompetencyTopic {
...
@@ -39,7 +39,7 @@ export class CompetencyTopic {
isChecked
:
boolean
=
false
;
// ใช้สำหรับตรวจสอบสถานะของ checkbox
isChecked
:
boolean
=
false
;
// ใช้สำหรับตรวจสอบสถานะของ checkbox
currentModal
=
""
;
currentModal
=
""
;
dataLoading
=
false
dataLoading
=
false
dataSelectList
:
DataModel
[]
=
[];
topicList
:
CompetencytopicService
[]
=
[];
dataSelect
:
DataModel
=
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
definition
:
""
,
file
:
""
,
type
:
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
},
checked
:
false
}
dataSelect
:
DataModel
=
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
definition
:
""
,
file
:
""
,
type
:
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
},
checked
:
false
}
competencytypeListLoading
=
false
competencytypeListLoading
=
false
competencytypeList
:
DataModel2
[]
=
[]
competencytypeList
:
DataModel2
[]
=
[]
...
@@ -49,12 +49,36 @@ export class CompetencyTopic {
...
@@ -49,12 +49,36 @@ export class CompetencyTopic {
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
examFile
:
File
|
null
=
null
;
examFile
:
File
|
null
=
null
;
examFileName
:
string
=
'กรุณาเลือกไฟล์'
;
examFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedItems
:
string
[]
=
[];
numDataListChecked
=
0
numDataListChecked
=
0
isDataListChecked
=
false
isDataListChecked
=
false
isDataListCheckedAll
=
false
isDataListCheckedAll
=
false
columns
:
ColumnModel
[]
=
[{
field
:
"competencyTypeId"
,
headerText
:
"รหัส"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ชื่อประเภท"
,
type
:
"string"
},
{
field
:
"shortName"
,
headerText
:
"ชื่อย่อ"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'competencyTypeId'
,
'tdesc'
,
'shortName'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
constructor
(
private
toastr
:
ToastrService
,
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
,
private
fileService
:
FileService
,
...
...
src/app/components/competency-assessment/name-registration/type-registration/type-registration.component.html
View file @
779e05b7
<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=
"#type-registration-component-page-modal"
(
click
)="
modalStatus=
'add'
;
setData
()"
>
data-hs-overlay=
"#type-registration-component-page-modal"
(
click
)="
currentModal=
'add'
;
edit
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
...
@@ -48,125 +35,31 @@
...
@@ -48,125 +35,31 @@
<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=
"#type-registration-component-page-alert-modal"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
(
click
)="
modalStatus=
'deleteGroup'
;
setData
()"
>
(
click
)="
currentModal=
'delete'
;
edit
()"
>
<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
]="
typeList
"
<table
class=
"ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"
>
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
modalName=
"#type-registration-component-page-modal"
<thead>
(
sendSelectData
)="
currentModal=
'edit'
;
edit
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
<tr>
</app-datagrid-syncfution>
<ng-container
*
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=
"dataLoading"
>
<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=
"!dataLoading&&!dataListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!dataLoading&&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.id}}"
[(
ngModel
)]="
item
.
check
"
(
change
)="
dataListCheck
()"
>
</td>
<td
class=
"text-center"
>
<label
for=
"checkbox-{{item.data.id}}"
>
{{item.data.id}}
</label>
</td>
<td>
{{item.data.name}}
</td>
<td
class=
"text-center"
>
{{item.data.code}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
modalStatus=
'edit'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#type-registration-component-page-modal"
></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
(click)="modalStatus='delete';setData(item.data)"
data-hs-overlay="#type-registration-component-page-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=
"type-registration-component-page-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"type-registration-component-page-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"
>
{{
modalStatus
=='add'?'เพิ่มประเภทสมรรถนะ':'แก้ไขประเภทสมรรถนะ'}}
{{
currentModal
=='add'?'เพิ่มประเภทสมรรถนะ':'แก้ไขประเภทสมรรถนะ'}}
</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"
...
@@ -180,7 +73,7 @@
...
@@ -180,7 +73,7 @@
<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
(
modalStatus
)"
>
(
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)"
>
...
@@ -196,38 +89,32 @@
...
@@ -196,38 +89,32 @@
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"
style=
"padding-top: 0px;"
>
<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
<label
for=
"input-label"
class=
"ti-form-label mt-1rem"
>
รหัส
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"
modalStatus
=='add'&&checkPrimary()"
>
*
ngIf=
"
currentModal
=='add'&&checkPrimary()"
>
รหัสซ้ำ
รหัสซ้ำ
</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
'
:
modalStatus=
='edit'}"
[
readonly
]="
modalStatus
=
='edit'"
[
ngClass
]="{'
bg-input-readonly
'
:
currentModal=
='edit'}"
[
readonly
]="
currentModal
=
='edit'"
[(
ngModel
)]="
dataSelect
.
i
d
"
>
[(
ngModel
)]="
competoncy_type
.
competencyTypeI
d
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (ไทย)
<span
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
dataSelect
.
name
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
competoncy_type
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (อังกฤษ)
</label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
competoncy_type
.
edesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อย่อ
<span
class=
"text-danger"
>
*
</span></label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อย่อ
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
dataSelect
.
cod
e
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
competoncy_type
.
shortNam
e
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ระดับความคาดหวัง
<span
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ระดับความคาดหวัง
<span
class=
"text-danger"
>
*
</span></label>
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
style=
"width: 200px;"
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
style=
"width: 200px;"
oninput=
"this.value = this.value.replace(/\D/g, '')"
[(
ngModel
)]="
dataSelect
.
l
evel
"
>
oninput=
"this.value = this.value.replace(/\D/g, '')"
[(
ngModel
)]="
competoncy_type
.
expectationL
evel
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
น้ำหนัก
</label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
น้ำหนัก
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
style=
"width: 200px;"
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
style=
"width: 200px;"
oninput=
"this.value = this.value.replace(/[^\d.]/g, '').replace(/(\..*?)\..*/g, '$1').replace(/(\..*?)(\d{2})./g, '$1$2');"
oninput=
"this.value = this.value.replace(/[^\d.]/g, '').replace(/(\..*?)\..*/g, '$1').replace(/(\..*?)(\d{2})./g, '$1$2');"
onchange=
"this.value = this.value.replace('', '0');this.value = parseFloat(this.value).toFixed(2)"
onchange=
"this.value = this.value.replace('', '0');this.value = parseFloat(this.value).toFixed(2)"
[(
ngModel
)]="
dataSelect
.
weight
"
>
[(
ngModel
)]="
competoncy_type
.
weight
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<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"
...
@@ -236,8 +123,8 @@
...
@@ -236,8 +123,8 @@
</button>
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
[
class
.
ti-btn-disabled
]="!
dataSelect
.
id
||!
dataSelect
.
name
||!
dataSelect
.
code
||!
dataSelect
.
level
||(
modalStatus
=
='add'&&checkPrimary())"
[
class
.
ti-btn-disabled
]="!
competoncy_type
.
competencyTypeId
||!
competoncy_type
.
tdesc
||!
competoncy_type
.
shortName
||(
currentModal
=
='add'&&checkPrimary())"
[
disabled
]="!
dataSelect
.
id
||!
dataSelect
.
name
||!
dataSelect
.
code
||!
dataSelect
.
level
||(
modalStatus
=
='add'&&checkPrimary())"
>
[
disabled
]="!
competoncy_type
.
competencyTypeId
||!
competoncy_type
.
tdesc
||!
competoncy_type
.
shortName
||(
currentModal
=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div>
</div>
...
@@ -254,14 +141,14 @@
...
@@ -254,14 +141,14 @@
แจ้งเตือน
แจ้งเตือน
</h3>
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
<ng-container
*
ngIf=
"
modalStatus=='add'||modalStatus
=='edit'"
>
<ng-container
*
ngIf=
"
currentModal=='add'||currentModal
=='edit'"
>
<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=
"#type-registration-component-page-modal"
>
data-hs-overlay=
"#type-registration-component-page-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>
</ng-container>
</ng-container>
<ng-container
*
ngIf=
"
modalStatus=='delete'||modalStatus=='deleteGroup
'"
>
<ng-container
*
ngIf=
"
currentModal=='delete
'"
>
<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=
"#type-registration-component-page-alert-modal"
>
data-hs-overlay=
"#type-registration-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
...
@@ -272,21 +159,21 @@
...
@@ -272,21 +159,21 @@
</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"
>
<ng-container
*
ngIf=
"
modalStatus=='add'||modalStatus
=='edit'"
>
<ng-container
*
ngIf=
"
currentModal=='add'||currentModal
=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
</ng-container>
<ng-container
*
ngIf=
"
modalStatus=='delete'||modalStatus=='deleteGroup
'"
>
<ng-container
*
ngIf=
"
currentModal=='delete
'"
>
<ng-container
*
ngIf=
"num
DataListChecked
"
>
<ng-container
*
ngIf=
"num
SelectItem()
"
>
ยืนยันการลบข้อมูลหรือไม่
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</ng-container>
<ng-container
*
ngIf=
"!num
DataListChecked
"
>
<ng-container
*
ngIf=
"!num
SelectItem()
"
>
เลือกข้อมูลที่ต้องการลบ
เลือกข้อมูลที่ต้องการลบ
</ng-container>
</ng-container>
</ng-container>
</ng-container>
</p>
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<ng-container
*
ngIf=
"
modalStatus=='add'||modalStatus
=='edit'"
>
<ng-container
*
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=
"#type-registration-component-page-modal"
>
data-hs-overlay=
"#type-registration-component-page-modal"
>
...
@@ -298,13 +185,13 @@
...
@@ -298,13 +185,13 @@
บันทึกข้อมูล
บันทึกข้อมูล
</a>
</a>
</ng-container>
</ng-container>
<ng-container
*
ngIf=
"
modalStatus=='delete'||modalStatus=='deleteGroup
'"
>
<ng-container
*
ngIf=
"
currentModal=='delete
'"
>
<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=
"#type-registration-component-page-alert-modal"
>
data-hs-overlay=
"#type-registration-component-page-alert-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
*
ngIf=
"num
DataListChecked
"
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
*
ngIf=
"num
SelectItem()
"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
(
click
)="
deleteType_registration
()"
>
(
click
)="
deleteType_registration
()"
>
ลบข้อมูล
ลบข้อมูล
...
...
src/app/components/competency-assessment/name-registration/type-registration/type-registration.component.ts
View file @
779e05b7
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
CompetencytypeModel
,
MyCompetencytypeModel
}
from
'src/app/shared/model/competencytype.model'
;
import
{
CompetencytypeModel
,
MyCompetencytypeModel
}
from
'src/app/shared/model/competencytype.model'
;
import
{
CompetencytypeService
}
from
'src/app/shared/services/competencytype.service'
;
import
{
CompetencytypeService
}
from
'src/app/shared/services/competencytype.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
id
:
string
companyId
:
string
edesc
:
string
name
:
string
code
:
string
level
:
string
weight
:
number
checked
:
boolean
}
@
Component
({
@
Component
({
selector
:
'app-type-registration'
,
selector
:
'app-type-registration'
,
templateUrl
:
'./type-registration.component.html'
,
templateUrl
:
'./type-registration.component.html'
,
styleUrls
:
[
'./type-registration.component.scss'
]
styleUrls
:
[
'./type-registration.component.scss'
]
})
})
export
class
TypeRegistration
{
export
class
TypeRegistration
{
isChecked
:
boolean
=
false
;
currentPage
=
1
selectedItems
:
string
[]
=
[];
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
numDataListChecked
=
0
isDataListChecked
=
false
isDataListCheckedAll
=
false
dataSelectList
:
Data
Model
[]
=
[];
typeList
:
Competencytype
Model
[]
=
[];
dataLoading
=
false
dataLoading
=
false
dataSelect
:
DataModel
=
{
id
:
""
,
companyId
:
""
,
edesc
:
""
,
name
:
""
,
code
:
""
,
level
:
""
,
weight
:
0.00
,
checked
:
false
}
competoncy_typeList
:
{
check
:
boolean
;
data
:
DataModel
&
{
checked
?:
boolean
}
}[]
=
[]
competoncy_type
:
CompetencytypeModel
=
new
MyCompetencytypeModel
({})
competoncy_type
:
CompetencytypeModel
=
new
MyCompetencytypeModel
({})
modalStatus
:
'add'
|
'edit'
|
'delete'
|
'deleteGroup'
=
'add'
currentModal
:
'add'
|
'edit'
|
'delete'
=
'add'
search
=
""
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
columns
:
ColumnModel
[]
=
[{
field
:
"competencyTypeId"
,
headerText
:
"รหัส"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ชื่อประเภท"
,
type
:
"string"
},
{
field
:
"shortName"
,
headerText
:
"ชื่อย่อ"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'competencyTypeId'
,
'tdesc'
,
'shortName'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
constructor
(
private
competencytypeService
:
CompetencytypeService
,
constructor
(
private
competencytypeService
:
CompetencytypeService
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
...
@@ -100,13 +106,16 @@ export class TypeRegistration {
...
@@ -100,13 +106,16 @@ export class TypeRegistration {
getCompetencytypeList
()
{
getCompetencytypeList
()
{
this
.
dataLoading
=
true
this
.
dataLoading
=
true
this
.
selectedItems
.
data
.
clear
()
this
.
competencytypeService
.
getList
().
subscribe
({
this
.
competencytypeService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
competoncy_typeList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
id
:
x
.
competencyTypeId
,
companyId
:
x
.
companyId
,
edesc
:
x
.
edesc
,
name
:
x
.
tdesc
,
code
:
x
.
shortName
,
weight
:
x
.
weight
,
level
:
x
.
expectationLevel
,
checked
:
false
}
}))
this
.
typeList
=
response
.
map
(
x
=>
{
this
.
selectedItems
.
data
.
set
(
x
.
competencyTypeId
,
false
)
return
new
MyCompetencytypeModel
(
x
)
})
this
.
selectedItems
.
key
=
'competencyTypeId'
this
.
selectedItems
.
count
=
0
this
.
dataLoading
=
false
this
.
dataLoading
=
false
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
dataLoading
=
false
this
.
dataLoading
=
false
...
@@ -114,24 +123,16 @@ export class TypeRegistration {
...
@@ -114,24 +123,16 @@ export class TypeRegistration {
}
}
})
})
}
}
searchChange
()
{
this
.
currentPage
=
1
edit
(
item
?:
CompetencytypeModel
)
{
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
competoncy_type
=
new
MyCompetencytypeModel
(
item
||
{})
this
.
dataListCheck
()
}
dataListFilter
()
{
return
this
.
competoncy_typeList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
id
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
name
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
code
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
());
return
match
;
});
}
setData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
id
:
""
,
companyId
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
,
checked
:
false
}));
}
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addType_registration
()
{
addType_registration
()
{
const
body
=
new
MyCompetencytypeModel
(
{
competencyTypeId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
shortName
:
this
.
dataSelect
.
code
,
weight
:
+
(
this
.
dataSelect
.
weight
),
expectationLevel
:
this
.
dataSelect
.
level
}
)
const
body
=
new
MyCompetencytypeModel
(
this
.
competoncy_type
)
this
.
dataLoading
=
true
this
.
dataLoading
=
true
this
.
competencytypeService
.
post
(
body
).
subscribe
({
this
.
competencytypeService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
...
@@ -151,14 +152,10 @@ export class TypeRegistration {
...
@@ -151,14 +152,10 @@ export class TypeRegistration {
})
})
}
}
deleteType_registration
()
{
deleteType_registration
()
{
let
body
:
CompetencytypeModel
|
CompetencytypeModel
[]
=
[];
if
(
this
.
dataSelect
.
id
)
{
body
=
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
shortName
:
this
.
dataSelect
.
code
,
weight
:
+
(
this
.
dataSelect
.
weight
),
expectationLevel
:
this
.
dataSelect
.
level
});
}
else
{
body
=
this
.
competoncy_typeList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyCompetencytypeModel
({
competencyTypeId
:
x
.
data
.
id
,
tdesc
:
x
.
data
.
name
,
edesc
:
x
.
data
.
edesc
,
shortName
:
x
.
data
.
code
,
weight
:
+
(
this
.
dataSelect
.
weight
),
expectationLevel
:
x
.
data
.
level
}));
}
this
.
dataLoading
=
true
this
.
dataLoading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
typeList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
competencyTypeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
competencyTypeId
)).
map
(
x
=>
new
MyCompetencytypeModel
(
x
))
this
.
competencytypeService
.
delete
(
body
).
subscribe
({
this
.
competencytypeService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -185,32 +182,27 @@ export class TypeRegistration {
...
@@ -185,32 +182,27 @@ export class TypeRegistration {
}
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
competoncy_typeList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
id
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
name
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
code
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
());
return
match
;
}).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
dataListCheck
()
{
clearData
(
currentModal
:
string
)
{
const
dataCheck
=
this
.
dataListFilter
();
if
(
currentModal
==
'add'
)
{
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
competoncy_type
=
new
MyCompetencytypeModel
({})
this
.
numDataListChecked
=
this
.
competoncy_typeList
.
filter
(
x
=>
x
.
check
).
length
;
}
else
if
(
currentModal
==
'edit'
)
{
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
this
.
competoncy_type
=
new
MyCompetencytypeModel
({
...
this
.
competoncy_type
,
competencyTypeId
:
this
.
competoncy_type
.
competencyTypeId
})
}
clearData
(
modalStatus
:
string
)
{
if
(
modalStatus
==
'add'
)
{
this
.
setData
()
}
else
if
(
modalStatus
==
'edit'
)
{
this
.
setData
({
id
:
this
.
dataSelect
.
id
,
companyId
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
,
weight
:
0.00
,
checked
:
this
.
dataSelect
.
checked
})
}
}
}
}
checkPrimary
()
{
checkPrimary
()
{
return
this
.
competoncy_typeList
.
find
(
x
=>
x
.
data
.
id
==
this
.
dataSelect
.
id
)
return
this
.
typeList
.
find
(
x
=>
x
.
competencyTypeId
==
this
.
competoncy_type
.
competencyTypeId
)
}
numSelectItem
()
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
typeList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
competencyTypeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
competencyTypeId
)).
length
return
num
}
onSelectItemChange
(
arg
:
any
)
{
this
.
selectedItems
=
arg
}
}
}
}
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