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(
|
child: TextField(
|
||||||
controller: widget.controller, // Assign the controller
|
controller: widget.controller, // Assign the controller
|
||||||
focusNode: widget.searchFocusNode,
|
focusNode: widget.searchFocusNode,
|
||||||
|
onSubmitted: (value) {
|
||||||
|
widget.onPrefixIconTap
|
||||||
|
?.call(); // Call the prefix icon tap handler
|
||||||
|
},
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.hintColor,
|
color: widget.hintColor,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|||||||
@@ -207,3 +207,13 @@ class WalletArguments {
|
|||||||
this.index,
|
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: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
'/mzansi-ai',
|
'/mzansi-ai',
|
||||||
arguments: widget.signedInUser,
|
arguments: MzansiAiArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
"",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
tileName: "Mzansi AI",
|
tileName: "Mzansi AI",
|
||||||
@@ -464,7 +467,10 @@ class _MIHHomeLegacyState extends State<MIHHomeLegacy> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
'/mzansi-ai',
|
'/mzansi-ai',
|
||||||
arguments: widget.signedInUser,
|
arguments: MzansiAiArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
"",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
tileName: "Mzansi AI",
|
tileName: "Mzansi AI",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/services.dart';
|
||||||
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_layout/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.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(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onPrefixIconTap: () {
|
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,
|
searchFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
@@ -231,20 +241,49 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
.contains(searchController.text.toLowerCase()))
|
.contains(searchController.text.toLowerCase()))
|
||||||
.map((package) => package.values.first)
|
.map((package) => package.values.first)
|
||||||
.toList();
|
.toList();
|
||||||
return GridView.builder(
|
if (filteredPackages.isNotEmpty) {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
return GridView.builder(
|
||||||
shrinkWrap: true,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: getPadding(width, height),
|
shrinkWrap: true,
|
||||||
// shrinkWrap: true,
|
padding: getPadding(width, height),
|
||||||
itemCount: filteredPackages.length,
|
// shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
itemCount: filteredPackages.length,
|
||||||
maxCrossAxisExtent: packageSize,
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
crossAxisSpacing: 5,
|
maxCrossAxisExtent: packageSize,
|
||||||
),
|
crossAxisSpacing: 5,
|
||||||
itemBuilder: (context, index) {
|
),
|
||||||
return filteredPackages[index];
|
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/main.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_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.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(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onPrefixIconTap: () {
|
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,
|
searchFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
@@ -274,21 +284,50 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
.contains(searchController.text.toLowerCase()))
|
.contains(searchController.text.toLowerCase()))
|
||||||
.map((package) => package.values.first)
|
.map((package) => package.values.first)
|
||||||
.toList();
|
.toList();
|
||||||
return GridView.builder(
|
if (filteredPackages.isNotEmpty) {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
return GridView.builder(
|
||||||
shrinkWrap: true,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: getPadding(width, height),
|
shrinkWrap: true,
|
||||||
// shrinkWrap: true,
|
padding: getPadding(width, height),
|
||||||
itemCount: filteredPackages.length,
|
// shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
itemCount: filteredPackages.length,
|
||||||
maxCrossAxisExtent: packageSize,
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
crossAxisSpacing: 5,
|
maxCrossAxisExtent: packageSize,
|
||||||
),
|
crossAxisSpacing: 5,
|
||||||
itemBuilder: (context, index) {
|
),
|
||||||
return filteredPackages[index];
|
itemBuilder: (context, index) {
|
||||||
// return personalPackages[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.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_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.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:mzansi_innovation_hub/mih_packages/mzansi_ai/package_tools/ai_chat.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class MzansiAi extends StatefulWidget {
|
class MzansiAi extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
// final AppUser signedInUser;
|
||||||
|
// final String? startUpQuestion;
|
||||||
|
final MzansiAiArguments arguments;
|
||||||
const MzansiAi({
|
const MzansiAi({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.arguments,
|
||||||
|
// required this.signedInUser,
|
||||||
|
// this.startUpQuestion,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -46,7 +50,10 @@ class _MzansiAiState extends State<MzansiAi> {
|
|||||||
|
|
||||||
List<Widget> getToolBody() {
|
List<Widget> getToolBody() {
|
||||||
List<Widget> toolBodies = [
|
List<Widget> toolBodies = [
|
||||||
AiChat(signedInUser: widget.signedInUser),
|
AiChat(
|
||||||
|
signedInUser: widget.arguments.signedInUser,
|
||||||
|
startUpQuestion: widget.arguments.startUpQuestion,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
return toolBodies;
|
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_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
|
|
||||||
class MzansiAiTile extends StatefulWidget {
|
class MzansiAiTile extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
@@ -25,7 +26,10 @@ class _MzansiAiTileState extends State<MzansiAiTile> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
'/mzansi-ai',
|
'/mzansi-ai',
|
||||||
arguments: widget.signedInUser,
|
arguments: MzansiAiArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
"",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
appName: "Mzansi AI",
|
appName: "Mzansi AI",
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ import 'package:uuid/uuid.dart';
|
|||||||
|
|
||||||
class AiChat extends StatefulWidget {
|
class AiChat extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
|
final String? startUpQuestion;
|
||||||
const AiChat({
|
const AiChat({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.signedInUser,
|
||||||
|
this.startUpQuestion,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -593,6 +595,12 @@ class _AiChatState extends State<AiChat> {
|
|||||||
_loadMessages();
|
_loadMessages();
|
||||||
initTTS();
|
initTTS();
|
||||||
_ttsVoiceController.addListener(voiceSelected);
|
_ttsVoiceController.addListener(voiceSelected);
|
||||||
|
if (widget.startUpQuestion != null && widget.startUpQuestion!.isNotEmpty) {
|
||||||
|
final partialText = types.PartialText(text: widget.startUpQuestion!);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_handleSendPressed(partialText);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class MihBusinessUserSearch extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
||||||
final FocusNode _focusNode = FocusNode();
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
late Future<List<AppUser>> userSearchResults;
|
late Future<List<AppUser>> userSearchResults;
|
||||||
final FocusNode _searchFocusNode = FocusNode();
|
final FocusNode _searchFocusNode = FocusNode();
|
||||||
@@ -101,72 +100,60 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
|||||||
|
|
||||||
Widget getBody(double width) {
|
Widget getBody(double width) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
focusNode: _focusNode,
|
Padding(
|
||||||
autofocus: true,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onKeyEvent: (event) async {
|
child: MihSearchBar(
|
||||||
if (event is KeyDownEvent &&
|
controller: searchController,
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintText: "Search Users",
|
||||||
submitUserForm();
|
prefixIcon: Icons.search,
|
||||||
}
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
},
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
onPrefixIconTap: () {
|
||||||
Padding(
|
submitUserForm();
|
||||||
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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
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) {
|
Widget getPatientSearch(double width) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
focusNode: _focusNode,
|
Padding(
|
||||||
autofocus: true,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onKeyEvent: (event) async {
|
child: MihSearchBar(
|
||||||
if (event is KeyDownEvent &&
|
controller: _mihPatientSearchController,
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintText: "Search Patient ID/ Aid No.",
|
||||||
// submitPatientForm();
|
prefixIcon: Icons.search,
|
||||||
submitPatientSearch();
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
//To-Do: Implement the search function
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
// print("To-Do: Implement the search function");
|
onPrefixIconTap: () {
|
||||||
}
|
submitPatientSearch();
|
||||||
},
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
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) {
|
Widget myPatientListTool(double width) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
focusNode: _focusNode,
|
Padding(
|
||||||
autofocus: true,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onKeyEvent: (event) async {
|
child: MihSearchBar(
|
||||||
if (event is KeyDownEvent &&
|
controller: _myPatientSearchController,
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintText: "Search Patient ID",
|
||||||
setState(() {
|
prefixIcon: Icons.search,
|
||||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
widget.business!.business_id);
|
onPrefixIconTap: () {
|
||||||
});
|
setState(() {
|
||||||
}
|
_myPatientIdSearchString = _myPatientSearchController.text;
|
||||||
},
|
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
||||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
widget.business!.business_id);
|
||||||
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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
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("");
|
final ValueNotifier<String> medAid = ValueNotifier("");
|
||||||
List<ICD10Code> icd10codeList = [];
|
List<ICD10Code> icd10codeList = [];
|
||||||
final FocusNode _searchFocusNode = FocusNode();
|
final FocusNode _searchFocusNode = FocusNode();
|
||||||
final FocusNode _focusNode = FocusNode();
|
|
||||||
|
|
||||||
void icd10SearchWindow(List<ICD10Code> codeList) {
|
void icd10SearchWindow(List<ICD10Code> codeList) {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -189,35 +188,22 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
//const SizedBox(height: 10),
|
//const SizedBox(height: 10),
|
||||||
KeyboardListener(
|
MihSearchBar(
|
||||||
focusNode: _focusNode,
|
controller: _icd10CodeController,
|
||||||
autofocus: true,
|
hintText: "ICD-10 Code & Description",
|
||||||
onKeyEvent: (event) async {
|
prefixIcon: Icons.search,
|
||||||
if (event is KeyDownEvent &&
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
|
onPrefixIconTap: () {
|
||||||
.then((result) {
|
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
|
||||||
icd10SearchWindow(result);
|
.then((result) {
|
||||||
});
|
icd10SearchWindow(result);
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
child: MihSearchBar(
|
onClearIconTap: () {
|
||||||
controller: _icd10CodeController,
|
_icd10CodeController.clear();
|
||||||
hintText: "ICD-10 Code & Description",
|
},
|
||||||
prefixIcon: Icons.search,
|
searchFocusNode: _searchFocusNode,
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MIHTextField(
|
MIHTextField(
|
||||||
|
|||||||
@@ -353,29 +353,19 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
children: [
|
children: [
|
||||||
//const SizedBox(height: 25.0),
|
//const SizedBox(height: 25.0),
|
||||||
|
|
||||||
KeyboardListener(
|
MihSearchBar(
|
||||||
focusNode: _focusNode,
|
controller: widget.medicineController,
|
||||||
autofocus: true,
|
hintText: "Search Medicine",
|
||||||
onKeyEvent: (event) async {
|
prefixIcon: Icons.search,
|
||||||
if (event is KeyDownEvent &&
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
getMedsPopUp(widget.medicineController);
|
onPrefixIconTap: () {
|
||||||
}
|
getMedsPopUp(widget.medicineController);
|
||||||
},
|
},
|
||||||
child: MihSearchBar(
|
onClearIconTap: () {
|
||||||
controller: widget.medicineController,
|
widget.medicineController.clear();
|
||||||
hintText: "Search Medicine",
|
},
|
||||||
prefixIcon: Icons.search,
|
searchFocusNode: _searchFocusNode,
|
||||||
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
getMedsPopUp(widget.medicineController);
|
|
||||||
},
|
|
||||||
onClearIconTap: () {
|
|
||||||
widget.medicineController.clear();
|
|
||||||
},
|
|
||||||
searchFocusNode: _searchFocusNode,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
|
||||||
|
|||||||
@@ -331,11 +331,11 @@ class RouteGenerator {
|
|||||||
|
|
||||||
//Mzansi AI
|
//Mzansi AI
|
||||||
case '/mzansi-ai':
|
case '/mzansi-ai':
|
||||||
if (args is AppUser) {
|
if (args is MzansiAiArguments) {
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
settings: settings,
|
settings: settings,
|
||||||
builder: (_) => MzansiAi(
|
builder: (_) => MzansiAi(
|
||||||
signedInUser: args,
|
arguments: args,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user