2025-11-28 20:39:48 +07:00
|
|
|
import { Component, Input, OnInit } from '@angular/core';
|
2025-11-17 17:19:18 +07:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-sidebar',
|
|
|
|
|
standalone: false,
|
|
|
|
|
templateUrl: './sidebar.component.html',
|
2025-11-28 20:39:48 +07:00
|
|
|
styleUrls: ['./sidebar.component.css']
|
2025-11-17 17:19:18 +07:00
|
|
|
})
|
|
|
|
|
export class SidebarComponent implements OnInit {
|
2025-11-28 20:39:48 +07:00
|
|
|
@Input() isCollapsed: boolean = false; // รับค่าสถานะย่อ/ขยาย
|
2025-11-17 17:19:18 +07:00
|
|
|
|
2025-11-28 20:39:48 +07:00
|
|
|
userData: any = {
|
|
|
|
|
name: 'Nuttakit',
|
|
|
|
|
role: 'Admin',
|
|
|
|
|
avatar: ''
|
|
|
|
|
};
|
2025-11-17 17:19:18 +07:00
|
|
|
|
2025-11-28 20:39:48 +07:00
|
|
|
constructor(private router: Router) { }
|
2025-11-17 17:19:18 +07:00
|
|
|
|
2025-11-28 20:39:48 +07:00
|
|
|
ngOnInit(): void {
|
|
|
|
|
// โหลด User Data ถ้ามี
|
2025-11-17 17:19:18 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logout() {
|
2025-11-28 20:39:48 +07:00
|
|
|
localStorage.removeItem('access_token');
|
|
|
|
|
this.router.navigate(['/login']);
|
2025-11-17 17:19:18 +07:00
|
|
|
}
|
|
|
|
|
}
|