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( arguments: PatientViewArguments(
widget.arguments.signedInUser, widget.arguments.signedInUser,
snapshot.requireData, snapshot.requireData,
null,
null,
widget.arguments.type, 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).pop(); Navigator.of(context).pop();
Navigator.of(context).pushNamed('/patient-manager/patient', Navigator.of(context).pushNamed('/patient-manager/patient',
arguments: PatientViewArguments( arguments: PatientViewArguments(widget.signedInUser,
widget.signedInUser, widget.selectedPatient, "business")); widget.selectedPatient, null, null, "business"));
// Navigator.of(context) // Navigator.of(context)
// .pushNamed('/patient-profile', arguments: widget.signedInUser); // .pushNamed('/patient-profile', arguments: widget.signedInUser);
// setState(() {}); // setState(() {});

View File

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

View File

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

View File

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

View File

@@ -271,6 +271,8 @@ class _PatientManagerState extends State<PatientManager> {
child: BuildPatientQueueList( child: BuildPatientQueueList(
patientQueue: patientQueueList, patientQueue: patientQueueList,
signedInUser: widget.arguments.signedInUser, 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; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// loadImage(); // loadImage();
@@ -109,6 +100,8 @@ class _PatientViewState extends State<PatientView> {
patientIndex: snapshot.data!.idpatients, patientIndex: snapshot.data!.idpatients,
selectedPatient: snapshot.data!, selectedPatient: snapshot.data!,
signedInUser: widget.arguments.signedInUser, signedInUser: widget.arguments.signedInUser,
business: widget.arguments.business,
businessUser: widget.arguments.businessUser,
type: widget.arguments.type, type: widget.arguments.type,
), ),
) )

View File

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