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
cd558547
Commit
cd558547
authored
Feb 10, 2025
by
Natthaphat Pankiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
กลุ่มพนักงาน, ตำเเหน่ง, ประเภทพนักงาน, ระดับพนักงาน (PL), ประเภทสมรรถนะ, หัวข้อสมรรถนะ
parent
853b91d6
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1112 additions
and
1373 deletions
+1112
-1373
department-list.component.ts
...usiness-unit/department-list/department-list.component.ts
+9
-9
section-registration.component.ts
...it/section-registration/section-registration.component.ts
+9
-9
sub-department-four.component.ts
...unit/sub-department-four/sub-department-four.component.ts
+9
-9
sub-department-one.component.ts
...s-unit/sub-department-one/sub-department-one.component.ts
+9
-9
sub-department-three.component.ts
...it/sub-department-three/sub-department-three.component.ts
+9
-9
sub-department-two.component.ts
...s-unit/sub-department-two/sub-department-two.component.ts
+9
-9
employee-categories.component.html
...on/employee-categories/employee-categories.component.html
+33
-3
employee-categories.component.ts
...tion/employee-categories/employee-categories.component.ts
+59
-9
employee-group-unit.component.html
...on/employee-group-unit/employee-group-unit.component.html
+102
-233
employee-group-unit.component.ts
...tion/employee-group-unit/employee-group-unit.component.ts
+126
-115
employee-level.component.html
...-description/employee-level/employee-level.component.html
+27
-25
employee-level.component.ts
...ob-description/employee-level/employee-level.component.ts
+58
-5
position-unit.component.html
...nts/job-description/position/position-unit.component.html
+102
-232
position-unit.component.ts
...nents/job-description/position/position-unit.component.ts
+122
-73
competency-topic.component.html
...stration/competency-topic/competency-topic.component.html
+86
-209
competency-topic.component.ts
...gistration/competency-topic/competency-topic.component.ts
+127
-109
name-registration.component.html
...ssment/name-registration/name-registration.component.html
+4
-4
name-registration.component.ts
...sessment/name-registration/name-registration.component.ts
+1
-0
type-registration.component.html
...ration/type-registration/type-registration.component.html
+84
-174
type-registration.component.ts
...stration/type-registration/type-registration.component.ts
+114
-96
competencytopic.service.ts
src/app/shared/services/competencytopic.service.ts
+6
-4
competencytype.service.ts
src/app/shared/services/competencytype.service.ts
+7
-4
emp-group.service.ts
src/app/shared/services/emp-group.service.ts
+0
-12
position.service.ts
src/app/shared/services/position.service.ts
+0
-12
No files found.
src/app/components/company-components/company-registration/branch-business-unit/department-list/department-list.component.ts
View file @
cd558547
...
...
@@ -116,9 +116,9 @@ export class DepartmentListComponent implements OnInit {
this
.
bu2Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu2Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu2Table
()
{
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
includes
(
this
.
bu2Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu2Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu2Table
.
search
))
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
()
))
}
selectBu2
(
bu2
?:
Bu2Model
)
{
this
.
bu2
=
new
MyBu2Model
(
bu2
||
{})
...
...
@@ -139,9 +139,9 @@ export class DepartmentListComponent implements OnInit {
this
.
bu2Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu2Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu2Modal
()
{
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
includes
(
this
.
bu2Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu2Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu2Modal
.
search
))
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
))
}
...
...
@@ -160,9 +160,9 @@ export class DepartmentListComponent implements OnInit {
this
.
selectBu1
(
bu1
||
new
MyBu1Model
({
bu1id
:
this
.
bu1
.
bu1id
}))
}
filterBu1Modal
()
{
return
this
.
bu1List
.
filter
(
x
=>
x
.
bu1id
.
includes
(
this
.
bu1Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu1Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu1Modal
.
search
))
return
this
.
bu1List
.
filter
(
x
=>
x
.
bu1id
.
toLowerCase
().
includes
(
this
.
bu1Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu1Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu1Modal
.
search
.
toLowerCase
()
))
}
selectBu1
(
bu1
?:
Bu1Model
)
{
this
.
bu1
=
new
MyBu1Model
(
bu1
||
{})
...
...
src/app/components/company-components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
View file @
cd558547
...
...
@@ -117,9 +117,9 @@ export class SectionRegistrationComponent implements OnInit {
this
.
bu3Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu3Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu3Table
()
{
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
includes
(
this
.
bu3Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu3Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu3Table
.
search
))
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
()
))
}
selectBu3
(
bu3
?:
Bu3Model
)
{
this
.
bu3
=
new
MyBu3Model
(
bu3
||
{})
...
...
@@ -140,9 +140,9 @@ export class SectionRegistrationComponent implements OnInit {
this
.
bu3Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu3Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu3Modal
()
{
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
includes
(
this
.
bu3Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu3Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu3Modal
.
search
))
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
))
}
addBu3
()
{
this
.
bu3Service
.
post
({
...
this
.
bu3
,
parent
:
this
.
bu2
.
bu2id
}).
subscribe
({
...
...
@@ -188,9 +188,9 @@ export class SectionRegistrationComponent implements OnInit {
this
.
selectBu2
(
bu2
||
new
MyBu2Model
({
bu2id
:
this
.
bu2
.
bu2id
}))
}
filterBu2Modal
()
{
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
includes
(
this
.
bu2Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu2Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu2Modal
.
search
))
return
this
.
bu2List
.
filter
(
x
=>
x
.
bu2id
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu2Modal
.
search
.
toLowerCase
()
))
}
selectBu2
(
bu2
?:
Bu2Model
)
{
this
.
bu2
=
new
MyBu2Model
(
bu2
||
{})
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-four/sub-department-four.component.ts
View file @
cd558547
...
...
@@ -117,9 +117,9 @@ export class SubDepartmentFourComponent implements OnInit {
this
.
bu7Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu7Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu7Table
()
{
return
this
.
bu7List
.
filter
(
x
=>
x
.
bu7id
.
includes
(
this
.
bu7Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu7Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu7Table
.
search
))
return
this
.
bu7List
.
filter
(
x
=>
x
.
bu7id
.
toLowerCase
().
includes
(
this
.
bu7Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu7Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu7Table
.
search
.
toLowerCase
()
))
}
selectBu7
(
bu7
?:
Bu7Model
)
{
this
.
bu7
=
new
MyBu7Model
(
bu7
||
{})
...
...
@@ -140,9 +140,9 @@ export class SubDepartmentFourComponent implements OnInit {
this
.
bu7Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu7Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu7Modal
()
{
return
this
.
bu7List
.
filter
(
x
=>
x
.
bu7id
.
includes
(
this
.
bu7Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu7Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu7Modal
.
search
))
return
this
.
bu7List
.
filter
(
x
=>
x
.
bu7id
.
toLowerCase
().
includes
(
this
.
bu7Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu7Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu7Modal
.
search
.
toLowerCase
()
))
}
addBu7
()
{
this
.
bu7Service
.
post
({
...
this
.
bu7
,
parent
:
this
.
bu6
.
bu6id
}).
subscribe
({
...
...
@@ -188,9 +188,9 @@ export class SubDepartmentFourComponent implements OnInit {
this
.
selectBu6
(
bu6
||
new
MyBu6Model
({
bu6id
:
this
.
bu6
.
bu6id
}))
}
filterBu6Modal
()
{
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
includes
(
this
.
bu6Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu6Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu6Modal
.
search
))
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
))
}
selectBu6
(
bu6
?:
Bu6Model
)
{
this
.
bu6
=
new
MyBu6Model
(
bu6
||
{})
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-one/sub-department-one.component.ts
View file @
cd558547
...
...
@@ -116,9 +116,9 @@ export class SubDepartmentOneComponent implements OnInit {
this
.
bu4Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu4Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu4Table
()
{
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
includes
(
this
.
bu4Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu4Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu4Table
.
search
))
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
()
))
}
selectBu4
(
bu4
?:
Bu4Model
)
{
this
.
bu4
=
new
MyBu4Model
(
bu4
||
{})
...
...
@@ -139,9 +139,9 @@ export class SubDepartmentOneComponent implements OnInit {
this
.
bu4Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu4Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu4Modal
()
{
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
includes
(
this
.
bu4Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu4Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu4Modal
.
search
))
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
))
}
addBu4
()
{
this
.
bu4Service
.
post
({
...
this
.
bu4
,
parent
:
this
.
bu3
.
bu3id
}).
subscribe
({
...
...
@@ -187,9 +187,9 @@ export class SubDepartmentOneComponent implements OnInit {
this
.
selectBu3
(
bu3
||
new
MyBu3Model
({
bu3id
:
this
.
bu3
.
bu3id
}))
}
filterBu3Modal
()
{
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
includes
(
this
.
bu3Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu3Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu3Modal
.
search
))
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu3Modal
.
search
.
toLowerCase
()
))
}
selectBu3
(
bu3
?:
Bu3Model
)
{
this
.
bu3
=
new
MyBu3Model
(
bu3
||
{})
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-three/sub-department-three.component.ts
View file @
cd558547
...
...
@@ -117,9 +117,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this
.
bu6Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu6Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu6Table
()
{
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
includes
(
this
.
bu6Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu6Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu6Table
.
search
))
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
toLowerCase
().
includes
(
this
.
bu6Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu6Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu6Table
.
search
.
toLowerCase
()
))
}
selectBu6
(
bu6
?:
Bu6Model
)
{
this
.
bu6
=
new
MyBu6Model
(
bu6
||
{})
...
...
@@ -140,9 +140,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this
.
bu6Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu6Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu6Modal
()
{
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
includes
(
this
.
bu6Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu6Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu6Modal
.
search
))
return
this
.
bu6List
.
filter
(
x
=>
x
.
bu6id
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu6Modal
.
search
.
toLowerCase
()
))
}
addBu6
()
{
this
.
bu6Service
.
post
({
...
this
.
bu6
,
parent
:
this
.
bu5
.
bu5id
}).
subscribe
({
...
...
@@ -188,9 +188,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this
.
selectBu5
(
bu5
||
new
MyBu5Model
({
bu5id
:
this
.
bu5
.
bu5id
}))
}
filterBu5Modal
()
{
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
includes
(
this
.
bu5Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu5Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu5Modal
.
search
))
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
))
}
selectBu5
(
bu5
?:
Bu5Model
)
{
this
.
bu5
=
new
MyBu5Model
(
bu5
||
{})
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts
View file @
cd558547
...
...
@@ -116,9 +116,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this
.
bu5Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu5Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu5Table
()
{
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
includes
(
this
.
bu5Table
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu5Table
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu5Table
.
search
))
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
toLowerCase
().
includes
(
this
.
bu5Table
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu5Table
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu5Table
.
search
.
toLowerCase
()
))
}
selectBu5
(
bu5
?:
Bu5Model
)
{
this
.
bu5
=
new
MyBu5Model
(
bu5
||
{})
...
...
@@ -139,9 +139,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this
.
bu5Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu5Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu5Modal
()
{
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
includes
(
this
.
bu5Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu5Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu5Modal
.
search
))
return
this
.
bu5List
.
filter
(
x
=>
x
.
bu5id
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu5Modal
.
search
.
toLowerCase
()
))
}
addBu5
()
{
this
.
bu5Service
.
post
({
...
this
.
bu5
,
parent
:
this
.
bu4
.
bu4id
}).
subscribe
({
...
...
@@ -187,9 +187,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this
.
selectBu4
(
bu4
||
new
MyBu4Model
({
bu4id
:
this
.
bu4
.
bu4id
}))
}
filterBu4Modal
()
{
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
includes
(
this
.
bu4Modal
.
search
)
||
x
.
tdesc
.
includes
(
this
.
bu4Modal
.
search
)
||
x
.
edesc
.
includes
(
this
.
bu4Modal
.
search
))
return
this
.
bu4List
.
filter
(
x
=>
x
.
bu4id
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
bu4Modal
.
search
.
toLowerCase
()
))
}
selectBu4
(
bu4
?:
Bu4Model
)
{
this
.
bu4
=
new
MyBu4Model
(
bu4
||
{})
...
...
src/app/components/company-components/job-description/employee-categories/employee-categories.component.html
View file @
cd558547
...
...
@@ -3,12 +3,12 @@
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#employee-categories-
page-
upload-modal"
>
data-hs-overlay=
"#employee-categories-upload-modal"
>
<i
class=
"ri-add-line"
></i>
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 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"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -221,7 +221,7 @@
<div
class=
"flex justify-end"
>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-categories-page-modal"
>
data-hs-overlay=
"#employee-categories-page-
alert-
modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -273,3 +273,33 @@
</div>
</div>
</div>
<div
id=
"employee-categories-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<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
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 mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
src/app/components/company-components/job-description/employee-categories/employee-categories.component.ts
View file @
cd558547
...
...
@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angu
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
EmpTypeModel
,
MyEmpTypeModel
}
from
'src/app/shared/model/employee-type.model'
;
import
{
EmpTypeService
}
from
'src/app/shared/services/employee-type.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
codeId
:
string
tdesc
:
string
...
...
@@ -35,23 +36,75 @@ export class EmployeeCategories {
dataSelect
:
DataModel
=
{
codeId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}
itemToDelete
:
EmpTypeModel
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
empTypeService
:
EmpTypeService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
)
{
}
ngOnInit
():
void
{
this
.
getEmpTypeList
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'employment_type'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmpTypeList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
downloadFile
()
{
const
fileName
=
'IMPORT_MEMPLOYMENTTYPE.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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'
)
}
})
}
getEmpTypeList
()
{
this
.
dataLoading
=
true
this
.
empTypeService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
emp_typelist
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
codeId
:
x
.
codeId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
companyId
:
x
.
companyId
}
}))
this
.
dataLoading
=
false
this
.
searchChange
();
this
.
cdr
.
detectChanges
();
},
error
:
err
=>
{
console
.
error
(
'Error fetching employee types:'
,
err
);
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
});
}
...
...
@@ -63,17 +116,14 @@ export class EmployeeCategories {
emp_typeListFilter
()
{
return
this
.
emp_typelist
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
codeId
.
includes
(
this
.
search
)
||
data
.
tdesc
.
includes
(
this
.
search
)
||
data
.
edesc
.
includes
(
this
.
search
);
const
match
=
data
.
codeId
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
edesc
.
toLowerCase
()
.
includes
(
this
.
search
);
return
match
;
});
}
setData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
code
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}));
}
// selectEmp_type(emp_type?: EmpTypeModel) {
// // this.showSuccess()
// this.emp_type = new MyEmpTypeModel(emp_type || {})
// }
addEmp_type
()
{
const
body
=
new
MyEmpTypeModel
({
codeId
:
this
.
dataSelect
.
codeId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
companyId
:
this
.
dataSelect
.
companyId
})
this
.
empTypeService
.
post
(
body
).
subscribe
({
...
...
src/app/components/company-components/job-description/employee-group-unit/employee-group-unit.component.html
View file @
cd558547
...
...
@@ -3,12 +3,12 @@
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#
company-registration-page
-upload-modal"
>
data-hs-overlay=
"#
employee-group-unit-component
-upload-modal"
>
<i
class=
"ri-add-line"
></i>
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 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"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -27,14 +27,14 @@
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#employee-group-unit-component-
modal-add"
(
click
)="
selectEmp_group
()"
>
data-hs-overlay=
"#employee-group-unit-component-
page-modal"
(
click
)="
modalStatus=
'add'
;
setData
()"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-20px m-0 shadow-md"
data-hs-overlay=
"#employee-group-unit-component-
alert-delete-checkbox-modal"
(
click
)="
selectEmp_group
()"
>
data-hs-overlay=
"#employee-group-unit-component-
page-alert-modal"
(
click
)="
modalStatus=
'deleteGroup'
;
setData
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
...
...
@@ -58,7 +58,7 @@
<th
scope=
"col"
class=
"relative px-10px py-10px bg-soft-secondary text-primary !text-center"
>
<span
class=
"font-size-12px font-weight-700"
>
<ng-container
*
ngIf=
"i === 0"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
(
change
)="
toggleSelectAll
($
event
)"
style=
"margin-right: 10px;"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
(
change
)="
toggleSelectAll
($
event
)"
style=
"margin-right: 10px;"
>
</ng-container>
</span>
<span
class=
"font-size-12px font-weight-700"
>
{{ item }}
</span>
...
...
@@ -69,28 +69,38 @@
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"!emp_groupListFilter().length"
>
<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&&!emp_groupListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"emp_groupListFilter().length"
>
<tbody
*
ngIf=
"
!dataLoading&&
emp_groupListFilter().length"
>
<tr
*
ngFor=
"let item of emp_groupListFilter() | 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.groupId}}"
[
checked
]="
selectedItems
.
includes
(
item
.
groupId
)"
(
change
)="
toggleSelection
(
item
.
groupId
,
$
event
)"
>
<label
for=
"checkbox-{{item.groupId}}"
>
{{item.groupId}}
</label>
<input
*
ngIf=
"item.data.groupId!='100'"
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.groupId}}"
[(
ngModel
)]="
item
.
check
"
>
<label
for=
"checkbox-{{item.data.groupId}}"
>
{{item.data.groupId}}
</label>
</td>
<td>
{{item.tdesc}}
</td>
<td>
{{item.edesc}}
</td>
<td>
{{item.
data.
tdesc}}
</td>
<td>
{{item.
data.
edesc}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectEmp_group
(
item
)"
data-hs-overlay=
"#employee-group-unit-component-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
(
click
)="
selectEmp_group
(
item
)"
data-hs-overlay=
"#employee-group-unit-component-alert-delete-modal"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
modalStatus=
'edit'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#employee-group-unit-component-page-modal"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
*
ngIf=
"item.data.groupId!='100'"
(
click
)="
modalStatus=
'delete'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
></i>
</td>
</tr>
</tbody>
...
...
@@ -127,21 +137,26 @@
</a>
</li>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{((currentPage-1) * 10)+1}} to {{emp_groupListFilter().length
<10
?
emp_groupListFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
10
)
-
((
currentPage
*
10
)
-
emp_groupListFilter
().
length
)
)
:
(
currentPage
*
10
)
)
}}
of
{{
emp_groupListFilter
().
length
}}
items
</
span
>
</ul>
</nav>
</div>
<div
id=
"employee-group-unit-component-
modal-add
"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"employee-group-unit-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=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
เพิ่มข้อมูลกลุ่มพนักงาน
{{modalStatus=='add'?'เพิ่มข้อมูลกลุ่มพนักงาน':'แก้ไขข้อมูลกลุ่มพนักงาน'}}
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-
modal-add
"
>
data-hs-overlay=
"#employee-group-unit-component-
page-modal
"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -176,150 +191,19 @@
</div>
<div
class=
"ti-modal-body "
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสกลุ่มพนักงาน
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
(
ngModel
)]="
emp_group
.
groupId
"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:modalStatus=
='edit'}"
[
readonly
]="
modalStatus=
='edit'"
[(
ngModel
)]="
dataSelect
.
groupId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_group
.
tdesc
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_group
.
edesc
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-2"
>
<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=
"#employee-group-unit-component-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-modal-edit"
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"
>
แก้ไขข้อมูลกลุ่มพนักงาน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-modal-edit"
>
<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"
>
<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 "
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสกลุ่มพนักงาน
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 bg-input-readonly"
readonly
[(
ngModel
)]="
emp_group
.
groupId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_group
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_group
.
edesc
"
>
<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=
"#employee-group-unit-component-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-edit-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-modal-upload"
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-upload"
>
<div
class=
"modal-headerupload bg-primary"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าข้อมูลบริษัท
</h5>
</div>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2"
style=
"margin-left: 10px;"
>
<div
class=
"flex rounded-md"
>
<input
type=
"text"
id=
"hs-trailing-button-add-on-with-icon"
name=
"hs-trailing-button-add-on-with-icon"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10"
>
<button
aria-label=
"button"
type=
"button"
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-primary text-white hover:bg-primary focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<a
class=
"ti-btn ti-btn-primary"
href=
"javascript:void(0);"
>
อัปโหลด
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-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"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-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"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</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=
"#employee-group-unit-component-modal-add"
>
data-hs-overlay=
"#employee-group-unit-component-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-
alert-modal"
(
click
)="
addEmp_group
()
"
>
data-hs-overlay=
"#employee-group-unit-component-
page-alert-modal
"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -328,7 +212,7 @@
</div>
</div>
<div
id=
"employee-group-unit-component-
alert-edi
t-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"employee-group-unit-component-
page-aler
t-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"
>
...
...
@@ -336,100 +220,85 @@
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการเเก้ไขข้อมูลหรือไม่
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</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=
"#employee-group-unit-component-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-edit-modal"
(
click
)="
addEmp_group
()"
>
บันทึกข้อมูล
</a>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='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=
"#employee-group-unit-component-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
(
click
)="
addEmp_group
()"
>
บันทึกข้อมูล
</a>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='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=
"#employee-group-unit-component-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
(
click
)="
deleteEmp_group
()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-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=
"#employee-group-unit-component-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"
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=
"#employee-group-unit-component-alert-delete-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-delete-modal"
(
click
)="
deleteEmp_group
()"
>
ลบข้อมูล
</a>
</div>
</div>
<div
id=
"employee-group-unit-component-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าฝ่าย
</h5>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-alert-delete-checkbox-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=
"#employee-group-unit-component-alert-delete-checkbox-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<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
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>
<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=
"#employee-group-unit-component-alert-delete-checkbox-modal"
>
ย้อนกลับ
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-delete-checkbox-modal"
(
click
)="
deleteSelectedItems
()"
>
ลบข้อมูล
</a>
</div>
</div>
</div>
...
...
src/app/components/company-components/job-description/employee-group-unit/employee-group-unit.component.ts
View file @
cd558547
...
...
@@ -2,6 +2,14 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } fro
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
EmpGroupModel
,
MyEmpGroupModel
}
from
'src/app/shared/model/emp-group.model'
;
import
{
EmpGroupService
}
from
'src/app/shared/services/emp-group.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
groupId
:
string
tdesc
:
string
edesc
:
string
companyId
:
string
checked
:
boolean
}
@
Component
({
selector
:
'app-employee-group-unit'
,
...
...
@@ -13,78 +21,92 @@ export class EmployeeGroupUnit implements OnInit {
@
Output
()
sendPathTitle
:
EventEmitter
<
string
[]
>
=
new
EventEmitter
<
string
[]
>
();
activeTab
:
string
=
'tab1'
;
// กำหนด tab เริ่มต้น
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab
(
tab
:
{
id
:
string
,
text
:
string
})
{
this
.
sendPathTitle
.
emit
([
'การจัดการข้อมูลองค์กร'
,
'ข้อมูลลักษณะงาน'
,
tab
.
text
])
this
.
activeTab
=
tab
.
id
;
}
currentPage
=
1
selectedItems
:
string
[]
=
[];
modalStatus
=
'add'
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
emp_groupList
:
EmpGroupModel
[]
=
[]
dataLoading
=
false
dataSelect
:
DataModel
=
{
groupId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
,
checked
:
false
}
emp_groupList
:
{
check
:
boolean
;
data
:
DataModel
&
{
checked
?:
boolean
}
}[]
=
[]
emp_group
:
EmpGroupModel
=
new
MyEmpGroupModel
({})
search
=
""
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
empGroupService
:
EmpGroupService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
)
{
}
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab
(
tab
:
{
id
:
string
,
text
:
string
})
{
this
.
sendPathTitle
.
emit
([
'การจัดการข้อมูลองค์กร'
,
'ข้อมูลลักษณะงาน'
,
tab
.
text
])
this
.
activeTab
=
tab
.
id
;
}
ngOnInit
():
void
{
this
.
getEmpGroupList
()
}
modalOptions
:
{
[
nameModal
:
string
]:
{
// ชื่อตรวจสอบการเปิดปิด
isModalOpen
:
boolean
;
// เปิด/ปิด
modalSize
:
string
;
// ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose
:
boolean
;
// (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"upload"
:
{
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
;
document
.
body
.
style
.
overflow
=
'hidden'
;
// ล็อก Scroll
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'mgroup'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmpGroupList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
isAnyModalOpen
():
boolean
{
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// หากไม่มี Modal อื่นเปิด
downloadFile
()
{
const
fileName
=
'IMPORT_MGROUP.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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'
)
}
})
}
getEmpGroupList
()
{
this
.
empGroupService
.
getList
().
subscribe
(
response
=>
{
this
.
emp_groupList
=
response
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
dataLoading
=
true
this
.
empGroupService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
emp_groupList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
groupId
:
x
.
groupId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
companyId
:
x
.
companyId
,
checked
:
false
}
}))
this
.
dataLoading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
})
}
searchChange
()
{
...
...
@@ -92,84 +114,73 @@ export class EmployeeGroupUnit implements OnInit {
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
emp_groupListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
emp_groupListFilter
()
{
return
this
.
emp_groupList
.
filter
(
x
=>
x
.
groupId
.
includes
(
this
.
search
)
||
x
.
tdesc
.
includes
(
this
.
search
)
||
x
.
edesc
.
includes
(
this
.
search
))
}
selectEmp_group
(
emp_group
?:
EmpGroupModel
)
{
this
.
emp_group
=
new
MyEmpGroupModel
(
emp_group
||
{})
}
showSuccess
()
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
return
this
.
emp_groupList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
groupId
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
search
);
return
match
;
});
}
showSuccesssEdit
()
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
}
showSuccessDelete
()
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
setData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
groupId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}));
}
addEmp_group
()
{
this
.
empGroupService
.
post
(
this
.
emp_group
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
getEmpGroupList
()
this
.
showSuccess
()
const
body
=
new
MyEmpGroupModel
({
groupId
:
this
.
dataSelect
.
groupId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
companyId
:
this
.
dataSelect
.
companyId
})
this
.
empGroupService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmpGroupList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
deleteEmp_group
()
{
this
.
empGroupService
.
delete
(
this
.
emp_group
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
getEmpGroupList
()
this
.
showSuccessDelete
()
}
})
}
toggleSelection
(
groupId
:
string
,
event
:
Event
)
{
const
checked
=
(
event
.
target
as
HTMLInputElement
).
checked
;
if
(
checked
)
{
this
.
selectedItems
.
push
(
groupId
);
let
body
:
EmpGroupModel
|
EmpGroupModel
[]
=
[];
if
(
this
.
dataSelect
.
groupId
)
{
body
=
new
MyEmpGroupModel
({
groupId
:
this
.
dataSelect
.
groupId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
companyId
:
this
.
dataSelect
.
companyId
});
}
else
{
this
.
selectedItems
=
this
.
selectedItems
.
filter
(
id
=>
id
!==
groupId
);
body
=
this
.
emp_groupList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyEmpGroupModel
({
groupId
:
x
.
data
.
groupId
,
tdesc
:
x
.
data
.
tdesc
,
edesc
:
x
.
data
.
edesc
,
companyId
:
x
.
data
.
companyId
})
);
}
this
.
empGroupService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
);
this
.
getEmpGroupList
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
);
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
});
}
toggleSelectAll
(
event
:
Event
)
{
const
checked
=
(
event
.
target
as
HTMLInputElement
).
checked
;
if
(
checked
)
{
this
.
selectedItems
=
this
.
emp_groupListFilter
().
map
(
item
=>
item
.
groupId
);
}
else
{
this
.
selectedItems
=
[];
}
}
deleteSelectedItems
()
{
if
(
this
.
selectedItems
.
length
===
0
)
{
alert
(
"เลือกข้อมูลก่อนลบ"
);
return
;
}
const
selectedGroups
=
this
.
emp_groupListFilter
().
filter
(
item
=>
this
.
selectedItems
.
includes
(
item
.
groupId
));
this
.
empGroupService
.
delete
(
selectedGroups
).
subscribe
({
next
:
(
response
)
=>
{
console
.
log
(
"ลบสำเร็จ"
,
response
);
this
.
selectedItems
=
[];
this
.
getEmpGroupList
();
this
.
showSuccessDelete
()
},
error
:
(
error
)
=>
{
console
.
error
(
"เกิดข้อผิดพลาดในการลบ"
,
error
);
}
this
.
emp_groupList
.
forEach
(
item
=>
{
item
.
check
=
checked
;
// อัปเดตค่า check ใน emp_groupList
});
// อัปเดตรายการ selectedItems ด้วย groupId ของรายการที่ถูกเลือก
this
.
selectedItems
=
checked
?
this
.
emp_groupList
.
map
(
item
=>
item
.
data
.
groupId
)
:
[];
this
.
cdr
.
detectChanges
();
// แจ้ง Angular ให้รีเฟรช UI
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
}
}
src/app/components/company-components/job-description/employee-level/employee-level.component.html
View file @
cd558547
...
...
@@ -8,7 +8,7 @@
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 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"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -210,31 +210,33 @@
</div>
</div>
<div
id=
"employee-level-modal-upload"
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 h-96"
>
<div
class=
"ti-modal-header bg-primary"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าข้อมูลบริษัท
</h5>
<div
id=
"employee-level-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าฝ่าย
</h5>
</div>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2 px-2"
>
<div
class=
"flex rounded-md"
>
<input
type=
"text"
id=
"hs-trailing-button-add-on-with-icon"
name=
"hs-trailing-button-add-on-with-icon"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10"
>
<button
aria-label=
"button"
type=
"button"
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-primary text-white hover:bg-primary focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<a
class=
"ti-btn ti-btn-primary"
href=
"javascript:void(0);"
>
อัปโหลด
</a>
</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
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 mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -248,7 +250,7 @@
<div
class=
"flex justify-end"
>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-level-page-modal"
>
data-hs-overlay=
"#employee-level-page-
alert-
modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
src/app/components/company-components/job-description/employee-level/employee-level.component.ts
View file @
cd558547
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
MyPLModel
,
PLModel
}
from
'src/app/shared/model/pl.model'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
PLService
}
from
'src/app/shared/services/pl.service'
;
export
interface
DataModel
{
plId
:
string
...
...
@@ -34,24 +35,76 @@ export class EmployeeLevel implements OnInit {
dataSelect
:
DataModel
=
{
plId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}
itemToDelete
:
PLModel
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
plService
:
PLService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
)
{
}
ngOnInit
():
void
{
this
.
getPLList
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'pl'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPLList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
downloadFile
()
{
const
fileName
=
'IMPORT_PL.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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'
)
}
})
}
getPLList
()
{
this
.
dataLoading
=
true
this
.
plService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
plList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
plId
:
x
.
plId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
companyId
:
x
.
companyId
}
}))
this
.
dataLoading
=
false
this
.
searchChange
();
this
.
cdr
.
detectChanges
();
},
error
:
err
=>
{
console
.
error
(
'Error fetching employee types:'
,
err
);
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
});
}
...
...
@@ -64,7 +117,7 @@ export class EmployeeLevel implements OnInit {
plListFilter
()
{
return
this
.
plList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
plId
.
includes
(
this
.
search
)
||
data
.
tdesc
.
includes
(
this
.
search
)
||
data
.
edesc
.
includes
(
this
.
search
);
const
match
=
data
.
plId
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
edesc
.
toLowerCase
()
.
includes
(
this
.
search
);
return
match
;
});
}
...
...
src/app/components/company-components/job-description/position/position-unit.component.html
View file @
cd558547
...
...
@@ -3,12 +3,12 @@
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#
company-registration-page
-upload-modal"
>
data-hs-overlay=
"#
position-unit-component
-upload-modal"
>
<i
class=
"ri-add-line"
></i>
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 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"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -27,14 +27,14 @@
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#position-unit-component-
modal-add"
(
click
)="
selectPosition
()"
>
data-hs-overlay=
"#position-unit-component-
page-modal"
(
click
)="
modalStatus=
'add'
;
setData
()"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-20px m-0 shadow-md"
data-hs-overlay=
"#position-unit-component-
alert-delete-check-modal"
(
click
)="
selectPosition
()"
>
data-hs-overlay=
"#position-unit-component-
page-alert-modal"
(
click
)="
modalStatus=
'deleteGroup'
;
setData
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
...
...
@@ -65,29 +65,39 @@
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"!positionListFilter().length"
>
<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&&!positionListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"positionListFilter().length"
>
<tbody
*
ngIf=
"
!dataLoading&&
positionListFilter().length"
>
<tr
*
ngFor=
"let item of positionListFilter() | 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.positionId}}"
[
checked
]="
selectedItems
.
includes
(
item
.
positionId
)"
(
change
)="
toggleSelection
(
item
.
positionId
,
$
event
)"
>
<label
for=
"checkbox-{{item.positionId}}"
>
{{item.positionId}}
</label>
<input
*
ngIf=
"item.data.positionId!='100'"
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.positionId}}"
[(
ngModel
)]="
item
.
check
"
>
<label
for=
"checkbox-{{item.data.positionId}}"
>
{{item.data.positionId}}
</label>
</td>
<td>
{{item.tdesc}}
</td>
<td>
{{item.edesc}}
</td>
<td>
{{item.
data.
tdesc}}
</td>
<td>
{{item.
data.
edesc}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectPosition
(
item
)"
data-hs-overlay=
"#position-unit-component-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
(
click
)="
selectPosition
(
item
)"
data-hs-overlay=
"#position-unit-component-alert-delete-modal"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
modalStatus=
'edit'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#position-unit-component-page-modal"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
*
ngIf=
"item.data.positionId!='100'"
(
click
)="
modalStatus=
'delete'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
></i>
</td>
</tr>
</tbody>
...
...
@@ -124,20 +134,25 @@
</a>
</li>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{((currentPage-1) * 10)+1}} to {{positionListFilter().length
<10
?
positionListFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
10
)
-
((
currentPage
*
10
)
-
positionListFilter
().
length
)
)
:
(
currentPage
*
10
)
)
}}
of
{{
positionListFilter
().
length
}}
items
</
span
>
</ul>
</nav>
</div>
<div
id=
"position-unit-component-
modal-add
"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"position-unit-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=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
เพิ่มข้อมูลตำเเหน่ง
{{modalStatus=='add'?'เพิ่มข้อมูลตำเเหน่ง':'แก้ไขข้อมูลตำเเหน่ง'}}
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#position-unit-component-
modal-add
"
>
data-hs-overlay=
"#position-unit-component-
page-modal
"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -172,19 +187,19 @@
</div>
<div
class=
"ti-modal-body "
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสตำเเหน่ง
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 "
[
(
ngModel
)]="
position
.
positionId
"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 "
[
ngClass
]="{'
bg-input-readonly
'
:modalStatus=
='edit'}"
[
readonly
]="
modalStatus=
='edit'"
[(
ngModel
)]="
dataSelect
.
positionId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
position
.
tdesc
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
position
.
edesc
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-2"
>
<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=
"#position-unit-component-
modal-add
"
>
data-hs-overlay=
"#position-unit-component-
page-modal
"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-modal"
>
data-hs-overlay=
"#position-unit-component-
page-
alert-modal"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -193,100 +208,7 @@
</div>
</div>
<div
id=
"position-unit-component-modal-edit"
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"
>
แก้ไขข้อมูลตำเเหน่ง
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#position-unit-component-modal-edit"
>
<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"
>
<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 "
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสตำเเหน่ง
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 bg-input-readonly"
readonly
[(
ngModel
)]="
position
.
positionId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
position
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
position
.
edesc
"
>
<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=
"#position-unit-component-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-edit-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"position-unit-component-modal-upload"
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-upload"
>
<div
class=
"modal-headerupload bg-primary"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าข้อมูลบริษัท
</h5>
</div>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2"
style=
"margin-left: 10px;"
>
<div
class=
"flex rounded-md"
>
<input
type=
"text"
id=
"hs-trailing-button-add-on-with-icon"
name=
"hs-trailing-button-add-on-with-icon"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10"
>
<button
aria-label=
"button"
type=
"button"
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-primary text-white hover:bg-primary focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<a
class=
"ti-btn ti-btn-primary"
href=
"javascript:void(0);"
>
อัปโหลด
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"position-unit-component-alert-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"position-unit-component-page-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"
>
...
...
@@ -294,137 +216,85 @@
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#position-unit-component-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"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</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=
"#position-unit-component-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-modal"
(
click
)="
addPosition
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"position-unit-component-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"
data-hs-overlay=
"#position-unit-component-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการเเก้ไขข้อมูลหรือไม่
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</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=
"#position-unit-component-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-edit-modal"
(
click
)="
addPosition
()"
>
บันทึกข้อมูล
</a>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='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=
"#position-unit-component-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
(
click
)="
addPosition
()"
>
บันทึกข้อมูล
</a>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='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=
"#position-unit-component-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
(
click
)="
deletePosition
()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
<div
id=
"position-unit-component-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=
"#position-unit-component-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"
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=
"#position-unit-component-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-delete-modal"
(
click
)="
deletePosition
()"
>
ลบข้อมูล
</a>
</div>
</div>
<div
id=
"position-unit-component-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าฝ่าย
</h5>
</div>
</div>
</div>
<div
id=
"position-unit-component-alert-delete-check-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=
"#position-unit-component-alert-delete-check-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<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
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>
<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=
"#position-unit-component-alert-delete-check-modal"
>
ย้อนกลับ
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#position-unit-component-alert-delete-check-modal"
(
click
)="
deleteSelectedItems
()"
>
ลบข้อมูล
</a>
</div>
</div>
</div>
...
...
src/app/components/company-components/job-description/position/position-unit.component.ts
View file @
cd558547
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
MyPositionModel
,
PositionModel
}
from
'src/app/shared/model/position.model'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
PositionService
}
from
'src/app/shared/services/position.service'
;
export
interface
DataModel
{
positionId
:
string
tdesc
:
string
edesc
:
string
consolidate
:
string
shortName
:
string
companyId
:
string
}
@
Component
({
selector
:
'app-position-unit'
,
...
...
@@ -20,22 +29,82 @@ export class PositionUnitComponent implements OnInit {
}
currentPage
=
1
selectedItems
:
string
[]
=
[];
search
=
""
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
modalStatus
=
'add'
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
positionList
:
PositionModel
[]
=
[]
positionList
:
{
check
:
boolean
,
data
:
DataModel
}
[]
=
[]
position
:
PositionModel
=
new
MyPositionModel
({})
search
=
""
dataLoading
=
false
dataSelect
:
DataModel
=
{
positionId
:
""
,
tdesc
:
""
,
edesc
:
""
,
consolidate
:
""
,
shortName
:
""
,
companyId
:
""
}
constructor
(
private
positionService
:
PositionService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
)
{
}
ngOnInit
():
void
{
this
.
getPositionList
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'mposition'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPositionList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
downloadFile
()
{
const
fileName
=
'IMPORT_MPOSITION.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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'
)
}
})
}
getPositionList
()
{
this
.
positionService
.
getList
().
subscribe
(
response
=>
{
this
.
positionList
=
response
.
map
(
x
=>
new
MyPositionModel
(
x
))
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
this
.
dataLoading
=
true
this
.
positionService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
positionList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
positionId
:
x
.
positionId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
consolidate
:
x
.
consolidate
,
shortName
:
x
.
shortName
,
companyId
:
x
.
companyId
}
}))
this
.
dataLoading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
();
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
})
}
searchChange
()
{
...
...
@@ -43,83 +112,63 @@ export class PositionUnitComponent implements OnInit {
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
positionListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
positionListFilter
()
{
return
this
.
positionList
.
filter
(
x
=>
x
.
positionId
.
includes
(
this
.
search
)
||
x
.
tdesc
.
includes
(
this
.
search
)
||
x
.
edesc
.
includes
(
this
.
search
))
}
selectPosition
(
position
?:
PositionModel
)
{
// this.showSuccess()
this
.
position
=
new
MyPositionModel
(
position
||
{})
}
showSuccess
()
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
}
showSuccesssEdit
()
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
return
this
.
positionList
.
filter
(
x
=>
{
const
data
=
x
.
data
;
const
searchLower
=
this
.
search
.
toLowerCase
();
return
(
(
data
.
positionId
?.
toLowerCase
()
||
''
).
includes
(
searchLower
)
||
(
data
.
tdesc
?.
toLowerCase
()
||
''
).
includes
(
searchLower
)
||
(
data
.
edesc
?.
toLowerCase
()
||
''
).
includes
(
searchLower
)
||
(
data
.
consolidate
?.
toLowerCase
()
||
''
).
includes
(
searchLower
)
||
(
data
.
shortName
?.
toLowerCase
()
||
''
).
includes
(
searchLower
)
);
});
}
showSuccessDelete
()
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
setData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
positionId
:
""
,
tdesc
:
""
,
edesc
:
""
,
consolidate
:
""
,
shortName
:
""
,
companyId
:
""
}));
}
addPosition
()
{
this
.
positionService
.
post
(
this
.
position
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
getPositionList
()
this
.
showSuccess
()
const
body
=
new
MyPositionModel
({
positionId
:
this
.
dataSelect
.
positionId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
consolidate
:
this
.
dataSelect
.
consolidate
,
shortName
:
this
.
dataSelect
.
shortName
,
companyId
:
this
.
dataSelect
.
companyId
})
this
.
positionService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPositionList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
deletePosition
()
{
this
.
positionService
.
delete
(
this
.
position
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
getPositionList
()
this
.
showSuccessDelete
()
}
})
}
toggleSelection
(
positionId
:
string
,
event
:
Event
)
{
const
checked
=
(
event
.
target
as
HTMLInputElement
).
checked
;
if
(
checked
)
{
this
.
selectedItems
.
push
(
positionId
);
let
body
:
PositionModel
|
PositionModel
[]
=
[]
if
(
this
.
dataSelect
.
positionId
)
{
body
=
new
MyPositionModel
({
positionId
:
this
.
dataSelect
.
positionId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
consolidate
:
this
.
dataSelect
.
consolidate
,
shortName
:
this
.
dataSelect
.
shortName
,
companyId
:
this
.
dataSelect
.
companyId
})
}
else
{
this
.
selectedItems
=
this
.
selectedItems
.
filter
(
id
=>
id
!==
positionId
);
body
=
this
.
positionList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyPositionModel
({
positionId
:
x
.
data
.
positionId
,
tdesc
:
x
.
data
.
tdesc
,
edesc
:
x
.
data
.
edesc
,
consolidate
:
x
.
data
.
consolidate
,
shortName
:
x
.
data
.
shortName
,
companyId
:
x
.
data
.
companyId
}))
}
}
toggleSelectAll
(
event
:
Event
)
{
const
checked
=
(
event
.
target
as
HTMLInputElement
).
checked
;
if
(
checked
)
{
this
.
selectedItems
=
this
.
positionListFilter
().
map
(
item
=>
item
.
positionId
);
}
else
{
this
.
selectedItems
=
[];
}
}
deleteSelectedItems
()
{
if
(
this
.
selectedItems
.
length
===
0
)
{
alert
(
"เลือกข้อมูลก่อนลบ"
);
return
;
}
const
selectedGroups
=
this
.
positionListFilter
().
filter
(
item
=>
this
.
selectedItems
.
includes
(
item
.
positionId
));
this
.
positionService
.
delete
(
selectedGroups
).
subscribe
({
next
:
(
response
)
=>
{
console
.
log
(
"ลบสำเร็จ"
,
response
);
this
.
selectedItems
=
[];
this
.
getPositionList
();
this
.
showSuccessDelete
()
},
error
:
(
error
)
=>
{
console
.
error
(
"เกิดข้อผิดพลาดในการลบ"
,
error
);
this
.
positionService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPositionList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
}
}
...
...
src/app/components/competency-assessment/name-registration/competency-topic/competency-topic.component.html
View file @
cd558547
...
...
@@ -5,7 +5,7 @@
<div
class=
"flex gap-x-6"
>
<div
class=
"flex items-center"
>
<label
for=
"hs-checkbox-group-1"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
{{
mockDataSelec
t.length}}
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
{{
dataSelectLis
t.length}}
Selected
</label>
</div>
...
...
@@ -35,28 +35,24 @@
<div
class=
"px-1"
>
<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"
data-hs-overlay=
"#competency-topic-
modal-add
"
>
data-hs-overlay=
"#competency-topic-
upload-modal
"
>
<i
class=
"ti ti-file-plus"
></i>
import
</button>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
data-hs-overlay=
"#competency-topic-
modal-add"
(
click
)="
selectCompetencytopic
()"
>
data-hs-overlay=
"#competency-topic-
page-modal"
(
click
)="
modalStatus=
'add'
;
setData
()"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<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=
"#competency-topic-page-alert-modal"
(
click
)="
modalStatus=
'deleteGroup'
;
setData
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
<!-- <button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay="#competency-topic-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button> -->
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-10 m-0 shadow-md"
>
...
...
@@ -106,18 +102,18 @@
<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.id}}"
[(
ngModel
)]="
item
.
check
ed
"
(
change
)="
checkSelect
()"
>
<label
for=
"checkbox-{{item.
id}}"
>
{{item
.id}}
</label>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.
data.
id}}"
[(
ngModel
)]="
item
.
check
"
(
change
)="
checkSelect
()"
>
<label
for=
"checkbox-{{item.
data.id}}"
>
{{item.data
.id}}
</label>
</td>
<td>
{{item.name}}
</td>
<td
class=
"text-center"
>
{{item.code}}
</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"
data-hs-overlay=
"#competency-topic-
modal-edit"
(
click
)="
selectCompetencytopic
(
item
)
"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#competency-topic-alert-delete-modal
"
(
click
)="
selectCompetencytopic
(
item
)
"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
modalStatus=
'edit'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#competency-topic-
page-modal
"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
*
ngIf=
"item.data.id!='100'"
(
click
)="
modalStatus=
'delete'
;
setData
(
item
.
data
)
"
data-hs-overlay=
"#competency-topic-page-alert-modal
"
></i>
</td>
</tr>
</tbody>
...
...
@@ -164,16 +160,16 @@
<div
id=
"competency-topic-
modal-add
"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"competency-topic-
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=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
เพิ่มหัวข้อสมรรถนะ
{{modalStatus=='add'?'เพิ่มหัวข้อสมรรถนะ':'แก้ไขประเภทสมรรถนะ'}}
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-
modal-add
"
>
data-hs-overlay=
"#competency-topic-
page-modal
"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -208,7 +204,7 @@
</div>
<div
class=
"ti-modal-body mt-1"
>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัส*
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[(
ngModel
)]="
dataSelect
.
id
"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:modalStatus=
='edit'}"
[
readonly
]="
modalStatus=
='edit'"
[
(
ngModel
)]="
dataSelect
.
id
"
>
<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
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
ชื่อหัวข้อ (อังกฤษ)
</label>
...
...
@@ -255,116 +251,11 @@
<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=
"#competency-topic-
modal-add
"
>
data-hs-overlay=
"#competency-topic-
page-modal
"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-alert-add-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"competency-topic-modal-edit"
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"
>
แก้ไขหัวข้อสมรรถนะ
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-modal-edit"
>
<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"
>
<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 mt-1"
>
<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
[(
ngModel
)]="
dataSelect
.
id
"
>
<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
"
>
<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
.
definition
"
>
</textarea>
<label
class=
"ti-form-label mt-2rem"
>
ประเภท Competency
</label>
<div
class=
"flex"
>
<div
class=
"relative flex rounded-md w-1/2"
>
<input
type=
"text"
id=
"hs-leading-button-add-on-with-icon-and-button"
name=
"hs-leading-button-add-on-with-icon-and-button"
class=
"ti-form-input rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10"
style=
"padding-right: 2.5rem;"
[(
ngModel
)]="
dataSelect
.
type
.
code
"
>
<div
class=
"absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"
>
<button
type=
"button"
class=
"flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay=
"#competency-topic-table-modal-edit"
>
<i
class=
"ri-search-line cursor-pointer text-gray"
></i>
</button>
</div>
</div>
</div>
<label
class=
"ti-form-label mt-2rem"
>
แนบไฟล์ข้อสอบ
</label>
<div>
<div
class=
"flex rounded-md"
>
<label
for=
"file-input-medium"
class=
"sr-only"
>
อัปโหลดไฟล์
</label>
<input
type=
"file"
id=
"file-input-medium"
name=
"file-input-medium"
class=
"block w-full border border-gray-200 focus:shadow-sm dark:focus:shadow-white/10 ltr:rounded-l-md rtl:rounded-r-none text-sm focus:z-10 focus:outline-0 focus:border-gray-200 dark:focus:border-white/10 dark:border-white/10 dark:text-white/70 file:border-0 file:bg-gray-100 ltr:file:mr-4 rtl:file:ml-4 file:py-3 file:px-4 dark:file:bg-black/20 dark:file:text-white/70"
>
<span
class=
"px-4 inline-flex items-center min-w-fit ltr:rounded-r-md rtl:rounded-l-none border ltr:border-l-0 rtl:border-r-0 border-gray-200 bg-gray-50 text-sm dark:bg-black/20 dark:border-white/10"
>
<button
class=
"text-sm text-gray-500 dark:text-white/70"
onclick=
"document.getElementById('file-input-medium').click();"
>
Browse
</button>
</span>
<div
class=
"flex items-center ml-2"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-10px m-0 shadow-md rounded-md"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
</div>
</div>
</div>
<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=
"#competency-topic-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-alert-edit-modal"
>
data-hs-overlay=
"#competency-topic-page-alert-modal"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -382,7 +273,7 @@
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-
modal-add
"
>
data-hs-overlay=
"#competency-topic-
page-modal
"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -454,7 +345,7 @@
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#competency-topic-
modal-add
"
data-hs-overlay=
"#competency-topic-
page-modal
"
(
click
)="
selectCompetencytype
(
item
)"
>
<i
class=
"ri-add-line"
></i>
Select
...
...
@@ -653,7 +544,7 @@
</div>
</div>
<div
id=
"competency-topic-
alert-add
-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"competency-topic-
page-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"
>
...
...
@@ -661,99 +552,85 @@
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-alert-add-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#competency-topic-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</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=
"#competency-topic-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-alert-add-modal"
(
click
)="
addUser
()"
>
บันทึกข้อมูล
</a>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='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=
"#competency-topic-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-page-alert-modal"
(
click
)="
addCompetency_topic
()"
>
บันทึกข้อมูล
</a>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='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=
"#competency-topic-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-page-alert-modal"
(
click
)="
deleteCompetency_topic
()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
<div
id=
"competency-topic-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"
data-hs-overlay=
"#competency-topic-alert-edit-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"
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=
"#competency-topic-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-alert-edit-modal"
(
click
)="
addUser
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
<div
id=
"competency-topic-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าฝ่าย
</h5>
</div>
</div>
</div>
<div
id=
"competency-topic-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=
"#competency-topic-alert-delete-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<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
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>
<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=
"#competency-topic-alert-delete-modal"
>
ย้อนกลับ
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#competency-topic-alert-delete-modal"
(
click
)="
deleteUser
()"
>
ลบข้อมูล
</a>
</div>
</div>
</div>
...
...
src/app/components/competency-assessment/name-registration/competency-topic/competency-topic.component.ts
View file @
cd558547
...
...
@@ -4,6 +4,7 @@ import { MyCompetencytopicModel } from 'src/app/shared/model/competencytopic.mod
import
{
MyCompetencytypeModel
}
from
'src/app/shared/model/competencytype.model'
;
import
{
CompetencytopicService
}
from
'src/app/shared/services/competencytopic.service'
;
import
{
CompetencytypeService
}
from
'src/app/shared/services/competencytype.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
id
:
string
name
:
string
...
...
@@ -27,14 +28,6 @@ export interface DataModel2 {
})
export
class
CompetencyTopic
{
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
currentPageModal
=
1
pageModal
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
searchModal
=
""
@
Input
()
pathTitle
=
[
'การประเมินสมรรถนะ'
,
'ทะเบียนกำหนดชื่อ'
,
'หัวข้อสมรรถนะ'
];
@
Output
()
sendPathTitle
:
EventEmitter
<
string
[]
>
=
new
EventEmitter
<
string
[]
>
();
activeTab
:
string
=
'tab1'
;
// กำหนด tab เริ่มต้น
...
...
@@ -45,109 +38,96 @@ export class CompetencyTopic {
this
.
activeTab
=
tab
.
id
;
}
// การจัดการการเปิดปิด modal
modalOptions
:
{
[
nameModal
:
string
]:
{
isModalOpen
:
boolean
;
modalSize
:
string
;
backdropClose
:
boolean
;
};
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
}
};
// [
// ['CC-01', 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality)','CC'],
// ['CC-02', 'การทำงานเป็นทีมแบบ TAT (TAT Teamwork)','CC'],
// ['CC-03', 'ความรับผิดชอบในหน้าที่และโปร่งใส (Accountability & Ethics)','CC'],
// ['MC-01', 'การคิดเชิงกลยุทธิ์ (Strategic Thinking)','MC'],
// ['MC-02', 'การมีทัศนคติเชิงบวก (Mindset-Growth)','MC'],
// ['PC-01', 'ความรู้ด้านกฏหมายแรงงาน, กฏหมายแพ่งภาณิชย์, กฏหมายอาญา','PC']
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
currentPageModal
=
1
pageModal
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
searchModal
=
""
mockData
:
DataModel
[]
=
[]
isChecked
:
boolean
=
false
;
// ใช้สำหรับตรวจสอบสถานะของ checkbox
currentModal
=
""
;
dataLoading
=
false
dataSelectList
:
DataModel
[]
=
[];
dataSelect
:
DataModel
=
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
definition
:
""
,
type
:
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
},
checked
:
false
}
competencytypeListLoading
=
false
competencytypeList
:
DataModel2
[]
=
[]
mockDataSelect
:
any
=
[]
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'
;
}
competoncyTopicList
:
{
check
:
boolean
;
data
:
DataModel
&
{
checked
?:
boolean
}
}[]
=
[]
modalStatus
=
'add'
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedItems
:
string
[]
=
[];
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
,
private
competencytopicService
:
CompetencytopicService
,
private
competencytypeService
:
CompetencytypeService
)
{
}
ngOnInit
():
void
{
this
.
getCompetencytopicList
()
this
.
getCompetencytypeList
()
}
isAnyModalOpen
():
boolean
{
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
checkSelect
()
{
this
.
dataSelectList
=
this
.
competoncyTopicList
.
filter
(
item
=>
item
.
check
).
map
(
item
=>
item
.
data
);
}
// ฟังก์ชัน toggle checkbox
isChecked
:
boolean
=
false
;
// ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox
()
{
this
.
isChecked
=
!
this
.
isChecked
;
// สลับสถานะ'
this
.
mockData
.
forEach
((
item
)
=>
{
item
.
check
ed
=
this
.
isChecked
;
this
.
competoncyTopicList
.
forEach
((
item
)
=>
{
item
.
check
=
this
.
isChecked
;
});
this
.
checkSelect
();
}
checkSelect
()
{
this
.
mockDataSelect
=
this
.
mockData
.
filter
(
item
=>
item
.
checked
);
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser
()
{
const
body
=
new
MyCompetencytopicModel
({
competencyTopicId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
competencyDetail
:
this
.
dataSelect
.
definition
,
competencyType
:
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
type
.
id
,
tdesc
:
this
.
dataSelect
.
type
.
name
,
edesc
:
this
.
dataSelect
.
type
.
edesc
,
shortName
:
this
.
dataSelect
.
type
.
code
,
expectationLevel
:
this
.
dataSelect
.
type
.
level
}),
})
this
.
competencytopicService
.
post
(
body
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showSuccess
()
this
.
getCompetencytopicList
()
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'competency_topic'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencytypeList
()
this
.
getCompetencytopicList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
deleteUser
()
{
const
body
=
new
MyCompetencytopicModel
({
competencyTopicId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
competencyDetail
:
this
.
dataSelect
.
definition
,
competencyType
:
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
type
.
id
,
tdesc
:
this
.
dataSelect
.
type
.
name
,
edesc
:
this
.
dataSelect
.
type
.
edesc
,
shortName
:
this
.
dataSelect
.
type
.
code
,
expectationLevel
:
this
.
dataSelect
.
type
.
level
}),
})
this
.
competencytopicService
.
delete
(
body
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showSuccessDelete
()
this
.
getCompetencytopicList
()
downloadFile
()
{
const
fileName
=
'IMPORT_COMPETENCY_TOPIC.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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
=
""
;
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
competencytopicService
:
CompetencytopicService
,
private
competencytypeService
:
CompetencytypeService
)
{
}
ngOnInit
():
void
{
this
.
getCompetencytopicList
()
this
.
getCompetencytypeList
()
}
getCompetencytypeList
()
{
this
.
competencytypeListLoading
=
true
this
.
competencytypeService
.
getList
().
subscribe
({
...
...
@@ -169,7 +149,7 @@ export class CompetencyTopic {
competencytypeListFilter
()
{
return
this
.
competencytypeList
.
filter
(
x
=>
{
const
data
=
x
const
match
=
data
.
id
.
includes
(
this
.
searchModal
)
||
data
.
name
.
includes
(
this
.
searchModal
)
||
data
.
code
.
includes
(
this
.
searchModal
);
const
match
=
data
.
id
.
toLowerCase
().
includes
(
this
.
searchModal
)
||
data
.
name
.
toLowerCase
().
includes
(
this
.
searchModal
)
||
data
.
code
.
toLowerCase
()
.
includes
(
this
.
searchModal
);
return
match
;
});
}
...
...
@@ -180,16 +160,19 @@ export class CompetencyTopic {
this
.
dataLoading
=
true
this
.
competencytopicService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
mockData
=
response
.
map
(
x
=>
({
id
:
x
.
competencyTopicId
,
name
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
code
:
x
.
competencyType
.
shortName
,
definition
:
x
.
competencyDetail
,
type
:
{
id
:
x
.
competencyType
.
competencyTypeId
,
name
:
x
.
competencyType
.
tdesc
,
edesc
:
x
.
competencyType
.
edesc
,
code
:
x
.
competencyType
.
shortName
,
level
:
x
.
expectationLevel
},
checked
:
false
this
.
competoncyTopicList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
id
:
x
.
competencyTopicId
,
name
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
code
:
x
.
competencyType
.
shortName
,
definition
:
x
.
competencyDetail
,
type
:
{
id
:
x
.
competencyType
.
competencyTypeId
,
name
:
x
.
competencyType
.
tdesc
,
edesc
:
x
.
competencyType
.
edesc
,
code
:
x
.
competencyType
.
shortName
,
level
:
x
.
expectationLevel
},
checked
:
false
}
}))
this
.
dataLoading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
})
...
...
@@ -199,34 +182,69 @@ export class CompetencyTopic {
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
dataListFilter
()
{
return
this
.
mockData
.
filter
(
x
=>
{
const
data
=
x
const
match
=
data
.
id
.
includes
(
this
.
search
)
||
data
.
name
.
includes
(
this
.
search
)
||
data
.
code
.
includes
(
this
.
search
);
return
this
.
competoncyTopicList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
id
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
name
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
code
.
toLowerCase
()
.
includes
(
this
.
search
);
return
match
;
});
}
se
lectCompetencytopic
(
data
?:
DataModel
)
{
se
tData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
definition
:
""
,
type
:
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
},
checked
:
false
}));
}
showSuccess
()
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addCompetency_topic
()
{
const
body
=
new
MyCompetencytopicModel
({
competencyTopicId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
competencyDetail
:
this
.
dataSelect
.
definition
,
competencyType
:
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
type
.
id
,
tdesc
:
this
.
dataSelect
.
type
.
name
,
edesc
:
this
.
dataSelect
.
type
.
edesc
,
shortName
:
this
.
dataSelect
.
type
.
code
,
expectationLevel
:
this
.
dataSelect
.
type
.
level
}),
})
this
.
competencytopicService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencytypeList
()
this
.
getCompetencytopicList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
showSuccessEdit
()
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
deleteCompetency_topic
()
{
let
body
:
any
if
(
this
.
modalStatus
==
"deleteGroup"
)
{
body
=
this
.
competoncyTopicList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyCompetencytopicModel
({
competencyTopicId
:
x
.
data
.
id
,
tdesc
:
x
.
data
.
name
,
edesc
:
x
.
data
.
edesc
,
competencyDetail
:
x
.
data
.
definition
,
competencyType
:
new
MyCompetencytypeModel
({
competencyTypeId
:
x
.
data
.
type
.
id
,
tdesc
:
x
.
data
.
type
.
name
,
edesc
:
x
.
data
.
type
.
edesc
,
shortName
:
x
.
data
.
type
.
code
,
expectationLevel
:
x
.
data
.
type
.
level
}),
}))
}
else
{
body
=
new
MyCompetencytopicModel
({
competencyTopicId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
competencyDetail
:
this
.
dataSelect
.
definition
,
competencyType
:
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
type
.
id
,
tdesc
:
this
.
dataSelect
.
type
.
name
,
edesc
:
this
.
dataSelect
.
type
.
edesc
,
shortName
:
this
.
dataSelect
.
type
.
code
,
expectationLevel
:
this
.
dataSelect
.
type
.
level
}),
})
}
console
.
log
(
body
)
this
.
competencytopicService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencytypeList
()
this
.
getCompetencytopicList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
show
SuccessDelete
(
)
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเ
จ้งเตือน'
,
{
show
Alert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แ
จ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
;
})
}
}
src/app/components/competency-assessment/name-registration/name-registration.component.html
View file @
cd558547
...
...
@@ -10,22 +10,22 @@
<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"
href=
"javascript:void(0);"
id=
"underline-item-1"
data-hs-tab=
"#underline-1"
aria-controls=
"underline-1"
(
click
)="
pathTitle =
['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','ประเภทสมรรถนะ']"
>
aria-controls=
"underline-1"
(
click
)="
currentPage =
1;
pathTitle
=
['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','ประเภทสมรรถนะ']"
>
ประเภทสมรรถนะ
</a>
<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"
href=
"javascript:void(0);"
id=
"underline-item-2"
data-hs-tab=
"#underline-2"
aria-controls=
"underline-2"
(
click
)="
pathTitle =
['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','หัวข้อสมรรถนะ']"
>
aria-controls=
"underline-2"
(
click
)="
currentPage =
2;
pathTitle
=
['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','หัวข้อสมรรถนะ']"
>
หัวข้อสมรรถนะ
</a>
</nav>
</div>
<div
class=
"mt-3 px-3rem !-mt-3 pt-50px"
>
<div
id=
"underline-1"
role=
"tabpanel"
aria-labelledby=
"underline-item-1"
>
<div
*
ngIf=
"currentPage == 1"
id=
"underline-1"
role=
"tabpanel"
aria-labelledby=
"underline-item-1"
>
<app-type-registration
[
pathTitle
]="
pathTitle
"
(
sendPathTitle
)="
pathTitle=
$event"
></app-type-registration>
</div>
<div
id=
"underline-2"
class=
"hidden"
role=
"tabpanel"
aria-labelledby=
"underline-item-2"
>
<div
*
ngIf=
"currentPage == 2"
id=
"underline-2"
class=
"hidden"
role=
"tabpanel"
aria-labelledby=
"underline-item-2"
>
<app-competency-topic
[
pathTitle
]="
pathTitle
"
(
sendPathTitle
)="
pathTitle=
$event"
></app-competency-topic>
</div>
...
...
src/app/components/competency-assessment/name-registration/name-registration.component.ts
View file @
cd558547
...
...
@@ -7,4 +7,5 @@ import { Component } from '@angular/core';
})
export
class
NameRegistrationComponent
{
pathTitle
=
[
'การประเมินสมรรถนะ'
,
'ทะเบียนกำหนดชื่อ'
,
'ประเภทสมรรถนะ'
]
currentPage
=
1
}
src/app/components/competency-assessment/name-registration/type-registration/type-registration.component.html
View file @
cd558547
...
...
@@ -5,7 +5,7 @@
<div
class=
"flex gap-x-6"
>
<div
class=
"flex items-center"
>
<label
for=
"hs-checkbox-group-1"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
{{
mockDataSelec
t.length}}
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
{{
dataSelectLis
t.length}}
Selected
</label>
</div>
...
...
@@ -35,28 +35,24 @@
<div
class=
"px-1"
>
<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"
data-hs-overlay=
"#type-registration-component-
modal-add
"
>
data-hs-overlay=
"#type-registration-component-
upload-modal
"
>
<i
class=
"ti ti-file-plus"
></i>
import
</button>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-10 m-0 shadow-md"
data-hs-overlay=
"#type-registration-component-
modal-add"
(
click
)="
selectCompetencytype
()"
>
data-hs-overlay=
"#type-registration-component-
page-modal"
(
click
)="
modalStatus=
'add'
;
setData
()"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<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"
(
click
)="
modalStatus=
'deleteGroup'
;
setData
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
<!-- <button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay="#type-registration-component-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button> -->
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-10 m-0 shadow-md"
>
...
...
@@ -105,19 +101,18 @@
<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
.id}}"
[(
ngModel
)]="
item
.
check
ed
"
(
change
)="
checkSelect
()"
>
<label
for=
"checkbox-{{item.
id}}"
>
{{item
.id}}
</label>
<input
*
ngIf=
"item.data.id!='100'"
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data
.id}}"
[(
ngModel
)]="
item
.
check
"
(
change
)="
checkSelect
()"
>
<label
for=
"checkbox-{{item.
data.id}}"
>
{{item.data
.id}}
</label>
</td>
<td>
{{item.name}}
</td>
<td
class=
"text-center"
>
{{item.code}}
</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"
data-hs-overlay=
"#type-registration-component-modal-edit"
(
click
)="
selectCompetencytype
(
item
)"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#type-registration-component-alert-delete-modal"
(
click
)="
selectCompetencytype
(
item
)"
></i>
<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"
*
ngIf=
"item.data.id!='100'"
(
click
)="
modalStatus=
'delete'
;
setData
(
item
.
data
)"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
></i>
</td>
</tr>
</tbody>
...
...
@@ -164,16 +159,16 @@
<div
id=
"type-registration-component-
modal-add
"
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=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
เพิ่มประเภทสมรรถนะ
{{modalStatus=='add'?'เพิ่มประเภทสมรรถนะ':'แก้ไขประเภทสมรรถนะ'}}
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#type-registration-component-
modal-add
"
>
data-hs-overlay=
"#type-registration-component-
page-modal
"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
...
...
@@ -208,7 +203,7 @@
</div>
<div
class=
"ti-modal-body"
style=
"padding-top: 0px;"
>
<label
for=
"input-label"
class=
"ti-form-label mt-1rem"
>
รหัส *
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[(
ngModel
)]="
dataSelect
.
id
"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:modalStatus=
='edit'}"
[
readonly
]="
modalStatus=
='edit'"
[
(
ngModel
)]="
dataSelect
.
id
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (ไทย)*
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
dataSelect
.
name
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (อังกฤษ)
</label>
...
...
@@ -221,11 +216,11 @@
<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=
"#type-registration-component-
modal-add
"
>
data-hs-overlay=
"#type-registration-component-
page-modal
"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-alert-modal"
>
data-hs-overlay=
"#type-registration-component-
page-
alert-modal"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -234,78 +229,7 @@
</div>
</div>
<div
id=
"type-registration-component-modal-edit"
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"
>
เเก้ไขประเภทสมรรถนะ
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#type-registration-component-modal-edit"
>
<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"
>
<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"
>
รหัส *
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[(
ngModel
)]="
dataSelect
.
id
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-1rem"
>
ชื่อประเภท (ไทย)*
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input w-2/3"
[(
ngModel
)]="
dataSelect
.
name
"
>
<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
"
>
<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
.
code
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-1rem"
>
ระดับความคาดหวัง *
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
style=
"width: 200px;"
[(
ngModel
)]="
dataSelect
.
level
"
>
<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=
"#type-registration-component-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-alert-edit-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"type-registration-component-alert-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"type-registration-component-page-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"
>
...
...
@@ -313,99 +237,85 @@
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#type-registration-component-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='deleteGroup'"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</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=
"#type-registration-component-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-alert-modal"
(
click
)="
addUser
()"
>
บันทึกข้อมูล
</a>
<ng-container
*
ngIf=
"modalStatus=='add'||modalStatus=='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=
"#type-registration-component-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
(
click
)="
addType_registration
()"
>
บันทึกข้อมูล
</a>
</ng-container>
<ng-container
*
ngIf=
"modalStatus=='delete'||modalStatus=='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=
"#type-registration-component-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-page-alert-modal"
(
click
)="
deleteType_registration
()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
<div
id=
"type-registration-component-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"
data-hs-overlay=
"#type-registration-component-alert-edit-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"
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-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-alert-edit-modal"
(
click
)="
addUser
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
<div
id=
"type-registration-component-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)] rounded-md"
>
<div
class=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าฝ่าย
</h5>
</div>
</div>
</div>
<div
id=
"type-registration-component-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=
"#type-registration-component-alert-delete-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<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
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>
<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=
"#type-registration-component-alert-delete-modal"
>
ย้อนกลับ
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#type-registration-component-alert-delete-modal"
(
click
)="
deleteUser
()"
>
ลบข้อมูล
</a>
</div>
</div>
</div>
...
...
src/app/components/competency-assessment/name-registration/type-registration/type-registration.component.ts
View file @
cd558547
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
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
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
id
:
string
name
:
string
companyId
:
string
edesc
:
string
name
:
string
code
:
string
level
:
string
checked
:
boolean
...
...
@@ -19,13 +21,6 @@ export class TypeRegistration {
@
Input
()
pathTitle
=
[
'การประเมินสมรรถนะ'
,
'ทะเบียนกำหนดชื่อ'
,
'ประเภทสมรรถนะ'
];
@
Output
()
sendPathTitle
:
EventEmitter
<
string
[]
>
=
new
EventEmitter
<
string
[]
>
();
activeTab
:
string
=
'tab1'
;
// กำหนด tab เริ่มต้น
isChecked
:
boolean
=
false
;
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab
(
tab
:
{
id
:
string
,
text
:
string
})
{
...
...
@@ -33,102 +28,98 @@ export class TypeRegistration {
this
.
activeTab
=
tab
.
id
;
}
isChecked
:
boolean
=
false
;
currentPage
=
1
selectedItems
:
string
[]
=
[];
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
dataSelectList
:
DataModel
[]
=
[];
dataLoading
=
false
dataSelect
:
DataModel
=
{
id
:
""
,
companyId
:
""
,
edesc
:
""
,
name
:
""
,
code
:
""
,
level
:
""
,
checked
:
false
}
competoncy_typeList
:
{
check
:
boolean
;
data
:
DataModel
&
{
checked
?:
boolean
}
}[]
=
[]
competoncy_type
:
CompetencytypeModel
=
new
MyCompetencytypeModel
({})
modalStatus
=
'add'
search
=
""
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
competencytypeService
:
CompetencytypeService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
// การจัดการการเปิดปิด modal
modalOptions
:
{
[
nameModal
:
string
]:
{
isModalOpen
:
boolean
;
modalSize
:
string
;
backdropClose
:
boolean
;
};
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
}
};
toggleCheckbox
():
void
{
this
.
isChecked
=
!
this
.
isChecked
;
this
.
mockData
.
forEach
((
item
)
=>
{
item
.
checked
=
this
.
isChecked
;
});
this
.
checkSelect
();
)
{
}
ngOnInit
():
void
{
this
.
getCompetencytypeList
()
}
mockData
:
DataModel
[]
=
[]
dataLoading
=
false
dataSelect
:
DataModel
=
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
,
checked
:
false
}
mockDataSelect
:
any
=
[]
checkSelect
()
{
this
.
mockDataSelect
=
this
.
mockData
.
filter
(
item
=>
item
.
checked
);
}
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'
;
this
.
dataSelectList
=
this
.
competoncy_typeList
.
filter
(
item
=>
item
.
check
).
map
(
item
=>
item
.
data
);
}
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
toggleCheckbox
()
{
this
.
isChecked
=
!
this
.
isChecked
;
// สลับสถานะ'
this
.
competoncy_typeList
.
forEach
((
item
)
=>
{
item
.
check
=
this
.
isChecked
;
});
this
.
checkSelect
();
}
isAnyModalOpen
():
boolean
{
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser
()
{
const
body
=
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
shortName
:
this
.
dataSelect
.
code
,
expectationLevel
:
this
.
dataSelect
.
level
})
this
.
competencytypeService
.
post
(
body
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showSuccess
()
this
.
getCompetencytypeList
()
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
fileService
.
upload
(
formData
,
'competency_type'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencytypeList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
deleteUser
()
{
const
body
=
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
shortName
:
this
.
dataSelect
.
code
,
expectationLevel
:
this
.
dataSelect
.
level
})
this
.
competencytypeService
.
delete
(
body
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showSuccessDelete
()
this
.
getCompetencytypeList
()
downloadFile
()
{
const
fileName
=
'IMPORT_COMPETENCY_TYPE.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
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
=
""
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
competencytypeService
:
CompetencytypeService
)
{
}
ngOnInit
():
void
{
this
.
getCompetencytypeList
()
}
getCompetencytypeList
()
{
this
.
dataLoading
=
true
this
.
competencytypeService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
mockData
=
response
.
map
(
x
=>
({
id
:
x
.
competencyTypeId
,
name
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
code
:
x
.
shortName
,
level
:
x
.
expectationLevel
,
checked
:
false
}))
this
.
competoncy_typeList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
id
:
x
.
competencyTypeId
,
companyId
:
x
.
companyId
,
edesc
:
x
.
edesc
,
name
:
x
.
tdesc
,
code
:
x
.
shortName
,
level
:
x
.
expectationLevel
,
checked
:
false
}
}))
this
.
dataLoading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
dataLoading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
}
})
...
...
@@ -138,33 +129,60 @@ export class TypeRegistration {
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
dataListFilter
()
{
return
this
.
mockData
.
filter
(
x
=>
{
const
data
=
x
const
match
=
data
.
id
.
includes
(
this
.
search
)
||
data
.
name
.
includes
(
this
.
search
)
||
data
.
code
.
includes
(
this
.
search
);
return
this
.
competoncy_typeList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
id
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
name
.
toLowerCase
().
includes
(
this
.
search
)
||
data
.
code
.
toLowerCase
()
.
includes
(
this
.
search
);
return
match
;
});
}
se
lectCompetencytype
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
id
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
,
checked
:
false
}));
se
tData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
id
:
""
,
companyId
:
""
,
name
:
""
,
edesc
:
""
,
code
:
""
,
level
:
""
}));
}
showSuccess
()
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addType_registration
()
{
const
body
=
new
MyCompetencytypeModel
({
competencyTypeId
:
this
.
dataSelect
.
id
,
tdesc
:
this
.
dataSelect
.
name
,
edesc
:
this
.
dataSelect
.
edesc
,
shortName
:
this
.
dataSelect
.
code
,
expectationLevel
:
this
.
dataSelect
.
level
})
this
.
competencytypeService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompetencytypeList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
showSuccessEdit
()
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
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
,
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
,
expectationLevel
:
x
.
data
.
level
}));
}
this
.
competencytypeService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
);
this
.
getCompetencytypeList
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
);
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
});
}
showSuccessDelete
()
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
;
})
}
}
src/app/shared/services/competencytopic.service.ts
View file @
cd558547
...
...
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
CompetencytopicModel
}
from
'../model/competencytopic.model'
;
import
{
AlertModel
}
from
'../model/alert.model'
;
@
Injectable
({
providedIn
:
'root'
})
...
...
@@ -17,16 +18,16 @@ export class CompetencytopicService {
getList
():
Observable
<
CompetencytopicModel
[]
>
{
return
this
.
http
.
get
<
CompetencytopicModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
post
(
body
:
CompetencytopicModel
)
{
return
this
.
http
.
post
(
this
.
urlApi
,
body
)
post
(
body
:
CompetencytopicModel
)
:
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
delete
(
body
:
CompetencytopicModel
)
{
delete
(
body
:
CompetencytopicModel
|
CompetencytopicModel
[]):
Observable
<
AlertModel
>
{
const
options
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
};
return
this
.
http
.
delete
(
this
.
urlApi
,
options
)
return
this
.
http
.
delete
<
AlertModel
>
(
this
.
urlApi
,
options
)
}
}
\ No newline at end of file
src/app/shared/services/competencytype.service.ts
View file @
cd558547
...
...
@@ -3,6 +3,8 @@ import { Injectable } from '@angular/core';
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
CompetencytypeModel
}
from
'../model/competencytype.model'
;
import
{
AlertModel
}
from
'../model/alert.model'
;
import
{
EmpGroupModel
}
from
'../model/emp-group.model'
;
@
Injectable
({
providedIn
:
'root'
})
...
...
@@ -17,16 +19,16 @@ export class CompetencytypeService {
getList
():
Observable
<
CompetencytypeModel
[]
>
{
return
this
.
http
.
get
<
CompetencytypeModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
post
(
body
:
CompetencytypeModel
)
{
return
this
.
http
.
post
(
this
.
urlApi
,
body
)
post
(
body
:
CompetencytypeModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
delete
(
body
:
CompetencytypeModel
)
{
delete
(
body
:
CompetencytypeModel
|
CompetencytypeModel
[]):
Observable
<
AlertModel
>
{
const
options
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
};
return
this
.
http
.
delete
(
this
.
urlApi
,
options
)
return
this
.
http
.
delete
<
AlertModel
>
(
this
.
urlApi
,
options
)
}
}
\ No newline at end of file
src/app/shared/services/emp-group.service.ts
View file @
cd558547
...
...
@@ -19,18 +19,6 @@ export class EmpGroupService {
getById
(
groupId
:
string
):
Observable
<
EmpGroupModel
>
{
return
this
.
http
.
get
<
EmpGroupModel
>
(
this
.
urlApi
+
"/"
+
groupId
)
}
// post(body: EmpGroupModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: EmpGroupModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post
(
body
:
EmpGroupModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
...
...
src/app/shared/services/position.service.ts
View file @
cd558547
...
...
@@ -19,18 +19,6 @@ import { AlertModel } from '../model/alert.model';
getList
():
Observable
<
PositionModel
[]
>
{
return
this
.
http
.
get
<
PositionModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
// post(body: PositionModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: PositionModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post
(
body
:
PositionModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
)
}
...
...
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