마스터 고객/제품/창고 테스트 및 UI 구현
This commit is contained in:
122
lib/features/masters/customer/domain/entities/customer.dart
Normal file
122
lib/features/masters/customer/domain/entities/customer.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
class Customer {
|
||||
Customer({
|
||||
this.id,
|
||||
required this.customerCode,
|
||||
required this.customerName,
|
||||
this.isPartner = false,
|
||||
this.isGeneral = true,
|
||||
this.email,
|
||||
this.mobileNo,
|
||||
this.zipcode,
|
||||
this.addressDetail,
|
||||
this.isActive = true,
|
||||
this.isDeleted = false,
|
||||
this.note,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String customerCode;
|
||||
final String customerName;
|
||||
final bool isPartner;
|
||||
final bool isGeneral;
|
||||
final String? email;
|
||||
final String? mobileNo;
|
||||
final CustomerZipcode? zipcode;
|
||||
final String? addressDetail;
|
||||
final bool isActive;
|
||||
final bool isDeleted;
|
||||
final String? note;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
Customer copyWith({
|
||||
int? id,
|
||||
String? customerCode,
|
||||
String? customerName,
|
||||
bool? isPartner,
|
||||
bool? isGeneral,
|
||||
String? email,
|
||||
String? mobileNo,
|
||||
CustomerZipcode? zipcode,
|
||||
String? addressDetail,
|
||||
bool? isActive,
|
||||
bool? isDeleted,
|
||||
String? note,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return Customer(
|
||||
id: id ?? this.id,
|
||||
customerCode: customerCode ?? this.customerCode,
|
||||
customerName: customerName ?? this.customerName,
|
||||
isPartner: isPartner ?? this.isPartner,
|
||||
isGeneral: isGeneral ?? this.isGeneral,
|
||||
email: email ?? this.email,
|
||||
mobileNo: mobileNo ?? this.mobileNo,
|
||||
zipcode: zipcode ?? this.zipcode,
|
||||
addressDetail: addressDetail ?? this.addressDetail,
|
||||
isActive: isActive ?? this.isActive,
|
||||
isDeleted: isDeleted ?? this.isDeleted,
|
||||
note: note ?? this.note,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomerZipcode {
|
||||
CustomerZipcode({
|
||||
required this.zipcode,
|
||||
this.sido,
|
||||
this.sigungu,
|
||||
this.roadName,
|
||||
});
|
||||
|
||||
final String zipcode;
|
||||
final String? sido;
|
||||
final String? sigungu;
|
||||
final String? roadName;
|
||||
}
|
||||
|
||||
class CustomerInput {
|
||||
CustomerInput({
|
||||
required this.customerCode,
|
||||
required this.customerName,
|
||||
required this.isPartner,
|
||||
required this.isGeneral,
|
||||
this.email,
|
||||
this.mobileNo,
|
||||
this.zipcode,
|
||||
this.addressDetail,
|
||||
this.isActive = true,
|
||||
this.note,
|
||||
});
|
||||
|
||||
final String customerCode;
|
||||
final String customerName;
|
||||
final bool isPartner;
|
||||
final bool isGeneral;
|
||||
final String? email;
|
||||
final String? mobileNo;
|
||||
final String? zipcode;
|
||||
final String? addressDetail;
|
||||
final bool isActive;
|
||||
final String? note;
|
||||
|
||||
Map<String, dynamic> toPayload() {
|
||||
return {
|
||||
'customer_code': customerCode,
|
||||
'customer_name': customerName,
|
||||
'is_partner': isPartner,
|
||||
'is_general': isGeneral,
|
||||
'email': email,
|
||||
'mobile_no': mobileNo,
|
||||
'zipcode': zipcode,
|
||||
'address_detail': addressDetail,
|
||||
'is_active': isActive,
|
||||
'note': note,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user