fix: 페이지네이션 로직 개선 및 상세 로그 추가
- 모든 관리 화면(회사, 장비, 입고지, 유지보수)의 페이지네이션 로직 통일 - Controller에서 전체 데이터 로드, View에서만 페이지네이션 처리 - 각 화면에 상세한 터미널 로그 추가로 데이터 로드 상태 추적 가능 - 회사 DTO에 지점 정보 포함 기능 추가 - 전체 79개 회사 중 14개만 표시되던 문제 해결
This commit is contained in:
@@ -1,6 +1,19 @@
|
|||||||
# Superport API 개선 사항
|
# Superport API 개선 사항
|
||||||
|
|
||||||
## 1. 회사 목록 API에 company_types 필드 누락
|
## 1. ✅ [해결됨] 회사 목록 API에 company_types 필드 누락 및 제거 대응
|
||||||
|
|
||||||
|
### 최종 해결 내역 (2025-01-09)
|
||||||
|
- **백엔드 변경사항**:
|
||||||
|
- company_types 필드 제거 예정
|
||||||
|
- is_partner, is_customer 필드로 대체
|
||||||
|
|
||||||
|
- **프론트엔드 대응 (완료)**:
|
||||||
|
- CompanyListDto, CompanyResponse, CompanyBranchFlatDto에 is_partner, is_customer 필드 추가 (@Default(false))
|
||||||
|
- CompanyService 변환 로직 수정 (하위 호환성 유지):
|
||||||
|
- company_types가 있으면 우선 사용
|
||||||
|
- company_types가 없으면 is_partner/is_customer 사용
|
||||||
|
- 둘 다 없으면 빈 리스트 반환
|
||||||
|
- 사이드 이펙트 없음 확인 (테스트 완료)
|
||||||
|
|
||||||
### 현재 상황
|
### 현재 상황
|
||||||
- **문제 엔드포인트**:
|
- **문제 엔드포인트**:
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ class CompanyBranchFlatDto with _$CompanyBranchFlatDto {
|
|||||||
@JsonKey(name: 'company_name') required String companyName,
|
@JsonKey(name: 'company_name') required String companyName,
|
||||||
@JsonKey(name: 'branch_id') int? branchId,
|
@JsonKey(name: 'branch_id') int? branchId,
|
||||||
@JsonKey(name: 'branch_name') String? branchName,
|
@JsonKey(name: 'branch_name') String? branchName,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
|
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
|
||||||
}) = _CompanyBranchFlatDto;
|
}) = _CompanyBranchFlatDto;
|
||||||
|
|
||||||
factory CompanyBranchFlatDto.fromJson(Map<String, dynamic> json) =>
|
factory CompanyBranchFlatDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ mixin _$CompanyBranchFlatDto {
|
|||||||
int? get branchId => throw _privateConstructorUsedError;
|
int? get branchId => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'branch_name')
|
@JsonKey(name: 'branch_name')
|
||||||
String? get branchName => throw _privateConstructorUsedError;
|
String? get branchName => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this CompanyBranchFlatDto to a JSON map.
|
/// Serializes this CompanyBranchFlatDto to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@@ -49,7 +55,10 @@ abstract class $CompanyBranchFlatDtoCopyWith<$Res> {
|
|||||||
{@JsonKey(name: 'company_id') int companyId,
|
{@JsonKey(name: 'company_id') int companyId,
|
||||||
@JsonKey(name: 'company_name') String companyName,
|
@JsonKey(name: 'company_name') String companyName,
|
||||||
@JsonKey(name: 'branch_id') int? branchId,
|
@JsonKey(name: 'branch_id') int? branchId,
|
||||||
@JsonKey(name: 'branch_name') String? branchName});
|
@JsonKey(name: 'branch_name') String? branchName,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -72,6 +81,9 @@ class _$CompanyBranchFlatDtoCopyWithImpl<$Res,
|
|||||||
Object? companyName = null,
|
Object? companyName = null,
|
||||||
Object? branchId = freezed,
|
Object? branchId = freezed,
|
||||||
Object? branchName = freezed,
|
Object? branchName = freezed,
|
||||||
|
Object? companyTypes = freezed,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
companyId: null == companyId
|
companyId: null == companyId
|
||||||
@@ -90,6 +102,18 @@ class _$CompanyBranchFlatDtoCopyWithImpl<$Res,
|
|||||||
? _value.branchName
|
? _value.branchName
|
||||||
: branchName // ignore: cast_nullable_to_non_nullable
|
: branchName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
companyTypes: freezed == companyTypes
|
||||||
|
? _value.companyTypes
|
||||||
|
: companyTypes // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,7 +130,10 @@ abstract class _$$CompanyBranchFlatDtoImplCopyWith<$Res>
|
|||||||
{@JsonKey(name: 'company_id') int companyId,
|
{@JsonKey(name: 'company_id') int companyId,
|
||||||
@JsonKey(name: 'company_name') String companyName,
|
@JsonKey(name: 'company_name') String companyName,
|
||||||
@JsonKey(name: 'branch_id') int? branchId,
|
@JsonKey(name: 'branch_id') int? branchId,
|
||||||
@JsonKey(name: 'branch_name') String? branchName});
|
@JsonKey(name: 'branch_name') String? branchName,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -126,6 +153,9 @@ class __$$CompanyBranchFlatDtoImplCopyWithImpl<$Res>
|
|||||||
Object? companyName = null,
|
Object? companyName = null,
|
||||||
Object? branchId = freezed,
|
Object? branchId = freezed,
|
||||||
Object? branchName = freezed,
|
Object? branchName = freezed,
|
||||||
|
Object? companyTypes = freezed,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CompanyBranchFlatDtoImpl(
|
return _then(_$CompanyBranchFlatDtoImpl(
|
||||||
companyId: null == companyId
|
companyId: null == companyId
|
||||||
@@ -144,6 +174,18 @@ class __$$CompanyBranchFlatDtoImplCopyWithImpl<$Res>
|
|||||||
? _value.branchName
|
? _value.branchName
|
||||||
: branchName // ignore: cast_nullable_to_non_nullable
|
: branchName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
companyTypes: freezed == companyTypes
|
||||||
|
? _value._companyTypes
|
||||||
|
: companyTypes // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +197,11 @@ class _$CompanyBranchFlatDtoImpl implements _CompanyBranchFlatDto {
|
|||||||
{@JsonKey(name: 'company_id') required this.companyId,
|
{@JsonKey(name: 'company_id') required this.companyId,
|
||||||
@JsonKey(name: 'company_name') required this.companyName,
|
@JsonKey(name: 'company_name') required this.companyName,
|
||||||
@JsonKey(name: 'branch_id') this.branchId,
|
@JsonKey(name: 'branch_id') this.branchId,
|
||||||
@JsonKey(name: 'branch_name') this.branchName});
|
@JsonKey(name: 'branch_name') this.branchName,
|
||||||
|
@JsonKey(name: 'company_types') final List<String>? companyTypes,
|
||||||
|
@JsonKey(name: 'is_partner') this.isPartner = false,
|
||||||
|
@JsonKey(name: 'is_customer') this.isCustomer = false})
|
||||||
|
: _companyTypes = companyTypes;
|
||||||
|
|
||||||
factory _$CompanyBranchFlatDtoImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$CompanyBranchFlatDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$CompanyBranchFlatDtoImplFromJson(json);
|
_$$CompanyBranchFlatDtoImplFromJson(json);
|
||||||
@@ -172,10 +218,27 @@ class _$CompanyBranchFlatDtoImpl implements _CompanyBranchFlatDto {
|
|||||||
@override
|
@override
|
||||||
@JsonKey(name: 'branch_name')
|
@JsonKey(name: 'branch_name')
|
||||||
final String? branchName;
|
final String? branchName;
|
||||||
|
final List<String>? _companyTypes;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes {
|
||||||
|
final value = _companyTypes;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_companyTypes is EqualUnmodifiableListView) return _companyTypes;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
final bool isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
final bool isCustomer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CompanyBranchFlatDto(companyId: $companyId, companyName: $companyName, branchId: $branchId, branchName: $branchName)';
|
return 'CompanyBranchFlatDto(companyId: $companyId, companyName: $companyName, branchId: $branchId, branchName: $branchName, companyTypes: $companyTypes, isPartner: $isPartner, isCustomer: $isCustomer)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -190,13 +253,26 @@ class _$CompanyBranchFlatDtoImpl implements _CompanyBranchFlatDto {
|
|||||||
(identical(other.branchId, branchId) ||
|
(identical(other.branchId, branchId) ||
|
||||||
other.branchId == branchId) &&
|
other.branchId == branchId) &&
|
||||||
(identical(other.branchName, branchName) ||
|
(identical(other.branchName, branchName) ||
|
||||||
other.branchName == branchName));
|
other.branchName == branchName) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._companyTypes, _companyTypes) &&
|
||||||
|
(identical(other.isPartner, isPartner) ||
|
||||||
|
other.isPartner == isPartner) &&
|
||||||
|
(identical(other.isCustomer, isCustomer) ||
|
||||||
|
other.isCustomer == isCustomer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => Object.hash(
|
||||||
Object.hash(runtimeType, companyId, companyName, branchId, branchName);
|
runtimeType,
|
||||||
|
companyId,
|
||||||
|
companyName,
|
||||||
|
branchId,
|
||||||
|
branchName,
|
||||||
|
const DeepCollectionEquality().hash(_companyTypes),
|
||||||
|
isPartner,
|
||||||
|
isCustomer);
|
||||||
|
|
||||||
/// Create a copy of CompanyBranchFlatDto
|
/// Create a copy of CompanyBranchFlatDto
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -221,7 +297,10 @@ abstract class _CompanyBranchFlatDto implements CompanyBranchFlatDto {
|
|||||||
{@JsonKey(name: 'company_id') required final int companyId,
|
{@JsonKey(name: 'company_id') required final int companyId,
|
||||||
@JsonKey(name: 'company_name') required final String companyName,
|
@JsonKey(name: 'company_name') required final String companyName,
|
||||||
@JsonKey(name: 'branch_id') final int? branchId,
|
@JsonKey(name: 'branch_id') final int? branchId,
|
||||||
@JsonKey(name: 'branch_name') final String? branchName}) =
|
@JsonKey(name: 'branch_name') final String? branchName,
|
||||||
|
@JsonKey(name: 'company_types') final List<String>? companyTypes,
|
||||||
|
@JsonKey(name: 'is_partner') final bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') final bool isCustomer}) =
|
||||||
_$CompanyBranchFlatDtoImpl;
|
_$CompanyBranchFlatDtoImpl;
|
||||||
|
|
||||||
factory _CompanyBranchFlatDto.fromJson(Map<String, dynamic> json) =
|
factory _CompanyBranchFlatDto.fromJson(Map<String, dynamic> json) =
|
||||||
@@ -239,6 +318,15 @@ abstract class _CompanyBranchFlatDto implements CompanyBranchFlatDto {
|
|||||||
@override
|
@override
|
||||||
@JsonKey(name: 'branch_name')
|
@JsonKey(name: 'branch_name')
|
||||||
String? get branchName;
|
String? get branchName;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer;
|
||||||
|
|
||||||
/// Create a copy of CompanyBranchFlatDto
|
/// Create a copy of CompanyBranchFlatDto
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ _$CompanyBranchFlatDtoImpl _$$CompanyBranchFlatDtoImplFromJson(
|
|||||||
companyName: json['company_name'] as String,
|
companyName: json['company_name'] as String,
|
||||||
branchId: (json['branch_id'] as num?)?.toInt(),
|
branchId: (json['branch_id'] as num?)?.toInt(),
|
||||||
branchName: json['branch_name'] as String?,
|
branchName: json['branch_name'] as String?,
|
||||||
|
companyTypes: (json['company_types'] as List<dynamic>?)
|
||||||
|
?.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
|
isPartner: json['is_partner'] as bool? ?? false,
|
||||||
|
isCustomer: json['is_customer'] as bool? ?? false,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$CompanyBranchFlatDtoImplToJson(
|
Map<String, dynamic> _$$CompanyBranchFlatDtoImplToJson(
|
||||||
@@ -22,4 +27,7 @@ Map<String, dynamic> _$$CompanyBranchFlatDtoImplToJson(
|
|||||||
'company_name': instance.companyName,
|
'company_name': instance.companyName,
|
||||||
'branch_id': instance.branchId,
|
'branch_id': instance.branchId,
|
||||||
'branch_name': instance.branchName,
|
'branch_name': instance.branchName,
|
||||||
|
'company_types': instance.companyTypes,
|
||||||
|
'is_partner': instance.isPartner,
|
||||||
|
'is_customer': instance.isCustomer,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class CompanyResponse with _$CompanyResponse {
|
|||||||
@JsonKey(name: 'company_types') @Default([]) List<String> companyTypes,
|
@JsonKey(name: 'company_types') @Default([]) List<String> companyTypes,
|
||||||
String? remark,
|
String? remark,
|
||||||
@JsonKey(name: 'is_active') required bool isActive,
|
@JsonKey(name: 'is_active') required bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') required DateTime createdAt,
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
||||||
@JsonKey(name: 'updated_at') DateTime? updatedAt, // nullable로 변경
|
@JsonKey(name: 'updated_at') DateTime? updatedAt, // nullable로 변경
|
||||||
@JsonKey(name: 'address_id') int? addressId,
|
@JsonKey(name: 'address_id') int? addressId,
|
||||||
|
|||||||
@@ -730,6 +730,10 @@ mixin _$CompanyResponse {
|
|||||||
String? get remark => throw _privateConstructorUsedError;
|
String? get remark => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
bool get isActive => throw _privateConstructorUsedError;
|
bool get isActive => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'updated_at')
|
@JsonKey(name: 'updated_at')
|
||||||
@@ -764,6 +768,8 @@ abstract class $CompanyResponseCopyWith<$Res> {
|
|||||||
@JsonKey(name: 'company_types') List<String> companyTypes,
|
@JsonKey(name: 'company_types') List<String> companyTypes,
|
||||||
String? remark,
|
String? remark,
|
||||||
@JsonKey(name: 'is_active') bool isActive,
|
@JsonKey(name: 'is_active') bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') DateTime createdAt,
|
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||||
@JsonKey(name: 'address_id') int? addressId});
|
@JsonKey(name: 'address_id') int? addressId});
|
||||||
@@ -794,6 +800,8 @@ class _$CompanyResponseCopyWithImpl<$Res, $Val extends CompanyResponse>
|
|||||||
Object? companyTypes = null,
|
Object? companyTypes = null,
|
||||||
Object? remark = freezed,
|
Object? remark = freezed,
|
||||||
Object? isActive = null,
|
Object? isActive = null,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
Object? createdAt = null,
|
Object? createdAt = null,
|
||||||
Object? updatedAt = freezed,
|
Object? updatedAt = freezed,
|
||||||
Object? addressId = freezed,
|
Object? addressId = freezed,
|
||||||
@@ -839,6 +847,14 @@ class _$CompanyResponseCopyWithImpl<$Res, $Val extends CompanyResponse>
|
|||||||
? _value.isActive
|
? _value.isActive
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
: isActive // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
createdAt: null == createdAt
|
createdAt: null == createdAt
|
||||||
? _value.createdAt
|
? _value.createdAt
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -874,6 +890,8 @@ abstract class _$$CompanyResponseImplCopyWith<$Res>
|
|||||||
@JsonKey(name: 'company_types') List<String> companyTypes,
|
@JsonKey(name: 'company_types') List<String> companyTypes,
|
||||||
String? remark,
|
String? remark,
|
||||||
@JsonKey(name: 'is_active') bool isActive,
|
@JsonKey(name: 'is_active') bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') DateTime createdAt,
|
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||||
@JsonKey(name: 'address_id') int? addressId});
|
@JsonKey(name: 'address_id') int? addressId});
|
||||||
@@ -902,6 +920,8 @@ class __$$CompanyResponseImplCopyWithImpl<$Res>
|
|||||||
Object? companyTypes = null,
|
Object? companyTypes = null,
|
||||||
Object? remark = freezed,
|
Object? remark = freezed,
|
||||||
Object? isActive = null,
|
Object? isActive = null,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
Object? createdAt = null,
|
Object? createdAt = null,
|
||||||
Object? updatedAt = freezed,
|
Object? updatedAt = freezed,
|
||||||
Object? addressId = freezed,
|
Object? addressId = freezed,
|
||||||
@@ -947,6 +967,14 @@ class __$$CompanyResponseImplCopyWithImpl<$Res>
|
|||||||
? _value.isActive
|
? _value.isActive
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
: isActive // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
createdAt: null == createdAt
|
createdAt: null == createdAt
|
||||||
? _value.createdAt
|
? _value.createdAt
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -978,6 +1006,8 @@ class _$CompanyResponseImpl implements _CompanyResponse {
|
|||||||
final List<String> companyTypes = const [],
|
final List<String> companyTypes = const [],
|
||||||
this.remark,
|
this.remark,
|
||||||
@JsonKey(name: 'is_active') required this.isActive,
|
@JsonKey(name: 'is_active') required this.isActive,
|
||||||
|
@JsonKey(name: 'is_partner') this.isPartner = false,
|
||||||
|
@JsonKey(name: 'is_customer') this.isCustomer = false,
|
||||||
@JsonKey(name: 'created_at') required this.createdAt,
|
@JsonKey(name: 'created_at') required this.createdAt,
|
||||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
@JsonKey(name: 'updated_at') this.updatedAt,
|
||||||
@JsonKey(name: 'address_id') this.addressId})
|
@JsonKey(name: 'address_id') this.addressId})
|
||||||
@@ -1020,6 +1050,12 @@ class _$CompanyResponseImpl implements _CompanyResponse {
|
|||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
final bool isActive;
|
final bool isActive;
|
||||||
@override
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
final bool isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
final bool isCustomer;
|
||||||
|
@override
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
@override
|
@override
|
||||||
@@ -1032,7 +1068,7 @@ class _$CompanyResponseImpl implements _CompanyResponse {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CompanyResponse(id: $id, name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, remark: $remark, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, addressId: $addressId)';
|
return 'CompanyResponse(id: $id, name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, remark: $remark, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, createdAt: $createdAt, updatedAt: $updatedAt, addressId: $addressId)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1056,6 +1092,10 @@ class _$CompanyResponseImpl implements _CompanyResponse {
|
|||||||
(identical(other.remark, remark) || other.remark == remark) &&
|
(identical(other.remark, remark) || other.remark == remark) &&
|
||||||
(identical(other.isActive, isActive) ||
|
(identical(other.isActive, isActive) ||
|
||||||
other.isActive == isActive) &&
|
other.isActive == isActive) &&
|
||||||
|
(identical(other.isPartner, isPartner) ||
|
||||||
|
other.isPartner == isPartner) &&
|
||||||
|
(identical(other.isCustomer, isCustomer) ||
|
||||||
|
other.isCustomer == isCustomer) &&
|
||||||
(identical(other.createdAt, createdAt) ||
|
(identical(other.createdAt, createdAt) ||
|
||||||
other.createdAt == createdAt) &&
|
other.createdAt == createdAt) &&
|
||||||
(identical(other.updatedAt, updatedAt) ||
|
(identical(other.updatedAt, updatedAt) ||
|
||||||
@@ -1078,6 +1118,8 @@ class _$CompanyResponseImpl implements _CompanyResponse {
|
|||||||
const DeepCollectionEquality().hash(_companyTypes),
|
const DeepCollectionEquality().hash(_companyTypes),
|
||||||
remark,
|
remark,
|
||||||
isActive,
|
isActive,
|
||||||
|
isPartner,
|
||||||
|
isCustomer,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
addressId);
|
addressId);
|
||||||
@@ -1111,6 +1153,8 @@ abstract class _CompanyResponse implements CompanyResponse {
|
|||||||
@JsonKey(name: 'company_types') final List<String> companyTypes,
|
@JsonKey(name: 'company_types') final List<String> companyTypes,
|
||||||
final String? remark,
|
final String? remark,
|
||||||
@JsonKey(name: 'is_active') required final bool isActive,
|
@JsonKey(name: 'is_active') required final bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') final bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') final bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') required final DateTime createdAt,
|
@JsonKey(name: 'created_at') required final DateTime createdAt,
|
||||||
@JsonKey(name: 'updated_at') final DateTime? updatedAt,
|
@JsonKey(name: 'updated_at') final DateTime? updatedAt,
|
||||||
@JsonKey(name: 'address_id') final int? addressId}) =
|
@JsonKey(name: 'address_id') final int? addressId}) =
|
||||||
@@ -1146,6 +1190,12 @@ abstract class _CompanyResponse implements CompanyResponse {
|
|||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
bool get isActive;
|
bool get isActive;
|
||||||
@override
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer;
|
||||||
|
@override
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
DateTime get createdAt;
|
DateTime get createdAt;
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ _$CompanyResponseImpl _$$CompanyResponseImplFromJson(
|
|||||||
const [],
|
const [],
|
||||||
remark: json['remark'] as String?,
|
remark: json['remark'] as String?,
|
||||||
isActive: json['is_active'] as bool,
|
isActive: json['is_active'] as bool,
|
||||||
|
isPartner: json['is_partner'] as bool? ?? false,
|
||||||
|
isCustomer: json['is_customer'] as bool? ?? false,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: json['updated_at'] == null
|
updatedAt: json['updated_at'] == null
|
||||||
? null
|
? null
|
||||||
@@ -101,6 +103,8 @@ Map<String, dynamic> _$$CompanyResponseImplToJson(
|
|||||||
'company_types': instance.companyTypes,
|
'company_types': instance.companyTypes,
|
||||||
'remark': instance.remark,
|
'remark': instance.remark,
|
||||||
'is_active': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
|
'is_partner': instance.isPartner,
|
||||||
|
'is_customer': instance.isCustomer,
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
'updated_at': instance.updatedAt?.toIso8601String(),
|
'updated_at': instance.updatedAt?.toIso8601String(),
|
||||||
'address_id': instance.addressId,
|
'address_id': instance.addressId,
|
||||||
|
|||||||
@@ -10,11 +10,14 @@ class CompanyListDto with _$CompanyListDto {
|
|||||||
const factory CompanyListDto({
|
const factory CompanyListDto({
|
||||||
required int id,
|
required int id,
|
||||||
required String name,
|
required String name,
|
||||||
required String address,
|
String? address,
|
||||||
@JsonKey(name: 'contact_name') String? contactName,
|
@JsonKey(name: 'contact_name') String? contactName,
|
||||||
@JsonKey(name: 'contact_phone') String? contactPhone,
|
@JsonKey(name: 'contact_phone') String? contactPhone,
|
||||||
@JsonKey(name: 'contact_email') String? contactEmail,
|
@JsonKey(name: 'contact_email') String? contactEmail,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
@JsonKey(name: 'is_active') required bool isActive,
|
@JsonKey(name: 'is_active') required bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||||
@JsonKey(name: 'branch_count') @Default(0) int branchCount,
|
@JsonKey(name: 'branch_count') @Default(0) int branchCount,
|
||||||
}) = _CompanyListDto;
|
}) = _CompanyListDto;
|
||||||
|
|||||||
@@ -22,15 +22,21 @@ CompanyListDto _$CompanyListDtoFromJson(Map<String, dynamic> json) {
|
|||||||
mixin _$CompanyListDto {
|
mixin _$CompanyListDto {
|
||||||
int get id => throw _privateConstructorUsedError;
|
int get id => throw _privateConstructorUsedError;
|
||||||
String get name => throw _privateConstructorUsedError;
|
String get name => throw _privateConstructorUsedError;
|
||||||
String get address => throw _privateConstructorUsedError;
|
String? get address => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'contact_name')
|
@JsonKey(name: 'contact_name')
|
||||||
String? get contactName => throw _privateConstructorUsedError;
|
String? get contactName => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'contact_phone')
|
@JsonKey(name: 'contact_phone')
|
||||||
String? get contactPhone => throw _privateConstructorUsedError;
|
String? get contactPhone => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'contact_email')
|
@JsonKey(name: 'contact_email')
|
||||||
String? get contactEmail => throw _privateConstructorUsedError;
|
String? get contactEmail => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
bool get isActive => throw _privateConstructorUsedError;
|
bool get isActive => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
DateTime? get createdAt => throw _privateConstructorUsedError;
|
DateTime? get createdAt => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'branch_count')
|
@JsonKey(name: 'branch_count')
|
||||||
@@ -55,11 +61,14 @@ abstract class $CompanyListDtoCopyWith<$Res> {
|
|||||||
$Res call(
|
$Res call(
|
||||||
{int id,
|
{int id,
|
||||||
String name,
|
String name,
|
||||||
String address,
|
String? address,
|
||||||
@JsonKey(name: 'contact_name') String? contactName,
|
@JsonKey(name: 'contact_name') String? contactName,
|
||||||
@JsonKey(name: 'contact_phone') String? contactPhone,
|
@JsonKey(name: 'contact_phone') String? contactPhone,
|
||||||
@JsonKey(name: 'contact_email') String? contactEmail,
|
@JsonKey(name: 'contact_email') String? contactEmail,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
@JsonKey(name: 'is_active') bool isActive,
|
@JsonKey(name: 'is_active') bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||||
@JsonKey(name: 'branch_count') int branchCount});
|
@JsonKey(name: 'branch_count') int branchCount});
|
||||||
}
|
}
|
||||||
@@ -81,11 +90,14 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? id = null,
|
Object? id = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? address = null,
|
Object? address = freezed,
|
||||||
Object? contactName = freezed,
|
Object? contactName = freezed,
|
||||||
Object? contactPhone = freezed,
|
Object? contactPhone = freezed,
|
||||||
Object? contactEmail = freezed,
|
Object? contactEmail = freezed,
|
||||||
|
Object? companyTypes = freezed,
|
||||||
Object? isActive = null,
|
Object? isActive = null,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
Object? createdAt = freezed,
|
Object? createdAt = freezed,
|
||||||
Object? branchCount = null,
|
Object? branchCount = null,
|
||||||
}) {
|
}) {
|
||||||
@@ -98,10 +110,10 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
|
|||||||
? _value.name
|
? _value.name
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
address: null == address
|
address: freezed == address
|
||||||
? _value.address
|
? _value.address
|
||||||
: address // ignore: cast_nullable_to_non_nullable
|
: address // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
contactName: freezed == contactName
|
contactName: freezed == contactName
|
||||||
? _value.contactName
|
? _value.contactName
|
||||||
: contactName // ignore: cast_nullable_to_non_nullable
|
: contactName // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -114,10 +126,22 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
|
|||||||
? _value.contactEmail
|
? _value.contactEmail
|
||||||
: contactEmail // ignore: cast_nullable_to_non_nullable
|
: contactEmail // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
companyTypes: freezed == companyTypes
|
||||||
|
? _value.companyTypes
|
||||||
|
: companyTypes // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
isActive: null == isActive
|
isActive: null == isActive
|
||||||
? _value.isActive
|
? _value.isActive
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
: isActive // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
createdAt: freezed == createdAt
|
createdAt: freezed == createdAt
|
||||||
? _value.createdAt
|
? _value.createdAt
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -141,11 +165,14 @@ abstract class _$$CompanyListDtoImplCopyWith<$Res>
|
|||||||
$Res call(
|
$Res call(
|
||||||
{int id,
|
{int id,
|
||||||
String name,
|
String name,
|
||||||
String address,
|
String? address,
|
||||||
@JsonKey(name: 'contact_name') String? contactName,
|
@JsonKey(name: 'contact_name') String? contactName,
|
||||||
@JsonKey(name: 'contact_phone') String? contactPhone,
|
@JsonKey(name: 'contact_phone') String? contactPhone,
|
||||||
@JsonKey(name: 'contact_email') String? contactEmail,
|
@JsonKey(name: 'contact_email') String? contactEmail,
|
||||||
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
||||||
@JsonKey(name: 'is_active') bool isActive,
|
@JsonKey(name: 'is_active') bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||||
@JsonKey(name: 'branch_count') int branchCount});
|
@JsonKey(name: 'branch_count') int branchCount});
|
||||||
}
|
}
|
||||||
@@ -165,11 +192,14 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? id = null,
|
Object? id = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? address = null,
|
Object? address = freezed,
|
||||||
Object? contactName = freezed,
|
Object? contactName = freezed,
|
||||||
Object? contactPhone = freezed,
|
Object? contactPhone = freezed,
|
||||||
Object? contactEmail = freezed,
|
Object? contactEmail = freezed,
|
||||||
|
Object? companyTypes = freezed,
|
||||||
Object? isActive = null,
|
Object? isActive = null,
|
||||||
|
Object? isPartner = null,
|
||||||
|
Object? isCustomer = null,
|
||||||
Object? createdAt = freezed,
|
Object? createdAt = freezed,
|
||||||
Object? branchCount = null,
|
Object? branchCount = null,
|
||||||
}) {
|
}) {
|
||||||
@@ -182,10 +212,10 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
|
|||||||
? _value.name
|
? _value.name
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
address: null == address
|
address: freezed == address
|
||||||
? _value.address
|
? _value.address
|
||||||
: address // ignore: cast_nullable_to_non_nullable
|
: address // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
contactName: freezed == contactName
|
contactName: freezed == contactName
|
||||||
? _value.contactName
|
? _value.contactName
|
||||||
: contactName // ignore: cast_nullable_to_non_nullable
|
: contactName // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -198,10 +228,22 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
|
|||||||
? _value.contactEmail
|
? _value.contactEmail
|
||||||
: contactEmail // ignore: cast_nullable_to_non_nullable
|
: contactEmail // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
companyTypes: freezed == companyTypes
|
||||||
|
? _value._companyTypes
|
||||||
|
: companyTypes // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
isActive: null == isActive
|
isActive: null == isActive
|
||||||
? _value.isActive
|
? _value.isActive
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
: isActive // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
isPartner: null == isPartner
|
||||||
|
? _value.isPartner
|
||||||
|
: isPartner // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isCustomer: null == isCustomer
|
||||||
|
? _value.isCustomer
|
||||||
|
: isCustomer // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
createdAt: freezed == createdAt
|
createdAt: freezed == createdAt
|
||||||
? _value.createdAt
|
? _value.createdAt
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -220,13 +262,17 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
const _$CompanyListDtoImpl(
|
const _$CompanyListDtoImpl(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.address,
|
this.address,
|
||||||
@JsonKey(name: 'contact_name') this.contactName,
|
@JsonKey(name: 'contact_name') this.contactName,
|
||||||
@JsonKey(name: 'contact_phone') this.contactPhone,
|
@JsonKey(name: 'contact_phone') this.contactPhone,
|
||||||
@JsonKey(name: 'contact_email') this.contactEmail,
|
@JsonKey(name: 'contact_email') this.contactEmail,
|
||||||
|
@JsonKey(name: 'company_types') final List<String>? companyTypes,
|
||||||
@JsonKey(name: 'is_active') required this.isActive,
|
@JsonKey(name: 'is_active') required this.isActive,
|
||||||
|
@JsonKey(name: 'is_partner') this.isPartner = false,
|
||||||
|
@JsonKey(name: 'is_customer') this.isCustomer = false,
|
||||||
@JsonKey(name: 'created_at') this.createdAt,
|
@JsonKey(name: 'created_at') this.createdAt,
|
||||||
@JsonKey(name: 'branch_count') this.branchCount = 0});
|
@JsonKey(name: 'branch_count') this.branchCount = 0})
|
||||||
|
: _companyTypes = companyTypes;
|
||||||
|
|
||||||
factory _$CompanyListDtoImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$CompanyListDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$CompanyListDtoImplFromJson(json);
|
_$$CompanyListDtoImplFromJson(json);
|
||||||
@@ -236,7 +282,7 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
@override
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
@override
|
@override
|
||||||
final String address;
|
final String? address;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'contact_name')
|
@JsonKey(name: 'contact_name')
|
||||||
final String? contactName;
|
final String? contactName;
|
||||||
@@ -246,10 +292,27 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
@override
|
@override
|
||||||
@JsonKey(name: 'contact_email')
|
@JsonKey(name: 'contact_email')
|
||||||
final String? contactEmail;
|
final String? contactEmail;
|
||||||
|
final List<String>? _companyTypes;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes {
|
||||||
|
final value = _companyTypes;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_companyTypes is EqualUnmodifiableListView) return _companyTypes;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
final bool isActive;
|
final bool isActive;
|
||||||
@override
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
final bool isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
final bool isCustomer;
|
||||||
|
@override
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
final DateTime? createdAt;
|
final DateTime? createdAt;
|
||||||
@override
|
@override
|
||||||
@@ -258,7 +321,7 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CompanyListDto(id: $id, name: $name, address: $address, contactName: $contactName, contactPhone: $contactPhone, contactEmail: $contactEmail, isActive: $isActive, createdAt: $createdAt, branchCount: $branchCount)';
|
return 'CompanyListDto(id: $id, name: $name, address: $address, contactName: $contactName, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, createdAt: $createdAt, branchCount: $branchCount)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -275,8 +338,14 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
other.contactPhone == contactPhone) &&
|
other.contactPhone == contactPhone) &&
|
||||||
(identical(other.contactEmail, contactEmail) ||
|
(identical(other.contactEmail, contactEmail) ||
|
||||||
other.contactEmail == contactEmail) &&
|
other.contactEmail == contactEmail) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._companyTypes, _companyTypes) &&
|
||||||
(identical(other.isActive, isActive) ||
|
(identical(other.isActive, isActive) ||
|
||||||
other.isActive == isActive) &&
|
other.isActive == isActive) &&
|
||||||
|
(identical(other.isPartner, isPartner) ||
|
||||||
|
other.isPartner == isPartner) &&
|
||||||
|
(identical(other.isCustomer, isCustomer) ||
|
||||||
|
other.isCustomer == isCustomer) &&
|
||||||
(identical(other.createdAt, createdAt) ||
|
(identical(other.createdAt, createdAt) ||
|
||||||
other.createdAt == createdAt) &&
|
other.createdAt == createdAt) &&
|
||||||
(identical(other.branchCount, branchCount) ||
|
(identical(other.branchCount, branchCount) ||
|
||||||
@@ -285,8 +354,20 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
|
|||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, id, name, address, contactName,
|
int get hashCode => Object.hash(
|
||||||
contactPhone, contactEmail, isActive, createdAt, branchCount);
|
runtimeType,
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
address,
|
||||||
|
contactName,
|
||||||
|
contactPhone,
|
||||||
|
contactEmail,
|
||||||
|
const DeepCollectionEquality().hash(_companyTypes),
|
||||||
|
isActive,
|
||||||
|
isPartner,
|
||||||
|
isCustomer,
|
||||||
|
createdAt,
|
||||||
|
branchCount);
|
||||||
|
|
||||||
/// Create a copy of CompanyListDto
|
/// Create a copy of CompanyListDto
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -309,11 +390,14 @@ abstract class _CompanyListDto implements CompanyListDto {
|
|||||||
const factory _CompanyListDto(
|
const factory _CompanyListDto(
|
||||||
{required final int id,
|
{required final int id,
|
||||||
required final String name,
|
required final String name,
|
||||||
required final String address,
|
final String? address,
|
||||||
@JsonKey(name: 'contact_name') final String? contactName,
|
@JsonKey(name: 'contact_name') final String? contactName,
|
||||||
@JsonKey(name: 'contact_phone') final String? contactPhone,
|
@JsonKey(name: 'contact_phone') final String? contactPhone,
|
||||||
@JsonKey(name: 'contact_email') final String? contactEmail,
|
@JsonKey(name: 'contact_email') final String? contactEmail,
|
||||||
|
@JsonKey(name: 'company_types') final List<String>? companyTypes,
|
||||||
@JsonKey(name: 'is_active') required final bool isActive,
|
@JsonKey(name: 'is_active') required final bool isActive,
|
||||||
|
@JsonKey(name: 'is_partner') final bool isPartner,
|
||||||
|
@JsonKey(name: 'is_customer') final bool isCustomer,
|
||||||
@JsonKey(name: 'created_at') final DateTime? createdAt,
|
@JsonKey(name: 'created_at') final DateTime? createdAt,
|
||||||
@JsonKey(name: 'branch_count') final int branchCount}) =
|
@JsonKey(name: 'branch_count') final int branchCount}) =
|
||||||
_$CompanyListDtoImpl;
|
_$CompanyListDtoImpl;
|
||||||
@@ -326,7 +410,7 @@ abstract class _CompanyListDto implements CompanyListDto {
|
|||||||
@override
|
@override
|
||||||
String get name;
|
String get name;
|
||||||
@override
|
@override
|
||||||
String get address;
|
String? get address;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'contact_name')
|
@JsonKey(name: 'contact_name')
|
||||||
String? get contactName;
|
String? get contactName;
|
||||||
@@ -337,9 +421,18 @@ abstract class _CompanyListDto implements CompanyListDto {
|
|||||||
@JsonKey(name: 'contact_email')
|
@JsonKey(name: 'contact_email')
|
||||||
String? get contactEmail;
|
String? get contactEmail;
|
||||||
@override
|
@override
|
||||||
|
@JsonKey(name: 'company_types')
|
||||||
|
List<String>? get companyTypes;
|
||||||
|
@override
|
||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
bool get isActive;
|
bool get isActive;
|
||||||
@override
|
@override
|
||||||
|
@JsonKey(name: 'is_partner')
|
||||||
|
bool get isPartner;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_customer')
|
||||||
|
bool get isCustomer;
|
||||||
|
@override
|
||||||
@JsonKey(name: 'created_at')
|
@JsonKey(name: 'created_at')
|
||||||
DateTime? get createdAt;
|
DateTime? get createdAt;
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -10,11 +10,16 @@ _$CompanyListDtoImpl _$$CompanyListDtoImplFromJson(Map<String, dynamic> json) =>
|
|||||||
_$CompanyListDtoImpl(
|
_$CompanyListDtoImpl(
|
||||||
id: (json['id'] as num).toInt(),
|
id: (json['id'] as num).toInt(),
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
address: json['address'] as String,
|
address: json['address'] as String?,
|
||||||
contactName: json['contact_name'] as String?,
|
contactName: json['contact_name'] as String?,
|
||||||
contactPhone: json['contact_phone'] as String?,
|
contactPhone: json['contact_phone'] as String?,
|
||||||
contactEmail: json['contact_email'] as String?,
|
contactEmail: json['contact_email'] as String?,
|
||||||
|
companyTypes: (json['company_types'] as List<dynamic>?)
|
||||||
|
?.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
isActive: json['is_active'] as bool,
|
isActive: json['is_active'] as bool,
|
||||||
|
isPartner: json['is_partner'] as bool? ?? false,
|
||||||
|
isCustomer: json['is_customer'] as bool? ?? false,
|
||||||
createdAt: json['created_at'] == null
|
createdAt: json['created_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
@@ -30,7 +35,10 @@ Map<String, dynamic> _$$CompanyListDtoImplToJson(
|
|||||||
'contact_name': instance.contactName,
|
'contact_name': instance.contactName,
|
||||||
'contact_phone': instance.contactPhone,
|
'contact_phone': instance.contactPhone,
|
||||||
'contact_email': instance.contactEmail,
|
'contact_email': instance.contactEmail,
|
||||||
|
'company_types': instance.companyTypes,
|
||||||
'is_active': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
|
'is_partner': instance.isPartner,
|
||||||
|
'is_customer': instance.isCustomer,
|
||||||
'created_at': instance.createdAt?.toIso8601String(),
|
'created_at': instance.createdAt?.toIso8601String(),
|
||||||
'branch_count': instance.branchCount,
|
'branch_count': instance.branchCount,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -253,6 +253,14 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
final int startIndex = (_currentPage - 1) * _pageSize;
|
final int startIndex = (_currentPage - 1) * _pageSize;
|
||||||
final int endIndex = startIndex + _pageSize;
|
final int endIndex = startIndex + _pageSize;
|
||||||
|
|
||||||
|
// 디버그 로그 추가
|
||||||
|
print('🔍 [VIEW DEBUG] 화면 페이지네이션 상태');
|
||||||
|
print(' • filteredCompanies 수: ${controller.filteredCompanies.length}개');
|
||||||
|
print(' • displayCompanies 수: ${displayCompanies.length}개 (지점 포함)');
|
||||||
|
print(' • 현재 페이지: $_currentPage');
|
||||||
|
print(' • 페이지 크기: $_pageSize');
|
||||||
|
print(' • startIndex: $startIndex, endIndex: $endIndex');
|
||||||
|
|
||||||
// startIndex가 displayCompanies.length보다 크거나 같으면 첫 페이지로 리셋
|
// startIndex가 displayCompanies.length보다 크거나 같으면 첫 페이지로 리셋
|
||||||
if (startIndex >= displayCompanies.length && displayCompanies.isNotEmpty) {
|
if (startIndex >= displayCompanies.length && displayCompanies.isNotEmpty) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
@@ -265,10 +273,12 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
final List<Map<String, dynamic>> pagedCompanies = displayCompanies.isEmpty
|
final List<Map<String, dynamic>> pagedCompanies = displayCompanies.isEmpty
|
||||||
? []
|
? []
|
||||||
: displayCompanies.sublist(
|
: displayCompanies.sublist(
|
||||||
startIndex.clamp(0, displayCompanies.length - 1),
|
startIndex.clamp(0, displayCompanies.length),
|
||||||
endIndex.clamp(0, displayCompanies.length),
|
endIndex.clamp(0, displayCompanies.length),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print(' • 화면에 표시될 항목 수: ${pagedCompanies.length}개');
|
||||||
|
|
||||||
// 로딩 상태
|
// 로딩 상태
|
||||||
if (controller.isLoading && controller.companies.isEmpty) {
|
if (controller.isLoading && controller.companies.isEmpty) {
|
||||||
return const StandardLoadingState(message: '회사 데이터를 불러오는 중...');
|
return const StandardLoadingState(message: '회사 데이터를 불러오는 중...');
|
||||||
|
|||||||
@@ -38,17 +38,26 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 초기 데이터 로드
|
// 초기 데이터 로드
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🚀 회사 목록 초기화 시작');
|
||||||
|
print('║ • 페이지 크기: $_perPage개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
await loadData(isRefresh: true);
|
await loadData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 페이지 크기를 지정하여 초기화
|
// 페이지 크기를 지정하여 초기화
|
||||||
Future<void> initializeWithPageSize(int pageSize) async {
|
Future<void> initializeWithPageSize(int pageSize) async {
|
||||||
_perPage = pageSize;
|
_perPage = pageSize;
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🚀 회사 목록 초기화 시작 (커스텀 페이지 크기)');
|
||||||
|
print('║ • 페이지 크기: $_perPage개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
await loadData(isRefresh: true);
|
await loadData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 데이터 로드 및 필터 적용
|
// 데이터 로드 및 필터 적용
|
||||||
Future<void> loadData({bool isRefresh = false}) async {
|
Future<void> loadData({bool isRefresh = false}) async {
|
||||||
|
print('🔍 [DEBUG] loadData 시작 - currentPage: $_currentPage, hasMore: $_hasMore, companies.length: ${companies.length}');
|
||||||
print('[CompanyListController] loadData called - isRefresh: $isRefresh');
|
print('[CompanyListController] loadData called - isRefresh: $isRefresh');
|
||||||
|
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
@@ -71,15 +80,34 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 지점 정보를 포함한 전체 회사 목록 가져오기
|
// 지점 정보를 포함한 전체 회사 목록 가져오기
|
||||||
final apiCompaniesWithBranches = await _companyService.getCompaniesWithBranchesFlat();
|
final apiCompaniesWithBranches = await _companyService.getCompaniesWithBranchesFlat();
|
||||||
print('[CompanyListController] API returned ${apiCompaniesWithBranches.length} companies with branches');
|
|
||||||
|
|
||||||
// 지점 수 출력
|
// 상세한 회사 정보 로그 출력
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 📊 회사 목록 로드 완료');
|
||||||
|
print('║ ▶ 총 회사 수: ${apiCompaniesWithBranches.length}개');
|
||||||
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
|
|
||||||
|
// 지점이 있는 회사와 없는 회사 구분
|
||||||
|
int companiesWithBranches = 0;
|
||||||
|
int totalBranches = 0;
|
||||||
|
|
||||||
for (final company in apiCompaniesWithBranches) {
|
for (final company in apiCompaniesWithBranches) {
|
||||||
if (company.branches?.isNotEmpty ?? false) {
|
if (company.branches?.isNotEmpty ?? false) {
|
||||||
print('[CompanyListController] ${company.name} has ${company.branches?.length ?? 0} branches');
|
companiesWithBranches++;
|
||||||
|
totalBranches += company.branches!.length;
|
||||||
|
print('║ • ${company.name}: ${company.branches!.length}개 지점');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final companiesWithoutBranches = apiCompaniesWithBranches.length - companiesWithBranches;
|
||||||
|
|
||||||
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
|
print('║ 📈 통계');
|
||||||
|
print('║ • 지점이 있는 회사: ${companiesWithBranches}개');
|
||||||
|
print('║ • 지점이 없는 회사: ${companiesWithoutBranches}개');
|
||||||
|
print('║ • 총 지점 수: ${totalBranches}개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
// 검색어 필터 적용 (서버에서 필터링이 안 되므로 클라이언트에서 처리)
|
// 검색어 필터 적용 (서버에서 필터링이 안 되므로 클라이언트에서 처리)
|
||||||
List<Company> filteredApiCompanies = apiCompaniesWithBranches;
|
List<Company> filteredApiCompanies = apiCompaniesWithBranches;
|
||||||
if (searchKeyword.isNotEmpty) {
|
if (searchKeyword.isNotEmpty) {
|
||||||
@@ -89,6 +117,13 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
(company.contactName?.toLowerCase().contains(keyword) ?? false) ||
|
(company.contactName?.toLowerCase().contains(keyword) ?? false) ||
|
||||||
(company.contactPhone?.toLowerCase().contains(keyword) ?? false);
|
(company.contactPhone?.toLowerCase().contains(keyword) ?? false);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🔍 검색 필터 적용');
|
||||||
|
print('║ • 검색어: "$searchKeyword"');
|
||||||
|
print('║ • 필터 전: ${apiCompaniesWithBranches.length}개');
|
||||||
|
print('║ • 필터 후: ${filteredApiCompanies.length}개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 활성 상태 필터 적용 (현재 API에서 지원하지 않으므로 주석 처리)
|
// 활성 상태 필터 적용 (현재 API에서 지원하지 않으므로 주석 처리)
|
||||||
@@ -96,30 +131,36 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
// filteredApiCompanies = filteredApiCompanies.where((c) => c.isActive == _isActiveFilter).toList();
|
// filteredApiCompanies = filteredApiCompanies.where((c) => c.isActive == _isActiveFilter).toList();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 페이지네이션 처리 (클라이언트 사이드)
|
// 전체 데이터를 한 번에 로드 (View에서 페이지네이션 처리)
|
||||||
final startIndex = (_currentPage - 1) * _perPage;
|
companies = filteredApiCompanies;
|
||||||
final endIndex = startIndex + _perPage;
|
_hasMore = false; // 전체 데이터를 로드했으므로 더 이상 로드할 필요 없음
|
||||||
final paginatedCompanies = filteredApiCompanies.skip(startIndex).take(_perPage).toList();
|
|
||||||
|
|
||||||
if (isRefresh) {
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
companies = paginatedCompanies;
|
print('║ 📑 전체 데이터 로드 완료');
|
||||||
} else {
|
print('║ • 로드된 회사 수: ${companies.length}개');
|
||||||
companies.addAll(paginatedCompanies);
|
print('║ • 필터링된 회사 수: ${filteredApiCompanies.length}개');
|
||||||
}
|
print('║ • View에서 페이지네이션 처리 예정');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
_hasMore = endIndex < filteredApiCompanies.length;
|
|
||||||
if (_hasMore) _currentPage++;
|
|
||||||
} else {
|
} else {
|
||||||
// Mock 데이터 사용
|
// Mock 데이터 사용
|
||||||
print('[CompanyListController] Using Mock data');
|
|
||||||
companies = dataService.getAllCompanies();
|
companies = dataService.getAllCompanies();
|
||||||
print('[CompanyListController] Mock returned ${companies.length} companies');
|
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🔧 Mock 데이터 로드 완료');
|
||||||
|
print('║ ▶ 총 회사 수: ${companies.length}개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
_hasMore = false;
|
_hasMore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 필터 적용
|
// 필터 적용
|
||||||
applyFilters();
|
applyFilters();
|
||||||
print('[CompanyListController] After filtering: ${filteredCompanies.length} companies shown');
|
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ ✅ 최종 화면 표시');
|
||||||
|
print('║ • 화면에 표시될 회사 수: ${filteredCompanies.length}개');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
selectedCompanyIds.clear();
|
selectedCompanyIds.clear();
|
||||||
} on Failure catch (e) {
|
} on Failure catch (e) {
|
||||||
print('[CompanyListController] Failure loading companies: ${e.message}');
|
print('[CompanyListController] Failure loading companies: ${e.message}');
|
||||||
@@ -165,6 +206,17 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
// 검색어 변경
|
// 검색어 변경
|
||||||
Future<void> updateSearchKeyword(String keyword) async {
|
Future<void> updateSearchKeyword(String keyword) async {
|
||||||
searchKeyword = keyword;
|
searchKeyword = keyword;
|
||||||
|
|
||||||
|
if (keyword.isNotEmpty) {
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🔍 검색어 변경: "$keyword"');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
} else {
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ ❌ 검색어 초기화');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
}
|
||||||
|
|
||||||
if (_useApi) {
|
if (_useApi) {
|
||||||
// API 사용 시 새로 조회
|
// API 사용 시 새로 조회
|
||||||
await loadData(isRefresh: true);
|
await loadData(isRefresh: true);
|
||||||
@@ -275,7 +327,12 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 더 많은 데이터 로드
|
// 더 많은 데이터 로드
|
||||||
Future<void> loadMore() async {
|
Future<void> loadMore() async {
|
||||||
if (!_hasMore || _isLoading || !_useApi) return;
|
print('🔍 [DEBUG] loadMore 호출됨 - hasMore: $_hasMore, isLoading: $_isLoading, useApi: $_useApi');
|
||||||
|
if (!_hasMore || _isLoading || !_useApi) {
|
||||||
|
print('🔍 [DEBUG] loadMore 조건 미충족으로 종료 (hasMore: $_hasMore, isLoading: $_isLoading, useApi: $_useApi)');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
print('🔍 [DEBUG] loadMore 실행 - 추가 데이터 로드 시작');
|
||||||
await loadData();
|
await loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,6 +350,9 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 리프레시
|
// 리프레시
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🔄 회사 목록 새로고침 시작');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
await loadData(isRefresh: true);
|
await loadData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,7 @@ class EquipmentListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 데이터 로드 및 상태 필터 적용
|
// 데이터 로드 및 상태 필터 적용
|
||||||
Future<void> loadData({bool isRefresh = false, String? search}) async {
|
Future<void> loadData({bool isRefresh = false, String? search}) async {
|
||||||
if (isRefresh) {
|
if (_isLoading) return;
|
||||||
_currentPage = 1;
|
|
||||||
_hasMore = true;
|
|
||||||
equipments.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_isLoading || (!_hasMore && !isRefresh)) return;
|
|
||||||
|
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_error = null;
|
_error = null;
|
||||||
@@ -58,31 +52,42 @@ class EquipmentListController extends ChangeNotifier {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (_useApi) {
|
if (_useApi) {
|
||||||
// API 호출
|
// API 호출 - 전체 데이터 로드
|
||||||
DebugLogger.log('장비 목록 API 호출 시작', tag: 'EQUIPMENT', data: {
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
'page': _currentPage,
|
print('║ 📦 장비 목록 API 호출 시작');
|
||||||
'perPage': _perPage,
|
print('║ • 상태 필터: ${selectedStatusFilter ?? "전체"}');
|
||||||
'statusFilter': selectedStatusFilter,
|
print('║ • 검색어: ${search ?? searchKeyword}');
|
||||||
});
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
// DTO 형태로 가져와서 status 정보 유지
|
// 전체 데이터를 가져오기 위해 큰 perPage 값 사용
|
||||||
final apiEquipmentDtos = await _equipmentService.getEquipmentsWithStatus(
|
final apiEquipmentDtos = await _equipmentService.getEquipmentsWithStatus(
|
||||||
page: _currentPage,
|
page: 1,
|
||||||
perPage: _perPage,
|
perPage: 1000, // 충분히 큰 값으로 전체 데이터 로드
|
||||||
status: selectedStatusFilter != null ? EquipmentStatusConverter.clientToServer(selectedStatusFilter) : null,
|
status: selectedStatusFilter != null ? EquipmentStatusConverter.clientToServer(selectedStatusFilter) : null,
|
||||||
search: search ?? searchKeyword,
|
search: search ?? searchKeyword,
|
||||||
);
|
);
|
||||||
|
|
||||||
DebugLogger.log('장비 목록 API 응답', tag: 'EQUIPMENT', data: {
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
'count': apiEquipmentDtos.length,
|
print('║ 📊 장비 목록 로드 완료');
|
||||||
'firstItem': apiEquipmentDtos.isNotEmpty ? {
|
print('║ ▶ 총 장비 수: ${apiEquipmentDtos.length}개');
|
||||||
'id': apiEquipmentDtos.first.id,
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
'equipmentNumber': apiEquipmentDtos.first.equipmentNumber,
|
|
||||||
'manufacturer': apiEquipmentDtos.first.manufacturer,
|
// 상태별 통계
|
||||||
'status': apiEquipmentDtos.first.status,
|
Map<String, int> statusCount = {};
|
||||||
} : null,
|
for (final dto in apiEquipmentDtos) {
|
||||||
|
final clientStatus = EquipmentStatusConverter.serverToClient(dto.status);
|
||||||
|
statusCount[clientStatus] = (statusCount[clientStatus] ?? 0) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusCount.forEach((status, count) {
|
||||||
|
print('║ • $status: $count개');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
|
print('║ 📑 전체 데이터 로드 완료');
|
||||||
|
print('║ • View에서 페이지네이션 처리 예정');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
// DTO를 UnifiedEquipment로 변환 (status 정보 포함)
|
// DTO를 UnifiedEquipment로 변환 (status 정보 포함)
|
||||||
final List<UnifiedEquipment> unifiedEquipments = apiEquipmentDtos.map((dto) {
|
final List<UnifiedEquipment> unifiedEquipments = apiEquipmentDtos.map((dto) {
|
||||||
final equipment = Equipment(
|
final equipment = Equipment(
|
||||||
@@ -105,14 +110,8 @@ class EquipmentListController extends ChangeNotifier {
|
|||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
if (isRefresh) {
|
equipments = unifiedEquipments;
|
||||||
equipments = unifiedEquipments;
|
_hasMore = false; // 전체 데이터를 로드했으므로 더 이상 로드할 필요 없음
|
||||||
} else {
|
|
||||||
equipments.addAll(unifiedEquipments);
|
|
||||||
}
|
|
||||||
|
|
||||||
_hasMore = unifiedEquipments.length == _perPage;
|
|
||||||
if (_hasMore) _currentPage++;
|
|
||||||
} else {
|
} else {
|
||||||
// Mock 데이터 사용
|
// Mock 데이터 사용
|
||||||
equipments = dataService.getAllEquipments();
|
equipments = dataService.getAllEquipments();
|
||||||
|
|||||||
@@ -90,48 +90,65 @@ class LicenseListController extends ChangeNotifier {
|
|||||||
|
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_error = null;
|
_error = null;
|
||||||
|
|
||||||
if (isInitialLoad) {
|
|
||||||
_currentPage = 1;
|
|
||||||
_licenses.clear();
|
|
||||||
_hasMore = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (useApi && GetIt.instance.isRegistered<LicenseService>()) {
|
if (useApi && GetIt.instance.isRegistered<LicenseService>()) {
|
||||||
debugPrint('📑 API 모드로 라이센스 로드 시작...');
|
// API 사용 - 전체 데이터 로드
|
||||||
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🔧 유지보수 목록 API 호출 시작');
|
||||||
|
print('║ • 회사 필터: ${_selectedCompanyId ?? "전체"}');
|
||||||
|
print('║ • 활성 필터: ${_isActive != null ? (_isActive! ? "활성" : "비활성") : "전체"}');
|
||||||
|
print('║ • 라이센스 타입: ${_licenseType ?? "전체"}');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
// API 사용
|
// 전체 데이터를 가져오기 위해 큰 perPage 값 사용
|
||||||
final fetchedLicenses = await _licenseService.getLicenses(
|
final fetchedLicenses = await _licenseService.getLicenses(
|
||||||
page: _currentPage,
|
page: 1,
|
||||||
perPage: _pageSize,
|
perPage: 1000, // 충분히 큰 값으로 전체 데이터 로드
|
||||||
isActive: _isActive,
|
isActive: _isActive,
|
||||||
companyId: _selectedCompanyId,
|
companyId: _selectedCompanyId,
|
||||||
licenseType: _licenseType,
|
licenseType: _licenseType,
|
||||||
);
|
);
|
||||||
|
|
||||||
debugPrint('📑 API에서 ${fetchedLicenses.length}개 라이센스 받음');
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 📊 유지보수 목록 로드 완료');
|
||||||
|
print('║ ▶ 총 라이센스 수: ${fetchedLicenses.length}개');
|
||||||
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
|
|
||||||
if (isInitialLoad) {
|
// 상태별 통계
|
||||||
_licenses = fetchedLicenses;
|
int activeCount = 0;
|
||||||
debugPrint('📑 초기 로드: _licenses에 ${_licenses.length}개 저장');
|
int expiringSoonCount = 0;
|
||||||
} else {
|
int expiredCount = 0;
|
||||||
_licenses.addAll(fetchedLicenses);
|
final now = DateTime.now();
|
||||||
debugPrint('📑 추가 로드: _licenses에 총 ${_licenses.length}개');
|
|
||||||
|
for (final license in fetchedLicenses) {
|
||||||
|
if (license.expiryDate != null) {
|
||||||
|
final daysUntil = license.expiryDate!.difference(now).inDays;
|
||||||
|
if (daysUntil < 0) {
|
||||||
|
expiredCount++;
|
||||||
|
} else if (daysUntil <= 30) {
|
||||||
|
expiringSoonCount++;
|
||||||
|
} else {
|
||||||
|
activeCount++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activeCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_hasMore = fetchedLicenses.length >= _pageSize;
|
print('║ • 활성: $activeCount개');
|
||||||
|
print('║ • 만료 임박 (30일 이내): $expiringSoonCount개');
|
||||||
|
print('║ • 만료됨: $expiredCount개');
|
||||||
|
|
||||||
// 전체 개수 조회
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
debugPrint('📑 전체 개수 조회 시작...');
|
print('║ 📑 전체 데이터 로드 완료');
|
||||||
_total = await _licenseService.getTotalLicenses(
|
print('║ • View에서 페이지네이션 처리 예정');
|
||||||
isActive: _isActive,
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
companyId: _selectedCompanyId,
|
|
||||||
licenseType: _licenseType,
|
_licenses = fetchedLicenses;
|
||||||
);
|
_hasMore = false; // 전체 데이터를 로드했으므로 더 이상 로드할 필요 없음
|
||||||
debugPrint('📑 전체 개수: $_total');
|
_total = fetchedLicenses.length;
|
||||||
} else {
|
} else {
|
||||||
// Mock 데이터 사용
|
// Mock 데이터 사용
|
||||||
final allLicenses = mockDataService?.getAllLicenses() ?? [];
|
final allLicenses = mockDataService?.getAllLicenses() ?? [];
|
||||||
|
|||||||
@@ -46,47 +46,51 @@ class WarehouseLocationListController extends ChangeNotifier {
|
|||||||
Future<void> loadWarehouseLocations({bool isInitialLoad = true}) async {
|
Future<void> loadWarehouseLocations({bool isInitialLoad = true}) async {
|
||||||
if (_isLoading) return;
|
if (_isLoading) return;
|
||||||
|
|
||||||
print('[WarehouseLocationListController] loadWarehouseLocations started - isInitialLoad: $isInitialLoad');
|
|
||||||
|
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_error = null;
|
_error = null;
|
||||||
|
|
||||||
if (isInitialLoad) {
|
|
||||||
_currentPage = 1;
|
|
||||||
_warehouseLocations.clear();
|
|
||||||
_hasMore = true;
|
|
||||||
} else {
|
|
||||||
// 다음 페이지를 로드할 때는 페이지 번호를 먼저 증가
|
|
||||||
_currentPage++;
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (useApi && _warehouseService != null) {
|
if (useApi && _warehouseService != null) {
|
||||||
// API 사용
|
// API 사용 - 전체 데이터 로드
|
||||||
print('[WarehouseLocationListController] Using API to fetch warehouse locations');
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 🏭 입고지 목록 API 호출 시작');
|
||||||
|
print('║ • 활성 필터: ${_isActive != null ? (_isActive! ? "활성" : "비활성") : "전체"}');
|
||||||
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
|
|
||||||
|
// 전체 데이터를 가져오기 위해 큰 perPage 값 사용
|
||||||
final fetchedLocations = await _warehouseService!.getWarehouseLocations(
|
final fetchedLocations = await _warehouseService!.getWarehouseLocations(
|
||||||
page: _currentPage,
|
page: 1,
|
||||||
perPage: _pageSize,
|
perPage: 1000, // 충분히 큰 값으로 전체 데이터 로드
|
||||||
isActive: _isActive,
|
isActive: _isActive,
|
||||||
);
|
);
|
||||||
|
|
||||||
print('[WarehouseLocationListController] API returned ${fetchedLocations.length} locations');
|
print('╔══════════════════════════════════════════════════════════');
|
||||||
|
print('║ 📊 입고지 목록 로드 완료');
|
||||||
|
print('║ ▶ 총 입고지 수: ${fetchedLocations.length}개');
|
||||||
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
|
|
||||||
if (isInitialLoad) {
|
// 상태별 통계 (입고지에 상태가 있다면)
|
||||||
_warehouseLocations = fetchedLocations;
|
int activeCount = 0;
|
||||||
} else {
|
int inactiveCount = 0;
|
||||||
_warehouseLocations.addAll(fetchedLocations);
|
for (final location in fetchedLocations) {
|
||||||
|
// isActive 필드가 있다면 활용
|
||||||
|
activeCount++; // 현재는 모두 활성으로 가정
|
||||||
}
|
}
|
||||||
|
|
||||||
_hasMore = fetchedLocations.length >= _pageSize;
|
print('║ • 활성 입고지: $activeCount개');
|
||||||
|
if (inactiveCount > 0) {
|
||||||
|
print('║ • 비활성 입고지: $inactiveCount개');
|
||||||
|
}
|
||||||
|
|
||||||
// 전체 개수 조회
|
print('╟──────────────────────────────────────────────────────────');
|
||||||
_total = await _warehouseService!.getTotalWarehouseLocations(
|
print('║ 📑 전체 데이터 로드 완료');
|
||||||
isActive: _isActive,
|
print('║ • View에서 페이지네이션 처리 예정');
|
||||||
);
|
print('╚══════════════════════════════════════════════════════════');
|
||||||
print('[WarehouseLocationListController] Total warehouse locations: $_total');
|
|
||||||
|
_warehouseLocations = fetchedLocations;
|
||||||
|
_hasMore = false; // 전체 데이터를 로드했으므로 더 이상 로드할 필요 없음
|
||||||
|
_total = fetchedLocations.length;
|
||||||
} else {
|
} else {
|
||||||
// Mock 데이터 사용
|
// Mock 데이터 사용
|
||||||
print('[WarehouseLocationListController] Using Mock data');
|
print('[WarehouseLocationListController] Using Mock data');
|
||||||
|
|||||||
@@ -271,10 +271,35 @@ class CompanyService {
|
|||||||
// 회사별로 데이터 그룹화
|
// 회사별로 데이터 그룹화
|
||||||
final Map<int, List<Branch>> companyBranchesMap = {};
|
final Map<int, List<Branch>> companyBranchesMap = {};
|
||||||
final Map<int, String> companyNamesMap = {};
|
final Map<int, String> companyNamesMap = {};
|
||||||
|
final Map<int, List<CompanyType>> companyTypesMap = {};
|
||||||
|
final Map<int, bool> companyIsPartnerMap = {};
|
||||||
|
final Map<int, bool> companyIsCustomerMap = {};
|
||||||
|
|
||||||
for (final item in flatData) {
|
for (final item in flatData) {
|
||||||
companyNamesMap[item.companyId] = item.companyName;
|
companyNamesMap[item.companyId] = item.companyName;
|
||||||
|
|
||||||
|
// 첫 번째 아이템에서만 회사 타입 정보 저장
|
||||||
|
if (!companyTypesMap.containsKey(item.companyId)) {
|
||||||
|
List<CompanyType> types = [];
|
||||||
|
|
||||||
|
// 1. company_types 필드가 있으면 우선 사용 (하위 호환성)
|
||||||
|
if (item.companyTypes != null && item.companyTypes!.isNotEmpty) {
|
||||||
|
types = item.companyTypes!.map((typeStr) {
|
||||||
|
if (typeStr.toLowerCase().contains('partner')) return CompanyType.partner;
|
||||||
|
return CompanyType.customer;
|
||||||
|
}).toSet().toList(); // 중복 제거
|
||||||
|
}
|
||||||
|
// 2. company_types가 없으면 is_partner, is_customer 사용
|
||||||
|
else {
|
||||||
|
if (item.isCustomer) types.add(CompanyType.customer);
|
||||||
|
if (item.isPartner) types.add(CompanyType.partner);
|
||||||
|
}
|
||||||
|
|
||||||
|
companyTypesMap[item.companyId] = types;
|
||||||
|
companyIsPartnerMap[item.companyId] = item.isPartner;
|
||||||
|
companyIsCustomerMap[item.companyId] = item.isCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.branchId != null && item.branchName != null) {
|
if (item.branchId != null && item.branchName != null) {
|
||||||
if (!companyBranchesMap.containsKey(item.companyId)) {
|
if (!companyBranchesMap.containsKey(item.companyId)) {
|
||||||
companyBranchesMap[item.companyId] = [];
|
companyBranchesMap[item.companyId] = [];
|
||||||
@@ -298,7 +323,7 @@ class CompanyService {
|
|||||||
id: entry.key,
|
id: entry.key,
|
||||||
name: entry.value,
|
name: entry.value,
|
||||||
address: Address.fromFullAddress(''), // 주소 정보가 없으므로 빈 값
|
address: Address.fromFullAddress(''), // 주소 정보가 없으므로 빈 값
|
||||||
companyTypes: [CompanyType.customer], // 기본값
|
companyTypes: companyTypesMap[entry.key] ?? [], // 빈 리스트 가능
|
||||||
branches: companyBranchesMap[entry.key], // null 허용
|
branches: companyBranchesMap[entry.key], // null 허용
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -317,22 +342,51 @@ class CompanyService {
|
|||||||
|
|
||||||
// 변환 헬퍼 메서드들
|
// 변환 헬퍼 메서드들
|
||||||
Company _convertListDtoToCompany(CompanyListDto dto) {
|
Company _convertListDtoToCompany(CompanyListDto dto) {
|
||||||
|
List<CompanyType> companyTypes = [];
|
||||||
|
|
||||||
|
// 1. company_types 필드가 있으면 우선 사용 (하위 호환성)
|
||||||
|
if (dto.companyTypes != null && dto.companyTypes!.isNotEmpty) {
|
||||||
|
companyTypes = dto.companyTypes!.map((typeStr) {
|
||||||
|
if (typeStr.toLowerCase().contains('partner')) return CompanyType.partner;
|
||||||
|
return CompanyType.customer;
|
||||||
|
}).toSet().toList(); // 중복 제거
|
||||||
|
}
|
||||||
|
// 2. company_types가 없으면 is_partner, is_customer 사용
|
||||||
|
else {
|
||||||
|
if (dto.isCustomer) companyTypes.add(CompanyType.customer);
|
||||||
|
if (dto.isPartner) companyTypes.add(CompanyType.partner);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 둘 다 없으면 빈 리스트 유지 (기본값 제거)
|
||||||
|
|
||||||
return Company(
|
return Company(
|
||||||
id: dto.id,
|
id: dto.id,
|
||||||
name: dto.name,
|
name: dto.name,
|
||||||
address: Address.fromFullAddress(dto.address),
|
address: Address.fromFullAddress(dto.address ?? ''),
|
||||||
contactName: dto.contactName,
|
contactName: dto.contactName,
|
||||||
contactPhone: dto.contactPhone,
|
contactPhone: dto.contactPhone,
|
||||||
companyTypes: [CompanyType.customer], // 기본값, 실제로는 API에서 받아와야 함
|
companyTypes: companyTypes,
|
||||||
branches: [], // branches는 빈 배열로 초기화
|
branches: [], // branches는 빈 배열로 초기화
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Company _convertResponseToCompany(CompanyResponse dto) {
|
Company _convertResponseToCompany(CompanyResponse dto) {
|
||||||
final companyTypes = dto.companyTypes.map((typeStr) {
|
List<CompanyType> companyTypes = [];
|
||||||
if (typeStr.contains('partner')) return CompanyType.partner;
|
|
||||||
return CompanyType.customer;
|
// 1. company_types 필드가 있으면 우선 사용 (하위 호환성)
|
||||||
}).toList();
|
if (dto.companyTypes.isNotEmpty) {
|
||||||
|
companyTypes = dto.companyTypes.map((typeStr) {
|
||||||
|
if (typeStr.toLowerCase().contains('partner')) return CompanyType.partner;
|
||||||
|
return CompanyType.customer;
|
||||||
|
}).toSet().toList(); // 중복 제거
|
||||||
|
}
|
||||||
|
// 2. company_types가 없으면 is_partner, is_customer 사용
|
||||||
|
else {
|
||||||
|
if (dto.isCustomer) companyTypes.add(CompanyType.customer);
|
||||||
|
if (dto.isPartner) companyTypes.add(CompanyType.partner);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 둘 다 없으면 빈 리스트 유지
|
||||||
|
|
||||||
return Company(
|
return Company(
|
||||||
id: dto.id,
|
id: dto.id,
|
||||||
@@ -342,7 +396,7 @@ class CompanyService {
|
|||||||
contactPosition: dto.contactPosition,
|
contactPosition: dto.contactPosition,
|
||||||
contactPhone: dto.contactPhone,
|
contactPhone: dto.contactPhone,
|
||||||
contactEmail: dto.contactEmail,
|
contactEmail: dto.contactEmail,
|
||||||
companyTypes: companyTypes.isEmpty ? [CompanyType.customer] : companyTypes,
|
companyTypes: companyTypes,
|
||||||
remark: dto.remark,
|
remark: dto.remark,
|
||||||
branches: [], // branches는 빈 배열로 초기화
|
branches: [], // branches는 빈 배열로 초기화
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user