diff --git a/lib/Reports/add_reports.dart b/lib/Reports/add_reports.dart index d43ba3a..585fdc2 100644 --- a/lib/Reports/add_reports.dart +++ b/lib/Reports/add_reports.dart @@ -18,6 +18,7 @@ class AddReports extends StatefulWidget { } class _AddReportsState extends State { + TextEditingController doctorNameController = TextEditingController(); TextEditingController hospitalNameController = TextEditingController(); TextEditingController problemController = TextEditingController(); @@ -33,7 +34,6 @@ class _AddReportsState extends State { List uiFindingsImages = []; List uiReportsImages = []; List uiPrescriptionImages = []; - Map findings={}; List images = []; String _error = 'No Error Dectected'; @@ -47,7 +47,6 @@ class _AddReportsState extends State { String? problemCategory; String? gender; var doctorNameVariable; - List connectedDoctorsListOriginal = []; Future getAllConnectedDoctors() async { @@ -55,7 +54,7 @@ class _AddReportsState extends State { var response = await AppSettings.getAllConnectedDoctors(); setState(() { - connectedDoctorsListOriginal = ((jsonDecode(response)) as List) + connectedDoctorsListOriginal = ((jsonDecode(response)['doctors']) as List) .map((dynamic model) { return GetConnectedDoctorsModel.fromJson(model); }).toList(); @@ -73,7 +72,6 @@ class _AddReportsState extends State { super.initState(); } - Future pickImageFromGallery() async { imageFileList = []; final List? selectedImages = await imagePicker.pickMultiImage(); @@ -351,8 +349,8 @@ class _AddReportsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container(child: connectedDoctorsListOriginal.length!=0?DropdownButtonFormField( - // Initial Value + Container( + child: connectedDoctorsListOriginal.length!=0?DropdownButtonFormField( value: doctorNameVariable, isExpanded: true, decoration: const InputDecoration( @@ -397,7 +395,8 @@ class _AddReportsState extends State { doctorNameVariable = newValue; }); }, - ):IconButton( + ): + IconButton( onPressed: () { Navigator.push(context, MaterialPageRoute(builder: (context) => AddDoctor())).then((value) { getAllConnectedDoctors(); @@ -409,90 +408,15 @@ class _AddReportsState extends State { size: 40, ), ),), - Visibility( - visible: connectedDoctorsListOriginal.length!=0, - child: Container(child: DropdownButtonFormField( - // Initial Value - value: doctorNameVariable, - isExpanded: true, - decoration: const InputDecoration( - prefixIcon: Icon( - Icons.person, - color: greyColor, - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor), - ), - labelText: 'Select Doctor', - labelStyle: TextStyle( - color: greyColor, //<-- SEE HERE - ), - ), - - hint: Text('Please Select Doctor'), - // Down Arrow Icon - //icon: const Icon(Icons.keyboard_arrow_down), - - // Array list of items - items: connectedDoctorsListOriginal.map((items) { - return DropdownMenuItem( - value: items, - child: Text( - items.doctor_name, - style: TextStyle( - fontSize: 16, - ), - textAlign: TextAlign.center, - )); - }).toList(), - // After selecting the desired option,it will - // change button value to selected value - onChanged: ( newValue) { - setState(() { - doctorNameVariable = newValue; - }); - }, - ),), - ), - - SizedBox( - height: MediaQuery.of(context).size.height * .02, - ), - /* Container( - child: TextFormField( - cursorColor: greyColor, - controller: doctorNameController, - textCapitalization: TextCapitalization.words, - decoration: textFormFieldDecoration( - Icons.person, 'Enter Doctor name'), - ), - ), SizedBox( height: MediaQuery.of(context).size.height * .02, ), - Container( - child: TextFormField( - cursorColor: greyColor, - controller: hospitalNameController, - textCapitalization: TextCapitalization.words, - decoration: textFormFieldDecoration( - Icons.location_city_outlined, 'Enter Hospital name'), - ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * .02, - ),*/ Container( child: TextFormField( cursorColor: greyColor, controller: problemController, textCapitalization: TextCapitalization.words, - decoration: textFormFieldDecoration( + decoration: textFormFieldDecorationGrey( Icons.report_problem, 'Enter Problem'), ), ), @@ -503,7 +427,7 @@ class _AddReportsState extends State { child: TextFormField( cursorColor: greyColor, controller: dateInput, - decoration: textFormFieldDecoration( + decoration: textFormFieldDecorationGrey( Icons.calendar_today, 'Enter Date'), readOnly: true, onTap: () async { @@ -546,7 +470,8 @@ class _AddReportsState extends State { SizedBox( height: MediaQuery.of(context).size.height * .02, ), - Text('Select Problem Category',style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),), + Text('Select Problem Category', + style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),), Row( children: [ Expanded( @@ -577,7 +502,8 @@ class _AddReportsState extends State { ), ], ), - Text('Select Problem For',style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),), + Text('Select Problem For', + style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),), Row( children: [ Expanded( @@ -608,7 +534,6 @@ class _AddReportsState extends State { ), ], ), - Visibility( visible: prescriptionFor.toString().toLowerCase() == 'others', @@ -690,6 +615,7 @@ class _AddReportsState extends State { ], ), ), + /*findings*/ Visibility( visible: uiFindingsImages.length == 0, @@ -1241,6 +1167,7 @@ class _AddReportsState extends State { child: const Text('Add Prescriptions'), ), ), + Container( width: double.infinity, height: MediaQuery.of(context).size.height * .06, @@ -1250,7 +1177,7 @@ class _AddReportsState extends State { onPrimary: Colors.black, // foreground ), onPressed: () async { - if (problemController.text != '' && + if (doctorNameVariable!=''&&problemController.text != '' && dateInput.text != '' && prescriptionFor != ''&&problemCategory!='') { String _name = ''; diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart index ae93cc0..4e41b5e 100644 --- a/lib/common/dashboard.dart +++ b/lib/common/dashboard.dart @@ -12,6 +12,7 @@ import 'package:healthcare_user/my_connections/all_connections.dart'; import 'package:healthcare_user/my_connections/dynamic_code_doctor.dart'; import 'package:healthcare_user/my_health.dart'; import 'package:healthcare_user/my_medicine_timings.dart'; +import 'package:healthcare_user/orders/quotations.dart'; import 'package:healthcare_user/prescriptions/prescriptions.dart'; import 'package:healthcare_user/report_problem/report_my_self.dart'; import 'package:healthcare_user/Reports/add_reports.dart'; @@ -1011,6 +1012,35 @@ class _DashboardState extends State { Divider( color: Colors.grey, ), + ListTile( + title: Row( + children: [ + Image( + image: const AssetImage('images/updatemylocation.png'), + height: 25, + width: 25, + fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + const SizedBox( + width: 10, + ), + Text('Quotations', + style: drawerListItemsTextStyle()), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AllQuotations()), + ); + }, + ), + Divider( + color: Colors.grey, + ), ListTile( title: Row( children: [ diff --git a/lib/common/otpscreen.dart b/lib/common/otpscreen.dart index 0cebcb1..66cd81d 100644 --- a/lib/common/otpscreen.dart +++ b/lib/common/otpscreen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:healthcare_user/common/dashboard.dart'; import 'package:healthcare_user/common/login.dart'; import 'package:healthcare_user/common/settings.dart'; class OtpScreen extends StatefulWidget { @@ -179,7 +180,7 @@ class _OtpScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => const Login()), + builder: (context) => const Dashboard()), ); } else{ diff --git a/lib/common/settings.dart b/lib/common/settings.dart index 71c8439..bf5cbf6 100644 --- a/lib/common/settings.dart +++ b/lib/common/settings.dart @@ -171,15 +171,15 @@ TextStyle drawerHeaderTextStyle() { TextStyle drawerHeaderTextStyleNew() { return TextStyle(color: Colors.black, fontSize: 15); } + TextStyle radioHeadingTextStyle() { return TextStyle(color: Colors.white); } + TextStyle radioItemsTextStyle() { return TextStyle(color: Colors.white,fontSize: 11); } - - InputDecoration textFormFieldDecoration(IconData icon, var text) { return InputDecoration( filled: true, @@ -223,7 +223,6 @@ InputDecoration textFormFieldDecorationGrey(IconData icon, var text) { ); } - InputDecoration textFormFieldDecorationBMI(IconData icon, var text) { return InputDecoration( //filled: true, @@ -247,6 +246,7 @@ InputDecoration textFormFieldDecorationBMI(IconData icon, var text) { } final GlobalKey preloaderWindowKey = new GlobalKey(); + Future preloaderWindow(BuildContext context) async { try { Dialogs.showLoadingDialog(context, preloaderWindowKey); @@ -338,7 +338,6 @@ class AppSettings { static String updateRecordsUrl = host + 'records'; static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo'; static String uploadReportMyselfPictureUrl = host + 'reportProblemPicture'; - //static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription'; static String getAllPrescriptionsDataUrl = host + 'getAllPrescriptionDetails'; static String getRecordsDataUrl = host + 'getAllRecords'; @@ -354,8 +353,13 @@ class AppSettings { static String getAllReportProblemDetalisUrl = host + 'userreport'; static String deleteReportMySelfProblemUrl = host + 'deleteReportProblem'; static String getAllConnectedDoctorsDataUrl = host + 'connected-doctors'; + static String getAllQuotationsDataUrl = host + 'getquotationsofUser'; + static String getAllCartItemsUrl = host + 'getcartofParticularPharmacyAndUser'; + static String getAllOffersUnderPharmacyDataUrl = host + 'getActivePharmacyOfferdata'; static String addDoctorUrl = host + 'user/connect-doctors'; static String getDynamicCodeDataUrl = host + 'getDoctorInfo'; + static String orderNowUrl = host + 'OrderNow'; + static File? updatedImage; @@ -554,8 +558,23 @@ class AppSettings { body: json.encode(payload), headers: {'Content-type': 'application/json'}); if (response.statusCode == 200) { - return true; - } else { + try { + var _response = json.decode(response.body); + print(_response['simplydata']['error']); + + if (_response['simplydata']['error'] == false) { + await saveAvailableReportAndLocationsInMemory(_response); + //await saveProfilePic(_response); + return true; + } else { + return false; + } + } catch (e) { + // display error toast + return false; + } + } + else { return false; } } @@ -1005,6 +1024,7 @@ class AppSettings { var response = await http.Response.fromStream(res); return response.body; } + static Future uploadBloodGroupImage(file) async { var request = http.MultipartRequest( 'POST', Uri.parse(uploadBloodGroupPicUrl + '/' + customerId)); @@ -1235,13 +1255,6 @@ class AppSettings { /*End*/ - - - - - - - static Future uploadImageForReports(file) async { var request = http.MultipartRequest( @@ -1256,7 +1269,6 @@ class AppSettings { return response.body; } - static Future uploadImageForFindingsCamera(file) async { var request = http.MultipartRequest( @@ -1267,7 +1279,6 @@ class AppSettings { return response.body; } - static Future uploadVideoInReportMySelf(file) async { var request = http.MultipartRequest( 'POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId)); @@ -1277,7 +1288,6 @@ class AppSettings { return response.body; } - static Future uploadReportMyselfPicture(file) async { var request = http.MultipartRequest('POST', Uri.parse(uploadReportMyselfPictureUrl + '/' + customerId)); @@ -1472,7 +1482,6 @@ class AppSettings { } } - static Future addRecords(payload) async { var uri = Uri.parse(addRecordsUrl + '/' + customerId); var response = await http.post(uri, @@ -1561,7 +1570,6 @@ class AppSettings { } } - static Future getAllRecords() async { var uri = Uri.parse(getRecordsDataUrl + '/' + customerId); //uri = uri.replace(query: 'customerId=$customerId'); @@ -1586,7 +1594,6 @@ class AppSettings { } } - static Future deleteRecord(recordId) async { var uri = Uri.parse(deleteRecordUrl + '/' + recordId); @@ -1616,7 +1623,6 @@ class AppSettings { } } - static Future deleteFindings(fileName,findingsId) async { var uri = Uri.parse(deleteFindingsUrl + '/' + customerId+'/'+findingsId+'/'+fileName); @@ -1878,7 +1884,6 @@ class AppSettings { } } - static Future addReportMySelfProblem(payload) async { var uri = Uri.parse(addReportMySelfProblemUrl + '/' + customerId); var response = await http.post(uri, @@ -1988,6 +1993,78 @@ class AppSettings { } } + static Future getAllQuotations() async { + var uri = Uri.parse(getAllQuotationsDataUrl + '/' + 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 getAllCartItems(bookingId,payload) async { + var uri = Uri.parse(getAllCartItemsUrl + '/' +bookingId ); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.put(uri,body: json.encode(payload), 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.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getAllOffersUnderPharmacy(pharmacyId) async { + var uri = Uri.parse(getAllOffersUnderPharmacyDataUrl + '/' + pharmacyId); + //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 addDoctor(payload) async { var uri = Uri.parse(addDoctorUrl + '/' + customerId); var response = await http.post(uri, @@ -2044,6 +2121,37 @@ class AppSettings { } } + static Future orderNow(payload,bookinId) async { + var uri = Uri.parse(orderNowUrl + '/' + bookinId+ '/' + customerId); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 201) { + 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.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } /*Apis ends here*/ @@ -2055,7 +2163,7 @@ class AppSettings { await saveData( 'access_token', input['simplydata']['access_token'], 'STRING'); await saveData('phone', input['simplydata']['phone'], 'STRING'); - await saveData('email', input['simplydata']['email'][0]['email'], 'STRING'); + await saveData('email', input['simplydata']['email'][0]['email']??'', 'STRING'); await saveData('customerId', input['simplydata']['customerId'], 'STRING'); await saveData('profile', input['simplydata']['picture'], 'STRING'); await saveData('user_address', input['simplydata']['address1'], 'STRING'); @@ -2134,7 +2242,6 @@ class AppSettings { } } - static void longSuccessToast(String message) { Fluttertoast.showToast( msg: message, @@ -2273,4 +2380,5 @@ class AppSettings { });*/ }); } + } diff --git a/lib/common/splash_screen.dart b/lib/common/splash_screen.dart index 6165004..a8f4984 100644 --- a/lib/common/splash_screen.dart +++ b/lib/common/splash_screen.dart @@ -19,7 +19,7 @@ void main() async{ Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, - title: 'Water Management', + title: 'Health Care', theme: new ThemeData( primarySwatch: Colors.blue, ), diff --git a/lib/models/cart_items_model.dart b/lib/models/cart_items_model.dart new file mode 100644 index 0000000..b7d92f1 --- /dev/null +++ b/lib/models/cart_items_model.dart @@ -0,0 +1,35 @@ + + +class CartItemsModel { + String medicine_name=''; + String quantity=''; + String price=''; + List items=[]; + + + + + + CartItemsModel(); + + factory CartItemsModel.fromJson(Map json){ + CartItemsModel rtvm = new CartItemsModel(); + + //rtvm.items=json['items']??[]; + rtvm.medicine_name = json['medicinename']?? ''; + rtvm.quantity =json['quantity'].toString()?? ''; + rtvm.price = json['price'].toString()?? ''; + + + + + + + + + + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/models/get_all_offers_model.dart b/lib/models/get_all_offers_model.dart new file mode 100644 index 0000000..2f59b31 --- /dev/null +++ b/lib/models/get_all_offers_model.dart @@ -0,0 +1,32 @@ + +import 'package:flutter/material.dart'; +class GetAllOffersModel { + String description=''; + String name=''; + String code=''; + String category=''; + String startDate=''; + String endDate=''; + String picture=''; + String pharmacy_id=''; + bool isChecked=false; + + + + + GetAllOffersModel(); + + factory GetAllOffersModel.fromJson(Map json){ + GetAllOffersModel rtvm = new GetAllOffersModel(); + rtvm.description = json['description'] ?? ''; + rtvm.name = json['offer_name'] ?? ''; + rtvm.code = json['offer_code'] ?? ''; + rtvm.category = json['category'] ?? ''; + rtvm.startDate = json['starting_date'] ?? ''; + rtvm.endDate = json['ending_date'] ?? ''; + rtvm.picture = json['picture'][0]['url'] ?? ''; + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/models/get_all_quotations.dart b/lib/models/get_all_quotations.dart new file mode 100644 index 0000000..f68c03d --- /dev/null +++ b/lib/models/get_all_quotations.dart @@ -0,0 +1,38 @@ + + +class GetAllQuotationsModel { + String bookingId=''; + String pharmacyId=''; + String pharmacyName=''; + String pharmacyContactNumber=''; + String pharmacy_address=''; + List prescriptionImages=[]; + + + + + + GetAllQuotationsModel(); + + factory GetAllQuotationsModel.fromJson(Map json){ + GetAllQuotationsModel rtvm = new GetAllQuotationsModel(); + rtvm.bookingId = json['bookingId'] ?? ''; + rtvm.pharmacyId = json['pharmacyId'] ?? ''; + if(json['pharmacyInfo']!=null){ + rtvm.pharmacyName = json['pharmacyInfo']['pharmacyname'] ?? ''; + rtvm.pharmacyContactNumber = json['pharmacyInfo']['profile']['contactNumber'] ?? ''; + rtvm.pharmacy_address = json['pharmacyInfo']['profile']['pharmacy_address'] ?? ''; + } + else{ + rtvm.pharmacyName = ''; + rtvm.pharmacyContactNumber = ''; + rtvm.pharmacy_address =''; + } + + + + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/models/get_offer_details_model.dart b/lib/models/get_offer_details_model.dart new file mode 100644 index 0000000..747ca5e --- /dev/null +++ b/lib/models/get_offer_details_model.dart @@ -0,0 +1,79 @@ +import 'dart:convert'; + +List listdadFromJson(String str) => List.from(json.decode(str).map((x) => GetOffersDetailsModel .fromJson(x))); + +String listdadToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class GetOffersDetailsModel { + String ? description; + String ? starting_date; + String ? ending_date; + String ? offer_code; + List picture; + String ? offer_name; + String ? category; + String ? pharmacyId; + String request_status=''; + + + GetOffersDetailsModel ({ + required this.description, + required this.starting_date, + required this.ending_date, + required this.offer_code, + required this.picture, + required this.offer_name , + required this.category , + required this.pharmacyId , + required this.request_status , + }); + + factory GetOffersDetailsModel .fromJson(Map json) => GetOffersDetailsModel ( + description: json["description"], + starting_date: json["starting_date"], + ending_date: json["ending_date"], + offer_code: json["offer_code"], + category: json["category"], + + picture: List.from(json["picture"].map((x) => Picture.fromJson(x))), + offer_name : json["offer_name"], + pharmacyId : json["pharmacyId"], + request_status : json["request_status"], + + ); + + Map toJson() => { + "description": description, + "starting_date": starting_date, + "ending_date": ending_date, + "offer_code": offer_code, + "picture": List.from(picture.map((x) => x.toJson())), + "offer_name": offer_name, + "category": category, + "pharmacyId": pharmacyId, + "request_status": request_status, + + + + }; +} + +class Picture { + String id; + String url; + + Picture({ + required this.id, + required this.url, + }); + + factory Picture.fromJson(Map json) => Picture( + id: json["_id"], + url: json["url"], + ); + + Map toJson() => { + "_id": id, + "url": url, + }; +} \ No newline at end of file diff --git a/lib/my_connections/add-doctor.dart b/lib/my_connections/add-doctor.dart index b70a80e..ede3304 100644 --- a/lib/my_connections/add-doctor.dart +++ b/lib/my_connections/add-doctor.dart @@ -132,6 +132,7 @@ class _AddDoctorState extends State { child: TextFormField( cursorColor: greyColor, controller: nameController, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.person, @@ -252,6 +253,7 @@ class _AddDoctorState extends State { child: TextFormField( cursorColor: greyColor, controller: qualificationController, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.quickreply, @@ -277,6 +279,7 @@ class _AddDoctorState extends State { child: TextFormField( cursorColor: greyColor, controller: specializationController, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.folder_special, @@ -319,6 +322,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: hospitalNameController1, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.location_city, @@ -342,6 +346,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: practiceAddressController1, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.location_on, @@ -397,6 +402,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: hospitalNameController2, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.location_city, @@ -420,6 +426,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: practiceAddressController2, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.location_on, @@ -475,6 +482,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: hospitalNameController3, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.location_city, @@ -498,6 +506,7 @@ class _AddDoctorState extends State { TextFormField( cursorColor: greyColor, controller: practiceAddressController3, + textCapitalization: TextCapitalization.words, onChanged:(val) { }, diff --git a/lib/my_connections/all_connections.dart b/lib/my_connections/all_connections.dart index 5d75f1d..f31309c 100644 --- a/lib/my_connections/all_connections.dart +++ b/lib/my_connections/all_connections.dart @@ -74,107 +74,86 @@ class _AllConnectionsState extends State //color: prescriptionsList[index].cardColor, child: Padding( - padding:EdgeInsets.all(8) , - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + padding:EdgeInsets.all(10) , + child: Row( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + 'Doctor Name', + style: labelTextStyle(), + ), - Container( - - - child: Row( - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Doctor Name', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - 'Hospital', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - 'Specialization', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - 'Qualification', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - - ], - ), - SizedBox(width:MediaQuery.of(context).size.width * .01,), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - ':', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - ':', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - ':', - style: labelTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - ':', - style: labelTextStyle(), - ), - - ], - ), - SizedBox(width:MediaQuery.of(context).size.width * .01,), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(connectedDoctorsListOriginal[index].doctor_name.toString().toUpperCase(),style: valuesTextStyle()), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - connectedDoctorsListOriginal[index].hospital_name, - style: valuesTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - connectedDoctorsListOriginal[index].specialization, - style: valuesTextStyle(), - ), - SizedBox(height:MediaQuery.of(context).size.height * .01,), - Text( - connectedDoctorsListOriginal[index].qualification, - style: valuesTextStyle(), - ), - ], - ), - ], - ), - - - + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Specialization', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Qualification', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Hospital', + style: labelTextStyle(), + ), + ], + ), + SizedBox(width:MediaQuery.of(context).size.width * .01,), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + ':', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), ), ], + ), + SizedBox(width:MediaQuery.of(context).size.width * .01,), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(connectedDoctorsListOriginal[index].doctor_name.toString().toUpperCase(),style: valuesTextStyle()), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + connectedDoctorsListOriginal[index].specialization, + style: valuesTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + connectedDoctorsListOriginal[index].qualification, + style: valuesTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + connectedDoctorsListOriginal[index].hospital_name, + style: valuesTextStyle(), + ), + ], ), ], ), diff --git a/lib/orders/cart-items.dart b/lib/orders/cart-items.dart new file mode 100644 index 0000000..c580f66 --- /dev/null +++ b/lib/orders/cart-items.dart @@ -0,0 +1,345 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:healthcare_user/common/settings.dart'; +import 'package:healthcare_user/common/zoom_image.dart'; +import 'package:healthcare_user/models/cart_items_model.dart'; +import 'package:healthcare_user/models/get_all_offers_model.dart'; +import 'package:healthcare_user/models/get_connected_doctors_model.dart'; +import 'package:healthcare_user/models/get_offer_details_model.dart'; +import 'package:healthcare_user/my_connections/add-doctor.dart'; +import 'package:healthcare_user/orders/cart-items.dart'; + +import '../models/get_all_quotations.dart'; + +class CartItems extends StatefulWidget { + var myObject; + CartItems({this.myObject}); + + @override + State createState() => _CartItemsState(); +} + +class _CartItemsState extends State + with TickerProviderStateMixin { + late TabController _controller; + bool isDataLoading = false; + bool isOffersLoading = false; + bool isSereverIssue = false; + String bookingId=''; + String totalCartPrice=''; + String totalCartPriceAfterDiscount=''; + + final List topTabs = [ + Tab( + child: Text( + 'Pending', + style: TextStyle(fontSize: 14), + )), + Tab( + child: Text( + 'Completed', + style: TextStyle(fontSize: 14), + )), + ]; + List cartItemsList = []; + + @override + void initState() { + _controller = TabController(vsync: this, length: topTabs.length); + getAllCartItems(); + super.initState(); + } + + Future getAllCartItems() async { + isDataLoading = true; + try { + var payload = new Map(); + payload["pharmacyId"] = widget.myObject.pharmacyId; + payload["customerId"] =AppSettings.customerId; + var response = await AppSettings.getAllCartItems(widget.myObject.bookingId,payload); + + setState(() { + cartItemsList = + ((jsonDecode(response)['data'][0]['items']) as List).map((dynamic model) { + return CartItemsModel.fromJson(model); + }).toList(); + cartItemsList = cartItemsList.reversed.toList(); + bookingId=jsonDecode(response)['data'][0]['bookingId']; + totalCartPrice=jsonDecode(response)['data'][0]['totalCartPrice'].toString(); + totalCartPriceAfterDiscount=jsonDecode(response)['data'][0]['totalCartPriceAfterDiscount'].toString(); + isDataLoading = false; + }); + } catch (e) { + setState(() { + isDataLoading = false; + isSereverIssue = true; + }); + } + } + + Widget _cartItems() { + if (cartItemsList.length != 0) { + return Column( + children: [ + Expanded(child: ListView.builder( + padding: EdgeInsets.all(0), + itemCount: cartItemsList.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () async{ + + }, + child: Card( + //color: prescriptionsList[index].cardColor, + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Medicine Name', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + 'Quantity', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + 'Price', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + cartItemsList[index] + .medicine_name + .toString() + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + cartItemsList[index].quantity, + style: valuesTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + cartItemsList[index] + .price + , + style: valuesTextStyle(), + ), + ], + ), + ], + ), + ], + )), + ), + ); + })), + Container( + width:double.infinity, + height: MediaQuery.of(context).size.height * .06, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: buttonColors, // background + onPrimary: Colors.black, // foreground + ), + onPressed: () async { + + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Total cart price: $totalCartPrice'), + Text('Total cart price after discount: $totalCartPriceAfterDiscount'), + ], + ), + )), + SizedBox(height:MediaQuery.of(context).size.height * .02,), + Container( + width:double.infinity, + height: MediaQuery.of(context).size.height * .06, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: buttonColors, // background + onPrimary: Colors.black, // foreground + ), + onPressed: () async { + AppSettings.preLoaderDialog(context); + bool isOnline = await AppSettings.internetConnectivity(); + if(isOnline){ + var payload = new Map(); + + payload["user"] = {"profile": {"firstName": AppSettings.userName.toString(), + "lastName": '', + "contactNumber": AppSettings.phoneNumber.toString(), + "address1": AppSettings.userAddress.toString(), + "address2": AppSettings.detailedAddress.toString(), + "country": '' + },}; + payload["pharmacies"] = [ + { + "pharmacyId": widget.myObject.pharmacyId.toString(), + "pharmacyname": widget.myObject.pharmacyName.toString(), + "phone":widget.myObject.pharmacyContactNumber.toString(), + "profile": "?" + } + ]; + payload["prescriptionPicture"] = + { + "pictureUrl": [ + "string" + ] + }; + payload["amount"] = + { + "biddingAmount": totalCartPriceAfterDiscount!='null'?int.parse(totalCartPriceAfterDiscount):0, + "totalAmount": totalCartPrice!='null'?int.parse(totalCartPrice):0, + "discountAmount":0, + }; + + bool orderStatus = await AppSettings.orderNow(payload,widget.myObject.bookingId); + + try { + if(orderStatus){ + Navigator.of(context, rootNavigator: true).pop(); + AppSettings.longSuccessToast("order placed successfully"); + + + } + else{ + Navigator.of(context, rootNavigator: true).pop(); + AppSettings.longFailedToast("failed to order"); + } + } catch (exception) { + print(exception); + Navigator.of(context, rootNavigator: true).pop(); + AppSettings.longFailedToast("failed to order"); + } + + } + else{ + Navigator.of(context,rootNavigator: true).pop(); + AppSettings.longFailedToast( + "Please check your internet"); + } + }, + child: Text('Order now'), + )), + ], + ); + } 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 Cart items found'), + SizedBox( + height: 20, + ), + CircleAvatar( + backgroundColor: primaryColor, + radius: 40, + child: IconButton( + iconSize: 40, + icon: const Icon( + Icons.info, + color: Colors.white, + ), + onPressed: () async {}, + ), + ) + ], + ), + )); + } + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Cart Items'), + backgroundColor: primaryColor, + ), + body: Container( + child: Padding( + padding: EdgeInsets.all(10), + child: isDataLoading + ? Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ) + : _cartItems(), + ), + ), + ); + } +} diff --git a/lib/orders/quotations.dart b/lib/orders/quotations.dart new file mode 100644 index 0000000..bd350b9 --- /dev/null +++ b/lib/orders/quotations.dart @@ -0,0 +1,805 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:healthcare_user/common/settings.dart'; +import 'package:healthcare_user/common/zoom_image.dart'; +import 'package:healthcare_user/models/get_all_offers_model.dart'; +import 'package:healthcare_user/models/get_connected_doctors_model.dart'; +import 'package:healthcare_user/models/get_offer_details_model.dart'; +import 'package:healthcare_user/my_connections/add-doctor.dart'; +import 'package:healthcare_user/orders/cart-items.dart'; + +import '../models/get_all_quotations.dart'; + +class AllQuotations extends StatefulWidget { + const AllQuotations({Key? key}) : super(key: key); + + @override + State createState() => _AllQuotationsState(); +} + +class _AllQuotationsState extends State + with TickerProviderStateMixin { + late TabController _controller; + bool isDataLoading = false; + bool isOffersLoading = false; + bool isSereverIssue = false; + + final List topTabs = [ + Tab( + child: Text( + 'Pending', + style: TextStyle(fontSize: 14), + )), + Tab( + child: Text( + 'Completed', + style: TextStyle(fontSize: 14), + )), + ]; + List quotationsListOriginal = []; + List offersListOriginal = []; + List offersList = []; + List pharmaciesCheckboxes = []; + List pharmaciesCheckboxesInDialog = []; + List selectedPharmacies = []; + + @override + void initState() { + _controller = TabController(vsync: this, length: topTabs.length); + getAllQuotations(); + super.initState(); + } + + Future getAllQuotations() async { + isDataLoading = true; + try { + var response = await AppSettings.getAllQuotations(); + + setState(() { + quotationsListOriginal = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return GetAllQuotationsModel.fromJson(model); + }).toList(); + quotationsListOriginal = quotationsListOriginal.reversed.toList(); + isDataLoading = false; + }); + } catch (e) { + setState(() { + isDataLoading = false; + isSereverIssue = true; + }); + } + } + + Future getAllOffers(pharmacyId) async { + isOffersLoading = true; + try { + var response = await AppSettings.getAllOffersUnderPharmacy(pharmacyId); + + setState(() { + offersListOriginal = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return GetAllOffersModel.fromJson(model); + }).toList(); + offersListOriginal = offersListOriginal.reversed.toList(); + isOffersLoading = false; + }); + } catch (e) { + setState(() { + isOffersLoading = false; + isSereverIssue = true; + }); + } + } + + Widget _pendingQuotations() { + if (quotationsListOriginal.length != 0) { + return ListView.builder( + padding: EdgeInsets.all(0), + itemCount: quotationsListOriginal.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () async{ + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartItems(myObject: quotationsListOriginal[index],)), + ); + }, + child: Card( + //color: prescriptionsList[index].cardColor, + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Booking Id', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + 'Pharmacy Name', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + 'Pharmacy ContactNumber', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + quotationsListOriginal[index] + .bookingId + .toString() + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + quotationsListOriginal[index].pharmacyName, + style: valuesTextStyle(), + ), + SizedBox( + height: + MediaQuery.of(context).size.height * .01, + ), + Text( + quotationsListOriginal[index] + .pharmacyContactNumber, + style: valuesTextStyle(), + ), + ], + ), + ], + ), + /*ElevatedButton( + style: ElevatedButton.styleFrom( + primary: buttonColors, // background + onPrimary: Colors.black, // foreground + ), + onPressed: () async { + await getAllOffers(quotationsListOriginal[index] + .pharmacyId + .toString()); + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return SizedBox( + child: isOffersLoading + ? Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ) + : _offersData(), + ); + }); + }, + child: Text('Check Offers'), + ),*/ + ], + )), + ), + ); + }); + } 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 pending quotations'), + SizedBox( + height: 20, + ), + CircleAvatar( + backgroundColor: primaryColor, + radius: 40, + child: IconButton( + iconSize: 40, + icon: const Icon( + Icons.info, + color: Colors.white, + ), + onPressed: () async {}, + ), + ) + ], + ), + )); + } + } + + Widget _offers() { + if (offersListOriginal.length != 0) { + return ListView.builder( + padding: EdgeInsets.all(10), + itemCount: offersListOriginal.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () {}, + child: Card( + //color: prescriptionsList[index].cardColor, + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Booking Id', + style: labelTextStyle(), + ), +/* + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Specialization', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Qualification', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + 'Hospital', + style: labelTextStyle(), + ),*/ + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + ':', + style: labelTextStyle(), + ), + /* SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + ':', + style: labelTextStyle(), + ),*/ + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * .01, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + offersListOriginal[index] + .description + .toString() + .toUpperCase(), + style: valuesTextStyle()), + + /* SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + quotationsListOriginal[index].specialization, + style: valuesTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + quotationsListOriginal[index].qualification, + style: valuesTextStyle(), + ), + SizedBox(height:MediaQuery.of(context).size.height * .01,), + Text( + quotationsListOriginal[index].hospital_name, + style: valuesTextStyle(), + ),*/ + ], + ), + ], + ), + ], + )), + ), + ); + }); + } 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 pending quotations'), + SizedBox( + height: 20, + ), + CircleAvatar( + backgroundColor: primaryColor, + radius: 40, + child: IconButton( + iconSize: 40, + icon: const Icon( + Icons.info, + color: Colors.white, + ), + onPressed: () async {}, + ), + ) + ], + ), + )); + } + } + + Widget _offersData() { + if (offersListOriginal.length != 0) { + return Container( + color: Colors.white60, + child: Column(crossAxisAlignment: CrossAxisAlignment.end, children: [ + Expanded( + child: GridView.builder( + itemCount: offersListOriginal.length, + itemBuilder: (context, index) { + return Card( + color: Colors.white, + elevation: 3.0, + child: CheckboxListTile( + title: Padding( + padding: EdgeInsets.fromLTRB(0, 10, 0, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => + new ImageZoomPage( + imageName: 'Reports', + imageDetails: + offersListOriginal[ + index] + .picture))); + }, + child: Container( + width: MediaQuery.of(context).size.width * + .18, + height: + MediaQuery.of(context).size.height * + .10, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + image: DecorationImage( + image: offersListOriginal[index] + .picture == + '' + ? AssetImage( + "images/logo.png") + : NetworkImage( + offersListOriginal[ + index] + .picture) + as ImageProvider, // picked file + fit: BoxFit.contain)), + ), + ), + ), + ], + ), + SizedBox( + width: 5, + ), + Expanded( + child: Container( + //width: MediaQuery.of(context).size.width * .70, + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Name', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + 'Code', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + 'Description', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + 'Category', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + 'Start Date', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + 'End Date', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * + .01, + ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + ':', + style: labelTextStyle(), + ), + ], + ), + SizedBox( + width: MediaQuery.of(context).size.width * + .01, + ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + offersListOriginal[index] + .name + .toString() + .toUpperCase(), + style: valuesTextStyle()), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + offersListOriginal[index].code, + style: valuesTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + offersListOriginal[index].description, + style: valuesTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + offersListOriginal[index].category, + style: valuesTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + offersListOriginal[index].startDate, + style: valuesTextStyle(), + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + .01, + ), + Text( + offersListOriginal[index].endDate, + style: valuesTextStyle(), + ), + ], + ), + ], + ), + ), + ), + ], + )), + checkColor: Colors.white, + activeColor: primaryColor, + value: offersListOriginal[index].isChecked, + onChanged: (val) { + setState( + () { + offersListOriginal[index].isChecked = val!; + }, + ); + /*if (offersListOriginal[index].isChecked) { + pharmaciesCheckboxes.add({ + 'pharmacyId': offersListOriginal[index].pharmacy_id, + }); + selectedPharmacies.add(offersListOriginal[index]); + } else { + pharmaciesCheckboxes.removeWhere((e) => + e['pharmacyId'].toString().toUpperCase() == + offersListOriginal[index] + .pharmacy_id + .toString() + .toUpperCase()); + selectedPharmacies.remove(offersListOriginal[index]); + }*/ + }, + ), + ); + }, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 1, //.size.width * .33, + childAspectRatio: MediaQuery.of(context).size.width / + (MediaQuery.of(context).size.height / 5)), + ), + ), + ]), + ); + } else { + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: isSereverIssue + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image( + image: AssetImage('images/serverissue.png'), + // height: MediaQuery.of(context).size.height * .10, + ), + SizedBox( + height: 20, + ), + Text( + 'There is an issue at server please try after some time', + style: serverIssueTextStyle(), + ), + ], + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + /*Image( + image: AssetImage('images/resourceblue.pngs'), + // height: MediaQuery.of(context).size.height * .10, + ),*/ + Icon( + Icons.info, + color: primaryColor, + size: 40, + ), + SizedBox( + height: 20, + ), + Text( + 'No offers available', + style: TextStyle( + color: primaryColor, + fontWeight: FontWeight.bold, + ), + ), + ], + ))); + } + } + + Widget _pharmacies() { + return Container(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('All Quotations'), + backgroundColor: primaryColor, + bottom: TabBar( + controller: _controller, + tabs: topTabs, + indicatorColor: buttonColors, + unselectedLabelColor: Colors.white60, + indicatorWeight: 2, + ), + ), + body: Container( + child: TabBarView(controller: _controller, children: [ + Padding( + padding: EdgeInsets.all(10), + child: isDataLoading + ? Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ) + : _pendingQuotations(), + ), + Padding( + padding: EdgeInsets.all(10), + ) + ]), + ), + ); + } +} diff --git a/lib/report_problem/report_my_self.dart b/lib/report_problem/report_my_self.dart index 645174a..422863c 100644 --- a/lib/report_problem/report_my_self.dart +++ b/lib/report_problem/report_my_self.dart @@ -42,6 +42,8 @@ class _ReportMySelfState extends State { String recordingTime = '0:0'; // to store value bool isRecording = false; String problemPictureUrl=''; + DateTime now=DateTime.now(); + String formattedDate = ''; void initializer() async { pathToAudio = '/sdcard/Download/temp.wav'; @@ -58,9 +60,17 @@ class _ReportMySelfState extends State { await Permission.manageExternalStorage.request(); } + void initialDate(){ + setState(() { + formattedDate=DateFormat('dd-MM-yyyy').format(now); + }); + } + @override void initState() { super.initState(); + initialDate(); + dateInput.text=formattedDate; _controller = VideoPlayerController.networkUrl( Uri.parse(videoUrl,), ); @@ -287,7 +297,7 @@ class _ReportMySelfState extends State { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: primaryColor), ), - labelText: 'Enter problem name', + labelText: 'Enter problem (if any)', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), @@ -769,7 +779,7 @@ class _ReportMySelfState extends State { }, - child: const Text('Report a problem'), + child: const Text('Save this in report my self'), )), diff --git a/lib/updates/update_location.dart b/lib/updates/update_location.dart index c8e7cee..95e8259 100644 --- a/lib/updates/update_location.dart +++ b/lib/updates/update_location.dart @@ -195,7 +195,7 @@ class _UpdateMyLocationState extends State { cursorColor: greyColor, controller: userAddressDescriptionController, keyboardType: TextInputType.emailAddress, - decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'), + decoration: textFormFieldDecorationGrey(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'), ), ),