forked from yaso_meth/mih-project
Merge pull request #191 from yaso-meth/NEW--Triiger-Mzansi-Ai-from-home
NEW--Triiger-Mzansi-Ai-from-home
This commit is contained in:
@@ -124,6 +124,10 @@ class _MihSearchBarState extends State<MihSearchBar> {
|
||||
child: TextField(
|
||||
controller: widget.controller, // Assign the controller
|
||||
focusNode: widget.searchFocusNode,
|
||||
onSubmitted: (value) {
|
||||
widget.onPrefixIconTap
|
||||
?.call(); // Call the prefix icon tap handler
|
||||
},
|
||||
style: TextStyle(
|
||||
color: widget.hintColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
@@ -207,3 +207,13 @@ class WalletArguments {
|
||||
this.index,
|
||||
);
|
||||
}
|
||||
|
||||
class MzansiAiArguments {
|
||||
final AppUser signedInUser;
|
||||
final String? startUpQuestion;
|
||||
|
||||
MzansiAiArguments(
|
||||
this.signedInUser,
|
||||
this.startUpQuestion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -229,7 +229,10 @@ class _MIHHomeLegacyState extends State<MIHHomeLegacy> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-ai',
|
||||
arguments: widget.signedInUser,
|
||||
arguments: MzansiAiArguments(
|
||||
widget.signedInUser,
|
||||
"",
|
||||
),
|
||||
);
|
||||
},
|
||||
tileName: "Mzansi AI",
|
||||
@@ -464,7 +467,10 @@ class _MIHHomeLegacyState extends State<MIHHomeLegacy> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-ai',
|
||||
arguments: widget.signedInUser,
|
||||
arguments: MzansiAiArguments(
|
||||
widget.signedInUser,
|
||||
"",
|
||||
),
|
||||
);
|
||||
},
|
||||
tileName: "Mzansi AI",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/services.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_components/mih_icons.dart';
|
||||
@@ -216,7 +217,16 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
print("Search Text: ${searchController.text}");
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-ai',
|
||||
arguments: MzansiAiArguments(
|
||||
widget.signedInUser,
|
||||
searchController.text.isEmpty
|
||||
? null
|
||||
: searchController.text,
|
||||
),
|
||||
);
|
||||
searchController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
@@ -231,20 +241,49 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
||||
.contains(searchController.text.toLowerCase()))
|
||||
.map((package) => package.values.first)
|
||||
.toList();
|
||||
return GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
padding: getPadding(width, height),
|
||||
// shrinkWrap: true,
|
||||
itemCount: filteredPackages.length,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: packageSize,
|
||||
crossAxisSpacing: 5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return filteredPackages[index];
|
||||
},
|
||||
);
|
||||
if (filteredPackages.isNotEmpty) {
|
||||
return GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
padding: getPadding(width, height),
|
||||
// shrinkWrap: true,
|
||||
itemCount: filteredPackages.length,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: packageSize,
|
||||
crossAxisSpacing: 5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return filteredPackages[index];
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
MihIcons.mzansiAi,
|
||||
size: 165,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Mzansi AI is here to help you!",
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/services.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_components/mih_icons.dart';
|
||||
@@ -259,7 +260,16 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
print("Search Text: ${searchController.text}");
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-ai',
|
||||
arguments: MzansiAiArguments(
|
||||
widget.signedInUser,
|
||||
searchController.text.isEmpty
|
||||
? null
|
||||
: searchController.text,
|
||||
),
|
||||
);
|
||||
searchController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
@@ -274,21 +284,50 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
||||
.contains(searchController.text.toLowerCase()))
|
||||
.map((package) => package.values.first)
|
||||
.toList();
|
||||
return GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
padding: getPadding(width, height),
|
||||
// shrinkWrap: true,
|
||||
itemCount: filteredPackages.length,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: packageSize,
|
||||
crossAxisSpacing: 5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return filteredPackages[index];
|
||||
// return personalPackages[index];
|
||||
},
|
||||
);
|
||||
if (filteredPackages.isNotEmpty) {
|
||||
return GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
padding: getPadding(width, height),
|
||||
// shrinkWrap: true,
|
||||
itemCount: filteredPackages.length,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: packageSize,
|
||||
crossAxisSpacing: 5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return filteredPackages[index];
|
||||
// return personalPackages[index];
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
MihIcons.mzansiAi,
|
||||
size: 165,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Mzansi AI is here to help you!",
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/package_tools/ai_chat.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MzansiAi extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
// final AppUser signedInUser;
|
||||
// final String? startUpQuestion;
|
||||
final MzansiAiArguments arguments;
|
||||
const MzansiAi({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.arguments,
|
||||
// required this.signedInUser,
|
||||
// this.startUpQuestion,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -46,7 +50,10 @@ class _MzansiAiState extends State<MzansiAi> {
|
||||
|
||||
List<Widget> getToolBody() {
|
||||
List<Widget> toolBodies = [
|
||||
AiChat(signedInUser: widget.signedInUser),
|
||||
AiChat(
|
||||
signedInUser: widget.arguments.signedInUser,
|
||||
startUpQuestion: widget.arguments.startUpQuestion,
|
||||
),
|
||||
];
|
||||
return toolBodies;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||
|
||||
class MzansiAiTile extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
@@ -25,7 +26,10 @@ class _MzansiAiTileState extends State<MzansiAiTile> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-ai',
|
||||
arguments: widget.signedInUser,
|
||||
arguments: MzansiAiArguments(
|
||||
widget.signedInUser,
|
||||
"",
|
||||
),
|
||||
);
|
||||
},
|
||||
appName: "Mzansi AI",
|
||||
|
||||
@@ -21,9 +21,11 @@ import 'package:uuid/uuid.dart';
|
||||
|
||||
class AiChat extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final String? startUpQuestion;
|
||||
const AiChat({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
this.startUpQuestion,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -593,6 +595,12 @@ class _AiChatState extends State<AiChat> {
|
||||
_loadMessages();
|
||||
initTTS();
|
||||
_ttsVoiceController.addListener(voiceSelected);
|
||||
if (widget.startUpQuestion != null && widget.startUpQuestion!.isNotEmpty) {
|
||||
final partialText = types.PartialText(text: widget.startUpQuestion!);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_handleSendPressed(partialText);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,7 +24,6 @@ class MihBusinessUserSearch extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
late Future<List<AppUser>> userSearchResults;
|
||||
final FocusNode _searchFocusNode = FocusNode();
|
||||
@@ -101,72 +100,60 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
||||
|
||||
Widget getBody(double width) {
|
||||
return MihSingleChildScroll(
|
||||
child: KeyboardListener(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) async {
|
||||
if (event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
submitUserForm();
|
||||
}
|
||||
},
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: searchController,
|
||||
hintText: "Search Users",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
submitUserForm();
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
searchController.clear();
|
||||
userSearch = "";
|
||||
});
|
||||
submitUserForm();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
),
|
||||
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 {
|
||||
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,
|
||||
),
|
||||
);
|
||||
}
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: searchController,
|
||||
hintText: "Search Users",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
submitUserForm();
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
searchController.clear();
|
||||
userSearch = "";
|
||||
});
|
||||
submitUserForm();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
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 {
|
||||
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,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,81 +42,64 @@ class _MihPatientSearchState extends State<MihPatientSearch> {
|
||||
|
||||
Widget getPatientSearch(double width) {
|
||||
return MihSingleChildScroll(
|
||||
child: KeyboardListener(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) async {
|
||||
if (event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
// submitPatientForm();
|
||||
submitPatientSearch();
|
||||
//To-Do: Implement the search function
|
||||
// print("To-Do: Implement the search function");
|
||||
}
|
||||
},
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: _mihPatientSearchController,
|
||||
hintText: "Search Patient ID/ Aid No.",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
submitPatientSearch();
|
||||
print("Search Text: ${_mihPatientSearchController.text}");
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
_mihPatientSearchController.clear();
|
||||
_mihPatientSearchString = "";
|
||||
});
|
||||
submitPatientSearch();
|
||||
//To-Do: Implement the search function
|
||||
// print("To-Do: Implement the search function");
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: _mihPatientSearchResults,
|
||||
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<Patient> patientsList;
|
||||
if (_mihPatientSearchString == "") {
|
||||
patientsList = [];
|
||||
} else {
|
||||
patientsList = filterSearchResults(
|
||||
snapshot.data!, _mihPatientSearchString);
|
||||
//print(patientsList);
|
||||
}
|
||||
return displayPatientList(
|
||||
patientsList, _mihPatientSearchString);
|
||||
} else {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Error pulling Patients Data\n$baseUrl/patients/search/$_mihPatientSearchString",
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.errorColor()),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: _mihPatientSearchController,
|
||||
hintText: "Search Patient ID/ Aid No.",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
submitPatientSearch();
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
_mihPatientSearchController.clear();
|
||||
_mihPatientSearchString = "";
|
||||
});
|
||||
submitPatientSearch();
|
||||
//To-Do: Implement the search function
|
||||
// print("To-Do: Implement the search function");
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: _mihPatientSearchResults,
|
||||
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<Patient> patientsList;
|
||||
if (_mihPatientSearchString == "") {
|
||||
patientsList = [];
|
||||
} else {
|
||||
patientsList = filterSearchResults(
|
||||
snapshot.data!, _mihPatientSearchString);
|
||||
//print(patientsList);
|
||||
}
|
||||
return displayPatientList(patientsList, _mihPatientSearchString);
|
||||
} else {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Error pulling Patients Data\n$baseUrl/patients/search/$_mihPatientSearchString",
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.errorColor()),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,82 +42,66 @@ class _MyPatientListState extends State<MyPatientList> {
|
||||
|
||||
Widget myPatientListTool(double width) {
|
||||
return MihSingleChildScroll(
|
||||
child: KeyboardListener(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) async {
|
||||
if (event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
setState(() {
|
||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
||||
widget.business!.business_id);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: _myPatientSearchController,
|
||||
hintText: "Search Patient ID",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
setState(() {
|
||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
||||
widget.business!.business_id);
|
||||
});
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
_myPatientSearchController.clear();
|
||||
_myPatientIdSearchString = "";
|
||||
});
|
||||
getMyPatientList();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: _myPatientList,
|
||||
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<PatientAccess> patientsAccessList;
|
||||
if (_myPatientIdSearchString == "") {
|
||||
patientsAccessList = snapshot.data!;
|
||||
} else {
|
||||
patientsAccessList = filterAccessResults(
|
||||
snapshot.data!, _myPatientIdSearchString);
|
||||
//print(patientsList);
|
||||
}
|
||||
return displayMyPatientList(patientsAccessList);
|
||||
} else {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}",
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.errorColor()),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||
child: MihSearchBar(
|
||||
controller: _myPatientSearchController,
|
||||
hintText: "Search Patient ID",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
setState(() {
|
||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
||||
widget.business!.business_id);
|
||||
});
|
||||
},
|
||||
onClearIconTap: () {
|
||||
setState(() {
|
||||
_myPatientSearchController.clear();
|
||||
_myPatientIdSearchString = "";
|
||||
});
|
||||
getMyPatientList();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: _myPatientList,
|
||||
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<PatientAccess> patientsAccessList;
|
||||
if (_myPatientIdSearchString == "") {
|
||||
patientsAccessList = snapshot.data!;
|
||||
} else {
|
||||
patientsAccessList = filterAccessResults(
|
||||
snapshot.data!, _myPatientIdSearchString);
|
||||
//print(patientsList);
|
||||
}
|
||||
return displayMyPatientList(patientsAccessList);
|
||||
} else {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}",
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.errorColor()),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
final ValueNotifier<String> medAid = ValueNotifier("");
|
||||
List<ICD10Code> icd10codeList = [];
|
||||
final FocusNode _searchFocusNode = FocusNode();
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
|
||||
void icd10SearchWindow(List<ICD10Code> codeList) {
|
||||
showDialog(
|
||||
@@ -189,35 +188,22 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
},
|
||||
),
|
||||
//const SizedBox(height: 10),
|
||||
KeyboardListener(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) async {
|
||||
if (event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
|
||||
.then((result) {
|
||||
icd10SearchWindow(result);
|
||||
});
|
||||
}
|
||||
MihSearchBar(
|
||||
controller: _icd10CodeController,
|
||||
hintText: "ICD-10 Code & Description",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
|
||||
.then((result) {
|
||||
icd10SearchWindow(result);
|
||||
});
|
||||
},
|
||||
child: MihSearchBar(
|
||||
controller: _icd10CodeController,
|
||||
hintText: "ICD-10 Code & Description",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
|
||||
.then((result) {
|
||||
icd10SearchWindow(result);
|
||||
});
|
||||
},
|
||||
onClearIconTap: () {
|
||||
_icd10CodeController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
onClearIconTap: () {
|
||||
_icd10CodeController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MIHTextField(
|
||||
|
||||
@@ -353,29 +353,19 @@ class _PrescripInputState extends State<PrescripInput> {
|
||||
children: [
|
||||
//const SizedBox(height: 25.0),
|
||||
|
||||
KeyboardListener(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (event) async {
|
||||
if (event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
getMedsPopUp(widget.medicineController);
|
||||
}
|
||||
MihSearchBar(
|
||||
controller: widget.medicineController,
|
||||
hintText: "Search Medicine",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
getMedsPopUp(widget.medicineController);
|
||||
},
|
||||
child: MihSearchBar(
|
||||
controller: widget.medicineController,
|
||||
hintText: "Search Medicine",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPrefixIconTap: () {
|
||||
getMedsPopUp(widget.medicineController);
|
||||
},
|
||||
onClearIconTap: () {
|
||||
widget.medicineController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
onClearIconTap: () {
|
||||
widget.medicineController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
|
||||
|
||||
@@ -331,11 +331,11 @@ class RouteGenerator {
|
||||
|
||||
//Mzansi AI
|
||||
case '/mzansi-ai':
|
||||
if (args is AppUser) {
|
||||
if (args is MzansiAiArguments) {
|
||||
return MaterialPageRoute(
|
||||
settings: settings,
|
||||
builder: (_) => MzansiAi(
|
||||
signedInUser: args,
|
||||
arguments: args,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user