diff --git a/Frontend/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart b/Frontend/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart index 9b754421..1c2509fa 100644 --- a/Frontend/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart +++ b/Frontend/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; @@ -44,13 +45,20 @@ class _BuildFavouriteBusinessesListState MzansiInnovationHub.of(context)!.theme.mode == "Dark"), child: InkWell( onTap: () { - Navigator.of(context).pushNamed( - '/business-profile/view', - arguments: BusinessViewArguments( - business, - business.Name, + context.goNamed( + 'businessProfileView', + extra: BusinessViewArguments( + widget.favouriteBusinesses[index]!, + widget.favouriteBusinesses[index]!.Name, ), ); + // Navigator.of(context).pushNamed( + // '/business-profile/view', + // arguments: BusinessViewArguments( + // business, + // business.Name, + // ), + // ); }, splashColor: MihColors.getSecondaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark") diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart index 4c55e1d8..6e70de6b 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; @@ -33,23 +34,13 @@ class _MihAddBookmarkAlertState extends State { await MihMzansiDirectoryServices() .addBookmarkedBusiness(user_id, business_id) .then((statusCode) { + context.pop(); if (statusCode == 201) { - Navigator.of(context).pushNamedAndRemoveUntil( - '/mzansi-directory', - ModalRoute.withName('/'), - arguments: MzansiDirectoryArguments( - personalSearch: false, // personalSearch - packageIndex: 1, - startSearchText: widget.business.Name, - ), - ); - MihAlertServices().successAlert( + successPopUp( "Successfully Bookmarked Business!", "${widget.business.Name} has successfully been added to favourite businessess in the Mzansi Directory.", - context, ); } else { - Navigator.of(context).pop(); MihAlertServices().errorAlert( "Error Adding Bookmark", "An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.", @@ -59,6 +50,71 @@ class _MihAddBookmarkAlertState extends State { }); } + void successPopUp(String title, String message) { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.check_circle_outline_rounded, + size: 150, + color: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ), + alertTitle: title, + alertBody: Column( + children: [ + Text( + message, + style: TextStyle( + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 25), + Center( + child: MihButton( + onPressed: () { + context.goNamed( + "mzansiDirectory", + extra: MzansiDirectoryArguments( + personalSearch: false, + startSearchText: widget.business.Name, + packageIndex: 1, + ), + ); + }, + buttonColor: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + elevation: 10, + width: 300, + child: Text( + "Dismiss", + style: TextStyle( + color: MihColors.getPrimaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ) + ], + ), + alertColour: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ); + // return MIHSuccessMessage( + // successType: "Success", + // successMessage: message, + // ); + }, + ); + } + @override Widget build(BuildContext context) { return MihPackageAlert( diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart index 2a935f9a..4d5dbae8 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/bookmarked_business.dart'; @@ -36,35 +37,13 @@ class _MihDeleteBookmarkAlertState extends State { await MihMzansiDirectoryServices() .deleteBookmarkedBusiness(idbookmarked_businesses) .then((statusCode) { + context.pop(); if (statusCode == 200) { - // Navigator.of(context).pop(); //Remove loading circle - // Navigator.of(context).pop(); //Remove window - // Navigator.of(context).pop(); //Remove profile - // Navigator.of(context).pop(); //Remove directory - // Navigator.of(context).pushNamed( - // '/mzansi-directory', - // arguments: MzansiDirectoryArguments( - // startUpSearch: widget.startUpSearch, // startUpSearch - // personalSearch: false, // personalSearch - // ), - // ); - Navigator.of(context).pushNamedAndRemoveUntil( - '/mzansi-directory', - ModalRoute.withName('/'), - arguments: MzansiDirectoryArguments( - personalSearch: false, // personalSearch - packageIndex: 1, - startSearchText: widget.business.Name, - ), - ); - MihAlertServices().successAlert( + successPopUp( "Successfully Removed Bookmark!", "${widget.business.Name} has successfully been removed your favourite businessess in the Mzansi Directory.", - context, ); } else { - //error messagek - Navigator.of(context).pop(); MihAlertServices().errorAlert( "Error Adding Bookmark", "An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.", @@ -74,6 +53,71 @@ class _MihDeleteBookmarkAlertState extends State { }); } + void successPopUp(String title, String message) { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.check_circle_outline_rounded, + size: 150, + color: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ), + alertTitle: title, + alertBody: Column( + children: [ + Text( + message, + style: TextStyle( + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 25), + Center( + child: MihButton( + onPressed: () { + context.goNamed( + "mzansiDirectory", + extra: MzansiDirectoryArguments( + personalSearch: false, + startSearchText: widget.business.Name, + packageIndex: 1, + ), + ); + }, + buttonColor: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + elevation: 10, + width: 300, + child: Text( + "Dismiss", + style: TextStyle( + color: MihColors.getPrimaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ) + ], + ), + alertColour: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ); + // return MIHSuccessMessage( + // successType: "Success", + // successMessage: message, + // ); + }, + ); + } + @override Widget build(BuildContext context) { return MihPackageAlert( diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart index 1d6e06dd..45dbf607 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart @@ -1,6 +1,7 @@ import 'package:custom_rating_bar/custom_rating_bar.dart'; import 'package:flutter/material.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; @@ -188,22 +189,12 @@ class _MihReviewBusinessWindowState extends State { widget.business.rating, ) .then((statusCode) { - Navigator.of(context).pop(); //Remove loading dialog + context.pop(); //Remove loading dialog if (statusCode == 200) { - Navigator.of(context).pop(); //pop window - Navigator.of(context).pop(); //pop business profile - Navigator.of(context).pop(); //pop directory - Navigator.of(context).pushNamed( - '/mzansi-directory', - arguments: MzansiDirectoryArguments( - personalSearch: false, // personalSearch - startSearchText: widget.business.Name, - ), - ); - MihAlertServices().successAlert( + context.pop(); + successPopUp( "Successfully Updated Review!", "Your review has successfully been updated and will now appear under the business.", - context, ); } else { MihAlertServices().errorAlert( @@ -224,22 +215,12 @@ class _MihReviewBusinessWindowState extends State { widget.business.rating.isEmpty ? "0.0" : widget.business.rating, ) .then((statusCode) { - Navigator.of(context).pop(); //Remove loading dialog + context.pop(); //Remove loading dialog if (statusCode == 201) { - Navigator.of(context).pop(); // pop window - Navigator.of(context).pop(); // pop business profile - Navigator.of(context).pop(); // pop directory - Navigator.of(context).pushNamed( - '/mzansi-directory', - arguments: MzansiDirectoryArguments( - personalSearch: false, // personalSearch - startSearchText: widget.business.Name, - ), - ); - MihAlertServices().successAlert( + context.pop(); + successPopUp( "Successfully Added Review!", "Your review has successfully been added and will now appear under the business.", - context, ); } else { MihAlertServices().errorAlert( @@ -252,6 +233,70 @@ class _MihReviewBusinessWindowState extends State { } } + void successPopUp(String title, String message) { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.check_circle_outline_rounded, + size: 150, + color: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ), + alertTitle: title, + alertBody: Column( + children: [ + Text( + message, + style: TextStyle( + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 25), + Center( + child: MihButton( + onPressed: () { + context.goNamed( + "mzansiDirectory", + extra: MzansiDirectoryArguments( + personalSearch: false, + startSearchText: widget.business.Name, + ), + ); + }, + buttonColor: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + elevation: 10, + width: 300, + child: Text( + "Dismiss", + style: TextStyle( + color: MihColors.getPrimaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ) + ], + ), + alertColour: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ); + // return MIHSuccessMessage( + // successType: "Success", + // successMessage: message, + // ); + }, + ); + } + String getWindowTitle() { if (widget.readOnly) { return "Review Details"; diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart index fdba7344..d8b14250 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart @@ -1,3 +1,4 @@ +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart'; @@ -42,7 +43,13 @@ class _MzansiBusinessProfileViewState extends State { icon: const Icon(Icons.arrow_back), iconSize: 35, onTap: () { - Navigator.of(context).pop(); + context.goNamed( + "mzansiDirectory", + extra: MzansiDirectoryArguments( + personalSearch: false, + startSearchText: widget.arguments.business.Name, + ), + ); FocusScope.of(context).unfocus(); }, ); diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart index a1c47ae8..edea06c9 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart @@ -1,4 +1,6 @@ +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart'; @@ -40,7 +42,13 @@ class _MzansiProfileViewState extends State { icon: const Icon(Icons.arrow_back), iconSize: 35, onTap: () { - Navigator.of(context).pop(); + context.goNamed( + "mzansiDirectory", + extra: MzansiDirectoryArguments( + personalSearch: true, + startSearchText: widget.user.username, + ), + ); FocusScope.of(context).unfocus(); }, );