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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
206 additions
and
306 deletions
+206
-306
employee-categories.component.html
...on/employee-categories/employee-categories.component.html
+45
-141
employee-categories.component.ts
...tion/employee-categories/employee-categories.component.ts
+58
-14
employee-level.component.html
...-description/employee-level/employee-level.component.html
+48
-140
employee-level.component.ts
...ob-description/employee-level/employee-level.component.ts
+55
-11
No files found.
src/app/components/company-components/job-description/employee-categories/employee-categories.component.html
View file @
2f8519d6
...
@@ -20,8 +20,7 @@
...
@@ -20,8 +20,7 @@
</button>
</button>
</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"
(
click
)="
currentModal=
'add'
;
selectEmp_type
();
openDialog
()"
>
data-hs-overlay=
"#employee-categories-page-modal"
(
click
)="
currentModal=
'add'
;
selectEmp_type
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
...
@@ -29,7 +28,7 @@
...
@@ -29,7 +28,7 @@
<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-categories-page-alert-modal"
data-hs-overlay=
"#employee-categories-page-alert-modal"
(
click
)="
currentModal=
'delete'
;
selectEmp_type
()"
>
(
click
)="
currentModal=
'delete'
;
selectEmp_type
()
;
deleteEmp_type
()
"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
...
@@ -39,152 +38,57 @@
...
@@ -39,152 +38,57 @@
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
emp_type
.
dataList
"
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
emp_type
.
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
modalName=
"#employee-categories-page-modal"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
currentModal=
'edit'
;
selectEmp_type
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
(
sendSelectData
)="
currentModal=
'edit'
;
selectEmp_type
($
event
)
;
openDialog
()
"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</app-datagrid-syncfution>
</div>
</div>
<ng-template
#
employeeCategoriesModal
let-modal
>
<div
id=
"employee-categories-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)]"
>
{{currentModal=='add'?'เพิ่มข้อมูลประเภทพนักงาน':'แก้ไขข้อมูลประเภทพนักงาน'}}
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
</h3>
<div
class=
"ti-modal-header"
>
<div
class=
"w-full flex justify-end mb-1rem"
>
<h3
class=
"text-xxl font-bold text-primary"
>
<div
class=
"absolute flex"
>
{{currentModal=='add'?'เพิ่มข้อมูลประเภทพนักงาน':'แก้ไขข้อมูลประเภทพนักงาน'}}
<div
class=
"px-1"
>
</h3>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectEmp_type
()"
>
<div
class=
"flex justify-end"
>
<i
class=
"ti ti-eraser text-base"
></i>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
Clear
data-hs-overlay=
"#employee-categories-page-modal"
>
</button>
<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"
(
click
)="
selectEmp_type
()"
>
<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>
</div>
<div
class=
"ti-modal-body"
style=
"margin-top: 40px;"
>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสประเภทพนักงาน
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
รหัสประเภทพนักงานซ้ำ
</ng-container>
</span></label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[
maxLength
]="
5
"
[(
ngModel
)]="
emp_type
.
select
.
codeId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดประเภทพนักงาน (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_type
.
select
.
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_type
.
select
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem 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=
"#employee-categories-page-modal"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#employee-categories-page-alert-modal"
[
class
.
ti-btn-disabled
]="!
emp_type
.
select
.
codeId
||!
emp_type
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
emp_type
.
select
.
codeId
||!
emp_type
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<mat-dialog-content>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสประเภทพนักงาน
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
รหัสประเภทพนักงานซ้ำ
</ng-container>
</span></label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[
maxLength
]="
5
"
[(
ngModel
)]="
emp_type
.
select
.
codeId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดประเภทพนักงาน (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_type
.
select
.
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_type
.
select
.
edesc
"
>
</mat-dialog-content>
<mat-dialog-actions
align=
"end"
>
<button
type=
"button"
mat-button
[
mat-dialog-close
]
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
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addEmp_type
()"
[
class
.
ti-btn-disabled
]="!
emp_type
.
select
.
codeId
||!
emp_type
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
emp_type
.
select
.
codeId
||!
emp_type
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</mat-dialog-actions>
</ng-template>
<div
id=
"employee-categories-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-categories-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-categories-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-categories-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-categories-page-alert-modal"
(
click
)="
addEmp_type
()"
>
บันทึกข้อมูล
</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-categories-page-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-categories-page-alert-modal"
(
click
)="
deleteEmp_type
()"
*
ngIf=
"numSelectItem()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-categories-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<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 rounded-md"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
...
...
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
()
{
this
.
emp_type
.
loading
=
true
Swal
.
fire
({
this
.
empTypeService
.
post
(
this
.
emp_type
.
select
).
subscribe
({
icon
:
'warning'
,
next
:
response
=>
{
title
:
'แจ้งเตือน'
,
if
(
response
.
success
)
{
text
:
'คุณต้องการเพิ่มประเภทพนักงานหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_type
.
loading
=
true
this
.
empTypeService
.
post
(
this
.
emp_type
.
select
).
subscribe
({
next
:
response
=>
{
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
...
@@ -146,14 +171,28 @@ export class EmployeeCategories {
...
@@ -146,14 +171,28 @@ export class EmployeeCategories {
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
emp_type
.
loading
=
false
this
.
emp_type
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
})
}
}
})
})
}
}
deleteEmp_type
()
{
deleteEmp_type
()
{
this
.
emp_type
.
loading
=
true
if
(
this
.
numSelectItem
()
==
0
)
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'warning'
,
title
:
'แจ้งเตือน'
,
text
:
'คุณต้องการลบประเภทพนักงานทั้งหมดหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_type
.
loading
=
true
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
))
this
.
empTypeService
.
delete
(
body
).
subscribe
({
this
.
empTypeService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
...
@@ -168,16 +207,21 @@ export class EmployeeCategories {
...
@@ -168,16 +207,21 @@ export class EmployeeCategories {
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
emp_type
.
loading
=
false
this
.
emp_type
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
})
}
}
})
})
}
}
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,82 +38,59 @@
...
@@ -38,82 +38,59 @@
<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)]"
>
{{currentModal=='add'?'เพิ่มข้อมูลระดับพนักงาน(JL)':'แก้ไขข้อมูลระดับพนักงาน(JL)'}}
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
</h3>
<div
class=
"ti-modal-header"
>
<div
class=
"w-full flex justify-end mb-1rem"
>
<h3
class=
"text-xxl font-bold text-primary"
>
<div
class=
"absolute flex"
>
{{currentModal=='add'?'เพิ่มข้อมูลระดับพนักงาน(JL)':'แก้ไขข้อมูลระดับพนักงาน(JL)'}}
</h3>
<div
class=
"flex justify-end"
>
<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>
</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"
Clear
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
</button>
<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>
</div>
</div>
</div>
<div
class=
"ti-modal-body"
style=
"margin-top: 40px;"
>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสระดับพนักงาน(JL)
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
รหัสระดับพนักงาน(JL)ซ้ำ
</ng-container>
</span>
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
pl
.
select
.
plId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดระดับพนักงาน(JL) (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<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>
<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"
>
<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>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#employee-level-page-alert-modal"
[
class
.
ti-btn-disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<mat-dialog-content>
<label
for=
"input-label"
class=
"ti-form-label"
>
รหัสระดับพนักงาน(JL)
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"currentModal=='add'&&checkPrimary()"
>
รหัสระดับพนักงาน(JL)ซ้ำ
</ng-container>
</span>
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
pl
.
select
.
plId
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดระดับพนักงาน(JL) (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<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>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
pl
.
select
.
edesc
"
>
</mat-dialog-content>
<mat-dialog-actions
align=
"end"
>
<button
type=
"button"
mat-button
[
mat-dialog-close
]
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
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())"
[
disabled
]="!
pl
.
select
.
plId
||!
pl
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</mat-dialog-actions>
</ng-template>
<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
()
{
this
.
pl
.
loading
=
true
Swal
.
fire
({
this
.
plService
.
post
(
this
.
pl
.
select
).
subscribe
({
icon
:
'warning'
,
next
:
response
=>
{
title
:
'แจ้งเตือน'
,
if
(
response
.
success
)
{
text
:
'คุณต้องการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
pl
.
loading
=
true
this
.
plService
.
post
(
this
.
pl
.
select
).
subscribe
({
next
:
response
=>
{
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'
)
...
@@ -146,12 +171,26 @@ export class EmployeeLevel implements OnInit {
...
@@ -146,12 +171,26 @@ export class EmployeeLevel implements OnInit {
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
pl
.
loading
=
true
this
.
pl
.
loading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
})
}
}
})
})
}
}
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
))
...
@@ -169,15 +208,20 @@ export class EmployeeLevel implements OnInit {
...
@@ -169,15 +208,20 @@ export class EmployeeLevel implements OnInit {
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
pl
.
loading
=
true
this
.
pl
.
loading
=
true
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
})
}
}
})
})
}
}
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