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
2f8519d6
Commit
2f8519d6
authored
Apr 28, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE แก้ model ข้อมูลลักษณะงาน
parent
f3407a40
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
124 deletions
+120
-124
employee-categories.component.html
...on/employee-categories/employee-categories.component.html
+0
-0
employee-categories.component.ts
...tion/employee-categories/employee-categories.component.ts
+50
-6
employee-level.component.html
...-description/employee-level/employee-level.component.html
+20
-112
employee-level.component.ts
...ob-description/employee-level/employee-level.component.ts
+50
-6
No files found.
src/app/components/company-components/job-description/employee-categories/employee-categories.component.html
View file @
2f8519d6
This diff is collapsed.
Click to expand it.
src/app/components/company-components/job-description/employee-categories/employee-categories.component.ts
View file @
2f8519d6
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
,
ViewChild
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
EmpTypeModel
,
MyEmpTypeModel
}
from
'src/app/shared/model/employee-type.model'
;
import
{
EmpTypeModel
,
MyEmpTypeModel
}
from
'src/app/shared/model/employee-type.model'
;
import
{
EmpTypeService
}
from
'src/app/shared/services/employee-type.service'
;
import
{
EmpTypeService
}
from
'src/app/shared/services/employee-type.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
@
Component
({
@
Component
({
selector
:
'app-employee-categories'
,
selector
:
'app-employee-categories'
,
templateUrl
:
'./employee-categories.component.html'
,
templateUrl
:
'./employee-categories.component.html'
,
...
@@ -40,15 +42,29 @@ export class EmployeeCategories {
...
@@ -40,15 +42,29 @@ export class EmployeeCategories {
ignoreCase
:
false
ignoreCase
:
false
}
}
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"employeeCategoriesModal"
)
employeeCategoriesModal
:
any
;
dialogRef
:
any
constructor
(
private
empTypeService
:
EmpTypeService
,
constructor
(
private
empTypeService
:
EmpTypeService
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
)
{
}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
getEmpTypeList
()
this
.
getEmpTypeList
()
}
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
employeeCategoriesModal
,
{
width
:
'500px'
,
height
:
'500px'
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
onFileSelected
(
event
:
any
)
{
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
@@ -132,12 +148,21 @@ export class EmployeeCategories {
...
@@ -132,12 +148,21 @@ export class EmployeeCategories {
addEmp_type
()
{
addEmp_type
()
{
Swal
.
fire
({
icon
:
'warning'
,
title
:
'แจ้งเตือน'
,
text
:
'คุณต้องการเพิ่มประเภทพนักงานหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_type
.
loading
=
true
this
.
emp_type
.
loading
=
true
this
.
empTypeService
.
post
(
this
.
emp_type
.
select
).
subscribe
({
this
.
empTypeService
.
post
(
this
.
emp_type
.
select
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmpTypeList
()
this
.
getEmpTypeList
()
this
.
closeDialog
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
emp_type
.
loading
=
false
this
.
emp_type
.
loading
=
false
...
@@ -150,8 +175,22 @@ export class EmployeeCategories {
...
@@ -150,8 +175,22 @@ export class EmployeeCategories {
}
}
})
})
}
}
})
}
deleteEmp_type
()
{
deleteEmp_type
()
{
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'warning'
,
title
:
'แจ้งเตือน'
,
text
:
'คุณต้องการลบประเภทพนักงานทั้งหมดหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_type
.
loading
=
true
this
.
emp_type
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
emp_type
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
codeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
codeId
)).
map
(
x
=>
new
MyEmpTypeModel
(
x
))
const
body
=
this
.
emp_type
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
codeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
codeId
)).
map
(
x
=>
new
MyEmpTypeModel
(
x
))
...
@@ -172,12 +211,17 @@ export class EmployeeCategories {
...
@@ -172,12 +211,17 @@ export class EmployeeCategories {
}
}
})
})
}
}
})
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
Swal
.
fire
({
timeOut
:
3000
,
icon
:
type
,
positionClass
:
'toast-top-right'
,
title
:
'แจ้งเตือน'
,
});
text
:
text
,
showCancelButton
:
false
,
confirmButtonText
:
'ยืนยัน'
,
})
}
}
...
...
src/app/components/company-components/job-description/employee-level/employee-level.component.html
View file @
2f8519d6
...
@@ -21,14 +21,14 @@
...
@@ -21,14 +21,14 @@
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay=
"#employee-level-page-modal"
(
click
)="
currentModal=
'add'
;
selectPl
()"
>
data-hs-overlay=
"#employee-level-page-modal"
(
click
)="
currentModal=
'add'
;
selectPl
()
;
openDialog
()
"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay=
"#employee-level-page-alert-modal"
(
click
)="
currentModal=
'delete'
;
selectPl
()"
>
data-hs-overlay=
"#employee-level-page-alert-modal"
(
click
)="
currentModal=
'delete'
;
selectPl
()
;
deletePL
();
"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
...
@@ -38,49 +38,26 @@
...
@@ -38,49 +38,26 @@
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
pl
.
dataList
"
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
pl
.
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
modalName=
"#employee-level-page-modal"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
currentModal=
'edit'
;
selectPl
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
(
sendSelectData
)="
currentModal=
'edit'
;
selectPl
($
event
)
;
openDialog
()
"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</app-datagrid-syncfution>
</div>
</div>
<ng-template
#
employeeLevelModal
let-modal
>
<div
id=
"employee-level-page-modal"
class=
"hs-overlay hidden ti-modal"
>
<h3
mat-dialog-title
>
<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"
>
{{currentModal=='add'?'เพิ่มข้อมูลระดับพนักงาน(JL)':'แก้ไขข้อมูลระดับพนักงาน(JL)'}}
{{currentModal=='add'?'เพิ่มข้อมูลระดับพนักงาน(JL)':'แก้ไขข้อมูลระดับพนักงาน(JL)'}}
</h3>
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"w-full flex justify-end mb-1rem"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<div
class=
"absolute flex"
>
data-hs-overlay=
"#employee-level-page-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-center"
>
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectPl
()"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectPl
()"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
<i
class=
"ti ti-eraser text-base"
></i>
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
stroke=
"#595BEA"
stroke-width=
"3.84"
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
<g
id=
"SVGRepo_bgCarrier"
stroke-width=
"0"
></g>
<g
id=
"SVGRepo_tracerCarrier"
stroke-linecap=
"round"
stroke-linejoin=
"round"
></g>
<g
id=
"SVGRepo_iconCarrier"
>
<path
d=
"M15 49A24 24 0 0 1 32 8"
></path>
<path
d=
"M49 15a24 24 0 0 1-17 41"
></path>
<polyline
points=
"15.03 40 15.03 48.97 8 48.97"
></polyline>
<polyline
points=
"48.97 24 48.97 15.03 56 15.03"
></polyline>
</g>
</svg>
Clear
Clear
</button>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"ti-modal-body"
style=
"margin-top: 40px;"
>
<mat-dialog-content
>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสระดับพนักงาน(JL)
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสระดับพนักงาน(JL)
<span
class=
"text-danger"
>
<span
class=
"text-danger"
>
*
*
...
@@ -98,22 +75,22 @@
...
@@ -98,22 +75,22 @@
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
pl
.
select
.
tdesc
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
pl
.
select
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดระดับพนักงาน(JL) (อังกฤษ)
</label>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดระดับพนักงาน(JL) (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
pl
.
select
.
edesc
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
pl
.
select
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
</mat-dialog-content
>
<button
type=
"button"
<mat-dialog-actions
align=
"end"
>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
<button
type=
"button"
mat-button
[
mat-dialog-close
]
data-hs-overlay=
"#employee-level-page-modal
"
>
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10
"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#employee-level-page-alert-modal
"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addPL
()
"
[
class
.
ti-btn-disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
class
.
ti-btn-disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
[
disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div
>
</mat-dialog-actions
>
</div
>
</ng-template
>
</div>
</div>
</div>
<div
id=
"employee-level-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<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 rounded-md"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
...
@@ -150,71 +127,3 @@
...
@@ -150,71 +127,3 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-level-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"
>
<h3
class=
"text-xxl font-bold text-primary"
>
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<ng-container
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-level-page-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</ng-container>
<ng-container
*
ngIf=
"currentModal=='delete'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-level-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=
"currentModal=='add'||currentModal=='edit'"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"currentModal=='delete'"
>
<ng-container
*
ngIf=
"numSelectItem()"
>
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
<ng-container
*
ngIf=
"!numSelectItem()"
>
เลือกข้อมูลที่ต้องการลบ
</ng-container>
</ng-container>
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<ng-container
*
ngIf=
"currentModal=='add'||currentModal=='edit'"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#employee-level-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-level-page-alert-modal"
(
click
)="
addPL
()"
>
บันทึกข้อมูล
</a>
</ng-container>
<ng-container
*
ngIf=
"currentModal=='delete'"
>
<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-level-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-level-page-alert-modal"
(
click
)="
deletePL
()"
*
ngIf=
"numSelectItem()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/components/company-components/job-description/employee-level/employee-level.component.ts
View file @
2f8519d6
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
,
ViewChild
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
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'
;
import
Swal
from
'sweetalert2'
;
@
Component
({
@
Component
({
selector
:
'app-employee-level'
,
selector
:
'app-employee-level'
,
templateUrl
:
'./employee-level.component.html'
,
templateUrl
:
'./employee-level.component.html'
,
...
@@ -41,16 +43,30 @@ export class EmployeeLevel implements OnInit {
...
@@ -41,16 +43,30 @@ export class EmployeeLevel implements OnInit {
ignoreCase
:
false
ignoreCase
:
false
}
}
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"employeeLevelModal"
)
employeeLevelModal
:
any
;
dialogRef
:
any
constructor
(
private
plService
:
PLService
,
constructor
(
private
plService
:
PLService
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
)
{
}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
getPLList
()
this
.
getPLList
()
}
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
employeeLevelModal
,
{
width
:
'500px'
,
height
:
'500px'
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
onFileSelected
(
event
:
any
)
{
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
@@ -132,11 +148,20 @@ export class EmployeeLevel implements OnInit {
...
@@ -132,11 +148,20 @@ export class EmployeeLevel implements OnInit {
}
}
addPL
()
{
addPL
()
{
Swal
.
fire
({
icon
:
'warning'
,
title
:
'แจ้งเตือน'
,
text
:
'คุณต้องการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
pl
.
loading
=
true
this
.
pl
.
loading
=
true
this
.
plService
.
post
(
this
.
pl
.
select
).
subscribe
({
this
.
plService
.
post
(
this
.
pl
.
select
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
closeDialog
()
this
.
getPLList
()
this
.
getPLList
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
...
@@ -150,8 +175,22 @@ export class EmployeeLevel implements OnInit {
...
@@ -150,8 +175,22 @@ export class EmployeeLevel implements OnInit {
}
}
})
})
}
}
})
}
deletePL
()
{
deletePL
()
{
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
pl
.
loading
=
true
this
.
pl
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
pl
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
plId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
plId
)).
map
(
x
=>
new
MyPLModel
(
x
))
const
body
=
this
.
pl
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
plId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
plId
)).
map
(
x
=>
new
MyPLModel
(
x
))
...
@@ -172,12 +211,17 @@ export class EmployeeLevel implements OnInit {
...
@@ -172,12 +211,17 @@ export class EmployeeLevel implements OnInit {
}
}
})
})
}
}
})
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
Swal
.
fire
({
timeOut
:
3000
,
icon
:
type
,
positionClass
:
'toast-top-right'
,
title
:
'แจ้งเตือน'
,
});
text
:
text
,
showCancelButton
:
false
,
confirmButtonText
:
'ยืนยัน'
,
})
}
}
...
...
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