diff --git a/Frontend/patient_manager/lib/components/profileOfficeUpdate.dart b/Frontend/patient_manager/lib/components/profileOfficeUpdate.dart deleted file mode 100644 index d7327c63..00000000 --- a/Frontend/patient_manager/lib/components/profileOfficeUpdate.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:patient_manager/objects/appUser.dart'; - -class ProfileOfficeUpdate extends StatefulWidget { - final AppUser signedInUser; - //final String userEmail; - const ProfileOfficeUpdate({ - super.key, - required this.signedInUser, - }); - - @override - State createState() => _ProfileOfficeUpdateState(); -} - -class _ProfileOfficeUpdateState extends State { - @override - Widget build(BuildContext context) { - return Center(child: Text("Office profile: ${widget.signedInUser.email}")); - } -} diff --git a/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart new file mode 100644 index 00000000..aaad45a6 --- /dev/null +++ b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:patient_manager/components/mihAppBar.dart'; +import 'package:patient_manager/components/myTextInput.dart'; +import 'package:patient_manager/components/mybutton.dart'; +import 'package:patient_manager/main.dart'; +import 'package:patient_manager/objects/appUser.dart'; + +class ProfileBusinessUpdate extends StatefulWidget { + final AppUser signedInUser; + //final String userEmail; + const ProfileBusinessUpdate({ + super.key, + required this.signedInUser, + }); + + @override + State createState() => _ProfileBusinessUpdateState(); +} + +class _ProfileBusinessUpdateState extends State { + final FocusNode _focusNode = FocusNode(); + final tempController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const MIHAppBar(barTitle: "Update Profile"), + body: Padding( + padding: const EdgeInsets.all(15.0), + child: Center( + child: KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + //submitForm(); + } + }, + child: Column( + children: [ + const Text( + "Personal profile:", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 15.0), + MyTextField( + controller: tempController, + hintText: "Username", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MyTextField( + controller: tempController, + hintText: "First Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MyTextField( + controller: tempController, + hintText: "Last Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + const Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text( + "Activate Business Account", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20, + ), + ), + SizedBox( + width: 25, + ), + ], + ), + const SizedBox(height: 10.0), + SizedBox( + width: 500.0, + height: 100.0, + child: MyButton( + buttonText: "Update", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + //submitForm(); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/Frontend/patient_manager/lib/pages/profileUpdate.dart b/Frontend/patient_manager/lib/pages/profileUpdate.dart deleted file mode 100644 index 30219d71..00000000 --- a/Frontend/patient_manager/lib/pages/profileUpdate.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; -import 'package:patient_manager/components/profileUserUpdate.dart'; -import 'package:patient_manager/objects/appUser.dart'; - -class ProfileUpdate extends StatefulWidget { - final AppUser signedInUser; - //final String userEmail; - const ProfileUpdate({ - super.key, - //required this.userEmail, - required this.signedInUser, - }); - - @override - State createState() => _ProfileUpdateState(); -} - -class _ProfileUpdateState extends State { - //int _selectedIndex = 0; - - @override - void initState() { - // _widgetOptions = [ - // //Center(child: Text("User profile")), - // ProfileUserUpdate( - // signedInUser: widget.signedInUser, - // ), - // ProfileOfficeUpdate( - // signedInUser: widget.signedInUser, - // ), - // ]; - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: const MIHAppBar(barTitle: "Update Profile"), - body: Padding( - padding: const EdgeInsets.all(15.0), - child: Center( - child: ProfileUserUpdate( - signedInUser: widget.signedInUser, - ), - ), - ), - // bottomNavigationBar: GNav( - // //hoverColor: Colors.lightBlueAccent, - // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // iconSize: 35.0, - // activeColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - // tabBackgroundColor: - // MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // //gap: 20, - // //padding: EdgeInsets.all(15), - // tabs: const [ - // GButton( - // icon: Icons.perm_identity, - // text: "User Profile", - // ), - // GButton( - // icon: Icons.business, - // text: "Office Profile", - // ), - // ], - // selectedIndex: _selectedIndex, - // onTabChange: (index) { - // setState(() { - // _selectedIndex = index; - // }); - // }, - // ), - ); - } -} diff --git a/Frontend/patient_manager/lib/components/profileUserUpdate.dart b/Frontend/patient_manager/lib/pages/profileUserUpdate.dart similarity index 59% rename from Frontend/patient_manager/lib/components/profileUserUpdate.dart rename to Frontend/patient_manager/lib/pages/profileUserUpdate.dart index 00582a41..2edb5594 100644 --- a/Frontend/patient_manager/lib/components/profileUserUpdate.dart +++ b/Frontend/patient_manager/lib/pages/profileUserUpdate.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:patient_manager/components/mihAppBar.dart'; import 'package:patient_manager/components/myErrorMessage.dart'; import 'package:patient_manager/components/mySuccessMessage.dart'; import 'package:patient_manager/components/myTextInput.dart'; @@ -155,85 +156,94 @@ class _ProfileUserUpdateState extends State { @override Widget build(BuildContext context) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - submitForm(); - } - }, - child: Column( - children: [ - const Text( - "Personal profile:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox(height: 15.0), - MyTextField( - controller: usernameController, - hintText: "Username", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MyTextField( - controller: fnameController, - hintText: "First Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MyTextField( - controller: lnameController, - hintText: "Last Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Text( - "Activate Business Account", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - const SizedBox( - width: 25, - ), - Switch( - value: businessUser, - onChanged: (bool value) { - setState(() { - businessUser = value; - }); - }, - ), - ], - ), - const SizedBox(height: 10.0), - SizedBox( - width: 500.0, - height: 100.0, - child: MyButton( - buttonText: "Update", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { + return Scaffold( + appBar: const MIHAppBar(barTitle: "Update Profile"), + body: Padding( + padding: const EdgeInsets.all(15.0), + child: Center( + child: KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { submitForm(); - }, + } + }, + child: Column( + children: [ + const Text( + "Personal profile:", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 15.0), + MyTextField( + controller: usernameController, + hintText: "Username", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MyTextField( + controller: fnameController, + hintText: "First Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MyTextField( + controller: lnameController, + hintText: "Last Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text( + "Activate Business Account", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20, + ), + ), + const SizedBox( + width: 25, + ), + Switch( + value: businessUser, + onChanged: (bool value) { + setState(() { + businessUser = value; + }); + }, + ), + ], + ), + const SizedBox(height: 10.0), + SizedBox( + width: 500.0, + height: 100.0, + child: MyButton( + buttonText: "Update", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onTap: () { + submitForm(); + }, + ), + ), + ], ), ), - ], + ), ), ); }