180 lines
5.2 KiB
Dart
180 lines
5.2 KiB
Dart
import 'package:cheminova/models/rd_order_item_model.dart';
|
|
|
|
class GetRdPendingModel {
|
|
String id;
|
|
String paymentMode;
|
|
String shipTo;
|
|
String billTo;
|
|
List<RDOrderItem> orderItem;
|
|
double subtotal;
|
|
double gstTotal;
|
|
double grandTotal;
|
|
String status;
|
|
List<String> invoices;
|
|
String addedBy;
|
|
String pd;
|
|
bool isCancelled;
|
|
bool isDelivered;
|
|
String deliveredDate;
|
|
String statusUpdatedAt;
|
|
String uniqueId;
|
|
String createdAt;
|
|
String updatedAt;
|
|
|
|
GetRdPendingModel({
|
|
required this.id,
|
|
required this.paymentMode,
|
|
required this.shipTo,
|
|
required this.billTo,
|
|
required this.orderItem,
|
|
required this.subtotal,
|
|
required this.gstTotal,
|
|
required this.grandTotal,
|
|
required this.status,
|
|
required this.invoices,
|
|
required this.addedBy,
|
|
required this.pd,
|
|
required this.isCancelled,
|
|
required this.isDelivered,
|
|
required this.deliveredDate,
|
|
required this.statusUpdatedAt,
|
|
required this.uniqueId,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory GetRdPendingModel.fromJson(Map<String, dynamic> json) {
|
|
return GetRdPendingModel(
|
|
id: json['_id'],
|
|
paymentMode: json['paymentMode'],
|
|
shipTo: json['shipTo'],
|
|
billTo: json['billTo'],
|
|
orderItem: (json['orderItem'] as List)
|
|
.map((item) => RDOrderItem.fromJson(item))
|
|
.toList(),
|
|
subtotal: json['subtotal'].toDouble(),
|
|
gstTotal: json['gstTotal'].toDouble(),
|
|
grandTotal: json['grandTotal'].toDouble(),
|
|
status: json['status'],
|
|
invoices: List<String>.from(json['invoices']),
|
|
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'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'_id': id,
|
|
'paymentMode': paymentMode,
|
|
'shipTo': shipTo,
|
|
'billTo': billTo,
|
|
'orderItem': orderItem.map((item) => item.toJson()).toList(),
|
|
'subtotal': subtotal,
|
|
'gstTotal': gstTotal,
|
|
'grandTotal': grandTotal,
|
|
'status': status,
|
|
'invoices': invoices,
|
|
'addedBy': addedBy,
|
|
'pd': pd,
|
|
'iscancelled': isCancelled,
|
|
'isDelivered': isDelivered,
|
|
'DeliveredDate': deliveredDate,
|
|
'statusUpdatedAt': statusUpdatedAt,
|
|
'uniqueId': uniqueId,
|
|
'createdAt': createdAt,
|
|
'updatedAt': updatedAt,
|
|
};
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'Order{id: $id, paymentMode: $paymentMode, shipTo: $shipTo, billTo: $billTo, '
|
|
'orderItem: $orderItem, subtotal: $subtotal, gstTotal: $gstTotal, grandTotal: $grandTotal, '
|
|
'status: $status, invoices: $invoices, addedBy: $addedBy, pd: $pd, isCancelled: $isCancelled, '
|
|
'isDelivered: $isDelivered, deliveredDate: $deliveredDate, statusUpdatedAt: $statusUpdatedAt, '
|
|
'uniqueId: $uniqueId, createdAt: $createdAt, updatedAt: $updatedAt}';
|
|
}
|
|
}
|
|
//
|
|
// class PendingOrderItem {
|
|
// String productId;
|
|
// String sku;
|
|
// String name;
|
|
// String categoryName;
|
|
// String brandName;
|
|
// double price;
|
|
// double gst;
|
|
// int hsnCode;
|
|
// String description;
|
|
// List<dynamic> image;
|
|
// int quantity;
|
|
// int remainingQuantity;
|
|
// String id;
|
|
//
|
|
// PendingOrderItem({
|
|
// 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.description,
|
|
// required this.image,
|
|
// required this.quantity,
|
|
// required this.remainingQuantity,
|
|
// required this.id,
|
|
// });
|
|
//
|
|
// factory PendingOrderItem.fromJson(Map<String, dynamic> json) {
|
|
// return PendingOrderItem(
|
|
// productId: json['productId'],
|
|
// sku: json['SKU'],
|
|
// name: json['name'],
|
|
// categoryName: json['categoryName'],
|
|
// brandName: json['brandName'],
|
|
// price: json['price'].toDouble(),
|
|
// gst: json['GST'].toDouble(),
|
|
// hsnCode: json['HSN_Code'],
|
|
// description: json['description'],
|
|
// image: List<dynamic>.from(json['image']),
|
|
// quantity: json['quantity'],
|
|
// remainingQuantity: json['remainingQuantity'],
|
|
// id: json['_id'],
|
|
// );
|
|
// }
|
|
//
|
|
// Map<String, dynamic> toJson() {
|
|
// return {
|
|
// 'productId': productId,
|
|
// 'SKU': sku,
|
|
// 'name': name,
|
|
// 'categoryName': categoryName,
|
|
// 'brandName': brandName,
|
|
// 'price': price,
|
|
// 'GST': gst,
|
|
// 'HSN_Code': hsnCode,
|
|
// 'description': description,
|
|
// 'image': image,
|
|
// 'quantity': quantity,
|
|
// 'remainingQuantity': remainingQuantity,
|
|
// '_id': id,
|
|
// };
|
|
// }
|
|
//
|
|
// @override
|
|
// String toString() {
|
|
// return 'OrderItem{productId: $productId, sku: $sku, name: $name, categoryName: $categoryName, '
|
|
// 'brandName: $brandName, price: $price, gst: $gst, hsnCode: $hsnCode, description: $description, '
|
|
// 'image: $image, quantity: $quantity, remainingQuantity: $remainingQuantity, id: $id}';
|
|
// }
|
|
// }
|