feat: 회사 관리 API 연동 구현

- CompanyService 및 RemoteDataSource 구현
- Company, Branch DTO 모델 생성 (Freezed)
- 의존성 주입 컨테이너 업데이트
- 회사 등록/수정 폼에 API 연동 로직 적용
- API 통합 계획 문서 업데이트
This commit is contained in:
JiWoong Sul
2025-07-24 17:56:06 +09:00
parent 47bfa3a26a
commit 6b31631cfb
16 changed files with 4171 additions and 85 deletions

View File

@@ -200,14 +200,41 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
}
// 회사 저장
void _saveCompany() {
Future<void> _saveCompany() async {
final duplicateCompany = _controller.checkDuplicateCompany();
if (duplicateCompany != null) {
DuplicateCompanyDialog.show(context, duplicateCompany);
return;
}
if (_controller.saveCompany()) {
Navigator.pop(context, true);
// 로딩 표시
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => const Center(
child: CircularProgressIndicator(),
),
);
try {
final success = await _controller.saveCompany();
if (mounted) {
Navigator.pop(context); // 로딩 다이얼로그 닫기
if (success) {
Navigator.pop(context, true);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('회사 저장에 실패했습니다.')),
);
}
}
} catch (e) {
if (mounted) {
Navigator.pop(context); // 로딩 다이얼로그 닫기
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('오류가 발생했습니다: $e')),
);
}
}
}

View File

@@ -533,9 +533,8 @@ class EquipmentOutFormController extends ChangeNotifier {
} else {
onError('출고 정보를 찾을 수 없습니다');
}
}
} else {
if (selectedEquipments != null && selectedEquipments!.isNotEmpty) {
} else {
if (selectedEquipments != null && selectedEquipments!.isNotEmpty) {
// 여러 회사에 각각 출고 처리
List<String> successCompanies = [];
@@ -591,7 +590,7 @@ class EquipmentOutFormController extends ChangeNotifier {
} else {
onSuccess('${successCompanies.join(", ")} 회사로 다중 장비 출고 처리 완료');
}
} else if (selectedEquipmentInId != null) {
} else if (selectedEquipmentInId != null) {
final equipment = Equipment(
manufacturer: manufacturer,
name: name,
@@ -722,7 +721,6 @@ class EquipmentOutFormController extends ChangeNotifier {
onSuccess('${successCompanies.join(", ")} 회사로 새 출고 장비 추가 완료');
}
}
}
} on Failure catch (e) {
_error = e.message;
onError(e.message);