Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
portal-apps-manage
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
portal-apps-manage
Commits
27944f40
Commit
27944f40
authored
Sep 29, 2025
by
sawit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toggle open/close menuAppmodule by employeeid
parent
b174a52f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
175 additions
and
87 deletions
+175
-87
permission.model.ts
src/app/portal-manage/models/permission/permission.model.ts
+1
-1
permission-appmodule.component.ts
...nt/permission-appmodule/permission-appmodule.component.ts
+13
-13
permission-employeelist.component.html
...ssion-employeelist/permission-employeelist.component.html
+2
-2
permission-employeelist.component.ts
...mission-employeelist/permission-employeelist.component.ts
+10
-2
permission-menumodule.component.html
...ermission-menumodule/permission-menumodule.component.html
+22
-14
permission-menumodule.component.ts
.../permission-menumodule/permission-menumodule.component.ts
+115
-53
permission-management.routes.ts
...age/permission-management/permission-management.routes.ts
+1
-1
permission.service.ts
...p/portal-manage/services/permission/permission.service.ts
+11
-1
No files found.
src/app/portal-manage/models/permission/permission.model.ts
View file @
27944f40
...
@@ -90,7 +90,7 @@ export interface AppModule {
...
@@ -90,7 +90,7 @@ export interface AppModule {
description
:
string
;
description
:
string
;
icon
:
string
;
icon
:
string
;
path
:
string
;
path
:
string
;
is
Visibl
e
:
boolean
;
is
Activ
e
:
boolean
;
category
:
'applications'
|
'services'
|
'system'
;
category
:
'applications'
|
'services'
|
'system'
;
permissions
:
{
permissions
:
{
view
:
boolean
;
view
:
boolean
;
...
...
src/app/portal-manage/permission-management/permission-appmodule/permission-appmodule.component.ts
View file @
27944f40
...
@@ -58,7 +58,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -58,7 +58,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการทรัพยากรบุคคลขั้นสูง'
,
description
:
'ระบบจัดการทรัพยากรบุคคลขั้นสูง'
,
icon
:
'./assets/images/logoallHR/myhr-plus.jpg'
,
icon
:
'./assets/images/logoallHR/myhr-plus.jpg'
,
path
:
'/portal-manage/myhr-plus'
,
path
:
'/portal-manage/myhr-plus'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -69,7 +69,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -69,7 +69,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการทรัพยากรบุคคลพื้นฐาน'
,
description
:
'ระบบจัดการทรัพยากรบุคคลพื้นฐาน'
,
icon
:
'./assets/images/logoallHR/myHR-Lite-logo-new.png'
,
icon
:
'./assets/images/logoallHR/myHR-Lite-logo-new.png'
,
path
:
'/portal-manage/myhr-lite'
,
path
:
'/portal-manage/myhr-lite'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -80,7 +80,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -80,7 +80,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการเวลาและลงเวลา'
,
description
:
'ระบบจัดการเวลาและลงเวลา'
,
icon
:
'./assets/images/logoallHR/zeemePlus.png'
,
icon
:
'./assets/images/logoallHR/zeemePlus.png'
,
path
:
'/portal-manage/zeeme'
,
path
:
'/portal-manage/zeeme'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -91,7 +91,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -91,7 +91,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการใบหน้าและความปลอดภัย'
,
description
:
'ระบบจัดการใบหน้าและความปลอดภัย'
,
icon
:
'./assets/images/logoallHR/logo_myface.png'
,
icon
:
'./assets/images/logoallHR/logo_myface.png'
,
path
:
'/portal-manage/myface'
,
path
:
'/portal-manage/myface'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -102,7 +102,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -102,7 +102,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการการเรียนรู้และฝึกอบรม'
,
description
:
'ระบบจัดการการเรียนรู้และฝึกอบรม'
,
icon
:
'./assets/images/logoallHR/mylearn-logo.png'
,
icon
:
'./assets/images/logoallHR/mylearn-logo.png'
,
path
:
'/portal-manage/mylearn'
,
path
:
'/portal-manage/mylearn'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -113,7 +113,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -113,7 +113,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการงานและโครงการ'
,
description
:
'ระบบจัดการงานและโครงการ'
,
icon
:
'./assets/images/logoallHR/logo_myjob.png'
,
icon
:
'./assets/images/logoallHR/logo_myjob.png'
,
path
:
'/portal-manage/myjob'
,
path
:
'/portal-manage/myjob'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -124,7 +124,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -124,7 +124,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการทักษะและความสามารถ'
,
description
:
'ระบบจัดการทักษะและความสามารถ'
,
icon
:
'./assets/images/logoallHR/mySkill-x.png'
,
icon
:
'./assets/images/logoallHR/mySkill-x.png'
,
path
:
'/portal-manage/myskill-x'
,
path
:
'/portal-manage/myskill-x'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -136,7 +136,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -136,7 +136,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจองห้องประชุม'
,
description
:
'ระบบจองห้องประชุม'
,
icon
:
'./assets/images/logoallHR/booking.png'
,
icon
:
'./assets/images/logoallHR/booking.png'
,
path
:
'/portal-manage/meeting-booking'
,
path
:
'/portal-manage/meeting-booking'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -148,7 +148,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -148,7 +148,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการสิทธิ์และบทบาท'
,
description
:
'ระบบจัดการสิทธิ์และบทบาท'
,
icon
:
'./assets/images/logoallHR/permission.png'
,
icon
:
'./assets/images/logoallHR/permission.png'
,
path
:
'/portal-manage/permission-management'
,
path
:
'/portal-manage/permission-management'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -161,7 +161,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -161,7 +161,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการแดชบอร์ด และคลังวิดเจ็ต'
,
description
:
'ระบบจัดการแดชบอร์ด และคลังวิดเจ็ต'
,
icon
:
'./assets/images/logoallHR/widget.webp'
,
icon
:
'./assets/images/logoallHR/widget.webp'
,
path
:
'/portal-manage/dashboard-management'
,
path
:
'/portal-manage/dashboard-management'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
...
@@ -172,7 +172,7 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -172,7 +172,7 @@ export class PermissionAppmoduleComponent implements OnInit {
description
:
'ระบบจัดการเอกสารและเมนูกลางสำหรับแอปพลิเคชันต่างๆ'
,
description
:
'ระบบจัดการเอกสารและเมนูกลางสำหรับแอปพลิเคชันต่างๆ'
,
icon
:
'./assets/images/logoallHR/portal.webp'
,
icon
:
'./assets/images/logoallHR/portal.webp'
,
path
:
'/portal-manage/my-portal'
,
path
:
'/portal-manage/my-portal'
,
is
Visibl
e
:
true
,
is
Activ
e
:
true
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
}
}
...
@@ -185,8 +185,8 @@ export class PermissionAppmoduleComponent implements OnInit {
...
@@ -185,8 +185,8 @@ export class PermissionAppmoduleComponent implements OnInit {
onToggleAppVisibility
(
app
:
AppModule
,
event
:
Event
)
{
onToggleAppVisibility
(
app
:
AppModule
,
event
:
Event
)
{
const
input
=
event
.
target
as
HTMLInputElement
;
const
input
=
event
.
target
as
HTMLInputElement
;
app
.
is
Visibl
e
=
input
.
checked
;
app
.
is
Activ
e
=
input
.
checked
;
console
.
log
(
`Toggled
${
app
.
name
}
:
${
app
.
is
Visibl
e
}
`
);
console
.
log
(
`Toggled
${
app
.
name
}
:
${
app
.
is
Activ
e
}
`
);
// Here you would typically call a service to save this change
// Here you would typically call a service to save this change
}
}
...
...
src/app/portal-manage/permission-management/permission-employeelist/permission-employeelist.component.html
View file @
27944f40
...
@@ -93,8 +93,8 @@
...
@@ -93,8 +93,8 @@
</td> -->
</td> -->
<td>
<td>
<div
class=
"flex flex-row items-center !gap-2 "
>
<div
class=
"flex flex-row items-center !gap-2 "
>
<a
aria-label=
"anchor"
[
routerLink
]="['../
permission-menumodule
']
"
<a
aria-label=
"anchor"
(
click
)="
goToMenuModule
(
item
)
"
class=
"ti-btn ti-btn-wave !gap-0 !m-0 bg-info/10 text-info hover:bg-info hover:text-white hover:border-info"
>
class=
"ti-btn ti-btn-wave !gap-0 !m-0 bg-info/10 text-info hover:bg-info hover:text-white hover:border-info
cursor-pointer
"
>
<i
class=
"ri-pencil-line"
></i>
<i
class=
"ri-pencil-line"
></i>
</a>
</a>
</div>
</div>
...
...
src/app/portal-manage/permission-management/permission-employeelist/permission-employeelist.component.ts
View file @
27944f40
import
{
Component
,
ElementRef
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
Component
,
ElementRef
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
RouterModule
}
from
'@angular/router'
;
import
{
ActivatedRoute
,
Router
,
RouterModule
}
from
'@angular/router'
;
import
{
NgSelectModule
}
from
'@ng-select/ng-select'
;
import
{
NgSelectModule
}
from
'@ng-select/ng-select'
;
import
{
TranslateModule
,
TranslateService
}
from
'@ngx-translate/core'
;
import
{
TranslateModule
,
TranslateService
}
from
'@ngx-translate/core'
;
import
{
SharedModule
}
from
'../../../shared/shared.module'
;
import
{
SharedModule
}
from
'../../../shared/shared.module'
;
...
@@ -88,7 +88,9 @@ export class PermissionEmployeelistComponent implements OnInit {
...
@@ -88,7 +88,9 @@ export class PermissionEmployeelistComponent implements OnInit {
private
permissionService
:
PermissionService
,
private
permissionService
:
PermissionService
,
private
userService
:
UserService
,
private
userService
:
UserService
,
public
translate
:
TranslateService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
private
tokenService
:
TokenService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
)
{
// this.uploadConfig();
// this.uploadConfig();
}
}
...
@@ -246,4 +248,10 @@ export class PermissionEmployeelistComponent implements OnInit {
...
@@ -246,4 +248,10 @@ export class PermissionEmployeelistComponent implements OnInit {
}
}
}
}
goToMenuModule
(
item
:
PermissionModel2
)
{
this
.
router
.
navigate
([
'../permission-menumodule'
,
item
.
employeeId
],
{
relativeTo
:
this
.
route
});
}
}
}
src/app/portal-manage/permission-management/permission-employeelist/permission-menumodule/permission-menumodule.component.html
View file @
27944f40
<app-page-header
[
title
]="'เลือกเมนู'"
[
activeTitle
]="'ผู้ดูแลระบบ'"
[
title1
]="'จัดการสิทธิ์พนักงาน'"
[
title1Link
]="'../
permission-employeelist
'"
[
title2
]="'แอพลิเคชันที่เข้าถึงได้'"
></app-page-header>
<app-page-header
[
title
]="'เลือกเมนู'"
[
activeTitle
]="'ผู้ดูแลระบบ'"
[
title1
]="'จัดการสิทธิ์พนักงาน'"
[
title1Link
]="'../
permission-employeelist
'"
[
title2
]="'แอพลิเคชันที่เข้าถึงได้'"
></app-page-header>
<div
*
ngFor=
"let category of appCategories$ | async"
class=
"mb-12"
>
<div
*
ngFor=
"let category of appCategories$ | async"
class=
"mb-12"
>
<div
class=
"flex items-center space-x-4"
>
<div
class=
"flex items-center justify-between space-x-4"
>
<div
<div
class=
"flex items-center space-x-4"
>
class=
"w-12 h-12 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center text-white text-xl shadow-lg"
<div
>
class=
"w-12 h-12 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center text-white text-xl shadow-lg"
<i
[
class
]="
category
.
icon
"
></i>
</div>
<div>
<h2
class=
"text-3xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2"
>
>
{{ category.name }}
<i
[
class
]="
category
.
icon
"
></i>
</h2>
</div>
<p
class=
"text-gray-600"
>
{{ category.description }}
</p>
<div>
<h2
class=
"text-3xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2"
>
{{ category.name }}
</h2>
<p
class=
"text-gray-600"
>
{{ category.description }}
</p>
</div>
</div>
<!-- Save/Cancel Buttons -->
<div
*
ngIf=
"hasChanges"
class=
"flex items-center space-x-2"
>
<button
(
click
)="
cancelChanges
()"
type=
"button"
class=
"ti-btn ti-btn-light"
><i
class=
"ri-close-circle-line me-2"
></i>
ยกเลิก
</button>
<button
(
click
)="
saveChanges
()"
type=
"button"
class=
"ti-btn ti-btn-primary-full"
><i
class=
"ri-save-line me-2"
></i>
บันทึก
</button>
</div>
</div>
</div>
</div>
...
@@ -25,9 +33,9 @@
...
@@ -25,9 +33,9 @@
<!-- Toggle Switch -->
<!-- Toggle Switch -->
<div
class=
"absolute top-4 right-4 z-10"
(
click
)="$
event
.
stopPropagation
()"
>
<div
class=
"absolute top-4 right-4 z-10"
(
click
)="$
event
.
stopPropagation
()"
>
<label
class=
"inline-flex items-center cursor-pointer"
>
<label
class=
"inline-flex items-center cursor-pointer"
>
<input
type=
"checkbox"
[
checked
]="
app
.
is
Visibl
e
"
(
change
)="
onToggleAppVisibility
(
app
,
$
event
)"
class=
"sr-only peer"
>
<input
type=
"checkbox"
[
checked
]="
app
.
is
Activ
e
"
(
change
)="
onToggleAppVisibility
(
app
,
$
event
)"
class=
"sr-only peer"
>
<div
class=
"relative w-11 h-6 bg-gray-300 rounded-full peer peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600"
<div
class=
"relative w-11 h-6 bg-gray-300 rounded-full peer peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600"
[
ngStyle
]="{
'
background-color
'
:
app
.
is
Visibl
e
?
'#
3b82f6
'
:
'#
d1d5db
'
}"
></div>
[
ngStyle
]="{
'
background-color
'
:
app
.
is
Activ
e
?
'#
3b82f6
'
:
'#
d1d5db
'
}"
></div>
</label>
</label>
</div>
</div>
...
...
src/app/portal-manage/permission-management/permission-employeelist/permission-menumodule/permission-menumodule.component.ts
View file @
27944f40
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
,
RouterLink
,
RouterModule
}
from
'@angular/router'
;
import
{
ActivatedRoute
,
Router
,
RouterModule
}
from
'@angular/router'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
Observable
,
of
}
from
'rxjs'
;
import
{
Observable
,
of
,
switchMap
,
map
,
BehaviorSubject
}
from
'rxjs'
;
import
{
SharedModule
}
from
'../../../../shared/shared.module'
;
import
{
SharedModule
}
from
'../../../../shared/shared.module'
;
import
{
TokenService
}
from
'../../../../shared/services/token.service'
;
import
{
TokenService
}
from
'../../../../shared/services/token.service'
;
import
{
AppModule
,
AppCategory
,
ManageEmployeeModule
}
from
'../../../models/permission/permission.model'
;
import
{
AppModule
,
AppCategory
,
ManageEmployeeModule
,
Module
}
from
'../../../models/permission/permission.model'
;
import
{
PermissionService
}
from
'../../../services/permission/permission.service'
;
import
swal
from
'sweetalert'
;
@
Component
({
@
Component
({
selector
:
'app-permission-menumodule'
,
selector
:
'app-permission-menumodule'
,
...
@@ -14,178 +16,238 @@ import { AppModule, AppCategory, ManageEmployeeModule } from '../../../models/pe
...
@@ -14,178 +16,238 @@ import { AppModule, AppCategory, ManageEmployeeModule } from '../../../models/pe
imports
:
[
RouterModule
,
CommonModule
,
SharedModule
]
imports
:
[
RouterModule
,
CommonModule
,
SharedModule
]
})
})
export
class
PermissionMenumoduleComponent
implements
OnInit
{
export
class
PermissionMenumoduleComponent
implements
OnInit
{
accessibleApps$
:
Observable
<
AppModule
[]
>
|
undefined
;
private
categoriesSubject
=
new
BehaviorSubject
<
AppCategory
[]
>
([]);
appCategories$
:
Observable
<
AppCategory
[]
>
|
undefined
;
appCategories$
:
Observable
<
AppCategory
[]
>
=
this
.
categoriesSubject
.
asObservable
();
employeeId
:
string
|
null
=
null
;
hasChanges
=
false
;
private
allModules
:
AppModule
[]
=
[];
private
originalState
:
string
=
'[]'
;
constructor
(
constructor
(
private
tokenService
:
TokenService
,
private
tokenService
:
TokenService
,
private
router
:
Router
private
router
:
Router
,
)
{
}
private
route
:
ActivatedRoute
,
private
permissionService
:
PermissionService
)
{
this
.
allModules
=
this
.
getAppModules
();
}
ngOnInit
()
{
ngOnInit
()
{
this
.
loadAppCategories
();
this
.
route
.
paramMap
.
pipe
(
}
switchMap
(
params
=>
{
private
loadAppCategories
():
void
{
this
.
employeeId
=
params
.
get
(
'empid'
);
this
.
appCategories$
=
of
(
this
.
getAppCategories
());
if
(
this
.
employeeId
)
{
}
return
this
.
permissionService
.
getAppmodule
(
this
.
employeeId
);
private
loadAccessibleApps
():
void
{
}
else
{
// แสดงทุกเมนูก่อน โดยไม่ต้องตรวจสอบสิทธิ์
return
of
({
employeeId
:
''
,
modules
:
[]
});
this
.
accessibleApps$
=
of
(
this
.
getAppModules
());
}
})
).
subscribe
(
employeeModule
=>
{
this
.
updateDisplayedApps
(
employeeModule
);
});
}
}
private
getAppCategories
():
AppCategory
[]
{
private
updateDisplayedApps
(
employeeModule
:
ManageEmployeeModule
):
void
{
const
apps
=
this
.
getAppModules
();
const
employeeApps
=
new
Map
(
employeeModule
.
modules
.
map
(
m
=>
[
m
.
app
,
m
.
isActive
]));
const
displayedApps
=
this
.
allModules
.
map
(
app
=>
({
...
app
,
isActive
:
employeeApps
.
get
(
app
.
name
)
??
false
}));
this
.
originalState
=
JSON
.
stringify
(
displayedApps
.
map
(
a
=>
({
app
:
a
.
name
,
isActive
:
a
.
isActive
})).
sort
((
a
,
b
)
=>
a
.
app
.
localeCompare
(
b
.
app
)));
this
.
hasChanges
=
false
;
this
.
categoriesSubject
.
next
(
this
.
buildCategories
(
displayedApps
));
}
private
buildCategories
(
apps
:
AppModule
[]):
AppCategory
[]
{
return
[
return
[
{
{
id
:
'applications'
,
id
:
'applications'
,
name
:
'แอปพลิเคชันที่เข้าถึงได้'
,
name
:
'แอปพลิเคชันที่เข้าถึงได้'
,
description
:
'แอปพลิเคชันหลักสำหรับการทำงานประจำวัน'
,
description
:
'แอปพลิเคชันหลักสำหรับการทำงานประจำวัน'
,
icon
:
'ri-apps-line'
,
icon
:
'ri-apps-line'
,
apps
:
apps
.
filter
(
app
=>
app
.
category
===
'applications'
)
apps
:
apps
},
},
];
];
}
}
onToggleAppVisibility
(
app
:
AppModule
,
event
:
Event
):
void
{
const
input
=
event
.
target
as
HTMLInputElement
;
app
.
isActive
=
input
.
checked
;
const
currentCategories
=
this
.
categoriesSubject
.
getValue
();
const
currentApps
=
currentCategories
.
flatMap
(
c
=>
c
.
apps
);
const
currentState
=
JSON
.
stringify
(
currentApps
.
map
(
a
=>
({
app
:
a
.
name
,
isActive
:
a
.
isActive
})).
sort
((
a
,
b
)
=>
a
.
app
.
localeCompare
(
b
.
app
)));
this
.
hasChanges
=
currentState
!==
this
.
originalState
;
}
saveChanges
():
void
{
if
(
!
this
.
employeeId
||
!
this
.
hasChanges
)
return
;
const
currentCategories
=
this
.
categoriesSubject
.
getValue
();
const
modules
:
Module
[]
=
currentCategories
.
flatMap
(
c
=>
c
.
apps
).
map
(
a
=>
({
app
:
a
.
name
,
isActive
:
a
.
isActive
}));
const
payload
=
{
employeeId
:
this
.
employeeId
,
modules
:
modules
};
this
.
permissionService
.
postAppmodule
(
payload
).
subscribe
({
next
:
(
res
)
=>
{
swal
(
'สำเร็จ'
,
'บันทึกการเปลี่ยนแปลงสิทธิ์เรียบร้อยแล้ว'
,
'success'
);
const
displayedApps
=
currentCategories
.
flatMap
(
c
=>
c
.
apps
);
this
.
originalState
=
JSON
.
stringify
(
displayedApps
.
map
(
a
=>
({
app
:
a
.
name
,
isActive
:
a
.
isActive
})).
sort
((
a
,
b
)
=>
a
.
app
.
localeCompare
(
b
.
app
)));
this
.
hasChanges
=
false
;
},
error
:
(
err
)
=>
{
console
.
error
(
'Save failed'
,
err
);
swal
(
'ผิดพลาด'
,
'ไม่สามารถบันทึกการเปลี่ยนแปลงได้'
,
'error'
);
}
});
}
cancelChanges
():
void
{
// Re-fetch data to revert all changes
if
(
this
.
employeeId
)
{
this
.
permissionService
.
getAppmodule
(
this
.
employeeId
).
subscribe
(
employeeModule
=>
{
this
.
updateDisplayedApps
(
employeeModule
);
});
}
}
private
getAppModules
():
AppModule
[]
{
private
getAppModules
():
AppModule
[]
{
return
[
return
[
// แอปพลิเคชันที่เข้าถึงได้
{
{
id
:
'myhr-plus'
,
id
:
'myhr-plus'
,
name
:
'
myhr-plus
'
,
name
:
'
MYHR
'
,
displayName
:
'myHR-Plus'
,
displayName
:
'myHR-Plus'
,
description
:
'ระบบจัดการทรัพยากรบุคคลขั้นสูง'
,
description
:
'ระบบจัดการทรัพยากรบุคคลขั้นสูง'
,
icon
:
'./assets/images/logoallHR/myhr-plus.jpg'
,
icon
:
'./assets/images/logoallHR/myhr-plus.jpg'
,
path
:
'/portal-manage/myhr-plus'
,
path
:
'/portal-manage/myhr-plus'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'myhr-lite'
,
id
:
'myhr-lite'
,
name
:
'
myhr-lite
'
,
name
:
'
MYHR-LITE
'
,
displayName
:
'myHR-Lite'
,
displayName
:
'myHR-Lite'
,
description
:
'ระบบจัดการทรัพยากรบุคคลพื้นฐาน'
,
description
:
'ระบบจัดการทรัพยากรบุคคลพื้นฐาน'
,
icon
:
'./assets/images/logoallHR/myHR-Lite-logo-new.png'
,
icon
:
'./assets/images/logoallHR/myHR-Lite-logo-new.png'
,
path
:
'/portal-manage/myhr-lite'
,
path
:
'/portal-manage/myhr-lite'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'zeeme'
,
id
:
'zeeme'
,
name
:
'
zeeme
'
,
name
:
'
ZEESERVER
'
,
displayName
:
'Zeeme Plus'
,
displayName
:
'Zeeme Plus'
,
description
:
'ระบบจัดการเวลาและลงเวลา'
,
description
:
'ระบบจัดการเวลาและลงเวลา'
,
icon
:
'./assets/images/logoallHR/zeemePlus.png'
,
icon
:
'./assets/images/logoallHR/zeemePlus.png'
,
path
:
'/portal-manage/zeeme'
,
path
:
'/portal-manage/zeeme'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'myface'
,
id
:
'myface'
,
name
:
'
myface
'
,
name
:
'
MYFACE
'
,
displayName
:
'myFace'
,
displayName
:
'myFace'
,
description
:
'ระบบจัดการใบหน้าและความปลอดภัย'
,
description
:
'ระบบจัดการใบหน้าและความปลอดภัย'
,
icon
:
'./assets/images/logoallHR/logo_myface.png'
,
icon
:
'./assets/images/logoallHR/logo_myface.png'
,
path
:
'/portal-manage/myface'
,
path
:
'/portal-manage/myface'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'mylearn'
,
id
:
'mylearn'
,
name
:
'
mylearn
'
,
name
:
'
MYLEARN
'
,
displayName
:
'myLearn'
,
displayName
:
'myLearn'
,
description
:
'ระบบจัดการการเรียนรู้และฝึกอบรม'
,
description
:
'ระบบจัดการการเรียนรู้และฝึกอบรม'
,
icon
:
'./assets/images/logoallHR/mylearn-logo.png'
,
icon
:
'./assets/images/logoallHR/mylearn-logo.png'
,
path
:
'/portal-manage/mylearn'
,
path
:
'/portal-manage/mylearn'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'myjob'
,
id
:
'myjob'
,
name
:
'
myjob
'
,
name
:
'
MYJOB
'
,
displayName
:
'myJob'
,
displayName
:
'myJob'
,
description
:
'ระบบจัดการงานและโครงการ'
,
description
:
'ระบบจัดการงานและโครงการ'
,
icon
:
'./assets/images/logoallHR/logo_myjob.png'
,
icon
:
'./assets/images/logoallHR/logo_myjob.png'
,
path
:
'/portal-manage/myjob'
,
path
:
'/portal-manage/myjob'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'myskill-x'
,
id
:
'myskill-x'
,
name
:
'
myskill-x
'
,
name
:
'
MYSKILL-X
'
,
displayName
:
'mySkill-X'
,
displayName
:
'mySkill-X'
,
description
:
'ระบบจัดการทักษะและความสามารถ'
,
description
:
'ระบบจัดการทักษะและความสามารถ'
,
icon
:
'./assets/images/logoallHR/mySkill-x.png'
,
icon
:
'./assets/images/logoallHR/mySkill-x.png'
,
path
:
'/portal-manage/myskill-x'
,
path
:
'/portal-manage/myskill-x'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'meetingBooking'
,
id
:
'meetingBooking'
,
name
:
'
meeting-booking
'
,
name
:
'
MEETING-BOOKING
'
,
displayName
:
'Meeting Booking'
,
displayName
:
'Meeting Booking'
,
description
:
'ระบบจองห้องประชุม'
,
description
:
'ระบบจองห้องประชุม'
,
icon
:
'./assets/images/logoallHR/booking.png'
,
icon
:
'./assets/images/logoallHR/booking.png'
,
path
:
'/portal-manage/meeting-booking'
,
path
:
'/portal-manage/meeting-booking'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
// การตั้งค่าระบบ
{
{
id
:
'permissionManagement'
,
id
:
'permissionManagement'
,
name
:
'
permission-management
'
,
name
:
'
PERMISSION
'
,
displayName
:
'Permission Management'
,
displayName
:
'Permission Management'
,
description
:
'ระบบจัดการสิทธิ์และบทบาท'
,
description
:
'ระบบจัดการสิทธิ์และบทบาท'
,
icon
:
'./assets/images/logoallHR/permission.png'
,
icon
:
'./assets/images/logoallHR/permission.png'
,
path
:
'/portal-manage/permission-management'
,
path
:
'/portal-manage/permission-management'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'dashboardManagement'
,
id
:
'dashboardManagement'
,
name
:
'
dashboard-management
'
,
name
:
'
DASHBOARD
'
,
displayName
:
'Dashboard Management'
,
displayName
:
'Dashboard Management'
,
description
:
'ระบบจัดการแดชบอร์ด และคลังวิดเจ็ต'
,
description
:
'ระบบจัดการแดชบอร์ด และคลังวิดเจ็ต'
,
icon
:
'./assets/images/logoallHR/widget.webp'
,
icon
:
'./assets/images/logoallHR/widget.webp'
,
path
:
'/portal-manage/dashboard-management'
,
path
:
'/portal-manage/dashboard-management'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
},
},
{
{
id
:
'my-portal'
,
id
:
'my-portal'
,
name
:
'
my-portal
'
,
name
:
'
MYPORTAL
'
,
displayName
:
'my-Portal'
,
displayName
:
'my-Portal'
,
description
:
'ระบบจัดการเอกสารและเมนูกลางสำหรับแอปพลิเคชันต่างๆ'
,
description
:
'ระบบจัดการเอกสารและเมนูกลางสำหรับแอปพลิเคชันต่างๆ'
,
icon
:
'./assets/images/logoallHR/portal.webp'
,
icon
:
'./assets/images/logoallHR/portal.webp'
,
path
:
'/portal-manage/my-portal'
,
path
:
'/portal-manage/my-portal'
,
is
Visible
:
tru
e
,
is
Active
:
fals
e
,
category
:
'applications'
,
category
:
'applications'
,
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
permissions
:
{
view
:
true
,
create
:
true
,
edit
:
true
,
delete
:
true
,
export
:
true
,
import
:
true
}
}
}
];
];
}
}
navigateToApp
(
app
:
AppModule
)
{
navigateToApp
(
app
:
AppModule
)
{
}
}
onToggleAppVisibility
(
app
:
AppModule
,
event
:
Event
)
{
const
input
=
event
.
target
as
HTMLInputElement
;
app
.
isVisible
=
input
.
checked
;
console
.
log
(
`Toggled
${
app
.
name
}
:
${
app
.
isVisible
}
`
);
// Here you would typically call a service to save this change
}
}
}
src/app/portal-manage/permission-management/permission-management.routes.ts
View file @
27944f40
...
@@ -14,7 +14,7 @@ export const PERMISSION_ROUTES: Routes = [
...
@@ -14,7 +14,7 @@ export const PERMISSION_ROUTES: Routes = [
import
(
'./permission-employeelist/permission-employeelist.component'
).
then
((
m
)
=>
m
.
PermissionEmployeelistComponent
),
import
(
'./permission-employeelist/permission-employeelist.component'
).
then
((
m
)
=>
m
.
PermissionEmployeelistComponent
),
},
},
{
{
path
:
'permission-menumodule'
,
path
:
'permission-menumodule
/:empid
'
,
loadComponent
:
()
=>
loadComponent
:
()
=>
import
(
'./permission-employeelist/permission-menumodule/permission-menumodule.component'
).
then
((
m
)
=>
m
.
PermissionMenumoduleComponent
),
import
(
'./permission-employeelist/permission-menumodule/permission-menumodule.component'
).
then
((
m
)
=>
m
.
PermissionMenumoduleComponent
),
},
},
...
...
src/app/portal-manage/services/permission/permission.service.ts
View file @
27944f40
...
@@ -6,7 +6,7 @@ import { HttpClient } from '@angular/common/http';
...
@@ -6,7 +6,7 @@ import { HttpClient } from '@angular/common/http';
import
{
Router
}
from
'@angular/router'
;
import
{
Router
}
from
'@angular/router'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
map
,
tap
}
from
'rxjs/operators'
;
import
{
map
,
tap
}
from
'rxjs/operators'
;
import
{
PermissionModel
}
from
'./../../models/permission/permission.model'
;
import
{
ManageEmployeeModule
,
PermissionModel
}
from
'./../../models/permission/permission.model'
;
@
Injectable
({
@
Injectable
({
...
@@ -30,4 +30,14 @@ constructor(
...
@@ -30,4 +30,14 @@ constructor(
return
this
.
http
.
get
<
PermissionModel
>
(
url
);
return
this
.
http
.
get
<
PermissionModel
>
(
url
);
}
}
getAppmodule
(
empid
:
string
):
Observable
<
ManageEmployeeModule
>
{
const
url
=
`
${
environment
.
url
}
management-permission/app-module?employeeid=
${
empid
}
`
;
return
this
.
http
.
get
<
ManageEmployeeModule
>
(
url
);
}
postAppmodule
(
payload
:
{
employeeId
:
string
|
null
;
modules
:
any
}):
Observable
<
ManageEmployeeModule
>
{
const
url
=
`
${
environment
.
url
}
management-permission/app-module`
;
return
this
.
http
.
post
<
ManageEmployeeModule
>
(
url
,
payload
);
}
}
}
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