forked from yaso_meth/mih-project
update authentication with supertokens
This commit is contained in:
BIN
Frontend/patient_manager/images/Logo-01.png
Normal file
BIN
Frontend/patient_manager/images/Logo-01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 442 KiB |
BIN
Frontend/patient_manager/images/Logo-02.png
Normal file
BIN
Frontend/patient_manager/images/Logo-02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 441 KiB |
BIN
Frontend/patient_manager/images/loading1.gif
Normal file
BIN
Frontend/patient_manager/images/loading1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 793 KiB |
BIN
Frontend/patient_manager/images/loading2.gif
Normal file
BIN
Frontend/patient_manager/images/loading2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 793 KiB |
@@ -9,8 +9,12 @@ import 'package:supertokens_flutter/supertokens.dart';
|
||||
|
||||
class PatManAppDrawer extends StatefulWidget {
|
||||
final String userEmail;
|
||||
|
||||
const PatManAppDrawer({super.key, required this.userEmail});
|
||||
final Image logo;
|
||||
const PatManAppDrawer({
|
||||
super.key,
|
||||
required this.userEmail,
|
||||
required this.logo,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PatManAppDrawer> createState() => _PatManAppDrawerState();
|
||||
@@ -19,16 +23,21 @@ class PatManAppDrawer extends StatefulWidget {
|
||||
class _PatManAppDrawerState extends State<PatManAppDrawer> {
|
||||
String endpointUserData = "${AppEnviroment.baseApiUrl}/users/profile/";
|
||||
late Future<AppUser> signedInUser;
|
||||
//late Image logo;
|
||||
|
||||
Future<AppUser> getUserDetails() async {
|
||||
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
||||
var response =
|
||||
await http.get(Uri.parse(endpointUserData + widget.userEmail));
|
||||
// print(response.statusCode);
|
||||
// print(response.body);
|
||||
//print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
return AppUser.fromJson(
|
||||
jsonDecode(response.body) as Map<String, dynamic>);
|
||||
//print("here");
|
||||
String body = response.body;
|
||||
var decodedData = jsonDecode(body);
|
||||
AppUser u = AppUser.fromJson(decodedData as Map<String, dynamic>);
|
||||
//print(u.email);
|
||||
return u;
|
||||
} else {
|
||||
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
@@ -47,206 +56,215 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// precacheImage(
|
||||
// MzanziInnovationHub.of(context)!.theme.logoImage().image, context);
|
||||
return FutureBuilder(
|
||||
future: signedInUser,
|
||||
builder: (BuildContext context, AsyncSnapshot<AppUser> snapshot) {
|
||||
return Drawer(
|
||||
//backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
child: Stack(children: [
|
||||
ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
DrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else if (snapshot.hasData) {
|
||||
return Drawer(
|
||||
//backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
child: Stack(children: [
|
||||
ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
DrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 60,
|
||||
child: widget.logo,
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
"Name: ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Text(
|
||||
"${snapshot.data?.fname} ${snapshot.data?.lname}",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
"Email: ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
"${snapshot.data?.email}",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home_outlined,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Signed Is As:",
|
||||
"Home",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20.0,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor()),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 50.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
"Name: ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Text(
|
||||
"${snapshot.data?.fname} ${snapshot.data?.lname}",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
"Email: ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
"${snapshot.data?.email}",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.primaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
//fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
//Navigator.of(context).pushNamed('/home');
|
||||
Navigator.popAndPushNamed(context, '/home');
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home_outlined,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Home",
|
||||
style: TextStyle(
|
||||
//fontWeight: FontWeight.bold,
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.perm_identity,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Profile",
|
||||
style: TextStyle(
|
||||
//fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
//signedInUser = snapshot.data!;
|
||||
//print("PatManAppDrawer: ${signedInUser.runtimeType}");
|
||||
Navigator.of(context)
|
||||
.pushNamed('/profile', arguments: snapshot.data);
|
||||
},
|
||||
),
|
||||
onTap: () {
|
||||
//Navigator.of(context).pushNamed('/home');
|
||||
Navigator.popAndPushNamed(context, '/home');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.perm_identity,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Profile",
|
||||
style: TextStyle(
|
||||
//fontWeight: FontWeight.bold,
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.logout,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
//signedInUser = snapshot.data!;
|
||||
//print("PatManAppDrawer: ${signedInUser.runtimeType}");
|
||||
Navigator.of(context).pushNamed('/patient-manager/profile',
|
||||
arguments: snapshot.data);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.logout,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Sign Out",
|
||||
style: TextStyle(
|
||||
//fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
const SizedBox(width: 25.0),
|
||||
Text(
|
||||
"Sign Out",
|
||||
style: TextStyle(
|
||||
//fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () async {
|
||||
if (await signOut()) {
|
||||
Navigator.of(context).pushNamed('/');
|
||||
}
|
||||
],
|
||||
),
|
||||
onTap: () async {
|
||||
if (await signOut()) {
|
||||
Navigator.of(context).pushNamed('/');
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 1,
|
||||
right: 1,
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (MzanziInnovationHub.of(context)?.theme.mode ==
|
||||
"Dark") {
|
||||
//darkm = !darkm;
|
||||
MzanziInnovationHub.of(context)!
|
||||
.changeTheme(ThemeMode.light);
|
||||
//print("Dark Mode: $darkm");
|
||||
} else {
|
||||
//darkm = !darkm;
|
||||
MzanziInnovationHub.of(context)!
|
||||
.changeTheme(ThemeMode.dark);
|
||||
//print("Dark Mode: $darkm");
|
||||
}
|
||||
Navigator.of(context).pushNamed('/home');
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 1,
|
||||
right: 1,
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (MzanziInnovationHub.of(context)?.theme.mode == "Dark") {
|
||||
//darkm = !darkm;
|
||||
MzanziInnovationHub.of(context)!
|
||||
.changeTheme(ThemeMode.light);
|
||||
//print("Dark Mode: $darkm");
|
||||
} else {
|
||||
//darkm = !darkm;
|
||||
MzanziInnovationHub.of(context)!
|
||||
.changeTheme(ThemeMode.dark);
|
||||
//print("Dark Mode: $darkm");
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.light_mode,
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
size: 35,
|
||||
icon: Icon(
|
||||
Icons.light_mode,
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
size: 35,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
]),
|
||||
);
|
||||
} else {
|
||||
return const Center(
|
||||
child: Text("Error Loading profile"),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
||||
body: jsonEncode(<String, dynamic>{
|
||||
"fullName":
|
||||
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
|
||||
"docfname": "${appUser.title} ${appUser.fname} ${appUser.lname}",
|
||||
"docfname": "${appUser.type} ${appUser.fname} ${appUser.lname}",
|
||||
"startDate": startDateController.text,
|
||||
"endDate": endDateTextController.text,
|
||||
"returnDate": retDateTextController.text,
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/myDropdownInput.dart';
|
||||
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||
import 'package:patient_manager/components/mySuccessMessage.dart';
|
||||
import 'package:patient_manager/components/myTextInput.dart';
|
||||
import 'package:patient_manager/components/mybutton.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:patient_manager/objects/appUser.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
|
||||
class ProfileUserUpdate extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
@@ -19,25 +23,79 @@ class ProfileUserUpdate extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
||||
final usernameController = TextEditingController();
|
||||
final fnameController = TextEditingController();
|
||||
final lnameController = TextEditingController();
|
||||
final titleController = TextEditingController();
|
||||
|
||||
bool isFieldsFilled() {
|
||||
if (fnameController.text.isEmpty ||
|
||||
lnameController.text.isEmpty ||
|
||||
titleController.text.isEmpty) {
|
||||
usernameController.text.isEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateUserApiCall() async {
|
||||
//print("Here1");
|
||||
//userEmail = getLoginUserEmail() as String;
|
||||
//print(userEmail);
|
||||
//print("Here2");
|
||||
//await getOfficeIdByUser(docOfficeIdApiUrl + userEmail);
|
||||
//print(futureDocOfficeId.toString());
|
||||
//print("Here3");
|
||||
var response = await http.put(
|
||||
Uri.parse("${AppEnviroment.baseApiUrl}/"),
|
||||
headers: <String, String>{
|
||||
"Content-Type": "application/json; charset=UTF-8"
|
||||
},
|
||||
body: jsonEncode(<String, dynamic>{
|
||||
"idusers": widget.signedInUser.idusers,
|
||||
"username": usernameController.text,
|
||||
"fnam": fnameController.text,
|
||||
"lname": lnameController.text,
|
||||
}),
|
||||
);
|
||||
//print("Here4");
|
||||
//print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
Navigator.of(context)
|
||||
.pushNamed('/profile', arguments: widget.signedInUser);
|
||||
String message =
|
||||
"${widget.signedInUser.email}'s information has been updated successfully!";
|
||||
successPopUp(message);
|
||||
} else {
|
||||
internetConnectionPopUp();
|
||||
}
|
||||
}
|
||||
|
||||
void internetConnectionPopUp() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const MyErrorMessage(errorType: "Internet Connection");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void successPopUp(String message) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return MySuccessMessage(
|
||||
successType: "Success",
|
||||
successMessage: message,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
fnameController.text = widget.signedInUser.fname;
|
||||
lnameController.text = widget.signedInUser.lname;
|
||||
titleController.text = widget.signedInUser.title;
|
||||
usernameController.text = widget.signedInUser.username;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -54,6 +112,13 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15.0),
|
||||
MyTextField(
|
||||
controller: usernameController,
|
||||
hintText: "Username",
|
||||
editable: true,
|
||||
required: true,
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
MyTextField(
|
||||
controller: fnameController,
|
||||
hintText: "First Name",
|
||||
@@ -68,13 +133,6 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
||||
required: true,
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
MyDropdownField(
|
||||
controller: titleController,
|
||||
hintText: "Title",
|
||||
dropdownOptions: const <String>["Dr.", "Assistant"],
|
||||
required: true,
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
SizedBox(
|
||||
width: 500.0,
|
||||
height: 100.0,
|
||||
|
||||
@@ -2,31 +2,36 @@
|
||||
class AppUser {
|
||||
final int idusers;
|
||||
final String email;
|
||||
final int docOffice_ID;
|
||||
// ignore: non_constant_identifier_names
|
||||
final int docOffice_id;
|
||||
final String fname;
|
||||
final String lname;
|
||||
final String title;
|
||||
final String type;
|
||||
// ignore: non_constant_identifier_names
|
||||
final String app_id;
|
||||
final String username;
|
||||
|
||||
const AppUser(
|
||||
this.idusers,
|
||||
this.email,
|
||||
this.docOffice_ID,
|
||||
this.docOffice_id,
|
||||
this.fname,
|
||||
this.lname,
|
||||
this.title,
|
||||
this.type,
|
||||
this.app_id,
|
||||
this.username,
|
||||
);
|
||||
|
||||
factory AppUser.fromJson(dynamic json) {
|
||||
return AppUser(
|
||||
json['idusers'],
|
||||
json['email'],
|
||||
json['docOffice_ID'],
|
||||
json['docOffice_id'],
|
||||
json['fname'],
|
||||
json['lname'],
|
||||
json['title'],
|
||||
json['type'],
|
||||
json['app_id'],
|
||||
json['username'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/patManAppDrawer.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
import 'package:patient_manager/components/homeTileGrid.dart';
|
||||
import 'package:patient_manager/components/myAppBar.dart';
|
||||
import 'package:patient_manager/components/homeAppDrawer.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:supertokens_flutter/supertokens.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
|
||||
@@ -20,6 +21,26 @@ class Home extends StatefulWidget {
|
||||
class _HomeState extends State<Home> {
|
||||
String useremail = "";
|
||||
final baseAPI = AppEnviroment.baseApiUrl;
|
||||
//late Image logo;
|
||||
|
||||
Future<void> loadImage() async {
|
||||
try {
|
||||
// load network image example
|
||||
var t = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
await precacheImage(t.image, context);
|
||||
// setState(() {
|
||||
//return MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
// });
|
||||
|
||||
// or
|
||||
// Load assets image example
|
||||
// await precacheImage(AssetImage(imagePath), context);
|
||||
//print('Image loaded and cached successfully!');
|
||||
} catch (e) {
|
||||
//return null;
|
||||
print('Failed to load and cache the image: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getUserEmail() async {
|
||||
var uid = await SuperTokens.getUserId();
|
||||
@@ -42,12 +63,13 @@ class _HomeState extends State<Home> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
loadImage();
|
||||
var logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
return FutureBuilder(
|
||||
future: getUserEmail(),
|
||||
builder: (contexts, snapshot) {
|
||||
@@ -55,7 +77,10 @@ class _HomeState extends State<Home> {
|
||||
//print("home page: $useremail");
|
||||
return Scaffold(
|
||||
appBar: const MyAppBar(barTitle: "Mzansi Innovation Hub"),
|
||||
drawer: HomeAppDrawer(userEmail: useremail),
|
||||
drawer: PatManAppDrawer(
|
||||
userEmail: useremail,
|
||||
logo: logo,
|
||||
), //HomeAppDrawer(userEmail: useremail),
|
||||
body: HomeTileGrid(
|
||||
userEmail: useremail,
|
||||
),
|
||||
|
||||
@@ -50,7 +50,7 @@ class _AddPatientState extends State<AddPatient> {
|
||||
var decodedData = jsonDecode(body);
|
||||
AppUser u = AppUser.fromJson(decodedData as Map<String, dynamic>);
|
||||
setState(() {
|
||||
futureDocOfficeId = u.docOffice_ID;
|
||||
futureDocOfficeId = u.docOffice_id;
|
||||
//print(futureDocOfficeId);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,7 @@ class _EditPatientState extends State<EditPatient> {
|
||||
var decodedData = jsonDecode(body);
|
||||
AppUser u = AppUser.fromJson(decodedData as Map<String, dynamic>);
|
||||
setState(() {
|
||||
futureDocOfficeId = u.docOffice_ID;
|
||||
futureDocOfficeId = u.docOffice_id;
|
||||
//print(futureDocOfficeId);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,8 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/buildPatientList.dart';
|
||||
import 'package:patient_manager/components/myAppBar.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
//import 'package:http/http.dart' as http;
|
||||
import 'package:patient_manager/components/mySearchInput.dart';
|
||||
import 'package:patient_manager/components/patManAppDrawer.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
@@ -36,9 +37,9 @@ class _PatientManagerState extends State<PatientManager> {
|
||||
Future<List<Patient>> fetchPatients(String endpoint) async {
|
||||
//print("Patien manager page: $endpoint");
|
||||
final response = await http.get(Uri.parse(endpoint));
|
||||
// print("Here");
|
||||
// print("Body: ${response.body}");
|
||||
// print("Code: {response.statusCode}");
|
||||
print("Here");
|
||||
print("Body: ${response.body}");
|
||||
print("Code: ${response.statusCode}");
|
||||
errorCode = response.statusCode.toString();
|
||||
errorBody = response.body;
|
||||
|
||||
@@ -239,7 +240,10 @@ class _PatientManagerState extends State<PatientManager> {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
return Scaffold(
|
||||
appBar: const MyAppBar(barTitle: "Patient Manager"),
|
||||
drawer: PatManAppDrawer(userEmail: widget.userEmail),
|
||||
drawer: PatManAppDrawer(
|
||||
userEmail: widget.userEmail,
|
||||
logo: MzanziInnovationHub.of(context)!.theme.logoImage(),
|
||||
),
|
||||
//floatingActionButtonLocation: FloatingActionButtonLocation.,
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
label: Text(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_nav_bar/google_nav_bar.dart';
|
||||
import 'package:patient_manager/components/myAppBar.dart';
|
||||
import 'package:patient_manager/components/profileOfficeUpdate.dart';
|
||||
import 'package:patient_manager/components/profileUserUpdate.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:patient_manager/objects/appUser.dart';
|
||||
|
||||
class ProfileUpdate extends StatefulWidget {
|
||||
@@ -20,7 +18,7 @@ class ProfileUpdate extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfileUpdateState extends State<ProfileUpdate> {
|
||||
int _selectedIndex = 0;
|
||||
//int _selectedIndex = 0;
|
||||
late List<Widget> _widgetOptions;
|
||||
|
||||
@override
|
||||
@@ -42,34 +40,34 @@ class _ProfileUpdateState extends State<ProfileUpdate> {
|
||||
return Scaffold(
|
||||
appBar: const MyAppBar(barTitle: "Update Profile"),
|
||||
body: Center(
|
||||
child: _widgetOptions.elementAt(_selectedIndex),
|
||||
),
|
||||
bottomNavigationBar: GNav(
|
||||
//hoverColor: Colors.lightBlueAccent,
|
||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
iconSize: 35.0,
|
||||
activeColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
tabBackgroundColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
//gap: 20,
|
||||
//padding: EdgeInsets.all(15),
|
||||
tabs: const [
|
||||
GButton(
|
||||
icon: Icons.perm_identity,
|
||||
text: "User Profile",
|
||||
),
|
||||
GButton(
|
||||
icon: Icons.business,
|
||||
text: "Office Profile",
|
||||
),
|
||||
],
|
||||
selectedIndex: _selectedIndex,
|
||||
onTabChange: (index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
},
|
||||
child: _widgetOptions.elementAt(0),
|
||||
),
|
||||
// bottomNavigationBar: GNav(
|
||||
// //hoverColor: Colors.lightBlueAccent,
|
||||
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
// iconSize: 35.0,
|
||||
// activeColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// tabBackgroundColor:
|
||||
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
// //gap: 20,
|
||||
// //padding: EdgeInsets.all(15),
|
||||
// tabs: const [
|
||||
// GButton(
|
||||
// icon: Icons.perm_identity,
|
||||
// text: "User Profile",
|
||||
// ),
|
||||
// GButton(
|
||||
// icon: Icons.business,
|
||||
// text: "Office Profile",
|
||||
// ),
|
||||
// ],
|
||||
// selectedIndex: _selectedIndex,
|
||||
// onTabChange: (index) {
|
||||
// setState(() {
|
||||
// _selectedIndex = index;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,9 @@ class _SignInState extends State<SignIn> {
|
||||
return AlertDialog(
|
||||
backgroundColor: _backgroundColor,
|
||||
content: Container(
|
||||
child: Center(
|
||||
child: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.loadingImage(), // Put your gif into the assets folder
|
||||
child: const Center(
|
||||
child:
|
||||
CircularProgressIndicator(), // Put your gif into the assets folder
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ class RouteGenerator {
|
||||
}
|
||||
return _errorRoute();
|
||||
|
||||
case '/patient-manager/profile':
|
||||
case '/profile':
|
||||
if (args is AppUser) {
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => ProfileUpdate(signedInUser: args),
|
||||
|
||||
@@ -102,15 +102,27 @@ class MyTheme {
|
||||
return Color(_succColor);
|
||||
}
|
||||
|
||||
Image logoImage() {
|
||||
if (mode == "Dark") {
|
||||
return Image.asset(
|
||||
'images/Logo-01.png',
|
||||
);
|
||||
} else {
|
||||
return Image.asset(
|
||||
'images/Logo-02.png',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Image loadingImage() {
|
||||
if (mode == "Dark") {
|
||||
loading = Image.asset(
|
||||
'images/Logo-loading.gif',
|
||||
'images/loading2.gif',
|
||||
width: 100,
|
||||
);
|
||||
} else {
|
||||
loading = Image.asset(
|
||||
'images/Logo-loading.gif',
|
||||
'images/loading1.gif',
|
||||
width: 100,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ flutter:
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- images/Logo-loading.gif
|
||||
- images/
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
|
||||
26
temp.pdf
26
temp.pdf
@@ -17,17 +17,17 @@ endobj
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/BitsPerComponent 8 /ColorSpace /DeviceRGB /Filter [ /ASCII85Decode /FlateDecode ] /Height 100 /Length 1054 /Subtype /Image
|
||||
/BitsPerComponent 8 /ColorSpace /DeviceRGB /Filter [ /ASCII85Decode /FlateDecode ] /Height 100 /Length 1059 /Subtype /Image
|
||||
/Type /XObject /Width 100
|
||||
>>
|
||||
stream
|
||||
Gb"/bbAP3O&-Mh05FpY@Odq[V'TKZDonne2r-EJio<U;H,eBM5?<s5m@G/QN:M-H9,*UYg\W:;lWQsn*lpe"\.]Xu`eX#X;RX/NTi'8;_eorKbA]=%S@HCeSRJ5ghQ&%IL/#,pAs,5DaN-C-;^"mcPm?[KX[Bs/pQdsN%H*>*'$srkC=8.0Yh*'mBodq]N=/GHi=WQ@Kc>KiSakO,\DkG&7USCNChH.>S/)SZS]PYfKc^1n7H!j-es(2L7>skX]YTqYYG,+KSqsRphA.8Q\`m]6@s'5A?-9aZ\7AS)+XJ.n[k/DW?W=Fl2\;rEQ;cZ"S=hW6*rO.dTl99rX!;uqZ4[K;%ass^n>f`u:Lm:$pH"+F"A4jgc?;nt3'aaKNXC>?M546,QMVi`-8!=V+.k;[EXE_Ae<iY2'a<gWk[65OOBc*l1B_jtpIS$1uCEEl"iVUOF,R+bi9qsnZ;bY^?0K+d(_aDnO&+(&E[6KUE@`26Nqd*mEO-O-9%jC5&eZs=#9j.9n*st7"k[/2FL9gQB_G]:-$?l&Mi#+1j<t(o-pLV><A]=C-L3a4X7fop]VudYlqT?n:QW7Q"9jpO)gR!UN]\9fq\h>S*[]F^WfEc(f$qKaJ9Qc+!Q/+9Op[T3EWiQ[R/Cia/YLHkqF!#PG]lJ\oT$0fLjR08%hL1'cD+F;2`V3rOYodPeL/I0m4_,2;Wu06NUadlMA]8:X*/9FH*bL'F)6-[8ToWJ[)m!Fl,sL/*;Ta2?Ytc8O^9#K"Qec-d]>IN#9T1][1R1rsr7A6clBKil5j<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6<XVsbKr9M`a"YGU1smpN=_1(#rNc!8AECd1%/p`0*Ik57Y4"&f=d>9"\\A(d/)u)c]=P%B?3bY7=3;g!nL^f:+H-O1HLZ\XUSnjDhrd8%XS=o8e]kJ50YGBP2q%20UCMc$;c\:;bXuH\fl8V-=n+A:G-i>aq._DW>4B:7jk[JWddd4>P[B(20orMF<b2HtX]VQN^D<lLGjnPKpA/?#<\VPNZL[m337<NUaLA7\0.B!M^4%G:YA%KL(#.@1p!m+l?<1h:iN/o_lQ11XB'&I8`RYVr=i'^5ZI6"gIci]j!!,i2m/~>endstream
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Contents 9 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 8 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /XObject <<
|
||||
/FormXob.225dfdaa579e83c5c861653a8b5bf7bc 4 0 R
|
||||
/FormXob.e919eed7a784fdab58f5ae41a6cfed93 4 0 R
|
||||
>>
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
@@ -42,7 +42,7 @@ endobj
|
||||
endobj
|
||||
7 0 obj
|
||||
<<
|
||||
/Author (anonymous) /CreationDate (D:20240713082604+00'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20240713082604+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||
/Author (anonymous) /CreationDate (D:20240723125521+00'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20240723125521+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||
/Subject (unspecified) /Title (untitled) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
@@ -53,10 +53,10 @@ endobj
|
||||
endobj
|
||||
9 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 447
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 449
|
||||
>>
|
||||
stream
|
||||
Gas2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 00000 n
|
||||
0000001912 00000 n
|
||||
0000002208 00000 n
|
||||
0000002267 00000 n
|
||||
0000001583 00000 n
|
||||
0000001849 00000 n
|
||||
0000001917 00000 n
|
||||
0000002213 00000 n
|
||||
0000002272 00000 n
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<19735eb2bf13a11947b390c577b55c6e><19735eb2bf13a11947b390c577b55c6e>]
|
||||
[<63be5818c448f92ab084bb85cde6d215><63be5818c448f92ab084bb85cde6d215>]
|
||||
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||
|
||||
/Info 7 0 R
|
||||
@@ -81,5 +81,5 @@ trailer
|
||||
/Size 10
|
||||
>>
|
||||
startxref
|
||||
2804
|
||||
2811
|
||||
%%EOF
|
||||
|
||||
Reference in New Issue
Block a user