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
f9d19f91
Commit
f9d19f91
authored
Apr 11, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ระดับพนักงาน (JL)
parent
962c6075
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
89 deletions
+66
-89
employee-categories.component.ts
...tion/employee-categories/employee-categories.component.ts
+1
-1
employee-level.component.html
...-description/employee-level/employee-level.component.html
+0
-0
employee-level.component.ts
...ob-description/employee-level/employee-level.component.ts
+65
-88
No files found.
src/app/components/company-components/job-description/employee-categories/employee-categories.component.ts
View file @
f9d19f91
...
@@ -101,6 +101,7 @@ export class EmployeeCategories {
...
@@ -101,6 +101,7 @@ export class EmployeeCategories {
getEmpTypeList
()
{
getEmpTypeList
()
{
this
.
emp_type
.
loading
=
true
this
.
emp_type
.
loading
=
true
this
.
selectedItems
.
data
.
clear
()
this
.
empTypeService
.
getList
().
subscribe
({
this
.
empTypeService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
emp_type
.
dataList
=
response
.
map
(
x
=>
{
this
.
emp_type
.
dataList
=
response
.
map
(
x
=>
{
...
@@ -113,7 +114,6 @@ export class EmployeeCategories {
...
@@ -113,7 +114,6 @@ export class EmployeeCategories {
this
.
cdr
.
detectChanges
();
this
.
cdr
.
detectChanges
();
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
emp_type
.
loading
=
false
this
.
emp_type
.
loading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
});
});
...
...
src/app/components/company-components/job-description/employee-level/employee-level.component.html
View file @
f9d19f91
This diff is collapsed.
Click to expand it.
src/app/components/company-components/job-description/employee-level/employee-level.component.ts
View file @
f9d19f91
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
MyPLModel
,
PLModel
}
from
'src/app/shared/model/pl.model'
;
import
{
MyPLModel
,
PLModel
}
from
'src/app/shared/model/pl.model'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
PLService
}
from
'src/app/shared/services/pl.service'
;
import
{
PLService
}
from
'src/app/shared/services/pl.service'
;
export
interface
DataModel
{
plId
:
string
tdesc
:
string
edesc
:
string
companyId
:
string
}
@
Component
({
@
Component
({
selector
:
'app-employee-level'
,
selector
:
'app-employee-level'
,
templateUrl
:
'./employee-level.component.html'
,
templateUrl
:
'./employee-level.component.html'
,
styleUrls
:
[
'./employee-level.component.scss'
]
styleUrls
:
[
'./employee-level.component.scss'
]
})
})
export
class
EmployeeLevel
implements
OnInit
{
export
class
EmployeeLevel
implements
OnInit
{
currentPage
=
1
pageSize
=
10
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
search
=
""
modalStatus
=
'add'
currentModal
:
'add'
|
'edit'
|
'delete'
=
'add'
plList
:
{
check
:
boolean
,
data
:
DataModel
}[]
=
[]
pl
:
{
loading
:
boolean
,
select
:
PLModel
,
dataList
:
PLModel
[]
}
=
{
loading
:
false
,
select
:
new
MyPLModel
(),
dataList
:
[]
}
pl
:
PLModel
=
new
MyPLModel
({})
dataLoading
=
false
dataSelect
:
DataModel
=
{
plId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}
itemToDelete
:
PLModel
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
numDataListChecked
=
0
columns
:
ColumnModel
[]
=
[{
isDataListChecked
=
false
field
:
"plId"
,
isDataListCheckedAll
=
false
headerText
:
"รหัสฝ่าย"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"รายละเอียดฝ่าย(ไทย)"
,
type
:
"string"
},
{
field
:
"edesc"
,
headerText
:
"รายละเอียดฝ่าย(อังกฤษ)"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'plId'
,
'tdesc'
,
'edesc'
],
operator
:
'contains'
,
ignoreCase
:
false
}
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
constructor
(
private
plService
:
PLService
,
constructor
(
private
plService
:
PLService
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
...
@@ -56,7 +63,7 @@ export class EmployeeLevel implements OnInit {
...
@@ -56,7 +63,7 @@ export class EmployeeLevel implements OnInit {
}
}
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
dataL
oading
=
true
this
.
pl
.
l
oading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
'pl'
).
subscribe
({
this
.
fileService
.
uploadExcel
(
formData
,
'pl'
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -64,12 +71,12 @@ export class EmployeeLevel implements OnInit {
...
@@ -64,12 +71,12 @@ export class EmployeeLevel implements OnInit {
this
.
getPLList
()
this
.
getPLList
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
dataL
oading
=
false
this
.
pl
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
dataL
oading
=
false
this
.
pl
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
...
@@ -95,71 +102,59 @@ export class EmployeeLevel implements OnInit {
...
@@ -95,71 +102,59 @@ export class EmployeeLevel implements OnInit {
}
}
getPLList
()
{
getPLList
()
{
this
.
dataLoading
=
true
this
.
pl
.
loading
=
true
this
.
selectedItems
.
data
.
clear
()
this
.
plService
.
getList
().
subscribe
({
this
.
plService
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
plList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
plId
:
x
.
plId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
companyId
:
x
.
companyId
}
}))
this
.
pl
.
dataList
=
response
.
map
(
x
=>
{
this
.
dataLoading
=
false
this
.
selectedItems
.
data
.
set
(
x
.
plId
,
false
)
this
.
isDataListCheckedAll
=
false
return
new
MyPLModel
(
x
)
this
.
dataListCheckAll
()
})
this
.
searchChange
();
this
.
selectedItems
.
key
=
'plId'
this
.
selectedItems
.
count
=
0
this
.
pl
.
loading
=
false
this
.
cdr
.
detectChanges
();
this
.
cdr
.
detectChanges
();
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
dataLoading
=
false
this
.
pl
.
loading
=
false
console
.
error
(
'Error fetching employee types:'
,
error
);
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
});
});
}
}
searchChange
()
{
selectPl
(
pl
?:
PLModel
)
{
this
.
currentPage
=
1
if
(
pl
)
{
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
plListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
pl
.
select
=
new
MyPLModel
(
pl
)
this
.
dataListCheck
();
}
else
if
(
this
.
currentModal
==
'add'
)
{
this
.
cdr
.
detectChanges
()
this
.
pl
.
select
=
new
MyPLModel
()
}
}
else
if
(
this
.
currentModal
==
'edit'
)
{
this
.
pl
.
select
=
new
MyPLModel
({
plId
:
this
.
pl
.
select
.
plId
})
plListFilter
()
{
}
return
this
.
plList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
plId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
());
return
match
;
});
}
setData
(
data
?:
DataModel
)
{
this
.
dataSelect
=
JSON
.
parse
(
JSON
.
stringify
(
data
||
{
plId
:
""
,
tdesc
:
""
,
edesc
:
""
,
companyId
:
""
}));
}
}
addPL
()
{
addPL
()
{
const
body
=
new
MyPLModel
({
plId
:
this
.
dataSelect
.
plId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
companyId
:
this
.
dataSelect
.
companyId
})
this
.
pl
.
loading
=
true
this
.
dataLoading
=
true
this
.
plService
.
post
(
this
.
pl
.
select
).
subscribe
({
this
.
plService
.
post
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPLList
()
this
.
getPLList
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
dataL
oading
=
true
this
.
pl
.
l
oading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
dataL
oading
=
true
this
.
pl
.
l
oading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
deletePL
()
{
deletePL
()
{
let
body
:
PLModel
|
PLModel
[]
=
[]
this
.
pl
.
loading
=
true
if
(
this
.
dataSelect
.
plId
)
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
body
=
new
MyPLModel
({
plId
:
this
.
dataSelect
.
plId
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
companyId
:
this
.
dataSelect
.
companyId
})
const
body
=
this
.
pl
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
plId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
plId
)).
map
(
x
=>
new
MyPLModel
(
x
))
}
else
{
body
=
this
.
plList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyPLModel
({
plId
:
x
.
data
.
plId
,
tdesc
:
x
.
data
.
tdesc
,
edesc
:
x
.
data
.
edesc
,
companyId
:
x
.
data
.
companyId
}))
}
this
.
dataLoading
=
true
this
.
plService
.
delete
(
body
).
subscribe
({
this
.
plService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -167,12 +162,12 @@ export class EmployeeLevel implements OnInit {
...
@@ -167,12 +162,12 @@ export class EmployeeLevel implements OnInit {
this
.
getPLList
()
this
.
getPLList
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
dataL
oading
=
true
this
.
pl
.
l
oading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
dataL
oading
=
true
this
.
pl
.
l
oading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
...
@@ -185,36 +180,18 @@ export class EmployeeLevel implements OnInit {
...
@@ -185,36 +180,18 @@ export class EmployeeLevel implements OnInit {
});
});
}
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
plList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
plId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
());
return
match
;
}).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
dataListCheck
()
{
const
dataCheck
=
this
.
plListFilter
();
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
plList
.
filter
(
x
=>
x
.
check
).
length
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
clearPl
(
modalStatus
:
string
)
{
checkPrimary
()
{
if
(
modalStatus
==
'add'
)
{
return
this
.
pl
.
dataList
.
find
(
x
=>
x
.
plId
==
this
.
pl
.
select
.
plId
)
this
.
dataSelect
.
plId
=
''
this
.
dataSelect
.
tdesc
=
''
this
.
dataSelect
.
edesc
=
''
}
else
if
(
modalStatus
==
'edit'
)
{
this
.
dataSelect
.
tdesc
=
''
this
.
dataSelect
.
edesc
=
''
}
}
}
numSelectItem
()
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
pl
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
plId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
plId
)).
length
return
num
}
checkPrimary
(
)
{
onSelectItemChange
(
arg
:
any
)
{
return
this
.
plList
.
find
(
x
=>
x
.
data
.
plId
==
this
.
dataSelect
.
plId
)
this
.
selectedItems
=
arg
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment