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
5c57a862
Commit
5c57a862
authored
Feb 17, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ตั้งค่าผู้ใช้งาน
parent
c4348818
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
444 additions
and
99 deletions
+444
-99
account-settings.component.html
...mponents/account-settings/account-settings.component.html
+1
-1
manage-user.component.html
...s/account-settings/manage-user/manage-user.component.html
+240
-0
manage-user.component.scss
...s/account-settings/manage-user/manage-user.component.scss
+0
-0
manage-user.component.ts
...nts/account-settings/manage-user/manage-user.component.ts
+144
-0
set-a-password.component.html
...unt-settings/set-a-password/set-a-password.component.html
+21
-73
set-a-password.component.ts
...count-settings/set-a-password/set-a-password.component.ts
+20
-2
user-settings.component.html
...count-settings/user-settings/user-settings.component.html
+13
-20
dashboard.module.ts
src/app/components/dashboard/dashboard.module.ts
+3
-1
user.service.ts
src/app/shared/services/user.service.ts
+2
-2
No files found.
src/app/components/company-components/account-settings/account-settings.component.html
View file @
5c57a862
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
</div>
</div>
<div
*
ngIf=
"currentPage==3"
id=
"underline-3"
class=
"hidden"
role=
"tabpanel"
<div
*
ngIf=
"currentPage==3"
id=
"underline-3"
class=
"hidden"
role=
"tabpanel"
aria-labelledby=
"underline-item-3"
>
aria-labelledby=
"underline-item-3"
>
จัดการผู้ใช้งาน
<app-manage-user></app-manage-user>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/components/company-components/account-settings/manage-user/manage-user.component.html
0 → 100644
View file @
5c57a862
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex justify-end"
>
<div
class=
"px-1"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
style=
"height: 40px;"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
>
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
</div>
</div>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-warning h-20px m-0 shadow-md"
>
<i
class=
"ti ti-book fs-l"
></i>
Help
</button>
</div>
</div>
</div>
<div
class=
"page px-rem"
>
<div
class=
"overflow-auto shadow-md rounded-t-md"
>
<table
class=
"ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"
>
<thead>
<tr>
<ng-container
*
ngFor=
"let item of ['ชื่อล็อคอิน','รหัสพนักงาน','ชื่อ','นามสกุล','สถานะ','การจัดการ']; let f = first; let l = last; let i = index"
>
<th
scope=
"col"
class=
"relative px-10px py-10px bg-soft-secondary text-primary !text-center"
>
<span
class=
"font-size-12px font-weight-700"
>
{{ item }}
</span>
<div
class=
"absolute top-1/2 transform -translate-y-1/2 right-0"
*
ngIf=
"!l"
>
<i
class=
"ti ti-dots-vertical fs-l"
></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"user.loading"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<div
*
ngFor=
"let item of [1,2,3]"
class=
"ti-spinner w-8 h-8 text-secondary mx-1"
role=
"status"
aria-label=
"loading"
>
<span
class=
"sr-only"
>
Loading...
</span>
</div>
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!user.loading&&!userListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!user.loading&&userListFilter().length"
>
<tr
*
ngFor=
"let item of userListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
{{item.data.usernameId}}
</td>
<td
class=
"text-center"
>
{{item.data.empId}}
</td>
<td>
{{item.data.employee.fname}}
</td>
<td>
{{item.data.employee.lname}}
</td>
<td
class=
"text-center"
>
{{item.data.status=='0'?'ไม่ใช้งาน':'ใช้งาน'}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectUser
(
item
.
data
)"
data-hs-overlay=
"#manage-user-modal"
></i>
</td>
</tr>
</tbody>
</table>
</div>
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"page.length"
>
<ul
class=
"ti-pagination"
>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage-1
||
1
)"
>
<i
class=
"ri-arrow-left-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<li
*
ngFor=
"let item of page;let f = first;let l = last"
>
<ng-container
*
ngIf=
"item==3&¤tPage!=1&¤tPage!=2&¤tPage!=3"
>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
><i
class=
"ri-more-line"
></i>
</a>
</ng-container>
<ng-container
*
ngIf=
"(f||l)||(item==currentPage-1||item==currentPage||item==currentPage+1)"
>
<a
class=
"page-link"
href=
"javascript:void(0);"
[
class
.
active
]="
item=
=currentPage"
(
click
)="
currentPage=
item"
>
{{item}}
</a>
</ng-container>
<ng-container
*
ngIf=
"item==page.length-2&¤tPage!=page.length&¤tPage!=page.length-1&¤tPage!=page.length-2"
>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
><i
class=
"ri-more-line"
></i>
</a>
</ng-container>
</li>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage
>
page.length-1 ? currentPage: currentPage+1 )">
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
</ul>
<ul
class=
"nav-tabs mt-3"
>
<span>
Show {{((currentPage-1) * 10)+1}} to {{userListFilter().length
<10
?
userListFilter
().
length:
(
currentPage=
=page.length
?
((
currentPage
*
10
)
-
((
currentPage
*
10
)
-
userListFilter
().
length
)
)
:
(
currentPage
*
10
)
)
}}
of
{{
userListFilter
().
length
}}
items
</
span
>
</ul>
</nav>
</div>
<div
id=
"manage-user-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"
>
จัดการผู้ใช้งาน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#manage-user-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<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"
(
click
)="
userPassword
.
oldPassword=
''
;
userPassword
.
newPassword=
''
"
>
<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
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-warning h-45px m-0 shadow-md"
>
<i
class=
"ti ti-book fs-l"
></i>
Help
</button>
</div>
</div>
</div>
<div
class=
"ti-modal-body padding-16px pt-0 overflow-y-0"
>
<label
class=
"ti-form-label mt-2rem"
>
ชื่อล็อคอิน
</label>
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
userPassword
.
usernameId
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสพนักงาน
</label>
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
userPassword
.
empId
"
>
<div
class=
"mt-2rem grid grid-cols-5 gap-6"
>
<div
class=
"flex"
>
<input
type=
"radio"
name=
"hs-default-radio"
class=
"ti-form-radio"
[
value
]="'
0
'"
[(
ngModel
)]="
user
.
select
.
status
"
id=
"hs-default-radio"
>
<label
for=
"hs-default-radio"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
ไม่ใช้งาน
</label>
</div>
<div
class=
"flex"
>
<input
type=
"radio"
name=
"hs-default-radio"
class=
"ti-form-radio"
[
value
]="'
1
'"
[(
ngModel
)]="
user
.
select
.
status
"
id=
"hs-checked-radio"
checked
>
<label
for=
"hs-checked-radio"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
ใช้งาน
</label>
</div>
</div>
<div
class=
"mt-2rem"
>
<div
class=
"flex"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox mt-0.5"
id=
"hs-default-checkbox"
[(
ngModel
)]="
changePassword
"
>
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
>
เปลี่ยนรหัสผ่าน
</label>
</div>
</div>
<ng-container
*
ngIf=
"changePassword"
>
<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>
<input
type=
"password"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
newPassword
"
>
</ng-container>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<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=
"#manage-user-modal"
>
ย้อนกลับ
</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
"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
<div
id=
"manage-user-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"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#manage-user-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<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=
"#manage-user-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#manage-user-alert-modal"
(
click
)="
updateUserPassword
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/components/company-components/account-settings/manage-user/manage-user.component.scss
0 → 100644
View file @
5c57a862
src/app/components/company-components/account-settings/manage-user/manage-user.component.ts
0 → 100644
View file @
5c57a862
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
MyUserModel
,
UserModel
}
from
'src/app/shared/model/user.model'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
UserService
}
from
'src/app/shared/services/user.service'
;
export
interface
DataPassword
{
usernameId
:
string
,
empId
:
string
,
companyId
:
string
,
oldPassword
:
string
,
newPassword
:
string
,
}
@
Component
({
selector
:
'app-manage-user'
,
templateUrl
:
'./manage-user.component.html'
,
styleUrls
:
[
'./manage-user.component.scss'
]
})
export
class
ManageUserComponent
{
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
companyId
=
""
user
:
{
loading
:
boolean
,
select
:
UserModel
,
dataList
:
{
check
:
boolean
,
data
:
UserModel
}[]
}
=
{
loading
:
false
,
select
:
new
MyUserModel
(),
dataList
:
[]
}
search
=
""
userPassword
:
DataPassword
=
{
usernameId
:
""
,
empId
:
""
,
companyId
:
""
,
oldPassword
:
""
,
newPassword
:
""
,
}
changePassword
=
false
constructor
(
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
userService
:
UserService
)
{
this
.
companyId
=
this
.
decodeJWT
(
sessionStorage
.
getItem
(
"accessToken"
)
||
''
).
companyid
}
ngOnInit
():
void
{
this
.
getUserList
()
}
decodeJWT
(
token
:
string
)
{
let
base64Url
=
token
.
split
(
'.'
)[
1
];
// ดึงส่วนที่เป็น Payload
let
base64
=
base64Url
.
replace
(
'-'
,
'+'
).
replace
(
'_'
,
'/'
);
// แก้ไข base64 ให้ถูกต้อง
let
jsonPayload
=
decodeURIComponent
(
atob
(
base64
).
split
(
''
).
map
(
function
(
c
)
{
return
'%'
+
(
'00'
+
c
.
charCodeAt
(
0
).
toString
(
16
)).
slice
(
-
2
);
}).
join
(
''
));
return
JSON
.
parse
(
jsonPayload
);
}
getUserList
()
{
this
.
user
.
loading
=
true
this
.
userService
.
getList
(
"false"
).
subscribe
({
next
:
response
=>
{
this
.
user
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyUserModel
(
x
)
}))
this
.
user
.
loading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
user
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
userListFilter
()
{
return
this
.
user
.
dataList
.
filter
(
x
=>
{
const
data
=
x
.
data
const
match
=
data
.
usernameId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
empId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
employee
.
thFullName
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
return
match
})
}
selectUser
(
data
:
UserModel
)
{
this
.
user
.
select
=
new
MyUserModel
(
data
)
this
.
userPassword
=
{
usernameId
:
this
.
user
.
select
.
usernameId
,
empId
:
this
.
user
.
select
.
empId
,
companyId
:
this
.
user
.
select
.
companyId
,
oldPassword
:
""
,
newPassword
:
""
,
}
}
updateUserPassword
()
{
if
(
this
.
changePassword
)
{
this
.
user
.
loading
=
true
this
.
userService
.
changePassword
(
this
.
userPassword
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
updateUser
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
user
.
loading
=
false
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
user
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
else
{
this
.
updateUser
()
}
}
updateUser
()
{
this
.
user
.
loading
=
true
this
.
userService
.
post
(
new
MyUserModel
(
this
.
user
.
select
)).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getUserList
()
this
.
searchChange
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
user
.
loading
=
false
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
user
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
userListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
selectDataModal
(
target
:
{
[
key
:
string
]:
any
},
field
:
string
,
data
:
any
)
{
target
[
field
]
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
}
}
\ No newline at end of file
src/app/components/company-components/account-settings/set-a-password/set-a-password.component.html
View file @
5c57a862
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-end"
>
<div
class=
"flex pr-2"
>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<div
class=
"relative shadow-md"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
<input
type=
"text"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
data-hs-overlay=
"#user-setting-upload-modal"
placeholder=
"Search by No. or Name"
style=
"height: 40px;"
[(
ngModel
)]="
search
"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
(
ngModelChange
)="
searchChange
()"
>
<i
class=
"ri-add-line"
></i>
<div
นำเข้าข้อมูล
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
</button>
<i
class=
"ri-search-line text-gray"
></i>
<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);"
>
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
</div>
<div
class=
"flex justify-end"
>
<div
class=
"px-1"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
style=
"height: 40px;"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
>
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
</div>
</div>
</div>
</div>
</div>
<div
class=
"px-1"
>
</div
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-warning h-20px m-0 shadow-md
"
>
<div
class=
"px-1
"
>
<i
class=
"ti ti-book fs-l"
></i
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-warning h-20px m-0 shadow-md"
>
Help
<i
class=
"ti ti-book fs-l"
></i>
</button>
Help
</
div
>
</
button
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -72,11 +56,7 @@
...
@@ -72,11 +56,7 @@
<tbody
*
ngIf=
"!user.loading&&userListFilter().length"
>
<tbody
*
ngIf=
"!user.loading&&userListFilter().length"
>
<tr
<tr
*
ngFor=
"let item of userListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
*
ngFor=
"let item of userListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
{{item.data.usernameId}}
</td>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.usernameId}}"
[(
ngModel
)]="
item
.
check
"
>
<label
for=
"checkbox-{{item.data.usernameId}}"
>
{{item.data.usernameId}}
</label>
</td>
<td
class=
"text-center"
>
{{item.data.empId}}
</td>
<td
class=
"text-center"
>
{{item.data.empId}}
</td>
<td>
{{item.data.employee.fname}}
</td>
<td>
{{item.data.employee.fname}}
</td>
<td>
{{item.data.employee.lname}}
</td>
<td>
{{item.data.employee.lname}}
</td>
...
@@ -148,7 +128,7 @@
...
@@ -148,7 +128,7 @@
<div
class=
"absolute flex"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<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
)="
userPassword
.
oldPassword=
=
'';userPassword.newPassword=''"
>
(
click
)="
userPassword
.
oldPassword=
''
;
userPassword
.
newPassword=
''
"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
<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"
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)"
>
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
...
@@ -178,49 +158,17 @@
...
@@ -178,49 +158,17 @@
[(
ngModel
)]="
userPassword
.
usernameId
"
>
[(
ngModel
)]="
userPassword
.
usernameId
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสพนักงาน
</label>
<label
class=
"ti-form-label mt-2rem"
>
รหัสพนักงาน
</label>
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
userPassword
.
empId
"
>
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
userPassword
.
empId
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านเก่า
</label>
<label
class=
"ti-form-label mt-2rem"
>
กำหนดผ่านใหม่*
</label>
<input
type=
"text"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
oldPassword
"
>
<input
type=
"password"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
newPassword
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสผ่านใหม่
</label>
<input
type=
"text"
class=
"ti-form-input"
[(
ngModel
)]="
userPassword
.
newPassword
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
<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"
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=
"#user-setting-modal"
>
data-hs-overlay=
"#user-setting-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<
a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);
"
<
button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#user-setting-alert-modal
"
data-hs-overlay=
"#user-setting-alert-modal
"
>
[
class
.
ti-btn-disabled
]="!
userPassword
.
newPassword
"
[
disabled
]="!
userPassword
.
newPassword
"
>
บันทึกข้อมูล
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"user-setting-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=
"ti-modal-header bg-primary !rounded-none !rounded-t-sm"
>
<h5
class=
"text-xxl font-bold text-white"
>
นำเข้าผู้ใช้งาน
</h5>
</div>
<div
class=
"ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm"
>
<h1
class=
"mt-2"
style=
"text-align: center;"
>
ไฟล์
</h1>
<div
class=
"mt-2 p-2"
>
<div
class=
"flex rounded-md"
>
<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"
>
<button
type=
"submit"
data-hs-overlay=
"#user-setting-upload-modal"
class=
"ti-btn ti-btn-secondary"
[
class
.
ti-btn-disabled
]="!
selectedFile
"
(
click
)="
uploadFile
()"
[
disabled
]="!
selectedFile
"
>
อัปโหลด
</button>
</button>
</div>
</div>
</div>
</div>
...
...
src/app/components/company-components/account-settings/set-a-password/set-a-password.component.ts
View file @
5c57a862
...
@@ -53,7 +53,7 @@ export class SetAPasswordComponent {
...
@@ -53,7 +53,7 @@ export class SetAPasswordComponent {
getUserList
()
{
getUserList
()
{
this
.
user
.
loading
=
true
this
.
user
.
loading
=
true
this
.
userService
.
getList
().
subscribe
({
this
.
userService
.
getList
(
"true"
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
user
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyUserModel
(
x
)
}))
this
.
user
.
dataList
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyUserModel
(
x
)
}))
this
.
user
.
loading
=
false
this
.
user
.
loading
=
false
...
@@ -136,9 +136,27 @@ export class SetAPasswordComponent {
...
@@ -136,9 +136,27 @@ export class SetAPasswordComponent {
this
.
userService
.
changePassword
(
this
.
userPassword
).
subscribe
({
this
.
userService
.
changePassword
(
this
.
userPassword
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
updateUser
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
user
.
loading
=
false
}
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
user
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
updateUser
()
{
this
.
user
.
loading
=
true
this
.
userService
.
post
(
new
MyUserModel
({
...
this
.
user
.
select
,
status
:
'1'
})).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getUserList
()
this
.
getUserList
()
this
.
searchChange
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
user
.
loading
=
false
this
.
user
.
loading
=
false
...
...
src/app/components/company-components/account-settings/user-settings/user-settings.component.html
View file @
5c57a862
...
@@ -210,10 +210,12 @@
...
@@ -210,10 +210,12 @@
</div>
</div>
</div>
</div>
<div
class=
"ti-modal-body padding-16px pt-0 overflow-y-0"
>
<div
class=
"ti-modal-body padding-16px pt-0 overflow-y-0"
>
<label
class=
"ti-form-label mt-2rem"
>
ชื่อล็อคอิน
</label>
<label
class=
"ti-form-label mt-2rem"
>
ชื่อล็อคอิน*
</label>
<input
type=
"text"
class=
"ti-form-input"
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
<input
type=
"text"
class=
"ti-form-input"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
user
.
select
.
usernameId
"
[
maxLength
]="
20
"
>
oninput=
"this.value = this.value.replace(/[\u0E00-\u0E7F]/g, '')"
<label
class=
"ti-form-label mt-2rem"
>
รหัสพนักงาน
</label>
[
ngClass
]="{'
bg-input-readonly
'
:currentModal=
='edit'}"
[
readonly
]="
currentModal=
='edit'"
[(
ngModel
)]="
user
.
select
.
usernameId
"
[
maxLength
]="
20
"
>
<label
class=
"ti-form-label mt-2rem"
>
รหัสพนักงาน*
</label>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"relative flex rounded-md"
>
<div
class=
"relative flex rounded-md"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
employee
.
employeeId
"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
employee
.
employeeId
"
>
...
@@ -232,7 +234,7 @@
...
@@ -232,7 +234,7 @@
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
user
.
select
.
employee
.
thFullName
"
>
[(
ngModel
)]="
user
.
select
.
employee
.
thFullName
"
>
</div>
</div>
<label
class=
"ti-form-label mt-2rem"
>
บทบาท
</label>
<label
class=
"ti-form-label mt-2rem"
>
บทบาท
*
</label>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"relative flex rounded-md"
>
<div
class=
"relative flex rounded-md"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
role
.
roleId
"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
role
.
roleId
"
>
...
@@ -251,7 +253,7 @@
...
@@ -251,7 +253,7 @@
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
user
.
select
.
role
.
tdesc
"
>
[(
ngModel
)]="
user
.
select
.
role
.
tdesc
"
>
</div>
</div>
<label
class=
"ti-form-label mt-2rem"
>
ระดับ
</label>
<label
class=
"ti-form-label mt-2rem"
>
ระดับ
*
</label>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"grid grid-cols-2 gap-2"
>
<div
class=
"relative flex rounded-md"
>
<div
class=
"relative flex rounded-md"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
level
.
userLevel
"
>
<input
type=
"text"
class=
"ti-form-input"
readonly
[(
ngModel
)]="
user
.
select
.
level
.
userLevel
"
>
...
@@ -270,26 +272,17 @@
...
@@ -270,26 +272,17 @@
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
<input
type=
"text"
class=
"ti-form-input bg-input-readonly"
readonly
[(
ngModel
)]="
user
.
select
.
level
.
tdesc
"
>
[(
ngModel
)]="
user
.
select
.
level
.
tdesc
"
>
</div>
</div>
<label
class=
"ti-form-label mt-2rem"
>
สถานะรหัสผ่าน
</label>
<select
class=
"ti-form-select w-1/2"
placeholder=
"Select"
[(
ngModel
)]="
user
.
select
.
status
"
>
<ng-container
*
ngIf=
"currentModal=='add'"
>
<option
[
ngValue
]="'
0
'"
>
รหัสผ่านถูกตั้งใหม่
</option>
</ng-container>
<ng-container
*
ngIf=
"currentModal=='edit'"
>
<option
[
ngValue
]="'
0
'"
>
รหัสผ่านถูกตั้งใหม่
</option>
<option
[
ngValue
]="'
1
'"
>
รหัสผ่านถูกใช้งาน
</option>
</ng-container>
</select>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
<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"
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=
"#user-setting-modal"
>
data-hs-overlay=
"#user-setting-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#user-setting-alert-modal"
data-hs-overlay=
"#user-setting-alert-modal"
>
[
class
.
ti-btn-disabled
]="!
user
.
select
.
usernameId
||!
user
.
select
.
employee
.
employeeId
||!
user
.
select
.
role
.
roleId
||!
user
.
select
.
level
.
userLevel
"
[
disabled
]="!
user
.
select
.
usernameId
||!
user
.
select
.
employee
.
employeeId
||!
user
.
select
.
role
.
roleId
||!
user
.
select
.
level
.
userLevel
"
>
บันทึกข้อมูล
บันทึกข้อมูล
</
a
>
</
button
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -788,7 +781,7 @@
...
@@ -788,7 +781,7 @@
data-hs-overlay=
"#user-setting-alert-modal"
>
data-hs-overlay=
"#user-setting-alert-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-
success
"
href=
"javascript:void(0);"
<a
class=
"ti-btn ti-btn-
danger
"
href=
"javascript:void(0);"
data-hs-overlay=
"#user-setting-alert-modal"
(
click
)="
updateUser
('
delete
')"
>
data-hs-overlay=
"#user-setting-alert-modal"
(
click
)="
updateUser
('
delete
')"
>
ลบข้อมูล
ลบข้อมูล
</a>
</a>
...
...
src/app/components/dashboard/dashboard.module.ts
View file @
5c57a862
...
@@ -135,6 +135,7 @@ import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-
...
@@ -135,6 +135,7 @@ import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-
import
{
IndicatorsCoursesService
}
from
'src/app/shared/services/indicators-courses.service'
;
import
{
IndicatorsCoursesService
}
from
'src/app/shared/services/indicators-courses.service'
;
import
{
IdpDevelopmentService
}
from
'src/app/shared/services/idp-development.service'
;
import
{
IdpDevelopmentService
}
from
'src/app/shared/services/idp-development.service'
;
import
{
UserService
}
from
'src/app/shared/services/user.service'
;
import
{
UserService
}
from
'src/app/shared/services/user.service'
;
import
{
ManageUserComponent
}
from
'../company-components/account-settings/manage-user/manage-user.component'
;
export
const
MY_DATE_FORMATS
=
{
export
const
MY_DATE_FORMATS
=
{
parse
:
{
parse
:
{
...
@@ -253,7 +254,8 @@ export class CustomDateAdapter extends NativeDateAdapter {
...
@@ -253,7 +254,8 @@ export class CustomDateAdapter extends NativeDateAdapter {
IdpEvalutionComponent
,
IdpEvalutionComponent
,
CompanyRegistrationPageComponent
,
CompanyRegistrationPageComponent
,
PmsEvalutionComponent
,
PmsEvalutionComponent
,
CEvaluationComponent
CEvaluationComponent
,
ManageUserComponent
],
],
imports
:
[
imports
:
[
CommonModule
,
CommonModule
,
...
...
src/app/shared/services/user.service.ts
View file @
5c57a862
...
@@ -13,8 +13,8 @@ export class UserService {
...
@@ -13,8 +13,8 @@ export class UserService {
urlApi
=
environment
.
baseUrl
+
this
.
api
urlApi
=
environment
.
baseUrl
+
this
.
api
constructor
(
private
http
:
HttpClient
)
{
constructor
(
private
http
:
HttpClient
)
{
}
}
getList
():
Observable
<
UserModel
[]
>
{
getList
(
pwdempty
?:
string
):
Observable
<
UserModel
[]
>
{
return
this
.
http
.
get
<
UserModel
[]
>
(
this
.
urlApi
+
"/lists"
)
return
this
.
http
.
get
<
UserModel
[]
>
(
this
.
urlApi
+
"/lists"
+
(
pwdempty
?
'?pwdempty='
+
pwdempty
:
""
)
)
}
}
getRoleList
():
Observable
<
RoleModel
[]
>
{
getRoleList
():
Observable
<
RoleModel
[]
>
{
return
this
.
http
.
get
<
RoleModel
[]
>
(
this
.
urlApi
+
"/role/lists"
)
return
this
.
http
.
get
<
RoleModel
[]
>
(
this
.
urlApi
+
"/role/lists"
)
...
...
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