diff --git a/images/editprofile.png b/images/editprofile.png index cb7373e..390ddeb 100644 Binary files a/images/editprofile.png and b/images/editprofile.png differ diff --git a/images/logout.png b/images/logout.png index f577225..71456e9 100644 Binary files a/images/logout.png and b/images/logout.png differ diff --git a/images/medicines.png b/images/medicines.png index d6d4650..80999e4 100644 Binary files a/images/medicines.png and b/images/medicines.png differ diff --git a/images/myconnections.png b/images/myconnections.png index 7062451..51fa9eb 100644 Binary files a/images/myconnections.png and b/images/myconnections.png differ diff --git a/images/myhealth.png b/images/myhealth.png index 1018a84..320c3fe 100644 Binary files a/images/myhealth.png and b/images/myhealth.png differ diff --git a/images/mymedicinetimings.png b/images/mymedicinetimings.png index ca62e55..1881b14 100644 Binary files a/images/mymedicinetimings.png and b/images/mymedicinetimings.png differ diff --git a/images/reportmyself.png b/images/reportmyself.png index c588708..039f53c 100644 Binary files a/images/reportmyself.png and b/images/reportmyself.png differ diff --git a/images/updatemobilenumber.png b/images/updatemobilenumber.png index 028dc66..a6b5d9f 100644 Binary files a/images/updatemobilenumber.png and b/images/updatemobilenumber.png differ diff --git a/images/updatemylocation.png b/images/updatemylocation.png index 533820d..937946d 100644 Binary files a/images/updatemylocation.png and b/images/updatemylocation.png differ diff --git a/images/updatepin.png b/images/updatepin.png index 7bbbd21..84e28e7 100644 Binary files a/images/updatepin.png and b/images/updatepin.png differ diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart index 160600e..dbdea3f 100644 --- a/lib/common/dashboard.dart +++ b/lib/common/dashboard.dart @@ -726,7 +726,7 @@ class _DashboardState extends State { title: Row( children: [ Image( - image: const AssetImage('images/myconnections.png'), + image: const AssetImage('images/reportmyself.png'), height: 25, width: 25, fit: BoxFit.fill), diff --git a/lib/common/settings.dart b/lib/common/settings.dart index 2d8b044..404e0b9 100644 --- a/lib/common/settings.dart +++ b/lib/common/settings.dart @@ -35,7 +35,8 @@ TextStyle labelTextStyle() { } TextStyle haveMotorTextStyle() { - return TextStyle(color: Colors.red, fontSize: 12,fontWeight: FontWeight.bold); + return TextStyle( + color: Colors.red, fontSize: 12, fontWeight: FontWeight.bold); } TextStyle textButtonStyle() { @@ -57,12 +58,14 @@ TextStyle startAndStopHeading() { return TextStyle( fontSize: 14, fontWeight: FontWeight.bold, - color: primaryColor, + color: primaryColor, ); } + Text capacitySuffixText() { return Text('in Ltrs.'); } + Text dimensionSuffixText() { return Text('in fts'); } @@ -86,39 +89,60 @@ TextStyle serverIssueTextStyle() { } TextStyle bottomSheetValuesTextStyle() { - return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); + return TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); } TextStyle wrapTextStyle() { - return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); + return TextStyle( + color: primaryColor, + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); } TextStyle wrapTextStyleBlack() { - return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); + return TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); } TextStyle withoutWrapTextStyle() { - return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,); + return TextStyle( + color: primaryColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ); } TextStyle bmiTextStyle() { - return TextStyle(color:primaryColor,fontSize: 16,fontWeight: FontWeight.bold,); + return TextStyle( + color: primaryColor, + fontSize: 16, + fontWeight: FontWeight.bold, + ); } -TextStyle drawerListItemsTextStyle(){ +TextStyle drawerListItemsTextStyle() { return TextStyle(color: Colors.white); } -TextStyle drawerHeaderTextStyle(){ + +TextStyle drawerHeaderTextStyle() { return TextStyle(color: Colors.white, fontSize: 15); } -TextStyle drawerHeaderTextStyleNew(){ +TextStyle drawerHeaderTextStyleNew() { return TextStyle(color: Colors.black, fontSize: 15); } - - -InputDecoration textFormFieldDecoration(IconData icon,var text){ +InputDecoration textFormFieldDecoration(IconData icon, var text) { return InputDecoration( filled: true, fillColor: Colors.white, @@ -134,8 +158,8 @@ InputDecoration textFormFieldDecoration(IconData icon,var text){ borderSide: BorderSide(color: primaryColor), ), labelText: text, - labelStyle: - TextStyle(color: Colors.black, //<-- SEE HERE + labelStyle: TextStyle( + color: Colors.black, //<-- SEE HERE ), ); } @@ -172,9 +196,9 @@ class AppSettings { static late Position position; static String long = "", lat = ""; late StreamSubscription positionStream; - static String fcmId=''; - static String serverToken='AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO'; - + static String fcmId = ''; + static String serverToken = + 'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO'; //api urls static String host = 'http://35.200.129.165:4000/api/'; @@ -197,21 +221,12 @@ class AppSettings { static String getMedicineTimingsUrl = host + 'getmedicineztiming'; static String prescriptionUploadPicUrl = host + 'uploads-precription'; static String getAllpharmaciesDataUrl = host + 'getAllPharmacylist'; + static String getAllQuotationRequestsUrl = host + 'userprecription'; static String getQuotationUrl = host + 'submitPicture'; static String addPrescriptionUrl = host + 'add-prescription-details'; static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo'; static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription'; - - - - - - - - - - static File? updatedImage; static String image = ''; static String profilePictureUrl = ''; @@ -234,8 +249,6 @@ class AppSettings { ); } - - /* Preloader */ static GlobalKey preLoaderKey = new GlobalKey(); static Future preLoaderDialog(BuildContext context) async { @@ -260,7 +273,8 @@ class AppSettings { return _headers; } - static Future> buildPutRequestHeadersForResetToken() async { + static Future> + buildPutRequestHeadersForResetToken() async { Map _headers = new Map(); return _headers; } @@ -369,28 +383,30 @@ class AppSettings { } } - static Future sendSms(payload) async{ - var response=await http.post(Uri.parse(sendSmsUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'}); - if(response.statusCode==200){ + static Future sendSms(payload) async { + var response = await http.post(Uri.parse(sendSmsUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + if (response.statusCode == 200) { return true; - } - else{ + } else { return false; } } - static Future phoneVerification(payload) async{ - var response=await http.post(Uri.parse(phoneVerificationUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'}); - if(response.statusCode==200){ + static Future phoneVerification(payload) async { + var response = await http.post(Uri.parse(phoneVerificationUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + if (response.statusCode == 200) { return true; - } - else{ + } else { return false; } } static Future calculateBmi(payload) async { - var uri = Uri.parse(bmiCaluculateUrl+ '/'+customerId); + var uri = Uri.parse(bmiCaluculateUrl + '/' + customerId); var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); @@ -415,7 +431,7 @@ class AppSettings { } static Future calculateBP(payload) async { - var uri = Uri.parse(bpCaluculateUrl+ '/'+customerId); + var uri = Uri.parse(bpCaluculateUrl + '/' + customerId); var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); @@ -440,7 +456,7 @@ class AppSettings { } static Future calculateSugar(payload) async { - var uri = Uri.parse(sugarCaluculateUrl+ '/'+customerId); + var uri = Uri.parse(sugarCaluculateUrl + '/' + customerId); var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); @@ -524,9 +540,7 @@ class AppSettings { // display error toast return false; } - } - - else if (response.statusCode == 401) { + } else if (response.statusCode == 401) { bool status = await AppSettings.resetToken(); if (status) { response = await http.post(uri, @@ -539,9 +553,7 @@ class AppSettings { } else { return false; } - } - - else { + } else { return false; } } @@ -549,10 +561,8 @@ class AppSettings { static Future updateProfile(payload) async { var uri = Uri.parse(updateProfileUrl + '/' + customerId); try { - var response = await http.put( - uri, - body: json.encode(payload), - headers: await buildRequestHeaders()); + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { var _response = json.decode(response.body); @@ -562,7 +572,7 @@ class AppSettings { email = _response['emails'][0]['email']; age = _response['age'].toString(); await saveData('phone', _response['phone'], 'STRING'); - await saveData('email', _response['emails'][0]['email'], 'STRING'); + await saveData('email', _response['emails'][0]['email'], 'STRING'); await saveData('username', _response['username'], 'STRING'); await saveData('age', _response['age'].toString(), 'STRING'); await loadDataFromMemory(); @@ -577,7 +587,7 @@ class AppSettings { } static Future getBmiHistory() async { - var uri = Uri.parse(getBmiHistoryUrl+'/'+customerId); + var uri = Uri.parse(getBmiHistoryUrl + '/' + customerId); var response = await http.get(uri, headers: await buildRequestHeaders()); if (response.statusCode == 200) { @@ -600,7 +610,7 @@ class AppSettings { } static Future getBPHistory() async { - var uri = Uri.parse(getBpHistoryUrl+'/'+customerId); + var uri = Uri.parse(getBpHistoryUrl + '/' + customerId); var response = await http.get(uri, headers: await buildRequestHeaders()); if (response.statusCode == 200) { @@ -623,7 +633,7 @@ class AppSettings { } static Future getSugarHistory() async { - var uri = Uri.parse(getSugarHistoryUrl+'/'+customerId); + var uri = Uri.parse(getSugarHistoryUrl + '/' + customerId); var response = await http.get(uri, headers: await buildRequestHeaders()); if (response.statusCode == 200) { @@ -645,7 +655,7 @@ class AppSettings { } } - /* static Future upload() async{ + /* static Future upload() async{ final uri = Uri.parse('https://myendpoint.com'); var request = new http.MultipartRequest('POST', uri); final httpImage = http.MultipartFile.fromBytes('files.myimage', bytes, @@ -655,41 +665,38 @@ class AppSettings { }*/ static Future uploadImageHTTP(file) async { - - var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + customerId)); + var request = http.MultipartRequest( + 'POST', Uri.parse(uploadPicUrl + '/' + customerId)); request.files.add(await http.MultipartFile.fromPath('picture', file.path)); var res = await request.send(); return res; - } - static Future uploadImageHTTPNew(file) async { - var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + customerId)); + static Future uploadImageHTTPNew(file) async { + var request = http.MultipartRequest( + 'POST', Uri.parse(uploadPicUrl + '/' + customerId)); request.files.add(await http.MultipartFile.fromPath('picture', file.path)); var res = await request.send(); var response = await http.Response.fromStream(res); return response.body; - } static Future uploadImageHTTPForPrescriptions(file) async { - - var request = http.MultipartRequest('POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId)); + var request = http.MultipartRequest( + 'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId)); request.files.add(await http.MultipartFile.fromPath('picture', file.path)); var res = await request.send(); - var response = await http.Response.fromStream(res); + var response = await http.Response.fromStream(res); return response.body; - } static Future uploadVideoInReportMySelf(file) async { - - var request = http.MultipartRequest('POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId)); + var request = http.MultipartRequest( + 'POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId)); request.files.add(await http.MultipartFile.fromPath('video', file.path)); var res = await request.send(); var response = await http.Response.fromStream(res); return response.body; - } static Future getAllpharmacies() async { @@ -716,8 +723,32 @@ class AppSettings { } } + static Future getAllQuotationRequests() async { + var uri = Uri.parse(getAllQuotationRequestsUrl+'/'+customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + 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 ''; + } + } + static Future addMedicineTimings(payload) async { - var uri = Uri.parse(addMedicineTimingsUrl+ '/'+customerId); + var uri = Uri.parse(addMedicineTimingsUrl + '/' + customerId); var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); @@ -742,7 +773,7 @@ class AppSettings { } static Future getMedicineTimings() async { - var uri = Uri.parse(getMedicineTimingsUrl+'/'+customerId); + var uri = Uri.parse(getMedicineTimingsUrl + '/' + customerId); var response = await http.get(uri, headers: await buildRequestHeaders()); if (response.statusCode == 200) { @@ -766,10 +797,8 @@ class AppSettings { static Future getQuotation(payload) async { var uri = Uri.parse(getQuotationUrl + '/' + customerId); - var response = await http.post( - uri, - body: json.encode(payload), - headers: await buildRequestHeaders()); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { try { @@ -783,10 +812,8 @@ class AppSettings { } else if (response.statusCode == 401) { bool status = await AppSettings.resetToken(); if (status) { - response = await http.post( - uri, - body: json.encode(payload), - headers: await buildRequestHeaders()); + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { return true; } else { @@ -802,10 +829,8 @@ class AppSettings { static Future addPrescription(payload) async { var uri = Uri.parse(addPrescriptionUrl + '/' + customerId); - var response = await http.post( - uri, - body: json.encode(payload), - headers: await buildRequestHeaders()); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { try { @@ -819,10 +844,8 @@ class AppSettings { } else if (response.statusCode == 401) { bool status = await AppSettings.resetToken(); if (status) { - response = await http.post( - uri, - body: json.encode(payload), - headers: await buildRequestHeaders()); + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { return true; } else { @@ -837,7 +860,7 @@ class AppSettings { } static Future getAllPrescriptions() async { - var uri = Uri.parse(getAllPrescriptionsDataUrl+'/'+customerId); + var uri = Uri.parse(getAllPrescriptionsDataUrl + '/' + customerId); //uri = uri.replace(query: 'customerId=$customerId'); var response = await http.get(uri, headers: await buildRequestHeaders()); @@ -860,8 +883,6 @@ class AppSettings { } } - - /*Apis ends here*/ //save data local @@ -886,7 +907,7 @@ class AppSettings { await loadDataFromMemory(); } - /* static Future saveProfile(dynamic image) async { + /* static Future saveProfile(dynamic image) async { // save login name information await saveData('profile', image.toString(), 'STRING'); //await loadDataFromMemory(); @@ -904,11 +925,11 @@ class AppSettings { phoneNumber = await getData('phone', 'STRING'); customerId = await getData('customerId', 'STRING'); userLatitude = await getData('latitude', 'DOUBLE'); - userLongitude =await getData('longitude', 'DOUBLE'); - profilePictureUrl=await getData('profile', 'STRING'); - fcmId =await getData('fcmId', 'STRING'); - age=await getData('age', 'STRING'); - gender=await getData('gender', 'STRING'); + userLongitude = await getData('longitude', 'DOUBLE'); + profilePictureUrl = await getData('profile', 'STRING'); + fcmId = await getData('fcmId', 'STRING'); + age = await getData('age', 'STRING'); + gender = await getData('gender', 'STRING'); } static void longFailedStyledToast(String message, context) { @@ -936,6 +957,7 @@ class AppSettings { textColor: Colors.white, fontSize: 16.0); } + static void longSuccessToast1(String message) { Fluttertoast.showToast( msg: message, @@ -944,8 +966,7 @@ class AppSettings { timeInSecForIosWeb: 1, backgroundColor: Colors.green, textColor: Colors.white, - fontSize: 16.0 - ); + fontSize: 16.0); } static void longFailedToast(String message) { diff --git a/lib/models/get_quotation_requests_list_model.dart b/lib/models/get_quotation_requests_list_model.dart new file mode 100644 index 0000000..17270b0 --- /dev/null +++ b/lib/models/get_quotation_requests_list_model.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:healthcare_user/common/settings.dart'; + +class GetQuotationsRequsetListModel { + String pharmacy_name = ''; + String customer_id = ''; + String patient_name = ''; + double patient_age =0; + String patient_gender = ''; + String patient_address = ''; + String status=''; + String picture=''; + String contact_number=''; + String pharmacy_address=''; + String pharmacy_id=''; + String registration_number=''; + String description=''; + String starting_price=''; + Color text_color=Colors.black; + double lat=0; + double lng=0; + bool isChecked=false; + bool isPharmacyInDialogChecked=false; + + GetQuotationsRequsetListModel(); + + factory GetQuotationsRequsetListModel.fromJson(Map json){ + GetQuotationsRequsetListModel rtvm = new GetQuotationsRequsetListModel(); + + rtvm.customer_id = json['customerId'] ?? ''; + rtvm.patient_name= json['user']['familyDetails']['patient_name']??''; + rtvm.patient_age= json['user']['familyDetails']['patient_age']??0; + rtvm.patient_gender= json['user']['familyDetails']['patient_gender']??''; + rtvm.patient_address= json['user']['familyDetails']['patient_address']??''; + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/models/pharmacies_model.dart b/lib/models/pharmacies_model.dart index 1972967..ecf8d2d 100644 --- a/lib/models/pharmacies_model.dart +++ b/lib/models/pharmacies_model.dart @@ -15,6 +15,7 @@ class PharmaciesModel { double lat=0; double lng=0; bool isChecked=false; + bool isPharmacyInDialogChecked=false; PharmaciesModel(); @@ -30,8 +31,8 @@ class PharmaciesModel { rtvm.starting_price = json['startingPrice'] ?? ''; rtvm.picture = json['picture'] ?? ''; rtvm.status = json['status'] ?? ''; - rtvm.lat = json['latitude'] ?? 0; - rtvm.lng = json['longitude'] ??0; + rtvm.lat = json['latitude'] ?? 0.0; + rtvm.lng = json['longitude'] ??0.0; return rtvm; } diff --git a/lib/my_medicine_timings.dart b/lib/my_medicine_timings.dart index f4bf3d1..30c06c0 100644 --- a/lib/my_medicine_timings.dart +++ b/lib/my_medicine_timings.dart @@ -366,6 +366,9 @@ class _MyMedicineTimingsState extends State { onPressed: () async { editTimingsDialog(); + /*Navigator.push(context, MaterialPageRoute(builder: (context) => EditMedicineTimings())).then((value) { + getMedicineTimingsList(); + });*/ }, child: const Text('Edit'), ), diff --git a/lib/prescriptions/get_quotations_request_list.dart b/lib/prescriptions/get_quotations_request_list.dart new file mode 100644 index 0000000..63b3673 --- /dev/null +++ b/lib/prescriptions/get_quotations_request_list.dart @@ -0,0 +1,60 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:healthcare_user/common/settings.dart'; +import 'package:healthcare_user/models/get_quotation_requests_list_model.dart'; + +class GetQuotationRequestsList extends StatefulWidget { + const GetQuotationRequestsList({Key? key}) : super(key: key); + + @override + State createState() => _GetQuotationRequestsListState(); +} + +class _GetQuotationRequestsListState extends State { + + bool isLoading = false; + bool isSereverIssue = false; + List quotationRequestsList = []; + + Future getAllQuotationRequestsList() async { + isLoading = true; + try { + var resopnse = await AppSettings.getAllQuotationRequests(); + + setState(() { + quotationRequestsList = ((jsonDecode(resopnse)) as List) + .map((dynamic model) { + return GetQuotationsRequsetListModel.fromJson(model); + }).toList(); + + isLoading = false; + }); + } catch (e) { + setState(() { + isLoading = false; + isSereverIssue = true; + }); + } + } + + + @override + void initState() { + getAllQuotationRequestsList(); + super.initState(); + } + + Widget renderUi(){ + return Container(); + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppSettings.appBar('Quotation Requests'), + body: renderUi(), + ); + } +} diff --git a/lib/prescriptions/oreder_medicines.dart b/lib/prescriptions/oreder_medicines.dart index dc44d21..e4a86db 100644 --- a/lib/prescriptions/oreder_medicines.dart +++ b/lib/prescriptions/oreder_medicines.dart @@ -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 { //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 { Future getAllPharmaciesData(var distance) async { isLoading = true; + selectedPharmacies=[]; try { var pharmacyResponse = await AppSettings.getAllpharmacies(); @@ -110,74 +113,447 @@ class _OrderMedicinesState extends State { } - showListOfSelectedPharmacies() async { + + showSelectedPharmaciesDialog(){ return showDialog( - context: context, - barrierDismissible: false, - 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, + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + 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'), - ); - }, - ), - ); - /* return AlertDialog( - title: const Text('Selected pharmacies'), - content: SingleChildScrollView( - child: Expanded( - child: ListView.builder( - itemCount: selectedPharmacies.length, - itemBuilder: (context, index) { - return Card( + 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()); + } + }, + ), + /*Padding( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), child: Column( children: [ - Text(selectedPharmacies[index].pharmacy_name) + 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'), + )) + ], + )), + ], - ), - );}, - ), - ) + )),*/ + ); + }, ), - actions: [ - TextButton( - child: Text('Cancel', style: textButtonStyle()), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - TextButton( - child: Text('Get quote', style: textButtonStyle()), - onPressed: () async { - Navigator.of(context).pop(); - }, - ), - ], - );*/ - }); - }, - ); + ), + actions: [ + + 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(); + + 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 { if(pharmaciesCheckboxes.length==3){ - + AppSettings.preLoaderDialog(context); var payload = new Map(); payload["picture"] = widget.prescriptionDetails.prescription_url.toString(); @@ -327,22 +703,30 @@ class _OrderMedicinesState extends State { 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,15 +872,35 @@ class _OrderMedicinesState extends State { )), Padding( padding: EdgeInsets.all(10), - child: TextButton( - onPressed: () {}, - child: const Text( - 'Want to order non prescribed items?', - style: TextStyle( - fontSize: 15, - decoration: TextDecoration.underline, - color: primaryColor), - )), + child: Row( + children: [ + TextButton( + onPressed: () {}, + child: const Text( + 'Want to order non prescribed items?', + style: TextStyle( + fontSize: 15, + 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 { isExpanded: true, decoration: const InputDecoration( prefixIcon: Icon( - Icons.area_chart, + Icons.location_on_outlined, color: primaryColor, ), border: OutlineInputBorder( diff --git a/lib/reports.dart b/lib/reports.dart index a41b4ff..e8ea39b 100644 --- a/lib/reports.dart +++ b/lib/reports.dart @@ -9,11 +9,48 @@ class Reports extends StatefulWidget { } class _ReportsState extends State { + + TextEditingController doctorNameController = TextEditingController(); + TextEditingController hospitalNameController = TextEditingController(); + TextEditingController problemController = TextEditingController(); + + @override Widget build(BuildContext context) { return Scaffold( appBar: AppSettings.appBar('Reports'), - body: Container(), + body: Container( + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: TextFormField( + cursorColor: greyColor, + controller: doctorNameController, + decoration: textFormFieldDecoration(Icons.person,'Enter Doctor name'), + ), + ), + SizedBox(height:MediaQuery.of(context).size.height * .02,), + Container( + child: TextFormField( + cursorColor: greyColor, + controller: hospitalNameController, + decoration: textFormFieldDecoration(Icons.location_city_outlined,'Enter Hospital name'), + ), + ), + SizedBox(height:MediaQuery.of(context).size.height * .02,), + Container( + child: TextFormField( + cursorColor: greyColor, + controller: problemController, + decoration: textFormFieldDecoration(Icons.edit,'Enter Problem'), + ), + ), + ], + ), + ), + ), ); } }