first commit
This commit is contained in:
163
app/lib/domain/entities/tour.dart
Normal file
163
app/lib/domain/entities/tour.dart
Normal file
@@ -0,0 +1,163 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class Tour extends Equatable {
|
||||
final int id;
|
||||
final int jobId;
|
||||
final int tourId;
|
||||
final int version;
|
||||
final int state; // 0 = offen, 1 = erledigt, 2 = abgeschlossen
|
||||
final String type;
|
||||
final int sort;
|
||||
final int locationId;
|
||||
final String locationCode;
|
||||
final String? locationCode2;
|
||||
final String? remark;
|
||||
final String? menuText;
|
||||
final int modified;
|
||||
final String? deliveryCode;
|
||||
final String? locationName;
|
||||
final bool isCompleted;
|
||||
final List<TourPage> pages;
|
||||
|
||||
const Tour({
|
||||
required this.id,
|
||||
required this.jobId,
|
||||
required this.tourId,
|
||||
required this.version,
|
||||
required this.state,
|
||||
required this.type,
|
||||
required this.sort,
|
||||
required this.locationId,
|
||||
required this.locationCode,
|
||||
this.locationCode2,
|
||||
this.remark,
|
||||
this.menuText,
|
||||
required this.modified,
|
||||
this.deliveryCode,
|
||||
this.locationName,
|
||||
this.isCompleted = false,
|
||||
this.pages = const [],
|
||||
});
|
||||
|
||||
Tour copyWith({
|
||||
int? id,
|
||||
int? jobId,
|
||||
int? tourId,
|
||||
int? version,
|
||||
int? state,
|
||||
String? type,
|
||||
int? sort,
|
||||
int? locationId,
|
||||
String? locationCode,
|
||||
String? locationCode2,
|
||||
String? remark,
|
||||
String? menuText,
|
||||
int? modified,
|
||||
String? deliveryCode,
|
||||
String? locationName,
|
||||
bool? isCompleted,
|
||||
List<TourPage>? pages,
|
||||
}) {
|
||||
return Tour(
|
||||
id: id ?? this.id,
|
||||
jobId: jobId ?? this.jobId,
|
||||
tourId: tourId ?? this.tourId,
|
||||
version: version ?? this.version,
|
||||
state: state ?? this.state,
|
||||
type: type ?? this.type,
|
||||
sort: sort ?? this.sort,
|
||||
locationId: locationId ?? this.locationId,
|
||||
locationCode: locationCode ?? this.locationCode,
|
||||
locationCode2: locationCode2 ?? this.locationCode2,
|
||||
remark: remark ?? this.remark,
|
||||
menuText: menuText ?? this.menuText,
|
||||
modified: modified ?? this.modified,
|
||||
deliveryCode: deliveryCode ?? this.deliveryCode,
|
||||
locationName: locationName ?? this.locationName,
|
||||
isCompleted: isCompleted ?? this.isCompleted,
|
||||
pages: pages ?? this.pages,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
jobId,
|
||||
tourId,
|
||||
version,
|
||||
state,
|
||||
type,
|
||||
sort,
|
||||
locationId,
|
||||
locationCode,
|
||||
locationCode2,
|
||||
remark,
|
||||
menuText,
|
||||
modified,
|
||||
deliveryCode,
|
||||
locationName,
|
||||
isCompleted,
|
||||
pages,
|
||||
];
|
||||
}
|
||||
|
||||
class TourPage extends Equatable {
|
||||
final int id;
|
||||
final int tourId;
|
||||
final int pageNumber;
|
||||
final String pageId;
|
||||
final String type;
|
||||
final String? code;
|
||||
final String? label;
|
||||
final Map<String, int> pickupCounts;
|
||||
final Map<String, int> swapCounts;
|
||||
|
||||
const TourPage({
|
||||
required this.id,
|
||||
required this.tourId,
|
||||
required this.pageNumber,
|
||||
required this.pageId,
|
||||
required this.type,
|
||||
this.code,
|
||||
this.label,
|
||||
this.pickupCounts = const {},
|
||||
this.swapCounts = const {},
|
||||
});
|
||||
|
||||
TourPage copyWith({
|
||||
int? id,
|
||||
int? tourId,
|
||||
int? pageNumber,
|
||||
String? pageId,
|
||||
String? type,
|
||||
String? code,
|
||||
String? label,
|
||||
Map<String, int>? pickupCounts,
|
||||
Map<String, int>? swapCounts,
|
||||
}) {
|
||||
return TourPage(
|
||||
id: id ?? this.id,
|
||||
tourId: tourId ?? this.tourId,
|
||||
pageNumber: pageNumber ?? this.pageNumber,
|
||||
pageId: pageId ?? this.pageId,
|
||||
type: type ?? this.type,
|
||||
code: code ?? this.code,
|
||||
label: label ?? this.label,
|
||||
pickupCounts: pickupCounts ?? this.pickupCounts,
|
||||
swapCounts: swapCounts ?? this.swapCounts,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
tourId,
|
||||
pageNumber,
|
||||
pageId,
|
||||
type,
|
||||
code,
|
||||
label,
|
||||
pickupCounts,
|
||||
swapCounts,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user