From 236e4d0a59cfec9d47d52796f1ee0d75b1c93a0d Mon Sep 17 00:00:00 2001 From: yaso Date: Tue, 1 Jul 2025 11:43:35 +0200 Subject: [PATCH 01/25] update personal profile and move edit to menu option --- .../package_tools/mih_personal_profile.dart | 352 ++++++++++++------ 1 file changed, 242 insertions(+), 110 deletions(-) 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 5ef3261b..7324e3a8 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,9 @@ 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_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'; import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; @@ -141,6 +144,7 @@ class _MihPersonalProfileState extends State { //print("Here4"); //print(response.statusCode); if (response.statusCode == 200) { + Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pushNamed( @@ -203,6 +207,152 @@ class _MihPersonalProfileState extends State { ); } + void editProfileWindow(double width) { + showDialog( + context: context, + builder: (context) => MihPackageWindow( + fullscreen: false, + windowTitle: "Edit Profile", + onWindowTapClose: () { + Navigator.of(context).pop(); + }, + windowBody: Padding( + padding: + MzanziInnovationHub.of(context)!.theme.screenType == "desktop" + ? EdgeInsets.symmetric(horizontal: width * 0.05) + : EdgeInsets.symmetric(horizontal: width * 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + MihForm( + formKey: _formKey, + formFields: [ + Center( + child: MihCircleAvatar( + imageFile: propicPreview, + width: 150, + editable: true, + fileNameController: proPicController, + userSelectedfile: proPic, + frameColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onChange: (selectedImage) { + setState(() { + proPic = selectedImage; + }); + }, + ), + ), + const SizedBox(height: 25.0), + Visibility( + visible: false, + child: MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: proPicController, + multiLineInput: false, + requiredText: true, + readOnly: true, + hintText: "Selected File Name", + ), + ), + const SizedBox(height: 10.0), + MihTextFormField( + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: usernameController, + multiLineInput: false, + requiredText: true, + hintText: "Username", + validator: (value) { + return MihValidationServices().validateUsername(value); + }, + ), + const SizedBox(height: 10.0), + MihTextFormField( + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: fnameController, + multiLineInput: false, + requiredText: true, + hintText: "First Name", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 10.0), + MihTextFormField( + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: lnameController, + multiLineInput: false, + requiredText: true, + hintText: "Last Name", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 10.0), + MihToggle( + hintText: "Activate Business Account", + initialPostion: businessUser, + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + secondaryFillColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onChange: (value) { + setState(() { + businessUser = value; + }); + }, + ), + const SizedBox(height: 30.0), + Center( + child: MihButton( + onPressed: () { + //Add validation here + if (_formKey.currentState!.validate()) { + submitForm(); + } else { + MihAlertServices().formNotFilledCompletely(context); + } + }, + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + width: 300, + child: Text( + "Update", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ], + ), + ), + ), + ); + } + @override void dispose() { proPicController.dispose(); @@ -246,22 +396,22 @@ class _MihPersonalProfileState extends State { } Widget getBody(double width) { - return MihSingleChildScroll( - child: Padding( - padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - MihForm( - formKey: _formKey, - formFields: [ + return Stack( + children: [ + MihSingleChildScroll( + child: Padding( + padding: + MzanziInnovationHub.of(context)!.theme.screenType == "desktop" + ? EdgeInsets.symmetric(horizontal: width * 0.2) + : EdgeInsets.symmetric(horizontal: width * 0.075), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ Center( child: MihCircleAvatar( imageFile: propicPreview, width: 150, - editable: true, + editable: false, fileNameController: proPicController, userSelectedfile: proPic, frameColor: @@ -275,117 +425,72 @@ class _MihPersonalProfileState extends State { }, ), ), - const SizedBox(height: 25.0), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: + Text( + "@${widget.arguments.signedInUser.username}", + style: TextStyle( + fontSize: 35, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + Text( + "${widget.arguments.signedInUser.fname} ${widget.arguments.signedInUser.lname}", + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + Text( + businessUser ? "Business" : "Personal", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: proPicController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected File Name", ), ), const SizedBox(height: 10.0), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: usernameController, - multiLineInput: false, - requiredText: true, - hintText: "Username", - validator: (value) { - return MihValidationServices().validateUsername(value); - }, + Text( + "This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: fnameController, - multiLineInput: false, - requiredText: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: lnameController, - multiLineInput: false, - requiredText: true, - hintText: "Last Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihToggle( - hintText: "Activate Business Account", - initialPostion: businessUser, - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - secondaryFillColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onChange: (value) { - setState(() { - businessUser = value; - }); - }, - ), - // Row( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // const Text( - // "Activate Business Account", - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 20, - // ), - // ), - // const SizedBox( - // width: 10, - // ), - // Switch( - // value: businessUser, - // onChanged: (bool value) { - // setState(() { - // businessUser = value; - // }); - // }, - // ), - // ], + // MihToggle( + // hintText: "Activate Business Account", + // initialPostion: businessUser, + // fillColor: + // MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // secondaryFillColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // onChange: (value) { + // setState(() { + // businessUser = value; + // }); + // }, // ), const SizedBox(height: 30.0), Center( child: MihButton( onPressed: () { - //Add validation here - if (_formKey.currentState!.validate()) { - submitForm(); - } else { - MihAlertServices().formNotFilledCompletely(context); - } + // //Add validation here + // if (_formKey.currentState!.validate()) { + // submitForm(); + // } else { + // MihAlertServices().formNotFilledCompletely(context); + // } }, buttonColor: MzanziInnovationHub.of(context)!.theme.successColor(), width: 300, child: Text( - "Update", + "Connect", style: TextStyle( color: MzanziInnovationHub.of(context)! .theme @@ -398,9 +503,36 @@ class _MihPersonalProfileState extends State { ), ], ), - ], + ), ), - ), + Positioned( + right: 5, + bottom: 10, + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + children: [ + SpeedDialChild( + child: Icon( + Icons.edit, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Edit Profile", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + editProfileWindow(width); + }, + ) + ], + ), + ), + ], ); } } From 74c9bea5ee2c4e31d9162b7321313e7212b18b7a Mon Sep 17 00:00:00 2001 From: yaso Date: Tue, 1 Jul 2025 11:49:01 +0200 Subject: [PATCH 02/25] remove comments --- .../package_tools/mih_personal_profile.dart | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) 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 7324e3a8..f4fd0e88 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 @@ -246,7 +246,7 @@ class _MihPersonalProfileState extends State { }, ), ), - const SizedBox(height: 25.0), + // const SizedBox(height: 25.0), Visibility( visible: false, child: MihTextFormField( @@ -462,29 +462,11 @@ class _MihPersonalProfileState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), ), - // MihToggle( - // hintText: "Activate Business Account", - // initialPostion: businessUser, - // fillColor: - // MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // secondaryFillColor: - // MzanziInnovationHub.of(context)!.theme.primaryColor(), - // onChange: (value) { - // setState(() { - // businessUser = value; - // }); - // }, - // ), const SizedBox(height: 30.0), Center( child: MihButton( onPressed: () { - // //Add validation here - // if (_formKey.currentState!.validate()) { - // submitForm(); - // } else { - // MihAlertServices().formNotFilledCompletely(context); - // } + // Connect with the user }, buttonColor: MzanziInnovationHub.of(context)!.theme.successColor(), From b570c17706ba401a2dcfb017ac6abfaceba95578 Mon Sep 17 00:00:00 2001 From: yaso Date: Tue, 1 Jul 2025 16:10:12 +0200 Subject: [PATCH 03/25] add fitted box around text --- .../package_tools/mih_personal_profile.dart | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) 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 f4fd0e88..dbbe8921 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 @@ -425,41 +425,54 @@ class _MihPersonalProfileState extends State { }, ), ), - Text( - "@${widget.arguments.signedInUser.username}", - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), + FittedBox( + child: Text( + "@${widget.arguments.signedInUser.username}", + style: TextStyle( + fontSize: 35, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), ), ), - Text( - "${widget.arguments.signedInUser.fname} ${widget.arguments.signedInUser.lname}", - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), + FittedBox( + child: Text( + "${widget.arguments.signedInUser.fname} ${widget.arguments.signedInUser.lname}", + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), ), ), - Text( - businessUser ? "Business" : "Personal", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), + FittedBox( + child: Text( + businessUser ? "Business" : "Personal", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), ), ), const SizedBox(height: 10.0), - Text( - "This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), + Center( + child: Text( + "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), ), ), const SizedBox(height: 30.0), From ff1123fe512bdd8e832f9a600d3427decb928ecc Mon Sep 17 00:00:00 2001 From: yaso Date: Tue, 1 Jul 2025 16:10:32 +0200 Subject: [PATCH 04/25] update business details screen --- .../package_tools/mih_business_details.dart | 533 +++++++++++------- 1 file changed, 331 insertions(+), 202 deletions(-) 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 0968ce61..584dd9d3 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,6 +1,9 @@ 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_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; @@ -185,6 +188,259 @@ class _MihBusinessDetailsState extends State { } } + void editBizProfileWindow(double width) { + showDialog( + context: context, + builder: (context) => MihPackageWindow( + fullscreen: false, + windowTitle: 'Edit Profile', + onWindowTapClose: () { + Navigator.of(context).pop(); + }, + windowBody: MihSingleChildScroll( + child: Padding( + padding: MzanziInnovationHub.of(context)!.theme.screenType == + "desktop" + ? EdgeInsets.symmetric(horizontal: width * 0.05) + : EdgeInsets.symmetric(horizontal: width * 0), + child: Column( + children: [ + MihForm( + formKey: _formKey, + formFields: [ + Center( + child: MihCircleAvatar( + imageFile: widget.logoImage, + width: 150, + editable: true, + fileNameController: fileNameController, + userSelectedfile: imageFile, + frameColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + backgroundColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onChange: (selectedfile) { + setState(() { + imageFile = selectedfile; + }); + }, + ), + ), + Visibility( + visible: false, + child: MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: fileNameController, + multiLineInput: false, + requiredText: true, + readOnly: true, + hintText: "Selected File Name", + ), + ), + const SizedBox(height: 20), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: regController, + multiLineInput: false, + requiredText: true, + hintText: "Registration No.", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: nameController, + multiLineInput: false, + requiredText: true, + hintText: "Business Name", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 15), + 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: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: practiceNoController, + multiLineInput: false, + requiredText: + typeController.text == "Doctors Office", + hintText: "Practice Number", + validator: (validateValue) { + return MihValidationServices() + .isEmpty(validateValue); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: vatNoController, + multiLineInput: false, + requiredText: true, + hintText: "VAT Number", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: contactController, + multiLineInput: false, + requiredText: true, + hintText: "Contact Number", + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: emailController, + multiLineInput: false, + requiredText: true, + hintText: "Business Email", + validator: (value) { + return MihValidationServices() + .validateEmail(value); + }, + ), + const SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + controller: locationController, + multiLineInput: false, + requiredText: true, + hintText: "GPS Location", + ), + ), + const SizedBox(width: 10.0), + MihButton( + onPressed: () { + MIHLocationAPI() + .getGPSPosition(context) + .then((position) { + if (position != null) { + setState(() { + locationController.text = + "${position.latitude}, ${position.longitude}"; + }); + } + }); + }, + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + width: 100, + child: Text( + "Set", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + const SizedBox(height: 25), + Center( + child: MihButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + submitForm(); + } else { + MihAlertServices() + .formNotFilledCompletely(context); + } + }, + buttonColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + width: 300, + child: Text( + "Update", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + const SizedBox(height: 20), + ], + ), + ], + ), + ), + ), + )); + } + @override void dispose() { super.dispose(); @@ -233,218 +489,91 @@ class _MihBusinessDetailsState extends State { } Widget getBody(double width, BuildContext context) { - return MihSingleChildScroll( - child: Padding( - padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Center( - child: MihCircleAvatar( - imageFile: widget.logoImage, - width: 150, - editable: true, - fileNameController: fileNameController, - userSelectedfile: imageFile, - frameColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - backgroundColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onChange: (selectedfile) { - setState(() { - imageFile = selectedfile; - }); - }, - ), - ), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: fileNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected File Name", - ), - ), - const SizedBox(height: 20), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: regController, - multiLineInput: false, - requiredText: true, - hintText: "Registration No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: nameController, - multiLineInput: false, - requiredText: true, - hintText: "Business Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 15), - 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: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: practiceNoController, - multiLineInput: false, - requiredText: typeController.text == "Doctors Office", - hintText: "Practice Number", - validator: (validateValue) { - return MihValidationServices().isEmpty(validateValue); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: vatNoController, - multiLineInput: false, - requiredText: true, - hintText: "VAT Number", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: contactController, - multiLineInput: false, - requiredText: true, - hintText: "Contact Number", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Business Email", - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: MihTextFormField( - fillColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: locationController, - multiLineInput: false, - requiredText: true, - hintText: "GPS Location", - ), - ), - const SizedBox(width: 10.0), - MihButton( - onPressed: () { - MIHLocationAPI().getGPSPosition(context).then((position) { - if (position != null) { - setState(() { - locationController.text = - "${position.latitude}, ${position.longitude}"; - }); - } + return Stack( + children: [ + MihSingleChildScroll( + child: Padding( + padding: + MzanziInnovationHub.of(context)!.theme.screenType == "desktop" + ? EdgeInsets.symmetric(horizontal: width * 0.2) + : EdgeInsets.symmetric(horizontal: width * 0.075), + child: Column( + children: [ + Center( + child: MihCircleAvatar( + imageFile: widget.logoImage, + width: 150, + editable: false, + fileNameController: fileNameController, + userSelectedfile: imageFile, + frameColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onChange: (selectedfile) { + setState(() { + imageFile = selectedfile; }); }, - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - width: 100, - child: Text( - "Set", - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), ), - ], - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(); - } else { - MihAlertServices().formNotFilledCompletely(context); - } - }, - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - width: 300, + ), + FittedBox( child: Text( - "Update", + widget.arguments.business!.Name, style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontSize: 20, + fontSize: 35, fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), ), ), ), - ), - const SizedBox(height: 20), + Center( + child: Text( + "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + ), + ], + ), + ), + ), + Positioned( + right: 5, + bottom: 10, + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + children: [ + SpeedDialChild( + child: Icon( + Icons.edit, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Edit Profile", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + editBizProfileWindow(width); + }, + ) ], ), - ], - ), - )); + ), + ], + ); } } From a6e8ef30b55c49e0fed541b07da5d563dd9c025b Mon Sep 17 00:00:00 2001 From: yaso Date: Wed, 2 Jul 2025 11:03:33 +0200 Subject: [PATCH 05/25] test business card --- .../Example/package_tools/package_tool_one.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 ebc87c96..351c9e83 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 @@ -3,6 +3,7 @@ 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_banner_ad.dart'; +import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_business_card.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_components/mih_package_components/mih_single_child_scroll.dart'; @@ -165,6 +166,21 @@ class _PackageToolOneState extends State { ], ), const SizedBox(height: 20), + MihBusinessCard( + businessName: "Mzansi Innovation Hub", + cellNumber: "0788300006", + email: "yasien.meth@mzansi-innovation-hub.co.za", + gpsLocation: "-26.1853611, 28.134664", + website: + "https://app.mzansi-innovation-hub.co.za/privacy.html", + ), + const SizedBox(height: 10), + Divider( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + thickness: 2, + ), + const SizedBox(height: 10), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ From 7016ef11a194c8049a2d1004fe83f231342959c5 Mon Sep 17 00:00:00 2001 From: yaso Date: Wed, 2 Jul 2025 11:03:51 +0200 Subject: [PATCH 06/25] create business card --- .../components/mih_business_card.dart | 425 ++++++++++++++++++ 1 file changed, 425 insertions(+) create mode 100644 Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart new file mode 100644 index 00000000..adb1831a --- /dev/null +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart @@ -0,0 +1,425 @@ +import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class MihBusinessCard extends StatefulWidget { + final String businessName; + final String cellNumber; + final String email; + final String gpsLocation; + final String website; + const MihBusinessCard({ + super.key, + required this.businessName, + required this.cellNumber, + required this.email, + required this.gpsLocation, + required this.website, + }); + + @override + State createState() => _MihBusinessCardState(); +} + +class _MihBusinessCardState extends State { + Future _makePhoneCall(String phoneNumber) async { + final Uri url = Uri(scheme: 'tel', path: phoneNumber); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } else { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Making Call", + alertBody: Column( + children: [ + Text( + "Unable to lauch phone to call ${widget.cellNumber}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } + + String? _encodeQueryParameters(Map params) { + return params.entries + .map((MapEntry e) => + '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') + .join('&'); + } + + Future _launchEmail( + String recipient, String subject, String body) async { + final Uri emailLaunchUri = Uri( + scheme: 'mailto', + path: recipient, + query: _encodeQueryParameters({ + 'subject': subject, + 'body': body, + }), + ); + + if (await canLaunchUrl(emailLaunchUri)) { + await launchUrl(emailLaunchUri); + } else { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Creating Email", + alertBody: Column( + children: [ + Text( + "Unable to lauch email to ${widget.email}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } + + Future _launchGoogleMapsWithUrl({ + required double latitude, + required double longitude, + String? label, + }) async { + final Uri googleMapsUrl = Uri.parse( + 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude${label != null ? '&query_place_id=' : ''}', + ); + try { + if (await canLaunchUrl(googleMapsUrl)) { + await launchUrl(googleMapsUrl); + } else { + print( + 'Could not launch Google Maps. Make sure the Google Maps app is installed or an internet connection is available.'); + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Creating Maps", + alertBody: Column( + children: [ + Text( + "Unable to lauch maps to ${widget.businessName}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } catch (e) { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Creating Maps", + alertBody: Column( + children: [ + Text( + "Unable to lauch maps to ${widget.businessName}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } + + Future _launchWebsite(String urlString) async { + final Uri url = Uri.parse(urlString); + try { + if (await canLaunchUrl(url)) { + await launchUrl(url); + } else { + print('Could not launch $urlString'); + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Opening Website", + alertBody: Column( + children: [ + Text( + "Unable to lauch ${widget.businessName}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } catch (e) { + showDialog( + context: context, + builder: (context) { + return MihPackageAlert( + alertIcon: Icon( + Icons.warning_rounded, + size: 100, + ), + alertTitle: "Error Opening Website", + alertBody: Column( + children: [ + Text( + "Unable to lauch ${widget.businessName}", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: 15, + ), + ), + ], + ), + alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(), + ); + }); + } + } + + Widget _buildContactInfo( + String label, + String subLabel, + IconData icon, + Color? iconColor, + Function()? ontap, + ) { + return Material( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + child: InkWell( + onTap: ontap, + splashColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor() + .withOpacity(0.2), + borderRadius: BorderRadius.circular(15), + child: Padding( + padding: EdgeInsetsGeometry.symmetric( + horizontal: 25, + ), + child: Row( + children: [ + Container( + decoration: BoxDecoration( + color: iconColor, + borderRadius: BorderRadius.circular(15), + ), + padding: const EdgeInsets.all(5.0), + child: Icon( + icon, + size: 35, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + SizedBox(width: 20), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + label, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + height: 1.0, + ), + ), + Text( + subLabel, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w700, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + children: [ + const SizedBox(height: 10), + _buildContactInfo( + "Call", + "Give us a quick call.", + Icons.phone, + const Color(0xffaff0b3), + () { + // print("Calling ${widget.cellNumber}"); + _makePhoneCall(widget.cellNumber); + }, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Divider( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + _buildContactInfo( + "Email", + "Send us an email.", + Icons.email, + const Color(0xffdaa2e9), + () { + // print("Emailing ${widget.email}"); + _launchEmail( + widget.email, + "Inquiery about ${widget.businessName}", + "Dear ${widget.businessName},\n\nI would like to inquire about your services.\n\nBest regards,\n", + ); + }, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Divider( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + _buildContactInfo( + "Location", + "Come visit us.", + Icons.location_on, + const Color(0xffe9e8a1), + () { + final latitude = double.parse(widget.gpsLocation.split(',')[0]); + final longitude = double.parse(widget.gpsLocation.split(',')[1]); + _launchGoogleMapsWithUrl( + latitude: latitude, + longitude: longitude, + ); + }, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Divider( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + _buildContactInfo( + "Website", + "Find out more about us.", + Icons.vpn_lock, + const Color(0xffd67d8a), + () { + _launchWebsite(widget.website); + }, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Divider( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + _buildContactInfo( + "Rate Us", + "Let us know how we are doing.", + Icons.star_rate_rounded, + const Color(0xffd69d7d), + () { + print("Opeining rating dialog"); + // _launchWebsite(widget.website); + }, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Divider( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + _buildContactInfo( + "Bookmark", + "Save us for later.", + Icons.bookmark_add_rounded, + const Color(0xff6e7dcc), + () { + // _launchWebsite(widget.website); + print("Saving ${widget.businessName} to Directory"); + }, + ), + const SizedBox(height: 10), + // Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: Divider( + // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + ], + ), + ); + } +} From f338bfa0d03c960179c3fe3894028be07fcdff5e Mon Sep 17 00:00:00 2001 From: yaso Date: Wed, 2 Jul 2025 11:04:13 +0200 Subject: [PATCH 07/25] add business card to profilre --- .../package_tools/mih_business_details.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 584dd9d3..a29945a2 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 @@ -4,6 +4,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_floating_menu.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; +import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; @@ -542,6 +543,16 @@ class _MihBusinessDetailsState extends State { ), ), ), + const SizedBox(height: 20), + MihBusinessCard( + businessName: widget.arguments.business!.Name, + cellNumber: widget.arguments.business!.contact_no, + email: widget.arguments.business!.bus_email, + gpsLocation: widget.arguments.business!.gps_location, + //To-Do: Add the business Website + website: + "https://app.mzansi-innovation-hub.co.za/privacy.html", + ), ], ), ), From afc47c33d96f30fd89d5387ceea10382d44cdb94 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:04:45 +0200 Subject: [PATCH 08/25] move update user api call to user services --- .../package_tools/mih_personal_profile.dart | 41 ++++--------------- .../lib/mih_services/mih_user_services.dart | 40 ++++++++++++++++++ 2 files changed, 49 insertions(+), 32 deletions(-) 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 dbbe8921..134e55f8 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,5 +1,3 @@ -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_floating_menu.dart'; @@ -22,7 +20,6 @@ import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; -import 'package:supertokens_flutter/http.dart' as http; class MihPersonalProfile extends StatefulWidget { final AppProfileUpdateArguments arguments; @@ -115,35 +112,16 @@ class _MihPersonalProfileState extends State { } Future updateUserApiCall() async { - var fname = proPicController.text.replaceAll(RegExp(r' '), '-'); - var filePath = - "${widget.arguments.signedInUser.app_id}/profile_files/$fname"; - var profileType; - if (businessUser) { - profileType = "business"; - } else { - profileType = "personal"; - } - if (isUsernameValid(usernameController.text) == false) { - usernamePopUp(); - } else { - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/user/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idusers": widget.arguments.signedInUser.idUser, - "username": usernameController.text, - "fnam": fnameController.text, - "lname": lnameController.text, - "type": profileType, - "pro_pic_path": filePath, - }), + int responseCode = await MihUserApis().updateUser( + widget.arguments.signedInUser, + fnameController.text, + lnameController.text, + usernameController.text, + proPicController.text, + businessUser, + context, ); - //print("Here4"); - //print(response.statusCode); - if (response.statusCode == 200) { + if (responseCode == 200) { Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pop(); @@ -159,7 +137,6 @@ class _MihPersonalProfileState extends State { } else { internetConnectionPopUp(); } - } } Future deleteFileApiCall(String filename) async { diff --git a/Frontend/lib/mih_services/mih_user_services.dart b/Frontend/lib/mih_services/mih_user_services.dart index 9f016198..1be699d0 100644 --- a/Frontend/lib/mih_services/mih_user_services.dart +++ b/Frontend/lib/mih_services/mih_user_services.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -29,6 +30,45 @@ class MihUserApis { } } + Future updateUser( + AppUser signedInUser, + String firstName, + String lastName, + String username, + String profilePicture, + bool isBusinessUser, + BuildContext context, + ) async { + var fileName = profilePicture.replaceAll(RegExp(r' '), '-'); + var filePath = + "${signedInUser.app_id}/profile_files/$fileName"; + String profileType; + if (isBusinessUser) { + profileType = "business"; + } else { + profileType = "personal"; + } + var response = await http.put( + Uri.parse("${AppEnviroment.baseApiUrl}/user/update/"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + body: jsonEncode({ + "idusers": signedInUser.idUser, + "username": username, + "fnam": firstName, + "lname": lastName, + "type": profileType, + "pro_pic_path": filePath, + }), + ); + if (response.statusCode == 200) { + return response.statusCode; + } else { + return response.statusCode; + } + } + static Future deleteAccount( String app_id, BuildContext context, From b93478ddf4371448d9add7037dd9b9039ef6bf30 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:22:09 +0200 Subject: [PATCH 09/25] add get user to user services and chanfge name --- .../lib/mih_services/mih_user_services.dart | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Frontend/lib/mih_services/mih_user_services.dart b/Frontend/lib/mih_services/mih_user_services.dart index 1be699d0..a0c7b8d6 100644 --- a/Frontend/lib/mih_services/mih_user_services.dart +++ b/Frontend/lib/mih_services/mih_user_services.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; import 'package:supertokens_flutter/http.dart' as http; import 'package:supertokens_flutter/supertokens.dart'; -class MihUserApis { +class MihUserServices { final baseAPI = AppEnviroment.baseApiUrl; static Future isUsernameUnique( @@ -30,6 +30,26 @@ class MihUserApis { } } + Future getUserDetails( + String app_id, + BuildContext context, + ) async { + var response = await http.get( + Uri.parse("${AppEnviroment.baseApiUrl}/user/$app_id"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + ); + + if (response.statusCode == 200) { + String body = response.body; + var jsonBody = jsonDecode(body); + return AppUser.fromJson(jsonBody); + } else { + return null; + } + } + Future updateUser( AppUser signedInUser, String firstName, From b863ff173a7ceede587e49e8c3350e7cb548879a Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:22:46 +0200 Subject: [PATCH 10/25] use enw user service in get profile service --- Frontend/lib/mih_services/mih_service_calls.dart | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 4a7da538..0157c539 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/mih_services/mih_user_services.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_env/mih_env.dart'; @@ -57,16 +58,11 @@ class MIHApiCalls { // Get Userdata var uid = await SuperTokens.getUserId(); - var responseUser = await http.get(Uri.parse("$baseAPI/user/$uid")); - if (responseUser.statusCode == 200) { - // print("here"); - String body = responseUser.body; - var decodedData = jsonDecode(body); - AppUser u = AppUser.fromJson(decodedData); - userData = u; + AppUser? user = await MihUserServices().getUserDetails(uid, context); + if(user != null) { + userData = user; } else { - throw Exception( - "Error: GetUserData status code ${responseUser.statusCode}"); + throw Exception("Error: GetUserData returned null"); } // Get BusinessUserdata From 76fc833bcf622284c15256cea27d9d3d4669b65d Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:23:08 +0200 Subject: [PATCH 11/25] update user api to user service --- .../lib/mih_packages/mih_home/mih_profile_getter.dart | 1 - .../package_tools/mih_personal_profile.dart | 4 ++-- .../package_tools/mih_personal_settings.dart | 2 +- .../lib/mih_services/mih_mzansi_wallet_services.dart | 11 ----------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Frontend/lib/mih_packages/mih_home/mih_profile_getter.dart b/Frontend/lib/mih_packages/mih_home/mih_profile_getter.dart index b2cb8d47..811dd798 100644 --- a/Frontend/lib/mih_packages/mih_home/mih_profile_getter.dart +++ b/Frontend/lib/mih_packages/mih_home/mih_profile_getter.dart @@ -218,7 +218,6 @@ class _MIHProfileGetterState extends State { // ); } -// Dont know icons created by Freepik - Flaticon @override void dispose() { // TODO: implement dispose 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 134e55f8..b0e2cc96 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 @@ -71,7 +71,7 @@ class _MihPersonalProfileState extends State { // print("============\nsubmiit form\n================="); if (widget.arguments.signedInUser.username != usernameController.text) { bool isUsernameUnique = - await MihUserApis.isUsernameUnique(usernameController.text, context); + await MihUserServices.isUsernameUnique(usernameController.text, context); print("isUsernameUnique: $isUsernameUnique"); if (isUsernameUnique == false) { notUniqueAlert(); @@ -112,7 +112,7 @@ class _MihPersonalProfileState extends State { } Future updateUserApiCall() async { - int responseCode = await MihUserApis().updateUser( + int responseCode = await MihUserServices().updateUser( widget.arguments.signedInUser, fnameController.text, lnameController.text, diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart index c1956931..5b07cc0a 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart @@ -61,7 +61,7 @@ class _MihPersonalSettingsState extends State { children: [ MihButton( onPressed: () { - MihUserApis.deleteAccount( + MihUserServices.deleteAccount( widget.signedInUser.app_id, context); }, buttonColor: diff --git a/Frontend/lib/mih_services/mih_mzansi_wallet_services.dart b/Frontend/lib/mih_services/mih_mzansi_wallet_services.dart index dad3dbb3..acbdf2a1 100644 --- a/Frontend/lib/mih_services/mih_mzansi_wallet_services.dart +++ b/Frontend/lib/mih_services/mih_mzansi_wallet_services.dart @@ -5,17 +5,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.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:flutter/material.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_env/mih_env.dart'; -// import '../mih_objects/app_user.dart'; -// import '../mih_objects/arguments.dart'; -// import '../mih_objects/business.dart'; -// import '../mih_objects/business_user.dart'; -// import '../mih_objects/notification.dart'; -// import '../mih_objects/patient_access.dart'; -// import '../mih_objects/patient_queue.dart'; -// import '../mih_objects/patients.dart'; import 'package:supertokens_flutter/http.dart' as http; import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; From 27c04341432fc9781ae3adad791ff81423a830e3 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:29:47 +0200 Subject: [PATCH 12/25] add get business call and change name to services --- .../mih_business_details_services.dart | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Frontend/lib/mih_services/mih_business_details_services.dart b/Frontend/lib/mih_services/mih_business_details_services.dart index 0281bdfb..5caba187 100644 --- a/Frontend/lib/mih_services/mih_business_details_services.dart +++ b/Frontend/lib/mih_services/mih_business_details_services.dart @@ -1,13 +1,34 @@ import 'dart:convert'; import 'package:http/http.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:flutter/material.dart'; import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:supertokens_flutter/http.dart' as http; -class MihBusinessDetailsApi { +class MihBusinessDetailsServices { + + Future getBusinessDetails( + String app_id, + BuildContext context, + ) async { + var response = await http.get( + Uri.parse("${AppEnviroment.baseApiUrl}/business/app_id/$app_id"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + ); + if (response.statusCode == 200) { + String body = response.body; + var jsonBody = jsonDecode(body); + return Business.fromJson(jsonBody); + } else { + return null; + } + } + Future createBusinessDetails( String appId, String busineName, From 2fa48e98f686da1af8330da3613a7b65ee89e5ff Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:30:04 +0200 Subject: [PATCH 13/25] user new get business service --- .../lib/mih_services/mih_service_calls.dart | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 0157c539..41e2343e 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; import 'package:flutter/material.dart'; @@ -79,16 +80,25 @@ class MIHApiCalls { } // Get Businessdata - var responseBusiness = - await http.get(Uri.parse("$baseAPI/business/app_id/$uid")); - if (responseBusiness.statusCode == 200) { - String body = responseBusiness.body; - var decodedData = jsonDecode(body); - Business business = Business.fromJson(decodedData); + Business? business = await MihBusinessDetailsServices().getBusinessDetails( + uid, + context, + ); + if (business != null) { busData = business; } else { busData = null; } + // var responseBusiness = + // await http.get(Uri.parse("$baseAPI/business/app_id/$uid")); + // if (responseBusiness.statusCode == 200) { + // String body = responseBusiness.body; + // var decodedData = jsonDecode(body); + // Business business = Business.fromJson(decodedData); + // busData = business; + // } else { + // busData = null; + // } //get profile picture if (userData.pro_pic_path == "") { From cd40114c920abdda195320103a466137b430e2c1 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:30:13 +0200 Subject: [PATCH 14/25] update service name --- .../business_profile/package_tools/mih_business_details.dart | 2 +- .../mzansi_profile/business_profile/profile_business_add.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 a29945a2..009d7e49 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 @@ -53,7 +53,7 @@ class _MihBusinessDetailsState extends State { Future submitForm() async { if (isFormFilled()) { int statusCode = 0; - statusCode = await MihBusinessDetailsApi().updateBusinessDetails( + statusCode = await MihBusinessDetailsServices().updateBusinessDetails( widget.arguments.business!.business_id, nameController.text, typeController.text, 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 fd0840d8..0f9569db 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 @@ -111,7 +111,7 @@ class _ProfileBusinessAddState extends State { Future createBusinessProfileAPICall() async { print("Inside create business profile method"); - Response response = await MihBusinessDetailsApi().createBusinessDetails( + Response response = await MihBusinessDetailsServices().createBusinessDetails( widget.signedInUser.app_id, nameController.text, typeController.text, From 753465be92edbdd9b4437e4aed087bef0022014d Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:37:07 +0200 Subject: [PATCH 15/25] add get business user and chanegh api to service name --- .../mih_my_business_user_services.dart | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Frontend/lib/mih_services/mih_my_business_user_services.dart b/Frontend/lib/mih_services/mih_my_business_user_services.dart index 9d758bed..e1481493 100644 --- a/Frontend/lib/mih_services/mih_my_business_user_services.dart +++ b/Frontend/lib/mih_services/mih_my_business_user_services.dart @@ -1,12 +1,28 @@ import 'dart:convert'; - +import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:flutter/material.dart'; import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:supertokens_flutter/http.dart' as http; -class MihMyBusinessUserApi { +class MihMyBusinessUserServices { + Future getBusinessUser( + String app_id, + ) async { + var response = await http.get( + Uri.parse("${AppEnviroment.baseApiUrl}/business-user/$app_id"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + ); + if (response.statusCode == 200) { + return BusinessUser.fromJson(jsonDecode(response.body)); + } else { + return null; + } + } + Future createBusinessUser( String business_id, String app_id, From 02ec5d4ee9371c92c5a49aee5775daa9bae4730a Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:37:19 +0200 Subject: [PATCH 16/25] use new get business user services --- .../lib/mih_services/mih_service_calls.dart | 60 ++++++------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 41e2343e..6de54e15 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; +import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; import 'package:flutter/material.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; @@ -60,24 +61,31 @@ class MIHApiCalls { // Get Userdata var uid = await SuperTokens.getUserId(); AppUser? user = await MihUserServices().getUserDetails(uid, context); - if(user != null) { + if (user != null) { userData = user; } else { throw Exception("Error: GetUserData returned null"); } // Get BusinessUserdata - var responseBUser = await http.get( - Uri.parse("$baseAPI/business-user/$uid"), - ); - if (responseBUser.statusCode == 200) { - String body = responseBUser.body; - var decodedData = jsonDecode(body); - BusinessUser business_User = BusinessUser.fromJson(decodedData); - bUserData = business_User; + BusinessUser? businessUser = + await MihMyBusinessUserServices().getBusinessUser(uid); + if (businessUser != null) { + bUserData = businessUser; } else { bUserData = null; } + // var responseBUser = await http.get( + // Uri.parse("$baseAPI/business-user/$uid"), + // ); + // if (responseBUser.statusCode == 200) { + // String body = responseBUser.body; + // var decodedData = jsonDecode(body); + // BusinessUser business_User = BusinessUser.fromJson(decodedData); + // bUserData = business_User; + // } else { + // bUserData = null; + // } // Get Businessdata Business? business = await MihBusinessDetailsServices().getBusinessDetails( @@ -89,25 +97,11 @@ class MIHApiCalls { } else { busData = null; } - // var responseBusiness = - // await http.get(Uri.parse("$baseAPI/business/app_id/$uid")); - // if (responseBusiness.statusCode == 200) { - // String body = responseBusiness.body; - // var decodedData = jsonDecode(body); - // Business business = Business.fromJson(decodedData); - // busData = business; - // } else { - // busData = null; - // } //get profile picture if (userData.pro_pic_path == "") { userPic = ""; - } - // else if (AppEnviroment.getEnv() == "Dev") { - // userPic = "${AppEnviroment.baseFileUrl}/mih/${userData.pro_pic_path}"; - // } - else { + } else { userPic = await MihFileApi.getMinioFileUrl(userData.pro_pic_path, context); } @@ -155,24 +149,6 @@ class MIHApiCalls { userData, bUserData, busData, patientData, notifi, userPic); } - /// This function is used to get business details by business _id. - /// - /// Patameters: String business_id & app_id (app_id of patient). - /// - /// Returns List (List of access that match the above parameters). - static Future getBusinessDetails(String business_id) async { - var responseBusiness = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/business/business_id/$business_id")); - if (responseBusiness.statusCode == 200) { - String body = responseBusiness.body; - var decodedData = jsonDecode(body); - Business business = Business.fromJson(decodedData); - return business; - } else { - return null; - } - } - //================== BUSINESS PATIENT/PERSONAL ACCESS ========================================================================== /// This function is used to check if a business has access to a specific patients profile. From 3d1272dee24c9f18e295784de910950104bf3fd9 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:37:30 +0200 Subject: [PATCH 17/25] update service to new name --- .../business_profile/package_tools/mih_my_business_user.dart | 2 +- .../business_profile/profile_business_add.dart | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 c3202f75..3116a16c 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 @@ -90,7 +90,7 @@ class _MihMyBusinessUserState extends State { Future submitForm() async { if (isFormFilled()) { - int statusCode = await MihMyBusinessUserApi().updateBusinessUser( + int statusCode = await MihMyBusinessUserServices().updateBusinessUser( widget.arguments.signedInUser.app_id, widget.arguments.businessUser!.business_id, titleDropdownController.text, 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 0f9569db..bea0eeff 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 @@ -86,7 +86,7 @@ class _ProfileBusinessAddState extends State { Future createBusinessUserAPICall(String business_id) async { print("Inside create bus user method"); - int statusCode = await MihMyBusinessUserApi().createBusinessUser( + int statusCode = await MihMyBusinessUserServices().createBusinessUser( business_id, widget.signedInUser.app_id, signtureController.text, @@ -111,7 +111,8 @@ class _ProfileBusinessAddState extends State { Future createBusinessProfileAPICall() async { print("Inside create business profile method"); - Response response = await MihBusinessDetailsServices().createBusinessDetails( + Response response = + await MihBusinessDetailsServices().createBusinessDetails( widget.signedInUser.app_id, nameController.text, typeController.text, From c139350de6662a4a64a4e25ea9b49d8b7c9fec8e Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 12:38:39 +0200 Subject: [PATCH 18/25] remove param context --- .../mih_services/mih_business_details_services.dart | 4 +--- Frontend/lib/mih_services/mih_service_calls.dart | 12 ------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Frontend/lib/mih_services/mih_business_details_services.dart b/Frontend/lib/mih_services/mih_business_details_services.dart index 5caba187..2ca27ed4 100644 --- a/Frontend/lib/mih_services/mih_business_details_services.dart +++ b/Frontend/lib/mih_services/mih_business_details_services.dart @@ -9,12 +9,10 @@ import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:supertokens_flutter/http.dart' as http; class MihBusinessDetailsServices { - Future getBusinessDetails( String app_id, - BuildContext context, ) async { - var response = await http.get( + var response = await http.get( Uri.parse("${AppEnviroment.baseApiUrl}/business/app_id/$app_id"), headers: { "Content-Type": "application/json; charset=UTF-8" diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 6de54e15..3aed2f9a 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -75,22 +75,10 @@ class MIHApiCalls { } else { bUserData = null; } - // var responseBUser = await http.get( - // Uri.parse("$baseAPI/business-user/$uid"), - // ); - // if (responseBUser.statusCode == 200) { - // String body = responseBUser.body; - // var decodedData = jsonDecode(body); - // BusinessUser business_User = BusinessUser.fromJson(decodedData); - // bUserData = business_User; - // } else { - // bUserData = null; - // } // Get Businessdata Business? business = await MihBusinessDetailsServices().getBusinessDetails( uid, - context, ); if (business != null) { busData = business; From 8685801cbb6c9216a6074558e83ce1c01121d35b Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:09:41 +0200 Subject: [PATCH 19/25] create patient services --- .../mih_services/mih_patient_services.dart | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Frontend/lib/mih_services/mih_patient_services.dart diff --git a/Frontend/lib/mih_services/mih_patient_services.dart b/Frontend/lib/mih_services/mih_patient_services.dart new file mode 100644 index 00000000..b57e89f2 --- /dev/null +++ b/Frontend/lib/mih_services/mih_patient_services.dart @@ -0,0 +1,27 @@ +import 'dart:convert'; + +import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart'; +import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; +import 'package:supertokens_flutter/http.dart' as http; + +class MihPatientServices { + final baseAPI = AppEnviroment.baseApiUrl; + + Future getPatientDetails( + String appId, + ) async { + var response = await http.get( + Uri.parse("${AppEnviroment.baseApiUrl}/patient/app_id/$appId"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + ); + if (response.statusCode == 200) { + String body = response.body; + var jsonBody = jsonDecode(body); + return Patient.fromJson(jsonBody); + } else { + return null; + } + } +} From f04f4f57d2f79b10e99b3cf12e15be0195cb8c98 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:09:50 +0200 Subject: [PATCH 20/25] use in nmain serviec fie --- .../lib/mih_services/mih_service_calls.dart | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 3aed2f9a..2ed117aa 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -5,6 +5,7 @@ import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; // import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; // import '../mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -112,26 +113,34 @@ class MIHApiCalls { } //get patient profile - //print("Patien manager page: $endpoint"); - final response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/patients/${userData.app_id}")); + Patient? patient = await MihPatientServices().getPatientDetails( + uid, + ); + if (patient != null) { + patientData = patient; + } else { + patientData = null; + } + // print("Here"); // print("Body: ${response.body}"); // print("Code: ${response.statusCode}"); // var errorCode = response.statusCode.toString(); // var errorBody = response.body; - if (response.statusCode == 200) { - // print("Here1"); - var decodedData = jsonDecode(response.body); - // print("Here2"); - Patient patients = Patient.fromJson(decodedData as Map); - // print("Here3"); - // print(patients); - patientData = patients; - } else { - patientData = null; - } + // final response = await http.get( + // Uri.parse("${AppEnviroment.baseApiUrl}/patients/${userData.app_id}")); + // if (response.statusCode == 200) { + // // print("Here1"); + // var decodedData = jsonDecode(response.body); + // // print("Here2"); + // Patient patients = Patient.fromJson(decodedData as Map); + // // print("Here3"); + // // print(patients); + // patientData = patients; + // } else { + // patientData = null; + // } //print(userPic); return HomeArguments( userData, bUserData, busData, patientData, notifi, userPic); From 32eb24ddf5ed6d92b7287a0130bed81b918455d5 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:23:39 +0200 Subject: [PATCH 21/25] get notification sevice --- .../mih_notification_services.dart | 18 +++++++++ .../lib/mih_services/mih_service_calls.dart | 39 ++----------------- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Frontend/lib/mih_services/mih_notification_services.dart b/Frontend/lib/mih_services/mih_notification_services.dart index 00298801..c58bca6f 100644 --- a/Frontend/lib/mih_services/mih_notification_services.dart +++ b/Frontend/lib/mih_services/mih_notification_services.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_objects/notification.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_success_message.dart'; import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; @@ -11,6 +12,23 @@ class MihNotificationApis { final baseAPI = AppEnviroment.baseApiUrl; //================== Notifications ========================================================================== + Future> getNotificationByUser( + String app_id, + int notificationAmount, + ) async { + var responseNotification = await http.get( + Uri.parse("$baseAPI/notifications/$app_id?amount=$notificationAmount")); + if (responseNotification.statusCode == 200) { + String body = responseNotification.body; + Iterable l = jsonDecode(body); + List notifications = List.from( + l.map((model) => MIHNotification.fromJson(model))); + return notifications; + } else { + return []; + } + } + /// This function is used to create notification to patient for access reviews /// /// Patameters:- diff --git a/Frontend/lib/mih_services/mih_service_calls.dart b/Frontend/lib/mih_services/mih_service_calls.dart index 2ed117aa..a1b701cc 100644 --- a/Frontend/lib/mih_services/mih_service_calls.dart +++ b/Frontend/lib/mih_services/mih_service_calls.dart @@ -96,21 +96,10 @@ class MIHApiCalls { } //Get Notifications - var responseNotification = await http.get( - Uri.parse("$baseAPI/notifications/$uid?amount=$notificationAmount")); - if (responseNotification.statusCode == 200) { - String body = responseNotification.body; - // var decodedData = jsonDecode(body); - // MIHNotification notifications = MIHNotification.fromJson(decodedData); - - Iterable l = jsonDecode(body); - //print("Here2"); - List notifications = List.from( - l.map((model) => MIHNotification.fromJson(model))); - notifi = notifications; - } else { - notifi = []; - } + notifi = await MihNotificationApis().getNotificationByUser( + uid, + notificationAmount, + ); //get patient profile Patient? patient = await MihPatientServices().getPatientDetails( @@ -122,26 +111,6 @@ class MIHApiCalls { patientData = null; } - // print("Here"); - // print("Body: ${response.body}"); - // print("Code: ${response.statusCode}"); - // var errorCode = response.statusCode.toString(); - // var errorBody = response.body; - - // final response = await http.get( - // Uri.parse("${AppEnviroment.baseApiUrl}/patients/${userData.app_id}")); - // if (response.statusCode == 200) { - // // print("Here1"); - // var decodedData = jsonDecode(response.body); - // // print("Here2"); - // Patient patients = Patient.fromJson(decodedData as Map); - // // print("Here3"); - // // print(patients); - // patientData = patients; - // } else { - // patientData = null; - // } - //print(userPic); return HomeArguments( userData, bUserData, busData, patientData, notifi, userPic); } From 57817038f494a4625d2fdcf9e23e93e04486b05b Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:27:44 +0200 Subject: [PATCH 22/25] remove temp bio --- .../package_tools/mih_personal_profile.dart | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) 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 b0e2cc96..bbff0a47 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 @@ -70,8 +70,8 @@ class _MihPersonalProfileState extends State { Future submitForm() async { // print("============\nsubmiit form\n================="); if (widget.arguments.signedInUser.username != usernameController.text) { - bool isUsernameUnique = - await MihUserServices.isUsernameUnique(usernameController.text, context); + bool isUsernameUnique = await MihUserServices.isUsernameUnique( + usernameController.text, context); print("isUsernameUnique: $isUsernameUnique"); if (isUsernameUnique == false) { notUniqueAlert(); @@ -112,31 +112,31 @@ class _MihPersonalProfileState extends State { } Future updateUserApiCall() async { - int responseCode = await MihUserServices().updateUser( - widget.arguments.signedInUser, - fnameController.text, - lnameController.text, - usernameController.text, - proPicController.text, - businessUser, - context, + int responseCode = await MihUserServices().updateUser( + widget.arguments.signedInUser, + fnameController.text, + lnameController.text, + usernameController.text, + proPicController.text, + businessUser, + context, + ); + if (responseCode == 200) { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pushNamed( + '/', + arguments: AuthArguments( + true, + false, + ), ); - if (responseCode == 200) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/', - arguments: AuthArguments( - true, - false, - ), - ); - String message = "Your information has been updated successfully!"; - successPopUp(message); - } else { - internetConnectionPopUp(); - } + String message = "Your information has been updated successfully!"; + successPopUp(message); + } else { + internetConnectionPopUp(); + } } Future deleteFileApiCall(String filename) async { @@ -438,31 +438,32 @@ class _MihPersonalProfileState extends State { ), ), ), - const SizedBox(height: 10.0), - Center( - child: Text( - "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - ), + // const SizedBox(height: 10.0), + // Center( + // child: Text( + // "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", + // textAlign: TextAlign.center, + // style: TextStyle( + // fontSize: 15, + // fontWeight: FontWeight.bold, + // color: MzanziInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // ), const SizedBox(height: 30.0), Center( child: MihButton( onPressed: () { // Connect with the user + editProfileWindow(width); }, buttonColor: MzanziInnovationHub.of(context)!.theme.successColor(), width: 300, child: Text( - "Connect", + "Edit Profile", style: TextStyle( color: MzanziInnovationHub.of(context)! .theme From d2e069d14f50b628971ea96c220ce1eb9ab19232 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:31:03 +0200 Subject: [PATCH 23/25] remove demo data --- .../components/mih_business_card.dart | 94 +++++++++---------- .../package_tools/mih_business_details.dart | 48 +++++++--- 2 files changed, 82 insertions(+), 60 deletions(-) diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart index adb1831a..32316654 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart @@ -364,53 +364,53 @@ class _MihBusinessCardState extends State { ); }, ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ), - _buildContactInfo( - "Website", - "Find out more about us.", - Icons.vpn_lock, - const Color(0xffd67d8a), - () { - _launchWebsite(widget.website); - }, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ), - _buildContactInfo( - "Rate Us", - "Let us know how we are doing.", - Icons.star_rate_rounded, - const Color(0xffd69d7d), - () { - print("Opeining rating dialog"); - // _launchWebsite(widget.website); - }, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ), - _buildContactInfo( - "Bookmark", - "Save us for later.", - Icons.bookmark_add_rounded, - const Color(0xff6e7dcc), - () { - // _launchWebsite(widget.website); - print("Saving ${widget.businessName} to Directory"); - }, - ), + // Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: Divider( + // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + // _buildContactInfo( + // "Website", + // "Find out more about us.", + // Icons.vpn_lock, + // const Color(0xffd67d8a), + // () { + // _launchWebsite(widget.website); + // }, + // ), + // Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: Divider( + // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + // _buildContactInfo( + // "Rate Us", + // "Let us know how we are doing.", + // Icons.star_rate_rounded, + // const Color(0xffd69d7d), + // () { + // print("Opeining rating dialog"); + // // _launchWebsite(widget.website); + // }, + // ), + // Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: Divider( + // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + // _buildContactInfo( + // "Bookmark", + // "Save us for later.", + // Icons.bookmark_add_rounded, + // const Color(0xff6e7dcc), + // () { + // // _launchWebsite(widget.website); + // print("Saving ${widget.businessName} to Directory"); + // }, + // ), const SizedBox(height: 10), // Padding( // padding: const EdgeInsets.symmetric(horizontal: 10.0), 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 009d7e49..aa96dba4 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 @@ -530,19 +530,19 @@ class _MihBusinessDetailsState extends State { ), ), ), - Center( - child: Text( - "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - ), + // Center( + // child: Text( + // "*DEMO TEXT* This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself and let. This would be the bio of the user telling us a bit about themself", + // textAlign: TextAlign.center, + // style: TextStyle( + // fontSize: 15, + // fontWeight: FontWeight.bold, + // color: MzanziInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + // ), const SizedBox(height: 20), MihBusinessCard( businessName: widget.arguments.business!.Name, @@ -553,6 +553,28 @@ class _MihBusinessDetailsState extends State { website: "https://app.mzansi-innovation-hub.co.za/privacy.html", ), + const SizedBox(height: 30.0), + Center( + child: MihButton( + onPressed: () { + // Connect with the user + editBizProfileWindow(width); + }, + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + width: 300, + child: Text( + "Edit Profile", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), ], ), ), From a54bb2693cee1a564996f8e9628786c8f52604a2 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 13:32:25 +0200 Subject: [PATCH 24/25] make business card width 700 --- .../package_tools/mih_business_details.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 aa96dba4..a0e0bcf2 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 @@ -544,14 +544,17 @@ class _MihBusinessDetailsState extends State { // ), // ), const SizedBox(height: 20), - MihBusinessCard( - businessName: widget.arguments.business!.Name, - cellNumber: widget.arguments.business!.contact_no, - email: widget.arguments.business!.bus_email, - gpsLocation: widget.arguments.business!.gps_location, - //To-Do: Add the business Website - website: - "https://app.mzansi-innovation-hub.co.za/privacy.html", + SizedBox( + width: 700, + child: MihBusinessCard( + businessName: widget.arguments.business!.Name, + cellNumber: widget.arguments.business!.contact_no, + email: widget.arguments.business!.bus_email, + gpsLocation: widget.arguments.business!.gps_location, + //To-Do: Add the business Website + website: + "https://app.mzansi-innovation-hub.co.za/privacy.html", + ), ), const SizedBox(height: 30.0), Center( From 0c3cc972ce3b6013c682ddd587f7cb083e880cbb Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 2 Jul 2025 14:04:04 +0200 Subject: [PATCH 25/25] Profile view enhancement --- .DS_Store | Bin 6148 -> 10244 bytes docker-compose.yml | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.DS_Store b/.DS_Store index ecfa0db117c4811cc792fa936a5f87e542c027e2..194e7e8051d3780ad4f1db04fb1e870c0acb5803 100644 GIT binary patch literal 10244 zcmeHMO=w(I6h3z{F>l%ghN=q}$`jGLsOd!0R8e7?P6`opkrC^EoXMM})4q9kn3-f+ zLtu6-*sUP=OT~qCA$1|BrMPN#(p3=@(Um**E=0fklgxQP846M&axdI_-n;iZ_nhaVNWPRTSx!ChLb28=}O0dV<63dI=km- znpUYvJ$`;4|2UfGZ7o@;)I(WEo%hp&zrXNpe(PAgJs8>EK0Uk}7{94k={W4JQ-dN} z=avg+E(GYAwQ}2M!v50xKip8ZV~C;kYy`KzZ}KM8X+qoY(h5lmsKI?88oQE4a6c+f zeo=nzEA2<3pOzf@vO9|VWB1Als#6W#oYkBJi=kYxj4QfS#M6K4geT>F49&e4w;p~r zjo{wD?A`s|hh_v5{c!JhM{)1Pk9ssca9E=rvhu4-jfDSS!Xxf~3eO{$y11xkTCz_b z!)K4YdF@jZL#i(x#V8z)W9nT!D-OV>w4>0W$Mo!IQ5$uL2{YzAwJ40oChkwfHc2P2 zoALk`wXH?doxEXyy0=(A(7p=jg`y@2*>pM&O6@^>*-_GdeYZEBJPw zK!g%2xtBF}#h<{$$3B6t_q%O7*T1Q^!)CWvD%}#fvHbX56W)Zk-+QBaTK22GT5qj8 zU+cW4-d>b4tZzTp>Mu1L{pI34$7R&3HKRsHD>Q=!Ag`ZnMuF_l%e5%zYTc@7@CsgG zxp?2k#_Z9fhy2;6W;PG`8#9lWj^O2qxy{Xjcke@opI%x%8@3{;1`A2pUm!GP-gnAN zcuEn$2kz>n%dcc%_<$|^bzpm8ruyQOdK8Wi(A8%?Q4Xg1TCaAZP)4h0Q}Gn&d3qaD zG{PirV$vR?#rPD@DI_1l3=JOZR_^f6+5PfpE5Cj4%d2J+&FGKEI~vI&-pYLs!}vHv z`lA-nxp*XcBmIbNqzuU;AUc@nhkG7={`L0u&-A&+*$D0_QAt@S&=M`cs|v+vT_uczj?L z>-g29_9~FVhxKxC>g2C~=&w3!AMTG??eQUv_nlZ~y3rMm0mp!2z%k$$*i#0^jCEh# z|1a$R|Nox)=!`oC90PZj0gd@2bkXjwm+~(i0KLh&i{O`{HxB^gDT;llfIVLH08+LEHjz9>eB%o;l0_ D)L|k~ diff --git a/docker-compose.yml b/docker-compose.yml index 6d7b5819..2be023d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -169,14 +169,14 @@ services: networks: - MIH-network # === Added section for NVIDIA GPU acceleration === - runtime: nvidia - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: all # or specify a number of GPUs - capabilities: [ gpu ] + # runtime: nvidia + # deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: all # or specify a number of GPUs + # capabilities: [ gpu ] #============== Firebaase ==================================================================== # firebase: # container_name: MIH-firebase-emulator