151 lines
3.5 KiB
Dart
151 lines
3.5 KiB
Dart
// class GetDeliveredModel {
|
|
// int totalCount;
|
|
// int currentPage;
|
|
// int totalPages;
|
|
// List<Invoice> invoices;
|
|
//
|
|
// GetDeliveredModel({
|
|
// required this.totalCount,
|
|
// required this.currentPage,
|
|
// required this.totalPages,
|
|
// required this.invoices,
|
|
// });
|
|
//
|
|
// factory GetDeliveredModel.fromJson(Map<String, dynamic> json) {
|
|
// return GetDeliveredModel(
|
|
// totalCount: json['totalCount'],
|
|
// currentPage: json['currentPage'],
|
|
// totalPages: json['totalPages'],
|
|
// invoices: List<Invoice>.from(
|
|
// json['invoices'].map((invoice) => Invoice.fromJson(invoice)),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|
|
|
|
class GetDeliveredModel {
|
|
CourierStatusTimeline courierStatusTimeline;
|
|
String id;
|
|
String invoiceId;
|
|
OrderId orderId;
|
|
List<Item> items;
|
|
int subtotal;
|
|
double gstTotal;
|
|
double invoiceAmount;
|
|
String courierStatus;
|
|
int v;
|
|
String courierName;
|
|
String courierTrackingId;
|
|
|
|
GetDeliveredModel({
|
|
required this.courierStatusTimeline,
|
|
required this.id,
|
|
required this.invoiceId,
|
|
required this.orderId,
|
|
required this.items,
|
|
required this.subtotal,
|
|
required this.gstTotal,
|
|
required this.invoiceAmount,
|
|
required this.courierStatus,
|
|
required this.v,
|
|
required this.courierName,
|
|
required this.courierTrackingId,
|
|
});
|
|
|
|
factory GetDeliveredModel.fromJson(Map<String, dynamic> json) {
|
|
return GetDeliveredModel(
|
|
courierStatusTimeline: CourierStatusTimeline.fromJson(
|
|
json['courierstatus_timeline']),
|
|
id: json['_id'],
|
|
invoiceId: json['invoiceId'],
|
|
orderId: OrderId.fromJson(json['orderId']),
|
|
items: List<Item>.from(json['items'].map((item) => Item.fromJson(item))),
|
|
subtotal: json['subtotal'],
|
|
gstTotal: json['gstTotal'].toDouble(),
|
|
invoiceAmount: json['invoiceAmount'].toDouble(),
|
|
courierStatus: json['courierStatus'],
|
|
v: json['__v'],
|
|
courierName: json['courier_name'],
|
|
courierTrackingId: json['courier_tracking_id'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class CourierStatusTimeline {
|
|
String processing;
|
|
String dispatched;
|
|
String delivered;
|
|
|
|
CourierStatusTimeline({
|
|
required this.processing,
|
|
required this.dispatched,
|
|
required this.delivered,
|
|
});
|
|
|
|
factory CourierStatusTimeline.fromJson(Map<String, dynamic> json) {
|
|
return CourierStatusTimeline(
|
|
processing: json['processing'],
|
|
dispatched: json['dispatched'],
|
|
delivered: json['delivered'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class OrderId {
|
|
String id;
|
|
String uniqueId;
|
|
|
|
OrderId({
|
|
required this.id,
|
|
required this.uniqueId,
|
|
});
|
|
|
|
factory OrderId.fromJson(Map<String, dynamic> json) {
|
|
return OrderId(
|
|
id: json['_id'],
|
|
uniqueId: json['uniqueId'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Item {
|
|
String productId;
|
|
String sku;
|
|
String name;
|
|
String categoryName;
|
|
String brandName;
|
|
int price;
|
|
int gst;
|
|
int hsnCode;
|
|
int processQuantity;
|
|
String id;
|
|
|
|
Item({
|
|
required this.productId,
|
|
required this.sku,
|
|
required this.name,
|
|
required this.categoryName,
|
|
required this.brandName,
|
|
required this.price,
|
|
required this.gst,
|
|
required this.hsnCode,
|
|
required this.processQuantity,
|
|
required this.id,
|
|
});
|
|
|
|
factory Item.fromJson(Map<String, dynamic> json) {
|
|
return Item(
|
|
productId: json['productId'],
|
|
sku: json['SKU'],
|
|
name: json['name'],
|
|
categoryName: json['categoryName'],
|
|
brandName: json['brandName'],
|
|
price: json['price'],
|
|
gst: json['GST'],
|
|
hsnCode: json['HSN_Code'],
|
|
processQuantity: json['processquantity'],
|
|
id: json['_id'],
|
|
);
|
|
}
|
|
}
|