change augument businessUpdateauguments to businessArguments

This commit is contained in:
2024-08-12 12:25:22 +02:00
parent 669e640668
commit a4d811bdc4
5 changed files with 78 additions and 35 deletions

View File

@@ -21,25 +21,34 @@ class BuildPatientsList extends StatefulWidget {
class _BuildPatientsListState extends State<BuildPatientsList> {
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") {
return Row(
mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.star_border_rounded,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
Text(
"${widget.patients[index].first_name} ${widget.patients[index].last_name}",
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
const SizedBox(
width: 10,
),
Icon(
Icons.star_border_rounded,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
],
);
} else {
return Text(
"${widget.patients[index].first_name} ${widget.patients[index].last_name}",
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
style: TextStyle(
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
Widget build(BuildContext context) {
return ListView.separated(
@@ -59,26 +115,7 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
itemBuilder: (context, index) {
//final patient = widget.patients[index].id_no.contains(widget.searchString);
//print(index);
return ListTile(
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(),
),
);
return hasMedicalAid(index);
},
);
}

View File

@@ -125,7 +125,7 @@ class _HomeTileGridState extends State<HomeTileGrid> {
() {
Navigator.of(context).pushNamed(
'/business-profile',
arguments: BusinessUpdateArguments(
arguments: BusinessArguments(
widget.signedInUser,
widget.businessUser,
widget.business,
@@ -143,8 +143,14 @@ class _HomeTileGridState extends State<HomeTileGrid> {
Icons.medication,
"Manage Patient",
() {
Navigator.of(context)
.pushNamed('/patient-manager', arguments: widget.signedInUser);
Navigator.of(context).pushNamed(
'/patient-manager',
arguments: BusinessArguments(
widget.signedInUser,
widget.businessUser,
widget.business,
),
);
// Navigator.popAndPushNamed(context, '/patient-manager',
// arguments: widget.userEmail);
}

View File

@@ -3,12 +3,12 @@ import 'package:patient_manager/objects/business.dart';
import 'package:patient_manager/objects/businessUser.dart';
import 'package:patient_manager/objects/patients.dart';
class BusinessUpdateArguments {
class BusinessArguments {
final AppUser signedInUser;
final BusinessUser? businessUser;
final Business? business;
BusinessUpdateArguments(
BusinessArguments(
this.signedInUser,
this.businessUser,
this.business,

View File

@@ -19,7 +19,7 @@ import 'package:supertokens_flutter/supertokens.dart';
import 'package:http/http.dart' as http2;
class ProfileBusinessUpdate extends StatefulWidget {
final BusinessUpdateArguments arguments;
final BusinessArguments arguments;
//final AppUser signedInUser;
const ProfileBusinessUpdate({
super.key,

View File

@@ -38,11 +38,11 @@ class RouteGenerator {
return _errorRoute();
case '/patient-manager':
if (args is AppUser) {
if (args is BusinessArguments) {
//print("route generator: $args");
return MaterialPageRoute(
builder: (_) => PatientManager(
signedInUser: args,
arguments: args,
),
);
}
@@ -89,7 +89,7 @@ class RouteGenerator {
return _errorRoute();
case '/business-profile':
if (args is BusinessUpdateArguments) {
if (args is BusinessArguments) {
return MaterialPageRoute(
builder: (_) => ProfileBusinessUpdate(
arguments: args,