Initial commit
This commit is contained in:
216
lib/models/parcel_order_model.dart
Normal file
216
lib/models/parcel_order_model.dart
Normal file
@@ -0,0 +1,216 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:driver/models/tax_model.dart';
|
||||
import 'package:driver/models/user_model.dart';
|
||||
import 'package:driver/models/vendor_model.dart';
|
||||
|
||||
class ParcelOrderModel {
|
||||
UserModel? author;
|
||||
UserModel? driver;
|
||||
|
||||
LocationInformation? sender;
|
||||
Timestamp? senderPickupDateTime;
|
||||
String? id;
|
||||
String? driverId;
|
||||
|
||||
UserLocation? receiverLatLong;
|
||||
bool? paymentCollectByReceiver;
|
||||
List<TaxModel>? taxSetting;
|
||||
String? adminCommissionType;
|
||||
List<dynamic>? rejectedByDrivers;
|
||||
String? adminCommission;
|
||||
List<dynamic>? parcelImages;
|
||||
String? parcelWeight;
|
||||
String? discountType;
|
||||
String? discountLabel;
|
||||
LocationInformation? receiver;
|
||||
String? paymentMethod;
|
||||
String? distance;
|
||||
Timestamp? createdAt;
|
||||
bool? isSchedule;
|
||||
String? subTotal;
|
||||
Timestamp? triggerDelevery;
|
||||
String? status;
|
||||
String? parcelType;
|
||||
bool? sendToDriver;
|
||||
String? sectionId;
|
||||
UserLocation? senderLatLong;
|
||||
String? authorID;
|
||||
String? parcelWeightCharge;
|
||||
String? parcelCategoryID;
|
||||
String? discount;
|
||||
Timestamp? receiverPickupDateTime;
|
||||
String? note;
|
||||
String? senderZoneId;
|
||||
String? receiverZoneId;
|
||||
G? sourcePoint;
|
||||
G? destinationPoint;
|
||||
|
||||
ParcelOrderModel({
|
||||
this.author,
|
||||
this.sender,
|
||||
this.senderPickupDateTime,
|
||||
this.id,
|
||||
this.driverId,
|
||||
this.receiverLatLong,
|
||||
this.paymentCollectByReceiver,
|
||||
this.taxSetting,
|
||||
this.adminCommissionType,
|
||||
this.rejectedByDrivers,
|
||||
this.adminCommission,
|
||||
this.parcelImages,
|
||||
this.parcelWeight,
|
||||
this.discountType,
|
||||
this.discountLabel,
|
||||
this.receiver,
|
||||
this.paymentMethod,
|
||||
this.distance,
|
||||
this.createdAt,
|
||||
this.isSchedule,
|
||||
this.subTotal,
|
||||
this.triggerDelevery,
|
||||
this.status,
|
||||
this.parcelType,
|
||||
this.sendToDriver,
|
||||
this.sectionId,
|
||||
this.senderLatLong,
|
||||
this.authorID,
|
||||
this.parcelWeightCharge,
|
||||
this.parcelCategoryID,
|
||||
this.discount,
|
||||
this.receiverPickupDateTime,
|
||||
this.note,
|
||||
this.senderZoneId,
|
||||
this.sourcePoint,
|
||||
this.destinationPoint,
|
||||
this.receiverZoneId,
|
||||
this.driver,
|
||||
});
|
||||
|
||||
ParcelOrderModel.fromJson(Map<String, dynamic> json) {
|
||||
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
|
||||
driver = json['driver'] != null ? UserModel.fromJson(json['driver']) : null;
|
||||
sender = json['sender'] != null ? LocationInformation.fromJson(json['sender']) : null;
|
||||
senderPickupDateTime = json['senderPickupDateTime'];
|
||||
id = json['id'];
|
||||
driverId = json['driverId'];
|
||||
receiverLatLong = json['receiverLatLong'] != null ? UserLocation.fromJson(json['receiverLatLong']) : null;
|
||||
paymentCollectByReceiver = json['paymentCollectByReceiver'];
|
||||
if (json['taxSetting'] != null) {
|
||||
taxSetting = <TaxModel>[];
|
||||
json['taxSetting'].forEach((v) {
|
||||
taxSetting!.add(TaxModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
adminCommissionType = json['adminCommissionType'];
|
||||
rejectedByDrivers = json['rejectedByDrivers'] ?? [];
|
||||
adminCommission = json['adminCommission'];
|
||||
parcelImages = json['parcelImages'] ?? [];
|
||||
parcelWeight = json['parcelWeight'];
|
||||
discountType = json['discountType'];
|
||||
discountLabel = json['discountLabel'];
|
||||
receiver = json['receiver'] != null ? LocationInformation.fromJson(json['receiver']) : null;
|
||||
paymentMethod = json['payment_method'];
|
||||
distance = json['distance'];
|
||||
createdAt = json['createdAt'];
|
||||
isSchedule = json['isSchedule'];
|
||||
subTotal = json['subTotal'];
|
||||
triggerDelevery = json['trigger_delevery'];
|
||||
status = json['status'];
|
||||
parcelType = json['parcelType'];
|
||||
sendToDriver = json['sendToDriver'];
|
||||
sectionId = json['sectionId'];
|
||||
senderLatLong = json['senderLatLong'] != null ? UserLocation.fromJson(json['senderLatLong']) : null;
|
||||
authorID = json['authorID'];
|
||||
parcelWeightCharge = json['parcelWeightCharge'];
|
||||
parcelCategoryID = json['parcelCategoryID'];
|
||||
discount = json['discount'];
|
||||
receiverPickupDateTime = json['receiverPickupDateTime'];
|
||||
note = json['note'];
|
||||
senderZoneId = json['senderZoneId'];
|
||||
receiverZoneId = json['receiverZoneId'];
|
||||
sourcePoint = json['sourcePoint'] != null ? G.fromJson(json['sourcePoint']) : null;
|
||||
destinationPoint = json['destinationPoint'] != null ? G.fromJson(json['destinationPoint']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (author != null) {
|
||||
data['author'] = author!.toJson();
|
||||
} if (driver != null) {
|
||||
data['driver'] = driver!.toJson();
|
||||
}
|
||||
if (sender != null) {
|
||||
data['sender'] = sender!.toJson();
|
||||
}
|
||||
data['senderPickupDateTime'] = senderPickupDateTime;
|
||||
data['id'] = id;
|
||||
if (receiverLatLong != null) {
|
||||
data['receiverLatLong'] = receiverLatLong!.toJson();
|
||||
}
|
||||
data['paymentCollectByReceiver'] = paymentCollectByReceiver;
|
||||
if (taxSetting != null) {
|
||||
data['taxSetting'] = taxSetting!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['driverId'] = driverId;
|
||||
data['adminCommissionType'] = adminCommissionType;
|
||||
data['rejectedByDrivers'] = rejectedByDrivers;
|
||||
data['adminCommission'] = adminCommission;
|
||||
data['parcelImages'] = parcelImages;
|
||||
data['parcelWeight'] = parcelWeight;
|
||||
data['discountType'] = discountType;
|
||||
data['discountLabel'] = discountLabel;
|
||||
if (receiver != null) {
|
||||
data['receiver'] = receiver!.toJson();
|
||||
}
|
||||
data['payment_method'] = paymentMethod;
|
||||
data['distance'] = distance;
|
||||
data['createdAt'] = createdAt;
|
||||
data['isSchedule'] = isSchedule;
|
||||
data['subTotal'] = subTotal;
|
||||
data['trigger_delevery'] = triggerDelevery;
|
||||
data['status'] = status;
|
||||
data['parcelType'] = parcelType;
|
||||
data['sendToDriver'] = sendToDriver;
|
||||
data['sectionId'] = sectionId;
|
||||
if (senderLatLong != null) {
|
||||
data['senderLatLong'] = senderLatLong!.toJson();
|
||||
}
|
||||
if (sourcePoint != null) {
|
||||
data['sourcePoint'] = sourcePoint!.toJson();
|
||||
}
|
||||
if (destinationPoint != null) {
|
||||
data['destinationPoint'] = destinationPoint!.toJson();
|
||||
}
|
||||
data['authorID'] = authorID;
|
||||
data['parcelWeightCharge'] = parcelWeightCharge;
|
||||
data['parcelCategoryID'] = parcelCategoryID;
|
||||
data['discount'] = discount;
|
||||
data['receiverPickupDateTime'] = receiverPickupDateTime;
|
||||
data['note'] = note;
|
||||
data['senderZoneId'] = senderZoneId;
|
||||
data['receiverZoneId'] = receiverZoneId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LocationInformation {
|
||||
String? address;
|
||||
String? name;
|
||||
String? phone;
|
||||
|
||||
LocationInformation({this.address, this.name, this.phone});
|
||||
|
||||
LocationInformation.fromJson(Map<String, dynamic> json) {
|
||||
address = json['address'];
|
||||
name = json['name'];
|
||||
phone = json['phone'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['address'] = address;
|
||||
data['name'] = name;
|
||||
data['phone'] = phone;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user