update Biz Profile to use MihSignlewScroll

This commit is contained in:
2025-03-17 10:45:26 +02:00
parent fa85ff5cbf
commit 4f6c7e0593
3 changed files with 332 additions and 331 deletions

View File

@@ -6,6 +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_dropdown_input.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_inputs_and_buttons/mih_file_input.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_inputs_and_buttons/mih_file_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_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_package/mih-app_tool_body.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
@@ -317,255 +318,246 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
} }
Widget getBody() { Widget getBody() {
return ScrollConfiguration( return MihSingleChildScroll(
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: KeyboardListener(
child: SingleChildScrollView( focusNode: _focusNode,
child: SafeArea( autofocus: true,
child: KeyboardListener( onKeyEvent: (event) async {
focusNode: _focusNode, if (event is KeyDownEvent &&
autofocus: true, event.logicalKey == LogicalKeyboardKey.enter) {
onKeyEvent: (event) async { //print(business_id);
if (event is KeyDownEvent && submitForm(business_id);
event.logicalKey == LogicalKeyboardKey.enter) { }
//print(business_id); },
submitForm(business_id); child: Column(
} children: [
}, Visibility(
child: Column( visible: isFullAccess(),
children: [ child: Column(
Visibility( children: [
visible: isFullAccess(), const Text(
child: Column( "Business Profile",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
Divider(
color:
MzanziInnovationHub.of(context)?.theme.secondaryColor(),
),
const SizedBox(height: 10.0),
MIHTextField(
controller: regController,
hintText: "Registration No.",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: nameController,
hintText: "Business Name",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHDropdownField(
controller: typeController,
hintText: "Business Type",
dropdownOptions: const ["Doctors Office", "Other"],
required: true,
editable: true,
enableSearch: false,
),
const SizedBox(height: 10.0),
ValueListenableBuilder(
valueListenable: busType,
builder:
(BuildContext context, String value, Widget? child) {
return Visibility(
visible: value == "Doctors Office",
child: MIHTextField(
controller: practiceNoController,
hintText: "Practice Number",
editable: true,
required: true,
),
);
},
),
const SizedBox(height: 10.0),
MIHTextField(
controller: vatNoController,
hintText: "VAT Number",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: contactController,
hintText: "Contact Number",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: emailController,
hintText: "Email",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHFileField(
controller: logonameController,
hintText: "Logo",
editable: false,
required: true,
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'pdf'],
);
if (result == null) return;
final selectedFile = result.files.first;
setState(() {
selectedLogo = selectedFile;
});
setState(() {
logonameController.text = selectedFile.name;
});
},
),
const SizedBox(height: 10.0),
Row(
children: [ children: [
const Text( Flexible(
"Business Profile", child: MIHTextField(
style: TextStyle( controller: locationController,
fontWeight: FontWeight.bold, hintText: "Location",
fontSize: 25, editable: false,
required: false,
), ),
), ),
Divider( const SizedBox(width: 10.0),
color: MzanziInnovationHub.of(context) SizedBox(
?.theme width: 80.0,
.secondaryColor(), height: 50.0,
), child: MIHButton(
const SizedBox(height: 10.0), buttonText: "Set",
MIHTextField( buttonColor: MzanziInnovationHub.of(context)!
controller: regController, .theme
hintText: "Registration No.", .secondaryColor(),
editable: true, textColor: MzanziInnovationHub.of(context)!
required: true, .theme
), .primaryColor(),
const SizedBox(height: 10.0), onTap: () {
MIHTextField( MIHLocationAPI()
controller: nameController, .getGPSPosition(context)
hintText: "Business Name", .then((position) {
editable: true, if (position != null) {
required: true, setState(() {
), locationController.text =
const SizedBox(height: 10.0), "${position.latitude}, ${position.longitude}";
MIHDropdownField(
controller: typeController,
hintText: "Business Type",
dropdownOptions: const ["Doctors Office", "Other"],
required: true,
editable: true,
enableSearch: false,
),
const SizedBox(height: 10.0),
ValueListenableBuilder(
valueListenable: busType,
builder: (BuildContext context, String value,
Widget? child) {
return Visibility(
visible: value == "Doctors Office",
child: MIHTextField(
controller: practiceNoController,
hintText: "Practice Number",
editable: true,
required: true,
),
);
},
),
const SizedBox(height: 10.0),
MIHTextField(
controller: vatNoController,
hintText: "VAT Number",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: contactController,
hintText: "Contact Number",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: emailController,
hintText: "Email",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHFileField(
controller: logonameController,
hintText: "Logo",
editable: false,
required: true,
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'pdf'],
);
if (result == null) return;
final selectedFile = result.files.first;
setState(() {
selectedLogo = selectedFile;
});
setState(() {
logonameController.text = selectedFile.name;
});
},
),
const SizedBox(height: 10.0),
Row(
children: [
Flexible(
child: MIHTextField(
controller: locationController,
hintText: "Location",
editable: false,
required: false,
),
),
const SizedBox(width: 10.0),
SizedBox(
width: 80.0,
height: 50.0,
child: MIHButton(
buttonText: "Set",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
MIHLocationAPI()
.getGPSPosition(context)
.then((position) {
if (position != null) {
setState(() {
locationController.text =
"${position.latitude}, ${position.longitude}";
});
}
}); });
}, }
), });
), },
], ),
), ),
const SizedBox(height: 15.0),
], ],
), ),
const SizedBox(height: 15.0),
],
),
),
Column(
children: [
//const SizedBox(height: 15.0),
const Text(
"My Business User",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
Column( Divider(
children: [ color:
//const SizedBox(height: 15.0), MzanziInnovationHub.of(context)?.theme.secondaryColor(),
const Text( ),
"My Business User", const SizedBox(height: 10.0),
style: TextStyle( MIHDropdownField(
fontWeight: FontWeight.bold, controller: titleController,
fontSize: 25, hintText: "Title",
), dropdownOptions: const ["Doctor", "Assistant"],
), required: true,
Divider( editable: true,
color: MzanziInnovationHub.of(context) enableSearch: false,
?.theme ),
.secondaryColor(), const SizedBox(height: 10.0),
), MIHTextField(
const SizedBox(height: 10.0), controller: fnameController,
MIHDropdownField( hintText: "Name",
controller: titleController, editable: false,
hintText: "Title", required: true,
dropdownOptions: const ["Doctor", "Assistant"], ),
required: true, const SizedBox(height: 10.0),
editable: true, MIHTextField(
enableSearch: false, controller: lnameController,
), hintText: "Surname",
const SizedBox(height: 10.0), editable: false,
MIHTextField( required: true,
controller: fnameController, ),
hintText: "Name", const SizedBox(height: 10.0),
editable: false, MIHFileField(
required: true, controller: signtureController,
), hintText: "Signature",
const SizedBox(height: 10.0), editable: false,
MIHTextField( required: true,
controller: lnameController, onPressed: () async {
hintText: "Surname", FilePickerResult? result =
editable: false, await FilePicker.platform.pickFiles(
required: true, type: FileType.custom,
), allowedExtensions: ['jpg', 'png', 'pdf'],
const SizedBox(height: 10.0), );
MIHFileField( if (result == null) return;
controller: signtureController, final selectedFile = result.files.first;
hintText: "Signature", setState(() {
editable: false, selectedSignature = selectedFile;
required: true, });
onPressed: () async { setState(() {
FilePickerResult? result = signtureController.text = selectedFile.name;
await FilePicker.platform.pickFiles( });
type: FileType.custom, },
allowedExtensions: ['jpg', 'png', 'pdf'], ),
); const SizedBox(height: 15.0),
if (result == null) return; MIHDropdownField(
final selectedFile = result.files.first; controller: accessController,
setState(() { hintText: "Access",
selectedSignature = selectedFile; dropdownOptions: const ["Full", "Partial"],
}); required: true,
setState(() { editable: false,
signtureController.text = selectedFile.name; enableSearch: false,
}); ),
}, const SizedBox(height: 30.0),
), SizedBox(
const SizedBox(height: 15.0), width: 500.0,
MIHDropdownField( height: 50.0,
controller: accessController, child: MIHButton(
hintText: "Access", buttonText: "Update",
dropdownOptions: const ["Full", "Partial"], buttonColor:
required: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
editable: false, textColor:
enableSearch: false, MzanziInnovationHub.of(context)!.theme.primaryColor(),
), onTap: () {
const SizedBox(height: 30.0), //print(business_id);
SizedBox( submitForm(business_id);
width: 500.0, },
height: 50.0, ),
child: MIHButton(
buttonText: "Update",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
//print(business_id);
submitForm(business_id);
},
),
),
],
), ),
], ],
), ),
), ],
), ),
), ),
); );

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:Mzansi_Innovation_Hub/main.dart'; import 'package:Mzansi_Innovation_Hub/main.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_search_input.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_single_child_scroll.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
@@ -97,65 +98,69 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
} }
Widget getBody() { Widget getBody() {
return KeyboardListener( return MihSingleChildScroll(
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
submitUserForm(); event.logicalKey == LogicalKeyboardKey.enter) {
}
},
child: Column(mainAxisSize: MainAxisSize.max, children: [
const Text(
"User Search",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
//spacer
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10),
MIHSearchField(
controller: searchController,
hintText: "Username or Email Search",
required: true,
editable: true,
onTap: () {
submitUserForm(); submitUserForm();
}, }
), },
//spacer child: Column(mainAxisSize: MainAxisSize.max, children: [
const SizedBox(height: 10), const Text(
FutureBuilder( "User Search",
future: userSearchResults, style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
builder: (context, snapshot) { ),
//print("patient Liust ${snapshot.data}"); //spacer
if (snapshot.connectionState == ConnectionState.waiting) { Divider(
return const Mihloadingcircle(); color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
} else if (snapshot.connectionState == ConnectionState.done && const SizedBox(height: 10),
snapshot.hasData) { MIHSearchField(
List<AppUser> patientsList; controller: searchController,
if (userSearch == "") { hintText: "Username or Email Search",
patientsList = []; required: true,
editable: true,
onTap: () {
submitUserForm();
},
),
//spacer
const SizedBox(height: 10),
FutureBuilder(
future: userSearchResults,
builder: (context, snapshot) {
//print("patient Liust ${snapshot.data}");
if (snapshot.connectionState == ConnectionState.waiting) {
return const Mihloadingcircle();
} else if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
List<AppUser> patientsList;
if (userSearch == "") {
patientsList = [];
} else {
patientsList = snapshot.data!;
//print(patientsList);
}
return displayUserList(patientsList);
} else { } else {
patientsList = snapshot.data!; return Center(
//print(patientsList); child: Text(
"$errorCode: Error pulling Patients Data\n/patients/search/$userSearch\n$errorBody",
style: TextStyle(
fontSize: 25,
color: MzanziInnovationHub.of(context)!
.theme
.errorColor()),
textAlign: TextAlign.center,
),
);
} }
return displayUserList(patientsList); },
} else { ),
return Center( ]),
child: Text( ),
"$errorCode: Error pulling Patients Data\n/patients/search/$userSearch\n$errorBody",
style: TextStyle(
fontSize: 25,
color:
MzanziInnovationHub.of(context)!.theme.errorColor()),
textAlign: TextAlign.center,
),
);
}
},
),
]),
); );
} }
} }

