Merge pull request #123 from yaso-meth/NEW--new-home-screen-set-up-account-business-and-patient
NEW--new-home-screen-set-up-account-business-and-patient
This commit is contained in:
@@ -47,7 +47,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
'/user-profile',
|
||||
'/mzansi-profile',
|
||||
arguments: AppProfileUpdateArguments(
|
||||
widget.signedInUser, widget.propicFile),
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ class MihHome extends StatefulWidget {
|
||||
|
||||
class _MihHomeState extends State<MihHome> {
|
||||
final proPicController = TextEditingController();
|
||||
int _selcetedIndex = 0;
|
||||
late int _selcetedIndex;
|
||||
late bool _personalSelected;
|
||||
|
||||
@override
|
||||
@@ -57,7 +57,18 @@ class _MihHomeState extends State<MihHome> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_personalSelected = widget.personalSelected;
|
||||
|
||||
if (widget.personalSelected == true) {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
_personalSelected = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_selcetedIndex = 1;
|
||||
_personalSelected = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -69,15 +80,14 @@ class _MihHomeState extends State<MihHome> {
|
||||
actionDrawer: getActionDrawer(),
|
||||
selectedbodyIndex: _selcetedIndex,
|
||||
onIndexChange: (newValue) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
});
|
||||
if (newValue == 0) {
|
||||
if (_selcetedIndex == 0) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = false;
|
||||
});
|
||||
}
|
||||
@@ -121,12 +131,14 @@ class _MihHomeState extends State<MihHome> {
|
||||
temp[const Icon(Icons.person)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
_personalSelected = true;
|
||||
});
|
||||
};
|
||||
if (widget.isBusinessUser) {
|
||||
temp[const Icon(Icons.business_center)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 1;
|
||||
_personalSelected = false;
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -145,6 +157,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
propicFile: widget.propicFile,
|
||||
isUserNew: widget.isUserNew,
|
||||
),
|
||||
);
|
||||
if (widget.isBusinessUser) {
|
||||
@@ -154,6 +167,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
personalSelected: _personalSelected,
|
||||
businessUser: widget.businessUser,
|
||||
business: widget.business,
|
||||
isBusinessUserNew: widget.isBusinessUserNew,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class _MIHHomeLegacyState extends State<MIHHomeLegacy> {
|
||||
tileList.add(MIHTile(
|
||||
videoID: "jFV3NN65DtQ",
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed('/user-profile',
|
||||
Navigator.of(context).pushNamed('/mzansi-profile',
|
||||
arguments: AppProfileUpdateArguments(
|
||||
widget.signedInUser, widget.propicFile));
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:Mzansi_Innovation_Hub/mih_packages/calculator/package_tiles/mih_
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_business_profile_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/patient_profile/pat_manager/package_tiles/pat_manager_tile.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -20,12 +21,14 @@ class MihBusinessHome extends StatefulWidget {
|
||||
final bool personalSelected;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final bool isBusinessUserNew;
|
||||
const MihBusinessHome({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.personalSelected,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.isBusinessUserNew,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -39,6 +42,17 @@ class _MihBusinessHomeState extends State<MihBusinessHome> {
|
||||
ValueNotifier([]);
|
||||
double packageSize = 200;
|
||||
|
||||
List<Map<String, Widget>> setNewBusinessUserPackages() {
|
||||
List<Map<String, Widget>> temp = [];
|
||||
temp.add({
|
||||
"Setup Business": MzansiSetupBusinessProfileTile(
|
||||
signedInUser: widget.signedInUser,
|
||||
packageSize: packageSize,
|
||||
)
|
||||
});
|
||||
return temp;
|
||||
}
|
||||
|
||||
List<Map<String, Widget>> setBusinessPackages() {
|
||||
List<Map<String, Widget>> temp = [];
|
||||
//=============== Biz Profile ===============
|
||||
@@ -137,7 +151,11 @@ class _MihBusinessHomeState extends State<MihBusinessHome> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
searchController.addListener(searchPackage);
|
||||
businessPackagesMap = setBusinessPackages();
|
||||
if (widget.isBusinessUserNew) {
|
||||
businessPackagesMap = setNewBusinessUserPackages();
|
||||
} else {
|
||||
businessPackagesMap = setBusinessPackages();
|
||||
}
|
||||
searchPackage();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:Mzansi_Innovation_Hub/mih_packages/calculator/package_tiles/mih_
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_profile_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/package_tiles/mih_wallet_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/patient_profile/pat_profile/package_tiles/patient_profile_tile.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -23,6 +24,7 @@ class MihPersonalHome extends StatefulWidget {
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final ImageProvider<Object>? propicFile;
|
||||
final bool isUserNew;
|
||||
|
||||
const MihPersonalHome({
|
||||
super.key,
|
||||
@@ -31,6 +33,7 @@ class MihPersonalHome extends StatefulWidget {
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.propicFile,
|
||||
required this.isUserNew,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -44,6 +47,18 @@ class _MihPersonalHomeState extends State<MihPersonalHome> {
|
||||
ValueNotifier([]);
|
||||
double packageSize = 200;
|
||||
|
||||
List<Map<String, Widget>> setNerUserPersonalPackage() {
|
||||
List<Map<String, Widget>> temp = [];
|
||||
temp.add({
|
||||
"Setup Profile": MzansiSetupProfileTile(
|
||||
signedInUser: widget.signedInUser,
|
||||
propicFile: widget.propicFile,
|
||||
packageSize: packageSize,
|
||||
)
|
||||
});
|
||||
return temp;
|
||||
}
|
||||
|
||||
List<Map<String, Widget>> setPersonalPackagesMap() {
|
||||
List<Map<String, Widget>> temp = [];
|
||||
//=============== Mzansi Profile ===============
|
||||
@@ -154,7 +169,11 @@ class _MihPersonalHomeState extends State<MihPersonalHome> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
searchController.addListener(searchPackage);
|
||||
personalPackagesMap = setPersonalPackagesMap();
|
||||
if (widget.isUserNew) {
|
||||
personalPackagesMap = setNerUserPersonalPackage();
|
||||
} else {
|
||||
personalPackagesMap = setPersonalPackagesMap();
|
||||
}
|
||||
searchPackage();
|
||||
}
|
||||
|
||||
@@ -193,7 +212,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome> {
|
||||
child: SizedBox(
|
||||
child: MIHSearchField(
|
||||
controller: searchController,
|
||||
hintText: "Search Mzansi Packages",
|
||||
hintText: "Search MIH Packages",
|
||||
required: false,
|
||||
editable: true,
|
||||
onTap: () {},
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import 'package:Mzansi_Innovation_Hub/main.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MzansiSetupBusinessProfileTile extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final double packageSize;
|
||||
const MzansiSetupBusinessProfileTile({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.packageSize,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MzansiSetupBusinessProfileTile> createState() =>
|
||||
_MzansiSetupBusinessProfileTileState();
|
||||
}
|
||||
|
||||
class _MzansiSetupBusinessProfileTileState
|
||||
extends State<MzansiSetupBusinessProfileTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihAppTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/business-profile/set-up',
|
||||
arguments: widget.signedInUser,
|
||||
);
|
||||
},
|
||||
appName: "Setup Business",
|
||||
appIcon: Container(
|
||||
padding: const EdgeInsets.all(0.5),
|
||||
child: Icon(
|
||||
Icons.business_center,
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
),
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
secondaryColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -122,12 +122,12 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
'/business-profile/manage',
|
||||
arguments: BusinessArguments(
|
||||
widget.arguments.signedInUser,
|
||||
widget.arguments.businessUser,
|
||||
widget.arguments.business,
|
||||
'/',
|
||||
arguments: AuthArguments(
|
||||
false,
|
||||
false,
|
||||
),
|
||||
);
|
||||
String message =
|
||||
|
||||
@@ -98,7 +98,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
||||
);
|
||||
if (response.statusCode == 201) {
|
||||
uploadSelectedFile(selectedSignature, signtureController);
|
||||
// Navigator.of(context).pushNamed('/');
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
'/',
|
||||
arguments: AuthArguments(false, false),
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:Mzansi_Innovation_Hub/main.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app_tile.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/arguments.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MzansiSetupProfileTile extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final ImageProvider<Object>? propicFile;
|
||||
final double packageSize;
|
||||
|
||||
const MzansiSetupProfileTile({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.propicFile,
|
||||
required this.packageSize,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MzansiSetupProfileTile> createState() => _MzansiSetupProfileTileState();
|
||||
}
|
||||
|
||||
class _MzansiSetupProfileTileState extends State<MzansiSetupProfileTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ImageProvider logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
return MihAppTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-profile',
|
||||
arguments: AppProfileUpdateArguments(
|
||||
widget.signedInUser,
|
||||
widget.propicFile,
|
||||
),
|
||||
);
|
||||
},
|
||||
appName: "Setup Profile",
|
||||
appIcon: Container(
|
||||
padding: const EdgeInsets.all(25),
|
||||
child: Image(image: logo),
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
secondaryColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -144,12 +144,20 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||
//print("Here4");
|
||||
//print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
'/user-profile',
|
||||
arguments: AppProfileUpdateArguments(
|
||||
widget.arguments.signedInUser, widget.arguments.propicFile),
|
||||
'/',
|
||||
arguments: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// '/mzansi-profile',
|
||||
// arguments: AppProfileUpdateArguments(
|
||||
// widget.arguments.signedInUser, widget.arguments.propicFile),
|
||||
// );
|
||||
String message =
|
||||
"${widget.arguments.signedInUser.email}'s information has been updated successfully!";
|
||||
successPopUp(message);
|
||||
|
||||
@@ -330,7 +330,7 @@ class _AddPatientState extends State<AddPatient> {
|
||||
headerAlignment: MainAxisAlignment.center,
|
||||
headerItems: [
|
||||
Text(
|
||||
"Add Patient Details",
|
||||
"Set Up Patient Profile",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 25,
|
||||
|
||||
Reference in New Issue
Block a user