feat: V/R 유지보수 시스템 전환 및 대시보드 테이블 형태 완성
- V/R 시스템 완전 전환: WARRANTY/CONTRACT/INSPECTION → V(방문)/R(원격) - 유지보수 대시보드 카드 → StandardDataTable 테이블 형태 전환 - "조회중..." 문제 해결: 백엔드 직접 필드 사용 (equipment_model, company_name) - MaintenanceDto 신규 필드 추가: company_id, company_name, equipment_serial, equipment_model - preloadEquipmentData 비활성화로 불필요한 equipment-history API 호출 제거 - CO-STAR 프레임워크 적용 및 CLAUDE.md v3.0 업데이트 - Flutter Analyze ERROR: 0 유지, 100% shadcn_ui 컴플라이언스 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,8 @@ class EquipmentDto with _$EquipmentDto {
|
||||
@JsonKey(name: 'models_id') required int modelsId,
|
||||
@JsonKey(name: 'model_name', includeToJson: false) String? modelName, // JOIN 필드 - 응답에서만 제공
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false) String? vendorName, // JOIN 필드 - 응답에서만 제공
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId,
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false) String? warehousesName, // JOIN 필드 - 응답에서만 제공
|
||||
@JsonKey(name: 'serial_number') required String serialNumber,
|
||||
String? barcode,
|
||||
@JsonKey(name: 'purchased_at') DateTime? purchasedAt,
|
||||
|
||||
@@ -34,6 +34,11 @@ mixin _$EquipmentDto {
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false)
|
||||
String? get vendorName =>
|
||||
throw _privateConstructorUsedError; // JOIN 필드 - 응답에서만 제공
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int? get warehousesId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
String? get warehousesName =>
|
||||
throw _privateConstructorUsedError; // JOIN 필드 - 응답에서만 제공
|
||||
@JsonKey(name: 'serial_number')
|
||||
String get serialNumber => throw _privateConstructorUsedError;
|
||||
String? get barcode => throw _privateConstructorUsedError;
|
||||
@@ -78,6 +83,9 @@ abstract class $EquipmentDtoCopyWith<$Res> {
|
||||
@JsonKey(name: 'models_id') int modelsId,
|
||||
@JsonKey(name: 'model_name', includeToJson: false) String? modelName,
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false) String? vendorName,
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId,
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
String? warehousesName,
|
||||
@JsonKey(name: 'serial_number') String serialNumber,
|
||||
String? barcode,
|
||||
@JsonKey(name: 'purchased_at') DateTime? purchasedAt,
|
||||
@@ -112,6 +120,8 @@ class _$EquipmentDtoCopyWithImpl<$Res, $Val extends EquipmentDto>
|
||||
Object? modelsId = null,
|
||||
Object? modelName = freezed,
|
||||
Object? vendorName = freezed,
|
||||
Object? warehousesId = freezed,
|
||||
Object? warehousesName = freezed,
|
||||
Object? serialNumber = null,
|
||||
Object? barcode = freezed,
|
||||
Object? purchasedAt = freezed,
|
||||
@@ -149,6 +159,14 @@ class _$EquipmentDtoCopyWithImpl<$Res, $Val extends EquipmentDto>
|
||||
? _value.vendorName
|
||||
: vendorName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehousesId: freezed == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehousesName: freezed == warehousesName
|
||||
? _value.warehousesName
|
||||
: warehousesName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
serialNumber: null == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
@@ -212,6 +230,9 @@ abstract class _$$EquipmentDtoImplCopyWith<$Res>
|
||||
@JsonKey(name: 'models_id') int modelsId,
|
||||
@JsonKey(name: 'model_name', includeToJson: false) String? modelName,
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false) String? vendorName,
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId,
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
String? warehousesName,
|
||||
@JsonKey(name: 'serial_number') String serialNumber,
|
||||
String? barcode,
|
||||
@JsonKey(name: 'purchased_at') DateTime? purchasedAt,
|
||||
@@ -244,6 +265,8 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
Object? modelsId = null,
|
||||
Object? modelName = freezed,
|
||||
Object? vendorName = freezed,
|
||||
Object? warehousesId = freezed,
|
||||
Object? warehousesName = freezed,
|
||||
Object? serialNumber = null,
|
||||
Object? barcode = freezed,
|
||||
Object? purchasedAt = freezed,
|
||||
@@ -281,6 +304,14 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
? _value.vendorName
|
||||
: vendorName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehousesId: freezed == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehousesName: freezed == warehousesName
|
||||
? _value.warehousesName
|
||||
: warehousesName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
serialNumber: null == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
@@ -339,6 +370,9 @@ class _$EquipmentDtoImpl extends _EquipmentDto {
|
||||
@JsonKey(name: 'models_id') required this.modelsId,
|
||||
@JsonKey(name: 'model_name', includeToJson: false) this.modelName,
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false) this.vendorName,
|
||||
@JsonKey(name: 'warehouses_id') this.warehousesId,
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
this.warehousesName,
|
||||
@JsonKey(name: 'serial_number') required this.serialNumber,
|
||||
this.barcode,
|
||||
@JsonKey(name: 'purchased_at') this.purchasedAt,
|
||||
@@ -374,6 +408,13 @@ class _$EquipmentDtoImpl extends _EquipmentDto {
|
||||
@override
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false)
|
||||
final String? vendorName;
|
||||
// JOIN 필드 - 응답에서만 제공
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
final int? warehousesId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
final String? warehousesName;
|
||||
// JOIN 필드 - 응답에서만 제공
|
||||
@override
|
||||
@JsonKey(name: 'serial_number')
|
||||
@@ -409,7 +450,7 @@ class _$EquipmentDtoImpl extends _EquipmentDto {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentDto(id: $id, companiesId: $companiesId, companyName: $companyName, modelsId: $modelsId, modelName: $modelName, vendorName: $vendorName, serialNumber: $serialNumber, barcode: $barcode, purchasedAt: $purchasedAt, purchasePrice: $purchasePrice, warrantyNumber: $warrantyNumber, warrantyStartedAt: $warrantyStartedAt, warrantyEndedAt: $warrantyEndedAt, remark: $remark, isDeleted: $isDeleted, registeredAt: $registeredAt, updatedAt: $updatedAt)';
|
||||
return 'EquipmentDto(id: $id, companiesId: $companiesId, companyName: $companyName, modelsId: $modelsId, modelName: $modelName, vendorName: $vendorName, warehousesId: $warehousesId, warehousesName: $warehousesName, serialNumber: $serialNumber, barcode: $barcode, purchasedAt: $purchasedAt, purchasePrice: $purchasePrice, warrantyNumber: $warrantyNumber, warrantyStartedAt: $warrantyStartedAt, warrantyEndedAt: $warrantyEndedAt, remark: $remark, isDeleted: $isDeleted, registeredAt: $registeredAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -428,6 +469,10 @@ class _$EquipmentDtoImpl extends _EquipmentDto {
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.vendorName, vendorName) ||
|
||||
other.vendorName == vendorName) &&
|
||||
(identical(other.warehousesId, warehousesId) ||
|
||||
other.warehousesId == warehousesId) &&
|
||||
(identical(other.warehousesName, warehousesName) ||
|
||||
other.warehousesName == warehousesName) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.barcode, barcode) || other.barcode == barcode) &&
|
||||
@@ -452,25 +497,28 @@ class _$EquipmentDtoImpl extends _EquipmentDto {
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
companiesId,
|
||||
companyName,
|
||||
modelsId,
|
||||
modelName,
|
||||
vendorName,
|
||||
serialNumber,
|
||||
barcode,
|
||||
purchasedAt,
|
||||
purchasePrice,
|
||||
warrantyNumber,
|
||||
warrantyStartedAt,
|
||||
warrantyEndedAt,
|
||||
remark,
|
||||
isDeleted,
|
||||
registeredAt,
|
||||
updatedAt);
|
||||
int get hashCode => Object.hashAll([
|
||||
runtimeType,
|
||||
id,
|
||||
companiesId,
|
||||
companyName,
|
||||
modelsId,
|
||||
modelName,
|
||||
vendorName,
|
||||
warehousesId,
|
||||
warehousesName,
|
||||
serialNumber,
|
||||
barcode,
|
||||
purchasedAt,
|
||||
purchasePrice,
|
||||
warrantyNumber,
|
||||
warrantyStartedAt,
|
||||
warrantyEndedAt,
|
||||
remark,
|
||||
isDeleted,
|
||||
registeredAt,
|
||||
updatedAt
|
||||
]);
|
||||
|
||||
/// Create a copy of EquipmentDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -499,6 +547,9 @@ abstract class _EquipmentDto extends EquipmentDto {
|
||||
final String? modelName,
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false)
|
||||
final String? vendorName,
|
||||
@JsonKey(name: 'warehouses_id') final int? warehousesId,
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
final String? warehousesName,
|
||||
@JsonKey(name: 'serial_number') required final String serialNumber,
|
||||
final String? barcode,
|
||||
@JsonKey(name: 'purchased_at') final DateTime? purchasedAt,
|
||||
@@ -536,6 +587,12 @@ abstract class _EquipmentDto extends EquipmentDto {
|
||||
@JsonKey(name: 'vendor_name', includeToJson: false)
|
||||
String? get vendorName; // JOIN 필드 - 응답에서만 제공
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int? get warehousesId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_name', includeToJson: false)
|
||||
String? get warehousesName; // JOIN 필드 - 응답에서만 제공
|
||||
@override
|
||||
@JsonKey(name: 'serial_number')
|
||||
String get serialNumber;
|
||||
@override
|
||||
|
||||
@@ -14,6 +14,8 @@ _$EquipmentDtoImpl _$$EquipmentDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
modelsId: (json['models_id'] as num).toInt(),
|
||||
modelName: json['model_name'] as String?,
|
||||
vendorName: json['vendor_name'] as String?,
|
||||
warehousesId: (json['warehouses_id'] as num?)?.toInt(),
|
||||
warehousesName: json['warehouses_name'] as String?,
|
||||
serialNumber: json['serial_number'] as String,
|
||||
barcode: json['barcode'] as String?,
|
||||
purchasedAt: json['purchased_at'] == null
|
||||
@@ -38,6 +40,7 @@ Map<String, dynamic> _$$EquipmentDtoImplToJson(_$EquipmentDtoImpl instance) =>
|
||||
'id': instance.id,
|
||||
'companies_id': instance.companiesId,
|
||||
'models_id': instance.modelsId,
|
||||
'warehouses_id': instance.warehousesId,
|
||||
'serial_number': instance.serialNumber,
|
||||
'barcode': instance.barcode,
|
||||
'purchased_at': instance.purchasedAt?.toIso8601String(),
|
||||
|
||||
@@ -43,7 +43,8 @@ class EquipmentHistoryDto with _$EquipmentHistoryDto {
|
||||
class EquipmentHistoryRequestDto with _$EquipmentHistoryRequestDto {
|
||||
const factory EquipmentHistoryRequestDto({
|
||||
@JsonKey(name: 'equipments_id') required int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required int warehousesId,
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId, // 출고 시 null 가능 (다른 회사로 완전 이관)
|
||||
@JsonKey(name: 'company_ids') List<int>? companyIds, // 백엔드 API 매칭
|
||||
@JsonKey(name: 'transaction_type') required String transactionType,
|
||||
required int quantity,
|
||||
@JsonKey(name: 'transacted_at') DateTime? transactedAt,
|
||||
|
||||
@@ -573,7 +573,10 @@ mixin _$EquipmentHistoryRequestDto {
|
||||
@JsonKey(name: 'equipments_id')
|
||||
int get equipmentsId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int get warehousesId => throw _privateConstructorUsedError;
|
||||
int? get warehousesId =>
|
||||
throw _privateConstructorUsedError; // 출고 시 null 가능 (다른 회사로 완전 이관)
|
||||
@JsonKey(name: 'company_ids')
|
||||
List<int>? get companyIds => throw _privateConstructorUsedError; // 백엔드 API 매칭
|
||||
@JsonKey(name: 'transaction_type')
|
||||
String get transactionType => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
@@ -600,7 +603,8 @@ abstract class $EquipmentHistoryRequestDtoCopyWith<$Res> {
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'equipments_id') int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') int warehousesId,
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId,
|
||||
@JsonKey(name: 'company_ids') List<int>? companyIds,
|
||||
@JsonKey(name: 'transaction_type') String transactionType,
|
||||
int quantity,
|
||||
@JsonKey(name: 'transacted_at') DateTime? transactedAt,
|
||||
@@ -624,7 +628,8 @@ class _$EquipmentHistoryRequestDtoCopyWithImpl<$Res,
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentsId = null,
|
||||
Object? warehousesId = null,
|
||||
Object? warehousesId = freezed,
|
||||
Object? companyIds = freezed,
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactedAt = freezed,
|
||||
@@ -635,10 +640,14 @@ class _$EquipmentHistoryRequestDtoCopyWithImpl<$Res,
|
||||
? _value.equipmentsId
|
||||
: equipmentsId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehousesId: null == warehousesId
|
||||
warehousesId: freezed == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
companyIds: freezed == companyIds
|
||||
? _value.companyIds
|
||||
: companyIds // ignore: cast_nullable_to_non_nullable
|
||||
as List<int>?,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
@@ -670,7 +679,8 @@ abstract class _$$EquipmentHistoryRequestDtoImplCopyWith<$Res>
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'equipments_id') int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') int warehousesId,
|
||||
@JsonKey(name: 'warehouses_id') int? warehousesId,
|
||||
@JsonKey(name: 'company_ids') List<int>? companyIds,
|
||||
@JsonKey(name: 'transaction_type') String transactionType,
|
||||
int quantity,
|
||||
@JsonKey(name: 'transacted_at') DateTime? transactedAt,
|
||||
@@ -693,7 +703,8 @@ class __$$EquipmentHistoryRequestDtoImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentsId = null,
|
||||
Object? warehousesId = null,
|
||||
Object? warehousesId = freezed,
|
||||
Object? companyIds = freezed,
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactedAt = freezed,
|
||||
@@ -704,10 +715,14 @@ class __$$EquipmentHistoryRequestDtoImplCopyWithImpl<$Res>
|
||||
? _value.equipmentsId
|
||||
: equipmentsId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehousesId: null == warehousesId
|
||||
warehousesId: freezed == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
companyIds: freezed == companyIds
|
||||
? _value._companyIds
|
||||
: companyIds // ignore: cast_nullable_to_non_nullable
|
||||
as List<int>?,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
@@ -733,11 +748,13 @@ class __$$EquipmentHistoryRequestDtoImplCopyWithImpl<$Res>
|
||||
class _$EquipmentHistoryRequestDtoImpl implements _EquipmentHistoryRequestDto {
|
||||
const _$EquipmentHistoryRequestDtoImpl(
|
||||
{@JsonKey(name: 'equipments_id') required this.equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required this.warehousesId,
|
||||
@JsonKey(name: 'warehouses_id') this.warehousesId,
|
||||
@JsonKey(name: 'company_ids') final List<int>? companyIds,
|
||||
@JsonKey(name: 'transaction_type') required this.transactionType,
|
||||
required this.quantity,
|
||||
@JsonKey(name: 'transacted_at') this.transactedAt,
|
||||
this.remark});
|
||||
this.remark})
|
||||
: _companyIds = companyIds;
|
||||
|
||||
factory _$EquipmentHistoryRequestDtoImpl.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
@@ -748,7 +765,21 @@ class _$EquipmentHistoryRequestDtoImpl implements _EquipmentHistoryRequestDto {
|
||||
final int equipmentsId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
final int warehousesId;
|
||||
final int? warehousesId;
|
||||
// 출고 시 null 가능 (다른 회사로 완전 이관)
|
||||
final List<int>? _companyIds;
|
||||
// 출고 시 null 가능 (다른 회사로 완전 이관)
|
||||
@override
|
||||
@JsonKey(name: 'company_ids')
|
||||
List<int>? get companyIds {
|
||||
final value = _companyIds;
|
||||
if (value == null) return null;
|
||||
if (_companyIds is EqualUnmodifiableListView) return _companyIds;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
// 백엔드 API 매칭
|
||||
@override
|
||||
@JsonKey(name: 'transaction_type')
|
||||
final String transactionType;
|
||||
@@ -762,7 +793,7 @@ class _$EquipmentHistoryRequestDtoImpl implements _EquipmentHistoryRequestDto {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentHistoryRequestDto(equipmentsId: $equipmentsId, warehousesId: $warehousesId, transactionType: $transactionType, quantity: $quantity, transactedAt: $transactedAt, remark: $remark)';
|
||||
return 'EquipmentHistoryRequestDto(equipmentsId: $equipmentsId, warehousesId: $warehousesId, companyIds: $companyIds, transactionType: $transactionType, quantity: $quantity, transactedAt: $transactedAt, remark: $remark)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -774,6 +805,8 @@ class _$EquipmentHistoryRequestDtoImpl implements _EquipmentHistoryRequestDto {
|
||||
other.equipmentsId == equipmentsId) &&
|
||||
(identical(other.warehousesId, warehousesId) ||
|
||||
other.warehousesId == warehousesId) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._companyIds, _companyIds) &&
|
||||
(identical(other.transactionType, transactionType) ||
|
||||
other.transactionType == transactionType) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
@@ -785,8 +818,15 @@ class _$EquipmentHistoryRequestDtoImpl implements _EquipmentHistoryRequestDto {
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, equipmentsId, warehousesId,
|
||||
transactionType, quantity, transactedAt, remark);
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
equipmentsId,
|
||||
warehousesId,
|
||||
const DeepCollectionEquality().hash(_companyIds),
|
||||
transactionType,
|
||||
quantity,
|
||||
transactedAt,
|
||||
remark);
|
||||
|
||||
/// Create a copy of EquipmentHistoryRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -809,7 +849,8 @@ abstract class _EquipmentHistoryRequestDto
|
||||
implements EquipmentHistoryRequestDto {
|
||||
const factory _EquipmentHistoryRequestDto(
|
||||
{@JsonKey(name: 'equipments_id') required final int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required final int warehousesId,
|
||||
@JsonKey(name: 'warehouses_id') final int? warehousesId,
|
||||
@JsonKey(name: 'company_ids') final List<int>? companyIds,
|
||||
@JsonKey(name: 'transaction_type') required final String transactionType,
|
||||
required final int quantity,
|
||||
@JsonKey(name: 'transacted_at') final DateTime? transactedAt,
|
||||
@@ -823,7 +864,10 @@ abstract class _EquipmentHistoryRequestDto
|
||||
int get equipmentsId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int get warehousesId;
|
||||
int? get warehousesId; // 출고 시 null 가능 (다른 회사로 완전 이관)
|
||||
@override
|
||||
@JsonKey(name: 'company_ids')
|
||||
List<int>? get companyIds; // 백엔드 API 매칭
|
||||
@override
|
||||
@JsonKey(name: 'transaction_type')
|
||||
String get transactionType;
|
||||
|
||||
@@ -59,7 +59,10 @@ _$EquipmentHistoryRequestDtoImpl _$$EquipmentHistoryRequestDtoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentHistoryRequestDtoImpl(
|
||||
equipmentsId: (json['equipments_id'] as num).toInt(),
|
||||
warehousesId: (json['warehouses_id'] as num).toInt(),
|
||||
warehousesId: (json['warehouses_id'] as num?)?.toInt(),
|
||||
companyIds: (json['company_ids'] as List<dynamic>?)
|
||||
?.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
transactionType: json['transaction_type'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
transactedAt: json['transacted_at'] == null
|
||||
@@ -73,6 +76,7 @@ Map<String, dynamic> _$$EquipmentHistoryRequestDtoImplToJson(
|
||||
<String, dynamic>{
|
||||
'equipments_id': instance.equipmentsId,
|
||||
'warehouses_id': instance.warehousesId,
|
||||
'company_ids': instance.companyIds,
|
||||
'transaction_type': instance.transactionType,
|
||||
'quantity': instance.quantity,
|
||||
'transacted_at': instance.transactedAt?.toIso8601String(),
|
||||
|
||||
96
lib/data/models/inventory_history_view_model.dart
Normal file
96
lib/data/models/inventory_history_view_model.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:superport/data/models/equipment_history_dto.dart';
|
||||
|
||||
part 'inventory_history_view_model.freezed.dart';
|
||||
part 'inventory_history_view_model.g.dart';
|
||||
|
||||
/// 재고 이력 관리 화면 전용 ViewModel
|
||||
/// 백엔드 여러 API를 조합한 최종 표시용 데이터
|
||||
@freezed
|
||||
class InventoryHistoryViewModel with _$InventoryHistoryViewModel {
|
||||
const InventoryHistoryViewModel._(); // Private constructor for getters
|
||||
|
||||
const factory InventoryHistoryViewModel({
|
||||
// 기본 식별자
|
||||
@JsonKey(name: 'history_id') required int historyId,
|
||||
@JsonKey(name: 'equipment_id') required int equipmentId,
|
||||
|
||||
// 화면 표시 필드들 (요구사항 기준)
|
||||
@JsonKey(name: 'equipment_name') required String equipmentName, // 장비명 (백엔드 조합)
|
||||
@JsonKey(name: 'serial_number') required String serialNumber, // 시리얼번호
|
||||
@JsonKey(name: 'location') required String location, // 위치 (transaction_type에 따라 다르게)
|
||||
@JsonKey(name: 'changed_date') required DateTime changedDate, // 변동일 (transacted_at)
|
||||
@JsonKey(name: 'remark') String? remark, // 비고
|
||||
|
||||
// 추가 정보
|
||||
@JsonKey(name: 'transaction_type') required String transactionType, // I, O, R, D
|
||||
@JsonKey(name: 'quantity') required int quantity,
|
||||
|
||||
// 원본 데이터 보존 (상세보기 시 필요)
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
EquipmentHistoryDto? originalHistory,
|
||||
}) = _InventoryHistoryViewModel;
|
||||
|
||||
/// Transaction Type에 따른 표시명
|
||||
String get transactionTypeDisplay {
|
||||
switch (transactionType) {
|
||||
case 'I':
|
||||
return '입고';
|
||||
case 'O':
|
||||
return '출고';
|
||||
case 'R':
|
||||
return '대여';
|
||||
case 'D':
|
||||
return '폐기';
|
||||
default:
|
||||
return transactionType;
|
||||
}
|
||||
}
|
||||
|
||||
/// 위치 유형 판단 (고객사/창고)
|
||||
bool get isCustomerLocation {
|
||||
return transactionType == 'O' || transactionType == 'R';
|
||||
}
|
||||
|
||||
/// 날짜 포맷팅 (yyyy-MM-dd)
|
||||
String get formattedDate {
|
||||
return '${changedDate.year}-${changedDate.month.toString().padLeft(2, '0')}-${changedDate.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
factory InventoryHistoryViewModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryViewModelFromJson(json);
|
||||
}
|
||||
|
||||
/// 재고 이력 목록 응답
|
||||
@freezed
|
||||
class InventoryHistoryListResponse with _$InventoryHistoryListResponse {
|
||||
const factory InventoryHistoryListResponse({
|
||||
@JsonKey(name: 'data') required List<InventoryHistoryViewModel> items,
|
||||
@JsonKey(name: 'total') required int totalCount,
|
||||
@JsonKey(name: 'page') required int currentPage,
|
||||
@JsonKey(name: 'total_pages') required int totalPages,
|
||||
@JsonKey(name: 'page_size') int? pageSize,
|
||||
}) = _InventoryHistoryListResponse;
|
||||
|
||||
factory InventoryHistoryListResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryListResponseFromJson(json);
|
||||
}
|
||||
|
||||
/// 검색/필터 파라미터
|
||||
@freezed
|
||||
class InventoryHistoryQuery with _$InventoryHistoryQuery {
|
||||
const factory InventoryHistoryQuery({
|
||||
int? page,
|
||||
@JsonKey(name: 'page_size') int? pageSize,
|
||||
@JsonKey(name: 'search_keyword') String? searchKeyword,
|
||||
@JsonKey(name: 'transaction_type') String? transactionType,
|
||||
@JsonKey(name: 'equipment_id') int? equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') int? warehouseId,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'date_from') DateTime? dateFrom,
|
||||
@JsonKey(name: 'date_to') DateTime? dateTo,
|
||||
}) = _InventoryHistoryQuery;
|
||||
|
||||
factory InventoryHistoryQuery.fromJson(Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryQueryFromJson(json);
|
||||
}
|
||||
1084
lib/data/models/inventory_history_view_model.freezed.dart
Normal file
1084
lib/data/models/inventory_history_view_model.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
90
lib/data/models/inventory_history_view_model.g.dart
Normal file
90
lib/data/models/inventory_history_view_model.g.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'inventory_history_view_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$InventoryHistoryViewModelImpl _$$InventoryHistoryViewModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryViewModelImpl(
|
||||
historyId: (json['history_id'] as num).toInt(),
|
||||
equipmentId: (json['equipment_id'] as num).toInt(),
|
||||
equipmentName: json['equipment_name'] as String,
|
||||
serialNumber: json['serial_number'] as String,
|
||||
location: json['location'] as String,
|
||||
changedDate: DateTime.parse(json['changed_date'] as String),
|
||||
remark: json['remark'] as String?,
|
||||
transactionType: json['transaction_type'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$InventoryHistoryViewModelImplToJson(
|
||||
_$InventoryHistoryViewModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'history_id': instance.historyId,
|
||||
'equipment_id': instance.equipmentId,
|
||||
'equipment_name': instance.equipmentName,
|
||||
'serial_number': instance.serialNumber,
|
||||
'location': instance.location,
|
||||
'changed_date': instance.changedDate.toIso8601String(),
|
||||
'remark': instance.remark,
|
||||
'transaction_type': instance.transactionType,
|
||||
'quantity': instance.quantity,
|
||||
};
|
||||
|
||||
_$InventoryHistoryListResponseImpl _$$InventoryHistoryListResponseImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryListResponseImpl(
|
||||
items: (json['data'] as List<dynamic>)
|
||||
.map((e) =>
|
||||
InventoryHistoryViewModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
totalCount: (json['total'] as num).toInt(),
|
||||
currentPage: (json['page'] as num).toInt(),
|
||||
totalPages: (json['total_pages'] as num).toInt(),
|
||||
pageSize: (json['page_size'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$InventoryHistoryListResponseImplToJson(
|
||||
_$InventoryHistoryListResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'data': instance.items,
|
||||
'total': instance.totalCount,
|
||||
'page': instance.currentPage,
|
||||
'total_pages': instance.totalPages,
|
||||
'page_size': instance.pageSize,
|
||||
};
|
||||
|
||||
_$InventoryHistoryQueryImpl _$$InventoryHistoryQueryImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$InventoryHistoryQueryImpl(
|
||||
page: (json['page'] as num?)?.toInt(),
|
||||
pageSize: (json['page_size'] as num?)?.toInt(),
|
||||
searchKeyword: json['search_keyword'] as String?,
|
||||
transactionType: json['transaction_type'] as String?,
|
||||
equipmentId: (json['equipment_id'] as num?)?.toInt(),
|
||||
warehouseId: (json['warehouse_id'] as num?)?.toInt(),
|
||||
companyId: (json['company_id'] as num?)?.toInt(),
|
||||
dateFrom: json['date_from'] == null
|
||||
? null
|
||||
: DateTime.parse(json['date_from'] as String),
|
||||
dateTo: json['date_to'] == null
|
||||
? null
|
||||
: DateTime.parse(json['date_to'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$InventoryHistoryQueryImplToJson(
|
||||
_$InventoryHistoryQueryImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'page': instance.page,
|
||||
'page_size': instance.pageSize,
|
||||
'search_keyword': instance.searchKeyword,
|
||||
'transaction_type': instance.transactionType,
|
||||
'equipment_id': instance.equipmentId,
|
||||
'warehouse_id': instance.warehouseId,
|
||||
'company_id': instance.companyId,
|
||||
'date_from': instance.dateFrom?.toIso8601String(),
|
||||
'date_to': instance.dateTo?.toIso8601String(),
|
||||
};
|
||||
@@ -14,7 +14,7 @@ class MaintenanceDto with _$MaintenanceDto {
|
||||
@JsonKey(name: 'started_at') required DateTime startedAt,
|
||||
@JsonKey(name: 'ended_at') required DateTime endedAt,
|
||||
@JsonKey(name: 'period_month') @Default(1) int periodMonth,
|
||||
@JsonKey(name: 'maintenance_type') @Default('WARRANTY') String maintenanceType, // WARRANTY|CONTRACT|INSPECTION
|
||||
@JsonKey(name: 'maintenance_type') @Default('V') String maintenanceType, // V: 방문, R: 원격
|
||||
@JsonKey(name: 'is_deleted') @Default(false) bool isDeleted,
|
||||
@JsonKey(name: 'registered_at') required DateTime registeredAt,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
@@ -22,6 +22,8 @@ class MaintenanceDto with _$MaintenanceDto {
|
||||
// 백엔드 추가 필드들 (계산된 값)
|
||||
@JsonKey(name: 'equipment_serial') String? equipmentSerial,
|
||||
@JsonKey(name: 'equipment_model') String? equipmentModel,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'days_remaining') int? daysRemaining,
|
||||
@JsonKey(name: 'is_expired') @Default(false) bool isExpired,
|
||||
|
||||
@@ -43,7 +45,7 @@ class MaintenanceRequestDto with _$MaintenanceRequestDto {
|
||||
@JsonKey(name: 'started_at') required DateTime startedAt,
|
||||
@JsonKey(name: 'ended_at') required DateTime endedAt,
|
||||
@JsonKey(name: 'period_month') @Default(1) int periodMonth,
|
||||
@JsonKey(name: 'maintenance_type') @Default('WARRANTY') String maintenanceType, // WARRANTY|CONTRACT|INSPECTION
|
||||
@JsonKey(name: 'maintenance_type') @Default('V') String maintenanceType, // V: 방문, R: 원격
|
||||
}) = _MaintenanceRequestDto;
|
||||
|
||||
factory MaintenanceRequestDto.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -93,30 +95,26 @@ class MaintenanceQueryDto with _$MaintenanceQueryDto {
|
||||
_$MaintenanceQueryDtoFromJson(json);
|
||||
}
|
||||
|
||||
// Maintenance Type 헬퍼 (백엔드와 일치)
|
||||
// Maintenance Type 헬퍼 (V/R 시스템)
|
||||
class MaintenanceType {
|
||||
static const String warranty = 'WARRANTY';
|
||||
static const String contract = 'CONTRACT';
|
||||
static const String inspection = 'INSPECTION';
|
||||
static const String visit = 'V'; // 방문 유지보수
|
||||
static const String remote = 'R'; // 원격 유지보수
|
||||
|
||||
static String getDisplayName(String type) {
|
||||
switch (type) {
|
||||
case warranty:
|
||||
return '무상 보증';
|
||||
case contract:
|
||||
return '유상 계약';
|
||||
case inspection:
|
||||
return '점검';
|
||||
case visit:
|
||||
return '방문';
|
||||
case remote:
|
||||
return '원격';
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
static List<String> get allTypes => [warranty, contract, inspection];
|
||||
static List<String> get allTypes => [visit, remote];
|
||||
|
||||
static List<Map<String, String>> get typeOptions => [
|
||||
{'value': warranty, 'label': '무상 보증'},
|
||||
{'value': contract, 'label': '유상 계약'},
|
||||
{'value': inspection, 'label': '점검'},
|
||||
{'value': visit, 'label': '방문'},
|
||||
{'value': remote, 'label': '원격'},
|
||||
];
|
||||
}
|
||||
@@ -33,7 +33,7 @@ mixin _$MaintenanceDto {
|
||||
int get periodMonth => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'maintenance_type')
|
||||
String get maintenanceType =>
|
||||
throw _privateConstructorUsedError; // WARRANTY|CONTRACT|INSPECTION
|
||||
throw _privateConstructorUsedError; // V: 방문, R: 원격
|
||||
@JsonKey(name: 'is_deleted')
|
||||
bool get isDeleted => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'registered_at')
|
||||
@@ -45,6 +45,10 @@ mixin _$MaintenanceDto {
|
||||
String? get equipmentSerial => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'equipment_model')
|
||||
String? get equipmentModel => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'company_id')
|
||||
int? get companyId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'company_name')
|
||||
String? get companyName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'days_remaining')
|
||||
int? get daysRemaining => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'is_expired')
|
||||
@@ -81,6 +85,8 @@ abstract class $MaintenanceDtoCopyWith<$Res> {
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
@JsonKey(name: 'equipment_serial') String? equipmentSerial,
|
||||
@JsonKey(name: 'equipment_model') String? equipmentModel,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'days_remaining') int? daysRemaining,
|
||||
@JsonKey(name: 'is_expired') bool isExpired,
|
||||
EquipmentHistoryDto? equipmentHistory});
|
||||
@@ -114,6 +120,8 @@ class _$MaintenanceDtoCopyWithImpl<$Res, $Val extends MaintenanceDto>
|
||||
Object? updatedAt = freezed,
|
||||
Object? equipmentSerial = freezed,
|
||||
Object? equipmentModel = freezed,
|
||||
Object? companyId = freezed,
|
||||
Object? companyName = freezed,
|
||||
Object? daysRemaining = freezed,
|
||||
Object? isExpired = null,
|
||||
Object? equipmentHistory = freezed,
|
||||
@@ -163,6 +171,14 @@ class _$MaintenanceDtoCopyWithImpl<$Res, $Val extends MaintenanceDto>
|
||||
? _value.equipmentModel
|
||||
: equipmentModel // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
companyId: freezed == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
daysRemaining: freezed == daysRemaining
|
||||
? _value.daysRemaining
|
||||
: daysRemaining // ignore: cast_nullable_to_non_nullable
|
||||
@@ -214,6 +230,8 @@ abstract class _$$MaintenanceDtoImplCopyWith<$Res>
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
@JsonKey(name: 'equipment_serial') String? equipmentSerial,
|
||||
@JsonKey(name: 'equipment_model') String? equipmentModel,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'days_remaining') int? daysRemaining,
|
||||
@JsonKey(name: 'is_expired') bool isExpired,
|
||||
EquipmentHistoryDto? equipmentHistory});
|
||||
@@ -246,6 +264,8 @@ class __$$MaintenanceDtoImplCopyWithImpl<$Res>
|
||||
Object? updatedAt = freezed,
|
||||
Object? equipmentSerial = freezed,
|
||||
Object? equipmentModel = freezed,
|
||||
Object? companyId = freezed,
|
||||
Object? companyName = freezed,
|
||||
Object? daysRemaining = freezed,
|
||||
Object? isExpired = null,
|
||||
Object? equipmentHistory = freezed,
|
||||
@@ -295,6 +315,14 @@ class __$$MaintenanceDtoImplCopyWithImpl<$Res>
|
||||
? _value.equipmentModel
|
||||
: equipmentModel // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
companyId: freezed == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
daysRemaining: freezed == daysRemaining
|
||||
? _value.daysRemaining
|
||||
: daysRemaining // ignore: cast_nullable_to_non_nullable
|
||||
@@ -320,12 +348,14 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
@JsonKey(name: 'started_at') required this.startedAt,
|
||||
@JsonKey(name: 'ended_at') required this.endedAt,
|
||||
@JsonKey(name: 'period_month') this.periodMonth = 1,
|
||||
@JsonKey(name: 'maintenance_type') this.maintenanceType = 'WARRANTY',
|
||||
@JsonKey(name: 'maintenance_type') this.maintenanceType = 'V',
|
||||
@JsonKey(name: 'is_deleted') this.isDeleted = false,
|
||||
@JsonKey(name: 'registered_at') required this.registeredAt,
|
||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
||||
@JsonKey(name: 'equipment_serial') this.equipmentSerial,
|
||||
@JsonKey(name: 'equipment_model') this.equipmentModel,
|
||||
@JsonKey(name: 'company_id') this.companyId,
|
||||
@JsonKey(name: 'company_name') this.companyName,
|
||||
@JsonKey(name: 'days_remaining') this.daysRemaining,
|
||||
@JsonKey(name: 'is_expired') this.isExpired = false,
|
||||
this.equipmentHistory})
|
||||
@@ -353,7 +383,7 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
@override
|
||||
@JsonKey(name: 'maintenance_type')
|
||||
final String maintenanceType;
|
||||
// WARRANTY|CONTRACT|INSPECTION
|
||||
// V: 방문, R: 원격
|
||||
@override
|
||||
@JsonKey(name: 'is_deleted')
|
||||
final bool isDeleted;
|
||||
@@ -371,6 +401,12 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
@JsonKey(name: 'equipment_model')
|
||||
final String? equipmentModel;
|
||||
@override
|
||||
@JsonKey(name: 'company_id')
|
||||
final int? companyId;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
final String? companyName;
|
||||
@override
|
||||
@JsonKey(name: 'days_remaining')
|
||||
final int? daysRemaining;
|
||||
@override
|
||||
@@ -382,7 +418,7 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MaintenanceDto(id: $id, equipmentHistoryId: $equipmentHistoryId, startedAt: $startedAt, endedAt: $endedAt, periodMonth: $periodMonth, maintenanceType: $maintenanceType, isDeleted: $isDeleted, registeredAt: $registeredAt, updatedAt: $updatedAt, equipmentSerial: $equipmentSerial, equipmentModel: $equipmentModel, daysRemaining: $daysRemaining, isExpired: $isExpired, equipmentHistory: $equipmentHistory)';
|
||||
return 'MaintenanceDto(id: $id, equipmentHistoryId: $equipmentHistoryId, startedAt: $startedAt, endedAt: $endedAt, periodMonth: $periodMonth, maintenanceType: $maintenanceType, isDeleted: $isDeleted, registeredAt: $registeredAt, updatedAt: $updatedAt, equipmentSerial: $equipmentSerial, equipmentModel: $equipmentModel, companyId: $companyId, companyName: $companyName, daysRemaining: $daysRemaining, isExpired: $isExpired, equipmentHistory: $equipmentHistory)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -410,6 +446,10 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
other.equipmentSerial == equipmentSerial) &&
|
||||
(identical(other.equipmentModel, equipmentModel) ||
|
||||
other.equipmentModel == equipmentModel) &&
|
||||
(identical(other.companyId, companyId) ||
|
||||
other.companyId == companyId) &&
|
||||
(identical(other.companyName, companyName) ||
|
||||
other.companyName == companyName) &&
|
||||
(identical(other.daysRemaining, daysRemaining) ||
|
||||
other.daysRemaining == daysRemaining) &&
|
||||
(identical(other.isExpired, isExpired) ||
|
||||
@@ -433,6 +473,8 @@ class _$MaintenanceDtoImpl extends _MaintenanceDto {
|
||||
updatedAt,
|
||||
equipmentSerial,
|
||||
equipmentModel,
|
||||
companyId,
|
||||
companyName,
|
||||
daysRemaining,
|
||||
isExpired,
|
||||
equipmentHistory);
|
||||
@@ -467,6 +509,8 @@ abstract class _MaintenanceDto extends MaintenanceDto {
|
||||
@JsonKey(name: 'updated_at') final DateTime? updatedAt,
|
||||
@JsonKey(name: 'equipment_serial') final String? equipmentSerial,
|
||||
@JsonKey(name: 'equipment_model') final String? equipmentModel,
|
||||
@JsonKey(name: 'company_id') final int? companyId,
|
||||
@JsonKey(name: 'company_name') final String? companyName,
|
||||
@JsonKey(name: 'days_remaining') final int? daysRemaining,
|
||||
@JsonKey(name: 'is_expired') final bool isExpired,
|
||||
final EquipmentHistoryDto? equipmentHistory}) = _$MaintenanceDtoImpl;
|
||||
@@ -492,7 +536,7 @@ abstract class _MaintenanceDto extends MaintenanceDto {
|
||||
int get periodMonth;
|
||||
@override
|
||||
@JsonKey(name: 'maintenance_type')
|
||||
String get maintenanceType; // WARRANTY|CONTRACT|INSPECTION
|
||||
String get maintenanceType; // V: 방문, R: 원격
|
||||
@override
|
||||
@JsonKey(name: 'is_deleted')
|
||||
bool get isDeleted;
|
||||
@@ -509,6 +553,12 @@ abstract class _MaintenanceDto extends MaintenanceDto {
|
||||
@JsonKey(name: 'equipment_model')
|
||||
String? get equipmentModel;
|
||||
@override
|
||||
@JsonKey(name: 'company_id')
|
||||
int? get companyId;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
String? get companyName;
|
||||
@override
|
||||
@JsonKey(name: 'days_remaining')
|
||||
int? get daysRemaining;
|
||||
@override
|
||||
@@ -685,7 +735,7 @@ class _$MaintenanceRequestDtoImpl implements _MaintenanceRequestDto {
|
||||
@JsonKey(name: 'started_at') required this.startedAt,
|
||||
@JsonKey(name: 'ended_at') required this.endedAt,
|
||||
@JsonKey(name: 'period_month') this.periodMonth = 1,
|
||||
@JsonKey(name: 'maintenance_type') this.maintenanceType = 'WARRANTY'});
|
||||
@JsonKey(name: 'maintenance_type') this.maintenanceType = 'V'});
|
||||
|
||||
factory _$MaintenanceRequestDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MaintenanceRequestDtoImplFromJson(json);
|
||||
|
||||
@@ -13,7 +13,7 @@ _$MaintenanceDtoImpl _$$MaintenanceDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
startedAt: DateTime.parse(json['started_at'] as String),
|
||||
endedAt: DateTime.parse(json['ended_at'] as String),
|
||||
periodMonth: (json['period_month'] as num?)?.toInt() ?? 1,
|
||||
maintenanceType: json['maintenance_type'] as String? ?? 'WARRANTY',
|
||||
maintenanceType: json['maintenance_type'] as String? ?? 'V',
|
||||
isDeleted: json['is_deleted'] as bool? ?? false,
|
||||
registeredAt: DateTime.parse(json['registered_at'] as String),
|
||||
updatedAt: json['updated_at'] == null
|
||||
@@ -21,6 +21,8 @@ _$MaintenanceDtoImpl _$$MaintenanceDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
equipmentSerial: json['equipment_serial'] as String?,
|
||||
equipmentModel: json['equipment_model'] as String?,
|
||||
companyId: (json['company_id'] as num?)?.toInt(),
|
||||
companyName: json['company_name'] as String?,
|
||||
daysRemaining: (json['days_remaining'] as num?)?.toInt(),
|
||||
isExpired: json['is_expired'] as bool? ?? false,
|
||||
equipmentHistory: json['equipmentHistory'] == null
|
||||
@@ -43,6 +45,8 @@ Map<String, dynamic> _$$MaintenanceDtoImplToJson(
|
||||
'updated_at': instance.updatedAt?.toIso8601String(),
|
||||
'equipment_serial': instance.equipmentSerial,
|
||||
'equipment_model': instance.equipmentModel,
|
||||
'company_id': instance.companyId,
|
||||
'company_name': instance.companyName,
|
||||
'days_remaining': instance.daysRemaining,
|
||||
'is_expired': instance.isExpired,
|
||||
'equipmentHistory': instance.equipmentHistory,
|
||||
@@ -55,7 +59,7 @@ _$MaintenanceRequestDtoImpl _$$MaintenanceRequestDtoImplFromJson(
|
||||
startedAt: DateTime.parse(json['started_at'] as String),
|
||||
endedAt: DateTime.parse(json['ended_at'] as String),
|
||||
periodMonth: (json['period_month'] as num?)?.toInt() ?? 1,
|
||||
maintenanceType: json['maintenance_type'] as String? ?? 'WARRANTY',
|
||||
maintenanceType: json['maintenance_type'] as String? ?? 'V',
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MaintenanceRequestDtoImplToJson(
|
||||
|
||||
181
lib/data/models/maintenance_stats_dto.dart
Normal file
181
lib/data/models/maintenance_stats_dto.dart
Normal file
@@ -0,0 +1,181 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'maintenance_stats_dto.freezed.dart';
|
||||
part 'maintenance_stats_dto.g.dart';
|
||||
|
||||
@freezed
|
||||
class MaintenanceStatsDto with _$MaintenanceStatsDto {
|
||||
const factory MaintenanceStatsDto({
|
||||
// 기본 계약 통계
|
||||
@JsonKey(name: 'active_contracts') @Default(0) int activeContracts,
|
||||
@JsonKey(name: 'total_contracts') @Default(0) int totalContracts,
|
||||
|
||||
// 만료 기간별 통계 (사용자 요구사항)
|
||||
@JsonKey(name: 'expiring_60_days') @Default(0) int expiring60Days,
|
||||
@JsonKey(name: 'expiring_30_days') @Default(0) int expiring30Days,
|
||||
@JsonKey(name: 'expiring_7_days') @Default(0) int expiring7Days,
|
||||
@JsonKey(name: 'expired_contracts') @Default(0) int expiredContracts,
|
||||
|
||||
// 유지보수 타입별 통계 (V/R 시스템)
|
||||
@JsonKey(name: 'visit_contracts') @Default(0) int visitContracts,
|
||||
@JsonKey(name: 'remote_contracts') @Default(0) int remoteContracts,
|
||||
|
||||
// 예정된 작업 통계
|
||||
@JsonKey(name: 'upcoming_visits') @Default(0) int upcomingVisits,
|
||||
@JsonKey(name: 'overdue_maintenances') @Default(0) int overdueMaintenances,
|
||||
|
||||
// 추가 메트릭
|
||||
@JsonKey(name: 'total_revenue_at_risk') @Default(0.0) double totalRevenueAtRisk,
|
||||
@JsonKey(name: 'completion_rate') @Default(0.0) double completionRate,
|
||||
|
||||
// 마지막 업데이트 시간
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
}) = _MaintenanceStatsDto;
|
||||
|
||||
factory MaintenanceStatsDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$MaintenanceStatsDtoFromJson(json);
|
||||
}
|
||||
|
||||
// 대시보드 상태별 카드 데이터
|
||||
@freezed
|
||||
class MaintenanceStatusCardData with _$MaintenanceStatusCardData {
|
||||
const factory MaintenanceStatusCardData({
|
||||
required String title,
|
||||
required int count,
|
||||
required String subtitle,
|
||||
required MaintenanceCardStatus status,
|
||||
String? actionLabel,
|
||||
}) = _MaintenanceStatusCardData;
|
||||
|
||||
factory MaintenanceStatusCardData.fromJson(Map<String, dynamic> json) =>
|
||||
_$MaintenanceStatusCardDataFromJson(json);
|
||||
}
|
||||
|
||||
// 카드 상태 열거형
|
||||
enum MaintenanceCardStatus {
|
||||
@JsonValue('active')
|
||||
active,
|
||||
@JsonValue('warning')
|
||||
warning,
|
||||
@JsonValue('urgent')
|
||||
urgent,
|
||||
@JsonValue('critical')
|
||||
critical,
|
||||
@JsonValue('expired')
|
||||
expired,
|
||||
}
|
||||
|
||||
// 카드 상태별 정보 헬퍼
|
||||
class MaintenanceCardHelper {
|
||||
static Map<MaintenanceCardStatus, Map<String, dynamic>> get statusConfig => {
|
||||
MaintenanceCardStatus.active: {
|
||||
'color': '#059669', // Green
|
||||
'icon': 'assignment',
|
||||
'description': '정상 활성'
|
||||
},
|
||||
MaintenanceCardStatus.warning: {
|
||||
'color': '#F59E0B', // Amber
|
||||
'icon': 'warning',
|
||||
'description': '주의 필요'
|
||||
},
|
||||
MaintenanceCardStatus.urgent: {
|
||||
'color': '#EA580C', // Orange
|
||||
'icon': 'schedule',
|
||||
'description': '긴급 처리'
|
||||
},
|
||||
MaintenanceCardStatus.critical: {
|
||||
'color': '#DC2626', // Red
|
||||
'icon': 'alert_circle',
|
||||
'description': '즉시 조치'
|
||||
},
|
||||
MaintenanceCardStatus.expired: {
|
||||
'color': '#991B1B', // Dark Red
|
||||
'icon': 'error',
|
||||
'description': '만료됨'
|
||||
},
|
||||
};
|
||||
|
||||
static String getColorForStatus(MaintenanceCardStatus status) {
|
||||
return statusConfig[status]?['color'] ?? '#6B7280';
|
||||
}
|
||||
|
||||
static String getIconForStatus(MaintenanceCardStatus status) {
|
||||
return statusConfig[status]?['icon'] ?? 'info';
|
||||
}
|
||||
|
||||
static String getDescriptionForStatus(MaintenanceCardStatus status) {
|
||||
return statusConfig[status]?['description'] ?? '상태 정보 없음';
|
||||
}
|
||||
}
|
||||
|
||||
// 대시보드 카드 생성 헬퍼
|
||||
extension MaintenanceStatsDashboard on MaintenanceStatsDto {
|
||||
List<MaintenanceStatusCardData> get dashboardCards => [
|
||||
// 60일 내 만료 예정
|
||||
MaintenanceStatusCardData(
|
||||
title: '60일 내',
|
||||
count: expiring60Days,
|
||||
subtitle: '만료 예정',
|
||||
status: expiring60Days > 0 ? MaintenanceCardStatus.warning : MaintenanceCardStatus.active,
|
||||
actionLabel: '계획하기',
|
||||
),
|
||||
|
||||
// 30일 내 만료 예정
|
||||
MaintenanceStatusCardData(
|
||||
title: '30일 내',
|
||||
count: expiring30Days,
|
||||
subtitle: '만료 예정',
|
||||
status: expiring30Days > 0 ? MaintenanceCardStatus.urgent : MaintenanceCardStatus.active,
|
||||
actionLabel: '예약하기',
|
||||
),
|
||||
|
||||
// 7일 내 만료 예정
|
||||
MaintenanceStatusCardData(
|
||||
title: '7일 내',
|
||||
count: expiring7Days,
|
||||
subtitle: '만료 임박',
|
||||
status: expiring7Days > 0 ? MaintenanceCardStatus.critical : MaintenanceCardStatus.active,
|
||||
actionLabel: '즉시 처리',
|
||||
),
|
||||
|
||||
// 만료된 계약
|
||||
MaintenanceStatusCardData(
|
||||
title: '만료됨',
|
||||
count: expiredContracts,
|
||||
subtitle: '조치 필요',
|
||||
status: expiredContracts > 0 ? MaintenanceCardStatus.expired : MaintenanceCardStatus.active,
|
||||
actionLabel: '갱신하기',
|
||||
),
|
||||
];
|
||||
|
||||
// 추가 요약 정보
|
||||
Map<String, int> get summaryStats => {
|
||||
'총 활성 계약': activeContracts,
|
||||
'방문 계약': visitContracts,
|
||||
'원격 계약': remoteContracts,
|
||||
'예정된 방문': upcomingVisits,
|
||||
'연체 유지보수': overdueMaintenances,
|
||||
};
|
||||
|
||||
// 위험도 계산
|
||||
double get riskScore {
|
||||
double score = 0.0;
|
||||
if (totalContracts == 0) return 0.0;
|
||||
|
||||
score += (expiredContracts / totalContracts) * 0.4; // 40% 가중치
|
||||
score += (expiring7Days / totalContracts) * 0.3; // 30% 가중치
|
||||
score += (expiring30Days / totalContracts) * 0.2; // 20% 가중치
|
||||
score += (expiring60Days / totalContracts) * 0.1; // 10% 가중치
|
||||
|
||||
return score.clamp(0.0, 1.0);
|
||||
}
|
||||
|
||||
// 위험도 상태
|
||||
MaintenanceCardStatus get riskStatus {
|
||||
final risk = riskScore;
|
||||
if (risk >= 0.7) return MaintenanceCardStatus.critical;
|
||||
if (risk >= 0.5) return MaintenanceCardStatus.urgent;
|
||||
if (risk >= 0.3) return MaintenanceCardStatus.warning;
|
||||
return MaintenanceCardStatus.active;
|
||||
}
|
||||
}
|
||||
729
lib/data/models/maintenance_stats_dto.freezed.dart
Normal file
729
lib/data/models/maintenance_stats_dto.freezed.dart
Normal file
@@ -0,0 +1,729 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'maintenance_stats_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
MaintenanceStatsDto _$MaintenanceStatsDtoFromJson(Map<String, dynamic> json) {
|
||||
return _MaintenanceStatsDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MaintenanceStatsDto {
|
||||
// 기본 계약 통계
|
||||
@JsonKey(name: 'active_contracts')
|
||||
int get activeContracts => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_contracts')
|
||||
int get totalContracts =>
|
||||
throw _privateConstructorUsedError; // 만료 기간별 통계 (사용자 요구사항)
|
||||
@JsonKey(name: 'expiring_60_days')
|
||||
int get expiring60Days => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expiring_30_days')
|
||||
int get expiring30Days => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expiring_7_days')
|
||||
int get expiring7Days => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expired_contracts')
|
||||
int get expiredContracts =>
|
||||
throw _privateConstructorUsedError; // 유지보수 타입별 통계 (V/R 시스템)
|
||||
@JsonKey(name: 'visit_contracts')
|
||||
int get visitContracts => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'remote_contracts')
|
||||
int get remoteContracts => throw _privateConstructorUsedError; // 예정된 작업 통계
|
||||
@JsonKey(name: 'upcoming_visits')
|
||||
int get upcomingVisits => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'overdue_maintenances')
|
||||
int get overdueMaintenances => throw _privateConstructorUsedError; // 추가 메트릭
|
||||
@JsonKey(name: 'total_revenue_at_risk')
|
||||
double get totalRevenueAtRisk => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'completion_rate')
|
||||
double get completionRate =>
|
||||
throw _privateConstructorUsedError; // 마지막 업데이트 시간
|
||||
@JsonKey(name: 'updated_at')
|
||||
DateTime? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this MaintenanceStatsDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MaintenanceStatsDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MaintenanceStatsDtoCopyWith<MaintenanceStatsDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MaintenanceStatsDtoCopyWith<$Res> {
|
||||
factory $MaintenanceStatsDtoCopyWith(
|
||||
MaintenanceStatsDto value, $Res Function(MaintenanceStatsDto) then) =
|
||||
_$MaintenanceStatsDtoCopyWithImpl<$Res, MaintenanceStatsDto>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'active_contracts') int activeContracts,
|
||||
@JsonKey(name: 'total_contracts') int totalContracts,
|
||||
@JsonKey(name: 'expiring_60_days') int expiring60Days,
|
||||
@JsonKey(name: 'expiring_30_days') int expiring30Days,
|
||||
@JsonKey(name: 'expiring_7_days') int expiring7Days,
|
||||
@JsonKey(name: 'expired_contracts') int expiredContracts,
|
||||
@JsonKey(name: 'visit_contracts') int visitContracts,
|
||||
@JsonKey(name: 'remote_contracts') int remoteContracts,
|
||||
@JsonKey(name: 'upcoming_visits') int upcomingVisits,
|
||||
@JsonKey(name: 'overdue_maintenances') int overdueMaintenances,
|
||||
@JsonKey(name: 'total_revenue_at_risk') double totalRevenueAtRisk,
|
||||
@JsonKey(name: 'completion_rate') double completionRate,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MaintenanceStatsDtoCopyWithImpl<$Res, $Val extends MaintenanceStatsDto>
|
||||
implements $MaintenanceStatsDtoCopyWith<$Res> {
|
||||
_$MaintenanceStatsDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MaintenanceStatsDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? activeContracts = null,
|
||||
Object? totalContracts = null,
|
||||
Object? expiring60Days = null,
|
||||
Object? expiring30Days = null,
|
||||
Object? expiring7Days = null,
|
||||
Object? expiredContracts = null,
|
||||
Object? visitContracts = null,
|
||||
Object? remoteContracts = null,
|
||||
Object? upcomingVisits = null,
|
||||
Object? overdueMaintenances = null,
|
||||
Object? totalRevenueAtRisk = null,
|
||||
Object? completionRate = null,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
activeContracts: null == activeContracts
|
||||
? _value.activeContracts
|
||||
: activeContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalContracts: null == totalContracts
|
||||
? _value.totalContracts
|
||||
: totalContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring60Days: null == expiring60Days
|
||||
? _value.expiring60Days
|
||||
: expiring60Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring30Days: null == expiring30Days
|
||||
? _value.expiring30Days
|
||||
: expiring30Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring7Days: null == expiring7Days
|
||||
? _value.expiring7Days
|
||||
: expiring7Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiredContracts: null == expiredContracts
|
||||
? _value.expiredContracts
|
||||
: expiredContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
visitContracts: null == visitContracts
|
||||
? _value.visitContracts
|
||||
: visitContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
remoteContracts: null == remoteContracts
|
||||
? _value.remoteContracts
|
||||
: remoteContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
upcomingVisits: null == upcomingVisits
|
||||
? _value.upcomingVisits
|
||||
: upcomingVisits // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
overdueMaintenances: null == overdueMaintenances
|
||||
? _value.overdueMaintenances
|
||||
: overdueMaintenances // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalRevenueAtRisk: null == totalRevenueAtRisk
|
||||
? _value.totalRevenueAtRisk
|
||||
: totalRevenueAtRisk // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
completionRate: null == completionRate
|
||||
? _value.completionRate
|
||||
: completionRate // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MaintenanceStatsDtoImplCopyWith<$Res>
|
||||
implements $MaintenanceStatsDtoCopyWith<$Res> {
|
||||
factory _$$MaintenanceStatsDtoImplCopyWith(_$MaintenanceStatsDtoImpl value,
|
||||
$Res Function(_$MaintenanceStatsDtoImpl) then) =
|
||||
__$$MaintenanceStatsDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'active_contracts') int activeContracts,
|
||||
@JsonKey(name: 'total_contracts') int totalContracts,
|
||||
@JsonKey(name: 'expiring_60_days') int expiring60Days,
|
||||
@JsonKey(name: 'expiring_30_days') int expiring30Days,
|
||||
@JsonKey(name: 'expiring_7_days') int expiring7Days,
|
||||
@JsonKey(name: 'expired_contracts') int expiredContracts,
|
||||
@JsonKey(name: 'visit_contracts') int visitContracts,
|
||||
@JsonKey(name: 'remote_contracts') int remoteContracts,
|
||||
@JsonKey(name: 'upcoming_visits') int upcomingVisits,
|
||||
@JsonKey(name: 'overdue_maintenances') int overdueMaintenances,
|
||||
@JsonKey(name: 'total_revenue_at_risk') double totalRevenueAtRisk,
|
||||
@JsonKey(name: 'completion_rate') double completionRate,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MaintenanceStatsDtoImplCopyWithImpl<$Res>
|
||||
extends _$MaintenanceStatsDtoCopyWithImpl<$Res, _$MaintenanceStatsDtoImpl>
|
||||
implements _$$MaintenanceStatsDtoImplCopyWith<$Res> {
|
||||
__$$MaintenanceStatsDtoImplCopyWithImpl(_$MaintenanceStatsDtoImpl _value,
|
||||
$Res Function(_$MaintenanceStatsDtoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MaintenanceStatsDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? activeContracts = null,
|
||||
Object? totalContracts = null,
|
||||
Object? expiring60Days = null,
|
||||
Object? expiring30Days = null,
|
||||
Object? expiring7Days = null,
|
||||
Object? expiredContracts = null,
|
||||
Object? visitContracts = null,
|
||||
Object? remoteContracts = null,
|
||||
Object? upcomingVisits = null,
|
||||
Object? overdueMaintenances = null,
|
||||
Object? totalRevenueAtRisk = null,
|
||||
Object? completionRate = null,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(_$MaintenanceStatsDtoImpl(
|
||||
activeContracts: null == activeContracts
|
||||
? _value.activeContracts
|
||||
: activeContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalContracts: null == totalContracts
|
||||
? _value.totalContracts
|
||||
: totalContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring60Days: null == expiring60Days
|
||||
? _value.expiring60Days
|
||||
: expiring60Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring30Days: null == expiring30Days
|
||||
? _value.expiring30Days
|
||||
: expiring30Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiring7Days: null == expiring7Days
|
||||
? _value.expiring7Days
|
||||
: expiring7Days // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiredContracts: null == expiredContracts
|
||||
? _value.expiredContracts
|
||||
: expiredContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
visitContracts: null == visitContracts
|
||||
? _value.visitContracts
|
||||
: visitContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
remoteContracts: null == remoteContracts
|
||||
? _value.remoteContracts
|
||||
: remoteContracts // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
upcomingVisits: null == upcomingVisits
|
||||
? _value.upcomingVisits
|
||||
: upcomingVisits // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
overdueMaintenances: null == overdueMaintenances
|
||||
? _value.overdueMaintenances
|
||||
: overdueMaintenances // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalRevenueAtRisk: null == totalRevenueAtRisk
|
||||
? _value.totalRevenueAtRisk
|
||||
: totalRevenueAtRisk // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
completionRate: null == completionRate
|
||||
? _value.completionRate
|
||||
: completionRate // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MaintenanceStatsDtoImpl implements _MaintenanceStatsDto {
|
||||
const _$MaintenanceStatsDtoImpl(
|
||||
{@JsonKey(name: 'active_contracts') this.activeContracts = 0,
|
||||
@JsonKey(name: 'total_contracts') this.totalContracts = 0,
|
||||
@JsonKey(name: 'expiring_60_days') this.expiring60Days = 0,
|
||||
@JsonKey(name: 'expiring_30_days') this.expiring30Days = 0,
|
||||
@JsonKey(name: 'expiring_7_days') this.expiring7Days = 0,
|
||||
@JsonKey(name: 'expired_contracts') this.expiredContracts = 0,
|
||||
@JsonKey(name: 'visit_contracts') this.visitContracts = 0,
|
||||
@JsonKey(name: 'remote_contracts') this.remoteContracts = 0,
|
||||
@JsonKey(name: 'upcoming_visits') this.upcomingVisits = 0,
|
||||
@JsonKey(name: 'overdue_maintenances') this.overdueMaintenances = 0,
|
||||
@JsonKey(name: 'total_revenue_at_risk') this.totalRevenueAtRisk = 0.0,
|
||||
@JsonKey(name: 'completion_rate') this.completionRate = 0.0,
|
||||
@JsonKey(name: 'updated_at') this.updatedAt});
|
||||
|
||||
factory _$MaintenanceStatsDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MaintenanceStatsDtoImplFromJson(json);
|
||||
|
||||
// 기본 계약 통계
|
||||
@override
|
||||
@JsonKey(name: 'active_contracts')
|
||||
final int activeContracts;
|
||||
@override
|
||||
@JsonKey(name: 'total_contracts')
|
||||
final int totalContracts;
|
||||
// 만료 기간별 통계 (사용자 요구사항)
|
||||
@override
|
||||
@JsonKey(name: 'expiring_60_days')
|
||||
final int expiring60Days;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_30_days')
|
||||
final int expiring30Days;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_7_days')
|
||||
final int expiring7Days;
|
||||
@override
|
||||
@JsonKey(name: 'expired_contracts')
|
||||
final int expiredContracts;
|
||||
// 유지보수 타입별 통계 (V/R 시스템)
|
||||
@override
|
||||
@JsonKey(name: 'visit_contracts')
|
||||
final int visitContracts;
|
||||
@override
|
||||
@JsonKey(name: 'remote_contracts')
|
||||
final int remoteContracts;
|
||||
// 예정된 작업 통계
|
||||
@override
|
||||
@JsonKey(name: 'upcoming_visits')
|
||||
final int upcomingVisits;
|
||||
@override
|
||||
@JsonKey(name: 'overdue_maintenances')
|
||||
final int overdueMaintenances;
|
||||
// 추가 메트릭
|
||||
@override
|
||||
@JsonKey(name: 'total_revenue_at_risk')
|
||||
final double totalRevenueAtRisk;
|
||||
@override
|
||||
@JsonKey(name: 'completion_rate')
|
||||
final double completionRate;
|
||||
// 마지막 업데이트 시간
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
final DateTime? updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MaintenanceStatsDto(activeContracts: $activeContracts, totalContracts: $totalContracts, expiring60Days: $expiring60Days, expiring30Days: $expiring30Days, expiring7Days: $expiring7Days, expiredContracts: $expiredContracts, visitContracts: $visitContracts, remoteContracts: $remoteContracts, upcomingVisits: $upcomingVisits, overdueMaintenances: $overdueMaintenances, totalRevenueAtRisk: $totalRevenueAtRisk, completionRate: $completionRate, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MaintenanceStatsDtoImpl &&
|
||||
(identical(other.activeContracts, activeContracts) ||
|
||||
other.activeContracts == activeContracts) &&
|
||||
(identical(other.totalContracts, totalContracts) ||
|
||||
other.totalContracts == totalContracts) &&
|
||||
(identical(other.expiring60Days, expiring60Days) ||
|
||||
other.expiring60Days == expiring60Days) &&
|
||||
(identical(other.expiring30Days, expiring30Days) ||
|
||||
other.expiring30Days == expiring30Days) &&
|
||||
(identical(other.expiring7Days, expiring7Days) ||
|
||||
other.expiring7Days == expiring7Days) &&
|
||||
(identical(other.expiredContracts, expiredContracts) ||
|
||||
other.expiredContracts == expiredContracts) &&
|
||||
(identical(other.visitContracts, visitContracts) ||
|
||||
other.visitContracts == visitContracts) &&
|
||||
(identical(other.remoteContracts, remoteContracts) ||
|
||||
other.remoteContracts == remoteContracts) &&
|
||||
(identical(other.upcomingVisits, upcomingVisits) ||
|
||||
other.upcomingVisits == upcomingVisits) &&
|
||||
(identical(other.overdueMaintenances, overdueMaintenances) ||
|
||||
other.overdueMaintenances == overdueMaintenances) &&
|
||||
(identical(other.totalRevenueAtRisk, totalRevenueAtRisk) ||
|
||||
other.totalRevenueAtRisk == totalRevenueAtRisk) &&
|
||||
(identical(other.completionRate, completionRate) ||
|
||||
other.completionRate == completionRate) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
activeContracts,
|
||||
totalContracts,
|
||||
expiring60Days,
|
||||
expiring30Days,
|
||||
expiring7Days,
|
||||
expiredContracts,
|
||||
visitContracts,
|
||||
remoteContracts,
|
||||
upcomingVisits,
|
||||
overdueMaintenances,
|
||||
totalRevenueAtRisk,
|
||||
completionRate,
|
||||
updatedAt);
|
||||
|
||||
/// Create a copy of MaintenanceStatsDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MaintenanceStatsDtoImplCopyWith<_$MaintenanceStatsDtoImpl> get copyWith =>
|
||||
__$$MaintenanceStatsDtoImplCopyWithImpl<_$MaintenanceStatsDtoImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MaintenanceStatsDtoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _MaintenanceStatsDto implements MaintenanceStatsDto {
|
||||
const factory _MaintenanceStatsDto(
|
||||
{@JsonKey(name: 'active_contracts') final int activeContracts,
|
||||
@JsonKey(name: 'total_contracts') final int totalContracts,
|
||||
@JsonKey(name: 'expiring_60_days') final int expiring60Days,
|
||||
@JsonKey(name: 'expiring_30_days') final int expiring30Days,
|
||||
@JsonKey(name: 'expiring_7_days') final int expiring7Days,
|
||||
@JsonKey(name: 'expired_contracts') final int expiredContracts,
|
||||
@JsonKey(name: 'visit_contracts') final int visitContracts,
|
||||
@JsonKey(name: 'remote_contracts') final int remoteContracts,
|
||||
@JsonKey(name: 'upcoming_visits') final int upcomingVisits,
|
||||
@JsonKey(name: 'overdue_maintenances') final int overdueMaintenances,
|
||||
@JsonKey(name: 'total_revenue_at_risk') final double totalRevenueAtRisk,
|
||||
@JsonKey(name: 'completion_rate') final double completionRate,
|
||||
@JsonKey(name: 'updated_at')
|
||||
final DateTime? updatedAt}) = _$MaintenanceStatsDtoImpl;
|
||||
|
||||
factory _MaintenanceStatsDto.fromJson(Map<String, dynamic> json) =
|
||||
_$MaintenanceStatsDtoImpl.fromJson;
|
||||
|
||||
// 기본 계약 통계
|
||||
@override
|
||||
@JsonKey(name: 'active_contracts')
|
||||
int get activeContracts;
|
||||
@override
|
||||
@JsonKey(name: 'total_contracts')
|
||||
int get totalContracts; // 만료 기간별 통계 (사용자 요구사항)
|
||||
@override
|
||||
@JsonKey(name: 'expiring_60_days')
|
||||
int get expiring60Days;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_30_days')
|
||||
int get expiring30Days;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_7_days')
|
||||
int get expiring7Days;
|
||||
@override
|
||||
@JsonKey(name: 'expired_contracts')
|
||||
int get expiredContracts; // 유지보수 타입별 통계 (V/R 시스템)
|
||||
@override
|
||||
@JsonKey(name: 'visit_contracts')
|
||||
int get visitContracts;
|
||||
@override
|
||||
@JsonKey(name: 'remote_contracts')
|
||||
int get remoteContracts; // 예정된 작업 통계
|
||||
@override
|
||||
@JsonKey(name: 'upcoming_visits')
|
||||
int get upcomingVisits;
|
||||
@override
|
||||
@JsonKey(name: 'overdue_maintenances')
|
||||
int get overdueMaintenances; // 추가 메트릭
|
||||
@override
|
||||
@JsonKey(name: 'total_revenue_at_risk')
|
||||
double get totalRevenueAtRisk;
|
||||
@override
|
||||
@JsonKey(name: 'completion_rate')
|
||||
double get completionRate; // 마지막 업데이트 시간
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
DateTime? get updatedAt;
|
||||
|
||||
/// Create a copy of MaintenanceStatsDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MaintenanceStatsDtoImplCopyWith<_$MaintenanceStatsDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
MaintenanceStatusCardData _$MaintenanceStatusCardDataFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _MaintenanceStatusCardData.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MaintenanceStatusCardData {
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
int get count => throw _privateConstructorUsedError;
|
||||
String get subtitle => throw _privateConstructorUsedError;
|
||||
MaintenanceCardStatus get status => throw _privateConstructorUsedError;
|
||||
String? get actionLabel => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this MaintenanceStatusCardData to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MaintenanceStatusCardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MaintenanceStatusCardDataCopyWith<MaintenanceStatusCardData> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MaintenanceStatusCardDataCopyWith<$Res> {
|
||||
factory $MaintenanceStatusCardDataCopyWith(MaintenanceStatusCardData value,
|
||||
$Res Function(MaintenanceStatusCardData) then) =
|
||||
_$MaintenanceStatusCardDataCopyWithImpl<$Res, MaintenanceStatusCardData>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
int count,
|
||||
String subtitle,
|
||||
MaintenanceCardStatus status,
|
||||
String? actionLabel});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MaintenanceStatusCardDataCopyWithImpl<$Res,
|
||||
$Val extends MaintenanceStatusCardData>
|
||||
implements $MaintenanceStatusCardDataCopyWith<$Res> {
|
||||
_$MaintenanceStatusCardDataCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MaintenanceStatusCardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? count = null,
|
||||
Object? subtitle = null,
|
||||
Object? status = null,
|
||||
Object? actionLabel = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
count: null == count
|
||||
? _value.count
|
||||
: count // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
subtitle: null == subtitle
|
||||
? _value.subtitle
|
||||
: subtitle // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as MaintenanceCardStatus,
|
||||
actionLabel: freezed == actionLabel
|
||||
? _value.actionLabel
|
||||
: actionLabel // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MaintenanceStatusCardDataImplCopyWith<$Res>
|
||||
implements $MaintenanceStatusCardDataCopyWith<$Res> {
|
||||
factory _$$MaintenanceStatusCardDataImplCopyWith(
|
||||
_$MaintenanceStatusCardDataImpl value,
|
||||
$Res Function(_$MaintenanceStatusCardDataImpl) then) =
|
||||
__$$MaintenanceStatusCardDataImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
int count,
|
||||
String subtitle,
|
||||
MaintenanceCardStatus status,
|
||||
String? actionLabel});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MaintenanceStatusCardDataImplCopyWithImpl<$Res>
|
||||
extends _$MaintenanceStatusCardDataCopyWithImpl<$Res,
|
||||
_$MaintenanceStatusCardDataImpl>
|
||||
implements _$$MaintenanceStatusCardDataImplCopyWith<$Res> {
|
||||
__$$MaintenanceStatusCardDataImplCopyWithImpl(
|
||||
_$MaintenanceStatusCardDataImpl _value,
|
||||
$Res Function(_$MaintenanceStatusCardDataImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MaintenanceStatusCardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? count = null,
|
||||
Object? subtitle = null,
|
||||
Object? status = null,
|
||||
Object? actionLabel = freezed,
|
||||
}) {
|
||||
return _then(_$MaintenanceStatusCardDataImpl(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
count: null == count
|
||||
? _value.count
|
||||
: count // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
subtitle: null == subtitle
|
||||
? _value.subtitle
|
||||
: subtitle // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as MaintenanceCardStatus,
|
||||
actionLabel: freezed == actionLabel
|
||||
? _value.actionLabel
|
||||
: actionLabel // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MaintenanceStatusCardDataImpl implements _MaintenanceStatusCardData {
|
||||
const _$MaintenanceStatusCardDataImpl(
|
||||
{required this.title,
|
||||
required this.count,
|
||||
required this.subtitle,
|
||||
required this.status,
|
||||
this.actionLabel});
|
||||
|
||||
factory _$MaintenanceStatusCardDataImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MaintenanceStatusCardDataImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String title;
|
||||
@override
|
||||
final int count;
|
||||
@override
|
||||
final String subtitle;
|
||||
@override
|
||||
final MaintenanceCardStatus status;
|
||||
@override
|
||||
final String? actionLabel;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MaintenanceStatusCardData(title: $title, count: $count, subtitle: $subtitle, status: $status, actionLabel: $actionLabel)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MaintenanceStatusCardDataImpl &&
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.count, count) || other.count == count) &&
|
||||
(identical(other.subtitle, subtitle) ||
|
||||
other.subtitle == subtitle) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.actionLabel, actionLabel) ||
|
||||
other.actionLabel == actionLabel));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, title, count, subtitle, status, actionLabel);
|
||||
|
||||
/// Create a copy of MaintenanceStatusCardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MaintenanceStatusCardDataImplCopyWith<_$MaintenanceStatusCardDataImpl>
|
||||
get copyWith => __$$MaintenanceStatusCardDataImplCopyWithImpl<
|
||||
_$MaintenanceStatusCardDataImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MaintenanceStatusCardDataImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _MaintenanceStatusCardData implements MaintenanceStatusCardData {
|
||||
const factory _MaintenanceStatusCardData(
|
||||
{required final String title,
|
||||
required final int count,
|
||||
required final String subtitle,
|
||||
required final MaintenanceCardStatus status,
|
||||
final String? actionLabel}) = _$MaintenanceStatusCardDataImpl;
|
||||
|
||||
factory _MaintenanceStatusCardData.fromJson(Map<String, dynamic> json) =
|
||||
_$MaintenanceStatusCardDataImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get title;
|
||||
@override
|
||||
int get count;
|
||||
@override
|
||||
String get subtitle;
|
||||
@override
|
||||
MaintenanceCardStatus get status;
|
||||
@override
|
||||
String? get actionLabel;
|
||||
|
||||
/// Create a copy of MaintenanceStatusCardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MaintenanceStatusCardDataImplCopyWith<_$MaintenanceStatusCardDataImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
74
lib/data/models/maintenance_stats_dto.g.dart
Normal file
74
lib/data/models/maintenance_stats_dto.g.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'maintenance_stats_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$MaintenanceStatsDtoImpl _$$MaintenanceStatsDtoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$MaintenanceStatsDtoImpl(
|
||||
activeContracts: (json['active_contracts'] as num?)?.toInt() ?? 0,
|
||||
totalContracts: (json['total_contracts'] as num?)?.toInt() ?? 0,
|
||||
expiring60Days: (json['expiring_60_days'] as num?)?.toInt() ?? 0,
|
||||
expiring30Days: (json['expiring_30_days'] as num?)?.toInt() ?? 0,
|
||||
expiring7Days: (json['expiring_7_days'] as num?)?.toInt() ?? 0,
|
||||
expiredContracts: (json['expired_contracts'] as num?)?.toInt() ?? 0,
|
||||
visitContracts: (json['visit_contracts'] as num?)?.toInt() ?? 0,
|
||||
remoteContracts: (json['remote_contracts'] as num?)?.toInt() ?? 0,
|
||||
upcomingVisits: (json['upcoming_visits'] as num?)?.toInt() ?? 0,
|
||||
overdueMaintenances: (json['overdue_maintenances'] as num?)?.toInt() ?? 0,
|
||||
totalRevenueAtRisk:
|
||||
(json['total_revenue_at_risk'] as num?)?.toDouble() ?? 0.0,
|
||||
completionRate: (json['completion_rate'] as num?)?.toDouble() ?? 0.0,
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MaintenanceStatsDtoImplToJson(
|
||||
_$MaintenanceStatsDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'active_contracts': instance.activeContracts,
|
||||
'total_contracts': instance.totalContracts,
|
||||
'expiring_60_days': instance.expiring60Days,
|
||||
'expiring_30_days': instance.expiring30Days,
|
||||
'expiring_7_days': instance.expiring7Days,
|
||||
'expired_contracts': instance.expiredContracts,
|
||||
'visit_contracts': instance.visitContracts,
|
||||
'remote_contracts': instance.remoteContracts,
|
||||
'upcoming_visits': instance.upcomingVisits,
|
||||
'overdue_maintenances': instance.overdueMaintenances,
|
||||
'total_revenue_at_risk': instance.totalRevenueAtRisk,
|
||||
'completion_rate': instance.completionRate,
|
||||
'updated_at': instance.updatedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_$MaintenanceStatusCardDataImpl _$$MaintenanceStatusCardDataImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$MaintenanceStatusCardDataImpl(
|
||||
title: json['title'] as String,
|
||||
count: (json['count'] as num).toInt(),
|
||||
subtitle: json['subtitle'] as String,
|
||||
status: $enumDecode(_$MaintenanceCardStatusEnumMap, json['status']),
|
||||
actionLabel: json['actionLabel'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MaintenanceStatusCardDataImplToJson(
|
||||
_$MaintenanceStatusCardDataImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'title': instance.title,
|
||||
'count': instance.count,
|
||||
'subtitle': instance.subtitle,
|
||||
'status': _$MaintenanceCardStatusEnumMap[instance.status]!,
|
||||
'actionLabel': instance.actionLabel,
|
||||
};
|
||||
|
||||
const _$MaintenanceCardStatusEnumMap = {
|
||||
MaintenanceCardStatus.active: 'active',
|
||||
MaintenanceCardStatus.warning: 'warning',
|
||||
MaintenanceCardStatus.urgent: 'urgent',
|
||||
MaintenanceCardStatus.critical: 'critical',
|
||||
MaintenanceCardStatus.expired: 'expired',
|
||||
};
|
||||
@@ -7,8 +7,9 @@ part 'stock_status_dto.g.dart';
|
||||
@freezed
|
||||
class StockStatusDto with _$StockStatusDto {
|
||||
const factory StockStatusDto({
|
||||
@JsonKey(name: 'equipments_id') required int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required int warehousesId,
|
||||
// 백엔드 StockStatusResponse와 정확히 매핑
|
||||
@JsonKey(name: 'equipment_id') required int equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') required int warehouseId,
|
||||
@JsonKey(name: 'equipment_serial') required String equipmentSerial,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
@JsonKey(name: 'warehouse_name') required String warehouseName,
|
||||
|
||||
@@ -20,10 +20,11 @@ StockStatusDto _$StockStatusDtoFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$StockStatusDto {
|
||||
@JsonKey(name: 'equipments_id')
|
||||
int get equipmentsId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int get warehousesId => throw _privateConstructorUsedError;
|
||||
// 백엔드 StockStatusResponse와 정확히 매핑
|
||||
@JsonKey(name: 'equipment_id')
|
||||
int get equipmentId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouse_id')
|
||||
int get warehouseId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'equipment_serial')
|
||||
String get equipmentSerial => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'model_name')
|
||||
@@ -52,8 +53,8 @@ abstract class $StockStatusDtoCopyWith<$Res> {
|
||||
_$StockStatusDtoCopyWithImpl<$Res, StockStatusDto>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'equipments_id') int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') int warehousesId,
|
||||
{@JsonKey(name: 'equipment_id') int equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') int warehouseId,
|
||||
@JsonKey(name: 'equipment_serial') String equipmentSerial,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
@JsonKey(name: 'warehouse_name') String warehouseName,
|
||||
@@ -76,8 +77,8 @@ class _$StockStatusDtoCopyWithImpl<$Res, $Val extends StockStatusDto>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentsId = null,
|
||||
Object? warehousesId = null,
|
||||
Object? equipmentId = null,
|
||||
Object? warehouseId = null,
|
||||
Object? equipmentSerial = null,
|
||||
Object? modelName = freezed,
|
||||
Object? warehouseName = null,
|
||||
@@ -85,13 +86,13 @@ class _$StockStatusDtoCopyWithImpl<$Res, $Val extends StockStatusDto>
|
||||
Object? lastTransactionDate = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
equipmentsId: null == equipmentsId
|
||||
? _value.equipmentsId
|
||||
: equipmentsId // ignore: cast_nullable_to_non_nullable
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehousesId: null == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
warehouseId: null == warehouseId
|
||||
? _value.warehouseId
|
||||
: warehouseId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentSerial: null == equipmentSerial
|
||||
? _value.equipmentSerial
|
||||
@@ -126,8 +127,8 @@ abstract class _$$StockStatusDtoImplCopyWith<$Res>
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'equipments_id') int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') int warehousesId,
|
||||
{@JsonKey(name: 'equipment_id') int equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') int warehouseId,
|
||||
@JsonKey(name: 'equipment_serial') String equipmentSerial,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
@JsonKey(name: 'warehouse_name') String warehouseName,
|
||||
@@ -148,8 +149,8 @@ class __$$StockStatusDtoImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentsId = null,
|
||||
Object? warehousesId = null,
|
||||
Object? equipmentId = null,
|
||||
Object? warehouseId = null,
|
||||
Object? equipmentSerial = null,
|
||||
Object? modelName = freezed,
|
||||
Object? warehouseName = null,
|
||||
@@ -157,13 +158,13 @@ class __$$StockStatusDtoImplCopyWithImpl<$Res>
|
||||
Object? lastTransactionDate = freezed,
|
||||
}) {
|
||||
return _then(_$StockStatusDtoImpl(
|
||||
equipmentsId: null == equipmentsId
|
||||
? _value.equipmentsId
|
||||
: equipmentsId // ignore: cast_nullable_to_non_nullable
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehousesId: null == warehousesId
|
||||
? _value.warehousesId
|
||||
: warehousesId // ignore: cast_nullable_to_non_nullable
|
||||
warehouseId: null == warehouseId
|
||||
? _value.warehouseId
|
||||
: warehouseId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentSerial: null == equipmentSerial
|
||||
? _value.equipmentSerial
|
||||
@@ -193,8 +194,8 @@ class __$$StockStatusDtoImplCopyWithImpl<$Res>
|
||||
@JsonSerializable()
|
||||
class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
const _$StockStatusDtoImpl(
|
||||
{@JsonKey(name: 'equipments_id') required this.equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required this.warehousesId,
|
||||
{@JsonKey(name: 'equipment_id') required this.equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') required this.warehouseId,
|
||||
@JsonKey(name: 'equipment_serial') required this.equipmentSerial,
|
||||
@JsonKey(name: 'model_name') this.modelName,
|
||||
@JsonKey(name: 'warehouse_name') required this.warehouseName,
|
||||
@@ -204,12 +205,13 @@ class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
factory _$StockStatusDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$StockStatusDtoImplFromJson(json);
|
||||
|
||||
// 백엔드 StockStatusResponse와 정확히 매핑
|
||||
@override
|
||||
@JsonKey(name: 'equipments_id')
|
||||
final int equipmentsId;
|
||||
@JsonKey(name: 'equipment_id')
|
||||
final int equipmentId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
final int warehousesId;
|
||||
@JsonKey(name: 'warehouse_id')
|
||||
final int warehouseId;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_serial')
|
||||
final String equipmentSerial;
|
||||
@@ -228,7 +230,7 @@ class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StockStatusDto(equipmentsId: $equipmentsId, warehousesId: $warehousesId, equipmentSerial: $equipmentSerial, modelName: $modelName, warehouseName: $warehouseName, currentQuantity: $currentQuantity, lastTransactionDate: $lastTransactionDate)';
|
||||
return 'StockStatusDto(equipmentId: $equipmentId, warehouseId: $warehouseId, equipmentSerial: $equipmentSerial, modelName: $modelName, warehouseName: $warehouseName, currentQuantity: $currentQuantity, lastTransactionDate: $lastTransactionDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -236,10 +238,10 @@ class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$StockStatusDtoImpl &&
|
||||
(identical(other.equipmentsId, equipmentsId) ||
|
||||
other.equipmentsId == equipmentsId) &&
|
||||
(identical(other.warehousesId, warehousesId) ||
|
||||
other.warehousesId == warehousesId) &&
|
||||
(identical(other.equipmentId, equipmentId) ||
|
||||
other.equipmentId == equipmentId) &&
|
||||
(identical(other.warehouseId, warehouseId) ||
|
||||
other.warehouseId == warehouseId) &&
|
||||
(identical(other.equipmentSerial, equipmentSerial) ||
|
||||
other.equipmentSerial == equipmentSerial) &&
|
||||
(identical(other.modelName, modelName) ||
|
||||
@@ -256,8 +258,8 @@ class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
equipmentsId,
|
||||
warehousesId,
|
||||
equipmentId,
|
||||
warehouseId,
|
||||
equipmentSerial,
|
||||
modelName,
|
||||
warehouseName,
|
||||
@@ -283,8 +285,8 @@ class _$StockStatusDtoImpl implements _StockStatusDto {
|
||||
|
||||
abstract class _StockStatusDto implements StockStatusDto {
|
||||
const factory _StockStatusDto(
|
||||
{@JsonKey(name: 'equipments_id') required final int equipmentsId,
|
||||
@JsonKey(name: 'warehouses_id') required final int warehousesId,
|
||||
{@JsonKey(name: 'equipment_id') required final int equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') required final int warehouseId,
|
||||
@JsonKey(name: 'equipment_serial') required final String equipmentSerial,
|
||||
@JsonKey(name: 'model_name') final String? modelName,
|
||||
@JsonKey(name: 'warehouse_name') required final String warehouseName,
|
||||
@@ -295,12 +297,13 @@ abstract class _StockStatusDto implements StockStatusDto {
|
||||
factory _StockStatusDto.fromJson(Map<String, dynamic> json) =
|
||||
_$StockStatusDtoImpl.fromJson;
|
||||
|
||||
// 백엔드 StockStatusResponse와 정확히 매핑
|
||||
@override
|
||||
@JsonKey(name: 'equipments_id')
|
||||
int get equipmentsId;
|
||||
@JsonKey(name: 'equipment_id')
|
||||
int get equipmentId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses_id')
|
||||
int get warehousesId;
|
||||
@JsonKey(name: 'warehouse_id')
|
||||
int get warehouseId;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_serial')
|
||||
String get equipmentSerial;
|
||||
|
||||
@@ -8,8 +8,8 @@ part of 'stock_status_dto.dart';
|
||||
|
||||
_$StockStatusDtoImpl _$$StockStatusDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$StockStatusDtoImpl(
|
||||
equipmentsId: (json['equipments_id'] as num).toInt(),
|
||||
warehousesId: (json['warehouses_id'] as num).toInt(),
|
||||
equipmentId: (json['equipment_id'] as num).toInt(),
|
||||
warehouseId: (json['warehouse_id'] as num).toInt(),
|
||||
equipmentSerial: json['equipment_serial'] as String,
|
||||
modelName: json['model_name'] as String?,
|
||||
warehouseName: json['warehouse_name'] as String,
|
||||
@@ -22,8 +22,8 @@ _$StockStatusDtoImpl _$$StockStatusDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
Map<String, dynamic> _$$StockStatusDtoImplToJson(
|
||||
_$StockStatusDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'equipments_id': instance.equipmentsId,
|
||||
'warehouses_id': instance.warehousesId,
|
||||
'equipment_id': instance.equipmentId,
|
||||
'warehouse_id': instance.warehouseId,
|
||||
'equipment_serial': instance.equipmentSerial,
|
||||
'model_name': instance.modelName,
|
||||
'warehouse_name': instance.warehouseName,
|
||||
|
||||
Reference in New Issue
Block a user