Files
superport/lib/screens/overview/controllers/overview_controller.dart
2025-07-02 17:45:44 +09:00

61 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:superport/services/mock_data_service.dart';
import 'package:superport/screens/common/theme_tailwind.dart';
// 대시보드(Overview) 화면의 상태 및 비즈니스 로직을 담당하는 컨트롤러
class OverviewController {
final MockDataService dataService;
int totalCompanies = 0;
int totalUsers = 0;
int totalEquipmentIn = 0;
int totalEquipmentOut = 0;
int totalLicenses = 0;
// 최근 활동 데이터
List<Map<String, dynamic>> recentActivities = [];
OverviewController({required this.dataService});
// 데이터 로드 및 통계 계산
void loadData() {
totalCompanies = dataService.getAllCompanies().length;
totalUsers = dataService.getAllUsers().length;
// 실제 서비스에서는 아래 메서드 구현 필요
totalEquipmentIn = 32; // 임시 데이터
totalEquipmentOut = 18; // 임시 데이터
totalLicenses = dataService.getAllLicenses().length;
_loadRecentActivities();
}
// 최근 활동 데이터 로드 (임시 데이터)
void _loadRecentActivities() {
recentActivities = [
{
'type': '장비 입고',
'title': '라우터 입고 처리 완료',
'time': '30분 전',
'user': '홍길동',
'icon': Icons.input,
'color': AppThemeTailwind.success,
},
{
'type': '사용자 추가',
'title': '새 관리자 등록',
'time': '1시간 전',
'user': '김철수',
'icon': Icons.person_add,
'color': AppThemeTailwind.primary,
},
{
'type': '장비 출고',
'title': '모니터 5대 출고 처리',
'time': '2시간 전',
'user': '이영희',
'icon': Icons.output,
'color': AppThemeTailwind.warning,
},
];
}
}