code updated 03/01/24

master
suresh 11 months ago
parent a2c3141e67
commit d28a3a7148

@ -172,9 +172,9 @@ class _BiddingRequestsState extends State<BiddingRequests> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(prescriptionsList[index].bidding_firstName.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].bidding_firstName.toString().toUpperCase(),style: valuesTextStyle()),
//Text(prescriptionsList[index].bidding_contactNumber.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].bidding_contactNumber.toString().toUpperCase(),style: valuesTextStyle()),
Text(prescriptionsList[index].bidding_bookingid.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].bidding_bookingid.toString().toUpperCase(),style: valuesTextStyle()),
Text(prescriptionsList[index].amount_bidding.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].bidding_address.toString().toUpperCase(),style: valuesTextStyle()),
Text(prescriptionsList[index].custumerid_bidding.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].custumerid_bidding.toString().toUpperCase(),style: valuesTextStyle()),
Text(prescriptionsList[index].pharmacyid_bidding.toString().toUpperCase(),style: valuesTextStyle()), Text(prescriptionsList[index].pharmacyid_bidding.toString().toUpperCase(),style: valuesTextStyle()),
], ],

@ -326,7 +326,7 @@ class _offersState extends State<offers> {
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor), borderSide: BorderSide(color: greyColor),
), ),
labelText: 'Type of water storage', labelText: 'Select Type of Category',
labelStyle: TextStyle( labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
@ -547,13 +547,18 @@ class _offersState extends State<offers> {
bool offerStatus = await AppSettings.createOffers(payload); bool offerStatus = await AppSettings.createOffers(payload);
try{ try{
if (offerStatus) { if (offerStatus) {
Navigator.pop(context);
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
AppSettings.longSuccessToast("Offer Created Succesfully!!");
offer_nameController.text = '' ;
offer_codeController.text = '' ;
descriptionController.text = '';
starting_dateController.text = '';
ending_dateController.text = '';
Navigator.pop(context);
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => Dashboard()), MaterialPageRoute(builder: (context) => Dashboard()),
); );
AppSettings.longSuccessToast("Offer Created Succesfully!!");
} else { } else {
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Please enter all fields"); AppSettings.longFailedToast("Please enter all fields");

@ -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] : '';
// 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, context,
new MaterialPageRoute( MaterialPageRoute(
builder: (__) => new CompanyOffers(phid: checked.toString())));*/ 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'),
)), )),

