|
|
@ -10,6 +10,7 @@ import 'package:healthcare_user/Reports/update_report.dart';
|
|
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
|
|
import 'package:healthcare_user/common/zoom_image.dart';
|
|
|
|
import 'package:healthcare_user/common/zoom_image.dart';
|
|
|
|
import 'package:healthcare_user/models/reports_model.dart';
|
|
|
|
import 'package:healthcare_user/models/reports_model.dart';
|
|
|
|
|
|
|
|
import 'package:healthcare_user/report_problem/all-records_onclick_new.dart';
|
|
|
|
import 'package:photo_view/photo_view.dart';
|
|
|
|
import 'package:photo_view/photo_view.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -29,7 +30,11 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
bool isSereverIssue = false;
|
|
|
|
bool isSereverIssue = false;
|
|
|
|
TextEditingController searchController = TextEditingController();
|
|
|
|
TextEditingController searchController = TextEditingController();
|
|
|
|
TextEditingController dateInput = TextEditingController();
|
|
|
|
TextEditingController dateInput = TextEditingController();
|
|
|
|
|
|
|
|
TextEditingController fromdateController = TextEditingController();
|
|
|
|
|
|
|
|
TextEditingController todateController = TextEditingController();
|
|
|
|
|
|
|
|
DateTime fromDate=DateTime.now();
|
|
|
|
String dropdownSearchType = 'Problem';
|
|
|
|
String dropdownSearchType = 'Problem';
|
|
|
|
|
|
|
|
String? searchBy;
|
|
|
|
var typeOfSearchItems = [
|
|
|
|
var typeOfSearchItems = [
|
|
|
|
'Problem',
|
|
|
|
'Problem',
|
|
|
|
'Doctor',
|
|
|
|
'Doctor',
|
|
|
@ -133,9 +138,57 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getRecordsByDateRange(var fromDate,var toDate) async {
|
|
|
|
|
|
|
|
isReportsDataLoading = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
var response = await AppSettings.getAllRecords();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
reportsListOriginal = ((jsonDecode(response)) as List)
|
|
|
|
|
|
|
|
.map((dynamic model) {
|
|
|
|
|
|
|
|
return ReportsModel.fromJson(model);
|
|
|
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
reportsList=reportsListOriginal.reversed.toList();
|
|
|
|
|
|
|
|
var dateToCheck = DateTime.now().add(Duration(days: -1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reportsList = reportsListOriginal.reversed.where((product) {
|
|
|
|
|
|
|
|
final date = product.dateForFilter;
|
|
|
|
|
|
|
|
final startDate =DateFormat('dd-MM-yyyy').parse(fromDate);
|
|
|
|
|
|
|
|
final endDate = DateFormat('dd-MM-yyyy').parse(toDate);
|
|
|
|
|
|
|
|
return date.isAfter(startDate) && date.isBefore(endDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//reportsList=reportsListOriginal.reversed.toList();
|
|
|
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if( dateToCheck.isAfter(startDate) && dateToCheck.isBefore(endDate))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
print("dateToCheck is between now and lastYear");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
print("dateToCheck is not between now and lastYear");
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isReportsDataLoading = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
isReportsDataLoading = false;
|
|
|
|
|
|
|
|
isSereverIssue = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
var now = new DateTime.now();
|
|
|
|
|
|
|
|
String formattedDate = DateFormat('dd-MM-yyyy').format(now);
|
|
|
|
|
|
|
|
fromdateController.text=formattedDate;
|
|
|
|
|
|
|
|
todateController.text=formattedDate;
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -333,6 +386,7 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
|
|
|
|
|
|
|
|
Widget _filtereddata(){
|
|
|
|
Widget _filtereddata(){
|
|
|
|
if(reportsList.length!=0){
|
|
|
|
if(reportsList.length!=0){
|
|
|
|
|
|
|
|
reportsList.sort((a, b) => b.date.compareTo(a.date));
|
|
|
|
return ListView.builder(
|
|
|
|
return ListView.builder(
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
itemCount: reportsList.length,
|
|
|
|
itemCount: reportsList.length,
|
|
|
@ -343,7 +397,7 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -470,18 +524,18 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
/*Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new FindingImages(imageDetails:reportsList[index].findingsImages,recordId: reportsList[index].recordId,))).then((value) {
|
|
|
|
builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});*/
|
|
|
|
});
|
|
|
|
Navigator.push(
|
|
|
|
/*Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Text('Findings: '+reportsList[index].findingsImages.length.toString(),style:textButtonStyleReports(),),
|
|
|
|
child: Text('Findings: '+reportsList[index].findingsImages.length.toString(),style:textButtonStyleReports(),),
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -494,18 +548,18 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
/*Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new ReportImages(imageDetails:reportsList[index].reportImages,recordId:reportsList[index].recordId ,))).then((value) {
|
|
|
|
builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});*/
|
|
|
|
});
|
|
|
|
Navigator.push(
|
|
|
|
/*Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 1,))).then((value) {
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 1,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Text('Reports: '+reportsList[index].reportImages.length.toString(),style:textButtonStyleReports()),
|
|
|
|
child: Text('Reports: '+reportsList[index].reportImages.length.toString(),style:textButtonStyleReports()),
|
|
|
@ -519,19 +573,19 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
/*Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new PrescriptionImages(imageDetails:reportsList[index].prescriptionImages,recordId: reportsList[index].recordId,familyDetails:reportsList[index],details:reportsList[index] ,))).then((value) {
|
|
|
|
builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});*/
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
/*Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 2,))).then((value) {
|
|
|
|
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 2,))).then((value) {
|
|
|
|
getAllRecords();
|
|
|
|
getAllRecords();
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Text('Prescriptions: '+reportsList[index].prescriptionImages.length.toString(),style:textButtonStyleReports()),
|
|
|
|
child: Text('Prescriptions: '+reportsList[index].prescriptionImages.length.toString(),style:textButtonStyleReports()),
|
|
|
@ -596,7 +650,7 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
/*Container(
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
child: DropdownButtonFormField(
|
|
|
|
child: DropdownButtonFormField(
|
|
|
|
// Initial Value
|
|
|
|
// Initial Value
|
|
|
@ -640,9 +694,69 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),*/
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Padding(padding: EdgeInsets.fromLTRB(10,10,0,0),
|
|
|
|
|
|
|
|
child: Text('Please select search option',style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 16),),),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
|
|
|
title: Text("Problem", style: TextStyle(fontSize: 10)),
|
|
|
|
|
|
|
|
value: "problem",
|
|
|
|
|
|
|
|
groupValue: searchBy,
|
|
|
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
searchBy = value.toString();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
"Doctor",
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
value: "doctor",
|
|
|
|
|
|
|
|
groupValue: searchBy,
|
|
|
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
searchBy = value.toString();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
|
|
|
title:
|
|
|
|
|
|
|
|
Text("Date", style: TextStyle(fontSize: 10)),
|
|
|
|
|
|
|
|
value: "date",
|
|
|
|
|
|
|
|
groupValue: searchBy,
|
|
|
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
searchBy = value.toString();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible:dropdownSearchType.toString().toLowerCase()=='problem' ,
|
|
|
|
visible:searchBy.toString().toLowerCase()=='problem' ,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
@ -707,7 +821,7 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
),)
|
|
|
|
),)
|
|
|
|
),),
|
|
|
|
),),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible:dropdownSearchType.toString().toLowerCase()=='doctor' ,
|
|
|
|
visible:searchBy.toString().toLowerCase()=='doctor' ,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
@ -772,7 +886,204 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
),)
|
|
|
|
),)
|
|
|
|
),),
|
|
|
|
),),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible:dropdownSearchType.toString().toLowerCase()=='date' ,
|
|
|
|
visible:searchBy.toString().toLowerCase()=='date',
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
//height: 60,
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: TextField(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
|
|
|
controller: fromdateController,
|
|
|
|
|
|
|
|
onChanged: (string) {
|
|
|
|
|
|
|
|
if(string.length>=1){
|
|
|
|
|
|
|
|
//getRecordsByDate(string);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
DateTime? pickedDate = await showDatePicker(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
|
|
|
firstDate: DateTime(1950),
|
|
|
|
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
|
|
|
|
builder: (BuildContext context, Widget? child) {
|
|
|
|
|
|
|
|
return Theme(
|
|
|
|
|
|
|
|
data: ThemeData.dark().copyWith(
|
|
|
|
|
|
|
|
colorScheme: ColorScheme.dark(
|
|
|
|
|
|
|
|
primary: buttonColors,
|
|
|
|
|
|
|
|
onPrimary: Colors.white,
|
|
|
|
|
|
|
|
surface: buttonColors,
|
|
|
|
|
|
|
|
onSurface: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
dialogBackgroundColor: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: child!,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedDate != null) {
|
|
|
|
|
|
|
|
print(pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
|
|
|
|
|
|
|
String formattedDate = DateFormat('dd-MM-yyyy').format(pickedDate);
|
|
|
|
|
|
|
|
print(formattedDate); //formatted date output using intl package => 2021-03-16
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
fromDate=pickedDate;
|
|
|
|
|
|
|
|
fromdateController.text = formattedDate; //set output date to TextField value.
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
getRecordsByDateRange(fromdateController.text,todateController.text);
|
|
|
|
|
|
|
|
} else {}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
|
|
|
Icons.calendar_month,
|
|
|
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
suffixIcon: fromdateController.text!=''?IconButton(
|
|
|
|
|
|
|
|
icon: Icon(
|
|
|
|
|
|
|
|
Icons.clear,
|
|
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
fromdateController.text='';
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
):IconButton(
|
|
|
|
|
|
|
|
icon: Icon(
|
|
|
|
|
|
|
|
Icons.clear,
|
|
|
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
//labelText: 'Search by phone number',
|
|
|
|
|
|
|
|
hintText: 'From date',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(width: 5),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: TextField(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
|
|
|
controller: todateController,
|
|
|
|
|
|
|
|
onChanged: (string) {
|
|
|
|
|
|
|
|
if(string.length>=1){
|
|
|
|
|
|
|
|
//getRecordsByDate(string);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
DateTime? pickedDate = await showDatePicker(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
|
|
|
firstDate: fromDate,
|
|
|
|
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
|
|
|
|
builder: (BuildContext context, Widget? child) {
|
|
|
|
|
|
|
|
return Theme(
|
|
|
|
|
|
|
|
data: ThemeData.dark().copyWith(
|
|
|
|
|
|
|
|
colorScheme: ColorScheme.dark(
|
|
|
|
|
|
|
|
primary: buttonColors,
|
|
|
|
|
|
|
|
onPrimary: Colors.white,
|
|
|
|
|
|
|
|
surface: buttonColors,
|
|
|
|
|
|
|
|
onSurface: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
dialogBackgroundColor: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: child!,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedDate != null) {
|
|
|
|
|
|
|
|
print(
|
|
|
|
|
|
|
|
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
|
|
|
|
|
|
|
String formattedDate =
|
|
|
|
|
|
|
|
DateFormat('dd-MM-yyyy').format(pickedDate);
|
|
|
|
|
|
|
|
print(
|
|
|
|
|
|
|
|
formattedDate); //formatted date output using intl package => 2021-03-16
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
todateController.text = formattedDate; //set output date to TextField value.
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
getRecordsByDateRange(fromdateController.text,todateController.text);
|
|
|
|
|
|
|
|
} else {}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
|
|
|
Icons.calendar_month,
|
|
|
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
suffixIcon: todateController.text!=''?IconButton(
|
|
|
|
|
|
|
|
icon: Icon(
|
|
|
|
|
|
|
|
Icons.clear,
|
|
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
todateController.text='';
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
):IconButton(
|
|
|
|
|
|
|
|
icon: Icon(
|
|
|
|
|
|
|
|
Icons.clear,
|
|
|
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
//labelText: 'Search by phone number',
|
|
|
|
|
|
|
|
hintText: 'To date',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(width: 5),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),),
|
|
|
|
|
|
|
|
/*Visibility(
|
|
|
|
|
|
|
|
visible:searchBy.toString().toLowerCase()=='date' ,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
height: MediaQuery.of(context).size.height * .07,
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
@ -870,45 +1181,9 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),*/
|
|
|
|
Expanded(child: _filtereddata()),
|
|
|
|
Expanded(child: _filtereddata()),
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
|
|
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
|
|
|
radius: 40,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.add,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
/*await Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => AddPrescription()),
|
|
|
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports())).then((value) {
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//showBoreAddingDialog();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
/* Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
'Add Tanks ',
|
|
|
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)*/
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -961,6 +1236,43 @@ class _AllReportsState extends State<AllReports> {
|
|
|
|
strokeWidth: 5.0,
|
|
|
|
strokeWidth: 5.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
): _allreports(),
|
|
|
|
): _allreports(),
|
|
|
|
|
|
|
|
floatingActionButton: Visibility(
|
|
|
|
|
|
|
|
visible:reportsListOriginal.length!=0,
|
|
|
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: buttonColors,
|
|
|
|
|
|
|
|
radius: 40,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.add,
|
|
|
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
/*await Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => AddPrescription()),
|
|
|
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports())).then((value) {
|
|
|
|
|
|
|
|
getAllRecords();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//showBoreAddingDialog();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
/* Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
'Add Tanks ',
|
|
|
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)*/
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|