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
f3407a40
Commit
f3407a40
authored
Apr 28, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE เปลี่ยน modal ข้อมูลลักษณะงาน
parent
4ba38092
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
237 deletions
+140
-237
employee-group-unit.component.html
...on/employee-group-unit/employee-group-unit.component.html
+19
-112
employee-group-unit.component.ts
...tion/employee-group-unit/employee-group-unit.component.ts
+50
-5
position-unit.component.html
...nts/job-description/position/position-unit.component.html
+19
-114
position-unit.component.ts
...nents/job-description/position/position-unit.component.ts
+52
-6
No files found.
src/app/components/company-components/job-description/employee-group-unit/employee-group-unit.component.html
View file @
f3407a40
...
...
@@ -22,7 +22,7 @@
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay=
"#employee-group-unit-component-page-modal"
(
click
)="
currentModal=
'add'
;
selectEmp_group
()"
>
(
click
)="
currentModal=
'add'
;
selectEmp_group
()
;
openDialog
()
"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
...
...
@@ -30,7 +30,7 @@
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
(
click
)="
currentModal=
'delete'
;
selectEmp_group
()"
>
(
click
)="
currentModal=
'delete'
;
selectEmp_group
()
;
deleteEmp_group
()
"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
...
...
@@ -39,50 +39,27 @@
</div>
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
emp_group
.
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
modalName=
"#employee-group-unit-component-page-modal"
(
sendSelectData
)="
currentModal=
'edit'
;
selectEmp_group
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
currentModal=
'edit'
;
selectEmp_group
($
event
)
;
openDialog
()
"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</div>
<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"
>
<ng-template
#
employeeGroupUnitModal
let-modal
>
<h3
mat-dialog-title
>
{{currentModal=='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-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=
"w-full flex justify-end mb-1rem"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectEmp_group
()"
>
<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>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectEmp_group
()"
>
<i
class=
"ti ti-eraser text-base"
></i>
Clear
</button>
</div>
</div>
</div>
<div
class=
"ti-modal-body "
>
<mat-dialog-content
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสกลุ่มพนักงาน
<span
class=
"text-danger"
>
*
...
...
@@ -100,92 +77,22 @@
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
emp_group
.
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_group
.
select
.
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-page-modal
"
>
</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"
data-hs-overlay=
"#employee-group-unit-component-page-alert-modal"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addEmp_group
()"
[
class
.
ti-btn-disabled
]="!
emp_group
.
select
.
groupId
||!
emp_group
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
emp_group
.
select
.
groupId
||!
emp_group
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
</mat-dialog-actions>
</ng-template>
<div
id=
"employee-group-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"
>
<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-group-unit-component-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-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=
"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-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=
"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-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
()"
*
ngIf=
"numSelectItem()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</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 rounded-md"
>
...
...
src/app/components/company-components/job-description/employee-group-unit/employee-group-unit.component.ts
View file @
f3407a40
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
{
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'
;
import
Swal
from
'sweetalert2'
;
export
interface
DataModel
{
groupId
:
string
tdesc
:
string
...
...
@@ -46,16 +48,28 @@ export class EmployeeGroupUnit implements OnInit {
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"employeeGroupUnitModal"
)
employeeGroupUnitModal
:
any
;
dialogRef
:
any
constructor
(
private
empGroupService
:
EmpGroupService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
ngOnInit
():
void
{
this
.
getEmpGroupList
()
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
employeeGroupUnitModal
,
{
width
:
'500px'
,
height
:
'500px'
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
...
@@ -135,25 +149,51 @@ export class EmployeeGroupUnit implements OnInit {
}
addEmp_group
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_group
.
loading
=
true
this
.
empGroupService
.
post
(
this
.
emp_group
.
select
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmpGroupList
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
emp_group
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
closeDialog
()
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
emp_group
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
closeDialog
()
}
})
}
})
}
deleteEmp_group
()
{
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
emp_group
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
emp_group
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
groupId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
groupId
)).
map
(
x
=>
new
MyEmpGroupModel
(
x
))
...
...
@@ -175,11 +215,16 @@ export class EmployeeGroupUnit implements OnInit {
}
});
}
});
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
Swal
.
fire
({
icon
:
type
,
title
:
'แจ้งเตือน'
,
text
:
text
,
showCancelButton
:
false
,
confirmButtonText
:
'ยืนยัน'
,
})
}
...
...
src/app/components/company-components/job-description/position/position-unit.component.html
View file @
f3407a40
...
...
@@ -21,7 +21,7 @@
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay=
"#position-unit-component-page-modal"
(
click
)="
currentModal=
'add'
;
selectPosition
()"
>
data-hs-overlay=
"#position-unit-component-page-modal"
(
click
)="
currentModal=
'add'
;
selectPosition
()
;
openDialog
()
"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
...
...
@@ -29,7 +29,7 @@
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
(
click
)="
currentModal=
'delete'
;
selectPosition
()"
>
(
click
)="
currentModal=
'delete'
;
selectPosition
()
;
deletePosition
()
"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
...
...
@@ -39,50 +39,25 @@
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
position
.
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
modalName=
"#position-unit-component-page-modal"
(
sendSelectData
)="
currentModal=
'edit'
;
selectPosition
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
currentModal=
'edit'
;
selectPosition
($
event
)
;
openDialog
()
"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</div>
<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"
>
<ng-template
#
positionUnitModal
let-modal
>
<h3
mat-dialog-title
>
{{currentModal=='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-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=
"w-full flex justify-end mb-1rem"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectPosition
()"
>
<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>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectPosition
()"
>
<i
class=
"ti ti-eraser text-base"
></i>
Clear
</button>
</div>
</div>
</div>
<div
class=
"ti-modal-body "
>
<mat-dialog-content
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสตำแหน่ง
<span
class=
"text-danger"
>
...
...
@@ -99,92 +74,22 @@
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
position
.
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
)]="
position
.
select
.
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-page-modal
"
>
</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"
data-hs-overlay=
"#position-unit-component-page-alert-modal"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addPosition
()"
[
class
.
ti-btn-disabled
]="!
position
.
select
.
positionId
||!
position
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
[
disabled
]="!
position
.
select
.
positionId
||!
position
.
select
.
tdesc
||(
currentModal=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
</mat-dialog-actions>
</ng-template>
<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"
>
<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=
"#position-unit-component-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=
"#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=
"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=
"#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=
"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=
"#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
()"
*
ngIf=
"numSelectItem()"
>
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</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 rounded-md"
>
...
...
src/app/components/company-components/job-description/position/position-unit.component.ts
View file @
f3407a40
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
{
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'
;
import
Swal
from
'sweetalert2'
;
@
Component
({
selector
:
'app-position-unit'
,
templateUrl
:
'./position-unit.component.html'
,
...
...
@@ -38,14 +40,27 @@ export class PositionUnitComponent implements OnInit {
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"positionUnitModal"
)
positionUnitModal
:
any
;
dialogRef
:
any
constructor
(
private
positionService
:
PositionService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
ngOnInit
():
void
{
this
.
getPositionList
()
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
positionUnitModal
,
{
width
:
'500px'
,
height
:
'500px'
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
...
...
@@ -128,25 +143,51 @@ export class PositionUnitComponent implements OnInit {
}
addPosition
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
position
.
loading
=
true
this
.
positionService
.
post
(
this
.
position
.
select
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getPositionList
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
position
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
closeDialog
()
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
position
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
closeDialog
()
}
})
}
})
}
deletePosition
()
{
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
position
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
position
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
positionId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
positionId
)).
map
(
x
=>
new
MyPositionModel
(
x
))
...
...
@@ -167,11 +208,16 @@ export class PositionUnitComponent implements OnInit {
}
})
}
})
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
Swal
.
fire
({
icon
:
type
,
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