@ -136,7 +136,6 @@ class _GetMedicinesState extends State<GetMedicines> with TickerProviderStateMix
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * .18, width: MediaQuery.of(context).size.width * .18,
@ -150,7 +149,6 @@ class _GetMedicinesState extends State<GetMedicines> with TickerProviderStateMix
), ),
onTap: () async { onTap: () async {
showPicDialog(medImages[0]); showPicDialog(medImages[0]);
}, },
), ),
GestureDetector( GestureDetector(

@ -205,7 +205,7 @@ class _MedicineCartListState extends State<MedicineCartList> with TickerProvider
), ),
), ),
),), ),),
Container( /* Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: 30, height: 30,
child: Align( child: Align(
@ -215,7 +215,7 @@ class _MedicineCartListState extends State<MedicineCartList> with TickerProvider
await Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const GetAllOffers()), builder: (context) => GetAllOffers(bookidID:BookingidController.text.toString())),
); );
}, },
child: Text( child: Text(
@ -229,7 +229,7 @@ class _MedicineCartListState extends State<MedicineCartList> with TickerProvider
), ),
), ),
), ),
), ),*/
SizedBox( SizedBox(
height: 10, height: 10,

@ -7,8 +7,8 @@ class BiddingRequestsModel {
String? amount_bidding=''; String? amount_bidding='';
String? bidding_bookingid=''; String? bidding_bookingid='';
String? bidding_firstName=''; String? bidding_firstName='';
// String? bidding_contactNumber=''; String? bidding_contactNumber='';
String? bidding_address1=''; String? bidding_address='';
String orderStatus=''; String orderStatus='';
String status=''; String status='';
@ -28,6 +28,9 @@ class BiddingRequestsModel {
rtvm.amount_bidding = json['biddingAmount'].toString() ?? ''; rtvm.amount_bidding = json['biddingAmount'].toString() ?? '';
rtvm.bidding_bookingid = json['bookingId'].toString() ?? ''; rtvm.bidding_bookingid = json['bookingId'].toString() ?? '';
rtvm.bidding_firstName = json['customerDetails']["firstName"].toString() ?? ''; rtvm.bidding_firstName = json['customerDetails']["firstName"].toString() ?? '';
rtvm.bidding_firstName = json['customerDetails']["address1"].toString() ?? '';
rtvm.bidding_firstName = json['customerDetails']["firstName"].toString() ?? '';
rtvm.status = json['status'] ; rtvm.status = json['status'] ;

@ -189,6 +189,8 @@ class AppSettings {
static String inactiveOffersDataUrl = host + 'inactiveOffer'; static String inactiveOffersDataUrl = host + 'inactiveOffer';
static String reactiveOffersDataUrl = host + 'reactiveOffer'; static String reactiveOffersDataUrl = host + 'reactiveOffer';
static String deleteOfferUrl = host + 'deleteOffer'; static String deleteOfferUrl = host + 'deleteOffer';
static String discountOfferUrl = host + 'calculateTotalPriceWithDiscount';
static String medecineDataUrl = host + 'medicine'; static String medecineDataUrl = host + 'medicine';
static String getAllBiddingDataUrl = host + 'getBiddingRequests'; static String getAllBiddingDataUrl = host + 'getBiddingRequests';
static String getRequestBiddingDataUrl = host + 'statusBiddingRequest'; static String getRequestBiddingDataUrl = host + 'statusBiddingRequest';
@ -614,6 +616,7 @@ class AppSettings {
static Future<String> getCartDetails(bookingId) async { static Future<String> getCartDetails(bookingId) async {
//path parameter //path parameter
var uri = Uri.parse(getCartDataUrl + '/' + bookingId); var uri = Uri.parse(getCartDataUrl + '/' + bookingId);
// uri = uri.replace(query: 'pharmacyId=$healthpharmaIdsign');
var response = await http.get(uri, headers: await buildRequestHeaders()); var response = await http.get(uri, headers: await buildRequestHeaders());
var responcedatatemp=jsonDecode(response.body); var responcedatatemp=jsonDecode(response.body);
print("responcedata$responcedatatemp"); print("responcedata$responcedatatemp");
@ -657,6 +660,7 @@ class AppSettings {
}); });
print("Timintgs"+body.toString()); print("Timintgs"+body.toString());
var uri = Uri.parse(addToCartDataUrl); var uri = Uri.parse(addToCartDataUrl);
uri = uri.replace(query: 'pharmacyId=$healthpharmaIdsign');
var response = await http.post( var response = await http.post(
uri, uri,
headers: headers, headers: headers,
@ -826,6 +830,44 @@ class AppSettings {
return false; return false;
} }
} }
static Future<bool> discountOffer(String offerCode, String bookidID) async {
try {
// Construct the URL with offerCode as path parameter and bookidID as query parameter
var uri = Uri.parse('$discountOfferUrl/$offerCode').replace(query: 'bookingId=$bookidID');
// Make the HTTP request
var response = await http.get(uri, headers: await buildPutRequestHeaders());
// Check the response status
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
// Handle 401 Unauthorized status if needed
bool status = await AppSettings.resetToken();
if (status) {
// Retry the request after resetting the token
response = await http.put(uri, headers: await buildPutRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
// Handle other status codes if needed
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<bool> deleteOffers(offer_code) async { static Future<bool> deleteOffers(offer_code) async {
var uri = Uri.parse(inactiveOffersDataUrl + '/' + healthpharmaIdsign); var uri = Uri.parse(inactiveOffersDataUrl + '/' + healthpharmaIdsign);
uri = uri.replace(query: 'offer_code=$offer_code'); uri = uri.replace(query: 'offer_code=$offer_code');

Loading…
Cancel
Save