diff --git a/assets/images/doctor_icon.svg b/assets/images/doctor_icon.svg new file mode 100644 index 0000000..4671b96 --- /dev/null +++ b/assets/images/doctor_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/nebulization_icon.svg b/assets/images/nebulization_icon.svg new file mode 100644 index 0000000..fa45f8a --- /dev/null +++ b/assets/images/nebulization_icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/procedure_icon.svg b/assets/images/procedure_icon.svg new file mode 100644 index 0000000..a6fff3f --- /dev/null +++ b/assets/images/procedure_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/vaccination_icon.svg b/assets/images/vaccination_icon.svg new file mode 100644 index 0000000..44c12d3 --- /dev/null +++ b/assets/images/vaccination_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/vitalsign_icon.svg b/assets/images/vitalsign_icon.svg new file mode 100644 index 0000000..bf37c5e --- /dev/null +++ b/assets/images/vitalsign_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/lib/core/api.dart b/lib/core/api.dart index 1c1abb5..c8cfa78 100644 --- a/lib/core/api.dart +++ b/lib/core/api.dart @@ -20,7 +20,7 @@ class API { static getCallRequestInfoByClinicInfo(String deviceIp, {required Function(List, List, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async { final body = {"ipAdress": deviceIp, "apiKey": apiKey}; - bool isDevMode = false; + bool isDevMode = true; if (isDevMode) { var callPatients = PatientTicketModel.testCallPatients; CallConfig callConfig = CallConfig.testCallConfig; diff --git a/lib/core/config/config.dart b/lib/core/config/config.dart index 6dc723e..1faa39c 100644 --- a/lib/core/config/config.dart +++ b/lib/core/config/config.dart @@ -10,18 +10,29 @@ const apiKey = 'EE17D21C7943485D9780223CCE55DCE5'; // UAT // const BASE_URL = 'http://10.200.204.11:2222/Services/Nurses.svc/REST'; // const BASE_URL = 'https://hmgwebservices.com/'; - /// Timer Info const TIMER_MIN = 10; class AppGlobal { static var CONTEX; - static Color appRedColor = const Color(0xFFD02127); - static Color appGreenColor = const Color(0xFF359846); + + // static Color appRedColor = const Color(0xFFD02127); + // static Color appGreenColor = const Color(0xFF359846); static Color appTextColor = const Color(0xFF2B353E); - static Color scheduleTextColor = const Color(0xFF2E303A); - static Color inProgressColor = const Color(0xFFCC9B14); - static Color appGreyColor = const Color(0xFF575757); - static Color appLightGreyColor = const Color(0xFFE6E6E6); + //TextColors + static Color nebulizationColor = const Color(0xFF3C86D0); + static Color vitalSignColor = const Color(0xFFD02127); + static Color doctorColor = const Color(0xFF52964F); + // static Color procedureColor = const Color(0xFFC99609); + static Color vaccinationColor = const Color(0xFFC99609); + static Color procedureColor = const Color(0xFF460707); + + + //IconPaths + static String vitalSignIcon = "assets/images/vitalsign_icon.svg"; + static String nebulizationIcon = "assets/images/nebulization_icon.svg"; + static String doctorIcon = "assets/images/doctor_icon.svg"; + static String procedureIcon = "assets/images/procedure_icon.svg"; + static String vaccinationIcon = "assets/images/vaccination_icon.svg"; } diff --git a/lib/core/response_models/call_config_model.dart b/lib/core/response_models/call_config_model.dart index 4e24681..72023d9 100644 --- a/lib/core/response_models/call_config_model.dart +++ b/lib/core/response_models/call_config_model.dart @@ -68,7 +68,7 @@ class CallConfig { this.roomText = "", this.queueNoText = "", this.callForText = "", - this.currentServeText = "", + this.currentServeText = "Current Serving", this.callTypeVitalSignText = "", this.callTypeDoctorText = "", this.callTypeProcedureText = "", @@ -108,8 +108,8 @@ class CallConfig { callTypeProcedureText = json['callTypeProcedureText']; callTypeVaccinationText = json['callTypeVaccinationText']; callTypeNebulizationText = json['callTypeNebulizationText']; - // textDirection = json['textDirection'] == 2 ? TextDirection.rtl : TextDirection.ltr; - textDirection = TextDirection.ltr; + textDirection = json['textDirection'] == 2 ? TextDirection.rtl : TextDirection.ltr; + // textDirection = TextDirection.ltr; } static var data = { @@ -123,7 +123,7 @@ class CallConfig { "screenLanguageText": "English", "voiceLanguage": 1, "voiceLanguageText": "English", - "screenMaxDisplayPatients": 3, + "screenMaxDisplayPatients": 6, "isNotiReq": true, "prioritySMS": 2, "priorityWhatsApp": 3, diff --git a/lib/header/app_header.dart b/lib/header/app_header.dart index 9454d8d..28a9f1a 100644 --- a/lib/header/app_header.dart +++ b/lib/header/app_header.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; import 'package:queuing_system/core/config/config.dart'; +import 'package:queuing_system/home/app_provider.dart'; import 'package:queuing_system/utils/utils.dart'; import 'package:queuing_system/widget/data_display/app_texts_widget.dart'; @@ -9,12 +11,13 @@ class AppHeader extends StatelessWidget with PreferredSizeWidget { @override Widget build(BuildContext context) { + AppProvider appProvider = context.read(); return Container( padding: const EdgeInsets.only( left: 0, right: 5, ), - decoration: BoxDecoration(color: AppGlobal.appRedColor, border: const Border(bottom: BorderSide(color: Color(0xFFEFEFEF)))), + decoration: BoxDecoration(color: AppGlobal.vitalSignColor, border: const Border(bottom: BorderSide(color: Color(0xFFEFEFEF)))), child: Container( height: 100, padding: const EdgeInsets.only( @@ -22,23 +25,26 @@ class AppHeader extends StatelessWidget with PreferredSizeWidget { right: 20, bottom: 0, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () {}, - child: const AppText( - " Current Serving", - color: Colors.white, - fontFamily: 'Poppins-SemiBold.ttf', + child: Directionality( + textDirection: appProvider.patientCallConfigurations.textDirection, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () {}, + child: AppText( + appProvider.patientCallConfigurations.currentServeText, + color: Colors.white, + fontFamily: 'Poppins-SemiBold.ttf', + ), ), - ), - SvgPicture.asset( - "assets/images/hmglogo.svg", - height: Utils.getHeight() * 0.5, - ), - ], + SvgPicture.asset( + "assets/images/hmglogo.svg", + height: Utils.getHeight() * 0.5, + ), + ], + ), ), ), ); diff --git a/lib/home/app_provider.dart b/lib/home/app_provider.dart index 1868f48..bd9efa6 100644 --- a/lib/home/app_provider.dart +++ b/lib/home/app_provider.dart @@ -82,7 +82,7 @@ class AppProvider extends ChangeNotifier { notifyListeners(); if (patientTickets.isNotEmpty) { voiceCallPatientTicket(patientTickets.first); - updatePatientTicketByIndex(patientTickets.first); + updatePatientTicket(patientTickets.first); } }, onFailure: (error) { log("Api call failed with this error: ${error.toString()}"); @@ -122,8 +122,10 @@ class AppProvider extends ChangeNotifier { } CallByVoice? voiceCaller; + PatientTicketModel currentPatient = PatientTicketModel(); voiceCallPatientTicket(PatientTicketModel patientTicket) async { + currentPatient = patientTicket; isCallingInProgress = true; log("Setting isCallingInProgress : $isCallingInProgress"); @@ -156,9 +158,41 @@ class AppProvider extends ChangeNotifier { } Future listenAudioPlayerEvents() async { - audioPlayer.playerStateStream.listen((playerState) { + audioPlayer.playerStateStream.listen((playerState) async { if (playerState.processingState == ProcessingState.completed) { // isCallingInProgress = false; + + if (currentPatient.isVoiceReq) return; + + if (isQueuePatients.isNotEmpty) { + log("isQueuePatients length : ${isQueuePatients.length}"); + final length = isQueuePatients.length; + for (int i = 0; i < length; i++) { + await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async { + PatientTicketModel temp = PatientTicketModel(); + if (patientTickets.isNotEmpty) { + temp = patientTickets.elementAt(0); + patientTickets.removeAt(0); + } + notifyListeners(); + isQueuePatients.removeAt(0); + patientTickets.add(temp); + notifyListeners(); + await voiceCallPatientTicket(patientTickets.first); + updatePatientTicket(patientTickets.first); + }); + } + } + isCallingInProgress = false; + log("Setting isCallingInProgress : $isCallingInProgress"); + if (isApiCallNeeded) { + log("I will start waiting!!"); + Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async { + await callPatientsAPI(); + log("Called the API after waiting!"); + isApiCallNeeded = false; + }); + } } }); @@ -182,6 +216,7 @@ class AppProvider extends ChangeNotifier { patientTickets.add(temp); notifyListeners(); await voiceCallPatientTicket(patientTickets.first); + updatePatientTicket(patientTickets.first); }); } } @@ -209,8 +244,7 @@ class AppProvider extends ChangeNotifier { // } // } - updatePatientTicketByIndex(PatientTicketModel patientTicket) { - return; + updatePatientTicket(PatientTicketModel patientTicket) { if (!patientTicket.isQueue) { API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: patientTicket, onSuccess: (ticketsUpdated) { log("[${patientTicket.callNoStr}] Ticket Updated: $ticketsUpdated"); diff --git a/lib/home/priority_calls_components.dart b/lib/home/priority_calls_components.dart index e84244d..cee5eba 100644 --- a/lib/home/priority_calls_components.dart +++ b/lib/home/priority_calls_components.dart @@ -16,7 +16,6 @@ class PriorityTickets extends StatelessWidget { Widget build(BuildContext context) { final firstTicket = tickets[0]; final otherTickets = tickets.sublist(1, tickets.length); - return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -86,7 +85,6 @@ class TicketItem extends StatelessWidget { @override Widget build(BuildContext context) { - callConfig.textDirection = TextDirection.rtl; return Transform.scale( scale: scale, child: Column( @@ -95,7 +93,7 @@ class TicketItem extends StatelessWidget { BlinkText(getFormattedTicket(ticketNo, isClinicAdded), style: TextStyle( fontSize: SizeConfig.getWidthMultiplier() * 10, - letterSpacing: -9.32, + letterSpacing: -1, height: 0.5, fontWeight: FontWeight.bold, ), @@ -119,7 +117,7 @@ class TicketItem extends StatelessWidget { AppText( callType.message(callConfig), color: callType.color(), - letterSpacing: -1.5, + letterSpacing: -1, fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontWeight: FontWeight.w600, fontHeight: 1, @@ -136,7 +134,7 @@ class TicketItem extends StatelessWidget { AppText( callConfig.textDirection == TextDirection.ltr ? "${callConfig.roomText}: $roomNo" : " $roomNo : ${callConfig.roomText}", color: callType.color(), - letterSpacing: -1.5, + letterSpacing: -1, fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontWeight: FontWeight.w600, fontHeight: 1, @@ -263,7 +261,7 @@ Widget priorityTicketsWithSideList({required List tickets, r children: [ AppText( itm.queueNo.toString(), - letterSpacing: -2, + letterSpacing: -1, fontHeight: 0.5, fontWeight: FontWeight.bold, fontSize: SizeConfig.getWidthMultiplier() * 4, @@ -282,12 +280,12 @@ Widget priorityTicketsWithSideList({required List tickets, r flex: 5, child: Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: const EdgeInsets.only(top: 10), + padding: const EdgeInsets.only(bottom: 10), child: SizedBox( - width: SizeConfig.getWidthMultiplier() * 3, + width: SizeConfig.getWidthMultiplier() * 3.5, child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5), ), ), @@ -295,7 +293,7 @@ Widget priorityTicketsWithSideList({required List tickets, r AppText( itm.getCallType().message(callConfig, isListView: true), color: itm.getCallType().color(), - letterSpacing: -1.5, + letterSpacing: -1, fontSize: SizeConfig.getWidthMultiplier() * 3, fontWeight: FontWeight.w600, fontHeight: 0.5, diff --git a/lib/utils/call_type.dart b/lib/utils/call_type.dart index d035e40..5bae053 100644 --- a/lib/utils/call_type.dart +++ b/lib/utils/call_type.dart @@ -8,15 +8,15 @@ enum CallType { vitalSign, doctor, procedure, vaccination, nebulization, none } extension XCallType on CallType { Color color() { if (this == CallType.vitalSign) { - return AppGlobal.appGreenColor; + return AppGlobal.vitalSignColor; } else if (this == CallType.doctor) { - return AppGlobal.appRedColor; + return AppGlobal.doctorColor; } else if (this == CallType.procedure) { - return AppGlobal.appGreenColor; + return AppGlobal.procedureColor; } else if (this == CallType.vaccination) { - return AppGlobal.appGreenColor; + return AppGlobal.vaccinationColor; } else if (this == CallType.nebulization) { - return AppGlobal.appGreenColor; + return AppGlobal.nebulizationColor; } else { return Colors.black54; } @@ -44,15 +44,15 @@ extension XCallType on CallType { SvgPicture icon(double height) { if (this == CallType.vitalSign) { - return SvgPicture.asset("assets/images/nurseicon.svg", height: height, color: color()); + return SvgPicture.asset(AppGlobal.vitalSignIcon, height: height, color: color()); } else if (this == CallType.doctor) { - return SvgPicture.asset("assets/images/doctoricon.svg", height: height, color: color()); + return SvgPicture.asset(AppGlobal.doctorIcon, height: height, color: color()); } else if (this == CallType.procedure) { - return SvgPicture.asset("assets/images/doctoricon.svg", height: height, color: color()); + return SvgPicture.asset(AppGlobal.procedureIcon, height: height, color: color()); } else if (this == CallType.vaccination) { - return SvgPicture.asset("assets/images/doctoricon.svg", height: height, color: color()); + return SvgPicture.asset(AppGlobal.vaccinationIcon, height: height, color: color()); } else if (this == CallType.nebulization) { - return SvgPicture.asset("assets/images/nurseicon.svg", height: height, color: color()); + return SvgPicture.asset(AppGlobal.nebulizationIcon, height: height, color: color()); } return SvgPicture.asset("assets/images/wait.svg", height: height, color: color()); }