diff --git a/Frontend/lib/mih_components/mih_layout/mih_tile.dart b/Frontend/lib/mih_components/mih_layout/mih_tile.dart index caa406d9..ad59559f 100644 --- a/Frontend/lib/mih_components/mih_layout/mih_tile.dart +++ b/Frontend/lib/mih_components/mih_layout/mih_tile.dart @@ -1,7 +1,7 @@ +import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_yt_video_player.dart'; import 'package:flutter/material.dart'; -import '../../main.dart'; -import 'mih_window.dart'; class MIHTile extends StatefulWidget { final String tileName; @@ -47,16 +47,18 @@ class _MIHTileState extends State { showDialog( context: context, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: widget.tileName, - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHYTVideoPlayer(videoYTLink: widget.videoID!), - ], + windowBody: Column( + children: [ + MIHYTVideoPlayer(videoYTLink: widget.videoID!), + ], + ), ); }, ); diff --git a/Frontend/lib/mih_components/mih_layout/mih_window.dart b/Frontend/lib/mih_components/mih_layout/mih_window.dart deleted file mode 100644 index ded7b8cc..00000000 --- a/Frontend/lib/mih_components/mih_layout/mih_window.dart +++ /dev/null @@ -1,214 +0,0 @@ -import 'package:flutter/material.dart'; -import '../../main.dart'; - -class MIHWindow extends StatefulWidget { - final String windowTitle; - final List windowBody; - final List windowTools; - final void Function() onWindowTapClose; - final bool fullscreen; - const MIHWindow({ - super.key, - required this.fullscreen, - required this.windowTitle, - required this.windowTools, - required this.onWindowTapClose, - required this.windowBody, - }); - - @override - State createState() => _MIHWindowState(); -} - -class _MIHWindowState extends State { - late double windowTitleSize; - late double horizontralWindowPadding; - late double vertticalWindowPadding; - late double windowWidth; - late double windowHeight; - late double width; - late double height; - - void checkScreenSize() { - // print("screen width: $width"); - // print("screen height: $height"); - if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - windowTitleSize = 25; - horizontralWindowPadding = width / 7; - vertticalWindowPadding = 25; - windowWidth = width; - windowHeight = height; - }); - } else { - setState(() { - windowTitleSize = 20; - horizontralWindowPadding = 10; - vertticalWindowPadding = 10; - windowWidth = width; - windowHeight = height; - }); - } - } - - Widget getWidnowClose() { - return Container( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: widget.onWindowTapClose, - icon: Icon( - Icons.close, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - size: 35, - ), - ), - ); - } - - Widget getWidnowTools() { - return Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: widget.windowTools, - ); - } - - Widget getWidnowTitle() { - return Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - widget.windowTitle, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - fontSize: windowTitleSize, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ); - } - - Widget getWidnowHeader() { - return Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - getWidnowTools(), - Expanded( - flex: 2, - child: getWidnowTitle(), - ), - getWidnowClose(), - ], - ); - } - - Widget getWidnowBody() { - if (widget.fullscreen) { - return Expanded( - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: widget.windowBody, - ), - ), - ); - } else { - return Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: widget.windowBody, - ), - ); - } - } - - Widget createWindow(Widget header, Widget body) { - Widget visibleItems; - if (widget.fullscreen) { - visibleItems = Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - header, - //const Divider(), - body, - ], - ); - } else { - visibleItems = SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - header, - //const Divider(), - body, - ], - ), - ); - } - return Dialog( - insetPadding: EdgeInsets.symmetric( - horizontal: horizontralWindowPadding, - vertical: vertticalWindowPadding, - ), - insetAnimationCurve: Easing.emphasizedDecelerate, - insetAnimationDuration: Durations.short1, - child: Container( - //padding: const EdgeInsets.all(10), - width: windowWidth, - //height: windowHeight, - decoration: BoxDecoration( - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - width: 5.0), - ), - child: visibleItems, - ), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - checkScreenSize(); - return createWindow( - getWidnowHeader(), - getWidnowBody(), - ); - } -} diff --git a/Frontend/lib/mih_packages/access_review/builder/build_access_request_list.dart b/Frontend/lib/mih_packages/access_review/builder/build_access_request_list.dart index 64e6f0ac..3b2a8115 100644 --- a/Frontend/lib/mih_packages/access_review/builder/build_access_request_list.dart +++ b/Frontend/lib/mih_packages/access_review/builder/build_access_request_list.dart @@ -1,18 +1,17 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.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_error_message.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_warning_message.dart'; +import 'package:mzansi_innovation_hub/mih_env/env.dart'; +import 'package:mzansi_innovation_hub/mih_objects/access_request.dart'; +import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; import 'package:supertokens_flutter/http.dart' as http; -import '../../../main.dart'; -import '../../../mih_components/mih_inputs_and_buttons/mih_button.dart'; -import '../../../mih_components/mih_layout/mih_window.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_error_message.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_success_message.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_warning_message.dart'; -import '../../../mih_env/env.dart'; -import '../../../mih_objects/access_request.dart'; -import '../../../mih_objects/app_user.dart'; - class BuildAccessRequestList extends StatefulWidget { final List accessRequests; final AppUser signedInUser; @@ -220,65 +219,67 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Update Appointment Access", - windowBody: [ - const SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, + windowBody: Column( + children: [ + const SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Text( + subtitle, + textAlign: TextAlign.left, + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + fontSize: popUpBodySize, + //fontWeight: FontWeight.bold, + ), ), ), - ), - Wrap( - runSpacing: 10, - spacing: 10, - children: [ - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - updateAccessAPICall(index, "declined"); - }, - buttonText: "Decline", - buttonColor: - MzanziInnovationHub.of(context)!.theme.errorColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + Wrap( + runSpacing: 10, + spacing: 10, + children: [ + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + updateAccessAPICall(index, "declined"); + }, + buttonText: "Decline", + buttonColor: + MzanziInnovationHub.of(context)!.theme.errorColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - updateAccessAPICall(index, "approved"); - }, - buttonText: "Approve", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + updateAccessAPICall(index, "approved"); + }, + buttonText: "Approve", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - ], - ), - const SizedBox( - height: 10, - ), - ], - windowTools: const [], + ], + ), + const SizedBox( + height: 10, + ), + ], + ), + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }), diff --git a/Frontend/lib/mih_packages/access_review/builder/build_business_access_list.dart b/Frontend/lib/mih_packages/access_review/builder/build_business_access_list.dart index 42fdad96..6fd9b9e8 100644 --- a/Frontend/lib/mih_packages/access_review/builder/build_business_access_list.dart +++ b/Frontend/lib/mih_packages/access_review/builder/build_business_access_list.dart @@ -1,15 +1,14 @@ import 'package:flutter/material.dart'; - -import '../../../main.dart'; -import '../../../mih_apis/mih_api_calls.dart'; -import '../../../mih_components/mih_inputs_and_buttons/mih_button.dart'; -import '../../../mih_components/mih_layout/mih_window.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_error_message.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_success_message.dart'; -import '../../../mih_components/mih_pop_up_messages/mih_warning_message.dart'; -import '../../../mih_env/env.dart'; -import '../../../mih_objects/app_user.dart'; -import '../../../mih_objects/patient_access.dart'; +import 'package:mzansi_innovation_hub/main.dart'; +import 'package:mzansi_innovation_hub/mih_apis/mih_api_calls.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.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_error_message.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_warning_message.dart'; +import 'package:mzansi_innovation_hub/mih_env/env.dart'; +import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; +import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; class BuildBusinessAccessList extends StatefulWidget { final List patientAccessList; @@ -216,217 +215,228 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Profile Access", - windowBody: [ - const SizedBox( - height: 10, - ), - SizedBox( - width: 1000, - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, + windowBody: Column( + children: [ + const SizedBox( + height: 10, + ), + SizedBox( + width: 1000, + child: Text( + subtitle, + textAlign: TextAlign.left, + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + fontSize: popUpBodySize, + //fontWeight: FontWeight.bold, + ), ), ), - ), - const SizedBox(height: 20.0), - Visibility( - visible: widget.patientAccessList[index].status == 'pending', - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Important Notice: Approving Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), + const SizedBox(height: 20.0), + Visibility( + visible: widget.patientAccessList[index].status == 'pending', + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "Important Notice: Approving Profile Access", + style: TextStyle( + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), ), - ), - Text( - "You are about to accept access to your patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - SizedBox( - width: 700, - child: Text( - "1. Permanent Access: Once you accepts this access request, it will become permanent.", + Text( + "You are about to accept access to your patient's profile. Please be aware of the following important points:", style: TextStyle( fontWeight: FontWeight.normal, color: MzanziInnovationHub.of(context)!.theme.errorColor(), ), ), - ), - SizedBox( - width: 700, - child: Text( - "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", + SizedBox( + width: 700, + child: Text( + "1. Permanent Access: Once you accepts this access request, it will become permanent.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), + ), + ), + SizedBox( + width: 700, + child: Text( + "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), + ), + ), + SizedBox( + width: 700, + child: Text( + "3. Irreversible Access: Once granted, you cannot revoke access to your patient's profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), + ), + ), + Text( + "By pressing the \"Approve\" button you accept the above terms.", style: TextStyle( - fontWeight: FontWeight.normal, + fontWeight: FontWeight.bold, color: MzanziInnovationHub.of(context)!.theme.errorColor(), ), ), - ), - SizedBox( - width: 700, - child: Text( - "3. Irreversible Access: Once granted, you cannot revoke access to your patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ), - Text( - "By pressing the \"Approve\" button you accept the above terms.", - style: TextStyle( - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ], + ], + ), ), - ), - Visibility( - visible: widget.patientAccessList[index].status == 'approved', - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Important Notice: Approved Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), + Visibility( + visible: widget.patientAccessList[index].status == 'approved', + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "Important Notice: Approved Profile Access", + style: TextStyle( + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), ), - ), - Text( - "You have accepted access to your patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - SizedBox( - width: 700, - child: Text( - "1. Permanent Access: This access is permanent.", + Text( + "You have accepted access to your patient's profile. Please be aware of the following important points:", style: TextStyle( fontWeight: FontWeight.normal, color: MzanziInnovationHub.of(context)!.theme.errorColor(), ), ), - ), - SizedBox( - width: 700, - child: Text( - "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), + SizedBox( + width: 700, + child: Text( + "1. Permanent Access: This access is permanent.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), ), ), - ), - SizedBox( - width: 700, - child: Text( - "3. Irreversible Access: You cannot revoke this access to your patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), + SizedBox( + width: 700, + child: Text( + "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), ), ), - ), - ], + SizedBox( + width: 700, + child: Text( + "3. Irreversible Access: You cannot revoke this access to your patient's profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor(), + ), + ), + ), + ], + ), ), - ), - const SizedBox(height: 20.0), - const SizedBox( - height: 20, - ), - Visibility( - visible: widget.patientAccessList[index].status == 'pending', - child: Wrap( - runSpacing: 10, - spacing: 10, - children: [ - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - print("request declined"); - MIHApiCalls.updatePatientAccessAPICall( - widget.patientAccessList[index].business_id, - widget.patientAccessList[index].requested_by, - widget.patientAccessList[index].app_id, - "declined", - "${widget.signedInUser.fname} ${widget.signedInUser.lname}", - widget.signedInUser, - context, - ); - //updateAccessAPICall(index, "declined"); - }, - buttonText: "Decline", - buttonColor: - MzanziInnovationHub.of(context)!.theme.errorColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ), - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - print("request approved"); - MIHApiCalls.updatePatientAccessAPICall( - widget.patientAccessList[index].business_id, - widget.patientAccessList[index].requested_by, - widget.patientAccessList[index].app_id, - "approved", - "${widget.signedInUser.fname} ${widget.signedInUser.lname}", - widget.signedInUser, - context, - ); - //updateAccessAPICall(index, "approved"); - }, - buttonText: "Approve", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ), - ], + const SizedBox(height: 20.0), + const SizedBox( + height: 20, ), - ), - const SizedBox( - height: 10, - ), - ], - windowTools: const [], + Visibility( + visible: widget.patientAccessList[index].status == 'pending', + child: Wrap( + runSpacing: 10, + spacing: 10, + children: [ + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + print("request declined"); + MIHApiCalls.updatePatientAccessAPICall( + widget.patientAccessList[index].business_id, + widget.patientAccessList[index].requested_by, + widget.patientAccessList[index].app_id, + "declined", + "${widget.signedInUser.fname} ${widget.signedInUser.lname}", + widget.signedInUser, + context, + ); + //updateAccessAPICall(index, "declined"); + }, + buttonText: "Decline", + buttonColor: + MzanziInnovationHub.of(context)!.theme.errorColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + ), + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + print("request approved"); + MIHApiCalls.updatePatientAccessAPICall( + widget.patientAccessList[index].business_id, + widget.patientAccessList[index].requested_by, + widget.patientAccessList[index].app_id, + "approved", + "${widget.signedInUser.fname} ${widget.signedInUser.lname}", + widget.signedInUser, + context, + ); + //updateAccessAPICall(index, "approved"); + }, + buttonText: "Approve", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + ), + ], + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }), diff --git a/Frontend/lib/mih_packages/calculator/package_tools/tip_calc.dart b/Frontend/lib/mih_packages/calculator/package_tools/tip_calc.dart index ce02555f..b7a60467 100644 --- a/Frontend/lib/mih_packages/calculator/package_tools/tip_calc.dart +++ b/Frontend/lib/mih_packages/calculator/package_tools/tip_calc.dart @@ -3,8 +3,8 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_number_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -116,107 +116,28 @@ class _TipCalcState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Calculation Results", onWindowTapClose: () { Navigator.pop(context); }, - windowTools: const [], - windowBody: [ - // FaIcon( - // FontAwesomeIcons.moneyBills, - // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // size: 30, - // ), - // const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.coins, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - size: 35, - ), - const SizedBox(width: 15), - Text( - "Tip", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - ], - ), - Text( - tip, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.moneyBills, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - size: 35, - ), - const SizedBox(width: 15), - Text( - "Total", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - ], - ), - Text( - total, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - Text( - "~ ${double.parse(total).ceil()}.00", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - const Divider(), - if (splitBillController.text == "Yes") + windowTools: null, + windowBody: Column( + children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ FaIcon( - FontAwesomeIcons.peopleGroup, + FontAwesomeIcons.coins, color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), size: 35, ), const SizedBox(width: 15), Text( - "Total per Person", + "Tip", textAlign: TextAlign.center, style: TextStyle( fontSize: 25, @@ -227,9 +148,8 @@ class _TipCalcState extends State { ), ], ), - if (splitBillController.text == "Yes") Text( - amountPerPerson, + tip, textAlign: TextAlign.center, style: TextStyle( fontSize: 30, @@ -237,9 +157,32 @@ class _TipCalcState extends State { color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), ), - if (splitBillController.text == "Yes") + const Divider(), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FaIcon( + FontAwesomeIcons.moneyBills, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + size: 35, + ), + const SizedBox(width: 15), + Text( + "Total", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + ], + ), Text( - "~ ${double.parse(amountPerPerson).ceil()}.00", + total, textAlign: TextAlign.center, style: TextStyle( fontSize: 30, @@ -247,8 +190,66 @@ class _TipCalcState extends State { color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), ), - // if (splitBillController.text == "Yes") const Divider(), - ], + Text( + "~ ${double.parse(total).ceil()}.00", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + const Divider(), + if (splitBillController.text == "Yes") + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FaIcon( + FontAwesomeIcons.peopleGroup, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + size: 35, + ), + const SizedBox(width: 15), + Text( + "Total per Person", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + ], + ), + if (splitBillController.text == "Yes") + Text( + amountPerPerson, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + if (splitBillController.text == "Yes") + Text( + "~ ${double.parse(amountPerPerson).ceil()}.00", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), + ), + // if (splitBillController.text == "Yes") const Divider(), + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/calendar/builder/build_access_request_list.dart b/Frontend/lib/mih_packages/calendar/builder/build_access_request_list.dart index de26f6c1..8e7dd822 100644 --- a/Frontend/lib/mih_packages/calendar/builder/build_access_request_list.dart +++ b/Frontend/lib/mih_packages/calendar/builder/build_access_request_list.dart @@ -1,12 +1,12 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:supertokens_flutter/http.dart' as http; import '../../../main.dart'; import '../../../mih_components/mih_inputs_and_buttons/mih_button.dart'; -import '../../../mih_components/mih_layout/mih_window.dart'; import '../../../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../../../mih_components/mih_pop_up_messages/mih_success_message.dart'; import '../../../mih_components/mih_pop_up_messages/mih_warning_message.dart'; @@ -221,65 +221,67 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Update Appointment Access", - windowBody: [ - const SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, + windowBody: Column( + children: [ + const SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Text( + subtitle, + textAlign: TextAlign.left, + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + fontSize: popUpBodySize, + //fontWeight: FontWeight.bold, + ), ), ), - ), - Wrap( - runSpacing: 10, - spacing: 10, - children: [ - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - updateAccessAPICall(index, "declined"); - }, - buttonText: "Decline", - buttonColor: - MzanziInnovationHub.of(context)!.theme.errorColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + Wrap( + runSpacing: 10, + spacing: 10, + children: [ + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + updateAccessAPICall(index, "declined"); + }, + buttonText: "Decline", + buttonColor: + MzanziInnovationHub.of(context)!.theme.errorColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - SizedBox( - width: popUpButtonWidth, - height: 50, - child: MIHButton( - onTap: () { - updateAccessAPICall(index, "approved"); - }, - buttonText: "Approve", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + SizedBox( + width: popUpButtonWidth, + height: 50, + child: MIHButton( + onTap: () { + updateAccessAPICall(index, "approved"); + }, + buttonText: "Approve", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - ], - ), - const SizedBox( - height: 10, - ), - ], - windowTools: const [], + ], + ), + const SizedBox( + height: 10, + ), + ], + ), + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }), diff --git a/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart b/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart index 5c775aab..6c965876 100644 --- a/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart +++ b/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart @@ -1,3 +1,4 @@ +import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_apis/mih_mzansi_calendar_apis.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart'; @@ -5,7 +6,8 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_delete_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_env/env.dart'; @@ -151,20 +153,61 @@ class _BuildAppointmentListState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Appointment Details", - windowTools: [ - Visibility( - visible: canEditAppointment(index), - child: IconButton( - onPressed: () { - deleteAppointmentConfirmationWindow(index); - }, - icon: const Icon(Icons.delete), + windowTools: Visibility( + visible: canEditAppointment(index), + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.edit, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Edit Appointment", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + appointmentUpdateWindow(index); + }, + ), + SpeedDialChild( + child: Icon( + Icons.delete, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Appointment", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deleteAppointmentConfirmationWindow(index); + }, + ), + ], ), ), - ], + ), onWindowTapClose: () { Navigator.of(context).pop(); widget.dateController.clear(); @@ -172,79 +215,82 @@ class _BuildAppointmentListState extends State { widget.titleController.clear(); widget.descriptionIDController.clear(); }, - windowBody: [ - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.titleController, - hintText: "Title", - editable: false, - required: false, - ), - ), - const SizedBox(height: 10), - SizedBox( + windowBody: Column( + children: [ + const SizedBox(height: 10), + SizedBox( // width: 500, child: MIHTextField( - controller: widget.dateController, - hintText: "Date", - editable: false, - required: false, - )), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.timeController, - hintText: "Time", - editable: false, - required: false, - )), - const SizedBox(height: 10), - SizedBox( - // width: 500, - height: 250, - child: MIHMLTextField( - controller: widget.descriptionIDController, - hintText: "Description", - editable: false, - required: false, - ), - ), - const SizedBox(height: 20), - Visibility( - visible: canEditAppointment(index), - child: SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - appointmentUpdateWindow(index); - }, - buttonText: "Edit", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: widget.titleController, + hintText: "Title", + editable: false, + required: false, ), ), - ), - // SizedBox( - // width: 500, - // height: 50, - // child: MIHButton( - // onTap: () { - // addAppointmentCall(); - // checkforchange(); - // }, - // buttonText: "Add", - // buttonColor: - // MzanziInnovationHub.of(context)!.theme.successColor(), - // textColor: - // MzanziInnovationHub.of(context)!.theme.primaryColor(), - // ), - // ), - ], + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.dateController, + hintText: "Date", + editable: false, + required: false, + )), + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.timeController, + hintText: "Time", + editable: false, + required: false, + )), + const SizedBox(height: 10), + SizedBox( + // width: 500, + height: 250, + child: MIHMLTextField( + controller: widget.descriptionIDController, + hintText: "Description", + editable: false, + required: false, + ), + ), + const SizedBox(height: 10), + // Visibility( + // visible: canEditAppointment(index), + // child: SizedBox( + // width: 500, + // height: 50, + // child: MIHButton( + // onTap: () { + // appointmentUpdateWindow(index); + // }, + // buttonText: "Edit", + // buttonColor: + // MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // textColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + // ), + // SizedBox( + // width: 500, + // height: 50, + // child: MIHButton( + // onTap: () { + // addAppointmentCall(); + // checkforchange(); + // }, + // buttonText: "Add", + // buttonColor: + // MzanziInnovationHub.of(context)!.theme.successColor(), + // textColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + ], + ), ); }, ); @@ -255,20 +301,61 @@ class _BuildAppointmentListState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Appointment Details", - windowTools: [ - Visibility( - visible: canEditAppointment(index), - child: IconButton( - onPressed: () { - deleteAppointmentConfirmationWindow(index); - }, - icon: const Icon(Icons.delete), + windowTools: Visibility( + visible: canEditAppointment(index), + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.edit, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Edit Appointment", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + appointmentUpdateWindow(index); + }, + ), + SpeedDialChild( + child: Icon( + Icons.delete, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Appointment", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deleteAppointmentConfirmationWindow(index); + }, + ), + ], ), ), - ], + ), onWindowTapClose: () { Navigator.of(context).pop(); widget.dateController.clear(); @@ -276,89 +363,91 @@ class _BuildAppointmentListState extends State { widget.titleController.clear(); widget.descriptionIDController.clear(); }, - windowBody: [ - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.titleController, - hintText: "Title", - editable: false, - required: false, - ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.titleController, - hintText: "Patient ID Number", - editable: false, - required: false, - ), - ), - const SizedBox(height: 10), - SizedBox( + windowBody: Column( + children: [ + SizedBox( // width: 500, child: MIHTextField( - controller: widget.dateController, - hintText: "Date", - editable: false, - required: false, - )), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.timeController, - hintText: "Time", - editable: false, - required: false, - )), - const SizedBox(height: 10), - SizedBox( - // width: 500, - height: 250, - child: MIHMLTextField( - controller: widget.descriptionIDController, - hintText: "Description", - editable: false, - required: false, - ), - ), - const SizedBox(height: 20), - Visibility( - visible: canEditAppointment(index), - child: SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - appointmentUpdateWindow(index); - }, - buttonText: "Edit", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: widget.titleController, + hintText: "Title", + editable: false, + required: false, ), ), - ), - // SizedBox( - // width: 500, - // height: 50, - // child: MIHButton( - // onTap: () { - // addAppointmentCall(); - // checkforchange(); - // }, - // buttonText: "Add", - // buttonColor: - // MzanziInnovationHub.of(context)!.theme.successColor(), - // textColor: - // MzanziInnovationHub.of(context)!.theme.primaryColor(), - // ), - // ), - ], + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.titleController, + hintText: "Patient ID Number", + editable: false, + required: false, + ), + ), + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.dateController, + hintText: "Date", + editable: false, + required: false, + )), + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.timeController, + hintText: "Time", + editable: false, + required: false, + )), + const SizedBox(height: 10), + SizedBox( + // width: 500, + height: 250, + child: MIHMLTextField( + controller: widget.descriptionIDController, + hintText: "Description", + editable: false, + required: false, + ), + ), + const SizedBox(height: 20), + // Visibility( + // visible: canEditAppointment(index), + // child: SizedBox( + // width: 500, + // height: 50, + // child: MIHButton( + // onTap: () { + // appointmentUpdateWindow(index); + // }, + // buttonText: "Edit", + // buttonColor: + // MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // textColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + // ), + // SizedBox( + // width: 500, + // height: 50, + // child: MIHButton( + // onTap: () { + // addAppointmentCall(); + // checkforchange(); + // }, + // buttonText: "Add", + // buttonColor: + // MzanziInnovationHub.of(context)!.theme.successColor(), + // textColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // ), + // ), + ], + ), ); }, ); @@ -369,10 +458,10 @@ class _BuildAppointmentListState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Update Appointment", - windowTools: [], + windowTools: null, onWindowTapClose: () { setState(() { widget.titleController.text = widget.appointmentList[index].title; @@ -387,95 +476,70 @@ class _BuildAppointmentListState extends State { }); Navigator.of(context).pop(); }, - windowBody: [ - SizedBox( - // width: 500, - child: MIHTextField( - controller: widget.titleController, - hintText: "Title", - editable: true, - required: true, - ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHDateField( - controller: widget.dateController, - lableText: "Date", - required: true, - ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTimeField( - controller: widget.timeController, - lableText: "Time", - required: true, - ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - height: 250, - child: MIHMLTextField( - controller: widget.descriptionIDController, - hintText: "Description", - editable: true, - required: true, - ), - ), - const SizedBox(height: 20), - Wrap( - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - updateAppointmentCall(index); - }, - buttonText: "Update", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), + windowBody: Column( + children: [ + SizedBox( + // width: 500, + child: MIHTextField( + controller: widget.titleController, + hintText: "Title", + editable: true, + required: true, ), - // SizedBox( - // width: 500, - // height: 50, - // child: MIHButton( - // onTap: () { - // setState(() { - // widget.titleController.text = - // widget.appointmentList[index].title; - // widget.descriptionIDController.text = - // widget.appointmentList[index].description; - // widget.dateController.text = widget - // .appointmentList[index].date_time - // .split('T')[0]; - // widget.timeController.text = widget - // .appointmentList[index].date_time - // .split('T')[1] - // .substring(0, 5); - // }); - // Navigator.of(context).pop(); - // }, - // buttonText: "Cancel", - // buttonColor: - // MzanziInnovationHub.of(context)!.theme.errorColor(), - // textColor: - // MzanziInnovationHub.of(context)!.theme.primaryColor(), - // ), - // ), - ], - ) - ], + ), + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHDateField( + controller: widget.dateController, + lableText: "Date", + required: true, + ), + ), + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTimeField( + controller: widget.timeController, + lableText: "Time", + required: true, + ), + ), + const SizedBox(height: 10), + SizedBox( + // width: 500, + height: 250, + child: MIHMLTextField( + controller: widget.descriptionIDController, + hintText: "Description", + editable: true, + required: true, + ), + ), + const SizedBox(height: 20), + Wrap( + alignment: WrapAlignment.center, + runSpacing: 10, + spacing: 10, + children: [ + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + updateAppointmentCall(index); + }, + buttonText: "Update", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + ], + ) + ], + ), ); }, ); diff --git a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart index 007dde95..418936e2 100644 --- a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart +++ b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart @@ -6,9 +6,9 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; import 'package:mzansi_innovation_hub/mih_objects/business.dart'; @@ -101,10 +101,10 @@ class _PatientAccessRequestState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Add Appointment", - windowTools: [], + windowTools: null, onWindowTapClose: () { Navigator.of(context).pop(); _appointmentDateController.clear(); @@ -112,61 +112,63 @@ class _PatientAccessRequestState extends State { _appointmentTitleController.clear(); _appointmentDescriptionIDController.clear(); }, - windowBody: [ - SizedBox( - // width: 500, - child: MIHTextField( - controller: _appointmentTitleController, - hintText: "Title", - editable: true, - required: true, + windowBody: Column( + children: [ + SizedBox( + // width: 500, + child: MIHTextField( + controller: _appointmentTitleController, + hintText: "Title", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHDateField( - controller: _appointmentDateController, - lableText: "Date", - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHDateField( + controller: _appointmentDateController, + lableText: "Date", + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTimeField( - controller: _appointmentTimeController, - lableText: "Time", - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTimeField( + controller: _appointmentTimeController, + lableText: "Time", + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - height: 250, - child: MIHMLTextField( - controller: _appointmentDescriptionIDController, - hintText: "Description", - editable: true, - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + height: 250, + child: MIHMLTextField( + controller: _appointmentDescriptionIDController, + hintText: "Description", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 20), - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - addAppointmentCall(); - }, - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + const SizedBox(height: 20), + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + addAppointmentCall(); + }, + buttonText: "Add", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - ], + ], + ), ); }, ); diff --git a/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart b/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart index 20dab3ff..5074653b 100644 --- a/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart +++ b/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart @@ -2,6 +2,9 @@ import 'dart:async'; import 'dart:convert'; // import 'dart:convert'; +import 'package:flutter_speed_dial/flutter_speed_dial.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_objects/patients.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -21,7 +24,6 @@ import '../../mih_components/mih_layout/mih_header.dart'; import '../../mih_components/mih_layout/mih_layout_builder.dart'; import '../../mih_components/mih_layout/mih_notification_drawer.dart'; import '../../mih_components/mih_layout/mih_tile.dart'; -import '../../mih_components/mih_layout/mih_window.dart'; import '../../mih_components/mih_pop_up_messages/mih_delete_message.dart'; import '../../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -844,41 +846,70 @@ class _MIHHomeLegacyState extends State { // return const MIHErrorMessage(errorType: "User Exists"); // return const MIHErrorMessage(errorType: "Password Match"); // return const MIHErrorMessage(errorType: "Invalid Credentials"); - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Test Window title that is too large for mobile devices", - windowBody: const [ - SizedBox( - height: 250, - ) - ], - windowTools: [ - IconButton( - onPressed: () { - //deleteFilePopUp(filePath, fileID); - }, - icon: Icon( - Icons.delete, - size: 35, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), + windowBody: const Column( + children: [ + SizedBox( + height: 250, + ) + ], + ), + windowTools: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + label: "Wallet?", + labelBackgroundColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + onTap: () {}, + ), + SpeedDialChild( + child: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + label: "Delete File", + labelBackgroundColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: MzanziInnovationHub.of(context)! + .theme + .successColor(), + onTap: () {}, + ), + ], ), - IconButton( - onPressed: () { - //deleteFilePopUp(filePath, fileID); - }, - icon: Icon( - Icons.wallet, - size: 35, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - ], + ), onWindowTapClose: () { Navigator.pop(context); }, diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart index 0557750d..8755e035 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart @@ -1,10 +1,12 @@ 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_inputs_and_buttons/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_delete_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -149,80 +151,99 @@ class _BuildEmployeeListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Employee Details", - windowTools: [ - IconButton( - onPressed: () { - showDeleteWarning(index); - }, - icon: Icon( - Icons.delete, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - size: 35, - ), + windowTools: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Employee", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + showDeleteWarning(index); + }, + ), + ], ), - ], + ), onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Update", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (isRequiredFieldsCaptured()) { - updateEmployeeAPICall(index); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, ), - ) - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Update", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (isRequiredFieldsCaptured()) { + updateEmployeeAPICall(index); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart index 3a8aa5c5..d363db8b 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart @@ -4,7 +4,7 @@ import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -124,70 +124,72 @@ class _BuildUserListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Add Employee", - windowBody: [ - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "Username Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Email", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (isRequiredFieldsCaptured()) { - createBusinessUserAPICall(index); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage( - errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "Username Name", + editable: false, + required: true, ), - ), - const SizedBox(height: 10.0), - ], - windowTools: [], + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Email", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Add", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (isRequiredFieldsCaptured()) { + createBusinessUserAPICall(index); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Input Error"); + }, + ); + } + }, + ), + ), + const SizedBox(height: 10.0), + ], + ), + windowTools: null, onWindowTapClose: () { Navigator.pop(context); })); diff --git a/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_employee_list.dart b/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_employee_list.dart index 8154b030..5e5382dc 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_employee_list.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_employee_list.dart @@ -1,13 +1,15 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:flutter_speed_dial/flutter_speed_dial.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:supertokens_flutter/http.dart' as http; import '../../../../main.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_button.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import '../../../../mih_components/mih_layout/mih_window.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_delete_message.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -150,80 +152,99 @@ class _BuildEmployeeListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Employee Details", - windowTools: [ - IconButton( - onPressed: () { - showDeleteWarning(index); - }, - icon: Icon( - Icons.delete, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - size: 35, - ), + windowTools: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Employee", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + showDeleteWarning(index); + }, + ), + ], ), - ], + ), onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Update", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (isRequiredFieldsCaptured()) { - updateEmployeeAPICall(index); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, ), - ) - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Update", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (isRequiredFieldsCaptured()) { + updateEmployeeAPICall(index); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); // showDialog( diff --git a/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_user_list.dart b/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_user_list.dart index a13c5d2f..79df1e59 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_user_list.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/manage_business/builder/build_user_list.dart @@ -1,13 +1,13 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:supertokens_flutter/http.dart' as http; import '../../../../main.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_button.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import '../../../../mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import '../../../../mih_components/mih_layout/mih_window.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import '../../../../mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -125,70 +125,72 @@ class _BuildUserListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Add Employee", - windowBody: [ - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "Username Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Email", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (isRequiredFieldsCaptured()) { - createBusinessUserAPICall(index); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage( - errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "Username Name", + editable: false, + required: true, ), - ), - const SizedBox(height: 10.0), - ], - windowTools: [], + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Email", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: true, + enableSearch: false, + ), + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Add", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (isRequiredFieldsCaptured()) { + createBusinessUserAPICall(index); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Input Error"); + }, + ); + } + }, + ), + ), + const SizedBox(height: 10.0), + ], + ), + windowTools: null, onWindowTapClose: () { Navigator.pop(context); })); 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 3b4a503e..b2db3dc9 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 @@ -4,7 +4,6 @@ import 'package:mzansi_innovation_hub/mih_apis/mih_mzansi_wallet_apis.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_number_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart'; @@ -50,85 +49,86 @@ class _BuildLoyaltyCardListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Edit Loyalty Card", - windowTools: const [ - SizedBox(width: 35), - ], + windowTools: null, onWindowTapClose: () { _cardNumberController.clear(); _nicknameController.clear(); Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: _nicknameController, - hintText: "Card Title", - editable: true, - required: false, - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MIHNumberField( - controller: _cardNumberController, - hintText: "Card Number", - editable: true, - required: true, - enableDecimal: false, + windowBody: Column( + children: [ + MIHTextField( + controller: _nicknameController, + hintText: "Card Title", + editable: true, + required: false, + ), + const SizedBox(height: 10), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: MIHNumberField( + controller: _cardNumberController, + hintText: "Card Number", + editable: true, + required: true, + enableDecimal: false, + ), ), - ), - const SizedBox(width: 10), - MIHButton( - onTap: () async { - openscanner(); + const SizedBox(width: 10), + MIHButton( + onTap: () async { + openscanner(); + }, + buttonText: "Scan", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ], + ), + const SizedBox(height: 15), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + onTap: () { + if (_cardNumberController.text == "") { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } else { + MIHMzansiWalletApis.updateLoyaltyCardAPICall( + widget.signedInUser, + widget.cardList[index].idloyalty_cards, + widget.cardList[index].favourite, + widget.cardList[index].priority_index, + _nicknameController.text, + _cardNumberController.text, + 0, + ctxt, + ); + } }, - buttonText: "Scan", + buttonText: "Update", buttonColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ], - ), - const SizedBox(height: 15), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - onTap: () { - if (_cardNumberController.text == "") { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } else { - MIHMzansiWalletApis.updateLoyaltyCardAPICall( - widget.signedInUser, - widget.cardList[index].idloyalty_cards, - widget.cardList[index].favourite, - widget.cardList[index].priority_index, - _nicknameController.text, - _cardNumberController.text, - 0, - ctxt, - ); - } - }, - buttonText: "Update", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ), - ], + ], + ), ), ); } @@ -279,98 +279,88 @@ class _BuildLoyaltyCardListState extends State { builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: widget.cardList[index].shop_name.toUpperCase(), - windowTools: Row( - children: [ - Padding( - padding: const EdgeInsets.only(top: 5.0), - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - direction: SpeedDialDirection.down, - children: [ - SpeedDialChild( - child: widget.cardList[index].favourite == "" - ? Icon( - Icons.favorite, - color: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - ) - : Icon( - Icons.favorite_border, - color: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - ), - label: widget.cardList[index].favourite == "" - ? "Add to Favourite" - : "Remove from Favourite", - labelBackgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - labelStyle: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - ), - backgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - onTap: () { - if (widget.cardList[index].favourite == "") { - addToFavCardWindow(context, index); - } else { - removeFromFavCardWindow(context, index); - } - }, - ), - SpeedDialChild( - child: Icon( - Icons.edit, - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - label: "Edit Card Details", - labelBackgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - labelStyle: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - ), - backgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - onTap: () { - setState(() { - _cardNumberController.text = - widget.cardList[index].card_number; - _nicknameController.text = - widget.cardList[index].nickname; - }); - editCardWindow(context, index); - }, - ), - SpeedDialChild( - child: Icon( - Icons.delete, - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - label: "Delete Card", - labelBackgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - labelStyle: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontWeight: FontWeight.bold, - ), - backgroundColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - onTap: () { - deleteCardWindow(context, index); - }, - ), - ], + windowTools: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: widget.cardList[index].favourite == "" + ? Icon( + Icons.favorite, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ) + : Icon( + Icons.favorite_border, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + label: widget.cardList[index].favourite == "" + ? "Add to Favourite" + : "Remove from Favourite", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + if (widget.cardList[index].favourite == "") { + addToFavCardWindow(context, index); + } else { + removeFromFavCardWindow(context, index); + } + }, ), - ), - ], + SpeedDialChild( + child: Icon( + Icons.edit, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Edit Card Details", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + setState(() { + _cardNumberController.text = + widget.cardList[index].card_number; + _nicknameController.text = widget.cardList[index].nickname; + }); + editCardWindow(context, index); + }, + ), + SpeedDialChild( + child: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Card", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deleteCardWindow(context, index); + }, + ), + ], + ), ), onWindowTapClose: () { Navigator.pop(context); 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 49e9da12..75ebb991 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 @@ -7,9 +7,9 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_search_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; @@ -81,21 +81,10 @@ class _MihCardsState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Add New Loyalty Card", - windowTools: const [ - SizedBox(width: 35), - // IconButton( - // onPressed: () { - // //Delete card API Call - // }, - // icon: Icon( - // Icons.delete, - // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // ), - // ), - ], + windowTools: null, onWindowTapClose: () { shopController.clear(); cardNumberController.clear(); @@ -103,145 +92,148 @@ class _MihCardsState extends State { shopName.value = ""; Navigator.pop(context); }, - windowBody: [ - MIHDropdownField( - controller: shopController, - hintText: "Shop Name", - dropdownOptions: const [ - "+More", - "Apple Tree", - "Auchan", - "Best Before", - "Big Save", - "Boxer", - "BP", - "Builders Warehouse", - "Checkers", - "Choppies", - "Clicks", - "Continente", - "Cotton:On", - "Carrefour", - "Dis-Chem", - "Edgars", - "Eskom", - "Exclusive Books", - "Fresh Stop", - "Fresmart", - "Infinity", - "Jet", - "Justrite", - "Kero", - "Leroy Merlin", - "Makro", - "Naivas", - "OK Foods", - "Panarottis", - "Pick n Pay", - "PnA", - "PQ Clothing", - "Rage", - "Sefalana", - "Sasol", - "Shell", - "Shoprite", - "Signature Cosmetics & Fragrances", - "Spar", - "Spur", - "TFG Group", - "Toys R Us", - "Woermann Brock", - "Woolworths" - ], - required: true, - editable: true, - enableSearch: false, - ), - ValueListenableBuilder( - valueListenable: shopName, - builder: (BuildContext context, String value, Widget? child) { - return Visibility( - visible: value != "", - child: Column( - children: [ - const SizedBox(height: 10), - MihCardDisplay( - shopName: shopName.value, nickname: "", height: 200), - ], + windowBody: Column( + children: [ + MIHDropdownField( + controller: shopController, + hintText: "Shop Name", + dropdownOptions: const [ + "+More", + "Apple Tree", + "Auchan", + "Best Before", + "Big Save", + "Boxer", + "BP", + "Builders Warehouse", + "Checkers", + "Choppies", + "Clicks", + "Continente", + "Cotton:On", + "Carrefour", + "Dis-Chem", + "Edgars", + "Eskom", + "Exclusive Books", + "Fresh Stop", + "Fresmart", + "Infinity", + "Jet", + "Justrite", + "Kero", + "Leroy Merlin", + "Makro", + "Naivas", + "OK Foods", + "Panarottis", + "Pick n Pay", + "PnA", + "PQ Clothing", + "Rage", + "Sefalana", + "Sasol", + "Shell", + "Shoprite", + "Signature Cosmetics & Fragrances", + "Spar", + "Spur", + "TFG Group", + "Toys R Us", + "Woermann Brock", + "Woolworths" + ], + required: true, + editable: true, + enableSearch: false, + ), + ValueListenableBuilder( + valueListenable: shopName, + builder: (BuildContext context, String value, Widget? child) { + return Visibility( + visible: value != "", + child: Column( + children: [ + const SizedBox(height: 10), + MihCardDisplay( + shopName: shopName.value, nickname: "", height: 200), + ], + ), + ); + }, + ), + const SizedBox(height: 10), + MIHTextField( + controller: _nicknameController, + hintText: "Card Title", + editable: true, + required: false, + ), + const SizedBox(height: 10), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: MIHNumberField( + controller: cardNumberController, + hintText: "Card Number", + editable: true, + required: true, + enableDecimal: false, + ), ), - ); - }, - ), - const SizedBox(height: 10), - MIHTextField( - controller: _nicknameController, - hintText: "Card Title", - editable: true, - required: false, - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MIHNumberField( - controller: cardNumberController, - hintText: "Card Number", - editable: true, - required: true, - enableDecimal: false, + const SizedBox(width: 10), + MIHButton( + onTap: () async { + openscanner(); + }, + buttonText: "Scan", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ), - const SizedBox(width: 10), - MIHButton( - onTap: () async { - openscanner(); + ], + ), + const SizedBox(height: 15), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + onTap: () { + if (shopController.text == "" || + cardNumberController.text == "") { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } else { + MIHMzansiWalletApis.addLoyaltyCardAPICall( + widget.signedInUser, + widget.signedInUser.app_id, + shopController.text, + cardNumberController.text, + "", + 0, + _nicknameController.text, + 0, + context, + ); + } }, - buttonText: "Scan", + buttonText: "Add", buttonColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ], - ), - const SizedBox(height: 15), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - onTap: () { - if (shopController.text == "" || - cardNumberController.text == "") { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } else { - MIHMzansiWalletApis.addLoyaltyCardAPICall( - widget.signedInUser, - widget.signedInUser.app_id, - shopController.text, - cardNumberController.text, - "", - 0, - _nicknameController.text, - 0, - context, - ); - } - }, - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ), - ], + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_mih_patient_search_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_mih_patient_search_list.dart index 28cf9946..a0bc7fd1 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_mih_patient_search_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_mih_patient_search_list.dart @@ -6,7 +6,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_date_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_warning_message.dart'; @@ -167,75 +167,78 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Patient Appointment", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: idController, - hintText: "ID No.", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDateField( - controller: dateController, - lableText: "Date", - required: true, - ), - const SizedBox(height: 10.0), - MIHTimeField( - controller: timeController, - lableText: "Time", - required: true, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Book", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - //print("here1"); - bool filled = isAppointmentFieldsFilled(); - //print("fields filled: $filled"); - if (filled) { - //print("here2"); - submitApointment(index); - //print("here3"); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + MIHTextField( + controller: idController, + hintText: "ID No.", + editable: false, + required: true, ), - ) - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDateField( + controller: dateController, + lableText: "Date", + required: true, + ), + const SizedBox(height: 10.0), + MIHTimeField( + controller: timeController, + lableText: "Time", + required: true, + ), + const SizedBox(height: 30.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Book", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + //print("here1"); + bool filled = isAppointmentFieldsFilled(); + //print("fields filled: $filled"); + if (filled) { + //print("here2"); + submitApointment(index); + //print("here3"); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); } @@ -321,226 +324,231 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Patient Profile", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: idController, - hintText: "ID No.", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: accessStatusController, - hintText: "Access Status", - editable: false, - required: true, - ), - const SizedBox(height: 20.0), - Visibility( - visible: !hasAccess, - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Important Notice: Requesting Patient Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - Text( - "You are about to request access to a patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - SizedBox( - width: 600, - child: Text( - "1. Permanent Access: Once the patient accepts your access request, it will become permanent.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ), - SizedBox( - width: 600, - child: Text( - "2. Shared Information: Any updates you make to the patient's profile will be visible to others who have access to the profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ), - SizedBox( - width: 600, - child: Text( - "3. Irreversible Access: Once granted, you cannot revoke your access to the patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: - MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ), - Text( - "By pressing the \"Request Access\" button you accept the above terms.\n", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - ), - ), - ], + windowBody: Column( + children: [ + MIHTextField( + controller: idController, + hintText: "ID No.", + editable: false, + required: true, ), - ), - // const SizedBox(height: 15.0), - Wrap(runSpacing: 10, spacing: 10, children: [ - // Visibility( - // visible: hasAccess, - // child: SizedBox( - // width: 300, - // height: 50, - // child: MIHButton( - // buttonText: "Book Appointment", - // buttonColor: - // MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // textColor: - // MzanziInnovationHub.of(context)!.theme.primaryColor(), - // onTap: () { - // if (hasAccess) { - // appointmentPopUp(index); - // } else { - // noAccessWarning(); - // } - // }, - // ), - // ), - // ), - Visibility( - visible: hasAccess, - child: SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "View Patient Profile", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (hasAccess) { - Navigator.of(context) - .pushNamed('/patient-manager/patient', - arguments: PatientViewArguments( - widget.signedInUser, - widget.patients[index], - widget.businessUser, - widget.business, - "business", - )); - } else { - noAccessWarning(); - } - }, - ), - ), + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: accessStatusController, + hintText: "Access Status", + editable: false, + required: true, + ), + const SizedBox(height: 20.0), Visibility( - visible: !hasAccess && accessStatus == "No Access", - child: SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Request Access", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - //print("Send access Request..."); - MIHApiCalls.addPatientAccessAPICall( - widget.business!.business_id, - widget.patients[index].app_id, - "patient", - widget.business!.Name, - widget.personalSelected, - BusinessArguments( - widget.signedInUser, - widget.businessUser, - widget.business, + visible: !hasAccess, + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "Important Notice: Requesting Patient Profile Access", + style: TextStyle( + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), + ), + Text( + "You are about to request access to a patient's profile. Please be aware of the following important points:", + style: TextStyle( + fontWeight: FontWeight.normal, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), + ), + SizedBox( + width: 600, + child: Text( + "1. Permanent Access: Once the patient accepts your access request, it will become permanent.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), ), - context, - ); - }, - ), - ), - ), - Visibility( - visible: !hasAccess && accessStatus == "declined", - child: SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Re-apply", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - // print("Send rewaply access Request..."); - MIHApiCalls.reapplyPatientAccessAPICall( - widget.business!.business_id, - widget.patients[index].app_id, - widget.personalSelected, - BusinessArguments( - widget.signedInUser, - widget.businessUser, - widget.business, + ), + ), + SizedBox( + width: 600, + child: Text( + "2. Shared Information: Any updates you make to the patient's profile will be visible to others who have access to the profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), ), - context, - ); - }, + ), + ), + SizedBox( + width: 600, + child: Text( + "3. Irreversible Access: Once granted, you cannot revoke your access to the patient's profile.", + style: TextStyle( + fontWeight: FontWeight.normal, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), + ), + ), + Text( + "By pressing the \"Request Access\" button you accept the above terms.\n", + style: TextStyle( + fontWeight: FontWeight.bold, + color: + MzanziInnovationHub.of(context)!.theme.errorColor(), + ), + ), + ], + ), + ), + // const SizedBox(height: 15.0), + Wrap(runSpacing: 10, spacing: 10, children: [ + // Visibility( + // visible: hasAccess, + // child: SizedBox( + // width: 300, + // height: 50, + // child: MIHButton( + // buttonText: "Book Appointment", + // buttonColor: + // MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // textColor: + // MzanziInnovationHub.of(context)!.theme.primaryColor(), + // onTap: () { + // if (hasAccess) { + // appointmentPopUp(index); + // } else { + // noAccessWarning(); + // } + // }, + // ), + // ), + // ), + Visibility( + visible: hasAccess, + child: SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "View Patient Profile", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (hasAccess) { + Navigator.of(context) + .pushNamed('/patient-manager/patient', + arguments: PatientViewArguments( + widget.signedInUser, + widget.patients[index], + widget.businessUser, + widget.business, + "business", + )); + } else { + noAccessWarning(); + } + }, + ), ), ), - ), - Visibility( - visible: !hasAccess && accessStatus == "pending", - child: const SizedBox( - width: 500, - //height: 50, - child: Text( - "Patient has not approved access to their profile. Once access has been approved you can book and appointment or view their profile."), + Visibility( + visible: !hasAccess && accessStatus == "No Access", + child: SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Request Access", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + //print("Send access Request..."); + MIHApiCalls.addPatientAccessAPICall( + widget.business!.business_id, + widget.patients[index].app_id, + "patient", + widget.business!.Name, + widget.personalSelected, + BusinessArguments( + widget.signedInUser, + widget.businessUser, + widget.business, + ), + context, + ); + }, + ), + ), ), - ), - ]) - ], + Visibility( + visible: !hasAccess && accessStatus == "declined", + child: SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Re-apply", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + // print("Send rewaply access Request..."); + MIHApiCalls.reapplyPatientAccessAPICall( + widget.business!.business_id, + widget.patients[index].app_id, + widget.personalSelected, + BusinessArguments( + widget.signedInUser, + widget.businessUser, + widget.business, + ), + context, + ); + }, + ), + ), + ), + Visibility( + visible: !hasAccess && accessStatus == "pending", + child: const SizedBox( + width: 500, + //height: 50, + child: Text( + "Patient has not approved access to their profile. Once access has been approved you can book and appointment or view their profile."), + ), + ), + ]) + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_my_patient_list_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_my_patient_list_list.dart index 023a2632..939cf62a 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_my_patient_list_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/list_builders/build_my_patient_list_list.dart @@ -5,7 +5,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_date_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_warning_message.dart'; import 'package:mzansi_innovation_hub/mih_env/env.dart'; @@ -100,75 +100,78 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Patient Appointment", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: idController, - hintText: "ID No.", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHDateField( - controller: dateController, - lableText: "Date", - required: true, - ), - const SizedBox(height: 10.0), - MIHTimeField( - controller: timeController, - lableText: "Time", - required: true, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Book", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - //print("here1"); - bool filled = isAppointmentFieldsFilled(); - //print("fields filled: $filled"); - if (filled) { - //print("here2"); - submitApointment(index); - //print("here3"); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + MIHTextField( + controller: idController, + hintText: "ID No.", + editable: false, + required: true, ), - ) - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHDateField( + controller: dateController, + lableText: "Date", + required: true, + ), + const SizedBox(height: 10.0), + MIHTimeField( + controller: timeController, + lableText: "Time", + required: true, + ), + const SizedBox(height: 30.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Book", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + //print("here1"); + bool filled = isAppointmentFieldsFilled(); + //print("fields filled: $filled"); + if (filled) { + //print("here2"); + submitApointment(index); + //print("here3"); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); } @@ -214,74 +217,76 @@ class _BuildPatientsListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Patient Profile", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: idController, - hintText: "ID No.", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 30.0), - Wrap(runSpacing: 10, spacing: 10, children: [ - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Book Appointment", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - appointmentPopUp(index); - }, - ), + windowBody: Column( + children: [ + MIHTextField( + controller: idController, + hintText: "ID No.", + editable: false, + required: true, ), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "View Patient Profile", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - // Navigator.of(context).pop(); - Navigator.of(context).pushNamed('/patient-manager/patient', - arguments: PatientViewArguments( - widget.signedInUser, - patientProfile, - widget.businessUser, - widget.business, - "business", - )); - }, - ), + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, ), - ]) - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 30.0), + Wrap(runSpacing: 10, spacing: 10, children: [ + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Book Appointment", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + appointmentPopUp(index); + }, + ), + ), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "View Patient Profile", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + // Navigator.of(context).pop(); + Navigator.of(context).pushNamed('/patient-manager/patient', + arguments: PatientViewArguments( + widget.signedInUser, + patientProfile, + widget.businessUser, + widget.business, + "business", + )); + }, + ), + ), + ]) + ], + ), ), ); } 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 bdbda248..90e51130 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 @@ -8,9 +8,9 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_env/env.dart'; @@ -222,71 +222,74 @@ class _WaitingRoomState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Appointment Type", - windowTools: [], + windowTools: null, onWindowTapClose: () { Navigator.of(context).pop(); }, - windowBody: [ - Text( - question, - style: TextStyle( - fontSize: 20, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor()), - textAlign: TextAlign.left, - ), - const SizedBox(height: 15), - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - widget.onIndexChange(1); - Navigator.of(context).pop(); - }, - buttonText: "Existing Patient", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + windowBody: Column( + children: [ + Text( + question, + style: TextStyle( + fontSize: 20, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor()), + textAlign: TextAlign.left, ), - ), - const SizedBox(height: 10), - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - widget.onIndexChange(2); - Navigator.of(context).pop(); - }, - buttonText: "Existing MIH User", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + const SizedBox(height: 15), + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + widget.onIndexChange(1); + Navigator.of(context).pop(); + }, + buttonText: "Existing Patient", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - const SizedBox(height: 10), - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - Navigator.pop(context); - addAppointmentWindow(); - }, - buttonText: "Skeleton Appointment", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + const SizedBox(height: 10), + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + widget.onIndexChange(2); + Navigator.of(context).pop(); + }, + buttonText: "Existing MIH User", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - ], + const SizedBox(height: 10), + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + Navigator.pop(context); + addAppointmentWindow(); + }, + buttonText: "Skeleton Appointment", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + ], + ), ); }, ); @@ -297,10 +300,10 @@ class _WaitingRoomState extends State { context: context, barrierDismissible: false, builder: (context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Add Appointment", - windowTools: [], + windowTools: null, onWindowTapClose: () { Navigator.of(context).pop(); _appointmentDateController.clear(); @@ -309,61 +312,63 @@ class _WaitingRoomState extends State { _appointmentDescriptionIDController.clear(); _patientController.clear(); }, - windowBody: [ - SizedBox( - // width: 500, - child: MIHTextField( - controller: _appointmentTitleController, - hintText: "Title", - editable: true, - required: true, + windowBody: Column( + children: [ + SizedBox( + // width: 500, + child: MIHTextField( + controller: _appointmentTitleController, + hintText: "Title", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHDateField( - controller: _appointmentDateController, - lableText: "Date", - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHDateField( + controller: _appointmentDateController, + lableText: "Date", + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - child: MIHTimeField( - controller: _appointmentTimeController, - lableText: "Time", - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + child: MIHTimeField( + controller: _appointmentTimeController, + lableText: "Time", + required: true, + ), ), - ), - const SizedBox(height: 10), - SizedBox( - // width: 500, - height: 250, - child: MIHMLTextField( - controller: _appointmentDescriptionIDController, - hintText: "Description", - editable: true, - required: true, + const SizedBox(height: 10), + SizedBox( + // width: 500, + height: 250, + child: MIHMLTextField( + controller: _appointmentDescriptionIDController, + hintText: "Description", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 20), - SizedBox( - width: 500, - height: 50, - child: MIHButton( - onTap: () { - addAppointmentCall(); - }, - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), + const SizedBox(height: 20), + SizedBox( + width: 500, + height: 50, + child: MIHButton( + onTap: () { + addAppointmentCall(); + }, + buttonText: "Add", + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), ), - ), - ], + ], + ), ); }, ); diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart index fc0a49b3..f54afe42 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart @@ -6,7 +6,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_search_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; @@ -389,10 +389,10 @@ class _ClaimStatementWindowState extends State { @override Widget build(BuildContext context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Generate Claim/ Statement Document", - windowTools: const [], + windowTools: null, onWindowTapClose: () { // medicineController.clear(); // quantityController.clear(); @@ -402,9 +402,7 @@ class _ClaimStatementWindowState extends State { // noRepeatsController.clear(); Navigator.pop(context); }, - windowBody: [ - getWindowBody(), - ], + windowBody: getWindowBody(), ); } } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/icd10_search_window.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/icd10_search_window.dart index c693a90b..3e9588c8 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/icd10_search_window.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/icd10_search_window.dart @@ -1,5 +1,5 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart'; import 'package:mzansi_innovation_hub/mih_objects/icd10_code.dart.dart'; import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_icd10_code_list.dart'; import 'package:flutter/material.dart'; @@ -37,10 +37,10 @@ class _ICD10SearchWindowState extends State { @override Widget build(BuildContext context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "ICD-10 Search", - windowTools: const [], + windowTools: null, onWindowTapClose: () { // medicineController.clear(); // quantityController.clear(); @@ -50,9 +50,7 @@ class _ICD10SearchWindowState extends State { // noRepeatsController.clear(); Navigator.pop(context); }, - windowBody: [ - getWindowBody(), - ], + windowBody: getWindowBody(), ); } } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/medicine_search.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/medicine_search.dart index adce4713..8eeea76f 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/medicine_search.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/medicine_search.dart @@ -1,6 +1,5 @@ import 'dart:convert'; - -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_env/env.dart'; @@ -66,47 +65,49 @@ class _MedicineSearchState extends State { @override Widget build(BuildContext context) { - return MIHWindow( + return MihPackageWindow( fullscreen: false, windowTitle: "Select Medicine", - windowTools: [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - FutureBuilder( - future: futueMeds, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const SizedBox( - height: 400, - child: Mihloadingcircle(), - ); - } else if (snapshot.hasData && snapshot.data!.isNotEmpty) { - final medsList = snapshot.data!; - return SizedBox( - height: 400, - child: BuildMedicinesList( - contoller: widget.searchVlaue, - medicines: medsList, - //searchString: searchString, - ), - ); - } else { - return const SizedBox( - height: 400, - child: Center( - child: Text( - "No Match Found\nPlease close and manually capture medicine", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, + windowBody: Column( + children: [ + FutureBuilder( + future: futueMeds, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const SizedBox( + height: 400, + child: Mihloadingcircle(), + ); + } else if (snapshot.hasData && snapshot.data!.isNotEmpty) { + final medsList = snapshot.data!; + return SizedBox( + height: 400, + child: BuildMedicinesList( + contoller: widget.searchVlaue, + medicines: medsList, + //searchString: searchString, ), - ), - ); - } - }, - ), - ], + ); + } else { + return const SizedBox( + height: 400, + child: Center( + child: Text( + "No Match Found\nPlease close and manually capture medicine", + style: TextStyle(fontSize: 25, color: Colors.grey), + textAlign: TextAlign.center, + ), + ), + ); + } + }, + ), + ], + ), ); } } 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 4ed07c83..6c33ec09 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 @@ -1,7 +1,9 @@ +import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart'; import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_delete_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -113,34 +115,68 @@ class _BuildClaimStatementFileListState showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: true, windowTitle: fileName, - windowBody: [ - BuildFileView( - link: url, - path: filePath, - //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', - ), - const SizedBox( - height: 10, - ) - ], - windowTools: [ - Visibility( - visible: hasAccessToDelete, - child: IconButton( - onPressed: () { - deleteFilePopUp(filePath, fileID); - }, - icon: Icon( - size: 35, - Icons.delete, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), + windowBody: Column( + children: [ + BuildFileView( + link: url, + path: filePath, + //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', + ), + const SizedBox( + height: 10, + ) + ], + ), + windowTools: Visibility( + visible: hasAccessToDelete, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Document", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deleteFilePopUp(filePath, fileID); + }, + ), + ], ), ), - ], + ), + // [ + // Visibility( + // visible: hasAccessToDelete, + // child: IconButton( + // onPressed: () { + // deleteFilePopUp(filePath, fileID); + // }, + // icon: Icon( + // size: 35, + // Icons.delete, + // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // ), + // ), + // ), + // ], onWindowTapClose: () { Navigator.pop(context); }, 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 260bc178..1311f41a 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 @@ -1,8 +1,10 @@ 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_apis/mih_file_api.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_delete_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -166,34 +168,53 @@ class _BuildFilesListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: true, windowTitle: fileName, - windowBody: [ - BuildFileView( - link: url, - path: filePath, - //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', - ), - const SizedBox( - height: 10, - ) - ], - windowTools: [ - Visibility( - visible: hasAccessToDelete, - child: IconButton( - onPressed: () { - deleteFilePopUp(filePath, fileID); - }, - icon: Icon( - size: 35, - Icons.delete, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), + windowBody: Column( + children: [ + BuildFileView( + link: url, + path: filePath, + //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', + ), + const SizedBox( + height: 10, + ) + ], + ), + windowTools: Visibility( + visible: hasAccessToDelete, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Document", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deleteFilePopUp(filePath, fileID); + }, + ), + ], ), ), - ], + ), onWindowTapClose: () { Navigator.pop(context); }, 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 f1e9a9b6..e7a2146e 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 @@ -1,9 +1,11 @@ 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_inputs_and_buttons/mih_multiline_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_delete_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -136,64 +138,84 @@ class _BuildNotesListState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: true, windowTitle: selectednote.note_name, - windowTools: [ - Visibility( - visible: hasAccessToDelete, - child: IconButton( - onPressed: () { - deletePatientPopUp(selectednote.idpatient_notes); - }, - icon: Icon( - Icons.delete, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), + windowTools: Visibility( + visible: hasAccessToDelete, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: MihFloatingMenu( + animatedIcon: AnimatedIcons.menu_close, + direction: SpeedDialDirection.down, + children: [ + SpeedDialChild( + child: Icon( + Icons.delete, + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + label: "Delete Document", + labelBackgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + labelStyle: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontWeight: FontWeight.bold, + ), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + onTap: () { + deletePatientPopUp(selectednote.idpatient_notes); + }, + ), + ], ), ), - ], + ), onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHTextField( - controller: businessNameController, - hintText: "Office", - editable: false, - required: false, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: userNameController, - hintText: "Created By", - editable: false, - required: false, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: dateController, - hintText: "Created Date", - editable: false, - required: false, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: noteTitleController, - hintText: "Note Title", - editable: false, - required: false, - ), - const SizedBox(height: 10.0), - Expanded( - child: MIHMLTextField( - controller: noteTextController, - hintText: "Note Details", + windowBody: Column( + children: [ + MIHTextField( + controller: businessNameController, + hintText: "Office", editable: false, required: false, ), - ), - ], + const SizedBox(height: 10.0), + MIHTextField( + controller: userNameController, + hintText: "Created By", + editable: false, + required: false, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: dateController, + hintText: "Created Date", + editable: false, + required: false, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: noteTitleController, + hintText: "Note Title", + editable: false, + required: false, + ), + const SizedBox(height: 10.0), + Expanded( + child: MIHMLTextField( + controller: noteTextController, + hintText: "Note Details", + editable: false, + required: false, + ), + ), + ], + ), ), ); // showDialog( diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_consultation.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_consultation.dart index a8ad62e4..a0752cc2 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_consultation.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_consultation.dart @@ -5,9 +5,9 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -84,106 +84,109 @@ class _PatientConsultationState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Add Note", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); titleController.clear(); noteTextController.clear(); }, - windowBody: [ - MIHTextField( - controller: officeController, - hintText: "Office", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: doctorController, - hintText: "Created By", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: dateController, - hintText: "Created Date", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: titleController, - hintText: "Note Title", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - SizedBox( - //width: 700, - height: 250, - child: MIHMLTextField( - controller: noteTextController, - hintText: "Note Details", + windowBody: Column( + children: [ + MIHTextField( + controller: officeController, + hintText: "Office", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: doctorController, + hintText: "Created By", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: dateController, + hintText: "Created Date", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: titleController, + hintText: "Note Title", editable: true, required: true, ), - ), - SizedBox( - height: 15, - child: ValueListenableBuilder( - builder: (BuildContext context, int value, Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getNoteDetailLimitColor(), - ), - ), - const SizedBox(width: 5), - Text( - "/512", - style: TextStyle( - color: getNoteDetailLimitColor(), - ), - ), - ], - ); - }, - valueListenable: _counter, + const SizedBox(height: 10.0), + SizedBox( + //width: 700, + height: 250, + child: MIHMLTextField( + controller: noteTextController, + hintText: "Note Details", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - onTap: () { - if (isFieldsFilled()) { - addPatientNoteAPICall(); - Navigator.pop(context); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, + SizedBox( + height: 15, + child: ValueListenableBuilder( + builder: (BuildContext context, int value, Widget? child) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + "$value", + style: TextStyle( + color: getNoteDetailLimitColor(), + ), + ), + const SizedBox(width: 5), + Text( + "/512", + style: TextStyle( + color: getNoteDetailLimitColor(), + ), + ), + ], ); - } - }, - buttonText: "Add Note", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), + }, + valueListenable: _counter, + ), ), - ) - ], + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + onTap: () { + if (isFieldsFilled()) { + addPatientNoteAPICall(); + Navigator.pop(context); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + buttonText: "Add Note", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ) + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_documents.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_documents.dart index 389b3810..5e79be80 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_documents.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/package_tools/patient_documents.dart @@ -7,9 +7,9 @@ import 'package:mzansi_innovation_hub/mih_components/med_cert_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_file_input.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_window.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_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_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; @@ -221,62 +221,65 @@ class _PatientDocumentsState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Upload File", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - MIHFileField( - controller: selectedFileController, - hintText: "Select File", - editable: false, - required: true, - onPressed: () async { - FilePickerResult? result = await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - withData: true, - ); - if (result == null) return; - final selectedFile = result.files.first; - print("Selected file: $selectedFile"); - setState(() { - selected = selectedFile; - }); - setState(() { - selectedFileController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 15), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Add File", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - if (isFileFieldsFilled()) { - submitDocUploadForm(); - // uploadSelectedFile(selected); - Navigator.pop(context); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } + windowBody: Column( + children: [ + MIHFileField( + controller: selectedFileController, + hintText: "Select File", + editable: false, + required: true, + onPressed: () async { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + withData: true, + ); + if (result == null) return; + final selectedFile = result.files.first; + print("Selected file: $selectedFile"); + setState(() { + selected = selectedFile; + }); + setState(() { + selectedFileController.text = selectedFile.name; + }); }, ), - ) - ], + const SizedBox(height: 15), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Add File", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + if (isFileFieldsFilled()) { + submitDocUploadForm(); + // uploadSelectedFile(selected); + Navigator.pop(context); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); } @@ -285,44 +288,47 @@ class _PatientDocumentsState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Create Medical Certificate", - windowTools: const [], + windowTools: null, onWindowTapClose: () { Navigator.pop(context); }, - windowBody: [ - Medcertinput( - startDateController: startDateController, - endDateTextController: endDateTextController, - retDateTextController: retDateTextController, - ), - const SizedBox(height: 15.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Generate", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () async { - if (isMedCertFieldsFilled()) { - await generateMedCert(); - //Navigator.pop(context); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage(errorType: "Input Error"); - }, - ); - } - }, + windowBody: Column( + children: [ + Medcertinput( + startDateController: startDateController, + endDateTextController: endDateTextController, + retDateTextController: retDateTextController, ), - ) - ], + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Generate", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () async { + if (isMedCertFieldsFilled()) { + await generateMedCert(); + //Navigator.pop(context); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ); } @@ -331,10 +337,10 @@ class _PatientDocumentsState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => MIHWindow( + builder: (context) => MihPackageWindow( fullscreen: false, windowTitle: "Create Prescription", - windowTools: const [], + windowTools: null, onWindowTapClose: () { medicineController.clear(); quantityController.clear(); @@ -344,22 +350,24 @@ class _PatientDocumentsState extends State { noRepeatsController.clear(); Navigator.pop(context); }, - windowBody: [ - PrescripInput( - medicineController: medicineController, - quantityController: quantityController, - dosageController: dosageController, - timesDailyController: timesDailyController, - noDaysController: noDaysController, - noRepeatsController: noRepeatsController, - outputController: outputController, - selectedPatient: widget.selectedPatient, - signedInUser: widget.signedInUser, - business: widget.business, - businessUser: widget.businessUser, - env: env, - ), - ], + windowBody: Column( + children: [ + PrescripInput( + medicineController: medicineController, + quantityController: quantityController, + dosageController: dosageController, + timesDailyController: timesDailyController, + noDaysController: noDaysController, + noRepeatsController: noRepeatsController, + outputController: outputController, + selectedPatient: widget.selectedPatient, + signedInUser: widget.signedInUser, + business: widget.business, + businessUser: widget.businessUser, + env: env, + ), + ], + ), ), ); } diff --git a/Frontend/lib/mih_packages/test/test.dart b/Frontend/lib/mih_packages/test/test.dart index 425a4470..af787b72 100644 --- a/Frontend/lib/mih_packages/test/test.dart +++ b/Frontend/lib/mih_packages/test/test.dart @@ -50,7 +50,7 @@ class _MIHTestState extends State { ], ), secondaryActionButton: null, - body: MIHBody( + body: const MIHBody( borderOn: false, bodyItems: [ // YoutubePlayer( @@ -64,18 +64,5 @@ class _MIHTestState extends State { pullDownToRefresh: false, onPullDown: () async {}, ); - // return MIHWindow( - // fullscreen: false, - // windowTitle: "Test", - // windowTools: const [], - // onWindowTapClose: () { - // Navigator.pop(context); - // }, - // windowBody: [ - // YoutubePlayer( - // controller: videoController, - // ), - // ], - // ); } }