Commit 8874d017 by Nattana Chaiyamat

กำหนดสิทธิการเข้าใช้งาน

parent 57aa19ab
...@@ -248,11 +248,11 @@ ...@@ -248,11 +248,11 @@
</ng-container> </ng-container>
<ng-container *ngIf="currentModal == 'delete'"> <ng-container *ngIf="currentModal == 'delete'">
<ng-container *ngIf="numDataListChecked"> <ng-container *ngIf="numDataListChecked">
ยืนยันการลบข้อมูลหรือไม่ ยืนยันการลบข้อมูลหรือไม่
</ng-container> </ng-container>
<ng-container *ngIf="!numDataListChecked"> <ng-container *ngIf="!numDataListChecked">
เลือกข้อมูลที่ต้องการลบ เลือกข้อมูลที่ต้องการลบ
</ng-container>! </ng-container>!
</ng-container> </ng-container>
</p> </p>
<div class="flex justify-end mt-2rem mb-1rem"> <div class="flex justify-end mt-2rem mb-1rem">
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
</button> </button>
<a class="ti-btn ti-btn-danger" href="javascript:void(0);" <a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#role-permission-config-alert-modal" data-hs-overlay="#role-permission-config-alert-modal"
(click)="updateConfigPermission('delete')" *ngIf="numDataListChecked"> (click)="updateConfigPermission('delete')" *ngIf="numDataListChecked">
ลบข้อมูล ลบข้อมูล
</a> </a>
</ng-container> </ng-container>
......
...@@ -85,6 +85,7 @@ export class SidebarComponent { ...@@ -85,6 +85,7 @@ export class SidebarComponent {
this.getConfigPermissionByUserLevel() this.getConfigPermissionByUserLevel()
this.ParentActive(); this.ParentActive();
this.router.events.subscribe((event) => { this.router.events.subscribe((event) => {
sessionStorage.setItem('currentUrl', this.router.url)
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
this.ParentActive(); this.ParentActive();
} }
...@@ -115,33 +116,41 @@ export class SidebarComponent { ...@@ -115,33 +116,41 @@ export class SidebarComponent {
this.configPermission.data = new MyConfigPermissionModel(response) this.configPermission.data = new MyConfigPermissionModel(response)
this.menuItems.forEach(x => { this.menuItems.forEach(x => {
// เปิดทุกเมนู // เปิดทุกเมนู
x.show = true // x.show = true
x.children?.forEach(y => { // x.children?.forEach(y => {
y.show = true // y.show = true
}) // })
// เปิดตาม config // เปิดตาม config
// const configMenu = this.configPermission.data.menuBody.find(y => y.id == x.id) const configMenu = this.configPermission.data.menuBody.find(y => y.id == x.id)
// if (configMenu) { if (configMenu) {
// x.show = configMenu.show x.show = configMenu.show
// x.children?.forEach(y => {
// const configChildren = configMenu.children.find(z => z.id == y.id)
// if (configChildren) {
// y.show = configChildren.show
// }
// })
// }
})
let path404check = '/404page'
this.menuItems.forEach(x => {
if (x.show && path404check == '/404page') {
x.children?.forEach(y => { x.children?.forEach(y => {
if (y.show) { const configChildren = configMenu.children.find(z => z.id == y.id)
path404check = y.path || '404page' if (configChildren) {
y.show = configChildren.show
} }
}) })
} }
}) })
let path404check = '/404page'
this.menuItems.forEach(x => {
const children = x.children?.find(y => y.path == sessionStorage.getItem('currentUrl'))
if (children?.show && path404check == '/404page') {
path404check = children.path || '/404page'
}
})
if (path404check == '/404page') {
this.menuItems.forEach(x => {
if (x.show && path404check == '/404page') {
x.children?.forEach(y => {
if (y.show) {
path404check = y.path || '404page'
}
})
}
})
}
this.router.navigate([path404check]); this.router.navigate([path404check]);
this.configPermission.loading = false this.configPermission.loading = false
this.cdr.detectChanges() this.cdr.detectChanges()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment