feat: 회사 관리 기능 개선 및 지점 평면화 DTO 추가

- CompanyBranchFlatDto 모델 추가로 지점 데이터 처리 개선
- 회사 서비스에 브랜치 평면화 기능 추가
- 회사 폼 컨트롤러 기능 확장
- 회사 리스트 화면 UI 개선

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
JiWoong Sul
2025-08-09 02:16:57 +09:00
parent 8302ff37cc
commit f8e8a95391
9 changed files with 682 additions and 208 deletions

View File

@@ -28,6 +28,7 @@ import 'package:superport/services/mock_data_service.dart';
import 'dart:async';
import 'dart:math' as math;
import 'package:superport/screens/company/controllers/branch_form_controller.dart';
import 'package:superport/core/config/environment.dart' as env;
/// 회사 유형 선택 위젯 (체크박스)
class CompanyTypeSelector extends StatelessWidget {
@@ -107,10 +108,36 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
companyId = args['companyId'];
branchId = args['branchId'];
}
// API 모드 확인
final useApi = env.Environment.useApi;
debugPrint('📌 회사 폼 초기화 - API 모드: $useApi, companyId: $companyId');
_controller = CompanyFormController(
dataService: MockDataService(),
dataService: useApi ? null : MockDataService(),
companyId: companyId,
useApi: useApi,
);
// 일반 회사 수정 모드일 때 데이터 로드
if (!isBranch && companyId != null) {
debugPrint('📌 회사 데이터 로드 시작...');
WidgetsBinding.instance.addPostFrameCallback((_) {
_controller.loadCompanyData().then((_) {
debugPrint('📌 회사 데이터 로드 완료, UI 갱신');
if (mounted) {
setState(() {
debugPrint('📌 setState 호출됨');
debugPrint('📌 nameController.text: "${_controller.nameController.text}"');
debugPrint('📌 contactNameController.text: "${_controller.contactNameController.text}"');
});
}
}).catchError((error) {
debugPrint('❌ 회사 데이터 로드 실패: $error');
});
});
}
// 지점 수정 모드일 때 branchId로 branch 정보 세팅
if (isBranch && branchId != null) {
final company = MockDataService().getCompanyById(companyId!);
@@ -471,7 +498,7 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
),
),
],
// 저장 버튼
// 저장 버튼 추가
Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 16.0),
child: ElevatedButton(
@@ -488,6 +515,7 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),