View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:Mzansi_Innovation_Hub/main.dart'; import 'package:Mzansi_Innovation_Hub/main.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_single_child_scroll.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
import 'package:Mzansi_Innovation_Hub/mih_env/env.dart'; import 'package:Mzansi_Innovation_Hub/mih_env/env.dart';
@@ -80,45 +81,48 @@ class _MihMyBusinessTeamState extends State<MihMyBusinessTeam> {
} }
Widget getBody() { Widget getBody() {
return Column(mainAxisSize: MainAxisSize.max, children: [ return MihSingleChildScroll(
const Text( child: Column(mainAxisSize: MainAxisSize.max, children: [
"Business Team", const Text(
style: TextStyle( "Business Team",
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), const SizedBox(height: 10),
const SizedBox(height: 10), FutureBuilder(
FutureBuilder( future: employeeList,
future: employeeList, builder: (context, snapshot) {
builder: (context, snapshot) { //print("patient Queue List ${snapshot.hasData}");
//print("patient Queue List ${snapshot.hasData}"); if (snapshot.connectionState == ConnectionState.waiting) {
if (snapshot.connectionState == ConnectionState.waiting) { return const Mihloadingcircle();
return const Mihloadingcircle(); } else if (snapshot.connectionState == ConnectionState.done) {
} else if (snapshot.connectionState == ConnectionState.done) { //List<BusinessEmployee> employeeListResults;
//List<BusinessEmployee> employeeListResults; // if (searchString == "") {
// if (searchString == "") { // patientQueueList = [];
// patientQueueList = []; // } else {
// } else {
// print(patientQueueList); // print(patientQueueList);
// } // }
return displayEmployeeList(snapshot.requireData); return displayEmployeeList(snapshot.requireData);
} else { } else {
return Center( return Center(
child: Text( child: Text(
"$errorCode: Error pulling Patients Data\n${AppEnviroment.baseApiUrl}/business-user/users/${widget.arguments.businessUser!.business_id}\n$errorBody", "$errorCode: Error pulling Patients Data\n${AppEnviroment.baseApiUrl}/business-user/users/${widget.arguments.businessUser!.business_id}\n$errorBody",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
color: MzanziInnovationHub.of(context)!.theme.errorColor()), color:
textAlign: TextAlign.center, MzanziInnovationHub.of(context)!.theme.errorColor()),
), textAlign: TextAlign.center,
); ),
} );
}, }
), },
]); ),
]),
);
} }
} }