|  |  |  | @ -6,6 +6,7 @@ import 'package:geolocator/geolocator.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/companyoffrers.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/getmedicines.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/maps/app_colors.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/medicinecart.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/models/addoffer_model.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/models/biddingrequest_model.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:healthcare_pharmacy/models/companyoffer_model.dart'; | 
			
		
	
	
		
			
				
					|  |  |  | @ -15,8 +16,11 @@ import 'package:image_picker/image_picker.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | import 'package:photo_view/photo_view.dart'; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | class GetAllOffers extends StatefulWidget { | 
			
		
	
		
			
				
					|  |  |  |  |   const GetAllOffers({Key? key}) : super(key: key); | 
			
		
	
		
			
				
					|  |  |  |  |   var bookidID; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   GetAllOffers({ | 
			
		
	
		
			
				
					|  |  |  |  |     this.bookidID | 
			
		
	
		
			
				
					|  |  |  |  |   }); | 
			
		
	
		
			
				
					|  |  |  |  |   @override | 
			
		
	
		
			
				
					|  |  |  |  |   State<GetAllOffers> createState() => _GetAllOffersState(); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | @ -29,6 +33,10 @@ class _GetAllOffersState extends State<GetAllOffers> { | 
			
		
	
		
			
				
					|  |  |  |  |   bool isSereverIssue = false; | 
			
		
	
		
			
				
					|  |  |  |  |   bool isLoading=false; | 
			
		
	
		
			
				
					|  |  |  |  |   List<String> checked = []; | 
			
		
	
		
			
				
					|  |  |  |  |   TextEditingController BookingidController = TextEditingController(); | 
			
		
	
		
			
				
					|  |  |  |  |   TextEditingController offerCodeController = TextEditingController(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   Future<void> getActiveOffersViewData() async { | 
			
		
	
	
		
			
				
					|  |  |  | @ -56,8 +64,8 @@ class _GetAllOffersState extends State<GetAllOffers> { | 
			
		
	
		
			
				
					|  |  |  |  |   @override | 
			
		
	
		
			
				
					|  |  |  |  |   void initState() { | 
			
		
	
		
			
				
					|  |  |  |  |     getActiveOffersViewData(); | 
			
		
	
		
			
				
					|  |  |  |  |     //getAllPharmaciesData(dropdownArea); | 
			
		
	
		
			
				
					|  |  |  |  |     super.initState(); | 
			
		
	
		
			
				
					|  |  |  |  |     BookingidController.text=widget.bookidID; | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   void _onCheckboxChanged(String id, bool value) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -226,12 +234,32 @@ class _GetAllOffersState extends State<GetAllOffers> { | 
			
		
	
		
			
				
					|  |  |  |  |                   primary: primaryColor, // background | 
			
		
	
		
			
				
					|  |  |  |  |                   onPrimary: Colors.white, // foreground | 
			
		
	
		
			
				
					|  |  |  |  |                 ), | 
			
		
	
		
			
				
					|  |  |  |  |                 onPressed: ()  async{ | 
			
		
	
		
			
				
					|  |  |  |  |                   Navigator.of(context).pop(); | 
			
		
	
		
			
				
					|  |  |  |  |                  /* Navigator.push( | 
			
		
	
		
			
				
					|  |  |  |  |                       context, | 
			
		
	
		
			
				
					|  |  |  |  |                       new MaterialPageRoute( | 
			
		
	
		
			
				
					|  |  |  |  |                           builder: (__) => new CompanyOffers(phid: checked.toString())));*/ | 
			
		
	
		
			
				
					|  |  |  |  |                 onPressed: ()async { | 
			
		
	
		
			
				
					|  |  |  |  |                   // Get the selected offer code from the checked list | 
			
		
	
		
			
				
					|  |  |  |  |                   String selectedOfferCode = checked.isNotEmpty ? checked[0] : ''; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                   // Check if an offer code is selected | 
			
		
	
		
			
				
					|  |  |  |  |                   if (selectedOfferCode.isNotEmpty) { | 
			
		
	
		
			
				
					|  |  |  |  |                     bool discountOfferStatus = await AppSettings.discountOffer( | 
			
		
	
		
			
				
					|  |  |  |  |                       selectedOfferCode, | 
			
		
	
		
			
				
					|  |  |  |  |                       widget.bookidID, | 
			
		
	
		
			
				
					|  |  |  |  |                     ); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if (discountOfferStatus) { | 
			
		
	
		
			
				
					|  |  |  |  |                       AppSettings.longSuccessToast('Offer added successfully'); | 
			
		
	
		
			
				
					|  |  |  |  |                       Navigator.of(context).pop(true); | 
			
		
	
		
			
				
					|  |  |  |  |                       await Navigator.push( | 
			
		
	
		
			
				
					|  |  |  |  |                         context, | 
			
		
	
		
			
				
					|  |  |  |  |                         MaterialPageRoute( | 
			
		
	
		
			
				
					|  |  |  |  |                             builder: (context) => MedicineCartList()) | 
			
		
	
		
			
				
					|  |  |  |  |                       ); | 
			
		
	
		
			
				
					|  |  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |  |                       AppSettings.longFailedToast('Offer addition failed'); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                   } else { | 
			
		
	
		
			
				
					|  |  |  |  |                     // Handle the case where no offer code is selected | 
			
		
	
		
			
				
					|  |  |  |  |                     AppSettings.longFailedToast('Please select an offer'); | 
			
		
	
		
			
				
					|  |  |  |  |                   } | 
			
		
	
		
			
				
					|  |  |  |  |                 }, | 
			
		
	
		
			
				
					|  |  |  |  |                 child:  Text('Submit'), | 
			
		
	
		
			
				
					|  |  |  |  |               )), | 
			
		
	
	
		
			
				
					|  |  |  | 
 |