|
|
|
@ -10,6 +10,7 @@ import 'package:healthcare_user/keys.dart';
|
|
|
|
|
import 'package:healthcare_user/models/pharmacies_model.dart';
|
|
|
|
|
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
|
|
|
|
|
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
|
|
|
|
|
import 'package:healthcare_user/prescriptions/get_quotations_request_list.dart';
|
|
|
|
|
import 'package:location/location.dart' as locationmap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -29,6 +30,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
//String dropdownType = 'Tank';
|
|
|
|
|
var AreaItems = ['2', '5', '10', '25', '50', '100'];
|
|
|
|
|
List pharmaciesCheckboxes = [];
|
|
|
|
|
List pharmaciesCheckboxesInDialog = [];
|
|
|
|
|
List selectedPharmacies = [];
|
|
|
|
|
bool isLoading = false;
|
|
|
|
|
bool isSereverIssue = false;
|
|
|
|
@ -68,6 +70,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
|
|
|
|
|
Future<void> getAllPharmaciesData(var distance) async {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
selectedPharmacies=[];
|
|
|
|
|
try {
|
|
|
|
|
var pharmacyResponse = await AppSettings.getAllpharmacies();
|
|
|
|
|
|
|
|
|
@ -110,74 +113,447 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showListOfSelectedPharmacies() async {
|
|
|
|
|
|
|
|
|
|
showSelectedPharmaciesDialog(){
|
|
|
|
|
return showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return StatefulBuilder(
|
|
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
height: 300.0, // Change as per your requirement
|
|
|
|
|
width: 300.0, // Change as per your requirement
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: 5,
|
|
|
|
|
return StatefulBuilder(builder: (context, setState) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: Text('Selected Pharmacies'),
|
|
|
|
|
content: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * .50,
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
child:ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => const Divider(height: 4.0,color: Colors.black,),
|
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return ListTile(
|
|
|
|
|
title: Text('Gujarat, India'),
|
|
|
|
|
title: CheckboxListTile(
|
|
|
|
|
title: Padding(
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
/*Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 5,
|
|
|
|
|
),*/
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.contact_number
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.description
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
checkColor: Colors.white,
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
value: selectedPharmacies[index].isPharmacyInDialogChecked,
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
setState(
|
|
|
|
|
() {
|
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked = val!;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
if (selectedPharmacies[index].isPharmacyInDialogChecked) {
|
|
|
|
|
pharmaciesCheckboxesInDialog.add({
|
|
|
|
|
'pharmacyId': selectedPharmacies[index].pharmacy_id,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
pharmaciesCheckboxesInDialog.removeWhere((e) =>
|
|
|
|
|
e['pharmacyId'].toString().toUpperCase() ==
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_id
|
|
|
|
|
.toString()
|
|
|
|
|
.toUpperCase());
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
/* return AlertDialog(
|
|
|
|
|
title: const Text('Selected pharmacies'),
|
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
|
child: Expanded(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Card(
|
|
|
|
|
/*Padding(
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 5,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(selectedPharmacies[index].pharmacy_name)
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.contact_number
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.description
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
);},
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:selectedPharmacies[index].isPharmacyInDialogChecked==false,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
child: Text('Cancel', style: textButtonStyle()),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked=true;
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Select'),
|
|
|
|
|
),),
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: selectedPharmacies[index].isPharmacyInDialogChecked==true,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
child: Text('Get quote', style: textButtonStyle()),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
child: const Text('Deselect'),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
);*/
|
|
|
|
|
});
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
)),*/
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: buttonColors, // background
|
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Cancel'),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: buttonColors, // background
|
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
if(pharmaciesCheckboxesInDialog.length==3){
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
|
|
payload["picture"] = widget.prescriptionDetails.prescription_url.toString();
|
|
|
|
|
payload["pharmacies"] = pharmaciesCheckboxesInDialog;
|
|
|
|
|
payload["familyDetails"] = {
|
|
|
|
|
"patient_name": widget.prescriptionDetails.patient_name.toString(),
|
|
|
|
|
"patient_age": int.parse(widget.prescriptionDetails.age.toString()),
|
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender,
|
|
|
|
|
"patient_address": userAddress
|
|
|
|
|
};
|
|
|
|
|
bool status = await AppSettings.getQuotation(payload);
|
|
|
|
|
|
|
|
|
|
if(status){
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longSuccessToast('Quotation request sent successfully');
|
|
|
|
|
pharmaciesCheckboxesInDialog.clear();
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longFailedToast('Get quotation failed try after some time');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(pharmaciesCheckboxesInDialog.length>3){
|
|
|
|
|
AppSettings.longFailedToast('Please select only three pharmacies to get quotation');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('Please select at least three pharmacies to get quotation');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Get quote'),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget setupAlertDialoadContainer() {
|
|
|
|
|
return Container(
|
|
|
|
|
height: 300.0, // Change as per your requirement
|
|
|
|
|
width: 300.0, // Change as per your requirement
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: 5,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .50,
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
child:ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => const Divider(height: 4.0,color: Colors.black,),
|
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return ListTile(
|
|
|
|
|
title: Text('Gujarat, India'),
|
|
|
|
|
title: Padding(
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 5,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.contact_number
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
child: Text(
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
.description
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:selectedPharmacies[index].isPharmacyInDialogChecked==false,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked=true;
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Select'),
|
|
|
|
|
),),
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: selectedPharmacies[index].isPharmacyInDialogChecked==true,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Deselect'),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
@ -319,7 +695,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(pharmaciesCheckboxes.length==3){
|
|
|
|
|
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
|
|
payload["picture"] = widget.prescriptionDetails.prescription_url.toString();
|
|
|
|
@ -327,22 +703,30 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
payload["familyDetails"] = {
|
|
|
|
|
"patient_name": widget.prescriptionDetails.patient_name.toString(),
|
|
|
|
|
"patient_age": int.parse(widget.prescriptionDetails.age.toString()),
|
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender,
|
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender.toString().toLowerCase(),
|
|
|
|
|
"patient_address": userAddress
|
|
|
|
|
};
|
|
|
|
|
bool status = await AppSettings.getQuotation(payload);
|
|
|
|
|
|
|
|
|
|
if(status){
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longSuccessToast('Quotation request sent successfully');
|
|
|
|
|
pharmaciesCheckboxes.clear();
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longFailedToast('Get quotation failed try after some time');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(pharmaciesCheckboxes.length>3){
|
|
|
|
|
|
|
|
|
|
showListOfSelectedPharmacies();
|
|
|
|
|
showSelectedPharmaciesDialog();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
@ -488,7 +872,9 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
)),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: TextButton(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
child: const Text(
|
|
|
|
|
'Want to order non prescribed items?',
|
|
|
|
@ -497,6 +883,24 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(width: 5,),
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: const Text(
|
|
|
|
|
'Requests',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
@ -659,7 +1063,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
Icons.area_chart,
|
|
|
|
|
Icons.location_on_outlined,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|