1) annaucement api integration done
2)Billto and shipTo api integration
This commit is contained in:
parent
ef6ef970bb
commit
ff065bdc16
@ -2,25 +2,59 @@ import 'package:cheminova/utils/api_urls.dart';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
import '../models/annauncement_model.dart';
|
import '../models/annauncement_model.dart';
|
||||||
|
import '../utils/common_api_service.dart';
|
||||||
|
|
||||||
class AnnouncementService {
|
class AnnouncementService {
|
||||||
final Dio _dio = Dio();
|
final Dio _dio = Dio();
|
||||||
|
|
||||||
Future<List<AnnouncementModel>> fetchAnnouncements(String token) async {
|
|
||||||
final String url = ApiUrls.AnnaouncementUrl;
|
Future<List<AnnouncementModel>?> fetchAnnouncements(String token) async {
|
||||||
try {
|
try {
|
||||||
_dio.options.headers['Authorization'] = 'Bearer $token';
|
String url = ApiUrls.AnnaouncementUrl; // Base URL to fetch product manuals
|
||||||
final Response response = await _dio.get(url);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
final response = await commonApiService<List<AnnouncementModel>>(
|
||||||
|
method: "GET",
|
||||||
List<dynamic> data = response.data;
|
url: url,
|
||||||
return data.map((announcement) => AnnouncementModel.fromJson(announcement)).toList();
|
additionalHeaders: { // Pass the token here
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
},
|
||||||
|
fromJson: (json) {
|
||||||
|
if (json['announcements'] != null) {
|
||||||
|
// If the productManuals key is present, map the response to a list of ProductManualModel objects
|
||||||
|
final List<AnnouncementModel> productManuals = (json['announcements'] as List)
|
||||||
|
.map((manualJson) => AnnouncementModel.fromJson(manualJson))
|
||||||
|
.toList();
|
||||||
|
return productManuals; // Return the list of product manuals
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Failed to load announcements');
|
return [];
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Error occurred while fetching announcements: $e');
|
|
||||||
|
print("fkfgghgh ,${e.toString()}");
|
||||||
|
//print(e.toString());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Future<List<AnnouncementModel>> fetchAnnouncements(String token) async {
|
||||||
|
// final String url = ApiUrls.AnnaouncementUrl;
|
||||||
|
// try {
|
||||||
|
// _dio.options.headers['Authorization'] = 'Bearer $token';
|
||||||
|
// final Response response = await _dio.get(url);
|
||||||
|
//
|
||||||
|
// if (response.statusCode == 200) {
|
||||||
|
//
|
||||||
|
// List<dynamic> data = response.data;
|
||||||
|
// return data.map((announcement) => AnnouncementModel.fromJson(announcement)).toList();
|
||||||
|
// } else {
|
||||||
|
// throw Exception('Failed to load announcements');
|
||||||
|
// }
|
||||||
|
// } catch (e) {
|
||||||
|
// throw Exception('Error occurred while fetching announcements: $e');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,46 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:cheminova/models/notification_model.dart';
|
import 'package:cheminova/models/notification_model.dart';
|
||||||
import 'package:cheminova/utils/api_urls.dart';
|
|
||||||
|
|
||||||
import '../utils/common_api_service.dart';
|
import '../utils/api_urls.dart';
|
||||||
|
|
||||||
|
class NotificationService {
|
||||||
|
final Dio _dio = Dio();
|
||||||
|
|
||||||
|
Future<List<NotificationModel>?> fetchNotifications(String token, String date) async {
|
||||||
|
final String url = ApiUrls.getNotificationUrl;
|
||||||
|
|
||||||
class NotificationApiService {
|
|
||||||
// Function to fetch notifications from the API
|
|
||||||
Future<List<NotificationModel>?> getNotification(String token) async {
|
|
||||||
try {
|
try {
|
||||||
// Set the URL for fetching notifications
|
final response = await _dio.get(
|
||||||
String url =ApiUrls.getNotificationUrl; // Base URL to fetch product manuals
|
url,
|
||||||
// Make a GET request to the notification API
|
options: Options(
|
||||||
final response = await commonApiService<List<NotificationModel>>(
|
headers: {
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
additionalHeaders: { // Pass the token here
|
|
||||||
'Authorization': 'Bearer $token',
|
'Authorization': 'Bearer $token',
|
||||||
},
|
},
|
||||||
fromJson: (json) {
|
),
|
||||||
if (json['notifications'] != null) {
|
queryParameters: {'Date': date},
|
||||||
// If notifications are present in the response, map them to NotificationModel objects
|
|
||||||
final List<NotificationModel> notification = (json['notifications'] as List)
|
|
||||||
.map((manualJson) => NotificationModel.fromJson(manualJson as Map<String, dynamic>))
|
|
||||||
.toList();
|
|
||||||
return notification;
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
return response;
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
print(e.toString());
|
// Ensure the response is not void and contains expected data
|
||||||
return null;
|
if (response.statusCode == 200 && response.data != null) {
|
||||||
|
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||||
|
|
||||||
|
if (data.containsKey('success') && data['success'] == true) {
|
||||||
|
List notifications = data['notifications'] ?? [];
|
||||||
|
List<NotificationModel> notificationModels = notifications.map((notification) {
|
||||||
|
return NotificationModel.fromJson(notification);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return notificationModels; // Return the list of NotificationModel
|
||||||
|
} else {
|
||||||
|
print('Failed to fetch notifications: ${data['message'] ?? 'Unknown error'}');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print('Unexpected response: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // Return null if fetching fails
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,39 @@
|
|||||||
import 'package:cheminova/controller/notification_api_service.dart';
|
|
||||||
import 'package:cheminova/controller/product_mannual_service.dart';
|
|
||||||
import 'package:cheminova/models/notification_model.dart';
|
import 'package:cheminova/models/notification_model.dart';
|
||||||
import 'package:cheminova/notification_service.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import '../models/product_mannual_model.dart'; // Your model import
|
import 'notification_api_service.dart';
|
||||||
// Your service import
|
|
||||||
|
|
||||||
class NotificationController extends GetxController {
|
class NotificationController extends GetxController {
|
||||||
|
var isLoading = false.obs;
|
||||||
var notificationList = <NotificationModel>[].obs;
|
var notificationList = <NotificationModel>[].obs;
|
||||||
|
|
||||||
// Service to fetch data
|
final NotificationService _notificationApiService = NotificationService();
|
||||||
final NotificationApiService notificationApiService = NotificationApiService();
|
|
||||||
|
|
||||||
// Loading state
|
// Function to fetch notifications from the API with the selected date
|
||||||
var isLoading = false.obs;
|
void fetchNotificationApiService(String date) async {
|
||||||
|
|
||||||
// Method to fetch product manuals from the service
|
|
||||||
void fetchNotificationApiService() async {
|
|
||||||
try {
|
try {
|
||||||
// Set loading to true
|
isLoading(true);
|
||||||
isLoading.value = true;
|
// Retrieve token from a secure source
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
String? token = prefs.getString('token');
|
String? token = prefs.getString('token');
|
||||||
var manuals = await notificationApiService.getNotification(token!);
|
|
||||||
|
|
||||||
// If data is returned, update the list
|
if (token == null) {
|
||||||
if (manuals != null) {
|
print("Token is null");
|
||||||
notificationList .value = manuals;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch notifications by date
|
||||||
|
List<NotificationModel>? notifications = await _notificationApiService.fetchNotifications(token, date);
|
||||||
|
|
||||||
|
if (notifications != null && notifications.isNotEmpty) {
|
||||||
|
notificationList.value = notifications;
|
||||||
} else {
|
} else {
|
||||||
notificationList.value = []; // If no data, set an empty list
|
notificationList.clear();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Handle error here, for example logging or showing an error message
|
print("Error fetching notifications: $e");
|
||||||
print("Error fetching product manuals: $e");
|
|
||||||
} finally {
|
} finally {
|
||||||
// Set loading to false
|
isLoading(false);
|
||||||
isLoading.value = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// Fetch product manuals when the controller is initialized
|
|
||||||
fetchNotificationApiService();
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,9 @@ class ProductService {
|
|||||||
String url;
|
String url;
|
||||||
// Determine the URL based on the presence of a category filter
|
// Determine the URL based on the presence of a category filter
|
||||||
if (category != null && category.isNotEmpty) {
|
if (category != null && category.isNotEmpty) {
|
||||||
url = "${ApiUrls.getCategoryUrl}?page=$page&category=$category";
|
url = "${ApiUrls.getallProductUrl}?page=$page&category=$category";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
url = "${ApiUrls.getallProductUrl}?page=$page"; // URL without category filter
|
url = "${ApiUrls.getallProductUrl}?page=$page"; // URL without category filter
|
||||||
}
|
}
|
||||||
// Make the API call using the common API service
|
// Make the API call using the common API service
|
||||||
|
@ -28,11 +28,12 @@ class RDOrderPlacedService {
|
|||||||
);
|
);
|
||||||
//logger.w("Status code,${response.statusCode}");
|
//logger.w("Status code,${response.statusCode}");
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
|
showSnackbar("stock not Available");
|
||||||
throw Exception('Failed to RD place order');
|
throw Exception('Failed to RD place order');
|
||||||
}
|
}
|
||||||
else if(response.statusCode != 200 && response.statusCode == 400){
|
// else if(response.statusCode != 200 && response.statusCode == 400){
|
||||||
showSnackbar("stock not Available");
|
// showSnackbar("stock not Available");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> RDOrderCancel(String token, String orderId, String reason) async {
|
Future<void> RDOrderCancel(String token, String orderId, String reason) async {
|
||||||
|
39
lib/controller/shiptoandbillto_service.dart
Normal file
39
lib/controller/shiptoandbillto_service.dart
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import '../models/shiping_billing_address_model.dart';
|
||||||
|
import '../utils/api_urls.dart';
|
||||||
|
import '../utils/common_api_service.dart';
|
||||||
|
|
||||||
|
class ShiptoandbilltoService {
|
||||||
|
|
||||||
|
|
||||||
|
Future<List<UserShippingAddress>?> fetchshiptobillAddress(String token) async {
|
||||||
|
try {
|
||||||
|
String url = ApiUrls
|
||||||
|
.ShiptoandBilltoAddressUrl; // Base URL to fetch product manuals
|
||||||
|
|
||||||
|
final response = await commonApiService<List<UserShippingAddress>>(
|
||||||
|
method: "GET",
|
||||||
|
url: url,
|
||||||
|
additionalHeaders: { // Pass the token here
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
},
|
||||||
|
fromJson: (json) {
|
||||||
|
if (json['UserShippingAddress'] != null) {
|
||||||
|
// If the productManuals key is present, map the response to a list of ProductManualModel objects
|
||||||
|
final List<
|
||||||
|
UserShippingAddress> productManuals = (json['UserShippingAddress'] as List)
|
||||||
|
.map((manualJson) => UserShippingAddress.fromJson(manualJson))
|
||||||
|
.toList();
|
||||||
|
return productManuals; // Return the list of product manuals
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
print("fkfgghgh ,${e.toString()}");
|
||||||
|
//print(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
99
lib/controller/shiptobilltoController.dart
Normal file
99
lib/controller/shiptobilltoController.dart
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// import 'package:cheminova/controller/shiptoandbillto_service.dart';
|
||||||
|
// import 'package:cheminova/models/shiping_billing_address_model.dart';
|
||||||
|
// import 'package:get/get.dart';
|
||||||
|
// import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
//
|
||||||
|
// class AddressController extends GetxController {
|
||||||
|
// final ShiptoandbilltoService _productService = ShiptoandbilltoService();
|
||||||
|
//
|
||||||
|
// var addressList = <UserShippingAddress>[].obs; // Observable list of addresses
|
||||||
|
// var selectedShippingAddressId = ''.obs;
|
||||||
|
// var selectedBillingAddressId = ''.obs;
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// void onInit() {
|
||||||
|
// super.onInit();
|
||||||
|
// _loadAddresses();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void _loadAddresses() async {
|
||||||
|
// try {
|
||||||
|
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
// String? token = prefs.getString('token');
|
||||||
|
// final response = await _productService.fetchshiptobillAddress(token!);
|
||||||
|
// addressList.assignAll(response as Iterable<UserShippingAddress>);
|
||||||
|
//
|
||||||
|
// // Load previously selected addresses
|
||||||
|
// selectedShippingAddressId.value = prefs.getString('selectedShippingAddress') ?? '';
|
||||||
|
// selectedBillingAddressId.value = prefs.getString('selectedBillingAddress') ?? '';
|
||||||
|
//
|
||||||
|
// // Set the default selection to the first address if available
|
||||||
|
// if (addressList.isNotEmpty) {
|
||||||
|
// if (selectedShippingAddressId.value.isEmpty) {
|
||||||
|
// selectedShippingAddressId.value = addressList.first.id;
|
||||||
|
// }
|
||||||
|
// if (selectedBillingAddressId.value.isEmpty) {
|
||||||
|
// selectedBillingAddressId.value = addressList.first.id;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (e) {
|
||||||
|
// print("Exception: $e");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void _saveSelectedAddress() async {
|
||||||
|
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
// await prefs.setString('selectedShippingAddress', selectedShippingAddressId.value);
|
||||||
|
// await prefs.setString('selectedBillingAddress', selectedBillingAddressId.value);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void onShippingAddressChanged(String? value) {
|
||||||
|
// if (value != null) {
|
||||||
|
// selectedShippingAddressId.value = value;
|
||||||
|
// _saveSelectedAddress();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void onBillingAddressChanged(String? value) {
|
||||||
|
// if (value != null) {
|
||||||
|
// selectedBillingAddressId.value = value;
|
||||||
|
// _saveSelectedAddress();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:cheminova/controller/shiptoandbillto_service.dart';
|
||||||
|
import 'package:get/get_rx/src/rx_types/rx_types.dart';
|
||||||
|
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../models/shiping_billing_address_model.dart';
|
||||||
|
|
||||||
|
class AddressController extends GetxController {
|
||||||
|
RxList<UserShippingAddress> addressList = <UserShippingAddress>[].obs;
|
||||||
|
RxString selectedShippingAddressId = ''.obs;
|
||||||
|
RxString selectedBillingAddressId = ''.obs;
|
||||||
|
Rx<UserShippingAddress?> selectedShippingAddress = Rx<UserShippingAddress?>(null);
|
||||||
|
Rx<UserShippingAddress?> selectedBillingAddress = Rx<UserShippingAddress?>(null);
|
||||||
|
|
||||||
|
void fetchAddresses() async {
|
||||||
|
// Fetch the addresses from the API
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
String? token = prefs.getString('token');
|
||||||
|
var response = await ShiptoandbilltoService().fetchshiptobillAddress(token!);
|
||||||
|
if (response!= null) {
|
||||||
|
addressList.value = response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onShippingAddressChanged(String? value) {
|
||||||
|
selectedShippingAddressId.value = value ?? '';
|
||||||
|
selectedShippingAddress.value = addressList.firstWhere((address) => address.id == value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onBillingAddressChanged(String? value) {
|
||||||
|
selectedBillingAddressId.value = value ?? '';
|
||||||
|
selectedBillingAddress.value = addressList.firstWhere((address) => address.id == value,);
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +1,84 @@
|
|||||||
|
// class AnnouncementModel {
|
||||||
|
// List<Announcement>? announcements;
|
||||||
|
// int? totalAnnouncements;
|
||||||
|
//
|
||||||
|
// AnnouncementModel({this.announcements, this.totalAnnouncements});
|
||||||
|
//
|
||||||
|
// // Factory constructor to create an instance from a JSON map
|
||||||
|
// factory AnnouncementModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
// return AnnouncementModel(
|
||||||
|
// announcements: json['announcements'] != null
|
||||||
|
// ? List<Announcement>.from(json['announcements'].map((item) => Announcement.fromJson(item)))
|
||||||
|
// : null,
|
||||||
|
// totalAnnouncements: json['totalAnnouncements']?.toString() != null
|
||||||
|
// ? int.tryParse(json['totalAnnouncements'].toString())
|
||||||
|
// : 1,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Method to convert an instance to a JSON map
|
||||||
|
// Map<String, dynamic> toJson() {
|
||||||
|
// return {
|
||||||
|
// 'announcements': announcements?.map((item) => item.toJson()).toList(),
|
||||||
|
// 'totalAnnouncements': totalAnnouncements,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Overriding the toString() method for debugging purposes
|
||||||
|
// @override
|
||||||
|
// String toString() {
|
||||||
|
// return 'AnnouncementModel(announcements: $announcements, totalAnnouncements: $totalAnnouncements)';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
class AnnouncementModel {
|
class AnnouncementModel {
|
||||||
final String id;
|
String? id;
|
||||||
final String uniqueId;
|
List<String>? sentTo;
|
||||||
final List<String> sentTo;
|
String? message;
|
||||||
final String message;
|
String? createdAt;
|
||||||
final DateTime createdAt;
|
String? updatedAt;
|
||||||
final DateTime updatedAt;
|
String? uniqueId;
|
||||||
|
int? version;
|
||||||
|
|
||||||
AnnouncementModel({
|
AnnouncementModel({
|
||||||
required this.id,
|
this.id,
|
||||||
required this.uniqueId,
|
this.sentTo,
|
||||||
required this.sentTo,
|
this.message,
|
||||||
required this.message,
|
this.createdAt,
|
||||||
required this.createdAt,
|
this.updatedAt,
|
||||||
required this.updatedAt,
|
this.uniqueId,
|
||||||
|
this.version,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Factory constructor to create an instance from a JSON map
|
||||||
factory AnnouncementModel.fromJson(Map<String, dynamic> json) {
|
factory AnnouncementModel.fromJson(Map<String, dynamic> json) {
|
||||||
return AnnouncementModel(
|
return AnnouncementModel(
|
||||||
id: json['_id']??"",
|
id: json['_id']?.toString(),
|
||||||
uniqueId: json['uniqueId']??"",
|
sentTo: json['sentTo'] != null ? List<String>.from(json['sentTo']) : null,
|
||||||
sentTo: List<String>.from(json['sentTo']),
|
message: json['message']?.toString(),
|
||||||
message: json['message']??"",
|
createdAt: json['createdAt']?.toString(),
|
||||||
createdAt: DateTime.parse(json['createdAt']),
|
updatedAt: json['updatedAt']?.toString(),
|
||||||
updatedAt: DateTime.parse(json['updatedAt']),
|
uniqueId: json['uniqueId']?.toString(),
|
||||||
|
version: json['__v']?.toString() != null ? int.tryParse(json['__v'].toString()) : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to convert an instance to a JSON map
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'_id': id,
|
||||||
|
'sentTo': sentTo,
|
||||||
|
'message': message,
|
||||||
|
'createdAt': createdAt,
|
||||||
|
'updatedAt': updatedAt,
|
||||||
|
'uniqueId': uniqueId,
|
||||||
|
'__v': version,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overriding the toString() method for debugging purposes
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Announcement(id: $id, sentTo: $sentTo, message: $message, createdAt: $createdAt, updatedAt: $updatedAt, uniqueId: $uniqueId, version: $version)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,67 +1,47 @@
|
|||||||
class NotificationModel {
|
class NotificationModel {
|
||||||
String? id;
|
final String id; // Notification ID
|
||||||
String? title;
|
final String title; // Title of the notification
|
||||||
String? msg;
|
final String message; // Message of the notification
|
||||||
String? addedFor;
|
final String addedFor; // ID of the user/recipient
|
||||||
String? createdAt;
|
final DateTime createdAt; // Timestamp when created
|
||||||
String? updatedAt;
|
final DateTime updatedAt; // Timestamp when updated
|
||||||
int? v;
|
|
||||||
|
|
||||||
NotificationModel({
|
NotificationModel({
|
||||||
this.id,
|
required this.id,
|
||||||
this.title,
|
required this.title,
|
||||||
this.msg,
|
required this.message,
|
||||||
this.addedFor,
|
required this.addedFor,
|
||||||
this.createdAt,
|
required this.createdAt,
|
||||||
this.updatedAt,
|
required this.updatedAt,
|
||||||
this.v,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Factory method to create a NotificationModel from JSON
|
||||||
factory NotificationModel.fromJson(Map<String, dynamic> json) {
|
factory NotificationModel.fromJson(Map<String, dynamic> json) {
|
||||||
return NotificationModel(
|
return NotificationModel(
|
||||||
id: json['_id'],
|
id: json['_id'].toString(),
|
||||||
title: json['title'],
|
title: json['title'].toString(),
|
||||||
msg: json['msg'],
|
message: json['msg'].toString(),
|
||||||
addedFor: json['added_for'],
|
addedFor: json['added_for'],
|
||||||
createdAt: json['createdAt'],
|
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||||
updatedAt: json['updatedAt'],
|
updatedAt: DateTime.parse(json['updatedAt']as String),
|
||||||
v: json['__v'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to convert a NotificationModel to JSON
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'_id': id,
|
'_id': id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'msg': msg,
|
'msg': message,
|
||||||
'added_for': addedFor,
|
'added_for': addedFor,
|
||||||
'createdAt': createdAt,
|
'createdAt': createdAt.toIso8601String(),
|
||||||
'updatedAt': updatedAt,
|
'updatedAt': updatedAt.toIso8601String(),
|
||||||
'__v': v,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class NotificationResponse {
|
// Override toString method for better readability
|
||||||
String? returnMessage;
|
@override
|
||||||
List<NotificationModel>? notifications;
|
String toString() {
|
||||||
|
return 'NotificationModel{id: $id, title: $title, message: $message, addedFor: $addedFor, createdAt: $createdAt, updatedAt: $updatedAt}';
|
||||||
NotificationResponse({this.returnMessage, this.notifications});
|
|
||||||
|
|
||||||
factory NotificationResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
return NotificationResponse(
|
|
||||||
returnMessage: json['return_message'],
|
|
||||||
notifications: json['notifications'] != null
|
|
||||||
? List<NotificationModel>.from(json['notifications']
|
|
||||||
.map((notification) => NotificationModel.fromJson(notification)))
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'return_message': returnMessage,
|
|
||||||
'notifications': notifications?.map((notification) => notification.toJson()).toList(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
62
lib/models/shiping_billing_address_model.dart
Normal file
62
lib/models/shiping_billing_address_model.dart
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
class UserShippingAddress {
|
||||||
|
final String id;
|
||||||
|
final String street;
|
||||||
|
final String city;
|
||||||
|
final String state;
|
||||||
|
final String postalCode;
|
||||||
|
final String country;
|
||||||
|
String? panNumber;
|
||||||
|
final String tradeName;
|
||||||
|
String? gstNumber;
|
||||||
|
bool? isDefault;
|
||||||
|
|
||||||
|
UserShippingAddress({
|
||||||
|
required this.id,
|
||||||
|
required this.street,
|
||||||
|
required this.city,
|
||||||
|
required this.state,
|
||||||
|
required this.postalCode,
|
||||||
|
required this.country,
|
||||||
|
this.panNumber,
|
||||||
|
required this.tradeName,
|
||||||
|
this.gstNumber,
|
||||||
|
this.isDefault,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory UserShippingAddress.fromJson(Map<String, dynamic> json) {
|
||||||
|
return UserShippingAddress(
|
||||||
|
id: json['_id'],
|
||||||
|
street: json['street'],
|
||||||
|
city: json['city'],
|
||||||
|
state: json['state'],
|
||||||
|
postalCode: json['postalCode'],
|
||||||
|
country: json['country'],
|
||||||
|
panNumber: json['panNumber'],
|
||||||
|
tradeName: json['tradeName'],
|
||||||
|
gstNumber: json['gstNumber'],
|
||||||
|
isDefault: json['isDefault'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'_id': id,
|
||||||
|
'street': street,
|
||||||
|
'city': city,
|
||||||
|
'state': state,
|
||||||
|
'postalCode': postalCode,
|
||||||
|
'country': country,
|
||||||
|
'panNumber': panNumber,
|
||||||
|
'tradeName': tradeName,
|
||||||
|
'gstNumber': gstNumber,
|
||||||
|
'isDefault': isDefault,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Utility method in UserShippingAddress model to get full address as a string
|
||||||
|
//extension UserShippingAddressExtensions on UserShippingAddress {
|
||||||
|
String toStringFullAddress() {
|
||||||
|
return "$street, $city, $state, $postalCode, $country";
|
||||||
|
}
|
||||||
|
}
|
@ -77,24 +77,33 @@ class _AnnouncementScreenState extends State<AnnouncementScreen> {
|
|||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: _announcementController.announcements.length,
|
itemCount: _announcementController.announcements.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
final announcementList = _announcementController.announcements[index];
|
||||||
return Card(
|
print("asdf,${announcementList}");
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
//leading:Text(_announcementController.announcements[index].id),
|
//leading:Text(_announcementController.announcements[index].id),
|
||||||
title: Row(
|
title: Row(
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
Text("Message :",style: TextStyle(fontWeight: FontWeight.bold),),
|
Text("Message :",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 14),),
|
||||||
Text(_announcementController.announcements[index].message),
|
Text(announcementList.message.toString(),style: TextStyle(fontSize: 12),),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Row(
|
subtitle: Row(
|
||||||
children: [
|
children: [
|
||||||
Text("UniqueID :" , style: TextStyle(fontWeight: FontWeight.bold),),
|
Text("UniqueID :" , style: TextStyle(fontWeight: FontWeight.bold),),
|
||||||
Text(_announcementController.announcements[index].uniqueId),
|
Text(announcementList.uniqueId.toString()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: Text(formatDate(_announcementController.announcements[index].createdAt.toIso8601String())),
|
trailing: Text(formatDate(announcementList.createdAt.toString()),style: TextStyle(fontSize: 10),),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -17,9 +17,6 @@ class NotificationScreen extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Fetch notifications when the screen is first built
|
|
||||||
notificationController.fetchNotificationApiService();
|
|
||||||
|
|
||||||
return CommonBackground(
|
return CommonBackground(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
@ -33,14 +30,41 @@ class NotificationScreen extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(right: 20),
|
padding: const EdgeInsets.only(right: 20),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: const Text('Notification',
|
title: const Text(
|
||||||
|
'Notification',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontFamily: 'Anek')),
|
fontFamily: 'Anek',
|
||||||
|
),
|
||||||
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
// Add the date picker button in the app bar
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(80),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
_selectDate(context);
|
||||||
|
},
|
||||||
|
child:
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text("Select Date: ",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 18),),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.calendar_today),
|
||||||
|
onPressed: () {
|
||||||
|
_selectDate(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
drawer: MyDrawer(),
|
drawer: MyDrawer(),
|
||||||
body: Obx(() {
|
body: Obx(() {
|
||||||
@ -58,6 +82,23 @@ class NotificationScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to show date picker
|
||||||
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
|
DateTime? selectedDate = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2020), // Adjust the start date as needed
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selectedDate != null) {
|
||||||
|
// Format the date to dd/MM/yyyy
|
||||||
|
String formattedDate = DateFormat('dd/MM/yyyy').format(selectedDate);
|
||||||
|
// Call the API with the selected date
|
||||||
|
notificationController.fetchNotificationApiService(formattedDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyListView extends StatelessWidget {
|
class MyListView extends StatelessWidget {
|
||||||
@ -74,7 +115,7 @@ class MyListView extends StatelessWidget {
|
|||||||
// Ensure that 'notifications' is not null
|
// Ensure that 'notifications' is not null
|
||||||
if (notification != null) {
|
if (notification != null) {
|
||||||
String date = DateFormat("dd MMM yyyy")
|
String date = DateFormat("dd MMM yyyy")
|
||||||
.format(DateTime.parse(notification.createdAt ?? ''));
|
.format(DateTime.parse(notification.createdAt.toString() ?? ''));
|
||||||
if (!groupedNotifications.containsKey(date)) {
|
if (!groupedNotifications.containsKey(date)) {
|
||||||
groupedNotifications[date] = [];
|
groupedNotifications[date] = [];
|
||||||
}
|
}
|
||||||
@ -94,15 +135,30 @@ class MyListView extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Display the date once
|
// Display the date card
|
||||||
Padding(
|
Card(
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
elevation: 3,
|
||||||
child: Text(
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
// Display the selected date
|
||||||
|
Text(
|
||||||
date,
|
date,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16, fontWeight: FontWeight.bold),
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
// Display notifications for the date
|
// Display notifications for the date
|
||||||
...notificationsForDate.map(
|
...notificationsForDate.map(
|
||||||
(notification) {
|
(notification) {
|
||||||
@ -115,9 +171,11 @@ class MyListView extends StatelessWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
notification.title ?? 'No title',
|
notification.title ?? 'No title',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 17, fontWeight: FontWeight.w500),
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
subtitle: Text(notification.msg ?? 'No message'),
|
),
|
||||||
|
subtitle: Text(notification.message ?? 'No message'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -4,6 +4,7 @@ import 'package:cheminova/models/rd_order_item_model.dart';
|
|||||||
import 'package:cheminova/models/rd_placed_order_model.dart';
|
import 'package:cheminova/models/rd_placed_order_model.dart';
|
||||||
import 'package:cheminova/screens/order/checkout_screen.dart';
|
import 'package:cheminova/screens/order/checkout_screen.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_pending_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_pending_screen.dart';
|
||||||
|
import 'package:cheminova/screens/rd%20orders/rd_processing_screen.dart';
|
||||||
import 'package:cheminova/widgets/my_drawer.dart';
|
import 'package:cheminova/widgets/my_drawer.dart';
|
||||||
import 'package:cheminova/widgets/product_card.dart';
|
import 'package:cheminova/widgets/product_card.dart';
|
||||||
import 'package:cheminova/widgets/product_card1.dart';
|
import 'package:cheminova/widgets/product_card1.dart';
|
||||||
@ -97,10 +98,11 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
|||||||
await controller.placeRDOrder();
|
await controller.placeRDOrder();
|
||||||
showSnackbar("Partial order processed successfully.");
|
showSnackbar("Partial order processed successfully.");
|
||||||
|
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
// Close the dialog before navigating to another screen
|
||||||
Get.to(RdOrderPendingScreen());
|
Navigator.of(context).pop();
|
||||||
//Navigator.of(context).pop();
|
|
||||||
});
|
// Navigate to the pending screen
|
||||||
|
Get.to(RdOrderProcessingScreen());
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
@ -358,14 +358,12 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
|||||||
|
|
||||||
await controller.placeRDOrder();
|
await controller.placeRDOrder();
|
||||||
showSnackbar("Partial order processed successfully.");
|
showSnackbar("Partial order processed successfully.");
|
||||||
Get.to(RdOrderPendingScreen());
|
|
||||||
//Navigator.of(context).pop();
|
|
||||||
// Future.delayed(const Duration(seconds: 1), () {
|
|
||||||
// Get.to(RdOrderPendingScreen());
|
|
||||||
// //Navigator.of(context).pop();
|
|
||||||
// });
|
|
||||||
|
|
||||||
//setState(() {});
|
// Close the dialog before navigating to another screen
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
|
// Navigate to the pending screen
|
||||||
|
Get.to(RdOrderPendingScreen());
|
||||||
},
|
},
|
||||||
child: const Text("Confirm"),
|
child: const Text("Confirm"),
|
||||||
),
|
),
|
||||||
|
@ -16,15 +16,17 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
import '../../controller/cart_controller.dart';
|
import '../../controller/cart_controller.dart';
|
||||||
import '../../controller/get_delivered_controller.dart';
|
import '../../controller/get_delivered_controller.dart';
|
||||||
|
import '../../models/get_invoice_model.dart';
|
||||||
import '../../models/product_model1.dart';
|
import '../../models/product_model1.dart';
|
||||||
|
|
||||||
class RdDeliveredDetailsScreen extends StatefulWidget {
|
class RdDeliveredDetailsScreen 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
|
||||||
GetDeliveredModel? placedOrderList;
|
GetDeliveredModel? placedOrderList;
|
||||||
|
GetInvoiceModel? placedInvoiceList;
|
||||||
// PlacedOrderModel? placedOrderModel;
|
// PlacedOrderModel? placedOrderModel;
|
||||||
// Constructor for initializing the screen with placed order details
|
// Constructor for initializing the screen with placed order details
|
||||||
RdDeliveredDetailsScreen({super.key,this.placedOrderList});
|
RdDeliveredDetailsScreen({super.key,this.placedOrderList,this.placedInvoiceList});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RdDeliveredDetailsScreen> createState() =>
|
State<RdDeliveredDetailsScreen> createState() =>
|
||||||
@ -419,211 +421,16 @@ class _RdDeliveredDetailsScreenState
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height* 0.19,
|
height: Get.height* 0.19,
|
||||||
child: Card(
|
child:_buildCustomerDetails(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Customer Details",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
//height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Name: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"Roshan Garg"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Email: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"roshangarg28@gmail.com"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Mobile Number: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"8876785448"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildBillingInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Billing Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"456, Park Street, Kolkata, West Bengal - 700016"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// Card for displaying shipping information
|
_buildShippingInfo(),
|
||||||
Card(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Shipping Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"456, Park Street, Kolkata, West Bengal - 700016"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildPaymentInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.05,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Payment Mode : ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(capitalizeFirstLetter("online-transfer")),
|
|
||||||
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
|
||||||
// overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -740,4 +547,119 @@ class _RdDeliveredDetailsScreenState
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildCustomerDetails() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Customer Details"),
|
||||||
|
_buildRow("Name:", widget.placedInvoiceList!.orderId!.addedBy!.name.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Email:", widget.placedInvoiceList!.orderId!.addedBy!.email.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Mobile Number:", widget.placedInvoiceList!.orderId!.addedBy!.mobileNumber.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBillingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Billing Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedInvoiceList!.orderId!.billTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildShippingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Shipping Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedInvoiceList!.orderId!.shipTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPaymentInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Payment Mode: ",
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
fontSize: Get.width * 0.04,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(capitalizeFirstLetter(widget.placedInvoiceList!.orderId!.paymentMode.toString())),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildSectionTitle(String title) {
|
||||||
|
return SizedBox(
|
||||||
|
width: Get.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.roboto(fontSize: Get.width * 0.05, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize,fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$label: ",
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:cheminova/controller/get_delivered_controller.dart';
|
import 'package:cheminova/controller/get_delivered_controller.dart';
|
||||||
|
import 'package:cheminova/controller/get_delivered_service.dart';
|
||||||
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
||||||
import 'package:cheminova/models/get_delivered_model.dart';
|
import 'package:cheminova/models/get_delivered_model.dart';
|
||||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||||
@ -16,7 +17,9 @@ 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_single_invoice_Service.dart';
|
||||||
import '../order_management/order_management_detail_screen.dart';
|
import '../order_management/order_management_detail_screen.dart';
|
||||||
|
|
||||||
class RdDeliveredScreen extends StatefulWidget {
|
class RdDeliveredScreen extends StatefulWidget {
|
||||||
@ -70,11 +73,68 @@ class _RdDeliveredScreenState extends State<RdDeliveredScreen> {
|
|||||||
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 _getRdProductController.getRDDeliveredInvoiceProduct();
|
||||||
|
|
||||||
|
// Log the count of fetched orders
|
||||||
|
print('Fetched orders count: ${_getRdProductController.productProcessingRDList.length}');
|
||||||
|
|
||||||
|
// Check if the productRDList is populated
|
||||||
|
if (_getRdProductController.productProcessingRDList.isNotEmpty) {
|
||||||
|
// Ensure the index is valid
|
||||||
|
if (index >= 0 && index < _getRdProductController.productProcessingRDList.length) {
|
||||||
|
// Get the order ID from the list based on the index
|
||||||
|
final orderId = _getRdProductController.productProcessingRDList[index].id;
|
||||||
|
final orderId1 = _getRdProductController.productProcessingRDList[index].id;
|
||||||
|
// 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, and avoid caching issues
|
||||||
|
final singleOrder = await GetSingleInvoiceService().fetchInvoice(token, orderId);
|
||||||
|
final invoiceOrder = await GetDeliveredService().getRDDeliveredProduct(token);
|
||||||
|
// Check if the single order was fetched successfully
|
||||||
|
if (singleOrder != null) {
|
||||||
|
// Navigate to the details screen with the fetched order
|
||||||
|
Get.to(() => RdDeliveredDetailsScreen(
|
||||||
|
placedOrderList: invoiceOrder![index],
|
||||||
|
placedInvoiceList: singleOrder,
|
||||||
|
));
|
||||||
|
} 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(
|
||||||
@ -329,10 +389,13 @@ class _RdDeliveredScreenState extends State<RdDeliveredScreen> {
|
|||||||
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);
|
||||||
RdDeliveredDetailsScreen(
|
},
|
||||||
placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
//=>
|
||||||
|
// Get.to(() =>
|
||||||
|
// RdDeliveredDetailsScreen(
|
||||||
|
// 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),
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:cheminova/controller/get_dispatch_controller.dart';
|
import 'package:cheminova/controller/get_dispatch_controller.dart';
|
||||||
import 'package:cheminova/controller/get_order_placed_controller.dart';
|
import 'package:cheminova/controller/get_order_placed_controller.dart';
|
||||||
|
import 'package:cheminova/controller/get_single_invoice_controller.dart';
|
||||||
import 'package:cheminova/models/get_dispatch_model.dart';
|
import 'package:cheminova/models/get_dispatch_model.dart';
|
||||||
import 'package:cheminova/models/oder_place_model.dart';
|
import 'package:cheminova/models/oder_place_model.dart';
|
||||||
import 'package:cheminova/models/order_item_model.dart';
|
import 'package:cheminova/models/order_item_model.dart';
|
||||||
import 'package:cheminova/models/place_order_list_model.dart';
|
import 'package:cheminova/models/place_order_list_model.dart';
|
||||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||||
|
import 'package:cheminova/screens/rd%20orders/rd_delivered_screen.dart';
|
||||||
import 'package:cheminova/utils/show_snackbar.dart';
|
import 'package:cheminova/utils/show_snackbar.dart';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@ -17,6 +19,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../controller/cart_controller.dart';
|
import '../../controller/cart_controller.dart';
|
||||||
|
import '../../models/get_invoice_model.dart';
|
||||||
import '../../models/product_model1.dart';
|
import '../../models/product_model1.dart';
|
||||||
|
|
||||||
class RdDispatchedDetailsDetailScreen extends StatefulWidget {
|
class RdDispatchedDetailsDetailScreen extends StatefulWidget {
|
||||||
@ -24,8 +27,9 @@ class RdDispatchedDetailsDetailScreen extends StatefulWidget {
|
|||||||
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
||||||
GetDispatchModel? placedOrderList;
|
GetDispatchModel? placedOrderList;
|
||||||
PlacedOrderModel? placedOrderModel;
|
PlacedOrderModel? placedOrderModel;
|
||||||
|
GetInvoiceModel? placedInvoiceList;
|
||||||
// Constructor for initializing the screen with placed order details
|
// Constructor for initializing the screen with placed order details
|
||||||
RdDispatchedDetailsDetailScreen({super.key,this.placedOrderList,this.placedOrderModel});
|
RdDispatchedDetailsDetailScreen({super.key,this.placedOrderList,this.placedOrderModel,this.placedInvoiceList});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RdDispatchedDetailsDetailScreen> createState() =>
|
State<RdDispatchedDetailsDetailScreen> createState() =>
|
||||||
@ -38,6 +42,7 @@ class _RdDispatchedDetailsDetailScreenState
|
|||||||
// Controllers for managing cart and placed orders
|
// Controllers for managing cart and placed orders
|
||||||
final CartController _cartController = Get.put(CartController());
|
final CartController _cartController = Get.put(CartController());
|
||||||
final GetDispatchController _getPlacedOrderController = Get.put(GetDispatchController());
|
final GetDispatchController _getPlacedOrderController = Get.put(GetDispatchController());
|
||||||
|
final GetSingleInvoiceController _getSingleInvoiceController = Get.put(GetSingleInvoiceController());
|
||||||
final GetDispatchController _getDispatchController = Get.put(GetDispatchController());
|
final GetDispatchController _getDispatchController = Get.put(GetDispatchController());
|
||||||
final List<String> statusOptions = [
|
final List<String> statusOptions = [
|
||||||
"new",
|
"new",
|
||||||
@ -180,6 +185,7 @@ class _RdDispatchedDetailsDetailScreenState
|
|||||||
// Call your API method here
|
// Call your API method here
|
||||||
await _getDispatchController.RDDispatchToDeliveredProduct(widget.placedOrderList!.id);
|
await _getDispatchController.RDDispatchToDeliveredProduct(widget.placedOrderList!.id);
|
||||||
showSnackbar("Order Status updated Order Delivered");
|
showSnackbar("Order Status updated Order Delivered");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Show a message if the status is not "Delivered"
|
// Show a message if the status is not "Delivered"
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@ -504,7 +510,7 @@ class _RdDispatchedDetailsDetailScreenState
|
|||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10)),
|
||||||
),
|
),
|
||||||
child: Text(widget.placedOrderList!.courierStatus, style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.w400)),
|
child: Text(capitalizeFirstLetter(widget.placedOrderList!.courierStatus), style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.w400)),
|
||||||
),
|
),
|
||||||
//Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
//Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
||||||
],
|
],
|
||||||
@ -516,214 +522,50 @@ class _RdDispatchedDetailsDetailScreenState
|
|||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
const SizedBox(height: 8),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height* 0.19,
|
height: Get.height* 0.19,
|
||||||
child: Card(
|
child:_buildCustomerDetails(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Customer Details",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
//height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Name: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"Roshan Garg"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Email: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"roshangarg28@gmail.com"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Mobile Number: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"8876785448"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildBillingInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Billing Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"456, Park Street, Kolkata, West Bengal - 700016"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// Card for displaying shipping information
|
_buildShippingInfo(),
|
||||||
Card(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Shipping Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"456, Park Street, Kolkata, West Bengal - 700016"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildPaymentInfo(),
|
||||||
child: Column(
|
// Card(
|
||||||
children: [
|
// child: Column(
|
||||||
SizedBox(
|
// children: [
|
||||||
width: Get.width,
|
// SizedBox(
|
||||||
height: Get.height*0.05,
|
// width: Get.width,
|
||||||
child: Padding(
|
// height: Get.height*0.05,
|
||||||
padding:
|
// child: Padding(
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
// padding:
|
||||||
child: Row(
|
// const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
children: [
|
// child: Row(
|
||||||
Text(
|
// children: [
|
||||||
"Payment Mode : ",
|
// Text(
|
||||||
style: GoogleFonts.roboto(
|
// "Payment Mode : ",
|
||||||
fontSize: Get.width * 0.04,
|
// style: GoogleFonts.roboto(
|
||||||
fontWeight: FontWeight.w500,
|
// fontSize: Get.width * 0.04,
|
||||||
),
|
// fontWeight: FontWeight.w500,
|
||||||
),
|
// ),
|
||||||
Text(capitalizeFirstLetter("Cheque")),
|
// ),
|
||||||
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
// Text(capitalizeFirstLetter("Cheque")),
|
||||||
// overflow:TextOverflow.ellipsis,)
|
// // Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
||||||
],
|
// // overflow:TextOverflow.ellipsis,)
|
||||||
),
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
|
// ),
|
||||||
|
//
|
||||||
],
|
//
|
||||||
),
|
// ],
|
||||||
),
|
// ),
|
||||||
|
// ),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -835,4 +677,119 @@ class _RdDispatchedDetailsDetailScreenState
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildCustomerDetails() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Customer Details"),
|
||||||
|
_buildRow("Name:", widget.placedInvoiceList!.orderId!.addedBy!.name.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Email:", widget.placedInvoiceList!.orderId!.addedBy!.email.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Mobile Number:", widget.placedInvoiceList!.orderId!.addedBy!.mobileNumber.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBillingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Billing Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedInvoiceList!.orderId!.billTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildShippingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Shipping Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedInvoiceList!.orderId!.shipTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPaymentInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Payment Mode: ",
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
fontSize: Get.width * 0.04,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(capitalizeFirstLetter(widget.placedInvoiceList!.orderId!.paymentMode.toString())),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildSectionTitle(String title) {
|
||||||
|
return SizedBox(
|
||||||
|
width: Get.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.roboto(fontSize: Get.width * 0.05, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize,fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$label: ",
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
import 'package:cheminova/controller/get_dispatch_service.dart';
|
||||||
|
import 'package:cheminova/controller/get_single_invoice_Service.dart';
|
||||||
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
||||||
import 'package:cheminova/models/get_dispatch_model.dart';
|
import 'package:cheminova/models/get_dispatch_model.dart';
|
||||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||||
@ -13,8 +15,10 @@ 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_dispatch_controller.dart';
|
import '../../controller/get_dispatch_controller.dart';
|
||||||
|
import '../../controller/get_single_invoice_controller.dart';
|
||||||
import '../order_management/order_management_detail_screen.dart';
|
import '../order_management/order_management_detail_screen.dart';
|
||||||
|
|
||||||
class RdDispatchedScreen extends StatefulWidget {
|
class RdDispatchedScreen extends StatefulWidget {
|
||||||
@ -36,6 +40,7 @@ class _RdDispatchedScreenState extends State<RdDispatchedScreen> {
|
|||||||
"delivered",];
|
"delivered",];
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
final GetDispatchController _getRdProductController = Get.put(GetDispatchController());
|
final GetDispatchController _getRdProductController = Get.put(GetDispatchController());
|
||||||
|
final GetSingleInvoiceController _getSingleInvoiceController = Get.put(GetSingleInvoiceController());
|
||||||
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -58,6 +63,62 @@ class _RdDispatchedScreenState extends State<RdDispatchedScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void onOrderTap(int index) async {
|
||||||
|
try {
|
||||||
|
// Fetch orders and ensure you wait for it to complete
|
||||||
|
await _getRdProductController.getRDDispatchInvoiceProduct();
|
||||||
|
|
||||||
|
// Log the count of fetched orders
|
||||||
|
print('Fetched orders count: ${_getRdProductController.productProcessingRDList.length}');
|
||||||
|
|
||||||
|
// Check if the productRDList is populated
|
||||||
|
if (_getRdProductController.productProcessingRDList.isNotEmpty) {
|
||||||
|
// Ensure the index is valid
|
||||||
|
if (index >= 0 && index < _getRdProductController.productProcessingRDList.length) {
|
||||||
|
// Get the order ID from the list based on the index
|
||||||
|
final orderId = _getRdProductController.productProcessingRDList[index].id;
|
||||||
|
final orderId1 = _getRdProductController.productProcessingRDList[index].id;
|
||||||
|
// 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, and avoid caching issues
|
||||||
|
final singleOrder = await GetSingleInvoiceService().fetchInvoice(token, orderId);
|
||||||
|
final invoiceOrder = await GetDispatchService().getRDDispatchedProduct(token);
|
||||||
|
// Check if the single order was fetched successfully
|
||||||
|
if (singleOrder != null) {
|
||||||
|
// Navigate to the details screen with the fetched order
|
||||||
|
Get.to(() => RdDispatchedDetailsDetailScreen(
|
||||||
|
placedOrderList: invoiceOrder![index],
|
||||||
|
placedInvoiceList: singleOrder,
|
||||||
|
));
|
||||||
|
} 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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String capitalizeFirstLetter(String text) {
|
String capitalizeFirstLetter(String text) {
|
||||||
if (text.isEmpty) return text;
|
if (text.isEmpty) return text;
|
||||||
return text[0].toUpperCase() + text.substring(1).toLowerCase();
|
return text[0].toUpperCase() + text.substring(1).toLowerCase();
|
||||||
@ -68,7 +129,8 @@ class _RdDispatchedScreenState extends State<RdDispatchedScreen> {
|
|||||||
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
|
||||||
}
|
}
|
||||||
@ -336,10 +398,14 @@ class _RdDispatchedScreenState extends State<RdDispatchedScreen> {
|
|||||||
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);
|
||||||
RdDispatchedDetailsDetailScreen(
|
},
|
||||||
placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
// Get.to(() =>
|
||||||
|
// RdDispatchedDetailsDetailScreen(
|
||||||
|
// 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),
|
||||||
|
@ -458,6 +458,9 @@ class _RdOrderDetailUpdateScreenState
|
|||||||
itemCount: widget.placedOrderList!.orderItem!.length ?? 0,
|
itemCount: widget.placedOrderList!.orderItem!.length ?? 0,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final orderItem = widget.placedOrderList!.orderItem![index];
|
final orderItem = widget.placedOrderList!.orderItem![index];
|
||||||
|
final subTotalProcesssItem = orderItem.price! * orderItem.quantity!.toInt();
|
||||||
|
final GstTotalAmounProcessItem = (orderItem.price! * orderItem.quantity!.toInt()) *(orderItem.gst!/100 );
|
||||||
|
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||||
return orderItem != null
|
return orderItem != null
|
||||||
? Card(
|
? Card(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
@ -486,9 +489,17 @@ class _RdOrderDetailUpdateScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("Quantity: ${orderItem.quantity}"),
|
Text(
|
||||||
Text("Price: ₹${orderItem.price}"),
|
"Quantity: ${orderItem.quantity}",
|
||||||
Text("GST: ${orderItem.gst}%"),
|
style: GoogleFonts.roboto(
|
||||||
|
fontSize: Get.width * 0.03,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text("Price: ${orderItem.price}"),
|
||||||
|
Text("Subtotal : ${subTotalProcesssItem}"),
|
||||||
|
Text("GST : ${orderItem.gst}%"),
|
||||||
|
Text("GST Amount (₹) : ${GstTotalAmounProcessItem}"),
|
||||||
|
Text("Total Amount : ${grandTotalProcessItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -667,7 +678,7 @@ class _RdOrderDetailUpdateScreenState
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: GoogleFonts.roboto(fontSize: fontSize),
|
style: GoogleFonts.roboto(fontSize: fontSize,fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
|
@ -87,7 +87,8 @@ class _RdOrderScreenState extends State<RdOrderScreen> {
|
|||||||
DateTime.parse(apiDate).toLocal(); // Convert to local time
|
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
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ 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/partial_pending_dialog.dart';
|
import 'package:cheminova/screens/rd%20orders/partial_pending_dialog.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/partial_processing_dialog_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/partial_processing_dialog_screen.dart';
|
||||||
|
import 'package:cheminova/screens/rd%20orders/rd_cancelled_screen.dart';
|
||||||
import 'package:cheminova/screens/rd%20orders/rd_processing_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_processing_screen.dart';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@ -128,6 +129,11 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
.map((item) => (item.quantity))
|
.map((item) => (item.quantity))
|
||||||
.join(', ');
|
.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
@ -136,6 +142,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
selectedStatus= widget.placedOrderList?.status ?? 'new';
|
selectedStatus= widget.placedOrderList?.status ?? 'new';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Future<void> getOrder1() async {
|
// Future<void> getOrder1() async {
|
||||||
// await _getSingleInvoiceController.fetchInvoice(widget.placedOrderList!.id);
|
// await _getSingleInvoiceController.fetchInvoice(widget.placedOrderList!.id);
|
||||||
// if (_getSingleInvoiceController.invoice.isEmpty) {
|
// if (_getSingleInvoiceController.invoice.isEmpty) {
|
||||||
@ -207,7 +214,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
|
|
||||||
// Notify user about successful cancellation
|
// Notify user about successful cancellation
|
||||||
showSnackbar("Order cancelled successfully");
|
showSnackbar("Order cancelled successfully");
|
||||||
|
Get.to(RdCancelledScreen());
|
||||||
// Update the status in your UI or backend to reflect the cancelled state
|
// Update the status in your UI or backend to reflect the cancelled state
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
@ -216,7 +223,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
Navigator.of(context).pop(); // Close the dialog
|
Navigator.of(context).pop(); // Close the dialog
|
||||||
});
|
});
|
||||||
|
|
||||||
return; // Exit here to prevent further processing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedStatus == "partial processing") {
|
if (selectedStatus == "partial processing") {
|
||||||
@ -303,10 +310,21 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color _getCourierStatusColor(String status) {
|
||||||
|
switch (status.toLowerCase()) {
|
||||||
|
case 'processing':
|
||||||
|
return Colors.orange;
|
||||||
|
case 'dispatched':
|
||||||
|
return Colors.lightBlue;
|
||||||
|
case 'delivered':
|
||||||
|
return Colors.green;
|
||||||
|
default:
|
||||||
|
return Colors.grey; // Default color for unknown statuses
|
||||||
|
}
|
||||||
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
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,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -397,7 +415,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(widget.placedOrderList!.uniqueId.toString()),
|
Text(widget.placeInvoiceList!.invoiceId.toString()),
|
||||||
// Text(widget.placedOrderList!.uniqueId),
|
// Text(widget.placedOrderList!.uniqueId),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -420,7 +438,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
SizedBox(height: 10), // Add spacing between the title and the list of items
|
SizedBox(height: 10), // Add spacing between the title and the list of items
|
||||||
Column(
|
Column(
|
||||||
children: widget.placedOrderList!.orderItem!.map((item) {
|
children: widget.placeInvoiceList!.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), // Add some spacing between items
|
||||||
@ -436,7 +454,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
overflow: TextOverflow.ellipsis, // Handle long text
|
overflow: TextOverflow.ellipsis, // Handle long text
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("x ${remainingQuantity.toString()}"),
|
Text("x ${item.processQuantity.toString()}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -461,32 +479,13 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.subtotal}"),
|
Text("₹ ${widget.placeInvoiceList!.subtotal}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// SizedBox(
|
|
||||||
// width: Get.width,
|
|
||||||
// child: Padding(
|
|
||||||
// padding:
|
|
||||||
// const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// "Gst %: ",
|
|
||||||
// style: GoogleFonts.roboto(
|
|
||||||
// fontSize: Get.width * 0.04,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Text(" ${widget.placedOrderList!.orderItem[0].gst}%"),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -502,7 +501,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
Text("₹ ${widget.placeInvoiceList!.gstTotal}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -522,7 +521,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text("₹ ${widget.placedOrderList!.grandTotal}"),
|
Text("₹ ${widget.placeInvoiceList!.invoiceAmount}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -549,19 +548,20 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
// placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
// placedOrderList: uniqueOrders[index])), // Navigate to detail screen
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor:_getCourierStatusColor(widget.placeInvoiceList!.courierStatus.toString()),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10)),
|
||||||
),
|
),
|
||||||
child: Text("Processing"),
|
child: Text(capitalizeFirstLetter(widget.placeInvoiceList!.courierStatus.toString()),
|
||||||
// Text(widget.placedOrderList!.status.toString())
|
// Text(widget.placedOrderList!.status.toString())
|
||||||
//Text(widget.placedOrderList!.status, style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.w400)),
|
//Text(widget.placedOrderList!.status, style: GoogleFonts.roboto(fontSize: 14, fontWeight: FontWeight.w400)),
|
||||||
),
|
),
|
||||||
//Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
//Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
||||||
],
|
)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -594,6 +594,9 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
itemCount: widget.placedOrderList?.orderItem!.length ?? 0,
|
itemCount: widget.placedOrderList?.orderItem!.length ?? 0,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final orderItem = widget.placedOrderList!.orderItem![index];
|
final orderItem = widget.placedOrderList!.orderItem![index];
|
||||||
|
final subTotal = orderItem.price * orderItem.quantity!.toInt();
|
||||||
|
final GstTotalAmount = (orderItem.price * orderItem.quantity!.toInt()) *(orderItem.gst/100 );
|
||||||
|
final grandTotal = subTotal + GstTotalAmount;
|
||||||
return orderItem != null
|
return orderItem != null
|
||||||
? Card(
|
? Card(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
@ -613,10 +616,11 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
capitalizeFirstLetter(orderItem.name),
|
capitalizeFirstLetter(orderItem.name.toString()),
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: Get.width * 0.04,
|
fontSize: Get.width * 0.04,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -628,11 +632,12 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontSize: Get.width * 0.03,
|
fontSize: Get.width * 0.03,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Text("Price: ${orderItem.price}"),
|
Text("Price: ${orderItem.price}"),
|
||||||
Text("Subtotal: ${widget.placedOrderList!.subtotal}"),
|
Text("Subtotal: ${subTotal}"),
|
||||||
Text("Gst: ${orderItem.gst}%"),
|
Text("GSt: ${orderItem.gst}%"),
|
||||||
Text("GST Total: ${widget.placedOrderList!.gstTotal}"),
|
Text("GST Amount (₹): ${GstTotalAmount}"),
|
||||||
Text("Total Amount: ${widget.placedOrderList!.grandTotal}"),
|
Text("Total Amount (₹): ${grandTotal}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -677,12 +682,17 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
?.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 = widget.placedOrderList!.orderItem!
|
||||||
.where((item) => item.remainingQuantity! > 0)
|
.where((item) => item.remainingQuantity! > 0)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final orderItem = filteredItems[index];
|
final orderItem = filteredItems[index];
|
||||||
|
final subTotalProcesssItem = orderItem.price! * orderItem.remainingQuantity!.toInt();
|
||||||
|
final GstTotalAmounProcessItem = (orderItem.price! * orderItem.remainingQuantity!.toInt()) *(orderItem.gst!/100 );
|
||||||
|
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
@ -705,7 +715,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
capitalizeFirstLetter(orderItem.name),
|
capitalizeFirstLetter(orderItem.name.toString()),
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: Get.width * 0.04,
|
fontSize: Get.width * 0.04,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -713,10 +723,10 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
Text("Quantity: ${orderItem.remainingQuantity}"),
|
Text("Quantity: ${orderItem.remainingQuantity}"),
|
||||||
Text("Price: ${orderItem.price}"),
|
Text("Price: ${orderItem.price}"),
|
||||||
Text("Subtotal: ${widget.placedOrderList!.subtotal}"),
|
Text("Subtotal: ${subTotalProcesssItem}"),
|
||||||
Text("Gst: ${orderItem.gst}%"),
|
Text("Gst: ${orderItem.gst}%"),
|
||||||
Text("GST Total: ${widget.placedOrderList!.gstTotal}"),
|
Text("GST Total: ${GstTotalAmounProcessItem}"),
|
||||||
Text("Total Amount: ${widget.placedOrderList!.grandTotal}"),
|
Text("Total Amount: ${grandTotalProcessItem}"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -737,180 +747,15 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height* 0.19,
|
height: Get.height* 0.19,
|
||||||
child: Card(
|
child:_buildCustomerDetails(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Customer Details",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
//height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Name: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"Roshan Garg"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Email: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"roshangarg28@gmail.com"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Mobile Number: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${"8876785448"}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
, ],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildBillingInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Billing Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${widget.placedOrderList!.billTo}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// Card for displaying shipping information
|
_buildShippingInfo(),
|
||||||
Card(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Shipping Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height*0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${widget.placedOrderList!.shipTo}",maxLines: 4,
|
|
||||||
overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -930,7 +775,7 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(capitalizeFirstLetter(widget.placedOrderList!.paymentMode.toString())),
|
Text(capitalizeFirstLetter(widget.placeInvoiceList!.orderId!.paymentMode.toString())),
|
||||||
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
||||||
// overflow:TextOverflow.ellipsis,)
|
// overflow:TextOverflow.ellipsis,)
|
||||||
],
|
],
|
||||||
@ -963,7 +808,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("${widget.placedOrderList!.status}",maxLines: 4,
|
Text(capitalizeFirstLetter(widget.placedOrderList!.status.toString()),maxLines: 4,
|
||||||
overflow:TextOverflow.ellipsis,)
|
overflow:TextOverflow.ellipsis,)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -1053,4 +898,146 @@ class _RdOrderPendingScreenDetailScreenState
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildBillingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Billing Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedOrderList!.billTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildShippingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Shipping Information"),
|
||||||
|
_buildInfoRow("Address", widget.placedOrderList!.shipTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCustomerDetails() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Customer Details"),
|
||||||
|
_buildRow("Name:", widget.placedOrderList!.addedBy!.name, Get.width * 0.04),
|
||||||
|
_buildRow("Email:", widget.placedOrderList!.addedBy!.email, Get.width * 0.04),
|
||||||
|
_buildRow("Mobile Number:", widget.placedOrderList!.addedBy!.mobileNumber, Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildInfoRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$label: ",
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize,fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSectionTitle(String title) {
|
||||||
|
return SizedBox(
|
||||||
|
width: Get.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.roboto(fontSize: Get.width * 0.05, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class simple extends State<RdOrderPendingScreenDetailScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
width: Get.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Courier Status : ",
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
fontSize: Get.width * 0.04,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
backgroundColor: _getCourierStatusColor(widget.placeInvoiceList!.courierStatus.toString()), // Call the method here
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(widget.placeInvoiceList!.courierStatus.toString()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to get the color based on the status
|
||||||
|
Color _getCourierStatusColor(String status) {
|
||||||
|
switch (status.toLowerCase()) {
|
||||||
|
case 'processing':
|
||||||
|
return Colors.orange; // Orange for processing
|
||||||
|
case 'dispatched':
|
||||||
|
return Colors.lightBlue; // Light blue for dispatched
|
||||||
|
case 'delivered':
|
||||||
|
return Colors.green; // Green for delivered
|
||||||
|
default:
|
||||||
|
return Colors.grey; // Default color if status doesn't match
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import 'package:cheminova/controller/get_rd_pending_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_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/screens/rd%20orders/rd_order_details_screen.dart';
|
import 'package:cheminova/screens/rd%20orders/rd_order_details_screen.dart';
|
||||||
@ -16,6 +17,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../controller/get_single_invoice_Service.dart';
|
import '../../controller/get_single_invoice_Service.dart';
|
||||||
|
import '../../controller/get_single_invoice_controller.dart';
|
||||||
import '../../controller/rd_get_single_service.dart';
|
import '../../controller/rd_get_single_service.dart';
|
||||||
import '../order_management/order_management_detail_screen.dart';
|
import '../order_management/order_management_detail_screen.dart';
|
||||||
|
|
||||||
@ -38,6 +40,8 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
"delivered",];
|
"delivered",];
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
final GetRdPendingController _getRdPendingController = Get.put(GetRdPendingController());
|
final GetRdPendingController _getRdPendingController = Get.put(GetRdPendingController());
|
||||||
|
final GetSingleInvoiceController _getSingleInvoiceController = Get.put(GetSingleInvoiceController());
|
||||||
|
final GetRDProcessingInvoiceController _getRDProcessingInvoiceController = Get.put(GetRDProcessingInvoiceController());
|
||||||
// final GetProductRDController _getRdProductController =
|
// final GetProductRDController _getRdProductController =
|
||||||
// Get.put(GetProductRDController());
|
// Get.put(GetProductRDController());
|
||||||
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
|
||||||
@ -73,7 +77,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
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
|
||||||
}
|
}
|
||||||
@ -84,6 +88,9 @@ 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}');
|
||||||
|
|
||||||
@ -93,7 +100,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
if (index >= 0 && index < _getRdPendingController.productRDList.length) {
|
if (index >= 0 && index < _getRdPendingController.productRDList.length) {
|
||||||
// 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];
|
||||||
// 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');
|
||||||
@ -102,7 +109,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
|||||||
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, and avoid caching issues
|
||||||
final singleOrder = await GetSingleProductService().getSingleOrder(token, orderId);
|
final singleOrder = await GetSingleProductService().getSingleOrder(token, orderId);
|
||||||
final singleInvoice = await GetSingleInvoiceService().fetchInvoice(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
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cheminova/screens/rd%20orders/rd_dispatched_scree.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -122,6 +123,7 @@ class _RdOrderProcessingDetailScreenState extends State<RdOrderProcessingDetailS
|
|||||||
// Call the API to submit data
|
// Call the API to submit data
|
||||||
_getDispatchController.RDProcessingToDispatchProduct(widget.placeInvoiceList!.id.toString(), courierName, courierTrackingId);
|
_getDispatchController.RDProcessingToDispatchProduct(widget.placeInvoiceList!.id.toString(), courierName, courierTrackingId);
|
||||||
showSnackbar("Order Status updated Order Dispatched");
|
showSnackbar("Order Status updated Order Dispatched");
|
||||||
|
|
||||||
Navigator.of(context).pop(); // Close the dialog after submission
|
Navigator.of(context).pop(); // Close the dialog after submission
|
||||||
},
|
},
|
||||||
child: Text('Submit'),
|
child: Text('Submit'),
|
||||||
@ -404,228 +406,18 @@ class _RdOrderProcessingDetailScreenState extends State<RdOrderProcessingDetailS
|
|||||||
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.height * 0.19,
|
height: Get.height* 0.19,
|
||||||
child: Card(
|
child:_buildCustomerDetails(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Customer Details",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
//height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Name: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("${widget.placeInvoiceList!.orderId!.addedBy!.name}", maxLines: 4,
|
|
||||||
overflow: TextOverflow
|
|
||||||
.ellipsis,)
|
|
||||||
,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Email: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"${widget.placeInvoiceList!.orderId!.addedBy!.email}",
|
|
||||||
maxLines: 4,
|
|
||||||
overflow: TextOverflow
|
|
||||||
.ellipsis,)
|
|
||||||
,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
// height: Get.height*0.09,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Mobile Number: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"${widget.placeInvoiceList!.orderId!.addedBy!.mobileNumber}", maxLines: 4,
|
|
||||||
overflow: TextOverflow
|
|
||||||
.ellipsis,)
|
|
||||||
,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildBillingInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Billing Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height * 0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment
|
|
||||||
.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"${widget.placeInvoiceList!.orderId!.billTo}",
|
|
||||||
maxLines: 4,
|
|
||||||
overflow: TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// Card for displaying shipping information
|
_buildShippingInfo(),
|
||||||
Card(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Text(
|
|
||||||
"Shipping Information",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.05,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height * 0.06,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Wrap(
|
|
||||||
crossAxisAlignment: WrapCrossAlignment
|
|
||||||
.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Address: ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"${widget.placeInvoiceList!.orderId!.shipTo}",
|
|
||||||
maxLines: 4,
|
|
||||||
overflow: TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
_buildPaymentInfo(),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: Get.height * 0.05,
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Payment Mode : ",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: Get.width * 0.04,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(capitalizeFirstLetter(
|
|
||||||
widget.placeInvoiceList!.orderId!.paymentMode.toString())),
|
|
||||||
// Text("${widget.placedOrderList!.paymentMode}",maxLines: 4,
|
|
||||||
// overflow:TextOverflow.ellipsis,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Card(
|
Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -749,6 +541,115 @@ class _RdOrderProcessingDetailScreenState extends State<RdOrderProcessingDetailS
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildCustomerDetails() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Customer Details"),
|
||||||
|
_buildRow("Name:", widget.placeInvoiceList!.orderId!.addedBy!.name.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Email:", widget.placeInvoiceList!.orderId!.addedBy!.email.toString(), Get.width * 0.04),
|
||||||
|
_buildRow("Mobile Number:", widget.placeInvoiceList!.orderId!.addedBy!.mobileNumber.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBillingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Billing Information"),
|
||||||
|
_buildInfoRow("Address", widget.placeInvoiceList!.orderId!.billTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildShippingInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSectionTitle("Shipping Information"),
|
||||||
|
_buildInfoRow("Address", widget.placeInvoiceList!.orderId!.shipTo.toString(), Get.width * 0.04),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPaymentInfo() {
|
||||||
|
return Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Payment Mode: ",
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
fontSize: Get.width * 0.04,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(capitalizeFirstLetter(widget.placeInvoiceList!.orderId!.paymentMode.toString())),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildSectionTitle(String title) {
|
||||||
|
return SizedBox(
|
||||||
|
width: Get.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.roboto(fontSize: Get.width * 0.05, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize,fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoRow(String label, String value, double fontSize) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$label: ",
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: GoogleFonts.roboto(fontSize: fontSize),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ class _RdOrderProcessingScreenState extends State<RdOrderProcessingScreen> {
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class ApiUrls {
|
|||||||
|
|
||||||
|
|
||||||
//============================== Notification Details ==============================//
|
//============================== Notification Details ==============================//
|
||||||
static const String getNotificationUrl = '/api/get-notification-pd';
|
static const String getNotificationUrl = '${baseUrl}/api/get-notification-pd/';
|
||||||
|
|
||||||
//============================== Kyc Details ==============================//
|
//============================== Kyc Details ==============================//
|
||||||
static const String getKycUrl = '${baseUrl}/api/kyc/getAll';
|
static const String getKycUrl = '${baseUrl}/api/kyc/getAll';
|
||||||
@ -78,7 +78,8 @@ class ApiUrls {
|
|||||||
|
|
||||||
|
|
||||||
//============================== Annaouncement Details ==============================//
|
//============================== Annaouncement Details ==============================//
|
||||||
static const String AnnaouncementUrl = '${baseUrl}/api/announcement/PDs';
|
static const String AnnaouncementUrl = '/api/announcement/PDs';
|
||||||
|
|
||||||
|
|
||||||
|
//============================== Annaouncement Details ==============================//
|
||||||
|
static const String ShiptoandBilltoAddressUrl = '/api/shipping/address/user/address';
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ Future<BodyType?> commonApiService<BodyType>({
|
|||||||
File? imageFile, // Optional image file for upload
|
File? imageFile, // Optional image file for upload
|
||||||
bool isformData = true,
|
bool isformData = true,
|
||||||
Map<String, String>? additionalHeaders, // Additional headers for the request
|
Map<String, String>? additionalHeaders, // Additional headers for the request
|
||||||
|
Map<String, String>? queryParameters, // Optional query parameters
|
||||||
required BodyType Function(Map<String, dynamic>) fromJson,// Function to parse the response data
|
required BodyType Function(Map<String, dynamic>) fromJson,// Function to parse the response data
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
|
@ -4,7 +4,7 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
class CommonAppBar extends StatelessWidget implements PreferredSizeWidget {
|
class CommonAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
final Widget title;
|
final Widget title;
|
||||||
final List<Widget>? actions;
|
final List<Widget>? actions;
|
||||||
final TabBar? bottom;
|
final PreferredSizeWidget? bottom; // Changed to PreferredSizeWidget?
|
||||||
|
|
||||||
const CommonAppBar({super.key, required this.title, this.actions, required Color backgroundColor, required int elevation, this.bottom});
|
const CommonAppBar({super.key, required this.title, this.actions, required Color backgroundColor, required int elevation, this.bottom});
|
||||||
|
|
||||||
@ -28,5 +28,5 @@ class CommonAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
Size get preferredSize => Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0)); // Adjusted to account for the bottom height
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user