forked from yaso_meth/mih-project
bus prf view
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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<MihAddBookmarkAlert> {
|
||||
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<MihAddBookmarkAlert> {
|
||||
});
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
@@ -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<MihDeleteBookmarkAlert> {
|
||||
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<MihDeleteBookmarkAlert> {
|
||||
});
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
@@ -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<MihReviewBusinessWindow> {
|
||||
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<MihReviewBusinessWindow> {
|
||||
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<MihReviewBusinessWindow> {
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
@@ -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<MzansiBusinessProfileView> {
|
||||
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();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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<MzansiProfileView> {
|
||||
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();
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user