Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myAppraisal
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
myAppraisal
Commits
94077098
Commit
94077098
authored
Feb 17, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ตั้งค่าผู้ใช้งาน
parent
5c57a862
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
256 additions
and
86 deletions
+256
-86
manage-user.component.html
...s/account-settings/manage-user/manage-user.component.html
+4
-4
set-a-password.component.ts
...count-settings/set-a-password/set-a-password.component.ts
+0
-46
user-settings.component.html
...count-settings/user-settings/user-settings.component.html
+1
-1
user-settings.component.ts
...account-settings/user-settings/user-settings.component.ts
+1
-1
company-registration-page.component.html
...egistration-page/company-registration-page.component.html
+38
-15
company-registration-page.component.ts
...-registration-page/company-registration-page.component.ts
+82
-4
employee-registration.component.html
...mployee-registration/employee-registration.component.html
+1
-1
sub-employee-registration.component.html
...yee-registration/sub-employee-registration.component.html
+41
-11
sub-employee-registration.component.ts
...loyee-registration/sub-employee-registration.component.ts
+88
-3
IMPORT_USER.xlsx
src/assets/template/IMPORT_USER.xlsx
+0
-0
No files found.
src/app/components/company-components/account-settings/manage-user/manage-user.component.html
View file @
94077098
...
...
@@ -181,9 +181,9 @@
</div>
</div>
<ng-container
*
ngIf=
"changePassword"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านเก่า
</label>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านเก่า
*
</label>
<input
type=
"password"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
oldPassword
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านใหม่
</label>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านใหม่
*
</label>
<input
type=
"password"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
newPassword
"
>
</ng-container>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
...
...
@@ -193,8 +193,8 @@
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#manage-user-alert-modal"
[
class
.
ti-btn-disabled
]="
changePassword
&&
!
userPassword
.
newPassword
"
[
disabled
]="
changePassword
&&
!
userPassword
.
newPassword
"
>
[
class
.
ti-btn-disabled
]="
changePassword
&&
(!
userPassword
.
newPassword
||
!
userPassword
.
oldPassword
)
"
[
disabled
]="
changePassword
&&
(!
userPassword
.
newPassword
||!
userPassword
.
oldPassword
)
"
>
บันทึกข้อมูล
</button>
</div>
...
...
src/app/components/company-components/account-settings/set-a-password/set-a-password.component.ts
View file @
94077098
...
...
@@ -84,52 +84,6 @@ export class SetAPasswordComponent {
newPassword
:
""
,
}
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
user
.
loading
=
true
this
.
fileService
.
upload
(
formData
,
'mbu1'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getUserList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
user
.
loading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
user
.
loading
=
false
}
})
}
downloadFile
()
{
const
fileName
=
'IMPORT_USER.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
fileName
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
updateUserPassword
()
{
this
.
user
.
loading
=
true
...
...
src/app/components/company-components/account-settings/user-settings/user-settings.component.html
View file @
94077098
...
...
@@ -27,7 +27,7 @@
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
src/app/components/company-components/account-settings/user-settings/user-settings.component.ts
View file @
94077098
...
...
@@ -178,7 +178,7 @@ export class UserSettingsComponent {
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
user
.
loading
=
true
this
.
fileService
.
upload
(
formData
,
'm
bu1
'
).
subscribe
({
this
.
fileService
.
upload
(
formData
,
'm
user
'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
...
...
src/app/components/company-components/company-registration/company-registration-page/company-registration-page.component.html
View file @
94077098
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex pr-2 pb-2rem"
>
<div
class=
"flex"
>
<div
class=
"flex items-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
[(
ngModel
)]="
isDataListChecked
"
>
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
{{numDataListChecked}} Selected
</label>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
</button>
<label
class=
"text-sm text-gray-500 ml-2"
>
Select All
</label>
</div>
</div>
</div>
<div
class=
"flex justify-between"
>
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#company-registration-page-upload-modal"
>
data-hs-overlay=
"#company-registration-page-upload-modal"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
<i
class=
"ri-add-line"
></i>
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -88,7 +107,7 @@
*
ngFor=
"let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<input
*
ngIf=
"item.data.code!='100'"
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.code}}"
[(
ngModel
)]="
item
.
check
"
>
id=
"checkbox-{{item.data.code}}"
[(
ngModel
)]="
item
.
check
"
(
ngModelChange
)="
dataListCheck
()"
>
<label
for=
"checkbox-{{item.data.code}}"
>
{{item.data.code}}
</label>
</td>
<td>
{{item.data.tdesc}}
</td>
...
...
@@ -164,7 +183,7 @@
<div
class=
"w-full flex justify-end"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
clearData
()"
>
<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)"
>
...
...
@@ -189,11 +208,11 @@
</div>
</div>
<div
class=
"ti-modal-body padding-16px pt-0 overflow-y-0"
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสบริษัท
*
</label>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสบริษัท*
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
ngClass
]="{'
bg-input-readonly
'
:modalStatus=
='edit'}"
[
readonly
]="
modalStatus=
='edit'"
[(
ngModel
)]="
dataSelect
.
code
"
[
maxLength
]="
5
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (ไทย)
*
</label>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (ไทย)*
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
edesc
"
>
...
...
@@ -207,10 +226,12 @@
data-hs-overlay=
"#company-registration-page-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#company-registration-page-alert-modal"
>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#company-registration-page-alert-modal"
[
class
.
ti-btn-disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
"
[
disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
"
>
บันทึกข้อมูล
</
a
>
</
button
>
</div>
</div>
</div>
...
...
@@ -291,18 +312,20 @@
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2 p-2"
>
<div
class=
"flex rounded-md"
>
<input
type=
"text"
id=
"hs-trailing-button-add-on-with-icon"
name=
"hs-trailing-button-add-on-with-icon
"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10"
>
<button
aria-label=
"button"
type=
"button
"
<input
#
fileInput
id=
"fileInput"
type=
"file"
(
change
)="
onFileSelected
($
event
)"
hidden
>
<input
type=
"text"
[
value
]="
selectedFileName
"
readonly
(
click
)="
fileInput
.
click
()
"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10
cursor-pointer
"
>
<button
type=
"button"
(
click
)="
fileInput
.
click
()
"
class=
"inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<a
class=
"ti-btn ti-btn-secondary"
href=
"javascript:void(0);"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
data-hs-overlay=
"#position-unit-component-upload-modal"
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</
a
>
</
button
>
</div>
</div>
</div>
...
...
src/app/components/company-components/company-registration/company-registration-page/company-registration-page.component.ts
View file @
94077098
...
...
@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component } from '@angular/core';
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
CompanyModel
,
MyCompanyModel
}
from
'src/app/shared/model/company.model'
;
import
{
CompanyService
}
from
'src/app/shared/services/company.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
export
interface
DataModel
{
code
:
string
tdesc
:
string
...
...
@@ -23,11 +24,16 @@ export class CompanyRegistrationPageComponent {
dataLoading
=
false
dataSelect
:
DataModel
=
{
code
:
""
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
}
numDataListChecked
=
0
isDataListChecked
=
false
isDataListCheckedAll
=
false
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
constructor
(
private
toastr
:
ToastrService
,
private
companyService
:
CompanyService
,
private
cdr
:
ChangeDetectorRef
)
{
}
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
)
{
}
ngOnInit
():
void
{
this
.
getCompanyList
()
}
...
...
@@ -38,6 +44,8 @@ export class CompanyRegistrationPageComponent {
next
:
response
=>
{
this
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
{
code
:
x
.
companyId
,
tdesc
:
x
.
tdesc
,
edesc
:
x
.
edesc
,
address
:
x
.
addressText
,
contact
:
x
.
descOther
}
}))
this
.
dataLoading
=
false
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
...
...
@@ -50,6 +58,7 @@ export class CompanyRegistrationPageComponent {
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
dataListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
dataListFilter
()
{
return
this
.
dataList
.
filter
(
x
=>
{
...
...
@@ -82,7 +91,7 @@ export class CompanyRegistrationPageComponent {
if
(
this
.
dataSelect
.
code
)
{
body
=
new
MyCompanyModel
({
companyId
:
this
.
dataSelect
.
code
,
tdesc
:
this
.
dataSelect
.
tdesc
,
edesc
:
this
.
dataSelect
.
edesc
,
addressText
:
this
.
dataSelect
.
address
,
descOther
:
this
.
dataSelect
.
contact
})
}
else
{
body
=
this
.
dataList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyCompanyModel
({
companyId
:
x
.
data
.
code
,
tdesc
:
x
.
data
.
tdesc
,
edesc
:
x
.
data
.
edesc
,
addressText
:
x
.
data
.
address
,
descOther
:
x
.
data
.
contact
}))
body
=
this
.
dataList
.
filter
(
x
=>
x
.
check
&&
x
.
data
.
code
!=
'100'
).
map
(
x
=>
new
MyCompanyModel
({
companyId
:
x
.
data
.
code
,
tdesc
:
x
.
data
.
tdesc
,
edesc
:
x
.
data
.
edesc
,
addressText
:
x
.
data
.
address
,
descOther
:
x
.
data
.
contact
}))
}
this
.
companyService
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
...
...
@@ -105,4 +114,73 @@ export class CompanyRegistrationPageComponent {
});
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
dataList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
code
.
includes
(
this
.
search
)
||
data
.
tdesc
.
includes
(
this
.
search
)
||
data
.
edesc
.
includes
(
this
.
search
);
return
match
;
}).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
dataListCheck
()
{
const
dataCheck
=
this
.
dataListFilter
();
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
dataList
.
filter
(
x
=>
x
.
check
).
length
;
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
dataLoading
=
true
this
.
fileService
.
upload
(
formData
,
''
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getCompanyList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
dataLoading
=
false
this
.
cdr
.
detectChanges
();
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
dataLoading
=
false
this
.
cdr
.
detectChanges
();
}
})
}
downloadFile
()
{
const
fileName
=
'.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
fileName
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
clearData
()
{
if
(
this
.
modalStatus
==
'add'
)
{
this
.
setData
()
}
else
{
this
.
setData
({
code
:
this
.
dataSelect
.
code
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
})
}
}
}
src/app/components/company-components/employee-registration/employee-registration.component.html
View file @
94077098
...
...
@@ -15,7 +15,7 @@
</a>
</nav>
</div>
<div
class=
"mt-3 px-
3
rem !-mt-3 pt-50px"
>
<div
class=
"mt-3 px-
2
rem !-mt-3 pt-50px"
>
<div
id=
"underline-1"
role=
"tabpanel"
aria-labelledby=
"underline-item-1"
>
<app-sub-employee-registration></app-sub-employee-registration>
</div>
...
...
src/app/components/company-components/employee-registration/sub-employee-registration/sub-employee-registration.component.html
View file @
94077098
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex pr-2 pb-2rem"
>
<div
class=
"flex"
>
<div
class=
"flex items-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
[(
ngModel
)]="
isDataListChecked
"
>
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
{{numDataListChecked}} Selected
</label>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
</button>
<label
class=
"text-sm text-gray-500 ml-2"
>
Select All
</label>
</div>
</div>
</div>
<div
class=
"flex justify-between"
>
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay=
"#sub-employee-registration-modal-upload"
>
data-hs-overlay=
"#sub-employee-registration-modal-upload"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
<i
class=
"ri-add-line"
></i>
นำเข้าข้อมูล
</button>
<a
class=
"mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href=
"javascript:void(0);"
>
href=
"javascript:void(0);"
(
click
)="
downloadFile
()"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
...
...
@@ -33,13 +52,21 @@
</button>
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-info h-45px m-0 shadow-md"
>
<button
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay=
"#sub-employee-registration-alert-delete-modal"
(
click
)="
modalType=
'deleteGroup'
;
selectEmployee
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
</div>
<div
class=
"px-1"
>
<button
class=
"ti-btn ti-btn-soft-info h-45px m-0 shadow-md"
>
<i
class=
"ri-printer-line"
></i>
Print
</button>
</div>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-45px m-0 shadow-md"
>
<button
class=
"ti-btn ti-btn-soft-warning h-45px m-0 shadow-md"
>
<i
class=
"ti ti-book fs-l"
></i>
Help
</button>
...
...
@@ -87,7 +114,7 @@
*
ngFor=
"let item of employeeFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.employeeId}}"
[(
ngModel
)]="
item
.
check
"
>
[(
ngModel
)]="
item
.
check
"
(
ngModelChange
)="
dataListCheck
()"
>
<label
for=
"checkbox-{{item.data.employeeId}}"
>
{{item.data.employeeId}}
</label>
</td>
<td>
{{item.data.fname}}
</td>
...
...
@@ -357,17 +384,20 @@
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2 p-2"
>
<div
class=
"flex rounded-md"
>
<input
type=
"text"
id=
"hs-trailing-button-add-on-with-icon"
name=
"hs-trailing-button-add-on-with-icon"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md "
>
<button
aria-label=
"button"
type=
"button"
class=
"inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm"
>
<input
#
fileInput
id=
"fileInput"
type=
"file"
(
change
)="
onFileSelected
($
event
)"
hidden
>
<input
type=
"text"
[
value
]="
selectedFileName
"
readonly
(
click
)="
fileInput
.
click
()"
class=
"ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer"
>
<button
type=
"button"
(
click
)="
fileInput
.
click
()"
class=
"inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm"
>
<i
class=
"ti ti-upload"
></i>
</button>
</div>
<div
class=
"flex justify-center mt-2rem mb-1rem space-x-4"
>
<a
class=
"ti-btn ti-btn-secondary"
href=
"javascript:void(0);"
>
<button
type=
"submit"
class=
"ti-btn ti-btn-secondary"
data-hs-overlay=
"#position-unit-component-upload-modal"
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</
a
>
</
button
>
</div>
</div>
</div>
...
...
src/app/components/company-components/employee-registration/sub-employee-registration/sub-employee-registration.component.ts
View file @
94077098
...
...
@@ -12,6 +12,7 @@ import { Bu1Service } from 'src/app/shared/services/bu1.service';
import
{
EmpGroupService
}
from
'src/app/shared/services/emp-group.service'
;
import
{
EmpTypeService
}
from
'src/app/shared/services/employee-type.service'
;
import
{
EmployeeService
}
from
'src/app/shared/services/employee.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
PLService
}
from
'src/app/shared/services/pl.service'
;
import
{
PositionService
}
from
'src/app/shared/services/position.service'
;
import
{
BranchService
}
from
'src/app/shared/services/่branch.service'
;
...
...
@@ -41,7 +42,7 @@ export class SubEmployeeRegistrationComponent {
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
modalType
:
'add'
|
'update'
|
'delete'
=
'add'
modalType
:
'add'
|
'update'
|
'delete'
|
'deleteGroup'
=
'add'
modal
:
DataModal
=
{
search
:
""
,
...
...
@@ -49,6 +50,13 @@ export class SubEmployeeRegistrationComponent {
page
:
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
)
}
numDataListChecked
=
0
isDataListChecked
=
false
isDataListCheckedAll
=
false
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
empGroup
:
{
loading
:
boolean
,
dataList
:
EmpGroupModel
[]
}
=
{
loading
:
false
,
dataList
:
[]
}
bu1
:
{
loading
:
boolean
,
dataList
:
Bu1Model
[]
}
=
{
loading
:
false
,
dataList
:
[]
}
position
:
{
loading
:
boolean
,
dataList
:
PositionModel
[]
}
=
{
loading
:
false
,
dataList
:
[]
}
...
...
@@ -65,6 +73,7 @@ export class SubEmployeeRegistrationComponent {
private
jobcodeService
:
JobCodeService
,
private
branchService
:
BranchService
,
private
empTypeService
:
EmpTypeService
,
private
fileService
:
FileService
,
private
pLService
:
PLService
)
{
}
ngOnInit
():
void
{
...
...
@@ -77,6 +86,53 @@ export class SubEmployeeRegistrationComponent {
this
.
getEmpTypeList
()
this
.
getPlList
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
}
uploadFile
()
{
if
(
!
this
.
selectedFile
)
{
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
return
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
employee
.
loading
=
true
this
.
fileService
.
upload
(
formData
,
''
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getEmployeeList
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
employee
.
loading
=
false
this
.
cdr
.
detectChanges
();
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
employee
.
loading
=
false
this
.
cdr
.
detectChanges
();
}
})
}
downloadFile
()
{
const
fileName
=
'IMPORT_MPOSITION.xlsx'
this
.
fileService
.
download
(
fileName
).
subscribe
({
next
:
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
response
);
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
fileName
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
getPlList
()
{
this
.
pl
.
loading
=
false
this
.
pLService
.
getList
().
subscribe
({
...
...
@@ -225,6 +281,8 @@ export class SubEmployeeRegistrationComponent {
next
:
response
=>
{
this
.
employee
.
dataList
=
response
.
map
((
x
:
any
)
=>
({
check
:
false
,
data
:
new
MyEmployeeModel
(
x
)
}))
this
.
employee
.
loading
=
false
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
...
...
@@ -233,10 +291,18 @@ export class SubEmployeeRegistrationComponent {
}
})
}
updateEmployeeList
(
type
:
'add'
|
'update'
|
'delete'
)
{
updateEmployeeList
(
type
:
'add'
|
'update'
|
'delete'
|
'deleteGroup'
)
{
let
body
=
this
.
employee
.
select
if
(
type
==
'delete'
)
{
switch
(
type
)
{
case
'delete'
:
{
body
=
[
this
.
employee
.
select
]
break
;
}
case
'deleteGroup'
:
{
body
=
this
.
employee
.
dataList
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyEmployeeModel
(
x
.
data
))
type
=
'delete'
break
;
}
}
this
.
employeeService
[
type
](
body
).
subscribe
({
next
:
response
=>
{
...
...
@@ -254,6 +320,7 @@ export class SubEmployeeRegistrationComponent {
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
employeeFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
employeeFilter
()
{
return
this
.
employee
.
dataList
.
filter
(
x
=>
...
...
@@ -300,4 +367,22 @@ export class SubEmployeeRegistrationComponent {
positionClass
:
'toast-top-right'
,
})
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
employee
.
dataList
.
filter
(
x
=>
x
.
data
.
employeeId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
data
.
fname
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
data
.
lname
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
data
.
position
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
data
.
jobCode
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())).
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
dataListCheck
()
{
const
dataCheck
=
this
.
employeeFilter
();
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
employee
.
dataList
.
filter
(
x
=>
x
.
check
).
length
;
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
}
src/assets/template/IMPORT_USER.xlsx
0 → 100644
View file @
94077098
File added
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