245 lines
5.9 KiB
Dart
245 lines
5.9 KiB
Dart
class GetInvoiceModel {
|
|
CourierStatusTimeline? courierStatusTimeline;
|
|
String? id;
|
|
String? invoiceId;
|
|
OrderId? orderId;
|
|
List<Item>? items;
|
|
int? subtotal;
|
|
double? gstTotal;
|
|
double? invoiceAmount;
|
|
String? courierStatus;
|
|
int? v;
|
|
|
|
GetInvoiceModel({
|
|
this.courierStatusTimeline,
|
|
this.id,
|
|
this.invoiceId,
|
|
this.orderId,
|
|
this.items,
|
|
this.subtotal,
|
|
this.gstTotal,
|
|
this.invoiceAmount,
|
|
this.courierStatus,
|
|
this.v,
|
|
});
|
|
|
|
factory GetInvoiceModel.fromJson(Map<String, dynamic> json) {
|
|
return GetInvoiceModel(
|
|
courierStatusTimeline: json['courierstatus_timeline'] != null
|
|
? CourierStatusTimeline.fromJson(json['courierstatus_timeline'])
|
|
: null,
|
|
id: json['_id'].toString() ?? '',
|
|
invoiceId: json['invoiceId'].toString() ?? '',
|
|
orderId: json['orderId'] != null ? OrderId.fromJson(json['orderId']) : null,
|
|
items: (json['items'] as List?)?.map((item) => Item.fromJson(item)).toList() ?? [],
|
|
subtotal: json['subtotal']?? 0,
|
|
gstTotal: json['gstTotal']?.toDouble() ?? 0.0,
|
|
invoiceAmount: json['invoiceAmount']?.toDouble() ?? 0.0,
|
|
courierStatus: json['courierStatus'].toString() ?? 'processing',
|
|
v: json['__v'] ?? 0,
|
|
);
|
|
}
|
|
}
|
|
|
|
class CourierStatusTimeline {
|
|
String? processing;
|
|
|
|
CourierStatusTimeline({
|
|
this.processing,
|
|
});
|
|
|
|
factory CourierStatusTimeline.fromJson(Map<String, dynamic> json) {
|
|
return CourierStatusTimeline(
|
|
processing: json['processing'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class OrderId {
|
|
String? id;
|
|
String? paymentMode;
|
|
String? shipTo;
|
|
String? billTo;
|
|
List<OrderItem>? orderItems;
|
|
int? subtotal;
|
|
double? gstTotal;
|
|
double? grandTotal;
|
|
String? status;
|
|
List<String>? invoices;
|
|
AddedBy? addedBy;
|
|
String? pd;
|
|
bool? isCancelled;
|
|
bool? isDelivered;
|
|
String? deliveredDate;
|
|
String? statusUpdatedAt;
|
|
String? uniqueId;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
int? v;
|
|
|
|
OrderId({
|
|
this.id,
|
|
this.paymentMode,
|
|
this.shipTo,
|
|
this.billTo,
|
|
this.orderItems,
|
|
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.v,
|
|
});
|
|
|
|
factory OrderId.fromJson(Map<String, dynamic> json) {
|
|
return OrderId(
|
|
id: json['_id'].toString() ?? '',
|
|
paymentMode: json['paymentMode'].toString() ?? '',
|
|
shipTo: json['shipTo'].toString() ?? '',
|
|
billTo: json['billTo'].toString() ?? '',
|
|
orderItems: (json['orderItem'] as List?)?.map((item) => OrderItem.fromJson(item)).toList() ?? [],
|
|
subtotal: json['subtotal'] ?? 0,
|
|
gstTotal: json['gstTotal']?.toDouble() ?? 0.0,
|
|
grandTotal: json['grandTotal']?.toDouble() ?? 0.0,
|
|
status: json['status'].toString()?? '',
|
|
invoices: List<String>.from(json['invoices'] ?? []),
|
|
addedBy: json['addedBy'] != null ? AddedBy.fromJson(json['addedBy']) : null,
|
|
pd: json['pd'].toString() ?? '',
|
|
isCancelled: json['iscancelled'] ?? false,
|
|
isDelivered: json['isDelivered'] ?? false,
|
|
deliveredDate: json['DeliveredDate']?? '',
|
|
statusUpdatedAt: json['statusUpdatedAt'] ?? '',
|
|
uniqueId: json['uniqueId'].toString() ?? '',
|
|
createdAt: json['createdAt'] ?? '',
|
|
updatedAt: json['updatedAt'] ?? '',
|
|
v: json['__v'] ?? 0,
|
|
);
|
|
}
|
|
}
|
|
|
|
class OrderItem {
|
|
String? productId;
|
|
String? sku;
|
|
String? name;
|
|
String? categoryName;
|
|
String? brandName;
|
|
int? price;
|
|
int? gst;
|
|
int? hsnCode;
|
|
String? description;
|
|
List<dynamic>? image;
|
|
int? quantity;
|
|
int? remainingQuantity;
|
|
String? id;
|
|
|
|
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.id,
|
|
});
|
|
|
|
factory OrderItem.fromJson(Map<String, dynamic> json) {
|
|
return OrderItem(
|
|
productId: json['productId'].toString()?? '',
|
|
sku: json['SKU'].toString() ?? '',
|
|
name: json['name'].toString()?? '',
|
|
categoryName: json['categoryName'].toString() ?? '',
|
|
brandName: json['brandName'].toString() ?? '',
|
|
price: json['price'] ?? 0,
|
|
gst: json['GST'] ?? 0,
|
|
hsnCode: json['HSN_Code'] ?? 0,
|
|
description: json['description'] ?? '',
|
|
image: List<dynamic>.from(json['image'] ?? []),
|
|
quantity: json['quantity'] ?? 0,
|
|
remainingQuantity: json['remainingQuantity'] ?? 0,
|
|
id: json['_id'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class Item {
|
|
String? productId;
|
|
String? sku;
|
|
String? name;
|
|
String? categoryName;
|
|
String? brandName;
|
|
int? price;
|
|
int? gst;
|
|
int? hsnCode;
|
|
int? processQuantity;
|
|
String? id;
|
|
|
|
Item({
|
|
this.productId,
|
|
this.sku,
|
|
this.name,
|
|
this.categoryName,
|
|
this.brandName,
|
|
this.price,
|
|
this.gst,
|
|
this.hsnCode,
|
|
this.processQuantity,
|
|
this.id,
|
|
});
|
|
|
|
factory Item.fromJson(Map<String, dynamic> json) {
|
|
return Item(
|
|
productId: json['productId'].toString() ?? '',
|
|
sku: json['SKU'].toString() ?? '',
|
|
name: json['name'].toString() ?? '',
|
|
categoryName: json['categoryName'].toString()?? '',
|
|
brandName: json['brandName'].toString() ?? '',
|
|
price: json['price'] ?? 0,
|
|
gst: json['GST'] ?? 0,
|
|
hsnCode: json['HSN_Code'] ?? 0,
|
|
processQuantity: json['processquantity'] ?? 0,
|
|
id: json['_id'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class AddedBy {
|
|
String? id;
|
|
String? name;
|
|
String? email;
|
|
String? mobileNumber;
|
|
dynamic fcmToken;
|
|
|
|
AddedBy({
|
|
this.id,
|
|
this.name,
|
|
this.email,
|
|
this.mobileNumber,
|
|
this.fcmToken,
|
|
});
|
|
|
|
factory AddedBy.fromJson(Map<String, dynamic> json) {
|
|
return AddedBy(
|
|
id: json['_id'].toString() ?? '',
|
|
name: json['name'].toString() ?? '',
|
|
email: json['email'].toString()?? '',
|
|
mobileNumber: json['mobile_number']?? '',
|
|
fcmToken: json['fcm_token']??"789789798798",
|
|
);
|
|
}
|
|
}
|