change augument businessUpdateauguments to businessArguments
This commit is contained in:
@@ -21,25 +21,34 @@ class BuildPatientsList extends StatefulWidget {
|
|||||||
|
|
||||||
class _BuildPatientsListState extends State<BuildPatientsList> {
|
class _BuildPatientsListState extends State<BuildPatientsList> {
|
||||||
Widget isMainMember(int index) {
|
Widget isMainMember(int index) {
|
||||||
|
//var matchRE = RegExp(r'^[a-z]+$');
|
||||||
|
var firstLetterFName = widget.patients[index].first_name[0];
|
||||||
|
var firstLetterLName = widget.patients[index].last_name[0];
|
||||||
|
var fnameStar = '*' * 8;
|
||||||
|
var lnameStar = '*' * 8;
|
||||||
|
|
||||||
if (widget.patients[index].medical_aid_main_member == "Yes") {
|
if (widget.patients[index].medical_aid_main_member == "Yes") {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
|
||||||
Icons.star_border_rounded,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
"${widget.patients[index].first_name} ${widget.patients[index].last_name}",
|
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.star_border_rounded,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Text(
|
return Text(
|
||||||
"${widget.patients[index].first_name} ${widget.patients[index].last_name}",
|
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
),
|
),
|
||||||
@@ -47,6 +56,53 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget hasMedicalAid(int index) {
|
||||||
|
var medAidNoStar = '*' * 8;
|
||||||
|
if (widget.patients[index].medical_aid == "Yes") {
|
||||||
|
return ListTile(
|
||||||
|
title: isMainMember(index),
|
||||||
|
subtitle: Text(
|
||||||
|
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: $medAidNoStar",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
|
arguments: PatientViewArguments(
|
||||||
|
widget.signedInUser, widget.patients[index], "business"));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
trailing: Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return ListTile(
|
||||||
|
title: isMainMember(index),
|
||||||
|
subtitle: Text(
|
||||||
|
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: $medAidNoStar",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
|
arguments: PatientViewArguments(
|
||||||
|
widget.signedInUser, widget.patients[index], "business"));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
trailing: Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
@@ -59,26 +115,7 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
||||||
//print(index);
|
//print(index);
|
||||||
return ListTile(
|
return hasMedicalAid(index);
|
||||||
title: isMainMember(index),
|
|
||||||
subtitle: Text(
|
|
||||||
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: ${widget.patients[index].medical_aid_no}",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
|
||||||
arguments: PatientViewArguments(
|
|
||||||
widget.signedInUser, widget.patients[index], "business"));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
trailing: Icon(
|
|
||||||
Icons.arrow_forward,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
|||||||
() {
|
() {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
'/business-profile',
|
'/business-profile',
|
||||||
arguments: BusinessUpdateArguments(
|
arguments: BusinessArguments(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.businessUser,
|
widget.businessUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
@@ -143,8 +143,14 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
|||||||
Icons.medication,
|
Icons.medication,
|
||||||
"Manage Patient",
|
"Manage Patient",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context)
|
Navigator.of(context).pushNamed(
|
||||||
.pushNamed('/patient-manager', arguments: widget.signedInUser);
|
'/patient-manager',
|
||||||
|
arguments: BusinessArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
widget.businessUser,
|
||||||
|
widget.business,
|
||||||
|
),
|
||||||
|
);
|
||||||
// Navigator.popAndPushNamed(context, '/patient-manager',
|
// Navigator.popAndPushNamed(context, '/patient-manager',
|
||||||
// arguments: widget.userEmail);
|
// arguments: widget.userEmail);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import 'package:patient_manager/objects/business.dart';
|
|||||||
import 'package:patient_manager/objects/businessUser.dart';
|
import 'package:patient_manager/objects/businessUser.dart';
|
||||||
import 'package:patient_manager/objects/patients.dart';
|
import 'package:patient_manager/objects/patients.dart';
|
||||||
|
|
||||||
class BusinessUpdateArguments {
|
class BusinessArguments {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final BusinessUser? businessUser;
|
final BusinessUser? businessUser;
|
||||||
final Business? business;
|
final Business? business;
|
||||||
|
|
||||||
BusinessUpdateArguments(
|
BusinessArguments(
|
||||||
this.signedInUser,
|
this.signedInUser,
|
||||||
this.businessUser,
|
this.businessUser,
|
||||||
this.business,
|
this.business,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import 'package:supertokens_flutter/supertokens.dart';
|
|||||||
import 'package:http/http.dart' as http2;
|
import 'package:http/http.dart' as http2;
|
||||||
|
|
||||||
class ProfileBusinessUpdate extends StatefulWidget {
|
class ProfileBusinessUpdate extends StatefulWidget {
|
||||||
final BusinessUpdateArguments arguments;
|
final BusinessArguments arguments;
|
||||||
//final AppUser signedInUser;
|
//final AppUser signedInUser;
|
||||||
const ProfileBusinessUpdate({
|
const ProfileBusinessUpdate({
|
||||||
super.key,
|
super.key,
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ class RouteGenerator {
|
|||||||
return _errorRoute();
|
return _errorRoute();
|
||||||
|
|
||||||
case '/patient-manager':
|
case '/patient-manager':
|
||||||
if (args is AppUser) {
|
if (args is BusinessArguments) {
|
||||||
//print("route generator: $args");
|
//print("route generator: $args");
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => PatientManager(
|
builder: (_) => PatientManager(
|
||||||
signedInUser: args,
|
arguments: args,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class RouteGenerator {
|
|||||||
return _errorRoute();
|
return _errorRoute();
|
||||||
|
|
||||||
case '/business-profile':
|
case '/business-profile':
|
||||||
if (args is BusinessUpdateArguments) {
|
if (args is BusinessArguments) {
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => ProfileBusinessUpdate(
|
builder: (_) => ProfileBusinessUpdate(
|
||||||
arguments: args,
|
arguments: args,
|
||||||
|
|||||||
Reference in New Issue
Block a user