rd-android-app/lib/models/place_order_list_model.dart
2024-10-07 13:16:43 +05:30

189 lines
4.8 KiB
Dart

class PlacedOrderResponse {
List<PlacedOrderList>? placedOrders;
dynamic? totalOrders;
PlacedOrderResponse({this.placedOrders, this.totalOrders});
PlacedOrderResponse.fromJson(Map<dynamic, dynamic> json) {
if (json['placedOrders'] != null) {
placedOrders = <PlacedOrderList>[];
json['placedOrders'].forEach((v) {
placedOrders!.add(PlacedOrderList.fromJson(v));
});
}
totalOrders = json['totalOrders'];
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = <dynamic, dynamic>{};
if (placedOrders != null) {
data['placedOrders'] = placedOrders!.map((v) => v.toJson()).toList();
}
data['totalOrders'] = totalOrders;
return data;
}
}
class PlacedOrderList {
dynamic? sId;
dynamic? paymentMode;
dynamic? shipTo;
dynamic? billTo;
List<OrderItem>? orderItem;
dynamic? subtotal;
dynamic? gstTotal;
dynamic? grandTotal;
dynamic? status;
List<dynamic>? invoices;
dynamic? addedBy;
dynamic? pd;
bool? iscancelled;
bool? isDelivered;
dynamic? deliveredDate;
dynamic? statusUpdatedAt;
dynamic? uniqueId;
dynamic? createdAt;
dynamic? updatedAt;
dynamic? iV;
PlacedOrderList(
{this.sId,
this.paymentMode,
this.shipTo,
this.billTo,
this.orderItem,
this.subtotal,
this.gstTotal,
this.grandTotal,
this.status,
this.invoices,
this.addedBy,
this.pd,
this.iscancelled,
this.isDelivered,
this.deliveredDate,
this.statusUpdatedAt,
this.uniqueId,
this.createdAt,
this.updatedAt,
this.iV});
PlacedOrderList.fromJson(Map<dynamic, dynamic> json) {
sId = json['_id'];
paymentMode = json['paymentMode'];
shipTo = json['shipTo'];
billTo = json['billTo'];
if (json['orderItem'] != null) {
orderItem = <OrderItem>[];
json['orderItem'].forEach((v) {
orderItem!.add(OrderItem.fromJson(v));
});
}
subtotal = json['subtotal'];
gstTotal = json['gstTotal'];
grandTotal = json['grandTotal'];
status = json['status'];
invoices = json['invoices'].cast<dynamic>();
addedBy = json['addedBy'];
pd = json['pd'];
iscancelled = json['iscancelled'];
isDelivered = json['isDelivered'];
deliveredDate = json['DeliveredDate'];
statusUpdatedAt = json['statusUpdatedAt'];
uniqueId = json['uniqueId'];
createdAt = json['createdAt'];
updatedAt = json['updatedAt'];
iV = json['__v'];
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = <dynamic, dynamic>{};
data['_id'] = sId;
data['paymentMode'] = paymentMode;
data['shipTo'] = shipTo;
data['billTo'] = billTo;
if (orderItem != null) {
data['orderItem'] = orderItem!.map((v) => v.toJson()).toList();
}
data['subtotal'] = subtotal;
data['gstTotal'] = gstTotal;
data['grandTotal'] = grandTotal;
data['status'] = status;
data['invoices'] = invoices;
data['addedBy'] = addedBy;
data['pd'] = pd;
data['iscancelled'] = iscancelled;
data['isDelivered'] = isDelivered;
data['DeliveredDate'] = deliveredDate;
data['statusUpdatedAt'] = statusUpdatedAt;
data['uniqueId'] = uniqueId;
data['createdAt'] = createdAt;
data['updatedAt'] = updatedAt;
data['__v'] = iV;
return data;
}
}
class OrderItem {
dynamic? productId;
dynamic? sKU;
dynamic? name;
dynamic? categoryName;
dynamic? brandName;
dynamic? price;
dynamic? gST;
dynamic? hSNCode;
dynamic? description;
List<Null>? image;
dynamic? quantity;
dynamic? remainingQuantity;
dynamic? sId;
OrderItem(
{this.productId,
this.sKU,
this.name,
this.categoryName,
this.brandName,
this.price,
this.gST,
this.hSNCode,
this.description,
this.image,
this.quantity,
this.remainingQuantity,
this.sId});
OrderItem.fromJson(Map<dynamic, dynamic> json) {
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'];
description = json['description'];
quantity = json['quantity'];
remainingQuantity = json['remainingQuantity'];
sId = json['_id'];
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = <dynamic, dynamic>{};
data['productId'] = productId;
data['SKU'] = sKU;
data['name'] = name;
data['categoryName'] = categoryName;
data['brandName'] = brandName;
data['price'] = price;
data['GST'] = gST;
data['HSN_Code'] = hSNCode;
data['description'] = description;
data['quantity'] = quantity;
data['remainingQuantity'] = remainingQuantity;
data['_id'] = sId;
return data;
}
}