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