Commit 8874d017 by Nattana Chaiyamat

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

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