@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
|
<false/>
|
||||||
<key>SKAdNetworkItems</key>
|
<key>SKAdNetworkItems</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
|
|||||||
@@ -12,10 +12,28 @@ class MihBannerAd extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihBannerAdState extends State<MihBannerAd> {
|
class _MihBannerAdState extends State<MihBannerAd> {
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
MihBannerAdProvider adProvider = context.read<MihBannerAdProvider>();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
adProvider.reset();
|
||||||
|
adProvider.loadBannerAd();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<MihBannerAdProvider>(
|
return Consumer<MihBannerAdProvider>(
|
||||||
builder: (context, bannerAdProvider, child) {
|
builder: (context, bannerAdProvider, child) {
|
||||||
|
if (!bannerAdProvider.isBannerAdLoaded) {
|
||||||
|
return SizedBox();
|
||||||
|
}
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
bannerAdProvider.bannerAd != null &&
|
bannerAdProvider.bannerAd != null &&
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
futureImageUrl =
|
|
||||||
MihFileApi.getMinioFileUrl(widget.business.logo_path, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -54,7 +52,8 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: futureImageUrl,
|
future: MihFileApi.getMinioFileUrl(
|
||||||
|
widget.business.logo_path, context),
|
||||||
builder: (context, asyncSnapshot) {
|
builder: (context, asyncSnapshot) {
|
||||||
if (asyncSnapshot.connectionState == ConnectionState.done &&
|
if (asyncSnapshot.connectionState == ConnectionState.done &&
|
||||||
asyncSnapshot.hasData) {
|
asyncSnapshot.hasData) {
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ class MihBannerAdProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadBannerAd() {
|
void loadBannerAd() {
|
||||||
|
if (bannerAd != null) {
|
||||||
|
bannerAd!.dispose();
|
||||||
|
bannerAd = null;
|
||||||
|
isBannerAdLoaded = false;
|
||||||
|
}
|
||||||
bannerAd = BannerAd(
|
bannerAd = BannerAd(
|
||||||
adUnitId: adUnitId,
|
adUnitId: adUnitId,
|
||||||
request: const AdRequest(),
|
request: const AdRequest(),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.dart';
|
||||||
|
|
||||||
class MihCalendarProvider extends ChangeNotifier {
|
class MihCalendarProvider extends ChangeNotifier {
|
||||||
@@ -57,6 +58,7 @@ class MihCalendarProvider extends ChangeNotifier {
|
|||||||
int index = personalAppointments?.indexWhere((appointment) =>
|
int index = personalAppointments?.indexWhere((appointment) =>
|
||||||
appointment.idappointments == updatedAppointment.idappointments) ??
|
appointment.idappointments == updatedAppointment.idappointments) ??
|
||||||
-1;
|
-1;
|
||||||
|
KenLogger.success("Edit Patient Index: $index");
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
personalAppointments?[index] = updatedAppointment;
|
personalAppointments?[index] = updatedAppointment;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class MzansiDirectoryProvider extends ChangeNotifier {
|
|||||||
String userLocation;
|
String userLocation;
|
||||||
bool personalSearch;
|
bool personalSearch;
|
||||||
List<BookmarkedBusiness> bookmarkedBusinesses = [];
|
List<BookmarkedBusiness> bookmarkedBusinesses = [];
|
||||||
Map<String, Business?> businessDetailsMap = {};
|
List<Business>? favouriteBusinessesList;
|
||||||
List<Business>? searchedBusinesses;
|
List<Business>? searchedBusinesses;
|
||||||
Business? selectedBusiness;
|
Business? selectedBusiness;
|
||||||
List<AppUser>? searchedUsers;
|
List<AppUser>? searchedUsers;
|
||||||
@@ -32,7 +32,6 @@ class MzansiDirectoryProvider extends ChangeNotifier {
|
|||||||
userLocation = "Unknown Location";
|
userLocation = "Unknown Location";
|
||||||
personalSearch = true;
|
personalSearch = true;
|
||||||
bookmarkedBusinesses = [];
|
bookmarkedBusinesses = [];
|
||||||
businessDetailsMap = {};
|
|
||||||
searchedBusinesses = null;
|
searchedBusinesses = null;
|
||||||
selectedBusiness = null;
|
selectedBusiness = null;
|
||||||
searchedUsers = null;
|
searchedUsers = null;
|
||||||
@@ -62,13 +61,14 @@ class MzansiDirectoryProvider extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFavouriteBusinesses({required List<BookmarkedBusiness> businesses}) {
|
void setBookmarkedeBusinesses(
|
||||||
|
{required List<BookmarkedBusiness> businesses}) {
|
||||||
bookmarkedBusinesses = businesses;
|
bookmarkedBusinesses = businesses;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBusinessDetailsMap({required Map<String, Business?> detailsMap}) {
|
void setFavouriteBusinesses({required List<Business> businesses}) {
|
||||||
businessDetailsMap = detailsMap;
|
favouriteBusinessesList = businesses;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ class MzansiWalletProvider extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLoyaltyCard({required MIHLoyaltyCard newCard}) {
|
|
||||||
loyaltyCards.add(newCard);
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteLoyaltyCard({required int cardId}) {
|
void deleteLoyaltyCard({required int cardId}) {
|
||||||
loyaltyCards.removeWhere((card) => card.idloyalty_cards == cardId);
|
loyaltyCards.removeWhere((card) => card.idloyalty_cards == cardId);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_route_error.dart
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/mih_mine_sweeper.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/mih_mine_sweeper.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/busines_profile.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart';
|
||||||
@@ -190,9 +190,10 @@ class MihGoRouter {
|
|||||||
});
|
});
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
return MzansiBusinessProfile(
|
return BusinesProfile();
|
||||||
key: UniqueKey(),
|
// return MzansiBusinessProfile(
|
||||||
);
|
// key: UniqueKey(),
|
||||||
|
// );
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:go_router/go_router.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.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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/currency_exchange_rate.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/currency_exchange_rate.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/simple_calc.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/simple_calc.dart';
|
||||||
@@ -29,7 +28,6 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
context.read<MihBannerAdProvider>().loadBannerAd();
|
|
||||||
await getCurrencyCodeList();
|
await getCurrencyCodeList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
@@ -67,7 +66,6 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Calculation Results",
|
windowTitle: "Calculation Results",
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
context.read<MihBannerAdProvider>().loadBannerAd();
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||||
@@ -99,7 +98,6 @@ class _TipCalcState extends State<TipCalc> {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Calculation Results",
|
windowTitle: "Calculation Results",
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
context.read<MihBannerAdProvider>().loadBannerAd();
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calendar_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -59,6 +58,13 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
late double width;
|
late double width;
|
||||||
late double height;
|
late double height;
|
||||||
|
|
||||||
|
void clearControllers() {
|
||||||
|
widget.titleController.clear();
|
||||||
|
widget.descriptionIDController.clear();
|
||||||
|
widget.dateController.clear();
|
||||||
|
widget.timeController.clear();
|
||||||
|
}
|
||||||
|
|
||||||
double getPaddingSize() {
|
double getPaddingSize() {
|
||||||
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
|
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
|
||||||
return (width / 10);
|
return (width / 10);
|
||||||
@@ -72,37 +78,41 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
||||||
? mihCalendarProvider.personalAppointments!
|
? mihCalendarProvider.personalAppointments!
|
||||||
: mihCalendarProvider.businessAppointments!;
|
: mihCalendarProvider.businessAppointments!;
|
||||||
String heading = "";
|
|
||||||
String description = "";
|
// SAFELY EXTRACT DATE AND TIME
|
||||||
DateTime now;
|
String dateTimeString = appointmentList[index].date_time;
|
||||||
int hourNow = 0;
|
String timePart = "";
|
||||||
String date = "";
|
String datePart = "";
|
||||||
int appointHour = 0;
|
|
||||||
String appointDate = "";
|
if (dateTimeString.contains("T")) {
|
||||||
if (appointmentList[index].date_time.contains("T")) {
|
List<String> parts = dateTimeString.split('T');
|
||||||
heading =
|
datePart = parts[0];
|
||||||
"${appointmentList[index].date_time.split('T')[1].substring(0, 5)} - ${appointmentList[index].title.toUpperCase()}";
|
timePart = parts[1].substring(0, 5);
|
||||||
description = appointmentList[index].description;
|
} else if (dateTimeString.contains(" ")) {
|
||||||
now = DateTime.now();
|
List<String> parts = dateTimeString.split(' ');
|
||||||
hourNow = int.parse(now.toString().split(' ')[1].substring(0, 2));
|
datePart = parts[0];
|
||||||
date = DateTime(now.year, now.month, now.day).toString().split(' ')[0];
|
timePart = parts[1].substring(0, 5);
|
||||||
appointDate = appointmentList[index].date_time.split('T')[0];
|
|
||||||
appointHour = int.parse(
|
|
||||||
appointmentList[index].date_time.split('T')[1].substring(0, 2));
|
|
||||||
} else {
|
} else {
|
||||||
heading =
|
// Fallback if format is unexpected
|
||||||
"${appointmentList[index].date_time.split(' ')[1].substring(0, 5)} - ${appointmentList[index].title.toUpperCase()}";
|
datePart = dateTimeString;
|
||||||
description = appointmentList[index].description;
|
timePart = "00:00";
|
||||||
now = DateTime.now();
|
|
||||||
hourNow = int.parse(now.toString().split(' ')[1].substring(0, 2));
|
|
||||||
date = DateTime(now.year, now.month, now.day).toString().split(' ')[0];
|
|
||||||
appointDate = appointmentList[index].date_time.split(' ')[0];
|
|
||||||
appointHour = int.parse(
|
|
||||||
appointmentList[index].date_time.split(' ')[1].substring(0, 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String heading =
|
||||||
|
"$timePart - ${appointmentList[index].title.toUpperCase()}";
|
||||||
|
String description = appointmentList[index].description;
|
||||||
|
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
int hourNow = int.parse(now.toString().split(' ')[1].substring(0, 2));
|
||||||
|
String currentDate =
|
||||||
|
DateTime(now.year, now.month, now.day).toString().split(' ')[0];
|
||||||
|
|
||||||
|
int appointHour = int.parse(timePart.split(':')[0]);
|
||||||
|
|
||||||
Color appointmentColor = MihColors.getSecondaryColor(
|
Color appointmentColor = MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||||
if (date == appointDate) {
|
|
||||||
|
if (currentDate == datePart) {
|
||||||
if (appointHour < hourNow) {
|
if (appointHour < hourNow) {
|
||||||
appointmentColor = MihColors.getGreyColor(
|
appointmentColor = MihColors.getGreyColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||||
@@ -110,7 +120,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
appointmentColor = MihColors.getGreenColor(
|
appointmentColor = MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||||
}
|
}
|
||||||
} else if (DateTime.parse(appointDate).isBefore(DateTime.parse(date))) {
|
} else if (DateTime.parse(datePart).isBefore(DateTime.parse(currentDate))) {
|
||||||
appointmentColor = MihColors.getGreyColor(
|
appointmentColor = MihColors.getGreyColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||||
}
|
}
|
||||||
@@ -138,15 +148,15 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
// SAFELY SET CONTROLLER VALUES
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.titleController.text = appointmentList[index].title;
|
widget.titleController.text = appointmentList[index].title;
|
||||||
widget.descriptionIDController.text =
|
widget.descriptionIDController.text =
|
||||||
appointmentList[index].description;
|
appointmentList[index].description;
|
||||||
widget.dateController.text =
|
widget.dateController.text = datePart;
|
||||||
appointmentList[index].date_time.split('T')[0];
|
widget.timeController.text = timePart;
|
||||||
widget.timeController.text =
|
|
||||||
appointmentList[index].date_time.split('T')[1].substring(0, 5);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (widget.inWaitingRoom == false) {
|
if (widget.inWaitingRoom == false) {
|
||||||
appointmentDetailsWindow(
|
appointmentDetailsWindow(
|
||||||
mzansiProfileProvider, mihCalendarProvider, index, bodyWidth);
|
mzansiProfileProvider, mihCalendarProvider, index, bodyWidth);
|
||||||
@@ -214,10 +224,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
],
|
],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
widget.dateController.clear();
|
clearControllers();
|
||||||
widget.timeController.clear();
|
|
||||||
widget.titleController.clear();
|
|
||||||
widget.descriptionIDController.clear();
|
|
||||||
},
|
},
|
||||||
windowBody: Padding(
|
windowBody: Padding(
|
||||||
padding:
|
padding:
|
||||||
@@ -342,10 +349,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
],
|
],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
widget.dateController.clear();
|
clearControllers();
|
||||||
widget.timeController.clear();
|
|
||||||
widget.titleController.clear();
|
|
||||||
widget.descriptionIDController.clear();
|
|
||||||
},
|
},
|
||||||
windowBody: Padding(
|
windowBody: Padding(
|
||||||
padding:
|
padding:
|
||||||
@@ -591,6 +595,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
||||||
? mihCalendarProvider.personalAppointments!
|
? mihCalendarProvider.personalAppointments!
|
||||||
: mihCalendarProvider.businessAppointments!;
|
: mihCalendarProvider.businessAppointments!;
|
||||||
|
KenLogger.success("ersonalHome: ${mzansiProfileProvider.personalHome}");
|
||||||
if (mzansiProfileProvider.personalHome == true) {
|
if (mzansiProfileProvider.personalHome == true) {
|
||||||
statusCode = await MihMzansiCalendarApis.updatePersonalAppointment(
|
statusCode = await MihMzansiCalendarApis.updatePersonalAppointment(
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
@@ -634,28 +639,30 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
if (!widget.inWaitingRoom) {
|
successPopUp("Successfully Updated Appointment",
|
||||||
KenLogger.warning("calendar route");
|
"You appointment has been successfully updated.");
|
||||||
context.goNamed(
|
// if (!widget.inWaitingRoom) {
|
||||||
"mihCalendar",
|
// KenLogger.warning("calendar route");
|
||||||
);
|
// context.goNamed(
|
||||||
} else {
|
// "mihCalendar",
|
||||||
KenLogger.warning("waiting room route");
|
// );
|
||||||
// GoRouter.of(context).refresh();
|
// } else {
|
||||||
context.goNamed(
|
// KenLogger.warning("waiting room route");
|
||||||
'mihHome',
|
// // GoRouter.of(context).refresh();
|
||||||
);
|
// context.goNamed(
|
||||||
context.goNamed(
|
// 'mihHome',
|
||||||
'patientManager',
|
// );
|
||||||
extra: PatManagerArguments(
|
// context.goNamed(
|
||||||
mzansiProfileProvider.user!,
|
// 'patientManager',
|
||||||
false,
|
// extra: PatManagerArguments(
|
||||||
mzansiProfileProvider.business,
|
// mzansiProfileProvider.user!,
|
||||||
mzansiProfileProvider.businessUser,
|
// false,
|
||||||
),
|
// mzansiProfileProvider.business,
|
||||||
);
|
// mzansiProfileProvider.businessUser,
|
||||||
// context.pop();
|
// ),
|
||||||
}
|
// );
|
||||||
|
// // context.pop();
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
@@ -724,6 +731,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
child: MihButton(
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
|
clearControllers();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
@@ -805,15 +813,17 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
MzansiProfileProvider mzansiProfileProvider,
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
MihCalendarProvider mihCalendarProvider,
|
MihCalendarProvider mihCalendarProvider,
|
||||||
Widget? child) {
|
Widget? child) {
|
||||||
List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
// List<Appointment> appointmentList = mzansiProfileProvider.personalHome
|
||||||
? mihCalendarProvider.personalAppointments!
|
// ? mihCalendarProvider.personalAppointments!
|
||||||
: mihCalendarProvider.businessAppointments!;
|
// : mihCalendarProvider.businessAppointments!;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: getPaddingSize()),
|
padding: EdgeInsets.symmetric(horizontal: getPaddingSize()),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: appointmentList.length,
|
itemCount: mzansiProfileProvider.personalHome
|
||||||
|
? mihCalendarProvider.personalAppointments!.length
|
||||||
|
: mihCalendarProvider.businessAppointments!.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return displayAppointment(
|
return displayAppointment(
|
||||||
mzansiProfileProvider, mihCalendarProvider, index, width);
|
mzansiProfileProvider, mihCalendarProvider, index, width);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Add Appointment",
|
windowTitle: "Add Appointment",
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
_appointmentDateController.clear();
|
_appointmentDateController.clear();
|
||||||
_appointmentTimeController.clear();
|
_appointmentTimeController.clear();
|
||||||
_appointmentTitleController.clear();
|
_appointmentTitleController.clear();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_mine_sweeper_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_mine_sweeper_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -124,8 +123,9 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
return '$hoursStr:$minutesStr:$secondsStr:$centiStr';
|
return '$hoursStr:$minutesStr:$secondsStr:$centiStr';
|
||||||
}
|
}
|
||||||
|
|
||||||
void showStartGameWindow(MihMineSweeperProvider mihMineSweeperProvider,
|
void showStartGameWindow(
|
||||||
MihBannerAdProvider addProvider) {
|
MihMineSweeperProvider mihMineSweeperProvider,
|
||||||
|
) {
|
||||||
// easy - 10 * 10 & 15 bombs
|
// easy - 10 * 10 & 15 bombs
|
||||||
// Intermediate - 10 * 15 & 23 bombs
|
// Intermediate - 10 * 15 & 23 bombs
|
||||||
// Hard - 10 * 20 & 30 bombs
|
// Hard - 10 * 20 & 30 bombs
|
||||||
@@ -134,7 +134,6 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihMineSweeperStartGameWindow(
|
return MihMineSweeperStartGameWindow(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
addProvider.loadBannerAd();
|
|
||||||
resetTimer();
|
resetTimer();
|
||||||
mihMineSweeperProvider
|
mihMineSweeperProvider
|
||||||
.setDifficulty(mihMineSweeperProvider.difficulty);
|
.setDifficulty(mihMineSweeperProvider.difficulty);
|
||||||
@@ -241,12 +240,8 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleTap(
|
Future<void> handleTap(MzansiProfileProvider profileProvider,
|
||||||
MzansiProfileProvider profileProvider,
|
MihMineSweeperProvider mihMineSweeperProvider, int r, int c) async {
|
||||||
MihMineSweeperProvider mihMineSweeperProvider,
|
|
||||||
MihBannerAdProvider adProvider,
|
|
||||||
int r,
|
|
||||||
int c) async {
|
|
||||||
if (isGameOver || board[r][c].isOpened || board[r][c].isFlagged) {
|
if (isGameOver || board[r][c].isOpened || board[r][c].isFlagged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -304,8 +299,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showStartGameWindow(
|
showStartGameWindow(mihMineSweeperProvider);
|
||||||
mihMineSweeperProvider, adProvider);
|
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
@@ -364,7 +358,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
squaresLeft--;
|
squaresLeft--;
|
||||||
}
|
}
|
||||||
// 3. Check for win
|
// 3. Check for win
|
||||||
_checkWinCondition(profileProvider, mihMineSweeperProvider, adProvider);
|
_checkWinCondition(profileProvider, mihMineSweeperProvider);
|
||||||
// Update the UI
|
// Update the UI
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@@ -383,7 +377,6 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
Future<void> _checkWinCondition(
|
Future<void> _checkWinCondition(
|
||||||
MzansiProfileProvider profileProvider,
|
MzansiProfileProvider profileProvider,
|
||||||
MihMineSweeperProvider mihMineSweeperProvider,
|
MihMineSweeperProvider mihMineSweeperProvider,
|
||||||
MihBannerAdProvider adProvider,
|
|
||||||
) async {
|
) async {
|
||||||
// Game is won if all non-mine squares are opened.
|
// Game is won if all non-mine squares are opened.
|
||||||
if (squaresLeft <= mihMineSweeperProvider.totalMines) {
|
if (squaresLeft <= mihMineSweeperProvider.totalMines) {
|
||||||
@@ -450,7 +443,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
showStartGameWindow(mihMineSweeperProvider, adProvider);
|
showStartGameWindow(mihMineSweeperProvider);
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
@@ -558,13 +551,9 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody() {
|
Widget getBody() {
|
||||||
return Consumer3<MzansiProfileProvider, MihMineSweeperProvider,
|
return Consumer2<MzansiProfileProvider, MihMineSweeperProvider>(
|
||||||
MihBannerAdProvider>(
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
builder: (BuildContext context,
|
MihMineSweeperProvider mihMineSweeperProvider, Widget? child) {
|
||||||
MzansiProfileProvider profileProvider,
|
|
||||||
MihMineSweeperProvider mihMineSweeperProvider,
|
|
||||||
MihBannerAdProvider adProvider,
|
|
||||||
Widget? child) {
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -725,12 +714,8 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
|
|
||||||
return MineTile(
|
return MineTile(
|
||||||
square: board[r][c],
|
square: board[r][c],
|
||||||
onTap: () => handleTap(
|
onTap: () => handleTap(profileProvider,
|
||||||
profileProvider,
|
mihMineSweeperProvider, r, c),
|
||||||
mihMineSweeperProvider,
|
|
||||||
adProvider,
|
|
||||||
r,
|
|
||||||
c),
|
|
||||||
onLongPress: () => handleLongPress(r, c),
|
onLongPress: () => handleLongPress(r, c),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -768,7 +753,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
mihMineSweeperProvider.setToolIndex(2);
|
mihMineSweeperProvider.setToolIndex(3);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SpeedDialChild(
|
SpeedDialChild(
|
||||||
@@ -778,9 +763,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
),
|
),
|
||||||
label: board.isEmpty && squaresLeft < 0
|
label: "Start New Game",
|
||||||
? "Start Game"
|
|
||||||
: "Reset Game",
|
|
||||||
labelBackgroundColor: MihColors.getGreenColor(
|
labelBackgroundColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
@@ -794,8 +777,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showStartGameWindow(
|
showStartGameWindow(mihMineSweeperProvider);
|
||||||
mihMineSweeperProvider, adProvider);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -93,6 +93,8 @@ class _AiChatState extends State<AiChat> {
|
|||||||
temp +=
|
temp +=
|
||||||
"- Calculator: Simple calculator with tip and forex calculation functionality.\n";
|
"- Calculator: Simple calculator with tip and forex calculation functionality.\n";
|
||||||
temp += "- MIH Access: Manage and view profile access security.\n";
|
temp += "- MIH Access: Manage and view profile access security.\n";
|
||||||
|
temp +=
|
||||||
|
"- MIH Minesweeper: The first game from MIH! It's the classic brain-teaser ready to entertain you no matter where you are.\n";
|
||||||
temp += "**Core Rules and Guidelines:**\n";
|
temp += "**Core Rules and Guidelines:**\n";
|
||||||
temp +=
|
temp +=
|
||||||
"- **Accuracy First:** Always prioritize providing correct information.\n";
|
"- **Accuracy First:** Always prioritize providing correct information.\n";
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class _BuildFavouriteBusinessesListState
|
|||||||
directoryProvider.setSelectedBusiness(
|
directoryProvider.setSelectedBusiness(
|
||||||
business: widget.favouriteBusinesses[index]!,
|
business: widget.favouriteBusinesses[index]!,
|
||||||
);
|
);
|
||||||
context.goNamed(
|
context.pushNamed(
|
||||||
'businessProfileView',
|
'businessProfileView',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.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.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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MzansiDirectory extends StatefulWidget {
|
class MzansiDirectory extends StatefulWidget {
|
||||||
@@ -31,11 +36,33 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getFavouriteBusinesses() async {
|
||||||
|
MzansiDirectoryProvider directoryProvider =
|
||||||
|
context.read<MzansiDirectoryProvider>();
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness(
|
||||||
|
profileProvider.user!.app_id,
|
||||||
|
directoryProvider,
|
||||||
|
);
|
||||||
|
List<Business> favBus = [];
|
||||||
|
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||||
|
await MihBusinessDetailsServices()
|
||||||
|
.getBusinessDetailsByBusinessId(bus.business_id)
|
||||||
|
.then((business) {
|
||||||
|
favBus.add(business!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
KenLogger.success(favBus);
|
||||||
|
directoryProvider.setFavouriteBusinesses(businesses: favBus);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
initialiseGPSLocation();
|
initialiseGPSLocation();
|
||||||
|
getFavouriteBusinesses();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_search_bar.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_search_bar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MihFavouriteBusinesses extends StatefulWidget {
|
class MihFavouriteBusinesses extends StatefulWidget {
|
||||||
@@ -31,38 +30,13 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
ValueNotifier([]);
|
ValueNotifier([]);
|
||||||
Timer? _debounce;
|
Timer? _debounce;
|
||||||
|
|
||||||
Future<void> getAndMapAllBusinessDetailsForBookmarkedBusinesses(
|
|
||||||
MzansiProfileProvider mzansiProfileProvider,
|
|
||||||
MzansiDirectoryProvider directoryProvider,
|
|
||||||
) async {
|
|
||||||
await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness(
|
|
||||||
mzansiProfileProvider.user!.app_id,
|
|
||||||
directoryProvider,
|
|
||||||
);
|
|
||||||
Map<String, Business?> businessMap = {};
|
|
||||||
List<Future<Business?>> detailFutures = [];
|
|
||||||
for (var item in directoryProvider.bookmarkedBusinesses) {
|
|
||||||
detailFutures.add(MihBusinessDetailsServices()
|
|
||||||
.getBusinessDetailsByBusinessId(item.business_id));
|
|
||||||
}
|
|
||||||
List<Business?> details = await Future.wait(detailFutures);
|
|
||||||
for (int i = 0; i < directoryProvider.bookmarkedBusinesses.length; i++) {
|
|
||||||
businessMap[directoryProvider.bookmarkedBusinesses[i].business_id] =
|
|
||||||
details[i];
|
|
||||||
}
|
|
||||||
directoryProvider.setBusinessDetailsMap(detailsMap: businessMap);
|
|
||||||
_filterAndSetBusinesses(directoryProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _filterAndSetBusinesses(MzansiDirectoryProvider directoryProvider) {
|
void _filterAndSetBusinesses(MzansiDirectoryProvider directoryProvider) {
|
||||||
List<Business?> businessesToDisplay = [];
|
List<Business?> businessesToDisplay = [];
|
||||||
String query = businessSearchController.text.toLowerCase();
|
String query = businessSearchController.text.toLowerCase();
|
||||||
for (var bookmarked in directoryProvider.bookmarkedBusinesses) {
|
if (directoryProvider.favouriteBusinessesList != null) {
|
||||||
if (bookmarked.business_name.toLowerCase().contains(query)) {
|
for (var bus in directoryProvider.favouriteBusinessesList!) {
|
||||||
if (directoryProvider.businessDetailsMap
|
if (bus.Name.toLowerCase().contains(query)) {
|
||||||
.containsKey(bookmarked.business_id)) {
|
businessesToDisplay.add(bus);
|
||||||
businessesToDisplay.add(
|
|
||||||
directoryProvider.businessDetailsMap[bookmarked.business_id]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,13 +56,11 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
MzansiDirectoryProvider directoryProvider =
|
MzansiDirectoryProvider directoryProvider =
|
||||||
context.read<MzansiDirectoryProvider>();
|
context.read<MzansiDirectoryProvider>();
|
||||||
MzansiProfileProvider mzansiProfileProvider =
|
// getAndMapAllBusinessDetailsForBookmarkedBusinesses(
|
||||||
context.read<MzansiProfileProvider>();
|
// mzansiProfileProvider,
|
||||||
|
// directoryProvider,
|
||||||
getAndMapAllBusinessDetailsForBookmarkedBusinesses(
|
// );
|
||||||
mzansiProfileProvider,
|
_filterAndSetBusinesses(directoryProvider);
|
||||||
directoryProvider,
|
|
||||||
);
|
|
||||||
businessSearchController.addListener(() {
|
businessSearchController.addListener(() {
|
||||||
if (_debounce?.isActive ?? false) {
|
if (_debounce?.isActive ?? false) {
|
||||||
_debounce!.cancel();
|
_debounce!.cancel();
|
||||||
@@ -110,116 +82,129 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody(double width) {
|
Widget getBody(double width) {
|
||||||
return MihSingleChildScroll(
|
return Consumer<MzansiDirectoryProvider>(
|
||||||
child: Column(
|
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
||||||
children: [
|
Widget? child) {
|
||||||
Padding(
|
if (directoryProvider.favouriteBusinessesList == null) {
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
return Center(
|
||||||
child: MihSearchBar(
|
child: Mihloadingcircle(),
|
||||||
controller: businessSearchController,
|
);
|
||||||
hintText: "Search Businesses",
|
}
|
||||||
prefixIcon: Icons.search,
|
return MihSingleChildScroll(
|
||||||
fillColor: MihColors.getSecondaryColor(
|
child: Column(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
children: [
|
||||||
hintColor: MihColors.getPrimaryColor(
|
Padding(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onPrefixIconTap: () {},
|
child: MihSearchBar(
|
||||||
searchFocusNode: searchFocusNode,
|
controller: businessSearchController,
|
||||||
),
|
hintText: "Search Businesses",
|
||||||
),
|
prefixIcon: Icons.search,
|
||||||
const SizedBox(height: 10),
|
fillColor: MihColors.getSecondaryColor(
|
||||||
ValueListenableBuilder<List<Business?>>(
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
valueListenable: searchBookmarkedBusinesses,
|
hintColor: MihColors.getPrimaryColor(
|
||||||
builder: (context, filteredBusinesses, child) {
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
if (filteredBusinesses.isEmpty &&
|
onPrefixIconTap: () {},
|
||||||
businessSearchController.text.isNotEmpty) {
|
searchFocusNode: searchFocusNode,
|
||||||
return Column(
|
),
|
||||||
children: [
|
),
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 10),
|
||||||
Icon(
|
ValueListenableBuilder<List<Business?>>(
|
||||||
MihIcons.iDontKnow,
|
valueListenable: searchBookmarkedBusinesses,
|
||||||
size: 165,
|
builder: (context, filteredBusinesses, child) {
|
||||||
color: MihColors.getSecondaryColor(
|
if (filteredBusinesses.isEmpty &&
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
businessSearchController.text.isNotEmpty) {
|
||||||
"Dark"),
|
return Column(
|
||||||
),
|
children: [
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 50),
|
||||||
Text(
|
Icon(
|
||||||
"Let's try refining your search",
|
MihIcons.iDontKnow,
|
||||||
textAlign: TextAlign.center,
|
size: 165,
|
||||||
overflow: TextOverflow.visible,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else if (filteredBusinesses.isEmpty &&
|
|
||||||
businessSearchController.text.isEmpty) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 50),
|
|
||||||
Icon(
|
|
||||||
MihIcons.businessProfile,
|
|
||||||
size: 165,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Text(
|
|
||||||
"No favourite businesses added to your mzansi directory",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
overflow: TextOverflow.visible,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
const SizedBox(height: 25),
|
Text(
|
||||||
Center(
|
"Let's try refining your search",
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
text: TextSpan(
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else if (filteredBusinesses.isEmpty &&
|
||||||
|
businessSearchController.text.isEmpty) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
Icon(
|
||||||
|
MihIcons.businessProfile,
|
||||||
|
size: 165,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"No favourite businesses added to your mzansi directory",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 25,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.bold,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!
|
MzansiInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.mode ==
|
.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
),
|
),
|
||||||
children: [
|
|
||||||
TextSpan(text: "Use the mzansi search"),
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
" to find your favourite businesses of mzansi"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 25),
|
||||||
|
Center(
|
||||||
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: "Use the mzansi search"),
|
||||||
|
TextSpan(
|
||||||
|
text:
|
||||||
|
" to find your favourite businesses of mzansi"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
}
|
||||||
);
|
KenLogger.success(filteredBusinesses);
|
||||||
}
|
return BuildFavouriteBusinessesList(
|
||||||
return BuildFavouriteBusinessesList(
|
favouriteBusinesses: filteredBusinesses,
|
||||||
favouriteBusinesses: filteredBusinesses,
|
);
|
||||||
);
|
}),
|
||||||
}),
|
],
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.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.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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_employee_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MzansiBusinessProfile extends StatefulWidget {
|
class BusinesProfile extends StatefulWidget {
|
||||||
const MzansiBusinessProfile({
|
const BusinesProfile({super.key});
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MzansiBusinessProfile> createState() => _MzansiBusinessProfileState();
|
State<BusinesProfile> createState() => _BusinesProfileState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
|
class _BusinesProfileState extends State<BusinesProfile> {
|
||||||
|
Future<void> initialiseBusinessData() async {
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
await MihBusinessEmployeeServices()
|
||||||
|
.fetchEmployees(profileProvider, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
initialiseBusinessData();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackage(
|
return MihPackage(
|
||||||
appActionButton: getAction(),
|
appActionButton: getAction(),
|
||||||
appTools: getTools(),
|
appTools: getTools(),
|
||||||
appBody: getToolBody(),
|
appBody: getToolBody(),
|
||||||
appToolTitles: getToolTitle(),
|
|
||||||
selectedbodyIndex: context.watch<MzansiProfileProvider>().businessIndex,
|
selectedbodyIndex: context.watch<MzansiProfileProvider>().businessIndex,
|
||||||
onIndexChange: (newIndex) {
|
onIndexChange: (newIndex) {
|
||||||
context.read<MzansiProfileProvider>().setBusinessIndex(newIndex);
|
context.read<MzansiProfileProvider>().setBusinessIndex(newIndex);
|
||||||
@@ -45,7 +56,6 @@ class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
|
|||||||
'mihHome',
|
'mihHome',
|
||||||
);
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
context.read<MzansiProfileProvider>().setBusinessIndex(0);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,22 +89,6 @@ class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getToolBody() {
|
|
||||||
List<Widget> toolBodies = [
|
|
||||||
MihBusinessDetails(),
|
|
||||||
MihMyBusinessUser(),
|
|
||||||
MihMyBusinessTeam(),
|
|
||||||
MihBusinessUserSearch(),
|
|
||||||
MihBusinessReviews(
|
|
||||||
business: context.watch<MzansiProfileProvider>().business!),
|
|
||||||
MihBusinessQrCode(
|
|
||||||
business: context.watch<MzansiProfileProvider>().business!,
|
|
||||||
// startUpSearch: "",
|
|
||||||
),
|
|
||||||
];
|
|
||||||
return toolBodies;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> getToolTitle() {
|
List<String> getToolTitle() {
|
||||||
List<String> toolTitles = [
|
List<String> toolTitles = [
|
||||||
"Profile",
|
"Profile",
|
||||||
@@ -106,4 +100,16 @@ class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
|
|||||||
];
|
];
|
||||||
return toolTitles;
|
return toolTitles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Widget> getToolBody() {
|
||||||
|
List<Widget> toolBodies = [
|
||||||
|
MihBusinessDetails(),
|
||||||
|
MihMyBusinessUser(),
|
||||||
|
MihMyBusinessTeam(),
|
||||||
|
MihBusinessUserSearch(),
|
||||||
|
MihBusinessReviews(business: null),
|
||||||
|
MihBusinessQrCode(business: null),
|
||||||
|
];
|
||||||
|
return toolBodies;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,22 +14,22 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:screenshot/screenshot.dart';
|
import 'package:screenshot/screenshot.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:supertokens_flutter/supertokens.dart';
|
import 'package:supertokens_flutter/supertokens.dart';
|
||||||
|
|
||||||
class MihBusinessQrCode extends StatefulWidget {
|
class MihBusinessQrCode extends StatefulWidget {
|
||||||
final Business business;
|
final Business? business;
|
||||||
// final String? startUpSearch;
|
|
||||||
const MihBusinessQrCode({
|
const MihBusinessQrCode({
|
||||||
super.key,
|
super.key,
|
||||||
required this.business,
|
required this.business,
|
||||||
// required this.startUpSearch,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -38,6 +38,7 @@ class MihBusinessQrCode extends StatefulWidget {
|
|||||||
|
|
||||||
class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||||
late Future<String> futureImageUrl;
|
late Future<String> futureImageUrl;
|
||||||
|
late Business business;
|
||||||
PlatformFile? file;
|
PlatformFile? file;
|
||||||
late String qrCodedata;
|
late String qrCodedata;
|
||||||
int qrSize = 500;
|
int qrSize = 500;
|
||||||
@@ -66,14 +67,14 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
.substring(2, 8);
|
.substring(2, 8);
|
||||||
// KenLogger.warning(bgColor);
|
// KenLogger.warning(bgColor);
|
||||||
String encodedData =
|
String encodedData =
|
||||||
Uri.encodeComponent("$qrCodedata${widget.business.business_id}");
|
Uri.encodeComponent("$qrCodedata${business.business_id}");
|
||||||
|
|
||||||
return "https://api.qrserver.com/v1/create-qr-code/?data=$encodedData&size=${qrSize}x${qrSize}&bgcolor=$bgColor&color=$color";
|
return "https://api.qrserver.com/v1/create-qr-code/?data=$encodedData&size=${qrSize}x${qrSize}&bgcolor=$bgColor&color=$color";
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveImage(Uint8List imageBytes) async {
|
Future<void> saveImage(Uint8List imageBytes) async {
|
||||||
final String filename =
|
final String filename =
|
||||||
"${widget.business.Name}_QR_Code_${DateTime.now().millisecondsSinceEpoch}.png";
|
"${business.Name}_QR_Code_${DateTime.now().millisecondsSinceEpoch}.png";
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
await FileSaver.instance.saveFile(
|
await FileSaver.instance.saveFile(
|
||||||
name: filename,
|
name: filename,
|
||||||
@@ -241,7 +242,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
),
|
),
|
||||||
FittedBox(
|
FittedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.business.Name,
|
business.Name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 35,
|
fontSize: 35,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -253,7 +254,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
),
|
),
|
||||||
FittedBox(
|
FittedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.business.type,
|
business.type,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -335,9 +336,15 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
if (widget.business != null) {
|
||||||
|
business = widget.business!;
|
||||||
|
} else {
|
||||||
|
business = profileProvider.business!;
|
||||||
|
}
|
||||||
_checkUserSession();
|
_checkUserSession();
|
||||||
futureImageUrl =
|
futureImageUrl = MihFileApi.getMinioFileUrl(business.logo_path, context);
|
||||||
MihFileApi.getMinioFileUrl(widget.business.logo_path, context);
|
|
||||||
qrCodedata =
|
qrCodedata =
|
||||||
"${AppEnviroment.baseAppUrl}/business-profile/view?business_id=";
|
"${AppEnviroment.baseAppUrl}/business-profile/view?business_id=";
|
||||||
}
|
}
|
||||||
@@ -418,8 +425,8 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
shareMIHLink(
|
shareMIHLink(
|
||||||
context,
|
context,
|
||||||
"Check out ${widget.business.Name} on the MIH app",
|
"Check out ${business.Name} on the MIH app",
|
||||||
"$qrCodedata${widget.business.business_id}",
|
"$qrCodedata${business.business_id}",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_review.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_review.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MihBusinessReviews extends StatefulWidget {
|
class MihBusinessReviews extends StatefulWidget {
|
||||||
final Business business;
|
final Business? business;
|
||||||
const MihBusinessReviews({
|
const MihBusinessReviews({
|
||||||
super.key,
|
super.key,
|
||||||
required this.business,
|
required this.business,
|
||||||
@@ -21,15 +23,19 @@ class MihBusinessReviews extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
||||||
// late Future<List<BusinessReview>> _reviews;
|
late Business business;
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void initState() {
|
void initState() {
|
||||||
// super.initState();
|
super.initState();
|
||||||
// _reviews = MihMzansiDirectoryServices().getAllReviewsofBusiness(
|
MzansiProfileProvider profileProvider =
|
||||||
// widget.businessId,
|
context.read<MzansiProfileProvider>();
|
||||||
// );
|
if (widget.business != null) {
|
||||||
// }
|
business = widget.business!;
|
||||||
|
} else {
|
||||||
|
business = profileProvider.business!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onReviewTap(BusinessReview? businessReview, double width) {
|
void onReviewTap(BusinessReview? businessReview, double width) {
|
||||||
// showDialog(context: context, builder: (context)=> )
|
// showDialog(context: context, builder: (context)=> )
|
||||||
@@ -37,7 +43,7 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihReviewBusinessWindow(
|
return MihReviewBusinessWindow(
|
||||||
business: widget.business,
|
business: business,
|
||||||
businessReview: businessReview,
|
businessReview: businessReview,
|
||||||
screenWidth: width,
|
screenWidth: width,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
@@ -52,7 +58,7 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
|||||||
double screenWidth = MediaQuery.of(context).size.width;
|
double screenWidth = MediaQuery.of(context).size.width;
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: MihMzansiDirectoryServices().getAllReviewsofBusiness(
|
future: MihMzansiDirectoryServices().getAllReviewsofBusiness(
|
||||||
widget.business.business_id,
|
business.business_id,
|
||||||
),
|
),
|
||||||
builder: (context, asyncSnapshot) {
|
builder: (context, asyncSnapshot) {
|
||||||
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
|
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
|
||||||
@@ -93,7 +99,7 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
"No reviews yet, be the first the review ${widget.business.Name}",
|
"No reviews yet, be the first the review ${business.Name}",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
|||||||
|
|
||||||
void submitUserForm(MzansiProfileProvider profileProvider) {
|
void submitUserForm(MzansiProfileProvider profileProvider) {
|
||||||
if (searchController.text != "") {
|
if (searchController.text != "") {
|
||||||
setState(() {
|
userSearch = searchController.text;
|
||||||
userSearch = searchController.text;
|
hasSearchedBefore = true;
|
||||||
hasSearchedBefore = true;
|
userSearchResults = fetchUsers(profileProvider, userSearch);
|
||||||
userSearchResults = fetchUsers(profileProvider, userSearch);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,6 +190,7 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
|||||||
searchController.clear();
|
searchController.clear();
|
||||||
userSearch = "";
|
userSearch = "";
|
||||||
});
|
});
|
||||||
|
profileProvider.setUserearchResults(userSearchResults: []);
|
||||||
},
|
},
|
||||||
searchFocusNode: _searchFocusNode,
|
searchFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_employee.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_employee.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_business_employee_services.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MihMyBusinessTeam extends StatefulWidget {
|
class MihMyBusinessTeam extends StatefulWidget {
|
||||||
@@ -23,32 +22,11 @@ class _MihMyBusinessTeamState extends State<MihMyBusinessTeam> {
|
|||||||
String errorCode = "";
|
String errorCode = "";
|
||||||
String errorBody = "";
|
String errorBody = "";
|
||||||
|
|
||||||
void getEmployeeData(MzansiProfileProvider mzansiProfileProvider) {
|
// void getEmployeeData(MzansiProfileProvider mzansiProfileProvider) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
// WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
await MihBusinessEmployeeServices()
|
// await MihBusinessEmployeeServices()
|
||||||
.fetchEmployees(mzansiProfileProvider, context);
|
// .fetchEmployees(mzansiProfileProvider, context);
|
||||||
});
|
// });
|
||||||
}
|
|
||||||
// Future<void> fetchEmployees(
|
|
||||||
// MzansiProfileProvider mzansiProfileProvider) async {
|
|
||||||
// //print("Patien manager page: $endpoint");
|
|
||||||
// final response = await http.get(Uri.parse(
|
|
||||||
// "${AppEnviroment.baseApiUrl}/business-user/employees/${mzansiProfileProvider.businessUser!.business_id}"));
|
|
||||||
// errorCode = response.statusCode.toString();
|
|
||||||
// errorBody = response.body;
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// //print("Here1");
|
|
||||||
// Iterable l = jsonDecode(response.body);
|
|
||||||
// //print("Here2");
|
|
||||||
// List<BusinessEmployee> employeeList = List<BusinessEmployee>.from(
|
|
||||||
// l.map((model) => BusinessEmployee.fromJson(model)));
|
|
||||||
// mzansiProfileProvider.setEmployeeList(employeeList: employeeList);
|
|
||||||
// //print("Here3");
|
|
||||||
// //print(patientQueue);
|
|
||||||
// // return patientQueue;
|
|
||||||
// } else {
|
|
||||||
// throw Exception('failed to load employees');
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Widget displayEmployeeList(List<BusinessEmployee> employeeList) {
|
Widget displayEmployeeList(List<BusinessEmployee> employeeList) {
|
||||||
@@ -89,7 +67,6 @@ class _MihMyBusinessTeamState extends State<MihMyBusinessTeam> {
|
|||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
||||||
if (mzansiProfileProvider.employeeList == null) {
|
if (mzansiProfileProvider.employeeList == null) {
|
||||||
getEmployeeData(mzansiProfileProvider);
|
|
||||||
return Center(
|
return Center(
|
||||||
child: Mihloadingcircle(),
|
child: Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -218,19 +218,17 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
void setControllers() {
|
void setControllers() {
|
||||||
MzansiProfileProvider mzansiProfileProvider =
|
MzansiProfileProvider mzansiProfileProvider =
|
||||||
context.read<MzansiProfileProvider>();
|
context.read<MzansiProfileProvider>();
|
||||||
setState(() {
|
fileNameController.text =
|
||||||
fileNameController.text =
|
mzansiProfileProvider.user!.pro_pic_path.split("/").last;
|
||||||
mzansiProfileProvider.user!.pro_pic_path.split("/").last;
|
signtureController.text =
|
||||||
signtureController.text =
|
mzansiProfileProvider.businessUser!.sig_path.split("/").last;
|
||||||
mzansiProfileProvider.businessUser!.sig_path.split("/").last;
|
KenLogger.success("title: ${mzansiProfileProvider.businessUser!.title}");
|
||||||
KenLogger.success("title: ${mzansiProfileProvider.businessUser!.title}");
|
KenLogger.success(
|
||||||
KenLogger.success(
|
"sig url: ${mzansiProfileProvider.businessUser!.sig_path}");
|
||||||
"sig url: ${mzansiProfileProvider.businessUser!.sig_path}");
|
titleTextController.text = mzansiProfileProvider.businessUser!.title;
|
||||||
titleTextController.text = mzansiProfileProvider.businessUser!.title;
|
fnameController.text = mzansiProfileProvider.user!.fname;
|
||||||
fnameController.text = mzansiProfileProvider.user!.fname;
|
lnameController.text = mzansiProfileProvider.user!.lname;
|
||||||
lnameController.text = mzansiProfileProvider.user!.lname;
|
accessController.text = mzansiProfileProvider.businessUser!.access;
|
||||||
accessController.text = mzansiProfileProvider.businessUser!.access;
|
|
||||||
});
|
|
||||||
if (AppEnviroment.getEnv() == "Prod") {
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
env = "Prod";
|
env = "Prod";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -58,8 +57,12 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void editCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void editCardWindow(
|
||||||
BuildContext ctxt, int index, double width) {
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
|
BuildContext ctxt,
|
||||||
|
int index,
|
||||||
|
double width) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -144,6 +147,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
int statusCode = await MIHMzansiWalletApis
|
int statusCode = await MIHMzansiWalletApis
|
||||||
.updateLoyaltyCardAPICall(
|
.updateLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
widget.cardList[index].idloyalty_cards,
|
widget.cardList[index].idloyalty_cards,
|
||||||
widget.cardList[index].shop_name,
|
widget.cardList[index].shop_name,
|
||||||
@@ -211,7 +215,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -221,6 +225,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
int statusCode =
|
int statusCode =
|
||||||
await MIHMzansiWalletApis.deleteLoyaltyCardAPICall(
|
await MIHMzansiWalletApis.deleteLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
widget.cardList[index].idloyalty_cards,
|
widget.cardList[index].idloyalty_cards,
|
||||||
context,
|
context,
|
||||||
@@ -238,7 +243,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -270,6 +275,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
int statusCode =
|
int statusCode =
|
||||||
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
widget.cardList[index].idloyalty_cards,
|
widget.cardList[index].idloyalty_cards,
|
||||||
widget.cardList[index].shop_name,
|
widget.cardList[index].shop_name,
|
||||||
@@ -283,6 +289,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!.app_id,
|
mzansiProfileProvider.user!.app_id,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
@@ -323,7 +330,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -355,6 +362,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
int statusCode =
|
int statusCode =
|
||||||
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
widget.cardList[index].idloyalty_cards,
|
widget.cardList[index].idloyalty_cards,
|
||||||
widget.cardList[index].shop_name,
|
widget.cardList[index].shop_name,
|
||||||
@@ -368,6 +376,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!.app_id,
|
mzansiProfileProvider.user!.app_id,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
@@ -396,8 +405,8 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewCardWindow(
|
void viewCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
MzansiProfileProvider mzansiProfileProvider, int index, double width) {
|
MzansiWalletProvider walletProvider, int index, double width) {
|
||||||
//print(widget.cardList[index].card_number);
|
//print(widget.cardList[index].card_number);
|
||||||
String formattedCardNumber = "";
|
String formattedCardNumber = "";
|
||||||
for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) {
|
for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) {
|
||||||
@@ -441,12 +450,14 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
if (widget.cardList[index].favourite == "") {
|
if (widget.cardList[index].favourite == "") {
|
||||||
addToFavCardWindow(
|
addToFavCardWindow(
|
||||||
mzansiProfileProvider,
|
mzansiProfileProvider,
|
||||||
|
walletProvider,
|
||||||
context,
|
context,
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
removeFromFavCardWindow(
|
removeFromFavCardWindow(
|
||||||
mzansiProfileProvider,
|
mzansiProfileProvider,
|
||||||
|
walletProvider,
|
||||||
context,
|
context,
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
@@ -476,6 +487,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
});
|
});
|
||||||
editCardWindow(
|
editCardWindow(
|
||||||
mzansiProfileProvider,
|
mzansiProfileProvider,
|
||||||
|
walletProvider,
|
||||||
context,
|
context,
|
||||||
index,
|
index,
|
||||||
width,
|
width,
|
||||||
@@ -501,6 +513,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
deleteCardWindow(
|
deleteCardWindow(
|
||||||
mzansiProfileProvider,
|
mzansiProfileProvider,
|
||||||
|
walletProvider,
|
||||||
context,
|
context,
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
@@ -508,7 +521,6 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
context.read<MihBannerAdProvider>().loadBannerAd();
|
|
||||||
resetScreenBrightness();
|
resetScreenBrightness();
|
||||||
context.pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
@@ -570,9 +582,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
Consumer(builder: (context, bannerAdDisplay, child) {
|
MihBannerAd()
|
||||||
return MihBannerAd();
|
|
||||||
}),
|
|
||||||
// MihBannerAd(),
|
// MihBannerAd(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -705,9 +715,11 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
// final double width = size.width;
|
// final double width = size.width;
|
||||||
//final double height = size.height;
|
//final double height = size.height;
|
||||||
if (widget.cardList.isNotEmpty) {
|
if (widget.cardList.isNotEmpty) {
|
||||||
return Consumer<MzansiProfileProvider>(
|
return Consumer2<MzansiProfileProvider, MzansiWalletProvider>(
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
|
Widget? child) {
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
@@ -732,6 +744,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
setScreenBrightness(1.0);
|
setScreenBrightness(1.0);
|
||||||
viewCardWindow(
|
viewCardWindow(
|
||||||
mzansiProfileProvider,
|
mzansiProfileProvider,
|
||||||
|
walletProvider,
|
||||||
index,
|
index,
|
||||||
size.width,
|
size.width,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
@@ -72,9 +73,6 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
child: MihButton(
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.goNamed(
|
|
||||||
'mzansiWallet',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
@@ -141,9 +139,11 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||||
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
||||||
: EdgeInsets.symmetric(horizontal: width * 0),
|
: EdgeInsets.symmetric(horizontal: width * 0),
|
||||||
child: Consumer<MzansiProfileProvider>(
|
child: Consumer2<MzansiProfileProvider, MzansiWalletProvider>(
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
|
Widget? child) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
MihForm(
|
MihForm(
|
||||||
@@ -158,9 +158,7 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
return MihValidationServices().isEmpty(value);
|
return MihValidationServices().isEmpty(value);
|
||||||
},
|
},
|
||||||
requiredText: true,
|
requiredText: true,
|
||||||
dropdownOptions: const [
|
dropdownOptions: const <String>[
|
||||||
"+More",
|
|
||||||
"Apple Tree",
|
|
||||||
"+More",
|
"+More",
|
||||||
"Apple Tree",
|
"Apple Tree",
|
||||||
"Auchan",
|
"Auchan",
|
||||||
@@ -206,7 +204,7 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
"Total Energies",
|
"Total Energies",
|
||||||
"Toys R Us",
|
"Toys R Us",
|
||||||
"Woermann Brock",
|
"Woermann Brock",
|
||||||
"Woolworths"
|
"Woolworths",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
@@ -306,6 +304,7 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
} else {
|
} else {
|
||||||
int statusCode = await MIHMzansiWalletApis
|
int statusCode = await MIHMzansiWalletApis
|
||||||
.addLoyaltyCardAPICall(
|
.addLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!,
|
||||||
mzansiProfileProvider.user!.app_id,
|
mzansiProfileProvider.user!.app_id,
|
||||||
_shopController.text,
|
_shopController.text,
|
||||||
@@ -317,7 +316,7 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
);
|
);
|
||||||
if (statusCode == 201) {
|
if (statusCode == 201) {
|
||||||
context.pop();
|
context.pop();
|
||||||
KenLogger.error("Card Added Successfully");
|
KenLogger.success("Card Added Successfully");
|
||||||
successPopUp(
|
successPopUp(
|
||||||
"Successfully Added Card",
|
"Successfully Added Card",
|
||||||
"The loyalty card has been added to your favourites.",
|
"The loyalty card has been added to your favourites.",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -25,25 +24,31 @@ class _MihWalletState extends State<MihWallet> {
|
|||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
Future<void> setLoyaltyCards(
|
Future<void> setLoyaltyCards(
|
||||||
MzansiProfileProvider mzansiProfileProvider) async {
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
|
) async {
|
||||||
await MIHMzansiWalletApis.getLoyaltyCards(
|
await MIHMzansiWalletApis.getLoyaltyCards(
|
||||||
mzansiProfileProvider.user!.app_id, context);
|
walletProvider, mzansiProfileProvider.user!.app_id, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setFavouritesCards(
|
Future<void> setFavouritesCards(
|
||||||
MzansiProfileProvider mzansiProfileProvider) async {
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
|
) async {
|
||||||
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||||
mzansiProfileProvider.user!.app_id, context);
|
walletProvider, mzansiProfileProvider.user!.app_id, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
var mzansiProfileProvider = context.read<MzansiProfileProvider>();
|
MzansiProfileProvider mzansiProfileProvider =
|
||||||
await setLoyaltyCards(mzansiProfileProvider);
|
context.read<MzansiProfileProvider>();
|
||||||
await setFavouritesCards(mzansiProfileProvider);
|
MzansiWalletProvider walletProvider =
|
||||||
context.read<MihBannerAdProvider>().loadBannerAd();
|
context.read<MzansiWalletProvider>();
|
||||||
|
await setLoyaltyCards(mzansiProfileProvider, walletProvider);
|
||||||
|
await setFavouritesCards(mzansiProfileProvider, walletProvider);
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
@@ -89,7 +94,6 @@ class _MihWalletState extends State<MihWallet> {
|
|||||||
temp[const Icon(Icons.favorite)] = () {
|
temp[const Icon(Icons.favorite)] = () {
|
||||||
context.read<MzansiWalletProvider>().setToolIndex(1);
|
context.read<MzansiWalletProvider>().setToolIndex(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return MihPackageTools(
|
return MihPackageTools(
|
||||||
tools: temp,
|
tools: temp,
|
||||||
selcetedIndex: context.watch<MzansiWalletProvider>().toolIndex,
|
selcetedIndex: context.watch<MzansiWalletProvider>().toolIndex,
|
||||||
|
|||||||
@@ -29,19 +29,20 @@ class MihCards extends StatefulWidget {
|
|||||||
class _MihCardsState extends State<MihCards> {
|
class _MihCardsState extends State<MihCards> {
|
||||||
final TextEditingController cardSearchController = TextEditingController();
|
final TextEditingController cardSearchController = TextEditingController();
|
||||||
final FocusNode searchFocusNode = FocusNode();
|
final FocusNode searchFocusNode = FocusNode();
|
||||||
List<MIHLoyaltyCard> listOfCards = [];
|
|
||||||
final ValueNotifier<List<MIHLoyaltyCard>> searchShopName = ValueNotifier([]);
|
final ValueNotifier<List<MIHLoyaltyCard>> searchShopName = ValueNotifier([]);
|
||||||
final MobileScannerController scannerController = MobileScannerController(
|
final MobileScannerController scannerController = MobileScannerController(
|
||||||
detectionSpeed: DetectionSpeed.unrestricted,
|
detectionSpeed: DetectionSpeed.unrestricted,
|
||||||
);
|
);
|
||||||
final boxFit = BoxFit.contain;
|
final boxFit = BoxFit.contain;
|
||||||
|
late MzansiWalletProvider _walletProvider;
|
||||||
|
late VoidCallback _searchListener;
|
||||||
|
|
||||||
void searchShop() {
|
void searchShop(List<MIHLoyaltyCard> allCards) {
|
||||||
if (cardSearchController.text.isEmpty) {
|
if (cardSearchController.text.isEmpty) {
|
||||||
searchShopName.value = listOfCards;
|
searchShopName.value = allCards;
|
||||||
} else {
|
} else {
|
||||||
List<MIHLoyaltyCard> temp = [];
|
List<MIHLoyaltyCard> temp = [];
|
||||||
for (var item in listOfCards) {
|
for (var item in allCards) {
|
||||||
if (item.shop_name
|
if (item.shop_name
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(cardSearchController.text.toLowerCase()) ||
|
.contains(cardSearchController.text.toLowerCase()) ||
|
||||||
@@ -130,24 +131,21 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
cardSearchController.removeListener(searchShop);
|
cardSearchController.removeListener(_searchListener);
|
||||||
cardSearchController.dispose();
|
cardSearchController.dispose();
|
||||||
searchShopName.dispose();
|
searchShopName.dispose();
|
||||||
searchFocusNode.dispose();
|
searchFocusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLoyaltyCards(BuildContext context) async {
|
|
||||||
setState(() {
|
|
||||||
listOfCards = context.read<MzansiWalletProvider>().loyaltyCards;
|
|
||||||
});
|
|
||||||
searchShop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
getLoyaltyCards(context);
|
_walletProvider = context.read<MzansiWalletProvider>();
|
||||||
cardSearchController.addListener(searchShop);
|
_searchListener = () {
|
||||||
|
searchShop(_walletProvider.loyaltyCards);
|
||||||
|
};
|
||||||
|
searchShopName.value = _walletProvider.loyaltyCards;
|
||||||
|
cardSearchController.addListener(_searchListener);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,76 +160,89 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody(double width) {
|
Widget getBody(double width) {
|
||||||
return Stack(
|
return Consumer<MzansiWalletProvider>(
|
||||||
children: [
|
builder: (BuildContext context, MzansiWalletProvider walletProvider,
|
||||||
MihSingleChildScroll(
|
Widget? child) {
|
||||||
child: Column(
|
if (cardSearchController.text.isEmpty) {
|
||||||
children: [
|
searchShopName.value = walletProvider.loyaltyCards;
|
||||||
Padding(
|
} else {
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
// Re-run search with updated card list
|
||||||
child: MihSearchBar(
|
searchShop(walletProvider.loyaltyCards);
|
||||||
controller: cardSearchController,
|
}
|
||||||
hintText: "Search Cards",
|
return Stack(
|
||||||
// prefixIcon: Icons.search,
|
children: [
|
||||||
prefixIcon: Icons.search,
|
MihSingleChildScroll(
|
||||||
fillColor: MihColors.getSecondaryColor(
|
child: Column(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
children: [
|
||||||
hintColor: MihColors.getPrimaryColor(
|
Padding(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onPrefixIconTap: () {
|
child: MihSearchBar(
|
||||||
// print("Search Icon Pressed: ${cardSearchController.text}");
|
controller: cardSearchController,
|
||||||
},
|
hintText: "Search Cards",
|
||||||
searchFocusNode: searchFocusNode,
|
// prefixIcon: Icons.search,
|
||||||
),
|
prefixIcon: Icons.search,
|
||||||
),
|
fillColor: MihColors.getSecondaryColor(
|
||||||
const SizedBox(height: 10),
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
Consumer<MzansiWalletProvider>(
|
"Dark"),
|
||||||
builder: (context, mzansiWalletProvider, child) {
|
hintColor: MihColors.getPrimaryColor(
|
||||||
listOfCards = mzansiWalletProvider.loyaltyCards;
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
return ValueListenableBuilder<List<MIHLoyaltyCard>>(
|
"Dark"),
|
||||||
valueListenable: searchShopName,
|
onPrefixIconTap: () {
|
||||||
builder: (context, filteredCards, child) {
|
// print("Search Icon Pressed: ${cardSearchController.text}");
|
||||||
return BuildLoyaltyCardList(
|
},
|
||||||
cardList: filteredCards, //listOfCards,
|
searchFocusNode: searchFocusNode,
|
||||||
navIndex: 0,
|
),
|
||||||
favouritesMode: false,
|
|
||||||
searchText: cardSearchController,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 10,
|
|
||||||
bottom: 10,
|
|
||||||
child: MihFloatingMenu(
|
|
||||||
animatedIcon: AnimatedIcons.menu_close,
|
|
||||||
children: [
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.add,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
),
|
||||||
label: "Add Loyalty Card",
|
const SizedBox(height: 10),
|
||||||
labelBackgroundColor: MihColors.getGreenColor(
|
ValueListenableBuilder<List<MIHLoyaltyCard>>(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
valueListenable: searchShopName,
|
||||||
labelStyle: TextStyle(
|
builder: (context, filteredCards, child) {
|
||||||
color: MihColors.getPrimaryColor(
|
return BuildLoyaltyCardList(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
cardList: filteredCards, //listOfCards,
|
||||||
fontWeight: FontWeight.bold,
|
navIndex: 0,
|
||||||
|
favouritesMode: false,
|
||||||
|
searchText: cardSearchController,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: MihColors.getGreenColor(
|
],
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
),
|
||||||
onTap: () {
|
),
|
||||||
addCardWindow(context, width);
|
Positioned(
|
||||||
},
|
right: 10,
|
||||||
)
|
bottom: 10,
|
||||||
]),
|
child: MihFloatingMenu(
|
||||||
)
|
animatedIcon: AnimatedIcons.menu_close,
|
||||||
],
|
children: [
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
label: "Add Loyalty Card",
|
||||||
|
labelBackgroundColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
onTap: () {
|
||||||
|
addCardWindow(context, width);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class PatientProfileTile extends StatefulWidget {
|
class PatientProfileTile extends StatefulWidget {
|
||||||
@@ -27,13 +29,24 @@ class _PatientProfileTileState extends State<PatientProfileTile> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackageTile(
|
return MihPackageTile(
|
||||||
authenticateUser: true,
|
authenticateUser: true,
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
PatientManagerProvider patientManagerProvider =
|
PatientManagerProvider patientManagerProvider =
|
||||||
context.read<PatientManagerProvider>();
|
context.read<PatientManagerProvider>();
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
String? app_id = profileProvider.user!.app_id;
|
||||||
|
if (patientManagerProvider.selectedPatient == null) {
|
||||||
|
await MihPatientServices()
|
||||||
|
.getPatientDetails(app_id, patientManagerProvider);
|
||||||
|
}
|
||||||
patientManagerProvider.setPersonalMode(true);
|
patientManagerProvider.setPersonalMode(true);
|
||||||
context.goNamed(
|
if (patientManagerProvider.selectedPatient != null) {
|
||||||
'patientProfile',
|
context.goNamed(
|
||||||
);
|
'patientProfile',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
context.goNamed("patientProfileSetup");
|
||||||
|
}
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
// '/patient-profile',
|
// '/patient-profile',
|
||||||
// arguments: widget.arguments,
|
// arguments: widget.arguments,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: patientManagerProvider.personalMode,
|
visible: !patientManagerProvider.personalMode,
|
||||||
child: Positioned(
|
child: Positioned(
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart';
|
||||||
@@ -30,19 +29,9 @@ class _PatientProfileState extends State<PatientProfile> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
MzansiProfileProvider profileProvider =
|
|
||||||
context.read<MzansiProfileProvider>();
|
|
||||||
PatientManagerProvider patientManagerProvider =
|
PatientManagerProvider patientManagerProvider =
|
||||||
context.read<PatientManagerProvider>();
|
context.read<PatientManagerProvider>();
|
||||||
String? app_id = profileProvider.user!.app_id;
|
if (patientManagerProvider.selectedPatient != null) {
|
||||||
if (patientManagerProvider.selectedPatient == null) {
|
|
||||||
await MihPatientServices()
|
|
||||||
.getPatientDetails(app_id, patientManagerProvider);
|
|
||||||
}
|
|
||||||
if (patientManagerProvider.selectedPatient == null) {
|
|
||||||
// go to set up patient package
|
|
||||||
context.goNamed("patientProfileSetup");
|
|
||||||
} else {
|
|
||||||
await MihPatientServices()
|
await MihPatientServices()
|
||||||
.getPatientConsultationNotes(patientManagerProvider);
|
.getPatientConsultationNotes(patientManagerProvider);
|
||||||
await MihPatientServices().getPatientDocuments(patientManagerProvider);
|
await MihPatientServices().getPatientDocuments(patientManagerProvider);
|
||||||
|
|||||||
@@ -166,7 +166,8 @@ class MihMzansiDirectoryServices {
|
|||||||
List<BookmarkedBusiness> favouriteBusinesses =
|
List<BookmarkedBusiness> favouriteBusinesses =
|
||||||
List<BookmarkedBusiness>.from(
|
List<BookmarkedBusiness>.from(
|
||||||
l.map((model) => BookmarkedBusiness.fromJson(model)));
|
l.map((model) => BookmarkedBusiness.fromJson(model)));
|
||||||
directoryProvider.setFavouriteBusinesses(businesses: favouriteBusinesses);
|
directoryProvider.setBookmarkedeBusinesses(
|
||||||
|
businesses: favouriteBusinesses);
|
||||||
return favouriteBusinesses;
|
return favouriteBusinesses;
|
||||||
} else if (response.statusCode == 404) {
|
} else if (response.statusCode == 404) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/loyalty_card.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/loyalty_card.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import '../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import '../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
import '../mih_config/mih_env.dart';
|
import '../mih_config/mih_env.dart';
|
||||||
@@ -17,6 +16,7 @@ class MIHMzansiWalletApis {
|
|||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
static Future<void> getLoyaltyCards(
|
static Future<void> getLoyaltyCards(
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
String app_id,
|
String app_id,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
@@ -26,7 +26,7 @@ class MIHMzansiWalletApis {
|
|||||||
Iterable l = jsonDecode(response.body);
|
Iterable l = jsonDecode(response.body);
|
||||||
List<MIHLoyaltyCard> myCards = List<MIHLoyaltyCard>.from(
|
List<MIHLoyaltyCard> myCards = List<MIHLoyaltyCard>.from(
|
||||||
l.map((model) => MIHLoyaltyCard.fromJson(model)));
|
l.map((model) => MIHLoyaltyCard.fromJson(model)));
|
||||||
context.read<MzansiWalletProvider>().setLoyaltyCards(cards: myCards);
|
walletProvider.setLoyaltyCards(cards: myCards);
|
||||||
// return myCards;
|
// return myCards;
|
||||||
} else {
|
} else {
|
||||||
throw Exception('failed to fatch loyalty cards');
|
throw Exception('failed to fatch loyalty cards');
|
||||||
@@ -34,6 +34,7 @@ class MIHMzansiWalletApis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> getFavouriteLoyaltyCards(
|
static Future<void> getFavouriteLoyaltyCards(
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
String app_id,
|
String app_id,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
@@ -44,7 +45,7 @@ class MIHMzansiWalletApis {
|
|||||||
Iterable l = jsonDecode(response.body);
|
Iterable l = jsonDecode(response.body);
|
||||||
List<MIHLoyaltyCard> myCards = List<MIHLoyaltyCard>.from(
|
List<MIHLoyaltyCard> myCards = List<MIHLoyaltyCard>.from(
|
||||||
l.map((model) => MIHLoyaltyCard.fromJson(model)));
|
l.map((model) => MIHLoyaltyCard.fromJson(model)));
|
||||||
context.read<MzansiWalletProvider>().setFavouriteCards(cards: myCards);
|
walletProvider.setFavouriteCards(cards: myCards);
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
// throw Exception('failed to fatch loyalty cards');
|
// throw Exception('failed to fatch loyalty cards');
|
||||||
@@ -60,6 +61,7 @@ class MIHMzansiWalletApis {
|
|||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
||||||
static Future<int> deleteLoyaltyCardAPICall(
|
static Future<int> deleteLoyaltyCardAPICall(
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
int idloyalty_cards,
|
int idloyalty_cards,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
@@ -77,9 +79,7 @@ class MIHMzansiWalletApis {
|
|||||||
//print(response.statusCode);
|
//print(response.statusCode);
|
||||||
context.pop();
|
context.pop();
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
context
|
walletProvider.deleteLoyaltyCard(cardId: idloyalty_cards);
|
||||||
.read<MzansiWalletProvider>()
|
|
||||||
.deleteLoyaltyCard(cardId: idloyalty_cards);
|
|
||||||
}
|
}
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
// if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
@@ -111,6 +111,7 @@ class MIHMzansiWalletApis {
|
|||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<int> addLoyaltyCardAPICall(
|
static Future<int> addLoyaltyCardAPICall(
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
String app_id,
|
String app_id,
|
||||||
String shop_name,
|
String shop_name,
|
||||||
@@ -137,6 +138,10 @@ class MIHMzansiWalletApis {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
context.pop();
|
context.pop();
|
||||||
|
KenLogger.success("Response: $response");
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
await getLoyaltyCards(walletProvider, app_id, context);
|
||||||
|
}
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
// if (response.statusCode == 201) {
|
// if (response.statusCode == 201) {
|
||||||
// // Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
@@ -164,6 +169,7 @@ class MIHMzansiWalletApis {
|
|||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
||||||
static Future<int> updateLoyaltyCardAPICall(
|
static Future<int> updateLoyaltyCardAPICall(
|
||||||
|
MzansiWalletProvider walletProvider,
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
int idloyalty_cards,
|
int idloyalty_cards,
|
||||||
String shopName,
|
String shopName,
|
||||||
@@ -190,17 +196,17 @@ class MIHMzansiWalletApis {
|
|||||||
);
|
);
|
||||||
context.pop();
|
context.pop();
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
context.read<MzansiWalletProvider>().editLoyaltyCard(
|
walletProvider.editLoyaltyCard(
|
||||||
updatedCard: MIHLoyaltyCard(
|
updatedCard: MIHLoyaltyCard(
|
||||||
idloyalty_cards: idloyalty_cards,
|
idloyalty_cards: idloyalty_cards,
|
||||||
app_id: signedInUser.app_id,
|
app_id: signedInUser.app_id,
|
||||||
shop_name: shopName,
|
shop_name: shopName,
|
||||||
card_number: card_number,
|
card_number: card_number,
|
||||||
favourite: favourite,
|
favourite: favourite,
|
||||||
priority_index: priority_index,
|
priority_index: priority_index,
|
||||||
nickname: nickname,
|
nickname: nickname,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: mzansi_innovation_hub
|
name: mzansi_innovation_hub
|
||||||
description: ""
|
description: ""
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 1.2.2+99
|
version: 1.2.2+103
|
||||||
# version: 1.1.1+97 #--- Updated version for upgrader package testing
|
# version: 1.1.1+97 #--- Updated version for upgrader package testing
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user