feat: 라이선스 관리 기능 개선 및 폼 검증 강화

- LicenseDto 모델 업데이트
- 라이선스 폼 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:17:30 +09:00
parent cddde57450
commit ef059d50ea
6 changed files with 525 additions and 138 deletions

View File

@@ -25,6 +25,27 @@ DateTime? _dateFromJson(String? dateStr) {
}
}
// 문자열이나 숫자를 double로 변환하는 헬퍼 함수
double? _priceFromJson(dynamic value) {
if (value == null) return null;
if (value is double) return value;
if (value is int) return value.toDouble();
if (value is String) {
try {
return double.parse(value);
} catch (e) {
return null;
}
}
return null;
}
// double을 문자열로 변환하는 헬퍼 함수
String? _priceToJson(double? value) {
if (value == null) return null;
return value.toStringAsFixed(2);
}
// 필수 날짜 필드용 헬퍼 함수 (항상 non-null DateTime 반환)
DateTime _requiredDateFromJson(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return DateTime.now();
@@ -53,7 +74,7 @@ class LicenseDto with _$LicenseDto {
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? purchaseDate,
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'purchase_price', toJson: _priceToJson, fromJson: _priceFromJson) double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'assigned_user_id') int? assignedUserId,