update patient view arguments to include business & business user

This commit is contained in:
2024-08-19 20:44:11 +02:00
parent 351ce0d6a7
commit d1f0d9045d
10 changed files with 44 additions and 20 deletions

View File

@@ -61,6 +61,8 @@ class _AddOrViewPatientState extends State<AddOrViewPatient> {
arguments: PatientViewArguments(
widget.arguments.signedInUser,
snapshot.requireData,
null,
null,
widget.arguments.type,
));
}

View File

@@ -110,8 +110,8 @@ class _BuildFilesListState extends State<BuildFilesList> {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pushNamed('/patient-manager/patient',
arguments: PatientViewArguments(
widget.signedInUser, widget.selectedPatient, "business"));
arguments: PatientViewArguments(widget.signedInUser,
widget.selectedPatient, null, null, "business"));
// Navigator.of(context)
// .pushNamed('/patient-profile', arguments: widget.signedInUser);
// setState(() {});

View File

@@ -6,6 +6,8 @@ import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/arguments.dart';
import 'package:patient_manager/objects/business.dart';
import 'package:patient_manager/objects/businessUser.dart';
import 'package:patient_manager/objects/patientQueue.dart';
import 'package:patient_manager/objects/patients.dart';
import 'package:supertokens_flutter/http.dart' as http;
@@ -13,11 +15,15 @@ import 'package:supertokens_flutter/http.dart' as http;
class BuildPatientQueueList extends StatefulWidget {
final List<PatientQueue> patientQueue;
final AppUser signedInUser;
final Business? business;
final BusinessUser? businessUser;
const BuildPatientQueueList({
super.key,
required this.patientQueue,
required this.signedInUser,
required this.business,
required this.businessUser,
});
@override
@@ -66,8 +72,8 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
if (widget.patientQueue[index].medical_aid_no == "") {
subtitle += "No Medical Aid";
} else {
subtitle +=
"Name: $fname $lname\nID No.: ${widget.patientQueue[index].id_no}\nMedical Aid No: ";
// subtitle +=
// "\nMedical Aid No: ";
subtitle += widget.patientQueue[index].medical_aid_no;
}
}
@@ -91,8 +97,8 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
onTap: () {
var todayDate = DateTime.now();
var revokeDate = DateTime.parse(widget.patientQueue[index].revoke_date);
print(
"Todays: $todayDate\nRevoke Date: $revokeDate\nHas revoke date passed: ${revokeDate.isBefore(todayDate)}");
// print(
// "Todays: $todayDate\nRevoke Date: $revokeDate\nHas revoke date passed: ${revokeDate.isBefore(todayDate)}");
if (revokeDate.isBefore(todayDate)) {
expiredAccessWarning();
} else if (widget.patientQueue[index].access != "pending") {
@@ -103,7 +109,12 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
selectedPatient = result;
Navigator.of(context).pushNamed('/patient-manager/patient',
arguments: PatientViewArguments(
widget.signedInUser, selectedPatient, "business"));
widget.signedInUser,
selectedPatient,
widget.businessUser,
widget.business,
"business",
));
});
},
);

View File

@@ -108,8 +108,8 @@ class _HomeTileGridState extends State<HomeTileGrid> {
() {
//comeback here
Navigator.of(context).pushNamed('/patient-profile',
arguments:
PatientViewArguments(widget.signedInUser, null, "personal"));
arguments: PatientViewArguments(
widget.signedInUser, null, null, null, "personal"));
// Navigator.popAndPushNamed(context, '/patient-manager',
// arguments: widget.userEmail);
}

View File

@@ -20,7 +20,7 @@ class _MedcertinputState extends State<Medcertinput> {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 325,
//height: 325,
child: Column(
children: [
const SizedBox(height: 50.0),

View File

@@ -14,6 +14,8 @@ import 'package:patient_manager/components/prescipInput.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/business.dart';
import 'package:patient_manager/objects/businessUser.dart';
import 'package:patient_manager/objects/files.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:http/http.dart' as http2;
@@ -25,12 +27,17 @@ class PatientFiles extends StatefulWidget {
final int patientIndex;
final Patient selectedPatient;
final AppUser signedInUser;
final Business? business;
final BusinessUser? businessUser;
final String type;
const PatientFiles({
super.key,
required this.patientIndex,
required this.selectedPatient,
required this.signedInUser,
required this.business,
required this.businessUser,
required this.type,
});
@@ -78,7 +85,7 @@ class _PatientFilesState extends State<PatientFiles> {
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{
"app_id": widget.signedInUser.app_id,
"app_id": widget.selectedPatient.app_id,
"fullName":
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
"docfname":
@@ -86,6 +93,8 @@ class _PatientFilesState extends State<PatientFiles> {
"startDate": startDateController.text,
"endDate": endDateTextController.text,
"returnDate": retDateTextController.text,
"logo_path": widget.business!.logo_path,
"sig_path": widget.businessUser!.sig_path,
}),
);
//print(response1.statusCode);
@@ -268,6 +277,7 @@ class _PatientFilesState extends State<PatientFiles> {
endDateTextController: endDateTextController,
retDateTextController: retDateTextController,
),
const SizedBox(height: 30.0),
SizedBox(
width: 300,
height: 50,

View File

@@ -18,11 +18,15 @@ class BusinessArguments {
class PatientViewArguments {
final AppUser signedInUser;
final Patient? selectedPatient;
final BusinessUser? businessUser;
final Business? business;
final String type;
PatientViewArguments(
this.signedInUser,
this.selectedPatient,
this.businessUser,
this.business,
this.type,
);
}

View File

@@ -271,6 +271,8 @@ class _PatientManagerState extends State<PatientManager> {
child: BuildPatientQueueList(
patientQueue: patientQueueList,
signedInUser: widget.arguments.signedInUser,
business: widget.arguments.business,
businessUser: widget.arguments.businessUser,
),
);
}

View File

@@ -48,15 +48,6 @@ class _PatientViewState extends State<PatientView> {
return null;
}
// Future<void> loadImage() async {
// try {
// var t = MzanziInnovationHub.of(context)!.theme.logoImage();
// await precacheImage(t.image, context);
// } catch (e) {
// print('Failed to load and cache the image: $e');
// }
// }
@override
Widget build(BuildContext context) {
// loadImage();
@@ -109,6 +100,8 @@ class _PatientViewState extends State<PatientView> {
patientIndex: snapshot.data!.idpatients,
selectedPatient: snapshot.data!,
signedInUser: widget.arguments.signedInUser,
business: widget.arguments.business,
businessUser: widget.arguments.businessUser,
type: widget.arguments.type,
),
)

View File

@@ -108,6 +108,8 @@ class _PatientViewState extends State<PatientViewPersonal> {
patientIndex: snapshot.data!.idpatients,
selectedPatient: snapshot.data!,
signedInUser: widget.arguments.signedInUser,
business: widget.arguments.business,
businessUser: widget.arguments.businessUser,
type: widget.arguments.type,
),
)