diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 5747ccb4..4147cfed 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -44,17 +44,17 @@ class BaseAppClient { if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body == null || body['DoctorID'] == null) { - body!['DoctorID'] = doctorProfile.doctorID; + body!['DoctorID'] = doctorProfile.doctorID.toString(); } if (body['DoctorID'] == "") body['DoctorID'] = doctorProfile .doctorID; // changed from null; because create update episode not working - if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID; + if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString(); if (body['ProjectID'] == null) { - body['ProjectID'] = doctorProfile.projectID; + body['ProjectID'] = doctorProfile.projectID.toString(); } - if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID; + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID.toString(); } else { String? doctorID = await sharedPref.getString(DOCTOR_ID); if (body!['DoctorID'] == '') { @@ -78,21 +78,21 @@ class BaseAppClient { if (!isFallLanguage) { String? lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') - body['LanguageID'] = 1; + body['LanguageID'] = '1'; else - body['LanguageID'] = 2; + body['LanguageID'] = '2'; } body['stamp'] = DateTime.now().toIso8601String(); - body['IPAdress'] = IP_ADDRESS; + body['IPAdress'] = IP_ADDRESS.toString(); if (body['VersionID'] == null) { - body['VersionID'] = VERSION_ID; + body['VersionID'] = VERSION_ID.toString(); } if (body['Channel'] == null) { - body['Channel'] = CHANNEL; + body['Channel'] = CHANNEL.toString(); } - body['SessionID'] = SESSION_ID; - body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; - body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; + body['SessionID'] = SESSION_ID.toString(); + body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString(); + body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); @@ -109,9 +109,9 @@ class BaseAppClient { body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3) - body['PatientOutSA'] = true; + body['PatientOutSA'] = 'true'; else - body['PatientOutSA'] = false; + body['PatientOutSA'] = 'false'; // if (!body.containsKey('ProjectID')) { // if (projectID != null) { @@ -121,7 +121,7 @@ class BaseAppClient { // } // } - body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + body['DeviceTypeID'] = Platform.isAndroid ? '1' : '2'; // body['ClinicID'] = 501; // body['ProjectID'] = 12; diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 31e9f363..cc9ae0b6 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -48,6 +48,7 @@ class DashboardViewModel extends BaseViewModel { return; } isInfectiousDiseaseConsultant = result; + print('the result is ${result}'); setState(ViewState.Idle); } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 5225d347..e2700987 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -80,7 +80,7 @@ class _HomeScreenState extends State { .then((value) { if (model.radiologyCriticalFindingModel != null) { print("onModelReady radiologyCriticalFindingModel!!!"); - showRadiologyFindingDialog(model); + // showRadiologyFindingDialog(model); } else { print("onModelReady radiologyCriticalFindingModel EMPTYYYY!!!"); } diff --git a/lib/screens/pharmacy_intervention/PharmacyIntervention.dart b/lib/screens/pharmacy_intervention/PharmacyIntervention.dart index 1d12ce9f..0af5c894 100644 --- a/lib/screens/pharmacy_intervention/PharmacyIntervention.dart +++ b/lib/screens/pharmacy_intervention/PharmacyIntervention.dart @@ -1,4 +1,5 @@ import 'dart:ui'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -40,6 +41,7 @@ class _PharmacyInterventionState extends State { } return AppScaffold( isShowAppBar: true, + isLoading: model.state == ViewState.BusyLocal, appBar: PatientSearchHeader( title: TranslationBase .of(context) @@ -47,7 +49,7 @@ class _PharmacyInterventionState extends State { fontSize: 18, showSearchIcon: true, onSearchPressed: () { - SearchDialog(context); + SearchDialog(context, model); }, ), appBarTitle: TranslationBase @@ -100,6 +102,7 @@ class _PharmacyInterventionState extends State { curve: Curves.easeInOut, ); } + @override void dispose() { super.dispose(); @@ -120,32 +123,54 @@ class _PharmacyInterventionState extends State { topLeft: Radius.circular(20), topRight: Radius.circular(20))), builder: (_) { return DraggableScrollableSheet( - key: _sheet, + key: _sheet, initialChildSize: 0.5, minChildSize: 0.5, maxChildSize: 1, snapSizes: [ - 0.5 ,// constraints.maxHeight, + 0.5, // constraints.maxHeight, 0.9, ], expand: false, controller: _controller, - builder:(_, controller) => - InterventionHistoryBottomSheet( - interventionList: interventionHistory, - controller: controller, - )); + builder: (_, controller) => + InterventionHistoryBottomSheet( + interventionList: interventionHistory, + controller: controller, + )); }, ).then((value) => model.toggleShowBottomSheetValue()); } - void SearchDialog(BuildContext context) { + void SearchDialog(BuildContext context, PharmacyInterventionViewModel model) { showDialog( context: context, barrierDismissible: true, // user must tap button! builder: (_) { return PharmacyInterventionDialog( - onDispose: (dateFrom, dateTo, admissionNumber, patientId) {}); + dateFrom: model.fromDate, + dateTo: model.toDate, + admissionNumber: model.admissionId, + nursingStation: model.nursingStationId, + patientID: model.patientID, + onDispose: (dateFrom, dateTo, admissionNumber, patientId, + nursingStation) { + if (dateFrom == model.fromDate && dateTo == model.toDate && + admissionNumber == model.admissionId && patientId == model.patientID && + nursingStation == model.nursingStationId) { + Navigator.of(context).pop(); + return; + } + + model.getPharmacyIntervention( + admissionId: admissionNumber, + patientID: patientId, + nursingStationId: nursingStation, + toDate: dateTo, + fromDate: dateFrom + ); + Navigator.of(context).pop(); + }); }); } } @@ -173,7 +198,7 @@ class InterventionCardItem extends StatelessWidget { medication: medication, model: model, ), - InterventionCardFooter(model: model) + InterventionCardFooter(model: model, medication: medication,) ], ), ), @@ -184,8 +209,8 @@ class InterventionCardItem extends StatelessWidget { class InterventionCardFooter extends StatelessWidget { final PharmacyInterventionViewModel model; - - const InterventionCardFooter({super.key, required this.model}); + final Medication medication; + const InterventionCardFooter({super.key, required this.model, required this.medication}); @override Widget build(BuildContext context) { @@ -200,7 +225,14 @@ class InterventionCardFooter extends StatelessWidget { borderColor: Colors.grey, color: Colors.grey, fontColor: Colors.white, - onPressed: () async {}, + onPressed: () async { + model.getInterventionHistory( + admissionNumber: medication.admissionNo?.toString() ?? '', + prescriptionNumber: medication.prescriptionNo?.toString() ?? '', + orderNumber: medication.orderNo?.toString() ?? '', + itemID: medication.itemID?.toString() ?? '', + ); + }, ), ), ]), @@ -217,7 +249,18 @@ class InterventionCardFooter extends StatelessWidget { borderColor: Color(0xFFB8382B), color: AppGlobal.appRedColor, fontColor: Colors.white, - onPressed: () async {}, + onPressed: () async { + model.updateInterventionDiseaseStatus( + admissionNo: medication.admissionNo?.toString() ?? '', + prescriptionNo: medication.prescriptionNo?.toString() ?? '', + orderNo: medication.orderNo?.toString() ?? '', + itemID: medication.itemID?.toString() ?? '', + interventionID: medication.?.toString() ?? '', + prescriptionNo: medication.prescriptionNo?.toString() ?? '', + orderNo: medication.orderNo?.toString() ?? '', + itemID: medication.itemID?.toString() ?? '', + ) + }, ), ), SizedBox( @@ -1008,13 +1051,20 @@ class _TableExampleState extends State { class PharmacyInterventionDialog extends StatefulWidget { final Function( - String, - String, - String, - String, + String, // dataFrom + String, // dateTo + String, // admissionNumber + String, // patient ID + String, // nursingStation ) onDispose; - const PharmacyInterventionDialog({super.key, required this.onDispose}); + final String dateFrom; + final String dateTo; + final String admissionNumber; + final String patientID; + final String nursingStation; + + const PharmacyInterventionDialog({super.key, required this.onDispose, required this.dateFrom, required this.dateTo, required this.admissionNumber, required this.patientID, required this.nursingStation}); @override State createState() => @@ -1034,8 +1084,16 @@ class _PharmacyInterventionDialogState @override void initState() { + initData(); super.initState(); - // initFromDate(); + } + + void initData() { + admissionNumber.text = widget.admissionNumber; + nursingStation.text = widget.nursingStation; + patientId.text = widget.patientID; + dateTo = getDate(widget.dateTo); + dateFrom = getDate(widget.dateFrom); } @override @@ -1101,7 +1159,15 @@ class _PharmacyInterventionDialogState borderColor: Color(0xFFB8382B), color: AppGlobal.appRedColor, fontColor: Colors.white, - onPressed: () async {}, + onPressed: () async { + //(dateFrom, dateTo, admissionNumber, patientId, nursingStation) + widget.onDispose( + dateFrom, + dateTo, + nursingStation.text, + patientId.text, + nursingStation.text); + }, ), ), ]), @@ -1191,6 +1257,13 @@ class _PharmacyInterventionDialogState } String getFormattedDate(DateTime time) { - return DateFormat('MM/dd/yyyy').format(time); + return DateFormat('yyyy-MM-dd').format(time); } + String getDate(String dateTime) { + if (dateTime.isEmpty) return ''; + List splitedDate = dateTime.split('-'); + DateTime now = DateTime(int.parse(splitedDate[0]), int.parse(splitedDate[1]), int.parse(splitedDate[2])); + return DateFormat('yyyy-MM-dd').format(now); + } + } diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart index 1017bcd7..936f0e89 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart @@ -1,12 +1,13 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PharmacyInterventionService extends BaseService { - FutureOr getMedicationList( + Future getMedicationList( {String nursingStationId = '', String admissionId = '', String patientID = '', @@ -20,32 +21,43 @@ class PharmacyInterventionService extends BaseService { "toDate": toDate, }; hasError = false; - await baseAppClient.post(GET_MEDICINE_WITH_INTERVAL, + MedicationList? result; + await baseAppClient.post(GET_MEDICINE_WITH_INTERVAL, onSuccess: (dynamic response, int statusCode) { - return MedicationList.fromJson(response['List_MedicineWithIntervention']); + result = MedicationList.fromJson(response['List_MedicineWithIntervention']); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error! + "\n" + error; - return null; + super.error = super.error??'' + "\n" + error; + }, body: request); - return null; + return result; } - FutureOr getInfectiousDiseaseConsultantStatus() async { + /// + /// it will be called only for the doctor that are associated to vida plus + /// project + /// + Future getInfectiousDiseaseConsultantStatus() async { + String vidaToken = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + + if(vidaToken.isEmpty){ + return false; + } hasError = false; + var success = false; await baseAppClient.post(IS_INFECTIOUS_DISEASE, onSuccess: (dynamic response, int statusCode) { - return response['IsInfectiousDiseases']; + success = response['IsInfectiousDiseases']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = super.error! + "\n" + error; - return false; + }, body: {}); - return false; + return success; } - FutureOr getInfectiousDiseaseHistory({ + Future getInfectiousDiseaseHistory({ String admissionNumber = '', String prescriptionNumber = '', String orderNumber = '', @@ -59,19 +71,20 @@ class PharmacyInterventionService extends BaseService { }; hasError = false; - await baseAppClient.post(INFECTIOUS_HISTORY, + InterventionHistoryList? result; + await baseAppClient.post(INFECTIOUS_HISTORY, onSuccess: (dynamic response, int statusCode) { - return InterventionHistoryList.fromJson( + result = InterventionHistoryList.fromJson( response['List_MedicineInterventionHistory']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = super.error! + "\n" + error; - return null; + }, body: request); - return null; + return result; } - FutureOr updateInterventionStatus({ + Future updateInterventionStatus({ String admissionNo = '', String prescriptionNo = '', String orderNo = '', @@ -97,14 +110,14 @@ class PharmacyInterventionService extends BaseService { }; hasError = false; - await baseAppClient.post(INFECTIOUS_HISTORY, + var result = false; + await baseAppClient.post(INFECTIOUS_HISTORY, onSuccess: (dynamic response, int statusCode) { - return response['IsAccepted']; + result = response['IsAccepted']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = super.error! + "\n" + error; - return false; }, body: request); - return false; + return result; } } diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart index 811c7bf3..1e50d722 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart @@ -565,40 +565,23 @@ class PharmacyInterventionViewModel extends BaseViewModel { } Future getInterventionHistory({ - String admissionNo = '', - String prescriptionNo = '', - String orderNo = '', + String admissionNumber = '', + String prescriptionNumber = '', + String orderNumber = '', String itemID = '', - String interventionID = '', - String isAccepted = '', - String remarks = '', - String authorizeID = '', - String lineItemNo = '', - String status = '', }) async { setState(ViewState.BusyLocal); - bool? result = await _service.updateInterventionStatus( - admissionNo: admissionNo, - prescriptionNo: prescriptionNo, - orderNo: orderNo, - itemID: itemID, - interventionID: interventionID, - isAccepted: isAccepted, - remarks: remarks, - authorizeID: authorizeID, - lineItemNo: lineItemNo, - status: status); - if (_service.hasError || !result) { + InterventionHistoryList? result = await _service.getInfectiousDiseaseHistory( + admissionNumber: admissionNumber, + prescriptionNumber: prescriptionNumber, + orderNumber: orderNumber, + itemID: itemID); + if (_service.hasError ) { error = _service.error; setState(ViewState.ErrorLocal); return; } - await getPharmacyIntervention( - nursingStationId: nursingStationId, - admissionId: admissionNo, - patientID: patientID, - fromDate: fromDate, - toDate: toDate); + interventionHistoryList = result; setState(ViewState.Idle); } diff --git a/pubspec.lock b/pubspec.lock index 685eba41..c92984e9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -233,30 +233,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" - cloud_firestore: - dependency: "direct main" - description: - name: cloud_firestore - sha256: "31cfa4d65d6e9ea837234fffe121304034c30c9214c06207b4a35867e3757900" - url: "https://pub.dev" - source: hosted - version: "4.15.8" - cloud_firestore_platform_interface: - dependency: transitive - description: - name: cloud_firestore_platform_interface - sha256: a0097a26569b015faf8142e159e855241609ea9a1738b5fd1c40bfe8411b41a0 - url: "https://pub.dev" - source: hosted - version: "6.1.9" - cloud_firestore_web: - dependency: transitive - description: - name: cloud_firestore_web - sha256: ed680ece29a5750985119c09cdc276b460c3a2fa80e8c12f9b7241f6b4a7ca16 - url: "https://pub.dev" - source: hosted - version: "3.10.8" cloudflare_turnstile: dependency: "direct main" description: @@ -1586,6 +1562,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + two_dimensional_scrollables: + dependency: "direct main" + description: + name: two_dimensional_scrollables + sha256: b6028c80e782e58a5d18f9491737aae4f70d72dc08050ac92006905c7c0b5e21 + url: "https://pub.dev" + source: hosted + version: "0.3.3" typed_data: dependency: transitive description: @@ -1710,10 +1694,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "14.2.5" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 45856f38..2dcd7b8b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -132,6 +132,7 @@ dependencies: cloudflare_turnstile: ^3.0.1 # flutter_zoom_videosdk: ^1.10.11 # dart_jsonwebtoken: ^2.14.0 + two_dimensional_scrollables: ^0.3.3 dependency_overrides: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index ad50cab8..c0183aab 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,7 +6,6 @@ #include "generated_plugin_registrant.h" -#include #include #include #include @@ -15,8 +14,6 @@ #include void RegisterPlugins(flutter::PluginRegistry* registry) { - CloudFirestorePluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3e03a259..14522e7e 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - cloud_firestore firebase_core flutter_inappwebview_windows local_auth_windows