diff --git a/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart b/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart index 85006f32..94a2fb7b 100644 --- a/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart +++ b/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart @@ -1,3 +1,4 @@ +import 'package:country_code_picker/country_code_picker.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; @@ -185,6 +186,20 @@ class _PackageToolOneState extends State { ], ), const SizedBox(height: 20), + CountryCodePicker( + padding: EdgeInsetsGeometry.all(0), + onChanged: (selectedCode) { + debugPrint("Selected Country Code: $selectedCode"); + }, + initialSelection: '+27', + showDropDownButton: false, + pickerStyle: PickerStyle.bottomSheet, + dialogBackgroundColor: + MzansiInnovationHub.of(context)!.theme.primaryColor(), + barrierColor: + MzansiInnovationHub.of(context)!.theme.primaryColor(), + ), + const SizedBox(height: 10), Center( child: MihButton( onPressed: () { @@ -305,7 +320,7 @@ class _PackageToolOneState extends State { "registration_no", "logo_name", "logo_path", - "contact_no", + "+27812345679", "bus_email", "app_id", "gps_location", diff --git a/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-dark.png b/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-dark.png new file mode 100644 index 00000000..a9e5cff9 Binary files /dev/null and b/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-dark.png differ diff --git a/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-light.png b/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-light.png new file mode 100644 index 00000000..69e2ea5b Binary files /dev/null and b/Frontend/lib/mih_components/mih_package_components/assets/images/i-dont-know-light.png differ diff --git a/Frontend/lib/mih_packages/access_review/package_tools/mih_access_requests.dart b/Frontend/lib/mih_packages/access_review/package_tools/mih_access_requests.dart index 5eb6cfb1..97d0bf67 100644 --- a/Frontend/lib/mih_packages/access_review/package_tools/mih_access_requests.dart +++ b/Frontend/lib/mih_packages/access_review/package_tools/mih_access_requests.dart @@ -1,3 +1,4 @@ +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.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_dropdwn_field.dart'; @@ -186,17 +187,77 @@ class _MihAccessRequestState extends State { patientAccessList: accessRequestList, ); } else { - return Center( - child: Text( - "No Request have been made.", - style: TextStyle( - fontSize: 25, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.accessControl, + size: 165, color: MzansiInnovationHub.of(context)! .theme - .messageTextColor()), - textAlign: TextAlign.center, + .secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "No Access has been granted to your MIH Profile", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + // const SizedBox(height: 10), + // Center( + // child: RichText( + // textAlign: TextAlign.center, + // text: TextSpan( + // style: TextStyle( + // fontSize: 20, + // fontWeight: FontWeight.normal, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // children: [ + // TextSpan(text: "Press "), + // WidgetSpan( + // alignment: PlaceholderAlignment.middle, + // child: Icon( + // Icons.menu, + // size: 20, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // TextSpan( + // text: " to add your first loyalty card."), + // ], + // ), + // ), + // ), + ], ), ); + // return Center( + // child: Text( + // "No Request have been made.", + // style: TextStyle( + // fontSize: 25, + // color: MzansiInnovationHub.of(context)! + // .theme + // .messageTextColor()), + // textAlign: TextAlign.center, + // ), + // ); } // return Expanded( diff --git a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart index e2ea3fa9..5077edce 100644 --- a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart +++ b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart @@ -1,4 +1,5 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; @@ -83,21 +84,79 @@ class _PatientAccessRequestState extends State { } return Expanded( child: Padding( - padding: const EdgeInsets.only(top: 35.0), - child: Align( - alignment: Alignment.center, - child: Text( - "No Appointments for $selectedDay", - style: TextStyle( - fontSize: 25, - color: MzansiInnovationHub.of(context)!.theme.messageTextColor(), + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.calendar, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), - textAlign: TextAlign.center, - softWrap: true, - ), + const SizedBox(height: 10), + Text( + "No Appointments for $selectedDay", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan( + text: + " to add an appointment or select a different date"), + ], + ), + ), + ), + ], ), ), ); + // return Expanded( + // child: Padding( + // padding: const EdgeInsets.only(top: 35.0), + // child: Align( + // alignment: Alignment.center, + // child: Text( + // "No Appointments for $selectedDay", + // style: TextStyle( + // fontSize: 25, + // color: MzansiInnovationHub.of(context)!.theme.messageTextColor(), + // ), + // textAlign: TextAlign.center, + // softWrap: true, + // ), + // ), + // ), + // ); } void addAppointmentWindow(double width) { diff --git a/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart b/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart index 7f7f9e56..baf50b96 100644 --- a/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart +++ b/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart @@ -306,7 +306,8 @@ class _MihSignInState extends State { passwordMode: true, autofillHints: const [AutofillHints.password], validator: (value) { - return MihValidationServices().validatePassword(value); + // return MihValidationServices().validatePassword(value); + return null; }, ), const SizedBox(height: 10), diff --git a/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart b/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart index ca33bd45..7db01937 100644 --- a/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart +++ b/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart @@ -230,29 +230,33 @@ class _MihBusinessHomeState extends State // ), // ), // const SizedBox(height: 20), - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: searchController, - hintText: "Ask Mzansi", - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - fillColor: - MzansiInnovationHub.of(context)!.theme.secondaryColor(), - hintColor: MzansiInnovationHub.of(context)!.theme.primaryColor(), - onPrefixIconTap: () { - Navigator.of(context).pushNamed( - '/mzansi-ai', - arguments: MzansiAiArguments( - widget.signedInUser, - searchController.text.isEmpty - ? null - : searchController.text, - ), - ); - searchController.clear(); - }, - searchFocusNode: _searchFocusNode, + Visibility( + visible: !widget.isBusinessUserNew, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: width / 20), + child: MihSearchBar( + controller: searchController, + hintText: "Ask Mzansi", + prefixIcon: Icons.search, + prefixAltIcon: MihIcons.mzansiAi, + fillColor: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + hintColor: + MzansiInnovationHub.of(context)!.theme.primaryColor(), + onPrefixIconTap: () { + Navigator.of(context).pushNamed( + '/mzansi-ai', + arguments: MzansiAiArguments( + widget.signedInUser, + searchController.text.isEmpty + ? null + : searchController.text, + ), + ); + searchController.clear(); + }, + searchFocusNode: _searchFocusNode, + ), ), ), const SizedBox(height: 10), diff --git a/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart b/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart index d92c4e97..e83df4de 100644 --- a/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart +++ b/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart @@ -213,6 +213,18 @@ class _MihPersonalHomeState extends State } } + void autoNavToProfile() { + WidgetsBinding.instance.addPostFrameCallback((_) { + Navigator.of(context).pushNamed( + '/mzansi-profile', + arguments: AppProfileUpdateArguments( + widget.signedInUser, + widget.propicFile, + ), + ); + }); + } + @override void dispose() { super.dispose(); @@ -229,17 +241,11 @@ class _MihPersonalHomeState extends State searchController.addListener(searchPackage); if (widget.isUserNew) { personalPackagesMap = setNerUserPersonalPackage(); + autoNavToProfile(); } else { personalPackagesMap = setPersonalPackagesMap(); } searchPackage(); - //Scrolling Banner message - // _marqueeController = AnimationController( - // vsync: this, - // duration: const Duration(seconds: 12), - // ); - // _scrollController = ScrollController(); - // WidgetsBinding.instance.addPostFrameCallback((_) => _startMarquee()); } @override @@ -275,29 +281,33 @@ class _MihPersonalHomeState extends State // ), // ), // const SizedBox(height: 20), - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: searchController, - hintText: "Ask Mzansi", - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - fillColor: - MzansiInnovationHub.of(context)!.theme.secondaryColor(), - hintColor: MzansiInnovationHub.of(context)!.theme.primaryColor(), - onPrefixIconTap: () { - Navigator.of(context).pushNamed( - '/mzansi-ai', - arguments: MzansiAiArguments( - widget.signedInUser, - searchController.text.isEmpty - ? null - : searchController.text, - ), - ); - searchController.clear(); - }, - searchFocusNode: _searchFocusNode, + Visibility( + visible: !widget.isUserNew, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: width / 20), + child: MihSearchBar( + controller: searchController, + hintText: "Ask Mzansi", + prefixIcon: Icons.search, + prefixAltIcon: MihIcons.mzansiAi, + fillColor: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + hintColor: + MzansiInnovationHub.of(context)!.theme.primaryColor(), + onPrefixIconTap: () { + Navigator.of(context).pushNamed( + '/mzansi-ai', + arguments: MzansiAiArguments( + widget.signedInUser, + searchController.text.isEmpty + ? null + : searchController.text, + ), + ); + searchController.clear(); + }, + searchFocusNode: _searchFocusNode, + ), ), ), const SizedBox(height: 20), diff --git a/Frontend/lib/mih_packages/mzansi_ai/package_tools/ai_chat.dart b/Frontend/lib/mih_packages/mzansi_ai/package_tools/ai_chat.dart index 67dfa582..a453116c 100644 --- a/Frontend/lib/mih_packages/mzansi_ai/package_tools/ai_chat.dart +++ b/Frontend/lib/mih_packages/mzansi_ai/package_tools/ai_chat.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_dropdwn_field.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_numeric_stepper.dart'; @@ -653,6 +654,7 @@ class _AiChatState extends State { }, child: Chat( messages: _messages, + emptyState: noMessagescDisplay(), // onAttachmentPressed: _handleAttachmentPressed, // onMessageTap: _handleMessageTap, // onPreviewDataFetched: _handlePreviewDataFetched, @@ -794,4 +796,63 @@ class _AiChatState extends State { ], ); } + + Widget? noMessagescDisplay() { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.mzansiAi, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Mzansi AI is here to help", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan( + text: + "Send us a message and we'll try our best to assist you"), + // WidgetSpan( + // alignment: PlaceholderAlignment.middle, + // child: Icon( + // Icons.menu, + // size: 20, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // TextSpan(text: " to add your first loyalty card."), + ], + ), + ), + ), + ], + ), + ); + } } diff --git a/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart b/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart index fb018a73..9f71b4ae 100644 --- a/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart +++ b/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/bookmarked_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_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_single_child_scroll.dart'; @@ -143,55 +144,23 @@ class _MihFavouriteBusinessesState extends State { children: [ const SizedBox(height: 50), Icon( - Icons - .search_off_rounded, // A different icon for "no results" - size: 150, + MihIcons.iDontKnow, + size: 165, color: MzansiInnovationHub.of(context)! .theme .secondaryColor(), ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10.0), - child: SizedBox( - width: 500, - child: Text( - "No businesses found for '${businessSearchController.text}'", // Specific message for no search results - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ); - } else if (businesses.isEmpty) { - // Initial empty state - return Column( - children: [ - const SizedBox(height: 50), - Icon( - Icons.business_center_rounded, - size: 150, - color: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10.0), - child: SizedBox( - width: 500, - child: Text( - "No favourites yet, use Mzansi Search to find and bookmark businesses you like", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), + const SizedBox(height: 10), + Text( + "Let's Try Refining Your Search", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), ), ), ], @@ -206,31 +175,68 @@ class _MihFavouriteBusinessesState extends State { ); } else { // This block handles the case where there are no bookmarked businesses initially - return Column( - children: [ - const SizedBox(height: 50), - Icon( - Icons.business_center_rounded, - size: 150, - color: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: SizedBox( - width: 500, - child: Text( - "No favourites yet, use Mzansi Search to find and bookmark businesses you like", + + 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: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "No Businesses added to your Favourites", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Use the Mzansi Search"), + // WidgetSpan( + // alignment: + // PlaceholderAlignment.middle, + // child: Icon( + // Icons.search, + // size: 20, + // color: + // MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + TextSpan( + text: " to find Businesses of Mzansi"), + ], ), ), ), - ), - ], + ], + ), ); } } else if (snapshot.hasError) { diff --git a/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart b/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart index 714f20a8..81a1fde9 100644 --- a/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart +++ b/Frontend/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart @@ -211,7 +211,7 @@ class _MihSearchMzansiState extends State { Expanded( child: MihDropdownField( controller: businessTypeController, - hintText: "Business Type Filter", + hintText: "Business Type", dropdownOptions: options, requiredText: true, editable: true, @@ -282,31 +282,89 @@ class _MihSearchMzansiState extends State { ], ); } else if (!snapshot.hasData) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.personalProfile, - size: 165, - color: - MzansiInnovationHub.of(context)!.theme.secondaryColor(), - ), - const SizedBox(height: 10), - Text( - "People Of Mzansi!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.personalProfile, + size: 165, color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), - ), - ], + const SizedBox(height: 10), + Text( + "Search for People Of Mzansi!", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.swap_horiz_rounded, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to search for Businesses of Mzansi"), + ], + ), + ), + ), + ], + ), ); + // return Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // const SizedBox(height: 50), + // Icon( + // MihIcons.personalProfile, + // size: 165, + // color: + // MzansiInnovationHub.of(context)!.theme.secondaryColor(), + // ), + // const SizedBox(height: 10), + // Text( + // "People Of Mzansi!", + // textAlign: TextAlign.center, + // overflow: TextOverflow.visible, + // style: TextStyle( + // fontSize: 25, + // fontWeight: FontWeight.bold, + // color: + // MzansiInnovationHub.of(context)!.theme.secondaryColor(), + // ), + // ), + // ], + // ); } else if (snapshot.connectionState == ConnectionState.done && snapshot.hasData && snapshot.requireData!.isEmpty) { @@ -400,30 +458,92 @@ class _MihSearchMzansiState extends State { ], ); } else if (!snapshot.hasData) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.businessProfile, - size: 165, - color: - MzansiInnovationHub.of(context)!.theme.secondaryColor(), - ), - const SizedBox(height: 10), - Text( - "Businesses Of Mzansi!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, + 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: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), - ), - ], + const SizedBox(height: 10), + Text( + "Search for Business Of Mzansi!", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.swap_horiz_rounded, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to search for People of Mzansi"), + ], + ), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.filter_list_rounded, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to filter business types"), + ], + ), + ), + ), + ], + ), ); } else { return Center( diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_info_card.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_info_card.dart index 6ef8bbdc..3ca50400 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_info_card.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_info_card.dart @@ -40,7 +40,8 @@ class _MihBusinessCardState extends State { } Future _makePhoneCall(String phoneNumber) async { - final Uri url = Uri(scheme: 'tel', path: phoneNumber); + String formattedNumber = phoneNumber.replaceAll("-", ""); + final Uri url = Uri(scheme: 'tel', path: formattedNumber); if (await canLaunchUrl(url)) { await launchUrl(url); } else { diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart index 4e905377..35aa1798 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart @@ -29,9 +29,9 @@ class _MzansiSetupBusinessProfileTileState arguments: widget.signedInUser, ); }, - appName: "Setup Business", + appName: "Set Up Business", appIcon: Icon( - MihIcons.profileSetup, + MihIcons.businessSetup, color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), iconSize: widget.packageSize, diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart index f74ae51f..6c0dd053 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart @@ -1,8 +1,7 @@ +import 'package:country_code_picker/country_code_picker.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_business_info_card.dart'; @@ -44,6 +43,7 @@ class _MihBusinessDetailsState extends State { final typeController = TextEditingController(); final practiceNoController = TextEditingController(); final vatNoController = TextEditingController(); + final countryCodeController = TextEditingController(); final contactController = TextEditingController(); final emailController = TextEditingController(); final locationController = TextEditingController(); @@ -65,7 +65,8 @@ class _MihBusinessDetailsState extends State { practiceNoController.text, vatNoController.text, emailController.text, - contactController.text, + getNumberWithCountryCode(), + // contactController.text, locationController.text, fileNameController.text, websiteController.text, @@ -196,6 +197,34 @@ class _MihBusinessDetailsState extends State { } } + void setContactNumberControllers() { + if (widget.arguments.business!.contact_no[0] == "+") { + List contactDetails = + widget.arguments.business!.contact_no.split("-"); + setState(() { + countryCodeController.text = contactDetails[0]; + contactController.text = contactDetails[1]; + }); + } else { + setState(() { + countryCodeController.text = "+27"; + contactController.text = widget.arguments.business!.contact_no; + }); + } + } + + String getNumberWithCountryCode() { + String numberWithoutBeginingZero = ""; + if (contactController.text[0] == "0") { + numberWithoutBeginingZero = contactController.text + .replaceAll(" ", "") + .substring(1, contactController.text.length); + } else { + numberWithoutBeginingZero = contactController.text.replaceAll("-", " "); + } + return "${countryCodeController.text}-$numberWithoutBeginingZero"; + } + void editBizProfileWindow(double width) { showDialog( context: context, @@ -204,6 +233,7 @@ class _MihBusinessDetailsState extends State { windowTitle: 'Edit Profile', onWindowTapClose: () { Navigator.of(context).pop(); + resetControllers(); }, windowBody: MihSingleChildScroll( child: Padding( @@ -284,17 +314,6 @@ class _MihBusinessDetailsState extends State { return MihValidationServices().isEmpty(value); }, ), - // MihDropdownField( - // controller: typeController, - // hintText: "Business Type", - // dropdownOptions: const ["Doctors Office", "Other"], - // editable: true, - // enableSearch: true, - // validator: (value) { - // return MihValidationServices().isEmpty(value); - // }, - // requiredText: true, - // ), const SizedBox(height: 10), MihTextFormField( fillColor: MzansiInnovationHub.of(context)! @@ -313,37 +332,61 @@ class _MihBusinessDetailsState extends State { }, ), const SizedBox(height: 10), - MihTextFormField( - fillColor: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - inputColor: MzansiInnovationHub.of(context)! - .theme - .primaryColor(), - controller: contactController, - multiLineInput: false, - requiredText: true, - hintText: "Contact Number", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, + Container( + width: 300, + alignment: Alignment.topLeft, + child: const Text( + "Contact Number:", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - inputColor: MzansiInnovationHub.of(context)! - .theme - .primaryColor(), - controller: websiteController, - multiLineInput: false, - requiredText: false, - hintText: "Business Website", - validator: (value) { - return MihValidationServices() - .validateWebsite(value, false); - }, + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + CountryCodePicker( + padding: EdgeInsetsGeometry.all(0), + onChanged: (selectedCode) { + setState(() { + countryCodeController.text = + selectedCode.toString(); + }); + debugPrint( + "Selected Country Code: ${countryCodeController.text}"); + }, + initialSelection: countryCodeController.text, + showDropDownButton: false, + pickerStyle: PickerStyle.bottomSheet, + dialogBackgroundColor: + MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + barrierColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + ), + Expanded( + child: MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + controller: contactController, + numberMode: true, + multiLineInput: false, + requiredText: true, + hintText: null, + validator: (value) { + return MihValidationServices() + .isEmpty(value); + }, + ), + ), + ], ), const SizedBox(height: 10), MihTextFormField( @@ -394,6 +437,23 @@ class _MihBusinessDetailsState extends State { ), ), const SizedBox(height: 10.0), + MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + controller: websiteController, + multiLineInput: false, + requiredText: false, + hintText: "Business Website", + validator: (value) { + return MihValidationServices() + .validateWebsite(value, false); + }, + ), + const SizedBox(height: 10), MihTextFormField( fillColor: MzansiInnovationHub.of(context)! .theme @@ -403,10 +463,11 @@ class _MihBusinessDetailsState extends State { .primaryColor(), controller: regController, multiLineInput: false, - requiredText: true, + requiredText: false, hintText: "Registration No.", validator: (value) { - return MihValidationServices().isEmpty(value); + // return MihValidationServices().isEmpty(value); + return null; }, ), const SizedBox(height: 10), @@ -419,8 +480,7 @@ class _MihBusinessDetailsState extends State { .primaryColor(), controller: practiceNoController, multiLineInput: false, - requiredText: - typeController.text == "Doctors Office", + requiredText: false, hintText: "Practice Number", validator: (validateValue) { return null; @@ -436,10 +496,11 @@ class _MihBusinessDetailsState extends State { .primaryColor(), controller: vatNoController, multiLineInput: false, - requiredText: true, + requiredText: false, hintText: "VAT Number", validator: (value) { - return MihValidationServices().isEmpty(value); + // return MihValidationServices().isEmpty(value); + return null; }, ), const SizedBox(height: 10), @@ -547,6 +608,34 @@ class _MihBusinessDetailsState extends State { } } + void resetControllers() { + setState(() { + fileNameController.text = + widget.arguments.business!.logo_path.split("/").last; + regController.text = widget.arguments.business!.registration_no; + nameController.text = widget.arguments.business!.Name; + typeController.text = widget.arguments.business!.type; + practiceNoController.text = widget.arguments.business!.practice_no; + vatNoController.text = widget.arguments.business!.vat_no; + emailController.text = widget.arguments.business!.bus_email; + locationController.text = widget.arguments.business!.gps_location; + websiteController.text = widget.arguments.business!.website; + ratingController.text = widget.arguments.business!.rating; + missionVisionController.text = widget.arguments.business!.mission_vision; + }); + setContactNumberControllers(); + if (AppEnviroment.getEnv() == "Prod") { + env = "Prod"; + } else { + env = "Dev"; + } + missionVisionController.addListener(() { + setState(() { + _counter.value = missionVisionController.text.characters.length; + }); + }); + } + @override void dispose() { super.dispose(); @@ -568,31 +657,7 @@ class _MihBusinessDetailsState extends State { @override void initState() { super.initState(); - setState(() { - fileNameController.text = - widget.arguments.business!.logo_path.split("/").last; - regController.text = widget.arguments.business!.registration_no; - nameController.text = widget.arguments.business!.Name; - typeController.text = widget.arguments.business!.type; - practiceNoController.text = widget.arguments.business!.practice_no; - vatNoController.text = widget.arguments.business!.vat_no; - contactController.text = widget.arguments.business!.contact_no; - emailController.text = widget.arguments.business!.bus_email; - locationController.text = widget.arguments.business!.gps_location; - websiteController.text = widget.arguments.business!.website; - ratingController.text = widget.arguments.business!.rating; - missionVisionController.text = widget.arguments.business!.mission_vision; - }); - if (AppEnviroment.getEnv() == "Prod") { - env = "Prod"; - } else { - env = "Dev"; - } - missionVisionController.addListener(() { - setState(() { - _counter.value = missionVisionController.text.characters.length; - }); - }); + resetControllers(); } @override @@ -733,33 +798,33 @@ class _MihBusinessDetailsState extends State { ), ), ), - Positioned( - right: 5, - bottom: 10, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.edit, - color: MzansiInnovationHub.of(context)!.theme.primaryColor(), - ), - label: "Edit Profile", - labelBackgroundColor: - MzansiInnovationHub.of(context)!.theme.successColor(), - labelStyle: TextStyle( - color: MzansiInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - ), - backgroundColor: - MzansiInnovationHub.of(context)!.theme.successColor(), - onTap: () { - editBizProfileWindow(width); - }, - ) - ], - ), - ), + // Positioned( + // right: 5, + // bottom: 10, + // child: MihFloatingMenu( + // animatedIcon: AnimatedIcons.menu_close, + // children: [ + // SpeedDialChild( + // child: Icon( + // Icons.edit, + // color: MzansiInnovationHub.of(context)!.theme.primaryColor(), + // ), + // label: "Edit Profile", + // labelBackgroundColor: + // MzansiInnovationHub.of(context)!.theme.successColor(), + // labelStyle: TextStyle( + // color: MzansiInnovationHub.of(context)!.theme.primaryColor(), + // fontWeight: FontWeight.bold, + // ), + // backgroundColor: + // MzansiInnovationHub.of(context)!.theme.successColor(), + // onTap: () { + // editBizProfileWindow(width); + // }, + // ) + // ], + // ), + // ), ], ); } diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart index 12683c97..96bc0fc0 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.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_review.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_config/mih_colors.dart'; import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart'; @@ -60,25 +61,99 @@ class _MihBusinessReviewsState extends State { List reviews = asyncSnapshot.data!; print("Reviews: ${reviews.length}"); if (reviews.isEmpty) { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - Icons.star_rate_rounded, - size: 150, - color: - MzansiInnovationHub.of(context)!.theme.secondaryColor(), - ), - Text( - "No reviews yet, be the first the review\n${widget.business.Name}", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Stack( + alignment: AlignmentDirectional.center, + children: [ + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: Icon( + MihIcons.mihRing, + size: 165, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + Icon( + Icons.star_rate_rounded, + size: 150, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ], ), - ), - ], + const SizedBox(height: 10), + Text( + "No reviews yet, be the first the review ${widget.business.Name}", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + // const SizedBox(height: 10), + // Center( + // child: RichText( + // textAlign: TextAlign.center, + // text: TextSpan( + // style: TextStyle( + // fontSize: 20, + // fontWeight: FontWeight.normal, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // children: [ + // TextSpan(text: "Press "), + // WidgetSpan( + // alignment: PlaceholderAlignment.middle, + // child: Icon( + // Icons.menu, + // size: 20, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // TextSpan(text: " to add your first loyalty card"), + // ], + // ), + // ), + // ), + ], + ), ); + // return Column( + // children: [ + // const SizedBox(height: 50), + // Icon( + // Icons.star_rate_rounded, + // size: 150, + // color: + // MzansiInnovationHub.of(context)!.theme.secondaryColor(), + // ), + // Text( + // "No reviews yet, be the first the review\n${widget.business.Name}", + // textAlign: TextAlign.center, + // style: TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ); } else { int descriptionDisplayCOunt = 75; return ListView.separated( diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart index 49cfbeb8..04a46c1e 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart @@ -1,4 +1,5 @@ import 'package:mzansi_innovation_hub/main.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_single_child_scroll.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'; @@ -24,7 +25,7 @@ class _MihBusinessUserSearchState extends State { final TextEditingController searchController = TextEditingController(); late Future> userSearchResults; final FocusNode _searchFocusNode = FocusNode(); - + bool hasSearchedBefore = false; String userSearch = ""; String errorCode = ""; String errorBody = ""; @@ -49,6 +50,7 @@ class _MihBusinessUserSearchState extends State { if (searchController.text != "") { setState(() { userSearch = searchController.text; + hasSearchedBefore = true; userSearchResults = fetchUsers(userSearch); }); } @@ -61,15 +63,94 @@ class _MihBusinessUserSearchState extends State { arguments: widget.arguments, ); } - return Center( - child: Text( - "Enter Username or Email to search", - style: TextStyle( - fontSize: 25, - color: MzansiInnovationHub.of(context)!.theme.messageTextColor()), - textAlign: TextAlign.center, - ), - ); + if (hasSearchedBefore && userSearch.isNotEmpty) { + return Column( + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.iDontKnow, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Let's Try Refining Your Search", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + ], + ); + } else { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.personalProfile, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Search for a Member of Mzansi to add to your team", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan( + text: "You can search using their Username or Email"), + // WidgetSpan( + // alignment: PlaceholderAlignment.middle, + // child: Icon( + // Icons.menu, + // size: 20, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // TextSpan(text: " to add your first loyalty card"), + ], + ), + ), + ), + ], + ), + ); + } + // return Center( + // child: Text( + // "Enter Username or Email to search", + // style: TextStyle( + // fontSize: 25, + // color: MzansiInnovationHub.of(context)!.theme.messageTextColor()), + // textAlign: TextAlign.center, + // ), + // ); } @override diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart index 43e55009..2cd4579c 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart @@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.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_button.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_dropdwn_field.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.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_alert.dart'; @@ -39,7 +38,6 @@ class _MihMyBusinessUserState extends State { PlatformFile? userPicFile; PlatformFile? userSignatureFile; final fileNameController = TextEditingController(); - final titleDropdownController = TextEditingController(); final titleTextController = TextEditingController(); final fnameController = TextEditingController(); final lnameController = TextEditingController(); @@ -49,7 +47,7 @@ class _MihMyBusinessUserState extends State { late String env; bool isFormFilled() { - if (titleDropdownController.text.isEmpty) { + if (titleTextController.text.isEmpty) { return false; } else { return true; @@ -93,7 +91,7 @@ class _MihMyBusinessUserState extends State { int statusCode = await MihMyBusinessUserServices().updateBusinessUser( widget.arguments.signedInUser.app_id, widget.arguments.businessUser!.business_id, - titleDropdownController.text, + titleTextController.text, accessController.text, signtureController.text, context, @@ -171,7 +169,6 @@ class _MihMyBusinessUserState extends State { void dispose() { super.dispose(); fileNameController.dispose(); - titleDropdownController.dispose(); titleTextController.dispose(); fnameController.dispose(); lnameController.dispose(); @@ -189,7 +186,6 @@ class _MihMyBusinessUserState extends State { widget.arguments.signedInUser.pro_pic_path.split("/").last; signtureController.text = widget.arguments.businessUser!.sig_path.split("/").last; - titleDropdownController.text = widget.arguments.businessUser!.title; titleTextController.text = widget.arguments.businessUser!.title; fnameController.text = widget.arguments.signedInUser.fname; lnameController.text = widget.arguments.signedInUser.lname; @@ -252,18 +248,6 @@ class _MihMyBusinessUserState extends State { ), ), const SizedBox(height: 20), - MihDropdownField( - controller: titleDropdownController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant", "Other"], - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 10), MihTextFormField( fillColor: MzansiInnovationHub.of(context)!.theme.secondaryColor(), @@ -272,7 +256,8 @@ class _MihMyBusinessUserState extends State { controller: titleTextController, multiLineInput: false, requiredText: true, - hintText: "Other Title", + readOnly: false, + hintText: "Title", validator: (value) { return MihValidationServices().isEmpty(value); }, @@ -329,7 +314,7 @@ class _MihMyBusinessUserState extends State { child: const Text( "Signature:", style: TextStyle( - fontSize: 15, + fontSize: 18, fontWeight: FontWeight.bold, ), ), diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/profile_business_add.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/profile_business_add.dart index 3dd67942..2bd8596f 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/profile_business_add.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/profile_business_add.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:country_code_picker/country_code_picker.dart'; import 'package:http/http.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -14,7 +15,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_body.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_header.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_layout_builder.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_dropdwn_field.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.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'; @@ -52,6 +52,7 @@ class _ProfileBusinessAddState extends State { final titleController = TextEditingController(); final signtureController = TextEditingController(); final accessController = TextEditingController(); + final countryCodeController = TextEditingController(); final contactController = TextEditingController(); final emailController = TextEditingController(); final locationController = TextEditingController(); @@ -125,7 +126,8 @@ class _ProfileBusinessAddState extends State { practiceNoController.text, vatNoController.text, emailController.text, - contactController.text, + getNumberWithCountryCode(), + // "${countryCodeController.text}-${contactController.text}", locationController.text, logonameController.text, websiteController.text, @@ -142,6 +144,18 @@ class _ProfileBusinessAddState extends State { } } + String getNumberWithCountryCode() { + String numberWithoutBeginingZero = ""; + if (contactController.text[0] == "0") { + numberWithoutBeginingZero = contactController.text + .replaceAll(" ", "") + .substring(1, contactController.text.length); + } else { + numberWithoutBeginingZero = contactController.text.replaceAll("-", " "); + } + return "${countryCodeController.text}-$numberWithoutBeginingZero"; + } + void internetConnectionPopUp() { showDialog( context: context, @@ -320,17 +334,6 @@ class _ProfileBusinessAddState extends State { return MihValidationServices().isEmpty(value); }, ), - // MihDropdownField( - // controller: typeController, - // hintText: "Business Type", - // dropdownOptions: const ["Doctors Office", "Other"], - // editable: true, - // enableSearch: true, - // validator: (value) { - // return MihValidationServices().isEmpty(value); - // }, - // requiredText: true, - // ), const SizedBox(height: 10.0), MihTextFormField( fillColor: MzansiInnovationHub.of(context)! @@ -348,37 +351,60 @@ class _ProfileBusinessAddState extends State { }, ), const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - inputColor: MzansiInnovationHub.of(context)! - .theme - .primaryColor(), - controller: contactController, - multiLineInput: false, - requiredText: true, - hintText: "Contact Number", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, + Container( + width: 300, + alignment: Alignment.topLeft, + child: const Text( + "Contact Number:", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MzansiInnovationHub.of(context)! - .theme - .secondaryColor(), - inputColor: MzansiInnovationHub.of(context)! - .theme - .primaryColor(), - controller: websiteController, - multiLineInput: false, - requiredText: false, - hintText: "Business Website", - validator: (value) { - return MihValidationServices() - .validateWebsite(value, false); - }, + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + CountryCodePicker( + padding: EdgeInsetsGeometry.all(0), + onChanged: (selectedCode) { + setState(() { + countryCodeController.text = + selectedCode.toString(); + }); + debugPrint( + "Selected Country Code: ${countryCodeController.text}"); + }, + initialSelection: countryCodeController.text, + showDropDownButton: false, + pickerStyle: PickerStyle.bottomSheet, + dialogBackgroundColor: + MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + barrierColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + ), + Expanded( + child: MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + controller: contactController, + numberMode: true, + multiLineInput: false, + requiredText: true, + hintText: null, + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + ), + ], ), const SizedBox(height: 10.0), MihTextFormField( @@ -429,6 +455,23 @@ class _ProfileBusinessAddState extends State { ), ), const SizedBox(height: 10.0), + MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), + controller: websiteController, + multiLineInput: false, + requiredText: false, + hintText: "Business Website", + validator: (value) { + return MihValidationServices() + .validateWebsite(value, false); + }, + ), + const SizedBox(height: 10.0), MihTextFormField( fillColor: MzansiInnovationHub.of(context)! @@ -439,10 +482,11 @@ class _ProfileBusinessAddState extends State { .primaryColor(), controller: regController, multiLineInput: false, - requiredText: true, + requiredText: false, hintText: "Registration No.", validator: (value) { - return MihValidationServices().isEmpty(value); + // return MihValidationServices().isEmpty(value); + return null; }, ), const SizedBox(height: 10.0), @@ -472,10 +516,11 @@ class _ProfileBusinessAddState extends State { .primaryColor(), controller: vatNoController, multiLineInput: false, - requiredText: true, + requiredText: false, hintText: "VAT Number", validator: (value) { - return MihValidationServices().isEmpty(value); + // return MihValidationServices().isEmpty(value); + return null; }, ), const SizedBox(height: 10.0), @@ -553,17 +598,32 @@ class _ProfileBusinessAddState extends State { .theme .secondaryColor()), const SizedBox(height: 10.0), - MihDropdownField( + MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), controller: titleController, + multiLineInput: false, + requiredText: true, hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant", "Other"], - editable: true, - enableSearch: true, validator: (value) { return MihValidationServices().isEmpty(value); }, - requiredText: true, ), + // MihDropdownField( + // controller: titleController, + // hintText: "Title", + // dropdownOptions: const ["Doctor", "Assistant", "Other"], + // editable: true, + // enableSearch: true, + // validator: (value) { + // return MihValidationServices().isEmpty(value); + // }, + // requiredText: true, + // ), const SizedBox(height: 10.0), MihTextFormField( fillColor: MzansiInnovationHub.of(context)! @@ -575,6 +635,7 @@ class _ProfileBusinessAddState extends State { controller: fnameController, multiLineInput: false, requiredText: true, + readOnly: true, hintText: "First Name", validator: (value) { return MihValidationServices().isEmpty(value); @@ -591,23 +652,40 @@ class _ProfileBusinessAddState extends State { controller: lnameController, multiLineInput: false, requiredText: true, + readOnly: true, hintText: "Surname", validator: (value) { return MihValidationServices().isEmpty(value); }, ), const SizedBox(height: 15.0), - MihDropdownField( + MihTextFormField( + fillColor: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzansiInnovationHub.of(context)! + .theme + .primaryColor(), controller: accessController, + multiLineInput: false, + requiredText: true, + readOnly: true, hintText: "Access Type", - dropdownOptions: const ["Full", "Partial"], - editable: true, - enableSearch: true, validator: (value) { return MihValidationServices().isEmpty(value); }, - requiredText: true, ), + // MihDropdownField( + // controller: accessController, + // hintText: "Access Type", + // dropdownOptions: const ["Full", "Partial"], + // editable: false, + // enableSearch: true, + // validator: (value) { + // return MihValidationServices().isEmpty(value); + // }, + // requiredText: true, + // ), const SizedBox(height: 20.0), Center( child: MihButton( @@ -674,6 +752,7 @@ class _ProfileBusinessAddState extends State { fnameController.text = widget.signedInUser.fname; lnameController.text = widget.signedInUser.lname; accessController.text = "Full"; + countryCodeController.text = "+27"; }); if (AppEnviroment.getEnv() == "Prod") { env = "Prod"; diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart index 45aa48d3..950858db 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart @@ -34,7 +34,7 @@ class _MzansiSetupProfileTileState extends State { ), ); }, - appName: "Setup Profile", + appName: "Set Up Profile", appIcon: Icon( MihIcons.profileSetup, color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart index b335d65f..ce17f9ce 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart @@ -1,6 +1,4 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; @@ -41,6 +39,7 @@ class _MihPersonalProfileState extends State { final ValueNotifier _counter = ValueNotifier(0); PlatformFile? proPic; late ImageProvider? propicPreview; + late bool originalProfileTypeIsBusiness; late bool businessUser; late String oldProPicName; late String env; @@ -125,13 +124,18 @@ class _MihPersonalProfileState extends State { context, ); if (responseCode == 200) { + bool stayOnPersonalSide = true; + if (originalProfileTypeIsBusiness == false && businessUser == true) { + stayOnPersonalSide = false; + } Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pushNamed( '/', arguments: AuthArguments( - true, + stayOnPersonalSide, + // true, false, ), ); @@ -302,7 +306,7 @@ class _MihPersonalProfileState extends State { controller: purposeController, multiLineInput: true, requiredText: true, - hintText: "Your Purpose", + hintText: "Your Personal Mission", validator: (value) { return MihValidationServices() .validateLength(purposeController.text, 256); @@ -423,6 +427,11 @@ class _MihPersonalProfileState extends State { usernameController.text = widget.arguments.signedInUser.username; purposeController.text = widget.arguments.signedInUser.purpose; businessUser = isBusinessUser(); + if (businessUser) { + originalProfileTypeIsBusiness = true; + } else { + originalProfileTypeIsBusiness = false; + } }); } @@ -513,7 +522,7 @@ class _MihPersonalProfileState extends State { child: Text( widget.arguments.signedInUser.purpose.isNotEmpty ? widget.arguments.signedInUser.purpose - : "No purpose added yet", + : "No Personal Mission added yet", textAlign: TextAlign.center, style: TextStyle( fontSize: 15, @@ -553,33 +562,33 @@ class _MihPersonalProfileState extends State { ), ), ), - Positioned( - right: 5, - bottom: 10, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.edit, - color: MzansiInnovationHub.of(context)!.theme.primaryColor(), - ), - label: "Edit Profile", - labelBackgroundColor: - MzansiInnovationHub.of(context)!.theme.successColor(), - labelStyle: TextStyle( - color: MzansiInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - ), - backgroundColor: - MzansiInnovationHub.of(context)!.theme.successColor(), - onTap: () { - editProfileWindow(width); - }, - ) - ], - ), - ), + // Positioned( + // right: 5, + // bottom: 10, + // child: MihFloatingMenu( + // animatedIcon: AnimatedIcons.menu_close, + // children: [ + // SpeedDialChild( + // child: Icon( + // Icons.edit, + // color: MzansiInnovationHub.of(context)!.theme.primaryColor(), + // ), + // label: "Edit Profile", + // labelBackgroundColor: + // MzansiInnovationHub.of(context)!.theme.successColor(), + // labelStyle: TextStyle( + // color: MzansiInnovationHub.of(context)!.theme.primaryColor(), + // fontWeight: FontWeight.bold, + // ), + // backgroundColor: + // MzansiInnovationHub.of(context)!.theme.successColor(), + // onTap: () { + // editProfileWindow(width); + // }, + // ) + // ], + // ), + // ), ], ); } diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart index da26939c..edfccf9e 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart @@ -157,7 +157,7 @@ class _MihPersonalProfileViewState extends State { child: Text( widget.user.purpose.isNotEmpty ? widget.user.purpose - : "No purpose added yet", + : "No Personal Mission added yet", textAlign: TextAlign.center, style: TextStyle( fontSize: 15, diff --git a/Frontend/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart b/Frontend/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart index 7a1640d6..f0e62836 100644 --- a/Frontend/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart +++ b/Frontend/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart @@ -1,6 +1,7 @@ import 'package:flutter_speed_dial/flutter_speed_dial.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_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; @@ -21,6 +22,8 @@ class BuildLoyaltyCardList extends StatefulWidget { final List cardList; final int navIndex; final MihBannerAd? bannerAd; + final bool favouritesMode; + final TextEditingController searchText; final void Function()? onCardViewClose; const BuildLoyaltyCardList({ @@ -28,6 +31,8 @@ class BuildLoyaltyCardList extends StatefulWidget { required this.signedInUser, required this.cardList, required this.navIndex, + required this.favouritesMode, + required this.searchText, this.bannerAd, this.onCardViewClose, }); @@ -502,11 +507,7 @@ class _BuildLoyaltyCardListState extends State { padding: EdgeInsets.only( left: getHorizontalPaddingSize(size), right: getHorizontalPaddingSize(size), - //bottom: height / 5, - //top: 20, ), - // physics: , - // shrinkWrap: true, itemCount: widget.cardList.length, gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( mainAxisSpacing: 0, @@ -526,41 +527,148 @@ class _BuildLoyaltyCardListState extends State { ); }, ); - // return ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // separatorBuilder: (BuildContext context, int index) { - // return Divider( - // color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), - // ); - // }, - // itemCount: widget.cardList.length, - // itemBuilder: (context, index) { - // return ListTile( - // title: MihCardDisplay( - // shopName: widget.cardList[index].shop_name, height: 200), - - // onTap: () { - // viewCardWindow(index); - // }, - // ); - // }, - // ); } else { - return Padding( - padding: const EdgeInsets.only(top: 25.0), - child: SizedBox( - height: size.height, - child: const Align( - alignment: Alignment.topCenter, - child: Text( - "No Cards Available", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, - ), + if (!widget.favouritesMode) { + if (widget.searchText.text.isNotEmpty) { + return Column( + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.iDontKnow, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Let's Try Refining Your Search", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + ], + ); + } + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.mzansiWallet, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "No Cards added to your Mzansi Wallet", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to add your first loyalty card"), + ], + ), + ), + ), + ], ), - ), - ); + ); + } else { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.mzansiWallet, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "No Favourite Cards in your Mzansi Wallet", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan( + text: + " when viewing loyalty card to add it to your favorites"), + ], + ), + ), + ), + ], + ), + ); + } } } } diff --git a/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart b/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart index 97f909a4..3b8e582d 100644 --- a/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart +++ b/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart @@ -63,6 +63,8 @@ class _MihCardFavouritesState extends State { signedInUser: widget.signedInUser, navIndex: 0, bannerAd: _bannerAd, + favouritesMode: true, + searchText: TextEditingController(), onCardViewClose: () { setState(() { _bannerAd = MihBannerAd(); diff --git a/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart b/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart index d2c03791..0bc622e9 100644 --- a/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart +++ b/Frontend/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart @@ -372,6 +372,8 @@ class _MihCardsState extends State { signedInUser: widget.signedInUser, navIndex: 0, bannerAd: _bannerAd, + favouritesMode: false, + searchText: cardSearchController, onCardViewClose: () { setState(() { _bannerAd = MihBannerAd(); diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/mih_patient_search.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/mih_patient_search.dart index 7f362826..fa5f9ff3 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/mih_patient_search.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/mih_patient_search.dart @@ -1,4 +1,5 @@ import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.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_package_tool_body.dart'; @@ -35,6 +36,7 @@ class _MihPatientSearchState extends State { TextEditingController _mihPatientSearchController = TextEditingController(); final FocusNode _focusNode = FocusNode(); final FocusNode _searchFocusNode = FocusNode(); + bool hasSearchedBefore = false; String _mihPatientSearchString = ""; String baseUrl = AppEnviroment.baseApiUrl; late Future> _mihPatientSearchResults; @@ -125,33 +127,97 @@ class _MihPatientSearchState extends State { personalSelected: widget.personalSelected, ); } else if (patientsList.isEmpty && searchString != "") { - return Padding( - padding: const EdgeInsets.only(top: 35.0), - child: Center( - child: Text( - "No ID or Medical Aid No. matches a Patient", - style: TextStyle( - fontSize: 25, - color: - MzansiInnovationHub.of(context)!.theme.messageTextColor()), - textAlign: TextAlign.center, + return Column( + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.iDontKnow, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), - ), + const SizedBox(height: 10), + Text( + "Let's Try Refining Your Search", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + ], ); } else { return Padding( - padding: const EdgeInsets.only(top: 35.0), - child: Center( - child: Text( - "Enter ID or Medical Aid No. of Patient", - style: TextStyle( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.patientProfile, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Search for a Patient of Mzansi to add to your Patient List", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( fontSize: 25, - color: - MzansiInnovationHub.of(context)!.theme.messageTextColor()), - textAlign: TextAlign.center, - ), + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan( + text: + "You can search using their teamtient ID or Medical Aid No."), + // WidgetSpan( + // alignment: PlaceholderAlignment.middle, + // child: Icon( + // Icons.menu, + // size: 20, + // color: MzansiInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // TextSpan(text: " to add your first loyalty card"), + ], + ), + ), + ), + ], ), ); + // return Padding( + // padding: const EdgeInsets.only(top: 35.0), + // child: Center( + // child: Text( + // "Enter ID or Medical Aid No. of Patient", + // style: TextStyle( + // fontSize: 25, + // color: + // MzansiInnovationHub.of(context)!.theme.messageTextColor()), + // textAlign: TextAlign.center, + // ), + // ), + // ); } } @@ -161,6 +227,7 @@ class _MihPatientSearchState extends State { _mihPatientSearchString = _mihPatientSearchController.text; _mihPatientSearchResults = MIHApiCalls.fetchPatients(_mihPatientSearchString); + hasSearchedBefore = true; }); } } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/my_patient_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/my_patient_list.dart index b5898c15..a908e555 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/my_patient_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/my_patient_list.dart @@ -1,4 +1,5 @@ import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.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_package_tool_body.dart'; @@ -11,7 +12,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.d import 'package:mzansi_innovation_hub/mih_components/mih_objects/patient_access.dart'; import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_manager/list_builders/build_my_patient_list_list.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; class MyPatientList extends StatefulWidget { final AppUser signedInUser; @@ -35,6 +35,7 @@ class _MyPatientListState extends State { late Future> _myPatientList; TextEditingController _myPatientSearchController = TextEditingController(); final FocusNode _searchFocusNode = FocusNode(); + bool hasSearchedBefore = false; String _myPatientIdSearchString = ""; String baseUrl = AppEnviroment.baseApiUrl; @@ -114,18 +115,98 @@ class _MyPatientListState extends State { businessUser: widget.businessUser, ); } - return Padding( - padding: const EdgeInsets.only(top: 35.0), - child: Center( - child: Text( - "No Patients matching search", - style: TextStyle( + if (hasSearchedBefore && _myPatientIdSearchString.isNotEmpty) { + return Column( + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.iDontKnow, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "Let's Try Refining Your Search", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( fontSize: 25, - color: MzansiInnovationHub.of(context)!.theme.messageTextColor()), - textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + ], + ); + } else { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.patientProfile, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + const SizedBox(height: 10), + Text( + "You dont have access to any Patients Profile", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.search, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan( + text: + " to use Patient Search to request access to their profile."), + ], + ), + ), + ), + ], ), - ), - ); + ); + } + // return Padding( + // padding: const EdgeInsets.only(top: 35.0), + // child: Center( + // child: Text( + // "No Patients matching search", + // style: TextStyle( + // fontSize: 25, + // color: MzansiInnovationHub.of(context)!.theme.messageTextColor()), + // textAlign: TextAlign.center, + // ), + // ), + // ); } List filterAccessResults( @@ -143,6 +224,7 @@ class _MyPatientListState extends State { setState(() { _myPatientList = MIHApiCalls.getPatientAccessListOfBusiness( widget.business!.business_id); + hasSearchedBefore = true; }); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/waiting_room.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/waiting_room.dart index 8affdaee..4e931554 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/waiting_room.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/package_tools/waiting_room.dart @@ -1,5 +1,6 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; @@ -170,21 +171,79 @@ class _WaitingRoomState extends State { } return Expanded( child: Padding( - padding: const EdgeInsets.only(top: 35.0), - child: Align( - alignment: Alignment.center, - child: Text( - "No Appointments for $selectedDay", - style: TextStyle( - fontSize: 25, - color: MzansiInnovationHub.of(context)!.theme.messageTextColor(), + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.calendar, + size: 165, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), ), - textAlign: TextAlign.center, - softWrap: true, - ), + const SizedBox(height: 10), + Text( + "No Appointments for $selectedDay", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan( + text: + " to add an appointment or select a different date"), + ], + ), + ), + ), + ], ), ), ); + // return Expanded( + // child: Padding( + // padding: const EdgeInsets.only(top: 35.0), + // child: Align( + // alignment: Alignment.center, + // child: Text( + // "No Appointments for $selectedDay", + // style: TextStyle( + // fontSize: 25, + // color: MzansiInnovationHub.of(context)!.theme.messageTextColor(), + // ), + // textAlign: TextAlign.center, + // softWrap: true, + // ), + // ), + // ), + // ); } void appointmentTypeSelection(double width) { diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_claim_statement_files_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_claim_statement_files_list.dart index 858ba93e..b5a1dfdb 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_claim_statement_files_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_claim_statement_files_list.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:fl_downloader/fl_downloader.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_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_window.dart'; @@ -349,11 +350,74 @@ class _BuildClaimStatementFileListState }, ); } else { - return const Center( - child: Text( - "No Documents Available", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Stack( + alignment: AlignmentDirectional.center, + children: [ + Icon( + MihIcons.mihRing, + size: 165, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + Icon( + Icons.file_open_outlined, + size: 110, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ], + ), + const SizedBox(height: 10), + Text( + "No Claims or Statements have been added to this profile.", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Visibility( + visible: widget.business != null, + child: Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to generate the first document"), + ], + ), + ), + ), + ), + ], ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart index c24ea631..89c76db8 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart @@ -4,6 +4,7 @@ import 'dart:convert'; import 'package:fl_downloader/fl_downloader.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart'; @@ -400,13 +401,82 @@ class _BuildFilesListState extends State { }, ); } else { - return const Center( - child: Text( - "No Documents Available", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Stack( + alignment: AlignmentDirectional.center, + children: [ + Icon( + MihIcons.mihRing, + size: 165, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + Icon( + Icons.file_present, + size: 110, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ], + ), + const SizedBox(height: 10), + Text( + "No Documents have been added to this profile.", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to add "), + widget.business != null + ? TextSpan(text: " or generate a the first document") + : TextSpan(text: " the first document"), + ], + ), + ), + ), + ], ), ); + // return const Center( + // child: Text( + // "No Documents Available", + // style: TextStyle(fontSize: 25, color: Colors.grey), + // textAlign: TextAlign.center, + // ), + // ); } } } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_notes_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_notes_list.dart index da33b4e8..6a131386 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_notes_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/list_builders/build_notes_list.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.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_window.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_delete_message.dart'; @@ -281,13 +282,83 @@ class _BuildNotesListState extends State { }, ); } else { - return const Center( - child: Text( - "No Notes Available", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Stack( + alignment: AlignmentDirectional.center, + children: [ + Icon( + MihIcons.mihRing, + size: 165, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + Icon( + Icons.article_outlined, + size: 110, + color: + MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ], + ), + const SizedBox(height: 10), + Text( + "No Notes have been added to this profile.", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzansiInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const SizedBox(height: 10), + Visibility( + visible: widget.business != null, + child: Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.menu, + size: 20, + color: MzansiInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + TextSpan(text: " to add the first note"), + ], + ), + ), + ), + ), + ], ), ); + // return const Center( + // child: Text( + // "No Notes Available", + // style: TextStyle(fontSize: 25, color: Colors.grey), + // textAlign: TextAlign.center, + // ), + // ); } } } diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index c793ee20..73a50178 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: google_mobile_ads: ^6.0.0 redacted: ^1.0.13 custom_rating_bar: ^3.0.0 + country_code_picker: ^3.3.0 dev_dependencies: flutter_test: