feat: API 연동 개선 및 라이선스 모델 확장

- 라이선스 모델 전면 개편 (상세 필드 추가, 계산 필드 구현)
- API 응답 처리 개선 (HTTP 상태 코드 기반)
- 장비 출고 폼 컨트롤러 추가
- 회사 지점 정보 모델 추가
- 공통 데이터 모델 구조 추가
- 전체 서비스 레이어 API 호출 방식 통일
- UI 컴포넌트 마이너 개선
This commit is contained in:
JiWoong Sul
2025-07-25 01:22:15 +09:00
parent 8384423cf2
commit 71b7b7f40b
42 changed files with 1543 additions and 315 deletions

View File

@@ -24,11 +24,35 @@ class LicenseFormController extends ChangeNotifier {
int _durationMonths = 12; // 기본값: 12개월
String _visitCycle = '미방문'; // 기본값: 미방문
// isEditMode setter
set isEditMode(bool value) {
_isEditMode = value;
notifyListeners();
}
// name setter
set name(String value) {
_name = value;
notifyListeners();
}
// durationMonths setter
set durationMonths(int value) {
_durationMonths = value;
notifyListeners();
}
// visitCycle setter
set visitCycle(String value) {
_visitCycle = value;
notifyListeners();
}
LicenseFormController({
this.useApi = true,
this.mockDataService,
this.useApi = false,
MockDataService? dataService,
int? licenseId,
}) {
}) : mockDataService = dataService ?? MockDataService() {
if (useApi && GetIt.instance.isRegistered<LicenseService>()) {
_licenseService = GetIt.instance<LicenseService>();
}
@@ -89,10 +113,11 @@ class LicenseFormController extends ChangeNotifier {
}
if (_originalLicense != null) {
_name = _originalLicense!.name;
_companyId = _originalLicense!.companyId;
_durationMonths = _originalLicense!.durationMonths;
_visitCycle = _originalLicense!.visitCycle;
_name = _originalLicense!.productName ?? '';
_companyId = _originalLicense!.companyId ?? 1;
// durationMonths와 visitCycle은 License 모델에 없으므로 기본값 유지
// _durationMonths = _originalLicense!.durationMonths;
// _visitCycle = _originalLicense!.visitCycle;
}
} catch (e) {
_error = e.toString();
@@ -115,10 +140,14 @@ class LicenseFormController extends ChangeNotifier {
try {
final license = License(
id: _isEditMode ? _licenseId : null,
licenseKey: 'LIC-${DateTime.now().millisecondsSinceEpoch}',
productName: _name,
companyId: _companyId,
name: _name,
durationMonths: _durationMonths,
visitCycle: _visitCycle,
// durationMonths와 visitCycle은 License 모델에 없음
// 대신 expiryDate를 설정
purchaseDate: DateTime.now(),
expiryDate: DateTime.now().add(Duration(days: _durationMonths * 30)),
remark: '방문주기: $_visitCycle',
);
if (useApi && GetIt.instance.isRegistered<LicenseService>()) {