appointment and waiting room update
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_bo
|
||||
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';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/business_user.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/builder/build_appointment_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../main.dart';
|
||||
@@ -21,12 +22,14 @@ import '../../mih_objects/app_user.dart';
|
||||
class Appointments extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final bool personalSelected;
|
||||
|
||||
const Appointments({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.personalSelected,
|
||||
});
|
||||
|
||||
@@ -60,6 +63,7 @@ class _PatientAccessRequestState extends State<Appointments> {
|
||||
appointmentList: appointmentList,
|
||||
signedInUser: widget.signedInUser,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
personalSelected: widget.personalSelected,
|
||||
inWaitingRoom: false,
|
||||
titleController: _appointmentTitleController,
|
||||
@@ -182,6 +186,8 @@ class _PatientAccessRequestState extends State<Appointments> {
|
||||
MihMzansiCalendarApis.addBusinessAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business!,
|
||||
widget.businessUser!,
|
||||
false,
|
||||
_appointmentTitleController.text,
|
||||
_appointmentDescriptionIDController.text,
|
||||
_appointmentDateController.text,
|
||||
|
||||
@@ -12,12 +12,14 @@ 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/appointment.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/business.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/business_user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BuildAppointmentList extends StatefulWidget {
|
||||
final List<Appointment> appointmentList;
|
||||
final AppUser signedInUser;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final bool personalSelected;
|
||||
final bool inWaitingRoom;
|
||||
final TextEditingController titleController;
|
||||
@@ -31,6 +33,7 @@ class BuildAppointmentList extends StatefulWidget {
|
||||
required this.appointmentList,
|
||||
required this.signedInUser,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.personalSelected,
|
||||
required this.inWaitingRoom,
|
||||
required this.titleController,
|
||||
@@ -505,16 +508,44 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
||||
|
||||
void updateAppointmentCall(int index) {
|
||||
if (isAppointmentInputValid()) {
|
||||
MihMzansiCalendarApis.updatePersonalAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business,
|
||||
widget.appointmentList[index].idappointments,
|
||||
widget.titleController.text,
|
||||
widget.descriptionIDController.text,
|
||||
widget.dateController.text,
|
||||
widget.timeController.text,
|
||||
context,
|
||||
);
|
||||
if (widget.personalSelected == true) {
|
||||
MihMzansiCalendarApis.updatePersonalAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business,
|
||||
null,
|
||||
widget.appointmentList[index].idappointments,
|
||||
widget.titleController.text,
|
||||
widget.descriptionIDController.text,
|
||||
widget.dateController.text,
|
||||
widget.timeController.text,
|
||||
context,
|
||||
);
|
||||
} else if (widget.personalSelected == false &&
|
||||
widget.inWaitingRoom == false) {
|
||||
MihMzansiCalendarApis.updateBusinessAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business,
|
||||
widget.businessUser,
|
||||
widget.appointmentList[index].idappointments,
|
||||
widget.titleController.text,
|
||||
widget.descriptionIDController.text,
|
||||
widget.dateController.text,
|
||||
widget.timeController.text,
|
||||
context,
|
||||
);
|
||||
} else {
|
||||
MihMzansiCalendarApis.updatePatientAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business,
|
||||
widget.businessUser,
|
||||
widget.appointmentList[index].idappointments,
|
||||
widget.titleController.text,
|
||||
widget.descriptionIDController.text,
|
||||
widget.dateController.text,
|
||||
widget.timeController.text,
|
||||
context,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -526,8 +557,12 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
||||
}
|
||||
|
||||
void deleteAppointmentCall(int index) {
|
||||
MihMzansiCalendarApis.deleteLoyaltyCardAPICall(
|
||||
MihMzansiCalendarApis.deleteAppointmentAPICall(
|
||||
widget.signedInUser,
|
||||
widget.personalSelected,
|
||||
widget.business,
|
||||
widget.businessUser,
|
||||
widget.inWaitingRoom,
|
||||
widget.appointmentList[index].idappointments,
|
||||
context,
|
||||
);
|
||||
|
||||
@@ -69,6 +69,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
|
||||
Appointments(
|
||||
signedInUser: widget.arguments.signedInUser,
|
||||
business: widget.arguments.business,
|
||||
businessUser: widget.arguments.businessUser,
|
||||
personalSelected: widget.arguments.personalSelected,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -38,6 +38,7 @@ import '../../mih_objects/business_user.dart';
|
||||
import '../../mih_objects/notification.dart';
|
||||
import '../test/test.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MIHHome extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final BusinessUser? businessUser;
|
||||
@@ -49,8 +50,8 @@ class MIHHome extends StatefulWidget {
|
||||
final bool isBusinessUser;
|
||||
final bool isBusinessUserNew;
|
||||
final bool isDevActive;
|
||||
final bool personalSelected;
|
||||
const MIHHome({
|
||||
bool personalSelected;
|
||||
MIHHome({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.businessUser,
|
||||
@@ -253,6 +254,7 @@ class _MIHHomeState extends State<MIHHome> {
|
||||
widget.signedInUser,
|
||||
true,
|
||||
widget.business,
|
||||
null,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -434,6 +436,7 @@ class _MIHHomeState extends State<MIHHome> {
|
||||
widget.signedInUser,
|
||||
false,
|
||||
widget.business,
|
||||
widget.businessUser,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -1171,8 +1174,10 @@ class _MIHHomeState extends State<MIHHome> {
|
||||
text: "Personal",
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
widget.personalSelected = true;
|
||||
_selectedIndex = 0;
|
||||
});
|
||||
print("personal selected: ${widget.personalSelected}");
|
||||
},
|
||||
),
|
||||
GButton(
|
||||
@@ -1180,8 +1185,10 @@ class _MIHHomeState extends State<MIHHome> {
|
||||
text: "Business",
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
widget.personalSelected = false;
|
||||
_selectedIndex = 1;
|
||||
});
|
||||
print("personal selected: ${widget.personalSelected}");
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:Mzansi_Innovation_Hub/mih_components/mih_calendar.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_date_input.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_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_inputs_and_buttons/mih_time_input.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_window.dart';
|
||||
@@ -15,19 +14,23 @@ 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/appointment.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/business.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_objects/business_user.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/builder/build_appointment_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class WaitingRoom extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final bool personalSelected;
|
||||
|
||||
final Function(int) onIndexChange;
|
||||
const WaitingRoom({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
this.business,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.personalSelected,
|
||||
required this.onIndexChange,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -52,6 +55,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
|
||||
late Future<List<Appointment>> businessAppointmentResults;
|
||||
late Future<List<Appointment>> appointmentResults;
|
||||
bool inWaitingRoom = true;
|
||||
|
||||
// Business Appointment Tool
|
||||
Widget getBusinessAppointmentsTool() {
|
||||
@@ -122,7 +126,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
child: IconButton(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onPressed: () {
|
||||
addAppointmentWindow();
|
||||
appointmentTypeSelection();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
@@ -141,6 +145,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
appointmentList: appointmentList,
|
||||
signedInUser: widget.signedInUser,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
personalSelected: widget.personalSelected,
|
||||
inWaitingRoom: true,
|
||||
titleController: _appointmentTitleController,
|
||||
@@ -170,7 +175,89 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
);
|
||||
}
|
||||
|
||||
void appointmentTypeSelection() {
|
||||
String question = "What type of appointment would you like to add?";
|
||||
question +=
|
||||
"\n\nExisting Patient: Add an appointment for an patient your practice has access to.";
|
||||
question +=
|
||||
"\nExisting MIH User: Add an appointment for an existing MIH user your practice does not have access to.";
|
||||
question +=
|
||||
"\nSkeleton Appointment: Add an appointment without a patient linked.";
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) {
|
||||
return MIHWindow(
|
||||
fullscreen: false,
|
||||
windowTitle: "Appointment Type",
|
||||
windowTools: [],
|
||||
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(),
|
||||
),
|
||||
),
|
||||
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: () {
|
||||
addAppointmentWindow();
|
||||
},
|
||||
buttonText: "Skeleton Appointment",
|
||||
buttonColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
textColor:
|
||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void addAppointmentWindow() {
|
||||
print(widget.personalSelected);
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
@@ -198,18 +285,6 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
child: MIHSearchField(
|
||||
controller: _patientController,
|
||||
hintText: "Patient ID Number",
|
||||
required: false,
|
||||
editable: true,
|
||||
onTap: () {
|
||||
//To-Do: Add search functionality
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
// width: 500,
|
||||
child: MIHDateField(
|
||||
@@ -244,9 +319,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
height: 50,
|
||||
child: MIHButton(
|
||||
onTap: () {
|
||||
//To-Do: Add appointment
|
||||
print("To-Do: Add appointment");
|
||||
// addAppointmentCall();
|
||||
addAppointmentCall();
|
||||
},
|
||||
buttonText: "Add",
|
||||
buttonColor:
|
||||
@@ -267,6 +340,8 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
||||
MihMzansiCalendarApis.addBusinessAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business!,
|
||||
widget.businessUser!,
|
||||
true,
|
||||
_appointmentTitleController.text,
|
||||
_appointmentDescriptionIDController.text,
|
||||
_appointmentDateController.text,
|
||||
|
||||
@@ -20,6 +20,13 @@ class PatManager extends StatefulWidget {
|
||||
|
||||
class _PatManagerState extends State<PatManager> {
|
||||
int _selcetedIndex = 0;
|
||||
|
||||
void updateIndex(int index) {
|
||||
setState(() {
|
||||
_selcetedIndex = index;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihApp(
|
||||
@@ -82,7 +89,9 @@ class _PatManagerState extends State<PatManager> {
|
||||
WaitingRoom(
|
||||
signedInUser: widget.arguments.signedInUser,
|
||||
business: widget.arguments.business,
|
||||
businessUser: widget.arguments.businessUser,
|
||||
personalSelected: widget.arguments.personalSelected,
|
||||
onIndexChange: updateIndex,
|
||||
),
|
||||
MyPatientList(
|
||||
signedInUser: widget.arguments.signedInUser,
|
||||
|
||||
Reference in New Issue
Block a user