parent
4eb06ee8e5
commit
281bd46f0a
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
@ -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<BiddingRequests> createState() => _BiddingRequestsState();
|
||||
}
|
||||
|
||||
class _BiddingRequestsState extends State<BiddingRequests> {
|
||||
String Url = '';
|
||||
List<BiddingRequestsModel> prescriptionsList = [];
|
||||
List<BiddingRequestsModel> prescriptionsListOriginal = [];
|
||||
bool isPrescriptionsDataLoading = false;
|
||||
bool isSereverIssue = false;
|
||||
bool isLoading=false;
|
||||
|
||||
|
||||
|
||||
Future<void> 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: <Widget>[
|
||||
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: <Widget>[
|
||||
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<String, dynamic>();
|
||||
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(),
|
||||
);
|
||||
}
|
||||
}
|
@ -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<MedicineCartList> createState() => _MedicineCartListState();
|
||||
}
|
||||
|
||||
class _MedicineCartListState extends State<MedicineCartList> 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<BiddingCartviewModel> offersviewList = [];
|
||||
TextEditingController medicine_nameController = TextEditingController();
|
||||
TextEditingController medicine_quantityController = TextEditingController();
|
||||
TextEditingController medicine_priceController = TextEditingController();
|
||||
TextEditingController medicine_timingsController = TextEditingController();
|
||||
|
||||
|
||||
Future<void> getCartViewData() async {
|
||||
isLoading = true;
|
||||
|
||||
try {
|
||||
var response = await AppSettings.getCartDetails(widget.bookidcart).then((value){
|
||||
setState(() {
|
||||
// offersviewList = BiddingCartviewModel.fromJson(response['items']) as List<BiddingCartviewModel>;
|
||||
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: <Widget>[
|
||||
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(),
|
||||
));
|
||||
}
|
||||
}
|
@ -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<MedicineDetails> createState() => _deliverboyState();
|
||||
}
|
||||
|
||||
class _deliverboyState extends State<MedicineDetails> {
|
||||
|
||||
|
||||
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: <Widget>[
|
||||
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<String, dynamic>();
|
||||
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,
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
@ -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<String, dynamic> 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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
import 'dart:convert';
|
||||
|
||||
List<BiddingCartviewModel> biddingCartviewModelFromJson(String str) => List<BiddingCartviewModel>.from(json.decode(str).map((x) => BiddingCartviewModel.fromJson(x)));
|
||||
|
||||
String biddingCartviewModelToJson(List<BiddingCartviewModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
||||
|
||||
class BiddingCartviewModel {
|
||||
String? id;
|
||||
String? medicinename_bidding ;
|
||||
int? quantity_bidding;
|
||||
double? price_bidding;
|
||||
List<MedicineTiming>? medicine_timings;
|
||||
|
||||
BiddingCartviewModel({
|
||||
this.id,
|
||||
this.medicinename_bidding ,
|
||||
this.quantity_bidding,
|
||||
this.price_bidding,
|
||||
this.medicine_timings,
|
||||
});
|
||||
|
||||
factory BiddingCartviewModel.fromJson(Map<String, dynamic> 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<MedicineTiming>.from(json["medicine_timings"]!.map((x) => MedicineTiming.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_id": id,
|
||||
"medicinename": medicinename_bidding ,
|
||||
"quantity": quantity_bidding,
|
||||
"price": price_bidding,
|
||||
"medicine_timings": medicine_timings == null ? [] : List<dynamic>.from(medicine_timings!.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class MedicineTiming {
|
||||
String? id;
|
||||
String? medicineTimings;
|
||||
|
||||
MedicineTiming({
|
||||
this.id,
|
||||
this.medicineTimings,
|
||||
});
|
||||
|
||||
factory MedicineTiming.fromJson(Map<String, dynamic> json) => MedicineTiming(
|
||||
id: json["_id"],
|
||||
medicineTimings: json["medicine_timings"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_id": id,
|
||||
"medicine_timings": medicineTimings,
|
||||
};
|
||||
}
|
Loading…
Reference in new issue