fix the remark validation, make the bottomSheet show after loading and edit the order numbers of priority refer-patient-screen-in-patient

merge-requests/979/head
RoaaGhali98 4 years ago
parent 8980f6f440
commit 7962d9b1be

@ -252,8 +252,12 @@ class PatientReferralViewModel extends BaseViewModel {
int priority,
String referralDate,
String remarks,
String ext}) async {
setState(ViewState.Busy);
String ext,
bool isLocalBusy = false}) async {
if(isLocalBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
await _referralService.referralPatient(
patientID: patient.patientId,
roomID: patient.roomId,

@ -4,8 +4,9 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/special_lab_result_details_page.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';

@ -5,14 +5,12 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result_page.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';

@ -1,8 +1,8 @@
import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';

@ -5,13 +5,12 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_details_page.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';

@ -50,6 +50,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
String clinicError;
String doctorError;
String frequencyError;
String remarkError;
stt.SpeechToText speech = stt.SpeechToText();
var recognizedWord;
var event = RobotProvider();
@ -127,15 +128,15 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
Widget build(BuildContext context) {
dynamic priority1 = {
"ParameterCode": 0,
"ParameterCode": 1,
"Description": TranslationBase.of(context).veryUrgent.toUpperCase(),
};
dynamic priority2 = {
"ParameterCode": 1,
"ParameterCode": 2,
'Description': TranslationBase.of(context).urgent.toUpperCase(),
};
dynamic priority3 = {
"ParameterCode": 2,
"ParameterCode": 0,
'Description': TranslationBase.of(context).routine.toUpperCase(),
};
@ -506,6 +507,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
Stack(
children: [
AppTextFieldCustom(
validationError: remarkError,
hintText: "Remarks",
controller: _remarksController,
inputType: TextInputType.multiline,
@ -554,77 +556,91 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
SizedBox(
height: 10,
),
],
)
),
],
),
),
),
bottomSheet: BottomSheetDialogButton(
label: "${TranslationBase.of(context).refer}",
onTap: () async {
setState(() {
if (_referTo == null) {
branchError =
TranslationBase.of(context).fieldRequired;
} else {
branchError = null;
}
if (_selectedBranch == null) {
hospitalError =
TranslationBase.of(context).fieldRequired;
} else {
hospitalError = null;
}
if (_selectedClinic == null) {
clinicError =
TranslationBase.of(context).fieldRequired;
} else {
clinicError = null;
}
if (_selectedDoctor == null) {
doctorError =
TranslationBase.of(context).fieldRequired;
} else {
doctorError = null;
bottomSheet:
model.state != ViewState.Idle
? Container(
height: 0,
)
:BottomSheetDialogButton(
label: "${TranslationBase.of(context).refer}",
onTap: () async {
setState(() {
if (_referTo == null) {
branchError =
TranslationBase.of(context).fieldRequired;
} else {
branchError = null;
}
if (_selectedBranch == null) {
hospitalError =
TranslationBase.of(context).fieldRequired;
} else {
hospitalError = null;
}
if (_selectedClinic == null) {
clinicError =
TranslationBase.of(context).fieldRequired;
} else {
clinicError = null;
}
if (_selectedDoctor == null) {
doctorError =
TranslationBase.of(context).fieldRequired;
} else {
doctorError = null;
}
if (_selectedFrequency == null) {
frequencyError =
TranslationBase.of(context).fieldRequired;
} else {
frequencyError = null;
}
if (_selectedPriority == null) {
remarkError =
TranslationBase.of(context).fieldRequired;
} else {
remarkError = null;
}
});
if (_selectedFrequency == null ||
_selectedPriority == null ||
_selectedBranch == null ||
_selectedClinic == null ||
_selectedDoctor == null ||
_remarksController.text == null ||
_extController.text == null) return;
{
GifLoaderDialogUtils.showMyDialog(context);
await model.makeInPatientReferral(
patient: patient,
projectID: _selectedBranch['facilityId'],
clinicID: _selectedClinic['ClinicID'],
doctorID: _selectedDoctor['DoctorID'],
frequencyCode:
_selectedFrequency['ParameterCode'],
ext: _extController.text,
remarks: _remarksController.text,
priority: _activePriority,
referralDate: appointmentDate,
isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal)
DrAppToastMsg.showErrorToast(model.error);
else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsg);
Navigator.pop(context);
}
}
if (_selectedFrequency == null) {
frequencyError =
TranslationBase.of(context).fieldRequired;
} else {
frequencyError = null;
}
});
if (_selectedFrequency == null ||
_selectedBranch == null ||
_selectedClinic == null ||
_selectedDoctor == null ||
_remarksController.text == null ||
_extController.text == null) return;
{
await model.makeInPatientReferral(
patient: patient,
projectID: _selectedBranch['facilityId'],
clinicID: _selectedClinic['ClinicID'],
doctorID: _selectedDoctor['DoctorID'],
frequencyCode:
_selectedFrequency['ParameterCode'],
ext: _extController.text,
remarks: _remarksController.text,
priority: _activePriority,
referralDate: appointmentDate);
if (model.state == ViewState.ErrorLocal)
DrAppToastMsg.showErrorToast(model.error);
else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsg);
Navigator.pop(context);
}
}
},
),
},
)
),
);
}

@ -1,4 +1,3 @@
//import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
@ -6,8 +5,8 @@ import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';

Loading…
Cancel
Save