1) Cancelled file changes done
This commit is contained in:
parent
ff065bdc16
commit
ef2799cbd4
@ -1,72 +1,345 @@
|
|||||||
|
// import 'package:cheminova/models/rd_order_item_model.dart';
|
||||||
|
//
|
||||||
|
// class SingleGetOrderModel {
|
||||||
|
// final String id;
|
||||||
|
// String? paymentMode;
|
||||||
|
// String? shipTo;
|
||||||
|
// String? billTo;
|
||||||
|
// List<RDOrderItem>? orderItem;
|
||||||
|
// double? subtotal;
|
||||||
|
// double? gstTotal;
|
||||||
|
// double? grandTotal;
|
||||||
|
// String? status;
|
||||||
|
// List<dynamic>? invoices;
|
||||||
|
// AddedBy? addedBy;
|
||||||
|
// String? pd;
|
||||||
|
// bool? isCancelled;
|
||||||
|
// bool? isDelivered;
|
||||||
|
// String? deliveredDate;
|
||||||
|
// DateTime? statusUpdatedAt;
|
||||||
|
// String? uniqueId;
|
||||||
|
// DateTime? createdAt;
|
||||||
|
// DateTime? updatedAt;
|
||||||
|
//
|
||||||
|
// SingleGetOrderModel({
|
||||||
|
// required this.id,
|
||||||
|
// 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,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory SingleGetOrderModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
// return SingleGetOrderModel(
|
||||||
|
// id: json['_id'] ?? '',
|
||||||
|
// paymentMode: json['paymentMode'] ?? '',
|
||||||
|
// shipTo: json['shipTo'] ?? '',
|
||||||
|
// billTo: json['billTo'] ?? '',
|
||||||
|
// orderItem: (json['orderItem'] as List<dynamic>?)
|
||||||
|
// ?.map((item) => RDOrderItem.fromJson(item))
|
||||||
|
// .toList() ??
|
||||||
|
// [],
|
||||||
|
// subtotal: (json['subtotal'] as num?)?.toDouble() ?? 0.0,
|
||||||
|
// gstTotal: (json['gstTotal'] as num?)?.toDouble() ?? 0.0,
|
||||||
|
// grandTotal: (json['grandTotal'] as num?)?.toDouble() ?? 0.0,
|
||||||
|
// status: json['status'] ?? '',
|
||||||
|
// invoices: json['invoices'] ?? [],
|
||||||
|
// addedBy: AddedBy.fromJson(json['addedBy'] ?? {}),
|
||||||
|
// pd: json['pd'] ?? '',
|
||||||
|
// isCancelled: json['iscancelled'] ?? false,
|
||||||
|
// isDelivered: json['isDelivered'] ?? false,
|
||||||
|
// deliveredDate: json['DeliveredDate'] ?? '',
|
||||||
|
// statusUpdatedAt: DateTime.parse(json['statusUpdatedAt'] ?? DateTime.now().toString()),
|
||||||
|
// uniqueId: json['uniqueId'] ?? '',
|
||||||
|
// createdAt: DateTime.parse(json['createdAt'] ?? DateTime.now().toString()),
|
||||||
|
// updatedAt: DateTime.parse(json['updatedAt'] ?? DateTime.now().toString()),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// 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?.toJson(),
|
||||||
|
// 'pd': pd,
|
||||||
|
// 'iscancelled': isCancelled,
|
||||||
|
// 'isDelivered': isDelivered,
|
||||||
|
// 'DeliveredDate': deliveredDate,
|
||||||
|
// 'statusUpdatedAt': statusUpdatedAt?.toIso8601String(),
|
||||||
|
// 'uniqueId': uniqueId,
|
||||||
|
// 'createdAt': createdAt?.toIso8601String(),
|
||||||
|
// 'updatedAt': updatedAt?.toIso8601String(),
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// String toString() {
|
||||||
|
// return 'SingleGetOrderModel(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 OrderItem {
|
||||||
|
// final String productId;
|
||||||
|
// final String sku;
|
||||||
|
// final String name;
|
||||||
|
// final String categoryName;
|
||||||
|
// final String brandName;
|
||||||
|
// final int price; // Use int for price
|
||||||
|
// final int gst; // Use int for GST
|
||||||
|
// final int hsnCode; // Use int for HSN Code
|
||||||
|
// final String description;
|
||||||
|
// final List<String> image; // Assuming images are stored as a list of strings
|
||||||
|
// final int quantity;
|
||||||
|
// final int remainingQuantity;
|
||||||
|
// int? processQuantity;
|
||||||
|
// final String id; // Use String for _id
|
||||||
|
//
|
||||||
|
// OrderItem({
|
||||||
|
// 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,
|
||||||
|
// this.processQuantity = 1,
|
||||||
|
// required this.id,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory OrderItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
// return OrderItem(
|
||||||
|
// productId: json['productId'] ?? '',
|
||||||
|
// sku: json['SKU'] ?? '',
|
||||||
|
// name: json['name'] ?? '',
|
||||||
|
// categoryName: json['categoryName'] ?? '',
|
||||||
|
// brandName: json['brandName'] ?? '',
|
||||||
|
// price: (json['price'] as num?)?.toInt() ?? 0, // Handle as num
|
||||||
|
// gst: (json['GST'] as num?)?.toInt() ?? 0, // Handle as num
|
||||||
|
// hsnCode: (json['HSN_Code'] as num?)?.toInt() ?? 0, // Handle as num
|
||||||
|
// description: json['description'] ?? '',
|
||||||
|
// image: List<String>.from(json['image'] ?? []),
|
||||||
|
// quantity: (json['quantity'] as num?)?.toInt() ?? 0, // Handle as num
|
||||||
|
// remainingQuantity: (json['remainingQuantity'] as num?)?.toInt() ?? 0, // Handle as num
|
||||||
|
// processQuantity: (json['processQuantity']as num?)?.toInt()??0,
|
||||||
|
// 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, HSN_Code: $hsnCode, '
|
||||||
|
// 'description: $description, image: $image, quantity: $quantity, '
|
||||||
|
// 'remainingQuantity: $remainingQuantity, id: $id)';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class AddedBy {
|
||||||
|
// final String id;
|
||||||
|
// final String designation;
|
||||||
|
// final String name;
|
||||||
|
// final String email;
|
||||||
|
// final String mobileNumber;
|
||||||
|
// final String principalDistributor;
|
||||||
|
// final String addedBy;
|
||||||
|
// final String userType;
|
||||||
|
// final String kyc;
|
||||||
|
// String? fcmToken;
|
||||||
|
// final DateTime createdAt;
|
||||||
|
// final DateTime updatedAt;
|
||||||
|
// final String mappedSC;
|
||||||
|
// final String uniqueId;
|
||||||
|
// final String mappedTM;
|
||||||
|
//
|
||||||
|
// AddedBy({
|
||||||
|
// required this.id,
|
||||||
|
// required this.designation,
|
||||||
|
// required this.name,
|
||||||
|
// required this.email,
|
||||||
|
// required this.mobileNumber,
|
||||||
|
// required this.principalDistributor,
|
||||||
|
// required this.addedBy,
|
||||||
|
// required this.userType,
|
||||||
|
// required this.kyc,
|
||||||
|
// this.fcmToken,
|
||||||
|
// required this.createdAt,
|
||||||
|
// required this.updatedAt,
|
||||||
|
// required this.mappedSC,
|
||||||
|
// required this.uniqueId,
|
||||||
|
// required this.mappedTM,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory AddedBy.fromJson(Map<String, dynamic> json) {
|
||||||
|
// return AddedBy(
|
||||||
|
// id: json['_id'] ?? '',
|
||||||
|
// designation: json['designation'] ?? '',
|
||||||
|
// name: json['name'] ?? '',
|
||||||
|
// email: json['email'] ?? '',
|
||||||
|
// mobileNumber: json['mobile_number'] ?? '',
|
||||||
|
// principalDistributor: json['principal_distributer'] ?? '',
|
||||||
|
// addedBy: json['addedBy'] ?? '',
|
||||||
|
// userType: json['userType'] ?? '',
|
||||||
|
// kyc: json['kyc'] ?? '',
|
||||||
|
// fcmToken: json['fcm_token']?.toString(), // Handle null safely
|
||||||
|
// createdAt: DateTime.parse(json['createdAt'] ?? DateTime.now().toString()),
|
||||||
|
// updatedAt: DateTime.parse(json['updatedAt'] ?? DateTime.now().toString()),
|
||||||
|
// mappedSC: json['mappedSC'] ?? '',
|
||||||
|
// uniqueId: json['uniqueId'] ?? '',
|
||||||
|
// mappedTM: json['mappedTM'] ?? '',
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() {
|
||||||
|
// return {
|
||||||
|
// '_id': id,
|
||||||
|
// 'designation': designation,
|
||||||
|
// 'name': name,
|
||||||
|
// 'email': email,
|
||||||
|
// 'mobile_number': mobileNumber,
|
||||||
|
// 'principal_distributer': principalDistributor,
|
||||||
|
// 'addedBy': addedBy,
|
||||||
|
// 'userType': userType,
|
||||||
|
// 'kyc': kyc,
|
||||||
|
// 'fcm_token': fcmToken,
|
||||||
|
// 'createdAt': createdAt.toIso8601String(),
|
||||||
|
// 'updatedAt': updatedAt.toIso8601String(),
|
||||||
|
// 'mappedSC': mappedSC,
|
||||||
|
// 'uniqueId': uniqueId,
|
||||||
|
// 'mappedTM': mappedTM,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// String toString() {
|
||||||
|
// return 'AddedBy(id: $id, designation: $designation, name: $name, email: $email, '
|
||||||
|
// 'mobileNumber: $mobileNumber, principalDistributor: $principalDistributor, '
|
||||||
|
// 'addedBy: $addedBy, userType: $userType, kyc: $kyc, '
|
||||||
|
// 'fcmToken: $fcmToken, createdAt: $createdAt, updatedAt: $updatedAt, '
|
||||||
|
// 'mappedSC: $mappedSC, uniqueId: $uniqueId, mappedTM: $mappedTM)';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:cheminova/models/rd_order_item_model.dart';
|
import 'package:cheminova/models/rd_order_item_model.dart';
|
||||||
|
|
||||||
|
// Main model for the order
|
||||||
class SingleGetOrderModel {
|
class SingleGetOrderModel {
|
||||||
final String id;
|
String id;
|
||||||
String? paymentMode;
|
String paymentMode;
|
||||||
String? shipTo;
|
String shipTo;
|
||||||
String? billTo;
|
String billTo;
|
||||||
List<RDOrderItem>? orderItem;
|
List<RDOrderItem> orderItem;
|
||||||
double? subtotal;
|
double subtotal;
|
||||||
double? gstTotal;
|
double gstTotal;
|
||||||
double? grandTotal;
|
double grandTotal;
|
||||||
String? status;
|
String status;
|
||||||
List<dynamic>? invoices;
|
List<Invoice> invoices;
|
||||||
AddedBy? addedBy;
|
AddedBy addedBy;
|
||||||
String? pd;
|
String pd;
|
||||||
bool? isCancelled;
|
bool isCancelled;
|
||||||
bool? isDelivered;
|
bool isDelivered;
|
||||||
String? deliveredDate;
|
String deliveredDate;
|
||||||
DateTime? statusUpdatedAt;
|
String statusUpdatedAt;
|
||||||
String? uniqueId;
|
String uniqueId;
|
||||||
DateTime? createdAt;
|
String createdAt;
|
||||||
DateTime? updatedAt;
|
String updatedAt;
|
||||||
|
|
||||||
SingleGetOrderModel({
|
SingleGetOrderModel({
|
||||||
required this.id,
|
required this.id,
|
||||||
this.paymentMode,
|
required this.paymentMode,
|
||||||
this.shipTo,
|
required this.shipTo,
|
||||||
this.billTo,
|
required this.billTo,
|
||||||
this.orderItem,
|
required this.orderItem,
|
||||||
this.subtotal,
|
required this.subtotal,
|
||||||
this.gstTotal,
|
required this.gstTotal,
|
||||||
this.grandTotal,
|
required this.grandTotal,
|
||||||
this.status,
|
required this.status,
|
||||||
this.invoices,
|
required this.invoices,
|
||||||
this.addedBy,
|
required this.addedBy,
|
||||||
this.pd,
|
required this.pd,
|
||||||
this.isCancelled,
|
required this.isCancelled,
|
||||||
this.isDelivered,
|
required this.isDelivered,
|
||||||
this.deliveredDate,
|
required this.deliveredDate,
|
||||||
this.statusUpdatedAt,
|
required this.statusUpdatedAt,
|
||||||
this.uniqueId,
|
required this.uniqueId,
|
||||||
this.createdAt,
|
required this.createdAt,
|
||||||
this.updatedAt,
|
required this.updatedAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory SingleGetOrderModel.fromJson(Map<String, dynamic> json) {
|
factory SingleGetOrderModel.fromJson(Map<String, dynamic> json) {
|
||||||
return SingleGetOrderModel(
|
return SingleGetOrderModel(
|
||||||
id: json['_id'] ?? '',
|
id: json['_id']??"1",
|
||||||
paymentMode: json['paymentMode'] ?? '',
|
paymentMode: json['paymentMode']??"2343",
|
||||||
shipTo: json['shipTo'] ?? '',
|
shipTo: json['shipTo']??"abc",
|
||||||
billTo: json['billTo'] ?? '',
|
billTo: json['billTo']??"xyz",
|
||||||
orderItem: (json['orderItem'] as List<dynamic>?)
|
orderItem: (json['orderItem'] as List)
|
||||||
?.map((item) => RDOrderItem.fromJson(item))
|
.map((i) => RDOrderItem.fromJson(i))
|
||||||
.toList() ??
|
.toList(),
|
||||||
[],
|
subtotal: json['subtotal'].toDouble(),
|
||||||
subtotal: (json['subtotal'] as num?)?.toDouble() ?? 0.0,
|
gstTotal: json['gstTotal'].toDouble(),
|
||||||
gstTotal: (json['gstTotal'] as num?)?.toDouble() ?? 0.0,
|
grandTotal: json['grandTotal'].toDouble(),
|
||||||
grandTotal: (json['grandTotal'] as num?)?.toDouble() ?? 0.0,
|
status: json['status'],
|
||||||
status: json['status'] ?? '',
|
invoices: (json['invoices'] as List)
|
||||||
invoices: json['invoices'] ?? [],
|
.map((i) => Invoice.fromJson(i))
|
||||||
addedBy: AddedBy.fromJson(json['addedBy'] ?? {}),
|
.toList(),
|
||||||
pd: json['pd'] ?? '',
|
addedBy: AddedBy.fromJson(json['addedBy']??""),
|
||||||
isCancelled: json['iscancelled'] ?? false,
|
pd: json['pd']??"",
|
||||||
isDelivered: json['isDelivered'] ?? false,
|
isCancelled: json['iscancelled']??"",
|
||||||
deliveredDate: json['DeliveredDate'] ?? '',
|
isDelivered: json['isDelivered']??"",
|
||||||
statusUpdatedAt: DateTime.parse(json['statusUpdatedAt'] ?? DateTime.now().toString()),
|
deliveredDate: json['DeliveredDate']??"",
|
||||||
uniqueId: json['uniqueId'] ?? '',
|
statusUpdatedAt: json['statusUpdatedAt']??"",
|
||||||
createdAt: DateTime.parse(json['createdAt'] ?? DateTime.now().toString()),
|
uniqueId: json['uniqueId']??"",
|
||||||
updatedAt: DateTime.parse(json['updatedAt'] ?? DateTime.now().toString()),
|
createdAt: json['createdAt']??"",
|
||||||
|
updatedAt: json['updatedAt']??"",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,51 +349,109 @@ class SingleGetOrderModel {
|
|||||||
'paymentMode': paymentMode,
|
'paymentMode': paymentMode,
|
||||||
'shipTo': shipTo,
|
'shipTo': shipTo,
|
||||||
'billTo': billTo,
|
'billTo': billTo,
|
||||||
'orderItem': orderItem?.map((item) => item.toJson()).toList(),
|
'orderItem': orderItem.map((i) => i.toJson()).toList(),
|
||||||
'subtotal': subtotal,
|
'subtotal': subtotal,
|
||||||
'gstTotal': gstTotal,
|
'gstTotal': gstTotal,
|
||||||
'grandTotal': grandTotal,
|
'grandTotal': grandTotal,
|
||||||
'status': status,
|
'status': status,
|
||||||
'invoices': invoices,
|
'invoices': invoices.map((i) => i.toJson()).toList(),
|
||||||
'addedBy': addedBy?.toJson(),
|
'addedBy': addedBy.toJson(),
|
||||||
'pd': pd,
|
'pd': pd,
|
||||||
'iscancelled': isCancelled,
|
'iscancelled': isCancelled,
|
||||||
'isDelivered': isDelivered,
|
'isDelivered': isDelivered,
|
||||||
'DeliveredDate': deliveredDate,
|
'DeliveredDate': deliveredDate,
|
||||||
'statusUpdatedAt': statusUpdatedAt?.toIso8601String(),
|
'statusUpdatedAt': statusUpdatedAt,
|
||||||
'uniqueId': uniqueId,
|
'uniqueId': uniqueId,
|
||||||
'createdAt': createdAt?.toIso8601String(),
|
'createdAt': createdAt,
|
||||||
'updatedAt': updatedAt?.toIso8601String(),
|
'updatedAt': updatedAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
// Model for individual order items
|
||||||
String toString() {
|
|
||||||
return 'SingleGetOrderModel(id: $id, paymentMode: $paymentMode, shipTo: $shipTo, billTo: $billTo, '
|
|
||||||
'orderItem: $orderItem, subtotal: $subtotal, gstTotal: $gstTotal, grandTotal: $grandTotal, '
|
// Model for invoices
|
||||||
'status: $status, invoices: $invoices, addedBy: $addedBy, pd: $pd, '
|
class Invoice {
|
||||||
'isCancelled: $isCancelled, isDelivered: $isDelivered, deliveredDate: $deliveredDate, '
|
Map<String, String> courierStatusTimeline;
|
||||||
'statusUpdatedAt: $statusUpdatedAt, uniqueId: $uniqueId, createdAt: $createdAt, updatedAt: $updatedAt)';
|
String id;
|
||||||
|
String invoiceId;
|
||||||
|
String orderId;
|
||||||
|
List<InvoiceItem> items;
|
||||||
|
double subtotal;
|
||||||
|
double gstTotal;
|
||||||
|
double invoiceAmount;
|
||||||
|
String courierStatus;
|
||||||
|
int v;
|
||||||
|
String courierName;
|
||||||
|
String courierTrackingId;
|
||||||
|
|
||||||
|
Invoice({
|
||||||
|
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 Invoice.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Invoice(
|
||||||
|
courierStatusTimeline: Map<String, String>.from(json['courierstatus_timeline']??""),
|
||||||
|
id: json['_id']??"",
|
||||||
|
invoiceId: json['invoiceId']??"",
|
||||||
|
orderId: json['orderId']??"",
|
||||||
|
items: (json['items'] as List)
|
||||||
|
.map((i) => InvoiceItem.fromJson(i))
|
||||||
|
.toList(),
|
||||||
|
subtotal: json['subtotal'].toDouble(),
|
||||||
|
gstTotal: json['gstTotal'].toDouble(),
|
||||||
|
invoiceAmount: json['invoiceAmount'].toDouble(),
|
||||||
|
courierStatus: json['courierStatus'],
|
||||||
|
v: json['__v'],
|
||||||
|
courierName: json['courier_name']??"",
|
||||||
|
courierTrackingId: json['courier_tracking_id']??"",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'courierstatus_timeline': courierStatusTimeline,
|
||||||
|
'_id': id,
|
||||||
|
'invoiceId': invoiceId,
|
||||||
|
'orderId': orderId,
|
||||||
|
'items': items.map((i) => i.toJson()).toList(),
|
||||||
|
'subtotal': subtotal,
|
||||||
|
'gstTotal': gstTotal,
|
||||||
|
'invoiceAmount': invoiceAmount,
|
||||||
|
'courierStatus': courierStatus,
|
||||||
|
'__v': v,
|
||||||
|
'courier_name': courierName,
|
||||||
|
'courier_tracking_id': courierTrackingId,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OrderItem {
|
// Model for items in an invoice
|
||||||
final String productId;
|
class InvoiceItem {
|
||||||
final String sku;
|
String productId;
|
||||||
final String name;
|
String sku;
|
||||||
final String categoryName;
|
String name;
|
||||||
final String brandName;
|
String categoryName;
|
||||||
final int price; // Use int for price
|
String brandName;
|
||||||
final int gst; // Use int for GST
|
double price;
|
||||||
final int hsnCode; // Use int for HSN Code
|
double gst;
|
||||||
final String description;
|
int hsnCode;
|
||||||
final List<String> image; // Assuming images are stored as a list of strings
|
int processQuantity;
|
||||||
final int quantity;
|
String id;
|
||||||
final int remainingQuantity;
|
|
||||||
int? processQuantity;
|
|
||||||
final String id; // Use String for _id
|
|
||||||
|
|
||||||
OrderItem({
|
InvoiceItem({
|
||||||
required this.productId,
|
required this.productId,
|
||||||
required this.sku,
|
required this.sku,
|
||||||
required this.name,
|
required this.name,
|
||||||
@ -129,30 +460,22 @@ class OrderItem {
|
|||||||
required this.price,
|
required this.price,
|
||||||
required this.gst,
|
required this.gst,
|
||||||
required this.hsnCode,
|
required this.hsnCode,
|
||||||
required this.description,
|
required this.processQuantity,
|
||||||
required this.image,
|
|
||||||
required this.quantity,
|
|
||||||
required this.remainingQuantity,
|
|
||||||
this.processQuantity = 1,
|
|
||||||
required this.id,
|
required this.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory OrderItem.fromJson(Map<String, dynamic> json) {
|
factory InvoiceItem.fromJson(Map<String, dynamic> json) {
|
||||||
return OrderItem(
|
return InvoiceItem(
|
||||||
productId: json['productId'] ?? '',
|
productId: json['productId']??"",
|
||||||
sku: json['SKU'] ?? '',
|
sku: json['SKU']??"",
|
||||||
name: json['name'] ?? '',
|
name: json['name']??"",
|
||||||
categoryName: json['categoryName'] ?? '',
|
categoryName: json['categoryName']??"",
|
||||||
brandName: json['brandName'] ?? '',
|
brandName: json['brandName']??"",
|
||||||
price: (json['price'] as num?)?.toInt() ?? 0, // Handle as num
|
price: json['price'].toDouble(),
|
||||||
gst: (json['GST'] as num?)?.toInt() ?? 0, // Handle as num
|
gst: json['GST'].toDouble(),
|
||||||
hsnCode: (json['HSN_Code'] as num?)?.toInt() ?? 0, // Handle as num
|
hsnCode: json['HSN_Code']??"",
|
||||||
description: json['description'] ?? '',
|
processQuantity: json['processquantity']??"",
|
||||||
image: List<String>.from(json['image'] ?? []),
|
id: json['_id']??"",
|
||||||
quantity: (json['quantity'] as num?)?.toInt() ?? 0, // Handle as num
|
|
||||||
remainingQuantity: (json['remainingQuantity'] as num?)?.toInt() ?? 0, // Handle as num
|
|
||||||
processQuantity: (json['processQuantity']as num?)?.toInt()??0,
|
|
||||||
id: json['_id'] ?? '',
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,23 +489,13 @@ class OrderItem {
|
|||||||
'price': price,
|
'price': price,
|
||||||
'GST': gst,
|
'GST': gst,
|
||||||
'HSN_Code': hsnCode,
|
'HSN_Code': hsnCode,
|
||||||
'description': description,
|
'processquantity': processQuantity,
|
||||||
'image': image,
|
|
||||||
'quantity': quantity,
|
|
||||||
'remainingQuantity': remainingQuantity,
|
|
||||||
'_id': id,
|
'_id': id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'OrderItem(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)';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Model for the user who added the order
|
||||||
class AddedBy {
|
class AddedBy {
|
||||||
final String id;
|
final String id;
|
||||||
final String designation;
|
final String designation;
|
||||||
@ -229,7 +542,8 @@ class AddedBy {
|
|||||||
addedBy: json['addedBy'] ?? '',
|
addedBy: json['addedBy'] ?? '',
|
||||||
userType: json['userType'] ?? '',
|
userType: json['userType'] ?? '',
|
||||||
kyc: json['kyc'] ?? '',
|
kyc: json['kyc'] ?? '',
|
||||||
fcmToken: json['fcm_token']?.toString(), // Handle null safely
|
fcmToken: json['fcm_token']?.toString(),
|
||||||
|
// Handle null safely
|
||||||
createdAt: DateTime.parse(json['createdAt'] ?? DateTime.now().toString()),
|
createdAt: DateTime.parse(json['createdAt'] ?? DateTime.now().toString()),
|
||||||
updatedAt: DateTime.parse(json['updatedAt'] ?? DateTime.now().toString()),
|
updatedAt: DateTime.parse(json['updatedAt'] ?? DateTime.now().toString()),
|
||||||
mappedSC: json['mappedSC'] ?? '',
|
mappedSC: json['mappedSC'] ?? '',
|
||||||
@ -267,3 +581,8 @@ class AddedBy {
|
|||||||
'mappedSC: $mappedSC, uniqueId: $uniqueId, mappedTM: $mappedTM)';
|
'mappedSC: $mappedSC, uniqueId: $uniqueId, mappedTM: $mappedTM)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Function to parse the JSON string and create a SingleOrder object
|
||||||
|
SingleGetOrderModel parseSingleOrder(String jsonString) {
|
||||||
|
final jsonData = json.decode(jsonString);
|
||||||
|
return SingleGetOrderModel.fromJson(jsonData);
|
||||||
|
}
|
||||||
|
@ -196,6 +196,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
HomeCard(
|
||||||
|
title: 'Opening Inventory',
|
||||||
|
onTap: () => Get.to(
|
||||||
|
() => InventoryManagementScreen(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// HomeCard(
|
||||||
|
// title: 'Announcement',
|
||||||
|
// onTap: () => Get.to(
|
||||||
|
// () => AnnouncementScreen(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -248,6 +248,19 @@ class _ProductCatalogScreenState extends State<ProductCatalogScreen> {
|
|||||||
_buildFilterDropdown(index),
|
_buildFilterDropdown(index),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(
|
||||||
|
// height: Get.height * 0.1,
|
||||||
|
child:_products.isEmpty // Check if no products found
|
||||||
|
? Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(40.0),
|
||||||
|
child: Text(
|
||||||
|
"No products found!",
|
||||||
|
style: TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) : SizedBox(),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height * 0.6,
|
height: Get.height * 0.6,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@ -272,6 +285,7 @@ class _ProductCatalogScreenState extends State<ProductCatalogScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -122,6 +122,11 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final order = widget.placedOrderList!.orderItem[0];
|
||||||
|
final subTotalProcesssItem = order.price! * order.remainingQuantity!.toInt();
|
||||||
|
final GstTotalAmounProcessItem = (order.price! * order.remainingQuantity!.toInt()) *(order.gst!/100 );
|
||||||
|
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -205,7 +210,7 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.subtotal ?? 0}"),
|
Text("₹ ${subTotalProcesssItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
@ -219,7 +224,7 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.gstTotal ?? 0}"),
|
Text("₹ ${GstTotalAmounProcessItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
@ -233,7 +238,7 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.grandTotal ?? 0}"),
|
Text("₹ ${grandTotalProcessItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -359,8 +359,6 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
|||||||
await controller.placeRDOrder();
|
await controller.placeRDOrder();
|
||||||
showSnackbar("Partial order processed successfully.");
|
showSnackbar("Partial order processed successfully.");
|
||||||
|
|
||||||
// Close the dialog before navigating to another screen
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
// Navigate to the pending screen
|
// Navigate to the pending screen
|
||||||
Get.to(RdOrderPendingScreen());
|
Get.to(RdOrderPendingScreen());
|
||||||
@ -382,6 +380,10 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final order = widget.placedOrderList!.orderItem[0];
|
||||||
|
final subTotalProcesssItem = order.price! * order.remainingQuantity!.toInt();
|
||||||
|
final GstTotalAmounProcessItem = (order.price! * order.remainingQuantity!.toInt()) *(order.gst!/100 );
|
||||||
|
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -470,7 +472,7 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.subtotal ?? 0}"),
|
Text("₹ ${subTotalProcesssItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,16 @@
|
|||||||
|
|
||||||
|
import 'package:cheminova/controller/get_rd_cancle_controller.dart';
|
||||||
|
import 'package:cheminova/controller/get_rd_pending_controller.dart';
|
||||||
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
||||||
|
import 'package:cheminova/controller/rd_processing_invoice_controller.dart';
|
||||||
import 'package:cheminova/models/get_rd_cancelled_model.dart';
|
import 'package:cheminova/models/get_rd_cancelled_model.dart';
|
||||||
|
import 'package:cheminova/models/get_rd_pennding_model.dart';
|
||||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||||
import 'package:cheminova/models/single_get_order_model.dart';
|
import 'package:cheminova/models/single_get_order_model.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_cancelled_details_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_cancelled_details_screen.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_dispatched_details_screen.dart';
|
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_order_details_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_order_details_screen.dart';
|
||||||
|
import 'package:cheminova/screens/rd%20orders/rd_order_details_update.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_pending_deatils.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_pending_deatils.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_processing_details.dart';
|
|
||||||
import 'package:cheminova/widgets/input_field.dart';
|
import 'package:cheminova/widgets/input_field.dart';
|
||||||
import 'package:cheminova/widgets/my_drawer.dart';
|
import 'package:cheminova/widgets/my_drawer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -15,12 +18,15 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../controller/get_rd_cancle_controller.dart';
|
import '../../controller/get_single_invoice_Service.dart';
|
||||||
|
import '../../controller/get_single_invoice_controller.dart';
|
||||||
|
import '../../controller/rd_get_single_service.dart';
|
||||||
import '../order_management/order_management_detail_screen.dart';
|
import '../order_management/order_management_detail_screen.dart';
|
||||||
|
|
||||||
class RdCancelledScreen extends StatefulWidget {
|
class RdCancelledScreen extends StatefulWidget {
|
||||||
final PlacedOrdersResponse? getrdProduct;
|
final GetRdCancelledModel? getrdProduct;
|
||||||
|
|
||||||
RdCancelledScreen({super.key, this.getrdProduct});
|
RdCancelledScreen({super.key, this.getrdProduct});
|
||||||
|
|
||||||
@ -37,7 +43,11 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
"cancelled",
|
"cancelled",
|
||||||
"delivered",];
|
"delivered",];
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
final GetRDCancleController _getRdProductController = Get.put(GetRDCancleController());
|
final GetRDCancleController _getRDCancleController = Get.put(GetRDCancleController());
|
||||||
|
// final GetSingleInvoiceController _getSingleInvoiceController = Get.put(GetSingleInvoiceController());
|
||||||
|
// final GetRDProcessingInvoiceController _getRDProcessingInvoiceController = Get.put(GetRDProcessingInvoiceController());
|
||||||
|
// // final GetProductRDController _getRdProductController =
|
||||||
|
// // Get.put(GetProductRDController());
|
||||||
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -49,11 +59,12 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
Future<void> _onRefresh() async {
|
Future<void> _onRefresh() async {
|
||||||
await getOrder1();
|
await getOrder1();
|
||||||
await Future.delayed(Duration(seconds: 1));
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getOrder1() async {
|
Future<void> getOrder1() async {
|
||||||
await _getRdProductController.getRDCancleProduct();
|
await _getRDCancleController.getRDCancleProduct();
|
||||||
if (_getRdProductController.productRDList.isEmpty) {
|
if (_getRDCancleController.productRDList.isEmpty) {
|
||||||
print("No orders found.");
|
print("No orders found.");
|
||||||
} else {
|
} else {
|
||||||
print("Orders fetched successfully");
|
print("Orders fetched successfully");
|
||||||
@ -70,11 +81,71 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
DateTime parsedDate = DateTime.parse(apiDate).toLocal(); // Convert to local time
|
DateTime parsedDate = DateTime.parse(apiDate).toLocal(); // Convert to local time
|
||||||
|
|
||||||
// Format the date and time according to your specified format
|
// Format the date and time according to your specified format
|
||||||
String formattedDate = DateFormat('EEE MMM dd yyyy').format(parsedDate);
|
String formattedDate = DateFormat('EEE MMM dd yyyy hh:mm a').format(parsedDate);
|
||||||
|
|
||||||
return formattedDate; // Return the formatted date string
|
return formattedDate; // Return the formatted date string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void onOrderTap(int index) async {
|
||||||
|
try {
|
||||||
|
// Fetch orders and ensure you wait for it to complete
|
||||||
|
await _getRDCancleController.getRDCancleProduct();
|
||||||
|
|
||||||
|
// Log the count of fetched orders
|
||||||
|
print('Fetched orders count: ${_getRDCancleController.productRDList.length}');
|
||||||
|
|
||||||
|
// Check if the productRDList is populated
|
||||||
|
if (_getRDCancleController.productRDList.isNotEmpty) {
|
||||||
|
// Ensure the index is valid
|
||||||
|
if (index >= 0 && index < _getRDCancleController.productRDList.length) {
|
||||||
|
// Get the order ID from the list based on the index
|
||||||
|
final orderId = _getRDCancleController.productRDList[index].id;
|
||||||
|
final invoiceId = _getRDCancleController.productRDList[index].invoices[0];
|
||||||
|
|
||||||
|
// Retrieve the token from SharedPreferences
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
String? token = prefs.getString('token');
|
||||||
|
|
||||||
|
// Check if the token is not null
|
||||||
|
if (token != null) {
|
||||||
|
// Fetch the single order using the order ID
|
||||||
|
final SingleGetOrderModel? singleOrder = await GetSingleProductService().getSingleOrder(token, orderId);
|
||||||
|
|
||||||
|
// Check if the single order was fetched successfully
|
||||||
|
if (singleOrder != null) {
|
||||||
|
// Navigate to the details screen with the fetched order
|
||||||
|
Get.to(() => RdOrderCancelledScreenDetailScreen(
|
||||||
|
placedOrderList: singleOrder, // Pass the single order instance
|
||||||
|
orderId: orderId,
|
||||||
|
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
// Handle the case where the single order could not be fetched
|
||||||
|
Get.snackbar("Error", "Unable to fetch order details.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle the case where the token is null
|
||||||
|
Get.snackbar("Error", "User not authenticated.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle the case when the index is out of bounds
|
||||||
|
Get.snackbar("Error", "Invalid order selection.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle the case when the list is empty
|
||||||
|
Get.snackbar("Error", "No orders available to display.");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Log any errors that occur during the process
|
||||||
|
print('Error in onOrderTap: $e');
|
||||||
|
Get.snackbar("Error", "An unexpected error occurred.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -128,6 +199,7 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
),
|
),
|
||||||
SizedBox(height: Get.height * 0.035),
|
SizedBox(height: Get.height * 0.035),
|
||||||
|
SizedBox(height: Get.height * 0.035),
|
||||||
Card(
|
Card(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 18),
|
margin: const EdgeInsets.symmetric(horizontal: 18),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -140,63 +212,11 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// SizedBox(
|
|
||||||
// height: Get.height * 0.05,
|
|
||||||
// child: ListView.builder(
|
|
||||||
// shrinkWrap: true,
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// itemCount: _filterList.length,
|
|
||||||
// itemBuilder: (context, index) => Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
||||||
// child: GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// setState(() {
|
|
||||||
// _selectedIndex = index; // Update selected index
|
|
||||||
// });
|
|
||||||
// // Navigate to different screens based on selected tab
|
|
||||||
// switch (_filterList[index]) {
|
|
||||||
// case "new":
|
|
||||||
// // Get.to(YourScreen1()); // Navigate to "new" orders screen
|
|
||||||
// break;
|
|
||||||
// case "pending":
|
|
||||||
// // Get.to(YourScreen2()); // Navigate to "pending" orders screen
|
|
||||||
// break;
|
|
||||||
// case "processing":
|
|
||||||
// // Get.to(YourScreen3()); // Navigate to "processing" orders screen
|
|
||||||
// break;
|
|
||||||
// // Add more cases for other statuses
|
|
||||||
// case "dispatched":
|
|
||||||
// // Get.to(YourScreen4()); // Navigate to dispatched orders
|
|
||||||
// break;
|
|
||||||
// case "cancelled":
|
|
||||||
// // Get.to(YourScreen5()); // Navigate to cancelled orders
|
|
||||||
// break;
|
|
||||||
// case "delivered":
|
|
||||||
// //Get.to(YourScreen6()); // Navigate to delivered orders
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// // Get.to(YourScreen1()); // Default screen
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: Chip(
|
|
||||||
// label: Text(capitalizeFirstLetter( _filterList[index])
|
|
||||||
// ,
|
|
||||||
// style: GoogleFonts.roboto(
|
|
||||||
// fontSize: 14,
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: _selectedIndex == index ? Colors.white : Colors.black, // Change color when selected
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// backgroundColor: _selectedIndex == index ? Colors.blue : Colors.grey[300], // Change color when selected
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height * 0.6,
|
height: Get.height * 0.6,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
if (_getRdProductController.productRDList.isEmpty) {
|
if (_getRDCancleController.productRDList.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'No Orders Found',
|
'No Orders Found',
|
||||||
@ -208,7 +228,7 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
final Set<String> uniqueOrderIds = {};
|
final Set<String> uniqueOrderIds = {};
|
||||||
final List<GetRdCancelledModel> uniqueOrders = [];
|
final List<GetRdCancelledModel> uniqueOrders = [];
|
||||||
|
|
||||||
for (var order in _getRdProductController.productRDList) {
|
for (var order in _getRDCancleController.productRDList) {
|
||||||
if (uniqueOrderIds.add(order.id)) {
|
if (uniqueOrderIds.add(order.id)) {
|
||||||
uniqueOrders.add(order);
|
uniqueOrders.add(order);
|
||||||
}
|
}
|
||||||
@ -282,7 +302,16 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 8, 8, 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text("Order Value: ", style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.bold)),
|
||||||
|
Text("${order.grandTotal}")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 8, 8, 0),
|
padding: const EdgeInsets.fromLTRB(16, 8, 8, 0),
|
||||||
@ -310,10 +339,12 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: ()=>
|
onPressed: (){
|
||||||
Get.to(() =>
|
onOrderTap(index);
|
||||||
RdCancelledDetailScreen(
|
},
|
||||||
placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
// Get.to(() =>
|
||||||
|
// RdOrderPendingScreenDetailScreen(
|
||||||
|
// placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: const Color(0xFF004791),
|
backgroundColor: const Color(0xFF004791),
|
||||||
@ -348,3 +379,5 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ import '../../utils/show_snackbar.dart';
|
|||||||
class RdOrderPendingScreenDetailScreen extends StatefulWidget {
|
class RdOrderPendingScreenDetailScreen extends StatefulWidget {
|
||||||
//final Product? productModel;
|
//final Product? productModel;
|
||||||
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
||||||
SingleGetOrderModel? placedOrderList;
|
final SingleGetOrderModel? placedOrderList;
|
||||||
GetRdPendingModel? productpendingModel;
|
// GetRdPendingModel? productpendingModel;
|
||||||
final String orderId;
|
final String orderId;
|
||||||
GetInvoiceModel? placeInvoiceList;
|
// GetInvoiceModel? placeInvoiceList;
|
||||||
|
|
||||||
// PlacedOrderModel? placedOrderModel;
|
// PlacedOrderModel? placedOrderModel;
|
||||||
// Constructor for initializing the screen with placed order details
|
// Constructor for initializing the screen with placed order details
|
||||||
RdOrderPendingScreenDetailScreen({super.key,this.placedOrderList,required this.orderId,this.placeInvoiceList});
|
RdOrderPendingScreenDetailScreen({super.key,this.placedOrderList,required this.orderId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RdOrderPendingScreenDetailScreen> createState() =>
|
State<RdOrderPendingScreenDetailScreen> createState() =>
|
||||||
@ -324,6 +324,27 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
if (widget.placedOrderList == null) {
|
||||||
|
return Center(child: Text('No order details available'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Safely get the order and invoice list
|
||||||
|
final order = widget.placedOrderList!;
|
||||||
|
final invoices = order.invoices;
|
||||||
|
|
||||||
|
// Check if the invoices list contains at least 4 items
|
||||||
|
List<String>? invoiceIds;
|
||||||
|
if (invoices.isNotEmpty) {
|
||||||
|
// Ensure there are at least 4 invoices
|
||||||
|
if (invoices.length >= 4) {
|
||||||
|
// Get the ID of the 4th invoice (index 3)
|
||||||
|
invoiceIds = [invoices[3].invoiceId!]; // Assuming invoiceId is a String
|
||||||
|
} else {
|
||||||
|
invoiceIds = []; // Fallback if not enough invoices
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
invoiceIds = []; // Fallback if no invoices available
|
||||||
|
}
|
||||||
//int remainingQuantity = (widget.placedOrderList!.orderItem![0].quantity)! -(widget.placedOrderList!.orderItem![0].remainingQuantity!.toInt());
|
//int remainingQuantity = (widget.placedOrderList!.orderItem![0].quantity)! -(widget.placedOrderList!.orderItem![0].remainingQuantity!.toInt());
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
@ -384,13 +405,13 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
children: [
|
children: [
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
child: Column(
|
child:
|
||||||
|
Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
"Invoices",
|
"Invoices",
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
@ -400,12 +421,18 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
// Displaying each invoice in a separate card
|
||||||
width: Get.width,
|
if (widget.placedOrderList!.invoices.isNotEmpty)
|
||||||
|
...widget.placedOrderList!.invoices.map((invoice) {
|
||||||
|
return Card(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.all(8.0),
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
child: Column(
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Invoice ID
|
||||||
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -415,20 +442,12 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(widget.placeInvoiceList!.invoiceId.toString()),
|
Text(invoice.invoiceId.toString()),
|
||||||
// Text(widget.placedOrderList!.uniqueId),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10), // Add spacing
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
|
|
||||||
|
// Items for this invoice
|
||||||
Text(
|
Text(
|
||||||
"Items: ",
|
"Items: ",
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
@ -436,12 +455,13 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10), // Add spacing between the title and the list of items
|
const SizedBox(height: 10), // Add spacing between title and items
|
||||||
Column(
|
|
||||||
children: widget.placeInvoiceList!.items!.map((item) {
|
|
||||||
|
|
||||||
|
// List of items in this invoice
|
||||||
|
Column(
|
||||||
|
children: invoice.items!.map((item) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0), // Add some spacing between items
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -451,7 +471,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: Get.width * 0.03,
|
fontSize: Get.width * 0.03,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis, // Handle long text
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("x ${item.processQuantity.toString()}"),
|
Text("x ${item.processQuantity.toString()}"),
|
||||||
@ -460,16 +480,11 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
const SizedBox(height: 10), // Add spacing between sections
|
||||||
),
|
|
||||||
),
|
// Sub Total
|
||||||
SizedBox(
|
Row(
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -479,19 +494,12 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placeInvoiceList!.subtotal}"),
|
Text("₹ ${invoice.subtotal}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
// GST
|
||||||
SizedBox(
|
Row(
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -501,17 +509,12 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placeInvoiceList!.gstTotal}"),
|
Text("₹ ${invoice.gstTotal}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
// Invoice Amount
|
||||||
SizedBox(
|
Row(
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -521,17 +524,12 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placeInvoiceList!.invoiceAmount}"),
|
Text("₹ ${invoice.invoiceAmount}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
// Courier Status
|
||||||
SizedBox(
|
Row(
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -543,28 +541,29 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
// Get.to(() =>
|
|
||||||
// RdOrderDetailScreen(
|
|
||||||
// placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor:_getCourierStatusColor(widget.placeInvoiceList!.courierStatus.toString()),
|
backgroundColor: _getCourierStatusColor(invoice.courierStatus.toString()),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
|
||||||
child: Text(capitalizeFirstLetter(widget.placeInvoiceList!.courierStatus.toString()),
|
|
||||||
// Text(widget.placedOrderList!.status.toString())
|
|
||||||
//Text(widget.placedOrderList!.status, style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.w400)),
|
|
||||||
),
|
|
||||||
//Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
|
||||||
)],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
child: Text(
|
||||||
|
capitalizeFirstLetter(invoice.courierStatus.toString()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
@ -591,9 +590,9 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: widget.placedOrderList?.orderItem!.length ?? 0,
|
itemCount: order.orderItem!.length ?? 0,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final orderItem = widget.placedOrderList!.orderItem![index];
|
final orderItem =order.orderItem![index];
|
||||||
final subTotal = orderItem.price * orderItem.quantity!.toInt();
|
final subTotal = orderItem.price * orderItem.quantity!.toInt();
|
||||||
final GstTotalAmount = (orderItem.price * orderItem.quantity!.toInt()) *(orderItem.gst/100 );
|
final GstTotalAmount = (orderItem.price * orderItem.quantity!.toInt()) *(orderItem.gst/100 );
|
||||||
final grandTotal = subTotal + GstTotalAmount;
|
final grandTotal = subTotal + GstTotalAmount;
|
||||||
@ -678,14 +677,14 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: widget.placedOrderList?.orderItem
|
itemCount: order.orderItem
|
||||||
?.where((item) => item.remainingQuantity! > 0)
|
?.where((item) => item.remainingQuantity! > 0)
|
||||||
.length ?? 0,
|
.length ?? 0,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
|
||||||
|
|
||||||
// Filter items with non-zero quantities
|
// Filter items with non-zero quantities
|
||||||
final filteredItems = widget.placedOrderList!.orderItem!
|
final filteredItems =order!.orderItem!
|
||||||
.where((item) => item.remainingQuantity! > 0)
|
.where((item) => item.remainingQuantity! > 0)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
@ -775,7 +774,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(capitalizeFirstLetter(widget.placeInvoiceList!.orderId!.paymentMode.toString())),
|
Text(capitalizeFirstLetter(widget.placedOrderList!.paymentMode.toString())),
|
||||||
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
||||||
// overflow:TextOverflow.ellipsis,)
|
// overflow:TextOverflow.ellipsis,)
|
||||||
],
|
],
|
||||||
@ -808,7 +807,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
SizedBox(width: Get.width*0.01,),
|
SizedBox(width: Get.width*0.01,),
|
||||||
//Text(capitalizeFirstLetter(widget.placedOrderList!.status)),
|
//Text(capitalizeFirstLetter(widget.placedOrderList!.status)),
|
||||||
Text(capitalizeFirstLetter(widget.placedOrderList!.status.toString()),maxLines: 4,
|
Text(capitalizeFirstLetter(order!.status.toString()),maxLines: 4,
|
||||||
overflow:TextOverflow.ellipsis,)
|
overflow:TextOverflow.ellipsis,)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -1014,12 +1013,12 @@ class simple extends State<RdOrderPendingScreenDetailScreen> {
|
|||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: _getCourierStatusColor(widget.placeInvoiceList!.courierStatus.toString()), // Call the method here
|
backgroundColor: _getCourierStatusColor(widget.placedOrderList!.invoices[0]!.courierStatus.toString()), // Call the method here
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(widget.placeInvoiceList!.courierStatus.toString()),
|
child: Text(widget.placedOrderList!.invoices[0]!.courierStatus.toString()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -4,6 +4,7 @@ import 'package:cheminova/controller/rd_get_order_controller.dart';
|
|||||||
import 'package:cheminova/controller/rd_processing_invoice_controller.dart';
|
import 'package:cheminova/controller/rd_processing_invoice_controller.dart';
|
||||||
import 'package:cheminova/models/get_rd_pennding_model.dart';
|
import 'package:cheminova/models/get_rd_pennding_model.dart';
|
||||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||||
|
import 'package:cheminova/models/single_get_order_model.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_order_details_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_order_details_screen.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_order_details_update.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_order_details_update.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_pending_deatils.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_pending_deatils.dart';
|
||||||
@ -88,9 +89,6 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
// Fetch orders and ensure you wait for it to complete
|
// Fetch orders and ensure you wait for it to complete
|
||||||
await _getRdPendingController.getRDPendingProduct();
|
await _getRdPendingController.getRDPendingProduct();
|
||||||
|
|
||||||
// await _getRDProcessingInvoiceController.getRDProcessingInvoiceProduct();
|
|
||||||
|
|
||||||
// await _getSingleInvoiceController.fetchInvoice(_getRDProcessingInvoiceController.productProcessingRDList[0].id);
|
|
||||||
// Log the count of fetched orders
|
// Log the count of fetched orders
|
||||||
print('Fetched orders count: ${_getRdPendingController.productRDList.length}');
|
print('Fetched orders count: ${_getRdPendingController.productRDList.length}');
|
||||||
|
|
||||||
@ -101,22 +99,22 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
// Get the order ID from the list based on the index
|
// Get the order ID from the list based on the index
|
||||||
final orderId = _getRdPendingController.productRDList[index].id;
|
final orderId = _getRdPendingController.productRDList[index].id;
|
||||||
final invoiceId = _getRdPendingController.productRDList[index].invoices[0];
|
final invoiceId = _getRdPendingController.productRDList[index].invoices[0];
|
||||||
|
|
||||||
// Retrieve the token from SharedPreferences
|
// Retrieve the token from SharedPreferences
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
String? token = prefs.getString('token');
|
String? token = prefs.getString('token');
|
||||||
|
|
||||||
// Check if the token is not null
|
// Check if the token is not null
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
// Fetch the single order using the order ID, and avoid caching issues
|
// Fetch the single order using the order ID
|
||||||
final singleOrder = await GetSingleProductService().getSingleOrder(token, orderId);
|
final SingleGetOrderModel? singleOrder = await GetSingleProductService().getSingleOrder(token, orderId);
|
||||||
final singleInvoice = await GetSingleInvoiceService().fetchInvoice(token, invoiceId.toString());
|
|
||||||
// Check if the single order was fetched successfully
|
// Check if the single order was fetched successfully
|
||||||
if (singleOrder != null) {
|
if (singleOrder != null) {
|
||||||
// Navigate to the details screen with the fetched order
|
// Navigate to the details screen with the fetched order
|
||||||
Get.to(() => RdOrderPendingScreenDetailScreen(
|
Get.to(() => RdOrderPendingScreenDetailScreen(
|
||||||
placedOrderList: singleOrder,
|
placedOrderList: singleOrder, // Pass the single order instance
|
||||||
orderId: orderId,
|
orderId: orderId,
|
||||||
placeInvoiceList: singleInvoice,
|
|
||||||
|
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
@ -144,6 +142,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -80,6 +80,14 @@ class ApiUrls {
|
|||||||
//============================== Annaouncement Details ==============================//
|
//============================== Annaouncement Details ==============================//
|
||||||
static const String AnnaouncementUrl = '/api/announcement/PDs';
|
static const String AnnaouncementUrl = '/api/announcement/PDs';
|
||||||
|
|
||||||
//============================== Annaouncement Details ==============================//
|
//============================== shipto Billto Details ==============================//
|
||||||
static const String ShiptoandBilltoAddressUrl = '/api/shipping/address/user/address';
|
static const String ShiptoandBilltoAddressUrl = '/api/shipping/address/user/address';
|
||||||
|
|
||||||
|
|
||||||
|
//============================== Product stock Details ==============================//
|
||||||
|
static const String ProductStockUrl = '/api/pd/stock';
|
||||||
|
|
||||||
|
//============================== Product Update stock Details ==============================//
|
||||||
|
static const String ProductUpdateStockUrl = '/api/pd/stock-update';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,14 @@ class _MyDrawerState extends State<MyDrawer> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
user!.name ?? "username",
|
user?.name ?? "username",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
user!.uniqueId ?? 'Employee ID',
|
user?.uniqueId ?? 'Employee ID',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
|
@ -94,7 +94,7 @@ class _ProductCard1State extends State<ProductCard1> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
" ${widget.productModel.quantity}",
|
" ${widget.productModel.remainingQuantity}",
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user