diff --git a/images/01.png b/images/01.png deleted file mode 100644 index 511be2d..0000000 Binary files a/images/01.png and /dev/null differ diff --git a/images/02.png b/images/02.png deleted file mode 100644 index debf165..0000000 Binary files a/images/02.png and /dev/null differ diff --git a/images/03.png b/images/03.png deleted file mode 100644 index 3d45adc..0000000 Binary files a/images/03.png and /dev/null differ diff --git a/images/04.png b/images/04.png deleted file mode 100644 index 253192d..0000000 Binary files a/images/04.png and /dev/null differ diff --git a/images/05.png b/images/05.png deleted file mode 100644 index e23fe31..0000000 Binary files a/images/05.png and /dev/null differ diff --git a/images/06.png b/images/06.png deleted file mode 100644 index 9e74414..0000000 Binary files a/images/06.png and /dev/null differ diff --git a/lib/biddingrequests.dart b/lib/biddingrequests.dart new file mode 100644 index 0000000..8a799ec --- /dev/null +++ b/lib/biddingrequests.dart @@ -0,0 +1,276 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:healthcare_pharmacy/getmedicines.dart'; +import 'package:healthcare_pharmacy/models/biddingrequest_model.dart'; +import 'package:healthcare_pharmacy/settings.dart'; + +import 'package:image_picker/image_picker.dart'; +import 'package:photo_view/photo_view.dart'; + +class BiddingRequests extends StatefulWidget { + const BiddingRequests({Key? key}) : super(key: key); + + @override + State createState() => _BiddingRequestsState(); +} + +class _BiddingRequestsState extends State { + String Url = ''; + List prescriptionsList = []; + List prescriptionsListOriginal = []; + bool isPrescriptionsDataLoading = false; + bool isSereverIssue = false; + bool isLoading=false; + + + + Future getAllPrescriptions() async { + isPrescriptionsDataLoading=true; + try { + var response = await AppSettings.getAllBiddingRecords(); + print(response); + setState(() { + prescriptionsList = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return BiddingRequestsModel.fromJson(model); + }).toList(); + isPrescriptionsDataLoading = false; + }); + + + } catch (e) { + setState(() { + isLoading = false; + isPrescriptionsDataLoading = false; + }); + } + } + + @override + void initState() { + getAllPrescriptions(); + //getAllPharmaciesData(dropdownArea); + super.initState(); + } + + showPicDialog(var imageUrl){ + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return AlertDialog( + title: const Text(''), + content: SingleChildScrollView( + child: ListBody( + children: [ + Container( + width: MediaQuery.of(context).size.width * .10, + height: MediaQuery.of(context).size.height * .50, + child: PhotoView( + imageProvider: NetworkImage(imageUrl) as ImageProvider, + maxScale: PhotoViewComputedScale.contained * 4.0, + minScale: PhotoViewComputedScale.contained, + initialScale: PhotoViewComputedScale.contained, + basePosition: Alignment.center, + + ) + ) + ], + ), + ), + actions: [ + TextButton( + child: Text('Close', style: textButtonStyle()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + }, + ); + } + + + Widget _allPrescriptions(){ + if (prescriptionsList.length != 0) { + return Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(child:ListView.builder( + padding: EdgeInsets.all(0), + itemCount: prescriptionsList.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: (){ + Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => new GetMedicines(medicinebookingid:prescriptionsList[index].bidding_bookingid))); + }, + child: Card( + + //color: prescriptionsList[index].cardColor, + child: Padding( + padding:EdgeInsets.all(8) , + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .18, + height: + MediaQuery.of(context).size.height * .10, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/mobilebg.png"), // picked file + fit: BoxFit.cover)), + /* decoration: BoxDecoration( + shape: BoxShape.rectangle, + image: DecorationImage( + image: NetworkImage(prescriptionsList[index].prescription_url) as ImageProvider, // picked file + fit: BoxFit.contain)),*/ + ), + onTap: (){ + // showPicDialog(prescriptionsList[index].prescription_url); + + }, + ), + SizedBox(width:MediaQuery.of(context).size.width * .02,), + Container( + width: MediaQuery.of(context).size.width * .55, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(prescriptionsList[index].custumerid_bidding.toString().toUpperCase(),style: valuesTextStyle()), + Text(prescriptionsList[index].pharmacyid_bidding.toString().toUpperCase(),style: valuesTextStyle()), + Text(prescriptionsList[index].amount_bidding.toString().toUpperCase(),style: valuesTextStyle()), + Text(prescriptionsList[index].bidding_bookingid.toString().toUpperCase(),style: valuesTextStyle()), + + ], + ), + + + ), + + Visibility( + //visible:offersviewList[index].orderStatus.toString().toLowerCase()=='pending', + child: Column( + children: [ + TextButton( + child: Text( + 'Accept', + style: TextStyle( + fontSize: 15, + color: + primaryColor /*FilteredList[index].text_color*/), + ), + onPressed: () async { + var payload = new Map(); + payload["customerId"] = prescriptionsList[index].custumerid_bidding.toLowerCase(); + payload["pharmacyId"] =AppSettings.healthpharmaIdsign.toLowerCase(); + bool requestStatus = + await AppSettings.getRequestBiddingDetails( + prescriptionsList[index].bidding_bookingid.toLowerCase(), + payload); + if(requestStatus){ + AppSettings.longSuccessToast("Request Accepted Successfully"); + await getAllPrescriptions(); + } + else{ + } + + }, + ), + TextButton( + child: Text( + 'Reject', + style: TextStyle( + fontSize: 15, + color: + primaryColor /*FilteredList[index].text_color*/), + ), + onPressed: () async { + + + + + + }, + ), + ], + )) + + ], + + ), + /*TextButton( + child: const Text( + 'Order Medicines', + style: TextStyle(color: primaryColor), + ), + onPressed: () { + + Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => new OrderMedicines(prescriptionDetails:prescriptionsList[index]))); + //signup screen + }, + )*/ + ], + ), + ), + ), + ); + }) ), + + + + + + ]); + } + else{ + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .25,), + + ], + ), + ) + ); + } + } + + /**/ + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppSettings.appBar('BiddingRequests'), + body: isPrescriptionsDataLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ): _allPrescriptions(), + ); + } +} diff --git a/lib/dashboard.dart b/lib/dashboard.dart index 788a524..d245e33 100644 --- a/lib/dashboard.dart +++ b/lib/dashboard.dart @@ -5,9 +5,11 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:healthcare_pharmacy/getmedicines.dart'; import 'package:healthcare_pharmacy/inactiveoffersview.dart'; +import 'package:healthcare_pharmacy/medicinecart.dart'; import 'package:healthcare_pharmacy/offers.dart'; -import 'package:healthcare_pharmacy/offersdata.dart'; +import 'package:healthcare_pharmacy/offerstabdata.dart'; import 'package:healthcare_pharmacy/offersview.dart'; +import 'package:healthcare_pharmacy/biddingrequests.dart'; import 'package:healthcare_pharmacy/updateprofile.dart'; import 'package:image_picker/image_picker.dart'; import 'package:carousel_slider/carousel_slider.dart'; @@ -119,7 +121,22 @@ class _DashboardState extends State { child: Column( children: [ - CarouselSlider( + Container( + height: MediaQuery.of(context).size.height * .250, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + //color: Colors.red, + child: FittedBox( + child:Image( + image: const AssetImage('images/mobilebg2.png'), + + ), + fit: BoxFit.fill, + ) + ), + /*CarouselSlider( options: CarouselOptions( height: MediaQuery.of(context).size.height * .250, aspectRatio: 16 / 9, @@ -154,7 +171,7 @@ class _DashboardState extends State { }, ); }).toList(), - ), + ),*/ SizedBox(height: 5), Expanded(child: Container( padding: EdgeInsets.all(12.0), @@ -334,6 +351,7 @@ class _DashboardState extends State { MediaQuery.of(context).size.height * .25, decoration: BoxDecoration( shape: BoxShape.rectangle, + border: Border.all(width: 2 , color: Colors.blueGrey), image: DecorationImage( image: (AppSettings.profilePictureUrl != '' && @@ -607,7 +625,7 @@ class _DashboardState extends State { Divider( color: Colors.grey, ), - /*ListTile( + ListTile( title: Row( children: const [ Image( @@ -618,7 +636,7 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('InActiveOffersView', style: TextStyle(color: Colors.black)), + Text('BiddingRequests', style: TextStyle(color: Colors.black)), ], ), onTap: () { @@ -626,7 +644,7 @@ class _DashboardState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => const InActiveOffersView()), + builder: (context) => MedicineCartList()), ); @@ -635,8 +653,8 @@ class _DashboardState extends State { ), Divider( color: Colors.grey, - ),*/ - ListTile( + ), + /* ListTile( title: Row( children: const [ Image( @@ -655,7 +673,7 @@ class _DashboardState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => const GetMedicines()), + builder: (context) => GetMedicines()), ); @@ -664,7 +682,7 @@ class _DashboardState extends State { ), Divider( color: Colors.grey, - ), + ),*/ ListTile( title: Row( children: const [ diff --git a/lib/getmedicines.dart b/lib/getmedicines.dart index fa01e1f..f355303 100644 --- a/lib/getmedicines.dart +++ b/lib/getmedicines.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; +import 'package:healthcare_pharmacy/medicinedetailspage.dart'; import 'package:healthcare_pharmacy/models/GetMedecineDetailsModel.dart'; import 'package:healthcare_pharmacy/settings.dart'; import 'package:flutter/services.dart'; @@ -11,7 +12,11 @@ import 'package:photo_view/photo_view.dart'; class GetMedicines extends StatefulWidget { - const GetMedicines({Key? key}) : super(key: key); + var medicinebookingid; + + GetMedicines({ + this.medicinebookingid + }); @override State createState() => _GetMedicinesState(); @@ -30,6 +35,8 @@ class _GetMedicinesState extends State with TickerProviderStateMix String medicine_salt_composition=''; String medicine_mrp=''; String medicine_primary_use=''; + String medbookingid = ''; + List medImages=[]; @@ -79,10 +86,10 @@ class _GetMedicinesState extends State with TickerProviderStateMix void initState() { // TODO: implement initState super.initState(); + medbookingid=widget.medicinebookingid; } - showPicDialog(var imageUrl){ return showDialog( context: context, @@ -124,121 +131,6 @@ class _GetMedicinesState extends State with TickerProviderStateMix ); } - - - /*Widget _bindMedicines(){ - if (medecineList.length != 0) { - return Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded(child:ListView.builder( - padding: EdgeInsets.all(0), - itemCount: medecineList.length, - itemBuilder: (BuildContext context, int index) { - return Card( - - //color: prescriptionsList[index].cardColor, - child: Padding( - padding:EdgeInsets.all(8) , - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Container( - width: MediaQuery.of(context).size.width * .18, - height: - MediaQuery.of(context).size.height * .10, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - image: DecorationImage( - image: NetworkImage(medImages[0]) as ImageProvider, // picked file - fit: BoxFit.contain)), - ), - onTap: (){ - showPicDialog(medImages[0]); - - }, - ), - SizedBox(width:MediaQuery.of(context).size.width * .02,), - - Container( - width: MediaQuery.of(context).size.width * .55, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(("Name :"+ medicine_name).toString().toUpperCase(),style: valuesTextStyle()), - Text(("Manufacturers :"+ medicine_manufacturers).toString().toUpperCase(),style: valuesTextStyle()), - Text(("Estimate Price :"+ medicine_mrp).toString().toUpperCase(),style: valuesTextStyle()), - Text(("Medicine_Use :"+ medicine_primary_use).toString().toUpperCase(),style: valuesTextStyle()), - ], - ), - - - ), - - ], - - ), - ], - ), - ), - ); - }) ), - ]); - } - else{ - return Center( - child: Padding( - padding: EdgeInsets.fromLTRB(0, 40, 0, 0), - child: isSereverIssue - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - height: 20, - ), - Text( - 'No medicine found with your search',style:serverIssueTextStyle() ,), - ], - ) - : userAddress==''?Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.search,color: primaryColor,size: 40,), - SizedBox( - height: 20, - ), - Text( - 'Please enter atleast 4 letters to continue search',style:TextStyle( - color: primaryColor, - fontWeight: FontWeight.bold, - ),), - ], - ): - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.dataset_rounded,color: primaryColor,size: 40,), - SizedBox( - height: 20, - ), - SizedBox( - height: 20, - ), - Text( - 'No medicine found with your search',style:serverIssueTextStyle() ,), - ], - ), - )); - } - }*/ - - Widget _bindMedicines() { if (medicine_name!='') { return Padding(padding: EdgeInsets.all(10), @@ -260,29 +152,48 @@ class _GetMedicinesState extends State with TickerProviderStateMix image: NetworkImage(medImages[0]) as ImageProvider, // picked file fit: BoxFit.contain)), ), - onTap: (){ + onTap: () async { showPicDialog(medImages[0]); }, ), + GestureDetector( + child: Column( + children: [ + Text(("Name :"+ medicine_name), + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text(("Manufacturers :"+ medicine_manufacturers), + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + medicine_salt_composition, + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text(("Estimate Price :"+ medicine_mrp), + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text(("Medicine_Use :"+ medicine_primary_use), + style: TextStyle(fontWeight: FontWeight.bold), + ), + ], + ), + onTap: () { + /* Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => new MedicineDetailsCount()));*/ + Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => new MedicineDetails(name: medicine_name,price: medicine_mrp,bookid:medbookingid))); + }, + + - Text(("Name :"+ medicine_name), - style: TextStyle(fontWeight: FontWeight.bold), - ), - Text(("Manufacturers :"+ medicine_manufacturers), - style: TextStyle(fontWeight: FontWeight.bold), - ), - Text( - medicine_salt_composition, - style: TextStyle(fontWeight: FontWeight.bold), - ), - Text(("Estimate Price :"+ medicine_mrp), - style: TextStyle(fontWeight: FontWeight.bold), - ), - Text(("Medicine_Use :"+ medicine_primary_use), - style: TextStyle(fontWeight: FontWeight.bold), ), + ], ), diff --git a/lib/inactiveoffersview.dart b/lib/inactiveoffersview.dart index ddcc896..babf68f 100644 --- a/lib/inactiveoffersview.dart +++ b/lib/inactiveoffersview.dart @@ -114,7 +114,7 @@ class _InActiveOffersViewState extends State with TickerProv Text(offersviewList[index].offer_name,style: valuesTextStyle()), Text(offersviewList[index].offer_code,style: valuesTextStyle()), Text(offersviewList[index].description,style: valuesTextStyle()), - Text(offersviewList[index].discount_percentage,style: valuesTextStyle()), + Text(offersviewList[index].offer,style: valuesTextStyle()), Text(offersviewList[index].starting_date,style: valuesTextStyle()), Text(offersviewList[index].ending_date,style: valuesTextStyle()) diff --git a/lib/login.dart b/lib/login.dart index 81476b9..2d9f8b4 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -88,7 +88,7 @@ class _LoginState extends State { child: Column( children: [ const SizedBox( - height: 15, + height: 55, ), Container( //width: double.infinity, @@ -107,12 +107,8 @@ class _LoginState extends State { keyboardType: TextInputType.number, maxLength: 10, decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'), - ), ), - const SizedBox( - height: 15, - ), Container( padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), @@ -207,13 +203,13 @@ class _LoginState extends State { MaterialPageRoute( builder: (context) => const Dashboard()), ); - // AppSettings.longSuccessToast("Logged in Successfully"); + AppSettings.longSuccessToast("Logged in Successfully"); mobileNumberController.text=''; passwordController.text=''; } else { Navigator.of(context,rootNavigator: true).pop(); - //AppSettings.longFailedToast("Please enter valid details"); + AppSettings.longFailedToast("Please enter valid details"); } } catch(exception){ @@ -223,14 +219,14 @@ class _LoginState extends State { } else{ Navigator.of(context,rootNavigator: true).pop(); - // AppSettings.longFailedToast("Please Check internet"); + AppSettings.longFailedToast("Please Check internet"); } } else{ - //AppSettings.longFailedToast("Please enter valid details"); + AppSettings.longFailedToast("Please enter valid details"); } }, diff --git a/lib/medicinecart.dart b/lib/medicinecart.dart new file mode 100644 index 0000000..e7f65b5 --- /dev/null +++ b/lib/medicinecart.dart @@ -0,0 +1,340 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:healthcare_pharmacy/biddingrequests.dart'; +import 'package:healthcare_pharmacy/dashboard.dart'; +import 'package:healthcare_pharmacy/getmedicines.dart'; +import 'package:healthcare_pharmacy/maps/app_colors.dart'; +import 'package:healthcare_pharmacy/medicinedetailspage.dart'; +import 'package:healthcare_pharmacy/models/biddingrequest_model.dart'; +import 'package:healthcare_pharmacy/models/cartview_model.dart'; +import 'package:healthcare_pharmacy/models/offersview_model.dart'; +import 'package:healthcare_pharmacy/settings.dart'; +import 'package:intl/intl.dart'; +import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; + + +class MedicineCartList extends StatefulWidget { + var bookidcart; + + MedicineCartList({ + this.bookidcart + }); + + @override + State createState() => _MedicineCartListState(); +} + +class _MedicineCartListState extends State with TickerProviderStateMixin { + bool isSupplierDataLoading=false; + bool isSereverIssue = false; + bool isSereverIssueConnected = false; + bool isSereverIssuePending = false; + var startdate; + var enddate; + String totalPrice=''; + String medicinetime=''; + + String bookingidstring=''; + bool isLoading=false; + + + + + List offersviewList = []; + TextEditingController medicine_nameController = TextEditingController(); + TextEditingController medicine_quantityController = TextEditingController(); + TextEditingController medicine_priceController = TextEditingController(); + TextEditingController medicine_timingsController = TextEditingController(); + + + Future getCartViewData() async { + isLoading = true; + + try { + var response = await AppSettings.getCartDetails(widget.bookidcart).then((value){ + setState(() { + // offersviewList = BiddingCartviewModel.fromJson(response['items']) as List; + offersviewList = + ((jsonDecode(value)['items']) as List).map((dynamic model) { + return BiddingCartviewModel.fromJson(model); + }).toList(); + + totalPrice=jsonDecode(value)['totalPrice'].toString(); + + print(medicinetime); + print(totalPrice); + isLoading = false; + }); + }); + print("offersviewListdata${jsonDecode(response)}"); + + } catch (e) { + setState(() { + isLoading = false; + isSereverIssueConnected = true; + }); + } + } + + + + @override + void initState() { + // TODO: implement initState + getCartViewData(); + super.initState(); + } + + Widget renderzUi() { + if (offersviewList.length != 0) { + return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [ + Expanded( + child: ListView.builder( + padding: EdgeInsets.all(0), + itemCount: offersviewList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + child: Padding( + padding: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + width: MediaQuery.of(context).size.width * .70, + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text('MedicineName:', + style: labelTextStyle()), + SizedBox( + height: 10, + ), + Text( + 'Medicine Timings:', + style: labelTextStyle()), + SizedBox( + height: 10, + ), + Text('MedicineQuantity:', + style: labelTextStyle()), + SizedBox( + height: 10, + ), + Text('MedicinePrice:', + style: labelTextStyle()), + ], + ), + SizedBox( + width: 10, + ), + Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Text( + offersviewList[index].medicinename_bidding! + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: 12, + ), + Text( + offersviewList[index].medicine_timings![0].medicineTimings!.toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: 10, + ), + Text( + offersviewList[index].quantity_bidding.toString() + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: 10, + ), + Text( + offersviewList[index].price_bidding.toString() + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: 10, + ), + ], + ), + ], + )), + ), + + ], + ), + ), + ); + })), + + Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child:TextButton( + onPressed: () { + // Add your button click logic here + }, + child: Text( + 'Total Price:$totalPrice', + style: TextStyle( + fontSize: 20, + color: AppColors.primaryColor, // Text color + decoration: TextDecoration.underline, // Underline the text + fontWeight: FontWeight.bold, // Bold text + ), + ), + ),), + SizedBox( + height: 10, + ), + Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: primaryColor, // background + onPrimary: Colors.white, // foreground + ), + onPressed: () async{ + + }, + child: Text('CheckOut'), + )), + + + + /*Column( + children: [ + Padding(padding: const EdgeInsets.fromLTRB(10, 10,10,10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'Add More', + style: TextStyle( + color: Colors.white, + ), + ), + TextButton( + child: const Text( + 'Sign Up', + style: TextStyle(fontSize: 15, + decoration: TextDecoration.underline,color: Colors.white), + ), + onPressed: () { + *//* Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const SignUp()), + );*//* + //signup screen + }, + ) + ], + ),) + Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child:TextButton( + onPressed: () { + // Add your button click logic here + }, + child: Text( + 'Total Price:$totalPrice', + style: TextStyle( + fontSize: 20, + color: AppColors.primaryColor, // Text color + decoration: TextDecoration.underline, // Underline the text + fontWeight: FontWeight.bold, // Bold text + ), + ), + ),), + SizedBox( + height: 10, + ), + Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: primaryColor, // background + onPrimary: Colors.white, // foreground + ), + onPressed: () async{ + + }, + child: Text('CheckOut'), + )), + ], + )*/ + + + + ]); + } else { + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: MediaQuery.of(context).size.height * .25, + ), + Text('No Data Found'), + SizedBox( + height: 20, + ), + ], + ), + )); + } + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + appBar: AppBar( + // Add a back button to the leading property + backgroundColor: primaryColor, + leading: IconButton( + icon: Icon(Icons.arrow_back), // You can use a different back icon if needed + onPressed: () { + // Implement the navigation logic to go back + Navigator.push( + context, + MaterialPageRoute(builder: (context) => BiddingRequests()), + ); // This will pop the current route and go back + }, + ), + title: Text('Cart Details'), + ), + body: isLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ):renderzUi(), + )); + } +} \ No newline at end of file diff --git a/lib/medicinedetailspage.dart b/lib/medicinedetailspage.dart new file mode 100644 index 0000000..53c06da --- /dev/null +++ b/lib/medicinedetailspage.dart @@ -0,0 +1,339 @@ + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:healthcare_pharmacy/medicinecart.dart'; +import 'package:healthcare_pharmacy/settings.dart'; +import 'package:quantity_input/quantity_input.dart'; +import 'package:flutter/services.dart'; +import 'dart:io' show File, Platform; +import 'package:location/location.dart' as locationmap; + + +class MedicineDetails extends StatefulWidget { + var name; + var price; + var bookid; + + MedicineDetails({ + this.name,this.price,this.bookid + }); + + @override + State createState() => _deliverboyState(); +} + +class _deliverboyState extends State { + + + TextEditingController MedicineNameController = TextEditingController(); + TextEditingController MedicineQuantityController = TextEditingController(); + TextEditingController MedicinePriceController = TextEditingController(); + TextEditingController BookingidController = TextEditingController(); + String selectedOptionsText = ''; + List medicineCheckboxes = ["BB","AB","BL","AL","BD","AD"]; + String medname = ''; + String medprice = ''; + int initialValue = 0; + double enteredValue = 0.0; + + + @override + void initState() { + super.initState(); + MedicineNameController.text=widget.name; + MedicinePriceController.text=widget.price; + BookingidController.text=widget.bookid; + } + + double getTotalAmount() { + return enteredValue * initialValue; + } + + void toggleOption(String option) { + setState(() { + if (selectedOptionsText.contains(option)) { + selectedOptionsText = selectedOptionsText + .replaceAll('$option,', '') // Remove option from the string + .replaceAll(', $option', '') // Remove option from the string + .trim(); // Remove leading/trailing spaces + } else { + if (selectedOptionsText.isEmpty) { + selectedOptionsText = option; + } else { + selectedOptionsText += ', $option'; + } + } + }); + } + @override + Widget build(BuildContext context) { + return Scaffold( + appBar:AppSettings.appBar('Medicine Details'), + body: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + const SizedBox( + height: 15, + ), + Container( + height: MediaQuery.of(context).size.height * .15, + width: double.infinity, + child: Image( + image: const AssetImage('images/logo.png'), + height: MediaQuery.of(context).size.height * .25, + )), + const SizedBox( + height: 15, + ), + Container( + //padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: MedicineNameController, + textCapitalization: TextCapitalization.characters, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.medical_information, + color: greyColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: greyColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + labelText: 'Medicine Name', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), //tanker name + ), + const SizedBox( + height: 15, + ), + ListView.builder( + shrinkWrap: true, + itemCount: (medicineCheckboxes.length / 2).ceil(), // Assuming 2 columns + itemBuilder: (context, index) { + final start = index * 2; + final end = start + 2 > medicineCheckboxes.length + ? medicineCheckboxes.length + : start + 2; + + return Row( + children: [ + for (int i = start; i < end; i++) + Expanded( + child: CheckboxListTile( + value: selectedOptionsText.contains(medicineCheckboxes[i]), + onChanged: (value) => toggleOption(medicineCheckboxes[i]), + title: Text(medicineCheckboxes[i]), + controlAffinity: ListTileControlAffinity.leading, + dense: true, + contentPadding: EdgeInsets.zero, + ), + ), + ], + ); + }, + ), + + + const SizedBox( + height: 5, + ), + Container( + //padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: MedicineQuantityController, + readOnly: true, + textCapitalization: TextCapitalization.characters, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.production_quantity_limits, + color: greyColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: greyColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + labelText: 'Medicine Quantity', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), //tanker name + ), + //phone number + const SizedBox( + height: 5, + ), + Container( + //padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: MedicinePriceController, + textCapitalization: TextCapitalization.characters, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.currency_rupee, + color: greyColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: greyColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + labelText: 'Medicine Price', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), //tanker name + ), //alternative phone number + const SizedBox( + height: 5, + ), + Container( + height: MediaQuery.of(context).size.height * .1, + width: MediaQuery.of(context).size.width * .5, + child: Column( + children: [ + QuantityInput( + label: 'Select Medicine Quntity', + value: initialValue, + iconColor: Colors.white, + buttonColor: primaryColor, + onChanged: (value) { + setState(() { + enteredValue = double.tryParse(value) ?? 0.0; + initialValue = int.parse(value.replaceAll(',', '')); + MedicineQuantityController.text=initialValue.toString(); + // MedicinePriceController.text= '${getTotalAmount()}'; + }); + } + + + + ), + ] + ) //tanker name + ), //alternative phone number + const SizedBox( + height: 5, + ), + + Container( + width: MediaQuery.of(context).size.width * .99, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: primaryColor, // background + onPrimary: Colors.white, // foreground + ), + onPressed: () async { + if (MedicineNameController.text != '' && + MedicineQuantityController.text != ''&& + MedicinePriceController.text != '' + ) { + AppSettings.preLoaderDialog(context); + /* var payload = new Map(); + payload["mbookingId"] = BookingidController.text.toString(); + payload["items"]=[{ + "medicinename":MedicineNameController.text.toString(), + "quantity":MedicineQuantityController.text.toString(), + "price":MedicinePriceController.text.toString() + }]; + print("responcedata${payload.toString()}");*/ + + var response = await AppSettings.addToCart(BookingidController.text,MedicineQuantityController.text, + MedicinePriceController.text,MedicineNameController.text,selectedOptionsText); + + //String response= await addToCart("OR1690969760576127","10","300","Dolo650"); + + //print("response$response"); + try { + if(response.statusCode==200){ + var msg=jsonDecode(response.body)['message']; + print(msg); + Navigator.of(context,rootNavigator: true).pop(); + AppSettings.longSuccessToast( + "Medicine Added to Cart Successfully"); + /* MedicineNameController.text = ''; + MedicineQuantityController.text = ''; + MedicinePriceController.text = ''; + //BookingidController.text = '';*/ + await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicineCartList(bookidcart:BookingidController.text.toString())), + ); + + + } + else{ + Navigator.of(context,rootNavigator: true).pop(); + AppSettings.longFailedToast("Medicine Not Added to Cart Successfully"); + } + + /* try { + if (medicineStatus) { + Navigator.of(context,rootNavigator: true).pop(); + AppSettings.longSuccessToast( + "Medicine Added to Cart Successfully"); + *//* MedicineNameController.text = ''; + MedicineQuantityController.text = ''; + MedicinePriceController.text = ''; + //BookingidController.text = '';*//* + await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicineCartList(bookidcart:BookingidController.text.toString())), + ); + + //Navigator.of(context).pushNamed('/tanksview'); + } else { + Navigator.of(context,rootNavigator: true).pop(); + AppSettings.longFailedToast("Medicine Not Added to Cart Successfully"); + }*/ + } catch (exception) { + print(exception); + } + } + else { + AppSettings.longFailedToast("Please enter valid details"); + } + }, + + child: const Text( + 'NEXT', + style: TextStyle( + fontSize: 25, + ), + ), + )), + + ], + ), + )), + ); + } +} diff --git a/lib/models/GetMedecineDetailsModel.dart b/lib/models/GetMedecineDetailsModel.dart index bfbd260..2facde4 100644 --- a/lib/models/GetMedecineDetailsModel.dart +++ b/lib/models/GetMedecineDetailsModel.dart @@ -22,9 +22,9 @@ class GetMedecineDetailsModel { GetMedecineDetailsModel rtvm = new GetMedecineDetailsModel(); rtvm.name = json['name'] ?? ''; - rtvm.manufacturers = json['manufacturers'] ?? ''; - rtvm.salt_composition = json['salt_composition'] ?? ''; - rtvm.mrp = json['mrp'] ?? ''; + rtvm.manufacturers = json['manufacturers'].toString() ?? ''; + rtvm.salt_composition = json['salt_composition'].toString() ?? ''; + rtvm.mrp = json['mrp'].toString() ?? ''; rtvm.primary_use = json['primary_use'] ??''; rtvm.picture = json['picture'] ?? ''; diff --git a/lib/models/biddingrequest_model.dart b/lib/models/biddingrequest_model.dart new file mode 100644 index 0000000..6af567e --- /dev/null +++ b/lib/models/biddingrequest_model.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + +class BiddingRequestsModel { + String custumerid_bidding = ''; + String pharmacyid_bidding=''; + String amount_bidding=''; + String bidding_bookingid=''; + + Color cardColor=Colors.white; + + + BiddingRequestsModel(); + + factory BiddingRequestsModel.fromJson(Map json){ + BiddingRequestsModel rtvm = new BiddingRequestsModel(); + + rtvm.custumerid_bidding = json['customerId'].toString() ??''; + rtvm.pharmacyid_bidding = json['pharmacyId'].toString() ?? ''; + rtvm.amount_bidding = json['biddingAmount'].toString() ?? ''; + rtvm.bidding_bookingid = json['bookingId'].toString() ?? ''; + + // rtvm.prescription_url = json['pictureUrl'][0] ?? ''; + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/models/cartview_model.dart b/lib/models/cartview_model.dart new file mode 100644 index 0000000..6e36052 --- /dev/null +++ b/lib/models/cartview_model.dart @@ -0,0 +1,57 @@ +import 'dart:convert'; + +List biddingCartviewModelFromJson(String str) => List.from(json.decode(str).map((x) => BiddingCartviewModel.fromJson(x))); + +String biddingCartviewModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class BiddingCartviewModel { + String? id; + String? medicinename_bidding ; + int? quantity_bidding; + double? price_bidding; + List? medicine_timings; + + BiddingCartviewModel({ + this.id, + this.medicinename_bidding , + this.quantity_bidding, + this.price_bidding, + this.medicine_timings, + }); + + factory BiddingCartviewModel.fromJson(Map json) => BiddingCartviewModel( + id: json["_id"], + medicinename_bidding : json["medicinename"], + quantity_bidding: json["quantity"], + price_bidding: json["price"]?.toDouble(), + medicine_timings: json["medicine_timings"] == null ? [] : List.from(json["medicine_timings"]!.map((x) => MedicineTiming.fromJson(x))), + ); + + Map toJson() => { + "_id": id, + "medicinename": medicinename_bidding , + "quantity": quantity_bidding, + "price": price_bidding, + "medicine_timings": medicine_timings == null ? [] : List.from(medicine_timings!.map((x) => x.toJson())), + }; +} + +class MedicineTiming { + String? id; + String? medicineTimings; + + MedicineTiming({ + this.id, + this.medicineTimings, + }); + + factory MedicineTiming.fromJson(Map json) => MedicineTiming( + id: json["_id"], + medicineTimings: json["medicine_timings"], + ); + + Map toJson() => { + "_id": id, + "medicine_timings": medicineTimings, + }; +} \ No newline at end of file diff --git a/lib/models/offersview_model.dart b/lib/models/offersview_model.dart index da9bf12..ef4f81d 100644 --- a/lib/models/offersview_model.dart +++ b/lib/models/offersview_model.dart @@ -5,7 +5,7 @@ class GetOffersDetailsModel { String offer_name = ''; String offer_code = ''; String description = ''; - String discount_percentage=''; + String offer=''; String starting_date=''; Color cardColor=Colors.white; String ending_date=''; @@ -20,7 +20,7 @@ class GetOffersDetailsModel { rtvm.offer_name = json['offer_name'] ?? ''; rtvm.offer_code = json['offer_code'] ?? ''; rtvm.description = json['description'] ?? ''; - rtvm.discount_percentage = json['discount_percentage'] ?? ''; + rtvm.offer = json['offer'] ?? ''; rtvm.starting_date = json['starting_date'] ??''; rtvm.ending_date = json['ending_date'] ??''; diff --git a/lib/offers.dart b/lib/offers.dart index b3928bb..f779edf 100644 --- a/lib/offers.dart +++ b/lib/offers.dart @@ -18,7 +18,7 @@ class _offersState extends State { TextEditingController offer_nameController = TextEditingController(); TextEditingController offer_codeController = TextEditingController(); TextEditingController descriptionController = TextEditingController(); - TextEditingController discount_percentageController = TextEditingController(); + TextEditingController offerController = TextEditingController(); TextEditingController starting_dateController = TextEditingController(); TextEditingController ending_dateController = TextEditingController(); var selIOS; @@ -145,12 +145,12 @@ class _offersState extends State { padding: const EdgeInsets.all(10), child: TextFormField( cursorColor: greyColor, - controller: discount_percentageController, - keyboardType: TextInputType.number, - maxLength: 2, + controller: offerController, + keyboardType: TextInputType.text, + textCapitalization: TextCapitalization.characters, decoration: const InputDecoration( prefixIcon: Icon( - Icons.percent_outlined, + Icons.local_offer, color: primaryColor, ), border: OutlineInputBorder( @@ -161,7 +161,7 @@ class _offersState extends State { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: primaryColor), ), - labelText: 'Enter Percentage', + labelText: 'Enter Offer', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), @@ -321,7 +321,7 @@ class _offersState extends State { if (offer_nameController.text != '' && offer_codeController.text != '' && descriptionController.text != ''&& - discount_percentageController.text != ''&& + offerController.text != ''&& starting_dateController.text != '' && ending_dateController.text != '') { AppSettings.preLoaderDialog(context); @@ -330,7 +330,7 @@ class _offersState extends State { payload["offer_name"] = offer_nameController.text.toString(); payload["offer_code"] = offer_codeController.text.toString(); payload["description"] = descriptionController.text.toString();; - payload["discount_percentage"] = discount_percentageController.text.toString(); + payload["offer"] = offerController.text.toString(); payload["starting_date"] = starting_dateController.text.toString(); payload["ending_date"] = ending_dateController.text.toString(); payload["offer_status"] ="active"; diff --git a/lib/offersdata.dart b/lib/offerstabdata.dart similarity index 88% rename from lib/offersdata.dart rename to lib/offerstabdata.dart index 021deb3..504b087 100644 --- a/lib/offersdata.dart +++ b/lib/offerstabdata.dart @@ -475,7 +475,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { Text('OfferName :',style: labelTextStyle()), Text('OfferCode :',style: labelTextStyle()), Text('OfferDes :' ,style: labelTextStyle()), - Text('OfferDis(%) :' ,style: labelTextStyle()), + Text('offer :' ,style: labelTextStyle()), Text('StartDate :',style: labelTextStyle()), Text('EndDate :' ,style: labelTextStyle()), @@ -489,7 +489,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { Text(activeOffersList[index].offer_name,style: valuesTextStyle()), Text(activeOffersList[index].offer_code,style: valuesTextStyle()), Text(activeOffersList[index].description,style: valuesTextStyle()), - Text(activeOffersList[index].discount_percentage,style: valuesTextStyle()), + Text(activeOffersList[index].offer,style: valuesTextStyle()), Text(activeOffersList[index].starting_date,style: valuesTextStyle()), Text(activeOffersList[index].ending_date,style: valuesTextStyle()) @@ -507,59 +507,78 @@ class _OffersDataState extends State with TickerProviderStateMixin { showUpdateOfferDialog(activeOffersList[index]); }, ),), - Expanded(child:IconButton( - icon: const Icon(Icons.hide_source_rounded,color: primaryColor,), - - onPressed: () async{ - showDialog( - //if set to true allow to close popup by tapping out of the popup - //barrierDismissible: false, - context: context, - builder: (BuildContext context) => AlertDialog( - title: const Text('Do you want In_Active Offer??', - style: TextStyle( - color: primaryColor, - fontSize: 16, - )), - actionsAlignment: MainAxisAlignment.spaceBetween, - actions: [ - TextButton( - onPressed: ()async { - bool deleteOfferStatus = await AppSettings.deleteOffers(activeOffersList[index].offer_code); - if(deleteOfferStatus){ - getActiveOffersViewData(); - AppSettings.longSuccessToast('Offer In_Active Successfully!!'); - getInactiveOffersViewData(); - Navigator.of(context).pop(true); - } - else{ - AppSettings.longFailedToast('Offer In_Active failed'); - } - }, - child: const Text('Yes', - style: TextStyle( - color: primaryColor, - fontSize: 18, - )), - ), - TextButton( - onPressed: () { - Navigator.of(context).pop(true); - }, - child: const Text('No', - style: TextStyle( - color: primaryColor, - fontSize: 18, - )), - ), - ], + Expanded( + child: Row( + children: [ + Text(''), + Switch( + value: false, // Replace this with your actual property + onChanged: (newValue) async { + if (newValue) { + // Show your AlertDialog for confirmation + showDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + title: Text( + 'Do you want to In_Activate the offer?', + style: TextStyle( + color: primaryColor, + fontSize: 16, + ), + ), + actionsAlignment: MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: () async { + bool deleteOfferStatus = + await AppSettings.deleteOffers( + activeOffersList[index].offer_code); + if (deleteOfferStatus) { + getActiveOffersViewData(); + AppSettings.longSuccessToast( + 'Offer In_Active Successfully!!'); + getInactiveOffersViewData(); + // Update the isActive property + + } else { + AppSettings.longFailedToast('Offer In_Active failed'); + } + Navigator.of(context).pop(true); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: primaryColor, + fontSize: 18, + ), + ), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text( + 'No', + style: TextStyle( + color: primaryColor, + fontSize: 18, + ), + ), + ), + ], + ), + ); + } else { + // Handle the case where the user wants to undo the In_Activation + // Update the isActive property + //m;./ activeOffersList[index].isActive = false; + // You might want to add code to revert the In_Activation in your data model here + } + }, ), - ); - - - - }, - ),) + ], + ), + ), ], @@ -691,7 +710,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { Text(inactiveOffersList[index].offer_name,style: valuesTextStyle()), Text(inactiveOffersList[index].offer_code,style: valuesTextStyle()), Text(inactiveOffersList[index].description,style: valuesTextStyle()), - Text(inactiveOffersList[index].discount_percentage,style: valuesTextStyle()), + Text(inactiveOffersList[index].offer,style: valuesTextStyle()), Text(inactiveOffersList[index].starting_date,style: valuesTextStyle()), Text(inactiveOffersList[index].ending_date,style: valuesTextStyle()) diff --git a/lib/offersview.dart b/lib/offersview.dart index f966b85..9e0eef4 100644 --- a/lib/offersview.dart +++ b/lib/offersview.dart @@ -454,7 +454,7 @@ class _OffersViewState extends State with TickerProviderStateMixin { Text(offersviewList[index].offer_name,style: valuesTextStyle()), Text(offersviewList[index].offer_code,style: valuesTextStyle()), Text(offersviewList[index].description,style: valuesTextStyle()), - Text(offersviewList[index].discount_percentage,style: valuesTextStyle()), + Text(offersviewList[index].offer,style: valuesTextStyle()), Text(offersviewList[index].starting_date,style: valuesTextStyle()), Text(offersviewList[index].ending_date,style: valuesTextStyle()) diff --git a/lib/settings.dart b/lib/settings.dart index 7dff2f8..c83f7e8 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -1,3 +1,5 @@ + +import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; import 'package:flutter/material.dart'; @@ -144,6 +146,7 @@ class AppSettings { static double userLatitude = 0; static double userLongitude = 0; static String healthpharmaIdsign = ''; + static String healthpharmastaticid = '123456789'; static String profileImage = ''; static List storedPreferenceValidKeys = ['pharmacyname', 'access_token']; static String preloadText = 'Please wait'; @@ -179,6 +182,15 @@ class AppSettings { static String deleteOffersDataUrl = host + 'deleteOffer'; static String reactiveOffersDataUrl = host + 'reactiveOffer'; static String medecineDataUrl = host + 'medicine'; + static String getAllBiddingDataUrl = host + 'getBiddingRequests'; + static String getRequestBiddingDataUrl = host + 'biddingRequest'; + static String addToCartDataUrl = host + 'cart/add'; + static String getCartDataUrl = host + 'cart/total-price'; + + + + + @@ -440,6 +452,181 @@ class AppSettings { return ''; } } + + + static Future getCartDetails(bookingId) async { + //path parameter + var uri = Uri.parse(getCartDataUrl + '/' + bookingId); + var response = await http.get(uri, headers: await buildRequestHeaders()); + var responcedatatemp=jsonDecode(response.body); + print("responcedata$responcedatatemp"); + print("responcedata$bookingId"); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future addToCart(String orderId, String quantity, String price,String mName,String mtimings) async { + var headers = { + 'Content-Type': 'application/json' + }; + var body=json.encode({ + "bookingId": orderId, + "items": [ + { + "medicinename": mName, + "quantity": quantity, + "price": price, + "medicine_timings":[ + { + "medicine_timings":mtimings + } + ] + } + ] + }); + print("Timintgs"+body.toString()); + var uri = Uri.parse(addToCartDataUrl); + var response = await http.post( + uri, + headers: headers, + body: body, + ); + + return response; + } + +/* static Future addToCart(payload) async { + var response = await http.post(Uri.parse(addToCartDataUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + + if (response.statusCode == 200) { + try { + var _response = jsonDecode(response.body); + print("responcedata$_response"); + return true; + *//* if (_response['items']['error'] == false) { + return true; + } else { + return false; + }*//* + } catch (e) { + // display error toast + return false; + } + } else { + return false; + } + }*/ + + + static Future getAllBiddingRecords() async { + //path parameter + var uri = Uri.parse(getAllBiddingDataUrl + '/' + healthpharmaIdsign); + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + //getRequestBiddingDataUrl + + + /*static Future getRequestBiddingDetails( bookingId) async { + var uri = Uri.parse(getRequestBiddingDataUrl + '/' +bookingId ); + try { + var response = await http.put(uri, headers: await buildRequestHeaders()); + var responcedatatemp=jsonDecode(response.body); + print("responcedata$responcedatatemp"); + print("responcedata$bookingId"); + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + }*/ + + static Future getRequestBiddingDetails(var bookingId,payload) async { + var response = await http.put(Uri.parse(getRequestBiddingDataUrl + '/' + bookingId), + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(Uri.parse(getRequestBiddingDataUrl + '/' + bookingId), + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + + + + + + static Future getinactiveOffers() async { //path parameter var uri = Uri.parse(getOffersinActiveDataUrl + '/' + healthpharmaIdsign); @@ -650,6 +837,8 @@ class AppSettings { + + static Future updateProfilePicture(payload) async { var uri = Uri.parse(profilePicUrl + '/' + pharmacyId); var response = await http.post(uri, diff --git a/lib/signup.dart b/lib/signup.dart index f283c7f..f92913b 100644 --- a/lib/signup.dart +++ b/lib/signup.dart @@ -168,12 +168,12 @@ class _SignUpState extends State { image: const AssetImage('images/logo.png'), height: MediaQuery.of(context).size.height * .18, )), - SizedBox( - height: 05, + height: 10, ), Container( - padding: const EdgeInsets.all(10), + padding: const EdgeInsets.all(10), // Set the desired width + child: TextFormField( cursorColor: greyColor, controller: nameController, @@ -181,9 +181,7 @@ class _SignUpState extends State { decoration: textFormFieldDecoration(Icons.person,'Name'), ), ), //name - SizedBox( - height: 05, - ), + Container( padding: const EdgeInsets.all(10), child: TextFormField( @@ -194,9 +192,7 @@ class _SignUpState extends State { ), ), - const SizedBox( - height: 5, - ), + Container( padding: const EdgeInsets.all(10), child: TextFormField( @@ -209,9 +205,7 @@ class _SignUpState extends State { ), ), //mobile - const SizedBox( - height: 5, - ), + Container( padding: const EdgeInsets.all(10), child: TextFormField( @@ -222,9 +216,7 @@ class _SignUpState extends State { ), ), - const SizedBox( - height: 5, - ), + GestureDetector( child: Container( padding: const EdgeInsets.all(10), diff --git a/lib/updateprofile.dart b/lib/updateprofile.dart index 9fc0aab..2b06eb0 100644 --- a/lib/updateprofile.dart +++ b/lib/updateprofile.dart @@ -117,7 +117,7 @@ class _UpdateprofileState extends State { height: MediaQuery.of(context).size.height * .15, decoration: BoxDecoration( shape: BoxShape.rectangle, - border: Border.all(width: 5, color: Colors.blueGrey), + border: Border.all(width: 2, color: Colors.blueGrey), image: DecorationImage( image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ? NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/mobilebg.png"), // picked file fit: BoxFit.fitWidth)), @@ -301,22 +301,28 @@ class _UpdateprofileState extends State { payload["emails"] = [{"email":emailController.text.toString()}]; payload["description"] = descriptionController.text.toString(); bool signUpStatus = await AppSettings.updatePharmaData(payload); - try{ + AppSettings.longSuccessToast("Pharmacy Profile Updated !!"); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Dashboard()), + ); + /* try{ if (signUpStatus) { Navigator.pop(context); + AppSettings.longSuccessToast("Pharmacy Profile Updated !!"); Navigator.push( context, MaterialPageRoute(builder: (context) => Dashboard()), ); - AppSettings.longSuccessToast("Pharmacy Profile Updated !!"); + } else { - AppSettings.longFailedToast("Pharmacy Profile Not Updated !!"); + //AppSettings.longFailedToast("Pharmacy Profile Not Updated !!"); } } catch(exception){ print(exception); AppSettings.longFailedToast("Please enter valid details"); - } + }*/ }, child: Text('Update'), ) diff --git a/pubspec.lock b/pubspec.lock index 7dea8d6..be82167 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -868,6 +868,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.5" + quantity_input: + dependency: "direct dev" + description: + name: quantity_input + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" sanitize_html: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index dc640df..b7da571 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,7 +62,7 @@ dev_dependencies: cloudinary_public: ^0.21.0 carousel_slider: ^4.2.1 photo_view: ^0.14.0 - + quantity_input: ^1.0.2 flutter_icons: