From d7301fe690c0f7f3eda0f08c6ef390cba6a6d523 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Tue, 17 Jan 2023 21:17:33 +0530 Subject: [PATCH 1/4] fixing bug in Healthcenter --- lib/screens/Healthcenter/Appointment.dart | 235 +++++++++++----------- 1 file changed, 122 insertions(+), 113 deletions(-) diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index dd486166..64321cb8 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; class Appointment extends StatefulWidget { - @override _AppointmentState createState() => _AppointmentState(); } @@ -10,128 +9,138 @@ class Appointment extends StatefulWidget { //int get _value=>_value; class _AppointmentState extends State { - int _value=1; + int _value = 1; @override Widget build(BuildContext context) { return Container( - // color: Colors.red, - width: 200, - //height: 120, - //color: Colors.blue, - alignment: Alignment.topCenter, - padding: EdgeInsets.all(30.0), - child:ListView( - children: [ - Text("Doctor",style:TextStyle(fontSize: 18,fontWeight: FontWeight.bold),textAlign: TextAlign.start,), - Padding( - padding:EdgeInsets.symmetric(horizontal:0.0), - child:Container( - height:0.5, - width:130.0, - color:Colors.black,),), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DropdownButton( - dropdownColor: Colors.deepOrangeAccent, - elevation: 16, - value: _value, - isExpanded: true, - hint: Text("-SELECT-"), - items: [ - DropdownMenuItem( - child: Text("--SELECT--"), - value: 1, - ), - DropdownMenuItem( - child: Text("Dr Tony Gupta"), - value: 2, - ), - DropdownMenuItem( - child: Text("Dr Hrishi Goyal"), - value: 3, - - ), - DropdownMenuItem( - child: Text("Dr Preeti Singh"), - value: 4 - ), - ], - onChanged: (value) { - setState(() { - //_value = value; - }); - }), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - //SessionView, - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'Date', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + // color: Colors.red, + width: 200, + //height: 120, + //color: Colors.blue, + alignment: Alignment.topCenter, + padding: EdgeInsets.all(30.0), + child: ListView( + children: [ + Text( + "Doctor", + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + textAlign: TextAlign.start, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.0), + child: Container( + height: 0.5, + width: 130.0, + color: Colors.black, ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'From Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DropdownButton( + dropdownColor: Colors.deepOrangeAccent, + elevation: 16, + value: _value, + isExpanded: true, + hint: Text("-SELECT-"), + items: [ + DropdownMenuItem( + child: Text("--SELECT--"), + value: 1, + ), + DropdownMenuItem( + child: Text("Dr Tony Gupta"), + value: 2, + ), + DropdownMenuItem( + child: Text("Dr Hrishi Goyal"), + value: 3, + ), + DropdownMenuItem(child: Text("Dr Preeti Singh"), value: 4), + ], + onChanged: (value) { + setState(() { + //_value = value; + }); + }), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + //SessionView, + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'Date', ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'To Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + mode: DateTimeFieldPickerMode.date, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.access_time_rounded), + labelText: 'From Time', ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - TextFormField( - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Issues/Symptoms", - fillColor: Colors.white, - border: new OutlineInputBorder( - ), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.access_time_rounded), + labelText: 'To Time', + ), + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + TextFormField( + cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Issues/Symptoms", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green ), - Padding(padding: EdgeInsets.symmetric(vertical: 5.0)), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), + style: new TextStyle( + fontFamily: "Poppins", + ), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 5.0)), //FlatButton not found in healthcenter + Center( + child: FlatButton( + child: Text( + 'Submit', + style: TextStyle(fontSize: 15.0), + ), color: Colors.deepOrangeAccent, onPressed: () {}, ), - ), - ], - ), + ), + ], + ), ); } } From 2c652b3de1ef19b9ca5bace16116c9af350e8c4a Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 15 Apr 2023 22:43:21 +0530 Subject: [PATCH 2/4] I have changed date time , not anyone can choose previous data time --- lib/Components/side_drawer.dart | 1 + lib/api.dart | 5 + lib/screens/Healthcenter/Appointment.dart | 91 ++++++++--- .../Healthcenter/ambulanceRequest.dart | 154 +++++++++++------- lib/screens/Healthcenter/feedback.dart | 96 +++++------ lib/services/health_service.dart | 111 +++++++++++++ 6 files changed, 331 insertions(+), 127 deletions(-) diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..523f93bd 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -138,6 +138,7 @@ class _SideDrawerState extends State { ModulesPadding( line: 'Health Center Module', pageMover: '/health_center', + isActive: true, // activating our module OS-2 ), ModulesPadding(line: 'Leave Module'), ModulesPadding(line: 'Placement Module'), diff --git a/lib/api.dart b/lib/api.dart index 802bee2d..968fc2f6 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -29,6 +29,11 @@ const kGymkhanaMemberRecords = '/api/gymkhana/members_record'; //HealthCentre String kHealthCentreStudent = "/healthcenter/api/student"; +// -------my----- +String kHealthCenterCompunderRequest = "/healthcenter/api/compounder/request"; +String kHealthCenterCompounder = "/healthcenter/api/compounder"; +String KHealthCenterStudentRequest = "/healthcenter/api/student/request"; + //------------Screens------------ //screens/Academic/Current_Semester diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index 64321cb8..bfc820a8 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; +import 'package:intl/intl.dart'; + +import 'package:fusion/services/health_service.dart'; class Appointment extends StatefulWidget { @override @@ -10,6 +13,8 @@ class Appointment extends StatefulWidget { class _AppointmentState extends State { int _value = 1; + String date = '', drname = '', from_time = '', to_time = '', issues = ''; + @override Widget build(BuildContext context) { return Container( @@ -47,18 +52,18 @@ class _AppointmentState extends State { value: 1, ), DropdownMenuItem( - child: Text("Dr Tony Gupta"), + child: Text("Dr G.S. Sandhu"), value: 2, ), DropdownMenuItem( - child: Text("Dr Hrishi Goyal"), + child: Text("Dr AN Gupta"), value: 3, ), DropdownMenuItem(child: Text("Dr Preeti Singh"), value: 4), ], onChanged: (value) { setState(() { - //_value = value; + // _value = value; }); }), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), @@ -73,10 +78,21 @@ class _AppointmentState extends State { ), mode: DateTimeFieldPickerMode.date, autovalidateMode: AutovalidateMode.always, + + // Adding first date (for this we can't select past date) + + // initialValue or controller.text can be null, empty or a DateTime string otherwise it will throw an error. + initialValue: DateTime.now(), + firstDate: DateTime.now(), + validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { - print(value); + // print(value); + date = DateFormat('yyyy-MM-dd').format(value); + print(date); + // date =value; }, ), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), @@ -90,10 +106,15 @@ class _AppointmentState extends State { ), mode: DateTimeFieldPickerMode.time, autovalidateMode: AutovalidateMode.always, + + // For time validation -----------> Pradeep + validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { - print(value); + // print(value); + from_time = DateFormat('HH:mm:ss').format(value); + // print(from_time); }, ), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), @@ -111,34 +132,58 @@ class _AppointmentState extends State { (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { print(value); + to_time = DateFormat('HH:mm:ss').format(value); }, ), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), TextFormField( - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Issues/Symptoms", - fillColor: Colors.white, - border: new OutlineInputBorder(), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), + cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Issues/Symptoms", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green + ), + style: new TextStyle( + fontFamily: "Poppins", + ), + onChanged: (value) { + setState(() { + issues = value; + }); + }), Padding( padding: EdgeInsets.symmetric( vertical: 5.0)), //FlatButton not found in healthcenter + Center( - child: FlatButton( - child: Text( - 'Submit', - style: TextStyle(fontSize: 15.0), + child: SizedBox( + width: 100, + height: 40, + child: TextButton( + child: Text( + "Submit", + style: TextStyle(fontSize: 20), + ), + onPressed: () { + print(date); + print(to_time); + print(from_time); + print(issues); + print('Submitted Successfully!'); + }, + style: ButtonStyle( + foregroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: MaterialStateProperty.all(Colors.white), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + side: BorderSide(color: Colors.red), + )), + ), ), - color: Colors.deepOrangeAccent, - onPressed: () {}, ), - ), + ) ], ), ); diff --git a/lib/screens/Healthcenter/ambulanceRequest.dart b/lib/screens/Healthcenter/ambulanceRequest.dart index 4d90910a..097c8e5c 100644 --- a/lib/screens/Healthcenter/ambulanceRequest.dart +++ b/lib/screens/Healthcenter/ambulanceRequest.dart @@ -1,77 +1,119 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; - class AmbulanceRequest extends StatefulWidget { @override _AmbulanceRequestState createState() => _AmbulanceRequestState(); } class _AmbulanceRequestState extends State { + int _value = 1; + String date = '', drname = '', from_time = '', to_time = '', issues = ''; + @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(20.0), child: Column( - children: [ - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + children: [ + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'Date', + ), + mode: DateTimeFieldPickerMode.date, + autovalidateMode: AutovalidateMode.always, - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'From', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + // initialValue or controller.text can be null, empty or a DateTime string otherwise it will throw an error. + initialValue: DateTime.now(), + firstDate: DateTime.now(), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'To', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - TextFormField( - maxLines: 4, - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Reason", - fillColor: Colors.white, - border: new OutlineInputBorder( - ), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), - color: Colors.deepOrangeAccent, - onPressed: () {}, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + // adding time for ambulence request + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.access_time_rounded), + labelText: 'From Time', + ), + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + + // For time validation -----------> Pradeep + + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + TextFormField( + maxLines: 1, + // cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Picking point", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green + ), + style: new TextStyle( + fontFamily: "Poppins", + ), + ), + + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + TextFormField( + maxLines: 4, + cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Reason", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green + ), + style: new TextStyle( + fontFamily: "Poppins", + ), + ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + Center( + child: SizedBox( + width: 100, + height: 40, + child: TextButton( + child: Text( + "Submit", + style: TextStyle(fontSize: 20), ), + onPressed: () { + print('Submitted Successfully!'); + }, + style: ButtonStyle( + foregroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: MaterialStateProperty.all(Colors.white), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + side: BorderSide(color: Colors.red), + )), ), - - ], + ), + ), + ) + ], ), ); } diff --git a/lib/screens/Healthcenter/feedback.dart b/lib/screens/Healthcenter/feedback.dart index 6b34c3f9..5a566d7d 100644 --- a/lib/screens/Healthcenter/feedback.dart +++ b/lib/screens/Healthcenter/feedback.dart @@ -1,18 +1,13 @@ import 'package:flutter/material.dart'; - class FeedBack extends StatefulWidget { @override _FeedBackState createState() => _FeedBackState(); } - - class _FeedBackState extends State { @override - - - Widget feed=Container( + Widget feed = Container( padding: EdgeInsets.all(20.0), child: Column( children: [ @@ -22,25 +17,28 @@ class _FeedBackState extends State { decoration: new InputDecoration( labelText: "Feedback", fillColor: Colors.white, - border: new OutlineInputBorder( - ), + border: new OutlineInputBorder(), //fillColor: Colors.green ), style: new TextStyle( fontFamily: "Poppins", ), ), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), - color: Colors.deepOrangeAccent, - onPressed: () {}, - ), + Center( + child: FlatButton( + //FlatButton ---> TextButton + child: Text( + 'Submit', + style: TextStyle(fontSize: 15.0), + ), + color: Colors.deepOrangeAccent, + onPressed: () {}, + ), ), ], ), ); - Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, @@ -50,41 +48,43 @@ class _FeedBackState extends State { ), body: Container( child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - SizedBox(height: 20.0), - DefaultTabController( - length: 1, // length of tabs - initialIndex: 0, - child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - //color: Colors.deepOrangeAccent, - child: TabBar( - labelColor: Colors.deepOrange, - indicatorColor: Colors.deepOrangeAccent, - unselectedLabelColor: Colors.black, - tabs: [ - Tab( - child: Text("Feedback Form", style: TextStyle( - fontWeight: FontWeight.bold),),), - ], - ), - ), - Container( - height: 520, //height of TabBarView - decoration: BoxDecoration( - border: Border( - top: BorderSide(color: Colors.grey, width: 0.5)) + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox(height: 20.0), + DefaultTabController( + length: 1, // length of tabs + initialIndex: 0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + color: Colors.deepOrangeAccent, + child: TabBar( + labelColor: Colors.deepOrange, + indicatorColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + tabs: [ + Tab( + child: Text( + "Feedback Form", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ], + ), ), - child: TabBarView(children: [ - feed, - - ]) - ) - ]) - ), - ]), + Container( + height: 520, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.grey, width: 0.5))), + child: TabBarView(children: [ + feed, + ])) + ])), + ]), ), ); } -} \ No newline at end of file +} diff --git a/lib/services/health_service.dart b/lib/services/health_service.dart index f90f37b0..96ea1596 100644 --- a/lib/services/health_service.dart +++ b/lib/services/health_service.dart @@ -1,6 +1,8 @@ import 'dart:core'; import 'package:fusion/api.dart'; import 'package:fusion/constants.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; import 'package:http/http.dart' as http; class HeathService { @@ -19,4 +21,113 @@ class HeathService { return response; } } + + //---- start-here -------- + + Future getAmbulence( + // here we have to all data point + String? user_id, + String? date_request, + String? start_date, + String? end_date, + String? reason, + ) async { + try { + Map data = { + // we have to write all point here + "user_id": user_id!, + "date_request": date_request!, + "start_date": start_date!, + "end_date": end_date!, + "reason": reason!, + }; + var storage_service = locator(); + if (storage_service.userInDB?.token == null) + throw Exception('Token Error'); + + Map headers = { + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + }; + + var client = http.Client(); + var response = await client.put( + Uri.http( + getLink(), + kHealthCenterCompounder, //constant update path + ), + headers: headers, + body: data); + print("Fetched Data"); + if (response.statusCode == 200) return true; + return false; + } catch (e) { + rethrow; + } + } + + Future doctorAppoinment( + String user_id, + String? doctor_id, + String? date, + String? start_date, + String? end_date, + String? description, + ) async { + try { + // here we have to write all data point + Map data = {}; + var storage_service = locator(); + if (storage_service.userInDB?.token == null) + throw Exception('Token Error'); + + Map headers = { + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + }; + + var client = http.Client(); + var response = await client.put( + Uri.http( + getLink(), + kHealthCenterCompounder, //constant update path + ), + headers: headers, + body: data); + print("Fetched Data"); + if (response.statusCode == 200) return true; + return false; + } catch (e) { + rethrow; + } + } + + Future function3( + // yaha parameters dalna hai form ke + ) async { + try { + Map data = { + // yaha par key value pair banana hai param se + }; + var storage_service = locator(); + if (storage_service.userInDB?.token == null) + throw Exception('Token Error'); + + Map headers = { + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + }; + + var client = http.Client(); + var response = await client.put( + Uri.http( + getLink(), + kHealthCenterCompounder, //change karna hai endpoint ko + ), + headers: headers, + body: data); + print("Fetched Data"); + if (response.statusCode == 200) return true; + return false; + } catch (e) { + rethrow; + } + } } From 21b3c4d52a147596cdbd44b1b3d3aebb04412837 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Wed, 19 Apr 2023 21:47:05 +0530 Subject: [PATCH 3/4] Add backend part for app --- lib/screens/Healthcenter/Appointment.dart | 68 ++++++- .../Healthcenter/ambulanceRequest.dart | 179 +++++++++++++++--- lib/screens/Healthcenter/feedback.dart | 2 + lib/services/health_service.dart | 23 ++- 4 files changed, 232 insertions(+), 40 deletions(-) diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index bfc820a8..6933a628 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -165,13 +165,69 @@ class _AppointmentState extends State { "Submit", style: TextStyle(fontSize: 20), ), - onPressed: () { - print(date); - print(to_time); - print(from_time); - print(issues); - print('Submitted Successfully!'); + + // try something new here + + onPressed: () async { + HeathService auth = HeathService(); + bool lodge = await auth.doctorAppoinment( + // _value, + date, + from_time, + to_time, + issues, + ); + // print(user_id); + // print(start_date); + // print(end_date); + // print(reason); + // print(lodge); + + // TextInput.finishAutofillContext(); + if (lodge == true) { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Success"), + content: Text("Ambulance Request Added Successfully"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } else { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Failed"), + content: Text("Cannot add Ambulance Request"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } }, + + // end something new here + + // onPressed: () { + // print(date); + // print(to_time); + // print(from_time); + // print(issues); + // print('Submitted Successfully!'); + // }, style: ButtonStyle( foregroundColor: MaterialStateProperty.all(Colors.red), backgroundColor: MaterialStateProperty.all(Colors.white), diff --git a/lib/screens/Healthcenter/ambulanceRequest.dart b/lib/screens/Healthcenter/ambulanceRequest.dart index 097c8e5c..c3c2f87e 100644 --- a/lib/screens/Healthcenter/ambulanceRequest.dart +++ b/lib/screens/Healthcenter/ambulanceRequest.dart @@ -1,14 +1,27 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; +// import 'package:fusion/services/storage_service.dart'; + +import 'package:fusion/services/health_service.dart'; +import 'package:intl/intl.dart'; class AmbulanceRequest extends StatefulWidget { + // here is changes for user_id + // final String? ambulanceRequesterRollNo; + // AmbulanceRequest(this.ambulanceRequesterRollNo); + @override _AmbulanceRequestState createState() => _AmbulanceRequestState(); } class _AmbulanceRequestState extends State { int _value = 1; - String date = '', drname = '', from_time = '', to_time = '', issues = ''; + String start_date = '', end_date = '', reason = '', user_id = "20BCS046"; + + // String? user_id = widget.ambulanceRequesterRollNo; + // String? worker_id = ""; + + TextEditingController reasonController = TextEditingController(); @override Widget build(BuildContext context) { @@ -23,7 +36,7 @@ class _AmbulanceRequestState extends State { errorStyle: TextStyle(color: Colors.redAccent), border: OutlineInputBorder(), suffixIcon: Icon(Icons.event_note), - labelText: 'Date', + labelText: 'From', ), mode: DateTimeFieldPickerMode.date, autovalidateMode: AutovalidateMode.always, @@ -35,49 +48,105 @@ class _AmbulanceRequestState extends State { validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { - print(value); + // start_date = value.toString(); + start_date = DateFormat('yyyy-MM-dd').format(value); + print(start_date); }, ), - // adding time for ambulence request Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), DateTimeFormField( decoration: const InputDecoration( hintStyle: TextStyle(color: Colors.black45), errorStyle: TextStyle(color: Colors.redAccent), border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'From Time', + suffixIcon: Icon(Icons.event_note), + labelText: 'To', ), - mode: DateTimeFieldPickerMode.time, + mode: DateTimeFieldPickerMode.date, autovalidateMode: AutovalidateMode.always, - // For time validation -----------> Pradeep + // initialValue or controller.text can be null, empty or a DateTime string otherwise it will throw an error. + initialValue: DateTime.now(), + firstDate: DateTime.now(), validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { - print(value); + // end_date = value.toString(); + end_date = DateFormat('yyyy-MM-dd').format(value); + print(end_date); }, ), + // adding time for ambulence request Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - TextFormField( - maxLines: 1, - // cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Picking point", - fillColor: Colors.white, - border: new OutlineInputBorder(), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), + // DateTimeFormField( + // decoration: const InputDecoration( + // hintStyle: TextStyle(color: Colors.black45), + // errorStyle: TextStyle(color: Colors.redAccent), + // border: OutlineInputBorder(), + // suffixIcon: Icon(Icons.access_time_rounded), + // labelText: 'From Time', + // ), + // mode: DateTimeFieldPickerMode.time, + // autovalidateMode: AutovalidateMode.always, + + // // For time validation -----------> Pradeep + + // validator: (e) => + // (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + // onDateSelected: (DateTime value) { + // print(value); + // start_date = value.toString(); + // }, + // ), + + // Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + // DateTimeFormField( + // decoration: const InputDecoration( + // hintStyle: TextStyle(color: Colors.black45), + // errorStyle: TextStyle(color: Colors.redAccent), + // border: OutlineInputBorder(), + // suffixIcon: Icon(Icons.access_time_rounded), + // labelText: 'To Time', + // ), + // mode: DateTimeFieldPickerMode.time, + // autovalidateMode: AutovalidateMode.always, + + // // For time validation -----------> Pradeep + + // validator: (e) => + // (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + // onDateSelected: (DateTime value) { + // print(value); + // end_date = value.toString(); + // }, + // ), + // Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + // TextFormField( + // maxLines: 1, + // // cursorHeight: 30, + // decoration: new InputDecoration( + // labelText: "Picking point", + // fillColor: Colors.white, + // border: new OutlineInputBorder(), + // //fillColor: Colors.green + // ), + // style: new TextStyle( + // fontFamily: "Poppins", + // ), + // ), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), TextFormField( maxLines: 4, cursorHeight: 30, + controller: reasonController, + // onChanged: (value) => reasonController.text = value, + onChanged: (value) { + setState(() { + reason = value.toString(); + }); + }, decoration: new InputDecoration( labelText: "Reason", fillColor: Colors.white, @@ -88,6 +157,7 @@ class _AmbulanceRequestState extends State { fontFamily: "Poppins", ), ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), Center( child: SizedBox( @@ -98,9 +168,70 @@ class _AmbulanceRequestState extends State { "Submit", style: TextStyle(fontSize: 20), ), - onPressed: () { - print('Submitted Successfully!'); + + // try something new + + onPressed: () async { + HeathService auth = HeathService(); + bool lodge = await auth.getAmbulence( + user_id, + start_date, + end_date, + reason, + ); + print(user_id); + print(start_date); + print(end_date); + print(reason); + print(lodge); + + // TextInput.finishAutofillContext(); + if (lodge == true) { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Success"), + content: Text("Ambulance Request Added Successfully"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } else { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Failed"), + content: Text("Cannot add Ambulance Request"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } }, + + //end something new + + // onPressed: () { + // print('Submitted Successfully ni!'); + // // reason = Text(reasonController.text).toString(); + // var res = reasonController.text; + // print(res); + // print(reason); + // print(start_date); + // print(end_date); + // }, style: ButtonStyle( foregroundColor: MaterialStateProperty.all(Colors.red), backgroundColor: MaterialStateProperty.all(Colors.white), diff --git a/lib/screens/Healthcenter/feedback.dart b/lib/screens/Healthcenter/feedback.dart index 5a566d7d..35dcf6a6 100644 --- a/lib/screens/Healthcenter/feedback.dart +++ b/lib/screens/Healthcenter/feedback.dart @@ -6,6 +6,8 @@ class FeedBack extends StatefulWidget { } class _FeedBackState extends State { + String feedback = ''; + @override Widget feed = Container( padding: EdgeInsets.all(20.0), diff --git a/lib/services/health_service.dart b/lib/services/health_service.dart index 96ea1596..1f0f4ba7 100644 --- a/lib/services/health_service.dart +++ b/lib/services/health_service.dart @@ -27,7 +27,7 @@ class HeathService { Future getAmbulence( // here we have to all data point String? user_id, - String? date_request, + // String? date_request, String? start_date, String? end_date, String? reason, @@ -36,10 +36,10 @@ class HeathService { Map data = { // we have to write all point here "user_id": user_id!, - "date_request": date_request!, + // "date_request": date_request!, "start_date": start_date!, "end_date": end_date!, - "reason": reason!, + "reason": reason, }; var storage_service = locator(); if (storage_service.userInDB?.token == null) @@ -49,15 +49,18 @@ class HeathService { 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") }; + // print(headers); + var client = http.Client(); - var response = await client.put( + var response = await client.post( Uri.http( getLink(), - kHealthCenterCompounder, //constant update path + KHealthCenterStudentRequest, //constant update path ), headers: headers, body: data); print("Fetched Data"); + if (response.statusCode == 200) return true; return false; } catch (e) { @@ -66,8 +69,8 @@ class HeathService { } Future doctorAppoinment( - String user_id, - String? doctor_id, + // String user_id, + // String? doctor_id, String? date, String? start_date, String? end_date, @@ -88,7 +91,7 @@ class HeathService { var response = await client.put( Uri.http( getLink(), - kHealthCenterCompounder, //constant update path + KHealthCenterStudentRequest, //constant update path ), headers: headers, body: data); @@ -100,7 +103,7 @@ class HeathService { } } - Future function3( + Future Student_history( // yaha parameters dalna hai form ke ) async { try { @@ -119,7 +122,7 @@ class HeathService { var response = await client.put( Uri.http( getLink(), - kHealthCenterCompounder, //change karna hai endpoint ko + kHealthCentreStudent, //change karna hai endpoint ko ), headers: headers, body: data); From 5d524f9d3011e9f7fc98a1bd44f241cf49981b6a Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 22 Apr 2023 22:40:46 +0530 Subject: [PATCH 4/4] done --- lib/api.dart | 5 +- lib/screens/Healthcenter/Appointment.dart | 11 ++- .../Healthcenter/ambulanceRequest.dart | 70 ++------------ lib/screens/Healthcenter/feedback.dart | 77 ++++++++++++++-- lib/services/health_service.dart | 92 ++++++++++++------- 5 files changed, 144 insertions(+), 111 deletions(-) diff --git a/lib/api.dart b/lib/api.dart index 968fc2f6..31865d3e 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -1,9 +1,10 @@ //Server and local links String klocalLink = "127.0.0.1:8000"; -String kserverLink = "172.27.16.215:80"; +String kserverLink = "172.27.16.214:80"; //Login Service -String kAuthUrl = "172.27.16.215:80"; +String kAuthUrl = "172.27.16.214:80"; + String kAuthLogin = "/api/auth/login/"; //Profile Service diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index 6933a628..0876b2b6 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -13,7 +13,12 @@ class Appointment extends StatefulWidget { class _AppointmentState extends State { int _value = 1; - String date = '', drname = '', from_time = '', to_time = '', issues = ''; + String date = '', + drname = '', + from_time = '', + to_time = '', + issues = '', + dr_id = ''; @override Widget build(BuildContext context) { @@ -63,7 +68,8 @@ class _AppointmentState extends State { ], onChanged: (value) { setState(() { - // _value = value; + // _value = (int)value; + dr_id = value.toString(); }); }), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), @@ -172,6 +178,7 @@ class _AppointmentState extends State { HeathService auth = HeathService(); bool lodge = await auth.doctorAppoinment( // _value, + dr_id, date, from_time, to_time, diff --git a/lib/screens/Healthcenter/ambulanceRequest.dart b/lib/screens/Healthcenter/ambulanceRequest.dart index c3c2f87e..e6bfd8d2 100644 --- a/lib/screens/Healthcenter/ambulanceRequest.dart +++ b/lib/screens/Healthcenter/ambulanceRequest.dart @@ -16,7 +16,7 @@ class AmbulanceRequest extends StatefulWidget { class _AmbulanceRequestState extends State { int _value = 1; - String start_date = '', end_date = '', reason = '', user_id = "20BCS046"; + String start_date = '', end_date = '', reason = ''; // String? user_id = widget.ambulanceRequesterRollNo; // String? worker_id = ""; @@ -78,63 +78,7 @@ class _AmbulanceRequestState extends State { }, ), // adding time for ambulence request - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - // DateTimeFormField( - // decoration: const InputDecoration( - // hintStyle: TextStyle(color: Colors.black45), - // errorStyle: TextStyle(color: Colors.redAccent), - // border: OutlineInputBorder(), - // suffixIcon: Icon(Icons.access_time_rounded), - // labelText: 'From Time', - // ), - // mode: DateTimeFieldPickerMode.time, - // autovalidateMode: AutovalidateMode.always, - - // // For time validation -----------> Pradeep - - // validator: (e) => - // (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - // onDateSelected: (DateTime value) { - // print(value); - // start_date = value.toString(); - // }, - // ), - // Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - // DateTimeFormField( - // decoration: const InputDecoration( - // hintStyle: TextStyle(color: Colors.black45), - // errorStyle: TextStyle(color: Colors.redAccent), - // border: OutlineInputBorder(), - // suffixIcon: Icon(Icons.access_time_rounded), - // labelText: 'To Time', - // ), - // mode: DateTimeFieldPickerMode.time, - // autovalidateMode: AutovalidateMode.always, - - // // For time validation -----------> Pradeep - - // validator: (e) => - // (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - // onDateSelected: (DateTime value) { - // print(value); - // end_date = value.toString(); - // }, - // ), - // Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - // TextFormField( - // maxLines: 1, - // // cursorHeight: 30, - // decoration: new InputDecoration( - // labelText: "Picking point", - // fillColor: Colors.white, - // border: new OutlineInputBorder(), - // //fillColor: Colors.green - // ), - // style: new TextStyle( - // fontFamily: "Poppins", - // ), - // ), Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), TextFormField( @@ -174,16 +118,16 @@ class _AmbulanceRequestState extends State { onPressed: () async { HeathService auth = HeathService(); bool lodge = await auth.getAmbulence( - user_id, + // user_id, start_date, end_date, reason, ); - print(user_id); - print(start_date); - print(end_date); - print(reason); - print(lodge); + + // print(start_date); + // print(end_date); + // print(reason); + // print(lodge); // TextInput.finishAutofillContext(); if (lodge == true) { diff --git a/lib/screens/Healthcenter/feedback.dart b/lib/screens/Healthcenter/feedback.dart index 35dcf6a6..6c191b8b 100644 --- a/lib/screens/Healthcenter/feedback.dart +++ b/lib/screens/Healthcenter/feedback.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:fusion/services/health_service.dart'; class FeedBack extends StatefulWidget { @override @@ -6,7 +7,7 @@ class FeedBack extends StatefulWidget { } class _FeedBackState extends State { - String feedback = ''; + String feedback = '', date = ''; @override Widget feed = Container( @@ -26,17 +27,75 @@ class _FeedBackState extends State { fontFamily: "Poppins", ), ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), Center( - child: FlatButton( - //FlatButton ---> TextButton - child: Text( - 'Submit', - style: TextStyle(fontSize: 15.0), + child: SizedBox( + width: 100, + height: 40, + child: TextButton( + child: Text( + "Submit", + style: TextStyle(fontSize: 20), + ), + + // try something new + + onPressed: () async { + HeathService auth = HeathService(); + bool lodge = await auth.postFeedback( + // user_id, + feedback, + ); + print(lodge); + + // TextInput.finishAutofillContext(); + if (lodge == true) { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Success"), + content: Text("Ambulance Request Added Successfully"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } else { + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text("Failed"), + content: Text("Cannot add Ambulance Request"), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: Text("okay"), + ), + ], + ), + ); + } + }, + + style: ButtonStyle( + foregroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: MaterialStateProperty.all(Colors.white), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + side: BorderSide(color: Colors.red), + )), + ), ), - color: Colors.deepOrangeAccent, - onPressed: () {}, ), - ), + ) ], ), ); diff --git a/lib/services/health_service.dart b/lib/services/health_service.dart index 1f0f4ba7..7c29d1d0 100644 --- a/lib/services/health_service.dart +++ b/lib/services/health_service.dart @@ -1,4 +1,5 @@ import 'dart:core'; +import 'dart:convert'; import 'package:fusion/api.dart'; import 'package:fusion/constants.dart'; import 'package:fusion/services/service_locator.dart'; @@ -25,77 +26,87 @@ class HeathService { //---- start-here -------- Future getAmbulence( - // here we have to all data point - String? user_id, - // String? date_request, String? start_date, String? end_date, String? reason, ) async { try { Map data = { - // we have to write all point here - "user_id": user_id!, - // "date_request": date_request!, "start_date": start_date!, "end_date": end_date!, "reason": reason, + "ambulancerequest": "true" }; var storage_service = locator(); if (storage_service.userInDB?.token == null) throw Exception('Token Error'); Map headers = { - 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? ""), + 'Content-type': 'application/json', }; - - // print(headers); - + var body = json.encode(data); var client = http.Client(); var response = await client.post( - Uri.http( - getLink(), - KHealthCenterStudentRequest, //constant update path - ), - headers: headers, - body: data); + Uri.http( + getLink(), + KHealthCenterStudentRequest, //constant update path + ), + headers: headers, + body: body, + ); print("Fetched Data"); - - if (response.statusCode == 200) return true; - return false; + print(response.statusCode); + // print(jsonDecode(response.body)); + if (response.statusCode == 201) + return true; + else + return false; } catch (e) { rethrow; } } Future doctorAppoinment( - // String user_id, - // String? doctor_id, + String? doctor_id, String? date, - String? start_date, - String? end_date, + String? from_time, + String? to_time, String? description, ) async { try { // here we have to write all data point - Map data = {}; + Map data = { + "doctor_id": doctor_id!, + "date": date!, + "from_time": from_time!, + "to_time": to_time!, + "description": description, + "appointmentadd": "true" + }; + print(json.encode(data)); var storage_service = locator(); if (storage_service.userInDB?.token == null) throw Exception('Token Error'); Map headers = { - 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? ""), + 'Content-type': 'application/json', }; var client = http.Client(); - var response = await client.put( + var body = json.encode(data); + var response = await client.post( Uri.http( getLink(), KHealthCenterStudentRequest, //constant update path ), headers: headers, - body: data); + // body: json.encode(data), + body: body); print("Fetched Data"); + print(response.statusCode); + print(response.body); if (response.statusCode == 200) return true; return false; } catch (e) { @@ -103,34 +114,45 @@ class HeathService { } } - Future Student_history( - // yaha parameters dalna hai form ke - ) async { +// for feedback + + Future postFeedback(String? feedback) async { try { + // here we have to write all data point Map data = { - // yaha par key value pair banana hai param se + "feedback": feedback!, + // "date": date!, + "complaintadd": "true" }; + print(json.encode(data)); var storage_service = locator(); if (storage_service.userInDB?.token == null) throw Exception('Token Error'); Map headers = { - 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? ""), + 'Content-type': 'application/json', }; var client = http.Client(); - var response = await client.put( + var body = json.encode(data); + var response = await client.post( Uri.http( getLink(), - kHealthCentreStudent, //change karna hai endpoint ko + KHealthCenterStudentRequest, //constant update path ), headers: headers, - body: data); + body: body); print("Fetched Data"); + print(response.statusCode); + print(response.body); if (response.statusCode == 200) return true; return false; } catch (e) { rethrow; } } + + // fetching health record here + }