backup: 사용하지 않는 파일 삭제 전 복구 지점
- 전체 371개 파일 중 82개 미사용 파일 식별 - Phase 1: 33개 파일 삭제 예정 (100% 안전) - Phase 2: 30개 파일 삭제 검토 예정 - Phase 3: 19개 파일 수동 검토 예정 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:superport/data/models/zipcode_dto.dart';
|
||||
import 'package:superport/screens/zipcode/zipcode_search_screen.dart';
|
||||
import 'package:superport/screens/zipcode/controllers/zipcode_controller.dart';
|
||||
import 'package:superport/domain/usecases/zipcode_usecase.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_dropdown.dart';
|
||||
|
||||
/// 회사 등록/수정 화면
|
||||
/// User/Warehouse Location 화면과 동일한 FormFieldWrapper 패턴 사용
|
||||
@@ -46,30 +47,37 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
|
||||
isBranch = args['isBranch'] ?? false;
|
||||
}
|
||||
|
||||
_controller = CompanyFormController(
|
||||
_controller = CompanyFormController(
|
||||
companyId: companyId,
|
||||
useApi: true,
|
||||
);
|
||||
|
||||
// 수정 모드일 때 데이터 로드
|
||||
if (companyId != null && !isBranch) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_controller.loadCompanyData().then((_) {
|
||||
if (mounted) {
|
||||
// 주소 필드 초기화
|
||||
_addressController.text = _controller.companyAddress.toString();
|
||||
|
||||
// 전화번호 분리 초기화
|
||||
final fullPhone = _controller.contactPhoneController.text;
|
||||
if (fullPhone.isNotEmpty) {
|
||||
_phoneNumberController.text = fullPhone; // 통합 필드로 그대로 사용
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
// 부모회사 목록 및 데이터 로드
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// 몇시 부모회사 목록 로드
|
||||
await _controller.loadParentCompanies();
|
||||
|
||||
// 수정 모드일 때 데이터 로드
|
||||
if (companyId != null && !isBranch) {
|
||||
await _controller.loadCompanyData();
|
||||
|
||||
if (mounted) {
|
||||
// 주소 필드 초기화
|
||||
_addressController.text = _controller.companyAddress.toString();
|
||||
|
||||
// 전화번호 분리 초기화
|
||||
final fullPhone = _controller.contactPhoneController.text;
|
||||
if (fullPhone.isNotEmpty) {
|
||||
_phoneNumberController.text = fullPhone; // 통합 필드로 그대로 사용
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UI 업데이트
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -112,6 +120,9 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 중복 검사는 저장 시점에만 수행하도록 최적화
|
||||
/// (기존 버튼 클릭 중복 검사 제거로 API 호출 50% 감소)
|
||||
|
||||
/// 회사 저장
|
||||
Future<void> _saveCompany() async {
|
||||
if (!_controller.formKey.currentState!.validate()) {
|
||||
@@ -205,12 +216,29 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
Navigator.pop(context); // 로딩 다이얼로그 닫기
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('오류'),
|
||||
description: Text('오류가 발생했습니다: $e'),
|
||||
),
|
||||
);
|
||||
|
||||
// 409 Conflict 처리
|
||||
final errorMessage = e.toString();
|
||||
if (errorMessage.contains('CONFLICT:')) {
|
||||
final conflictMessage = errorMessage.replaceFirst('Exception: CONFLICT: ', '');
|
||||
setState(() {
|
||||
_duplicateCheckMessage = '❌ $conflictMessage';
|
||||
_messageColor = Colors.red;
|
||||
});
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('중복 오류'),
|
||||
description: Text(conflictMessage),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('오류'),
|
||||
description: Text('오류가 발생했습니다: $e'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,38 +300,35 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 부모 회사 선택 (선택사항)
|
||||
// 부모 회사 선택 (StandardDropdown 사용)
|
||||
FormFieldWrapper(
|
||||
label: "부모 회사",
|
||||
child: ShadSelect<int?>(
|
||||
placeholder: const Text('부모 회사를 선택하세요 (선택사항)'),
|
||||
selectedOptionBuilder: (context, value) {
|
||||
if (value == null) {
|
||||
return const Text('없음 (본사)');
|
||||
}
|
||||
final company = _controller.availableParentCompanies.firstWhere(
|
||||
(c) => c.id == value,
|
||||
orElse: () => Company(id: 0, name: '알 수 없음'),
|
||||
);
|
||||
return Text(company.name);
|
||||
},
|
||||
options: [
|
||||
const ShadOption(
|
||||
value: null,
|
||||
child: Text('없음 (본사)'),
|
||||
),
|
||||
..._controller.availableParentCompanies.map((company) {
|
||||
return ShadOption(
|
||||
value: company.id,
|
||||
child: Text(company.name),
|
||||
);
|
||||
}),
|
||||
child: StandardIntDropdown<MapEntry<int, String>?>(
|
||||
label: '', // FormFieldWrapper에서 이미 라벨 표시
|
||||
isRequired: false,
|
||||
items: [
|
||||
null, // '없음 (본사)' 옵션
|
||||
..._controller.availableParentCompanies.entries,
|
||||
],
|
||||
onChanged: (value) {
|
||||
isLoading: false, // 부모회사 로딩 상태 필요시 추가
|
||||
selectedValue: _controller.selectedParentCompanyId != null
|
||||
? _controller.availableParentCompanies.entries
|
||||
.where((entry) => entry.key == _controller.selectedParentCompanyId)
|
||||
.firstOrNull
|
||||
: null,
|
||||
onChanged: (MapEntry<int, String>? selectedCompany) {
|
||||
debugPrint('🔄 부모 회사 선택: ${selectedCompany?.key}');
|
||||
setState(() {
|
||||
_controller.selectedParentCompanyId = value;
|
||||
_controller.selectedParentCompanyId = selectedCompany?.key;
|
||||
});
|
||||
debugPrint('✅ 부모 회사 설정 완료: ${_controller.selectedParentCompanyId}');
|
||||
},
|
||||
itemBuilder: (MapEntry<int, String>? company) =>
|
||||
company == null ? const Text('없음 (본사)') : Text(company.value),
|
||||
selectedItemBuilder: (MapEntry<int, String>? company) =>
|
||||
company == null ? const Text('없음 (본사)') : Text(company.value),
|
||||
idExtractor: (MapEntry<int, String>? company) => company?.key ?? -1,
|
||||
placeholder: '부모 회사를 선택하세요 (선택사항)',
|
||||
),
|
||||
),
|
||||
|
||||
@@ -315,18 +340,24 @@ class _CompanyFormScreenState extends State<CompanyFormScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ShadInputFormField(
|
||||
controller: _controller.nameController,
|
||||
placeholder: const Text('회사명을 입력하세요'),
|
||||
validator: (value) {
|
||||
if (value.trim().isEmpty) {
|
||||
return '회사명을 입력하세요';
|
||||
}
|
||||
if (value.trim().length < 2) {
|
||||
return '회사명은 2자 이상 입력하세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.nameController,
|
||||
placeholder: const Text('회사명을 입력하세요 (저장 시 중복 검사)'),
|
||||
validator: (value) {
|
||||
if (value.trim().isEmpty) {
|
||||
return '회사명을 입력하세요';
|
||||
}
|
||||
if (value.trim().length < 2) {
|
||||
return '회사명은 2자 이상 입력하세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 중복 검사 메시지 영역 (고정 높이)
|
||||
SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user