Merge pull request #30 from yaso-meth/patient-profile-fix-v2

Patient-profile-fix-v2
This commit is contained in:
yaso-meth
2024-12-18 11:29:00 +02:00
committed by GitHub
5 changed files with 102 additions and 24 deletions

View File

@@ -46,6 +46,7 @@ class MIHApiCalls {
AppUser userData;
Business? busData;
BusinessUser? bUserData;
Patient? patientData;
List<MIHNotification> notifi;
String userPic;
@@ -129,8 +130,30 @@ class MIHApiCalls {
notifi = [];
}
//get patient profile
//print("Patien manager page: $endpoint");
final response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/patients/${userData.app_id}"));
// print("Here");
// print("Body: ${response.body}");
// print("Code: ${response.statusCode}");
// var errorCode = response.statusCode.toString();
// var errorBody = response.body;
if (response.statusCode == 200) {
print("Here1");
var decodedData = jsonDecode(response.body);
print("Here2");
Patient patients = Patient.fromJson(decodedData as Map<String, dynamic>);
print("Here3");
print(patients);
patientData = patients;
} else {
patientData = null;
}
//print(userPic);
return HomeArguments(userData, bUserData, busData, notifi, userPic);
return HomeArguments(
userData, bUserData, busData, patientData, notifi, userPic);
}
/// This function is used to get business details by business _id.

View File

@@ -35,6 +35,7 @@ class HomeArguments {
final AppUser signedInUser;
final BusinessUser? businessUser;
final Business? business;
final Patient? patient;
final List<MIHNotification> notifi;
final String profilePicUrl;
@@ -42,6 +43,7 @@ class HomeArguments {
this.signedInUser,
this.businessUser,
this.business,
this.patient,
this.notifi,
this.profilePicUrl,
);

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
// import 'dart:convert';
import 'package:Mzansi_Innovation_Hub/mih_objects/patients.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
@@ -43,6 +44,7 @@ class MIHHome extends StatefulWidget {
final AppUser signedInUser;
final BusinessUser? businessUser;
final Business? business;
final Patient? patient;
final List<MIHNotification> notifications;
final ImageProvider<Object>? propicFile;
final bool isUserNew;
@@ -55,6 +57,7 @@ class MIHHome extends StatefulWidget {
required this.signedInUser,
required this.businessUser,
required this.business,
required this.patient,
required this.notifications,
required this.propicFile,
required this.isUserNew,
@@ -169,29 +172,78 @@ class _MIHHomeState extends State<MIHHome> {
p: getPrim(),
s: getSec(),
));
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile',
arguments: PatientViewArguments(
widget.signedInUser, null, null, null, "personal"));
},
tileName: "Patient Profile",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
print("Pat Prof: ${widget.patient}");
if (widget.patient != null) {
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile',
arguments: PatientViewArguments(
widget.signedInUser, null, null, null, "personal"));
},
tileName: "Patient Profile",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
),
),
),
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
} else {
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile/set-up',
arguments: widget.signedInUser);
},
tileName: "Set Up Patient",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
),
),
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
}
// tileList.add(MIHTile(
// videoID: "NUDdoWrbXNc",
// onTap: () {
// Navigator.of(context).pushNamed('/patient-profile',
// arguments: PatientViewArguments(
// widget.signedInUser, null, null, null, "personal"));
// },
// tileName: "Patient Profile",
// tileIcon: Center(
// child: FaIcon(
// FontAwesomeIcons.bookMedical,
// color: getSec(),
// size: 200,
// ),
// ),
// // Icon(
// // Icons.medication,
// // color: getSec(),
// // size: 200,
// // ),
// p: getPrim(),
// s: getSec(),
// ));
tileList.add(MIHTile(
onTap: () {
Navigator.of(context).pushNamed(

View File

@@ -99,6 +99,7 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
signedInUser: snapshot.requireData.signedInUser,
businessUser: snapshot.data!.businessUser,
business: snapshot.data!.business,
patient: snapshot.data!.patient,
notifications: snapshot.data!.notifi,
propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
isUserNew: isUserNew(snapshot.requireData.signedInUser),

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+9
version: 1.0.1+1
environment:
sdk: '>=3.2.4 <4.0.0'