From f95edc43653984b91f710d7d466053b28ec276ca Mon Sep 17 00:00:00 2001 From: suresh Date: Fri, 8 Sep 2023 16:47:41 +0530 Subject: [PATCH] Offerimage,companyoffers,getpharmacies updated --- images/activeoffer.png | Bin 6004 -> 8261 bytes lib/companyoffrers.dart | 466 +++++++++++++++++ lib/{offers.dart => createoffers.dart} | 158 ++++-- lib/dashboard.dart | 40 +- lib/getallpharmacies.dart | 271 ++++++++++ lib/getmedicines.dart | 4 - lib/inactiveoffersview.dart | 2 +- lib/login.dart | 2 +- lib/medicinecart.dart | 7 +- lib/models/companyoffer_model.dart | 27 + lib/offerstabdata.dart | 685 +++++++++++++++---------- lib/offersview.dart | 2 +- lib/otpscreen.dart | 78 +-- lib/settings.dart | 128 ++++- lib/signup.dart | 6 +- 15 files changed, 1485 insertions(+), 391 deletions(-) create mode 100644 lib/companyoffrers.dart rename lib/{offers.dart => createoffers.dart} (75%) create mode 100644 lib/getallpharmacies.dart create mode 100644 lib/models/companyoffer_model.dart diff --git a/images/activeoffer.png b/images/activeoffer.png index f4181c232ad51e05b94bf3d1ebf652691278eb07..358605cbb75fade409e6ba67e64bf4ab5f9889ff 100644 GIT binary patch literal 8261 zcmcgy^-~R#3SGTk%%=DqHIpZ@ejX{gEL<51!tAtB)_D#&OdAt3|)b75g1?s(z6BSAu< z!&8)zf_fnzull;B|IJ`MJH0qG6C3Xf3v#5_l%~_*j87Csd-J;XSVfHQ2(Xk>a3n%i zD<+Ofw990_7yC4^Te&K-%okSckUhPsy6`Eu;WLI(5g0R)4?@?gmJ1$kuSaSAkp#dT z5Heh|&fH7hiD4f~cvSLX_Lrol8K{9R_;mVYu3xlGpaNd~zYa}3qU`9ajs7bdtzphj zN}c!0LdB9EV3di}h~~ZX&|o@hrt6PmVgoN0c? zz&5T)R2O0lh4ALUymjjz{Sx~yFf5vgsTpH{SjutGewhLbFNC@Wz4VPxeH|#b!;Q`} zfWGhB^_0s|@O@EAVVr4$!v|=NoJX2>S?uMpmy)TVID#hjP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jd6 z9_2(2Bw>J?-r2!0@gUeYa-Gn8#2&(cSKKV{pb=n2XpbvqX{t$*XvpXb%?K~b zNz|=;%6ZEn-~0KQs!K9<%lZ3XeA!VOI0gZNshqUatjsN_)66Qy!UJ#hj9A_0Gfa&N z;u=DLm#n}1UeK(I6*hDZPgZ%5dkUz2SR58MNMH3+8yvRfan#O;#mT1^#nd+Ub$R*W zrq1Jji`n6X4qn!yis$^tCxrt_XIMz0wDAy~V*hlhUMJ<@CYS1r0dvYv;1S1}a(;c$ z%I6X%$p+5{?s}~Hp;c6I4D45p)$C*-YE&djf}1|9m;mshj^$NaWz(7w5=%09~amAwS&S1u>*2ji1T~ zhePwwQcH!-*mmc?)We&TpP(cI3 NAg3ZR<*3t=jKz;~K@5cavcC={qe``AS!yus zF8+G0)mI|ixx_p5WKp$9I^x-23^AR!xe?%;z`hBqDepMOI|VzqR5-3u<<;{g+=v;d zQZDitn1A-5^paE7kuRA)S~g!E!8?_?oZ`Hzu<#nGFd;nd%0p*-DZE&NFF%j@KQqby c0fYRn0 createState() => _CompanyOffersState(); +} + +class _CompanyOffersState extends State { + + TextEditingController offer_nameController = TextEditingController(); + TextEditingController offer_codeController = TextEditingController(); + TextEditingController descriptionController = TextEditingController(); + TextEditingController eligiblepharma_Controller = TextEditingController(); + TextEditingController starting_dateController = TextEditingController(); + TextEditingController ending_dateController = TextEditingController(); + + var selIOS; + final ImagePicker _picker = ImagePicker(); + String offerUrl=''; + + + + + Future pickImageFromGallery() async { + + try { + final image = await _picker.pickImage(source: ImageSource.gallery); + if (image == null) return; + final imageTemp = File(image.path); + + AppSettings.preLoaderDialog(context); + var res = await AppSettings.offeruploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); + setState(() { + AppSettings.offerPictureUrl = jsonDecode(res)['picture']; + }); + AppSettings.saveData('offer', jsonDecode(res)['picture'], 'STRING'); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + Future takeImageFromCamera() async { + try { + final image = await _picker.pickImage(source: ImageSource.camera); + if (image == null) return; + final imageTemp = File(image.path); + AppSettings.preLoaderDialog(context); + var res = await AppSettings.offeruploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); + setState(() { + //AppSettings.offerPictureUrl = jsonDecode(res)['picture']['url']; + offerUrl=jsonDecode(res)['picture'][0]['url']; + }); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + appBar: AppSettings.appBar('Cteate Offers'), + body: Stack(children: [ + + GestureDetector( + onTap: () { + FocusManager.instance.primaryFocus?.unfocus(); + }, + child: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + + SizedBox( + height: 20, + ), + Container(child: GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .60, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(width: 2, color: Colors.blueGrey), + image: DecorationImage( + image: (offerUrl!= ''&& + offerUrl!= 'null') ? + NetworkImage(offerUrl) as ImageProvider : AssetImage("images/mobilebg.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + child: Icon( + Icons.camera_alt_outlined, + size: 100, + color: primaryColor, + ), + onTap: () async { + await takeImageFromCamera(); + Navigator.pop(context); + }, + ), + SizedBox( + width: + MediaQuery.of(context).size.width * .20, + ), + GestureDetector( + child: Icon( + Icons.photo, + size: 100, + color: primaryColor, + ), + onTap: () async { + await pickImageFromGallery(); + Navigator.pop(context); + }, + ), + ], + ), + ), + ); + }); + }, + ),), + SizedBox( + height: 05, + ), + Container( + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: offer_nameController, + textCapitalization: TextCapitalization.words, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.person, + color: primaryColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + labelText: 'Enter Offer Name', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), + ), //name + SizedBox( + height: 05, + ), + Container( + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: offer_codeController, + textCapitalization: TextCapitalization.words, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.numbers, + color: primaryColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + labelText: 'Enter Offer Code', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), + ), + const SizedBox( + height: 5, + ), + + + + Container( + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: descriptionController, + textCapitalization: TextCapitalization.words, + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.description, + color:primaryColor, + ), + contentPadding: const EdgeInsets.symmetric(vertical:40.0, horizontal:30.0), + border: OutlineInputBorder( + borderSide: BorderSide(color: greyColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: greyColor), + ), + labelText: 'Enter Offer Description', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), + ), + Container( + padding: const EdgeInsets.all(10), + child: TextFormField( + cursorColor: greyColor, + controller: eligiblepharma_Controller, + textCapitalization: TextCapitalization.characters, + decoration: const InputDecoration( + prefixIcon: Icon( + Icons.local_pharmacy, + color: primaryColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + labelText: 'Enter Eligible Pharmacies', + labelStyle: TextStyle( + color: greyColor, //<-- SEE HERE + ), + ), + ), + ), //mobile + const SizedBox( + height: 5, + ), + Container( + padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), + child: TextFormField( + readOnly: true, + cursorColor: greyColor, + controller: starting_dateController, + decoration: InputDecoration( + labelText: 'Select Start Date', + prefixIcon: const Icon(Icons.date_range, color: primaryColor,), + labelStyle: const TextStyle( + color: greyColor, //<-- SEE HERE + ), + border: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor)), + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + suffixIcon: IconButton( + icon: Icon( + Icons.date_range, + ), + onPressed: () async { + DatePicker.showDatePicker( + context, + dateFormat: 'dd MMMM yyyy', + initialDateTime: DateTime.now(), + minDateTime:DateTime.now(), + maxDateTime: DateTime.now().add(Duration(days: 365)), + onMonthChangeStartWithFirstDate: true, + pickerMode: DateTimePickerMode.datetime, + pickerTheme: DateTimePickerTheme( + // backgroundColor: Colors.white, + cancelTextStyle: labelTextStyle(), + confirmTextStyle: labelTextStyle(), + // showTitle: true, + //title: Text('Pick date and time'), + itemTextStyle: valuesTextStyle(), + ), + onConfirm: (dateTime, List index)async { + DateTime selectdate = dateTime; + setState(() { + selIOS = DateFormat('dd-MMM-yyyy').format(selectdate); + }); + + if(selIOS!=''){ + setState(() { + starting_dateController.text=selIOS.toString(); + }); + } + else { + AppSettings.longFailedToast('please select date'); + } + }, + ); + }, + ), + + ), + + ), + ), + + const SizedBox( + height: 5, + ), + Container( + padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), + child: TextFormField( + readOnly: true, + cursorColor: greyColor, + controller: ending_dateController, + decoration: InputDecoration( + labelText: 'Select End Date', + prefixIcon: const Icon(Icons.date_range, color: primaryColor,), + labelStyle: const TextStyle( + color: greyColor, //<-- SEE HERE + ), + border: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor)), + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + suffixIcon: IconButton( + icon: Icon( + Icons.date_range, + ), + onPressed: () async { + DatePicker.showDatePicker( + context, + dateFormat: 'dd MMMM yyyy', + initialDateTime: DateTime.now(), + minDateTime:DateTime.now(), + maxDateTime: DateTime.now().add(Duration(days: 365)), + onMonthChangeStartWithFirstDate: true, + pickerMode: DateTimePickerMode.datetime, + pickerTheme: DateTimePickerTheme( + // backgroundColor: Colors.white, + cancelTextStyle: labelTextStyle(), + confirmTextStyle: labelTextStyle(), + // showTitle: true, + //title: Text('Pick date and time'), + itemTextStyle: valuesTextStyle(), + ), + onConfirm: (dateTime, List index)async { + DateTime selectdate = dateTime; + setState(() { + selIOS = DateFormat('dd-MMM-yyyy').format(selectdate); + }); + + if(selIOS!=''){ + setState(() { + ending_dateController.text=selIOS.toString(); + }); + } + else { + AppSettings.longFailedToast('please select date'); + } + }, + ); + }, + ), + + ), + + ), + ),//address description + + const SizedBox( + height:15, + ), + Container( + width:MediaQuery.of(context).size.width * .99, + height: 55, + padding: const EdgeInsets.fromLTRB(3, 0, 3, 0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: buttonColor, // background + onPrimary: Colors.white, // foreground + ), + onPressed: () async { + if (offer_nameController.text != '' && + offer_codeController.text != '' && + descriptionController.text != ''&& + starting_dateController.text != '' && + ending_dateController.text != '') { + AppSettings.preLoaderDialog(context); + + var payload = new Map(); + payload["offer_name"] = offer_nameController.text.toString(); + payload["offer_code"] = offer_codeController.text.toString(); + payload["description"] = descriptionController.text.toString(); + payload["pharmacies_eligible"] = eligiblepharma_Controller.text.toString(); + payload["starting_date"] = starting_dateController.text.toString(); + payload["ending_date"] = ending_dateController.text.toString(); + payload["offer_status"] ="active"; + bool offerStatus = await AppSettings.createCompanyOffers(payload); + try{ + if (offerStatus) { + Navigator.pop(context); + Navigator.of(context,rootNavigator: true).pop(); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Dashboard()), + ); + AppSettings.longSuccessToast("Company Offer Created Succesfully!!"); + } else { + + AppSettings.longFailedToast("Fields should not be empty !!"); + } + } + catch(exception){ + print(exception); + AppSettings.longFailedToast("Please enter valid details"); + } + } else { + AppSettings.longFailedToast("Company Offer Not Created!!"); + + } + }, + child: Text('Create'), + )),//login button + + ], + ), + )), + ), + ])), ); + } +} diff --git a/lib/offers.dart b/lib/createoffers.dart similarity index 75% rename from lib/offers.dart rename to lib/createoffers.dart index f779edf..9c041d6 100644 --- a/lib/offers.dart +++ b/lib/createoffers.dart @@ -1,9 +1,14 @@ +import 'dart:convert'; +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:healthcare_pharmacy/dashboard.dart'; import 'package:healthcare_pharmacy/settings.dart'; import 'package:intl/intl.dart'; import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; +import 'package:image_picker/image_picker.dart'; + class offers extends StatefulWidget { @@ -18,11 +23,52 @@ class _offersState extends State { TextEditingController offer_nameController = TextEditingController(); TextEditingController offer_codeController = TextEditingController(); TextEditingController descriptionController = TextEditingController(); - TextEditingController offerController = TextEditingController(); TextEditingController starting_dateController = TextEditingController(); TextEditingController ending_dateController = TextEditingController(); var selIOS; + final ImagePicker _picker = ImagePicker(); + String offerUrl=''; + + + + Future pickImageFromGallery() async { + + try { + final image = await _picker.pickImage(source: ImageSource.gallery); + if (image == null) return; + final imageTemp = File(image.path); + + AppSettings.preLoaderDialog(context); + var res = await AppSettings.offeruploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); + setState(() { + AppSettings.offerPictureUrl = jsonDecode(res)['picture']; + }); + AppSettings.saveData('offer', jsonDecode(res)['picture'], 'STRING'); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + Future takeImageFromCamera() async { + try { + final image = await _picker.pickImage(source: ImageSource.camera); + if (image == null) return; + final imageTemp = File(image.path); + AppSettings.preLoaderDialog(context); + var res = await AppSettings.offeruploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); + setState(() { + //AppSettings.offerPictureUrl = jsonDecode(res)['picture']['url']; + offerUrl=jsonDecode(res)['picture'][0]['url']; + }); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } @override Widget build(BuildContext context) { @@ -43,13 +89,62 @@ class _offersState extends State { SizedBox( height: 20, ), - Container( - //width: double.infinity, - child: Image( - image: const AssetImage('images/logo.png'), - height: MediaQuery.of(context).size.height * .18, - )), - + Container(child: GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .60, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(width: 2, color: Colors.blueGrey), + image: DecorationImage( + image: (offerUrl!= ''&& + offerUrl!= 'null') ? + NetworkImage(offerUrl) as ImageProvider : AssetImage("images/mobilebg.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + child: Icon( + Icons.camera_alt_outlined, + size: 100, + color: primaryColor, + ), + onTap: () async { + await takeImageFromCamera(); + Navigator.pop(context); + }, + ), + SizedBox( + width: + MediaQuery.of(context).size.width * .20, + ), + GestureDetector( + child: Icon( + Icons.photo, + size: 100, + color: primaryColor, + ), + onTap: () async { + await pickImageFromGallery(); + Navigator.pop(context); + }, + ), + ], + ), + ), + ); + }); + }, + ),), SizedBox( height: 05, ), @@ -58,7 +153,7 @@ class _offersState extends State { child: TextFormField( cursorColor: greyColor, controller: offer_nameController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.person, @@ -87,7 +182,7 @@ class _offersState extends State { child: TextFormField( cursorColor: greyColor, controller: offer_codeController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.numbers, @@ -111,24 +206,30 @@ class _offersState extends State { const SizedBox( height: 5, ), + + + Container( padding: const EdgeInsets.all(10), child: TextFormField( cursorColor: greyColor, controller: descriptionController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, + keyboardType: TextInputType.multiline, + maxLines: null, decoration: const InputDecoration( prefixIcon: Icon( Icons.description, - color: primaryColor, + color:primaryColor, ), + contentPadding: const EdgeInsets.symmetric(vertical:40.0, horizontal:30.0), border: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor)), + borderSide: BorderSide(color: greyColor)), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor), + borderSide: BorderSide(color: greyColor), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor), + borderSide: BorderSide(color: greyColor), ), labelText: 'Enter Offer Description', labelStyle: TextStyle( @@ -136,23 +237,19 @@ class _offersState extends State { ), ), ), - ), //mobile - - const SizedBox( - height: 5, ), - Container( + /* Container( padding: const EdgeInsets.all(10), child: TextFormField( cursorColor: greyColor, - controller: offerController, - keyboardType: TextInputType.text, + controller: descriptionController, textCapitalization: TextCapitalization.characters, decoration: const InputDecoration( prefixIcon: Icon( - Icons.local_offer, + Icons.description, color: primaryColor, ), + contentPadding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 30.0), border: OutlineInputBorder( borderSide: BorderSide(color: primaryColor)), focusedBorder: OutlineInputBorder( @@ -161,17 +258,16 @@ class _offersState extends State { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: primaryColor), ), - labelText: 'Enter Offer', + labelText: 'Enter Offer Description', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), ), ), - ), + ),*/ //mobile const SizedBox( height: 5, ), - Container( padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), child: TextFormField( @@ -199,7 +295,7 @@ class _offersState extends State { onPressed: () async { DatePicker.showDatePicker( context, - dateFormat: 'dd MMMM yyyy HH:mm', + dateFormat: 'dd MMMM yyyy', initialDateTime: DateTime.now(), minDateTime:DateTime.now(), maxDateTime: DateTime.now().add(Duration(days: 365)), @@ -216,7 +312,7 @@ class _offersState extends State { onConfirm: (dateTime, List index)async { DateTime selectdate = dateTime; setState(() { - selIOS = DateFormat('dd-MMM-yyyy - HH:mm').format(selectdate); + selIOS = DateFormat('dd-MMM-yyyy').format(selectdate); }); if(selIOS!=''){ @@ -267,7 +363,7 @@ class _offersState extends State { onPressed: () async { DatePicker.showDatePicker( context, - dateFormat: 'dd MMMM yyyy HH:mm', + dateFormat: 'dd MMMM yyyy', initialDateTime: DateTime.now(), minDateTime:DateTime.now(), maxDateTime: DateTime.now().add(Duration(days: 365)), @@ -284,7 +380,7 @@ class _offersState extends State { onConfirm: (dateTime, List index)async { DateTime selectdate = dateTime; setState(() { - selIOS = DateFormat('dd-MMM-yyyy - HH:mm').format(selectdate); + selIOS = DateFormat('dd-MMM-yyyy').format(selectdate); }); if(selIOS!=''){ @@ -321,7 +417,6 @@ class _offersState extends State { if (offer_nameController.text != '' && offer_codeController.text != '' && descriptionController.text != ''&& - offerController.text != ''&& starting_dateController.text != '' && ending_dateController.text != '') { AppSettings.preLoaderDialog(context); @@ -330,7 +425,6 @@ class _offersState extends State { payload["offer_name"] = offer_nameController.text.toString(); payload["offer_code"] = offer_codeController.text.toString(); payload["description"] = descriptionController.text.toString();; - payload["offer"] = offerController.text.toString(); payload["starting_date"] = starting_dateController.text.toString(); payload["ending_date"] = ending_dateController.text.toString(); payload["offer_status"] ="active"; diff --git a/lib/dashboard.dart b/lib/dashboard.dart index d245e33..e0e0905 100644 --- a/lib/dashboard.dart +++ b/lib/dashboard.dart @@ -3,10 +3,12 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:healthcare_pharmacy/companyoffrers.dart'; +import 'package:healthcare_pharmacy/getallpharmacies.dart'; import 'package:healthcare_pharmacy/getmedicines.dart'; import 'package:healthcare_pharmacy/inactiveoffersview.dart'; import 'package:healthcare_pharmacy/medicinecart.dart'; -import 'package:healthcare_pharmacy/offers.dart'; +import 'package:healthcare_pharmacy/createoffers.dart'; import 'package:healthcare_pharmacy/offerstabdata.dart'; import 'package:healthcare_pharmacy/offersview.dart'; import 'package:healthcare_pharmacy/biddingrequests.dart'; @@ -644,7 +646,7 @@ class _DashboardState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => MedicineCartList()), + builder: (context) => BiddingRequests()), ); @@ -654,7 +656,7 @@ class _DashboardState extends State { Divider( color: Colors.grey, ), - /* ListTile( + ListTile( title: Row( children: const [ Image( @@ -665,7 +667,7 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Get Medicines', style: TextStyle(color: Colors.black)), + Text('Company Offers', style: TextStyle(color: Colors.black)), ], ), onTap: () { @@ -673,7 +675,7 @@ class _DashboardState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => GetMedicines()), + builder: (context) => CompanyOffers()), ); @@ -682,7 +684,33 @@ class _DashboardState extends State { ), Divider( color: Colors.grey, - ),*/ + ), + ListTile( + title: Row( + children: const [ + Image( + image: const AssetImage('images/inactive.png'), + height: 25, + width: 25, + fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + Text('GetAllPharmacies', style: TextStyle(color: Colors.black)), + ], + ), + onTap: () { + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => GetAllPharmacies()), + ); + }, + ), + Divider( + color: Colors.grey, + ), ListTile( title: Row( children: const [ diff --git a/lib/getallpharmacies.dart b/lib/getallpharmacies.dart new file mode 100644 index 0000000..310aac1 --- /dev/null +++ b/lib/getallpharmacies.dart @@ -0,0 +1,271 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:healthcare_pharmacy/getmedicines.dart'; +import 'package:healthcare_pharmacy/maps/app_colors.dart'; +import 'package:healthcare_pharmacy/models/biddingrequest_model.dart'; +import 'package:healthcare_pharmacy/models/companyoffer_model.dart'; +import 'package:healthcare_pharmacy/settings.dart'; + +import 'package:image_picker/image_picker.dart'; +import 'package:photo_view/photo_view.dart'; + +class GetAllPharmacies extends StatefulWidget { + const GetAllPharmacies({Key? key}) : super(key: key); + + @override + State createState() => _GetAllPharmaciesState(); +} + +class _GetAllPharmaciesState extends State { + String Url = ''; + List pharmacyList = []; + List prescriptionsListOriginal = []; + bool isPrescriptionsDataLoading = false; + bool isSereverIssue = false; + bool isLoading=false; + List checked = []; + + + Future getAllPharmacies() async { + isPrescriptionsDataLoading=true; + try { + var response = await AppSettings.getPharmacyData(); + print(response); + setState(() { + pharmacyList = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return GetAllPharmacyModel.fromJson(model); + }).toList(); + isPrescriptionsDataLoading = false; + }); + + + } catch (e) { + setState(() { + isLoading = false; + isPrescriptionsDataLoading = false; + }); + } + } + + @override + void initState() { + getAllPharmacies(); + //getAllPharmaciesData(dropdownArea); + super.initState(); + } + + void _onCheckboxChanged(String id, bool value) { + setState(() { + if (value) { + checked.add(id); + } else { + checked.remove(id); + } + }); + } + + showPicDialog(var imageUrl){ + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return AlertDialog( + title: const Text(''), + content: SingleChildScrollView( + child: ListBody( + children: [ + Container( + width: MediaQuery.of(context).size.width * .10, + height: MediaQuery.of(context).size.height * .50, + child: PhotoView( + imageProvider: NetworkImage(imageUrl) as ImageProvider, + maxScale: PhotoViewComputedScale.contained * 4.0, + minScale: PhotoViewComputedScale.contained, + initialScale: PhotoViewComputedScale.contained, + basePosition: Alignment.center, + + ) + ) + ], + ), + ), + actions: [ + TextButton( + child: Text('Close', style: textButtonStyle()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + }, + ); + } + + + Widget _allPharmacies() { + if (pharmacyList.length != 0) { + return Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: ListView.builder( + padding: EdgeInsets.all(0), + itemCount: pharmacyList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + child: Padding( + padding: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .18, + height: MediaQuery.of(context).size.height * .10, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: (AppSettings.updatedImage != null) + ? FileImage(AppSettings.updatedImage!) + as ImageProvider + : AssetImage("images/mobilebg.png"), // picked file + fit: BoxFit.cover, + ), + ), + ), + onTap: () { + // showPicDialog(prescriptionsList[index].prescription_url); + }, + ), + SizedBox(width: MediaQuery.of(context).size.width * .02,), + Container( + width: MediaQuery.of(context).size.width * .55, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + pharmacyList[index].pharmacyname_offer + .toString() + .toUpperCase(), + style: valuesTextStyle(), + ), + Text( + pharmacyList[index].pharmacyId_offer + .toString() + .toUpperCase(), + style: valuesTextStyle(), + ), + Text( + pharmacyList[index].phone_offer + .toString() + .toUpperCase(), + style: valuesTextStyle(), + ), + Text( + pharmacyList[index].description_offer + .toString() + .toUpperCase(), + style: valuesTextStyle(), + ), + ], + ), + ), + Checkbox( + value: checked.contains( + pharmacyList[index].pharmacyId_offer.toString()), + onChanged: (value) { + _onCheckboxChanged( + pharmacyList[index].pharmacyId_offer.toString(), + value ?? false); + }, + ), + ], + ), + ), + ); + }, + ), + ), + + /* Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child:TextButton( + onPressed: () { + // Add your button click logic here + }, + child: Text( + 'Total Price:$checked.toString()', + style: TextStyle( + fontSize: 20, + color: AppColors.primaryColor, // Text color + decoration: TextDecoration.underline, // Underline the text + fontWeight: FontWeight.bold, // Bold text + ), + ), + ),),*/ + SizedBox( + height: 10, + ), + Container( + width: 400, + height: 50, + padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: primaryColor, // background + onPrimary: Colors.white, // foreground + ), + onPressed: () async{ + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(checked.toString()), + ), + ); + }, + child: Text('Submit'), + )), + ], + ); + } else { + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .25,), + ], + ), + ), + ); + } + } + + + + /**/ + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppSettings.appBar('All Pharmacies'), + body: isPrescriptionsDataLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ): _allPharmacies(), + ); + } +} diff --git a/lib/getmedicines.dart b/lib/getmedicines.dart index f355303..4c260fb 100644 --- a/lib/getmedicines.dart +++ b/lib/getmedicines.dart @@ -36,15 +36,11 @@ class _GetMedicinesState extends State with TickerProviderStateMix String medicine_mrp=''; String medicine_primary_use=''; String medbookingid = ''; - - List medImages=[]; Future getAllMedecineData(var medicineName) async { FilteredList=[]; isMedecineDataLoading = true; - - try { var medecineResponse = await AppSettings.getAllMedecines(medicineName); diff --git a/lib/inactiveoffersview.dart b/lib/inactiveoffersview.dart index babf68f..450d8f4 100644 --- a/lib/inactiveoffersview.dart +++ b/lib/inactiveoffersview.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:healthcare_pharmacy/models/offersview_model.dart'; -import 'package:healthcare_pharmacy/offers.dart'; +import 'package:healthcare_pharmacy/createoffers.dart'; import 'package:healthcare_pharmacy/settings.dart'; import 'package:intl/intl.dart'; import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; diff --git a/lib/login.dart b/lib/login.dart index 2d9f8b4..22a841d 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -122,7 +122,7 @@ class _LoginState extends State { labelText: 'Password', prefixIcon: const Icon(Icons.password, color: greyColor,), labelStyle: const TextStyle( - color: primaryColor, fontWeight: FontWeight.bold//<-- SEE HERE + color: Color(0xFF7A7575), fontWeight: FontWeight.bold//<-- SEE HERE ), border: const OutlineInputBorder( borderSide: BorderSide(color: primaryColor)), diff --git a/lib/medicinecart.dart b/lib/medicinecart.dart index e7f65b5..4965a5c 100644 --- a/lib/medicinecart.dart +++ b/lib/medicinecart.dart @@ -320,11 +320,12 @@ class _MedicineCartListState extends State with TickerProvider leading: IconButton( icon: Icon(Icons.arrow_back), // You can use a different back icon if needed onPressed: () { + Navigator.of(context).pop(); // Implement the navigation logic to go back - Navigator.push( + /* Navigator.push( context, - MaterialPageRoute(builder: (context) => BiddingRequests()), - ); // This will pop the current route and go back + MaterialPageRoute(builder: (context) => GetMedicines()), + );*/ // This will pop the current route and go back }, ), title: Text('Cart Details'), diff --git a/lib/models/companyoffer_model.dart b/lib/models/companyoffer_model.dart new file mode 100644 index 0000000..078a37f --- /dev/null +++ b/lib/models/companyoffer_model.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + +class GetAllPharmacyModel { + String pharmacyname_offer = ''; + String phone_offer=''; + String description_offer=''; + String pharmacyId_offer=''; + + Color cardColor=Colors.white; + + + GetAllPharmacyModel(); + + factory GetAllPharmacyModel.fromJson(Map json){ + GetAllPharmacyModel rtvm = new GetAllPharmacyModel(); + + rtvm.pharmacyname_offer = json['pharmacyname'].toString() ??''; + rtvm.phone_offer = json['phone'].toString() ?? ''; + rtvm.description_offer = json['description'].toString() ?? ''; + rtvm.pharmacyId_offer = json['pharmacyId'].toString() ?? ''; + + // rtvm.prescription_url = json['pictureUrl'][0] ?? ''; + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/offerstabdata.dart b/lib/offerstabdata.dart index 504b087..23324ca 100644 --- a/lib/offerstabdata.dart +++ b/lib/offerstabdata.dart @@ -2,8 +2,9 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:healthcare_pharmacy/maps/app_colors.dart'; import 'package:healthcare_pharmacy/models/offersview_model.dart'; -import 'package:healthcare_pharmacy/offers.dart'; +import 'package:healthcare_pharmacy/createoffers.dart'; import 'package:healthcare_pharmacy/settings.dart'; import 'package:intl/intl.dart'; import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; @@ -102,7 +103,6 @@ class _OffersDataState extends State with TickerProviderStateMixin { updateOfferNameController.text = object.offer_name; updateOfferCodeController.text = object.offer_code; updateOfferDescriptionController.text = object.description; - updateDiscountController.text = object.discount_percentage; updateOfferStartDateController.text=object.starting_date; updateOfferEndDateController.text=object.ending_date; return showDialog( @@ -121,7 +121,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { child: TextFormField( cursorColor: greyColor, controller: updateOfferNameController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.person, @@ -135,7 +135,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: greyColor), ), - labelText: 'Enter offer name', + labelText: 'Offer name', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), @@ -151,7 +151,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { child: TextFormField( cursorColor: greyColor, controller: updateOfferCodeController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.numbers, @@ -165,7 +165,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: greyColor), ), - labelText: 'Enter Offer Code', + labelText: 'Offer Code', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), @@ -180,7 +180,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { child: TextFormField( cursorColor: greyColor, controller: updateOfferDescriptionController, - textCapitalization: TextCapitalization.characters, + textCapitalization: TextCapitalization.words, decoration: const InputDecoration( prefixIcon: Icon( Icons.description, @@ -194,37 +194,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: greyColor), ), - labelText: 'Enter Offer Description', - labelStyle: TextStyle( - color: greyColor, //<-- SEE HERE - ), - ), - ), //tanker name - ), - const SizedBox( - height: 20, - ), - Container( - //padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), - child: TextFormField( - cursorColor: greyColor, - maxLength: 2, - controller: updateDiscountController, - textCapitalization: TextCapitalization.characters, - decoration: const InputDecoration( - prefixIcon: Icon( - Icons.percent_outlined, - color: primaryColor, - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: greyColor)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: greyColor), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: greyColor), - ), - labelText: 'Enter Offer Discount', + labelText: 'Offer Description', labelStyle: TextStyle( color: greyColor, //<-- SEE HERE ), @@ -249,10 +219,10 @@ class _OffersDataState extends State with TickerProviderStateMixin { onPressed: () async { DatePicker.showDatePicker( context, - dateFormat: 'dd MMMM yyyy HH:mm', + dateFormat: 'dd MMMM yyyy', initialDateTime: DateTime.now(), minDateTime:DateTime.now(), - maxDateTime: DateTime.now().add(Duration(days: 15)), + maxDateTime: DateTime.now().add(Duration(days: 365)), onMonthChangeStartWithFirstDate: true, pickerMode: DateTimePickerMode.datetime, pickerTheme: DateTimePickerTheme( @@ -266,7 +236,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { onConfirm: (dateTime, List index)async { DateTime selectdate = dateTime; setState(() { - startdate = DateFormat('dd-MMM-yyyy - HH:mm').format(selectdate); + startdate = DateFormat('dd-MMM-yyyy').format(selectdate); }); if(startdate!=''){ @@ -275,7 +245,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { }); } else { - AppSettings.longFailedToast('please select date'); + AppSettings.longFailedToast('Select start date'); } }, ); @@ -308,7 +278,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { cursorColor: greyColor, controller: updateOfferEndDateController, decoration: InputDecoration( - labelText: 'Select End Date', + labelText: 'Select end Date', prefixIcon: IconButton( icon: Icon( Icons.date_range, @@ -317,10 +287,10 @@ class _OffersDataState extends State with TickerProviderStateMixin { onPressed: () async { DatePicker.showDatePicker( context, - dateFormat: 'dd MMMM yyyy HH:mm', + dateFormat: 'dd MMMM yyyy', initialDateTime: DateTime.now(), minDateTime:DateTime.now(), - maxDateTime: DateTime.now().add(Duration(days: 15)), + maxDateTime: DateTime.now().add(Duration(days: 365)), onMonthChangeStartWithFirstDate: true, pickerMode: DateTimePickerMode.datetime, pickerTheme: DateTimePickerTheme( @@ -334,7 +304,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { onConfirm: (dateTime, List index)async { DateTime selectdate = dateTime; setState(() { - enddate = DateFormat('dd-MMM-yyyy - HH:mm').format(selectdate); + enddate = DateFormat('dd-MMM-yyyy').format(selectdate); }); if(enddate!=''){ @@ -343,7 +313,7 @@ class _OffersDataState extends State with TickerProviderStateMixin { }); } else { - AppSettings.longFailedToast('please select date'); + AppSettings.longFailedToast('Select end date'); } }, ); @@ -390,7 +360,6 @@ class _OffersDataState extends State with TickerProviderStateMixin { payload["offer_name"] = updateOfferNameController.text.toString(); payload["offer_code"] = updateOfferCodeController.text.toString(); payload["description"] = updateOfferDescriptionController.text.toString(); - payload["discount_percentage"] = updateDiscountController.text.toString(); payload["starting_date"] = updateOfferStartDateController.text.toString(); payload["ending_date"] = updateOfferEndDateController.text.toString(); payload["offer_status"] ="active"; @@ -404,7 +373,6 @@ class _OffersDataState extends State with TickerProviderStateMixin { updateOfferNameController.text = ''; updateOfferCodeController.text = ''; updateOfferDescriptionController.text = ''; - updateDiscountController.text = ''; updateOfferStartDateController.text = ''; updateOfferEndDateController.text = ''; @@ -451,140 +419,205 @@ class _OffersDataState extends State with TickerProviderStateMixin { itemCount: activeOffersList.length, itemBuilder: (BuildContext context, int index) { return Card( - - color: activeOffersList[index].cardColor, - child: Padding( - padding:EdgeInsets.all(8) , - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + margin: EdgeInsets.all(8.0), + child: ListTile( + contentPadding: EdgeInsets.all(8.0), + leading: CircleAvatar( + backgroundImage: AssetImage('images/logo.png'), // Replace with your image path + radius: 30, // Adjust the radius as needed + ), + title: RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Name: ', + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: activeOffersList[index].offer_name, + style: TextStyle( + color: primaryColor, + ), + ), + ], + ), + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - - Container( - //width: MediaQuery.of(context).size.width * .55, - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('OfferName :',style: labelTextStyle()), - Text('OfferCode :',style: labelTextStyle()), - Text('OfferDes :' ,style: labelTextStyle()), - Text('offer :' ,style: labelTextStyle()), - Text('StartDate :',style: labelTextStyle()), - Text('EndDate :' ,style: labelTextStyle()), - - ], - ), - SizedBox(width: 5,), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(activeOffersList[index].offer_name,style: valuesTextStyle()), - Text(activeOffersList[index].offer_code,style: valuesTextStyle()), - Text(activeOffersList[index].description,style: valuesTextStyle()), - Text(activeOffersList[index].offer,style: valuesTextStyle()), - Text(activeOffersList[index].starting_date,style: valuesTextStyle()), - Text(activeOffersList[index].ending_date,style: valuesTextStyle()) - - ], - ), - ], + // ... (other RichText widgets for Code, Description, Start Date, End Date) + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Code: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: activeOffersList[index].offer_code, + style: TextStyle( + color: primaryColor, // Change the color for description content + ), ), ], ), ), + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Description: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: activeOffersList[index].description, + style: TextStyle( + color:primaryColor, // Change the color for description content + ), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Start Date: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: activeOffersList[index].starting_date, - Expanded(child:IconButton( - icon: const Icon(Icons.edit,color: primaryColor,), - onPressed: () { - showUpdateOfferDialog(activeOffersList[index]); - }, - ),), - Expanded( - child: Row( - children: [ - Text(''), - Switch( - value: false, // Replace this with your actual property - onChanged: (newValue) async { - if (newValue) { - // Show your AlertDialog for confirmation - showDialog( - context: context, - builder: (BuildContext context) => AlertDialog( - title: Text( - 'Do you want to In_Activate the offer?', - style: TextStyle( - color: primaryColor, - fontSize: 16, - ), + style: TextStyle( + color:primaryColor, // Change the color for description content + ), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'End Date :', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: activeOffersList[index].ending_date, + style: TextStyle( + color:primaryColor, // Change the color for description content + ), + ), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: Icon(Icons.edit), + onPressed: () { + showUpdateOfferDialog(activeOffersList[index]); + }, + ), + Switch( + value: false, // Replace with your actual property + onChanged: (newValue) { + if (newValue) { + // Show your AlertDialog for confirmation + showDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + title: Text( + 'Do you want to In_Activate the offer?', + style: TextStyle( + color: primaryColor, + fontSize: 16, ), - actionsAlignment: MainAxisAlignment.spaceBetween, - actions: [ - TextButton( - onPressed: () async { - bool deleteOfferStatus = - await AppSettings.deleteOffers( - activeOffersList[index].offer_code); - if (deleteOfferStatus) { - getActiveOffersViewData(); - AppSettings.longSuccessToast( - 'Offer In_Active Successfully!!'); - getInactiveOffersViewData(); - // Update the isActive property - - } else { - AppSettings.longFailedToast('Offer In_Active failed'); - } - Navigator.of(context).pop(true); - }, - child: const Text( - 'Yes', - style: TextStyle( - color: primaryColor, - fontSize: 18, - ), + ), + actionsAlignment: MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: () async { + bool deleteOfferStatus = + await AppSettings.deleteOffers( + activeOffersList[index].offer_code); + if (deleteOfferStatus) { + getActiveOffersViewData(); + AppSettings.longSuccessToast( + 'Offer In_Active Successfully!!'); + getInactiveOffersViewData(); + // Update the isActive property + + } else { + AppSettings.longFailedToast('Offer In_Active failed'); + } + Navigator.of(context).pop(true); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: primaryColor, + fontSize: 18, ), ), - TextButton( - onPressed: () { - Navigator.of(context).pop(true); - }, - child: const Text( - 'No', - style: TextStyle( - color: primaryColor, - fontSize: 18, - ), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text( + 'No', + style: TextStyle( + color: primaryColor, + fontSize: 18, ), ), - ], - ), - ); - } else { - // Handle the case where the user wants to undo the In_Activation - // Update the isActive property - //m;./ activeOffersList[index].isActive = false; - // You might want to add code to revert the In_Activation in your data model here - } - }, - ), - ], - ), + ), + ], + ), + ); + } else { + // Handle the case where the user wants to undo the In_Activation + // Update the isActive property + //m;./ activeOffersList[index].isActive = false; + // You might want to add code to revert the In_Activation in your data model here + } + + }, + ), + ], ), - ], - ), ), ); + + + + + + }) ), Padding( padding: EdgeInsets.fromLTRB(8, 8, 8, 8), @@ -672,121 +705,245 @@ class _OffersDataState extends State with TickerProviderStateMixin { itemCount: inactiveOffersList.length, itemBuilder: (BuildContext context, int index) { return Card( - - color: inactiveOffersList[index].cardColor, - child: Padding( - padding:EdgeInsets.all(8) , - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + margin: EdgeInsets.all(8.0), + child: ListTile( + contentPadding: EdgeInsets.all(8.0), + leading: CircleAvatar( + backgroundImage: AssetImage('images/logo.png'), // Replace with your image path + radius: 30, // Adjust the radius as needed + ), + title: RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Name: ', + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: inactiveOffersList[index].offer_name, + style: TextStyle( + color: primaryColor, + ), + ), + ], + ), + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Code: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: inactiveOffersList[index].offer_code, + style: TextStyle( + color: primaryColor, // Change the color for description content + ), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Description: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: inactiveOffersList[index].description, + style: TextStyle( + color:primaryColor, // Change the color for description content + ), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'Start Date: ', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: inactiveOffersList[index].starting_date, - Container( - //width: MediaQuery.of(context).size.width * .55, - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('OfferName :',style: labelTextStyle()), - Text('OfferCode :',style: labelTextStyle()), - Text('OfferDes :' ,style: labelTextStyle()), - Text('OfferDis(%) :' ,style: labelTextStyle()), - Text('StartDate :',style: labelTextStyle()), - Text('EndDate :' ,style: labelTextStyle()), - - ], - ), - SizedBox(width: 5,), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(inactiveOffersList[index].offer_name,style: valuesTextStyle()), - Text(inactiveOffersList[index].offer_code,style: valuesTextStyle()), - Text(inactiveOffersList[index].description,style: valuesTextStyle()), - Text(inactiveOffersList[index].offer,style: valuesTextStyle()), - Text(inactiveOffersList[index].starting_date,style: valuesTextStyle()), - Text(inactiveOffersList[index].ending_date,style: valuesTextStyle()) + style: TextStyle( + color:primaryColor, // Change the color for description content + ), + ), + ], + ), + ), - ], - ), - ], + RichText( + text: TextSpan( + style: DefaultTextStyle.of(context).style, + children: [ + TextSpan( + text: 'End Date :', + style: TextStyle( + color: Colors.black, // Change the color for "Description" text + fontWeight: FontWeight.bold, // You can apply other styles too + ), + ), + TextSpan( + text: inactiveOffersList[index].ending_date, + style: TextStyle( + color:primaryColor, // Change the color for description content + ), ), ], ), ), - Expanded(child:TextButton( - onPressed: () { - showDialog( - //if set to true allow to close popup by tapping out of the popup - //barrierDismissible: false, - context: context, - builder: (BuildContext context) => AlertDialog( - title: const Text('Do you want to Re_Active offer ??', - style: TextStyle( - color: primaryColor, - fontSize: 16, - )), - actionsAlignment: MainAxisAlignment.spaceBetween, - actions: [ - TextButton( - onPressed: ()async { - bool deleteTankStatus = await AppSettings.reactiveOffers(inactiveOffersList[index].offer_code); - - if(deleteTankStatus){ - getInactiveOffersViewData(); - AppSettings.longSuccessToast('offer Re_Active successfully'); - getActiveOffersViewData(); - Navigator.of(context).pop(true); - - } - else{ - AppSettings.longFailedToast('offer Re_Active failed'); - } - }, - child: const Text('Yes', - style: TextStyle( - color: primaryColor, - fontSize: 18, - )), + SizedBox(height: 8), + + + + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: () { + showDialog( + //if set to true allow to close popup by tapping out of the popup + //barrierDismissible: false, + context: context, + builder: (BuildContext context) => AlertDialog( + title: const Text( + 'Do you want to Re-Active offer ??', + style: TextStyle( + color: primaryColor, + fontSize: 16, + ), + ), + actionsAlignment: MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: () async { + bool deleteTankStatus = await AppSettings.reactiveOffers(inactiveOffersList[index].offer_code); + + if (deleteTankStatus) { + getInactiveOffersViewData(); + AppSettings.longSuccessToast('offer Re-Active successfully'); + getActiveOffersViewData(); + Navigator.of(context).pop(true); + } else { + AppSettings.longFailedToast('offer Re-Active failed'); + } + }, + child: const Text( + 'Yes', + style: TextStyle( + color: primaryColor, + fontSize: 18, + ), + ), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text( + 'No', + style: TextStyle( + color: primaryColor, + fontSize: 18, + ), + ), + ), + ], ), - TextButton( - onPressed: () { - Navigator.of(context).pop(true); - }, - child: const Text('No', + ); + }, + child: Text( + 'Re-activate', + style: TextStyle( + color: primaryColor, // You can set the text color to your preference. + fontSize: 16, // You can adjust the font size as needed. + ), + ), + ), + IconButton( + icon: Icon( + Icons.delete, + color: primaryColor, // Customize the delete icon color + ), + onPressed: () async{ + showDialog( + //if set to true allow to close popup by tapping out of the popup + //barrierDismissible: false, + context: context, + builder: (BuildContext context) => AlertDialog( + title: const Text('Do you want to delete Offer?', style: TextStyle( color: primaryColor, - fontSize: 18, + fontSize: 20, )), + actionsAlignment: MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: ()async { + bool deleteOfferStatus = await AppSettings.deleteInActiveOffer(inactiveOffersList[index].offer_code); + if(deleteOfferStatus){ + getInactiveOffersViewData(); + AppSettings.longSuccessToast('Offer deleted successfully'); + Navigator.of(context).pop(true); + + } + else{ + AppSettings.longFailedToast('Offer deletion failed'); + } + }, + child: const Text('Yes', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text('No', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + ), + ], ), - ], - ), - ); - }, - child: const Text( - 'RE_ACTIVE', - style: TextStyle( - color: primaryColor, - fontSize: 15, - fontWeight: FontWeight.bold - /* decoration: TextDecoration.underline,*/ + ); + }, ), - ), - ), - + ], ), ], - ), ), ); diff --git a/lib/offersview.dart b/lib/offersview.dart index 9e0eef4..7dc1b0f 100644 --- a/lib/offersview.dart +++ b/lib/offersview.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:healthcare_pharmacy/models/offersview_model.dart'; -import 'package:healthcare_pharmacy/offers.dart'; +import 'package:healthcare_pharmacy/createoffers.dart'; import 'package:healthcare_pharmacy/settings.dart'; import 'package:intl/intl.dart'; import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; diff --git a/lib/otpscreen.dart b/lib/otpscreen.dart index ec2958b..d7e65ef 100644 --- a/lib/otpscreen.dart +++ b/lib/otpscreen.dart @@ -20,6 +20,8 @@ class _OtpScreenState extends State { final TextEditingController _fieldSix = TextEditingController(); TextEditingController mobileNumberController = TextEditingController(); TextEditingController passwordController = TextEditingController(); + TextEditingController otpController = TextEditingController(); + bool isTextfieldVisible=true; bool isOtpVisible=false; @@ -35,36 +37,6 @@ class _OtpScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('Phone Number Verification'), - - - Visibility( - visible: false, - child: Container( - padding: const EdgeInsets.all(10), - child: TextFormField( - cursorColor: greyColor, - controller: mobileNumberController, - keyboardType: TextInputType.number, - decoration: const InputDecoration( - prefixIcon: Icon( - Icons.phone, - color: greyColor, - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: greyColor)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color:greyColor), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: greyColor), - ), - labelText: 'Enter MobileNumber', - labelStyle: TextStyle( - color: greyColor, //<-- SEE HERE - ), - ), - ), - ),), const SizedBox( height: 30, ), @@ -100,49 +72,6 @@ class _OtpScreenState extends State { const SizedBox( height: 30, ), - Visibility( - visible: false, - child: Container( - padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), - child: TextFormField( - cursorColor: greyColor, - obscureText: isObscureText, - controller: passwordController, - decoration: InputDecoration( - labelText: 'Password', - prefixIcon: const Icon(Icons.password, color: greyColor,), - labelStyle: const TextStyle( - color: greyColor, //<-- SEE HERE - ), - border: const OutlineInputBorder( - borderSide: BorderSide(color: greyColor)), - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide(color: greyColor), - ), - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide(color: textFieldStartColor), - ), - suffixIcon: IconButton( - icon: Icon( - Icons.visibility_off_outlined, - color: isObscureText==true?greyColor:primaryColor, - ), - onPressed: () { - - print("show password"); - setState(() { - isObscureText = !isObscureText; - }); - }, - ), - - ), - - ), - ),), - const SizedBox( - height: 30, - ), Visibility( visible: true, child: Container( @@ -164,6 +93,9 @@ class _OtpScreenState extends State { }); if (_otp!.length == 6) { + + // Set the OTP to the otpController + otpController.text = _otp!; AppSettings.preLoaderDialog(context); bool isOnline = await AppSettings.internetConnectivity(); diff --git a/lib/settings.dart b/lib/settings.dart index c83f7e8..2495ab9 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -125,7 +125,7 @@ InputDecoration textFormFieldDecoration(IconData icon,var text){ ), labelText: text, labelStyle: - TextStyle(color: primaryColor, fontWeight: FontWeight.bold //<-- SEE HERE + TextStyle(color: Color(0xFF7A7575), fontWeight: FontWeight.bold //<-- SEE HERE ), ); } @@ -170,22 +170,28 @@ class AppSettings { static String verifyPhnUrl = host + 'phone'; static String profilePicUrl = host + 'users/profile-picture'; static String uploadPicUrl = host + 'uploadsPharmacy'; + static String uploadOfferUrl = host + 'uploads-offerPicture'; static String resetTokenUrl = host + 'reset_token'; static String forgotPasswordUrl = host + 'forgotpassword'; static String resetPasswordUrl = host + 'resetpassword'; static String sendSmsUrl = host + 'sendSms'; static String phoneVerificationUrl = host + 'pharmacyphone'; static String createOffersUrl = host + 'addoffer'; + static String createCompanyOffersUrl = host + 'addcompanyoffer'; static String getOffersActiveDataUrl = host + 'getActivePharmacyOfferdata'; static String getOffersinActiveDataUrl = host + 'getInActivePharmacyOfferdata'; static String updateOffersDataUrl = host + 'updateOffer'; - static String deleteOffersDataUrl = host + 'deleteOffer'; + static String inactiveOffersDataUrl = host + 'inactiveOffer'; static String reactiveOffersDataUrl = host + 'reactiveOffer'; + static String deleteOfferUrl = host + 'deleteOffer'; static String medecineDataUrl = host + 'medicine'; static String getAllBiddingDataUrl = host + 'getBiddingRequests'; static String getRequestBiddingDataUrl = host + 'biddingRequest'; static String addToCartDataUrl = host + 'cart/add'; static String getCartDataUrl = host + 'cart/total-price'; + static String getPharmacyDataUrl = host + 'getAllPharmacylist'; + + @@ -206,6 +212,8 @@ class AppSettings { static File? updatedImage; static String image = ''; static String profilePictureUrl = ''; + static String offerPictureUrl = ''; + static var api = { 'signIn': host + '/login', }; @@ -373,6 +381,19 @@ class AppSettings { } + static Future offeruploadImageHTTPNew(file) async { + + var request = http.MultipartRequest('POST', Uri.parse(uploadOfferUrl + '/' + healthpharmaIdsign)); + 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 updatePharmaData(payload) async { try { var response = await http.put( @@ -430,6 +451,79 @@ class AppSettings { return false; } } + + + static Future deleteInActiveOffer(offerCode) async { + var uri = Uri.parse(deleteOfferUrl + '/' + healthpharmaIdsign); + uri = uri.replace(query: 'offer_code=$offerCode'); + + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + + + + + + static Future createCompanyOffers(payload) async { + var uri = Uri.parse(createCompanyOffersUrl + '/' + "123456"); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + + + static Future getOffers() async { //path parameter var uri = Uri.parse(getOffersActiveDataUrl + '/' + healthpharmaIdsign); @@ -535,6 +629,30 @@ class AppSettings { }*/ + + static Future getPharmacyData() async { + var uri = Uri.parse(getPharmacyDataUrl); + 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 getAllBiddingRecords() async { //path parameter var uri = Uri.parse(getAllBiddingDataUrl + '/' + healthpharmaIdsign); @@ -682,7 +800,7 @@ class AppSettings { } } static Future deleteOffers(offer_code) async { - var uri = Uri.parse(deleteOffersDataUrl + '/' + healthpharmaIdsign); + var uri = Uri.parse(inactiveOffersDataUrl + '/' + healthpharmaIdsign); uri = uri.replace(query: 'offer_code=$offer_code'); try { @@ -899,6 +1017,8 @@ class AppSettings { static Future saveProfile(dynamic image) async { // save login name information await saveData('profile', image.toString(), 'STRING'); + await saveData('offer', image.toString(), 'STRING'); + //await loadDataFromMemory(); } @@ -915,6 +1035,8 @@ class AppSettings { healthpharmaIdsign = await getData('pharmacyId', 'STRING'); userLatitude = await getData('latitude', 'DOUBLE'); profilePictureUrl=await getData('profile', 'STRING'); + profilePictureUrl=await getData('profile', 'STRING'); + offerPictureUrl=await getData('offer', 'STRING'); userLongitude =await getData('longitude', 'DOUBLE'); fcmId =await getData('fcmId', 'STRING'); } diff --git a/lib/signup.dart b/lib/signup.dart index f92913b..8b6cb81 100644 --- a/lib/signup.dart +++ b/lib/signup.dart @@ -178,7 +178,7 @@ class _SignUpState extends State { cursorColor: greyColor, controller: nameController, textCapitalization: TextCapitalization.characters, - decoration: textFormFieldDecoration(Icons.person,'Name'), + decoration: textFormFieldDecoration(Icons.person,'Enter Your Name'), ), ), //name @@ -212,7 +212,7 @@ class _SignUpState extends State { cursorColor: greyColor, controller: emailController, keyboardType: TextInputType.emailAddress, - decoration: textFormFieldDecoration(Icons.email,'Enter Your Mail'), + decoration: textFormFieldDecoration(Icons.email,'Enter Your Email'), ), ), @@ -344,7 +344,7 @@ class _SignUpState extends State { cursorColor: greyColor, controller: userAddressDescriptionController, textCapitalization: TextCapitalization.characters, - decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'), + decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description ex:FlatNo [Optional]'), ), ),//address description const SizedBox(