Merge branch 'tasks-translation' into 'development'

Tasks translation

See merge request Cloud_Solution/doctor_app_flutter!269
merge-requests/270/merge
Mohammad Aljammal 5 years ago
commit 7aefcaa354

@ -65,17 +65,17 @@ class PrescriptionService extends BaseService {
Future getMedicationList() async { Future getMedicationList() async {
hasError = false; hasError = false;
_drugRequestModel.search =[""]; _drugRequestModel.search = [""];
await baseAppClient.post(SEARCH_DRUG, await baseAppClient.post(SEARCH_DRUG,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
allMedicationList = []; allMedicationList = [];
response['MedicationList']['entityList'].forEach((v) { response['MedicationList']['entityList'].forEach((v) {
allMedicationList.add(GetMedicationResponseModel.fromJson(v)); allMedicationList.add(GetMedicationResponseModel.fromJson(v));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: _drugRequestModel.toJson()); }, body: _drugRequestModel.toJson());
} }
Future postPrescription( Future postPrescription(

@ -12,8 +12,8 @@ class MedicineViewModel extends BaseViewModel {
get pharmaciesList => _medicineService.pharmaciesList; get pharmaciesList => _medicineService.pharmaciesList;
PrescriptionService _prescriptionService = locator<PrescriptionService>(); PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList; List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
Future getMedicineItem(String itemName) async { Future getMedicineItem(String itemName) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -24,6 +24,7 @@ class MedicineViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getMedicationList() async { Future getMedicationList() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.getMedicationList(); await _prescriptionService.getMedicationList();

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_model.dart';
import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart';
@ -13,11 +14,13 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-
class PrescriptionViewModel extends BaseViewModel { class PrescriptionViewModel extends BaseViewModel {
bool hasError = false; bool hasError = false;
PrescriptionService _prescriptionService = locator<PrescriptionService>(); PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<PrescriptionModel> get prescriptionList => List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList; _prescriptionService.prescriptionList;
List<dynamic> get drugsList => _prescriptionService.doctorsList; List<dynamic> get drugsList => _prescriptionService.doctorsList;
List<dynamic> get allMedicationList => _prescriptionService.allMedicationList; //List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
Future getPrescription({int mrn}) async { Future getPrescription({int mrn}) async {
hasError = false; hasError = false;
@ -46,6 +49,16 @@ class PrescriptionViewModel extends BaseViewModel {
} }
} }
Future getMedicationList() async {
setState(ViewState.Busy);
await _prescriptionService.getMedicationList();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future updatePrescription( Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async { PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false; hasError = false;

@ -61,6 +61,7 @@ class ProcedureViewModel extends BaseViewModel {
if (_procedureService.hasError) { if (_procedureService.hasError) {
error = _procedureService.error; error = _procedureService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
await getProcedure(mrn: mrn);
} else { } else {
await getProcedure(mrn: mrn); await getProcedure(mrn: mrn);
setState(ViewState.Idle); setState(ViewState.Idle);

@ -638,7 +638,8 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
.medicalFileList[ .medicalFileList[
0] 0]
.entityList[0] .entityList[0]
.timelines[0] .timelines[
encounterNumber]
.timeLineEvents[0] .timeLineEvents[0]
.consulations[0] .consulations[0]
.lstProcedure[ .lstProcedure[

@ -1,9 +1,12 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -16,6 +19,7 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart'; import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
@ -23,6 +27,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -105,6 +110,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController instructionController = TextEditingController(); TextEditingController instructionController = TextEditingController();
DateTime selectedDate; DateTime selectedDate;
dynamic selectedDrug; dynamic selectedDrug;
GetMedicationResponseModel _selectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
@ -343,11 +351,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// final routeArgs = ModalRoute.of(context).settings.arguments as Map; // final routeArgs = ModalRoute.of(context).settings.arguments as Map;
// patient = routeArgs['patient']; // patient = routeArgs['patient'];
return BaseView<PrescriptionViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) => model.getDrugs(drugName: textSeartch), onModelReady: (model) async {
builder: await model.getMedicationList();
(BuildContext context, PrescriptionViewModel model, Widget child) => },
NetworkBaseView( builder: (BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: DraggableScrollableSheet( child: DraggableScrollableSheet(
initialChildSize: 0.90, initialChildSize: 0.90,
@ -378,152 +387,73 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
//mainAxisAlignment: MainAxisAlignment.end, //mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Container( Container(
height: screenSize.height * 0.070, height: MediaQuery.of(context).size.height *
0.070,
child: InkWell( child: InkWell(
onTap: model.drugsList != null && onTap: model.allMedicationList != null
model.drugsList.length > 0
? () { ? () {
return drugDialog = setState(() {
ListSelectDialog( _selectedMedication = null;
list: model.drugsList, });
attributeName: 'GenericName',
attributeValueId: 'ItemId',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
selectedDrug = selectedValue;
});
},
/* searchWidget: Row(
children: [
Expanded(
child: TextField(
decoration: Helpers
.textFieldSelectorDecoration(
TranslationBase.of(
context)
.search,
searchController.text !=
null &&
searchController
.text !=
""
? searchController
.text
: null,
false,
),
onChanged: (String str) {
textSeartch = str;
},
controller:
searchController,
enabled: true,
),
),
Container(
child: InkWell(
child: Icon(
Icons.search,
color: Colors.black,
),
onTap: () async {
Navigator.of(context)
.pop();
await searchMedicine(
context,
model,
textSeartch);
showDialog(
barrierDismissible:
false,
context: context,
builder: (BuildContext
context) {
return drugDialog;
},
);
},
),
margin:
EdgeInsets.symmetric(
horizontal: 8),
)
],
),*/
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return drugDialog;
},
);
} }
: null, : null,
child: Row( child: _selectedMedication == null
children: [ ? AutoCompleteTextField<
Expanded( GetMedicationResponseModel>(
child: TextField( decoration:
decoration: Helpers textFieldSelectorDecoration(
.textFieldSelectorDecoration(
TranslationBase.of(context) TranslationBase.of(context)
.search, .searchMedicineNameHere,
searchController.text != null && _selectedMedication != null
searchController.text != ? _selectedMedication
"" .genericName
? searchController.text
: null, : null,
false, true,
), ),
onChanged: (String str) { itemSubmitted: (item) => setState(
textSeartch = str; () =>
}, _selectedMedication = item),
controller: searchController, key: key,
enabled: true, suggestions:
), model.allMedicationList,
), itemBuilder: (context,
Container( suggestion) =>
child: InkWell( new Padding(
child: Icon( child: Texts(suggestion
Icons.search, .description +
color: Colors.black, '/' +
suggestion.genericName),
padding:
EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.genericName
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(
input.toLowerCase()),
)
: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicineNameHere,
_selectedMedication != null
? _selectedMedication
.description +
('${_selectedMedication.genericName}')
: null,
true,
), ),
onTap: () async { enabled: false,
// Navigator.of(context)
// .pop();
await searchMedicine(
context, model, textSeartch);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return drugDialog;
},
);
},
), ),
margin: EdgeInsets.symmetric(
horizontal: 8),
)
],
), /*TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicine,
selectedDrug != null
? selectedDrug['GenericName']
: null,
true,
suffixIcon: Icon(
Icons.search,
color: Colors.black,
)),
enabled: true,
),*/
), ),
), ),
SizedBox( SizedBox(
@ -603,47 +533,21 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container( Container(
width: width:
MediaQuery.of(context).size.width * MediaQuery.of(context).size.width *
0.5, 0.650,
child: InkWell( child: TextFields(
onTap: strengthList != null hintText: TranslationBase.of(context)
? () { .strength,
ListSelectDialog dialog = controller: strengthController,
ListSelectDialog( keyboardType: TextInputType.number,
list: strengthList, validator: (value) {
attributeName: 'name', if (value.isEmpty &&
attributeValueId: 'id', strengthController.text.length >
okText: TranslationBase.of( 4)
context) return TranslationBase.of(context)
.ok, .emptyMessage;
okFunction: else
(selectedValue) { return null;
setState(() { },
strength =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.strength,
strength != null
? strength['name']
: null,
true),
enabled: false,
),
), ),
), ),
SizedBox( SizedBox(
@ -652,7 +556,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container( Container(
width: width:
MediaQuery.of(context).size.width * MediaQuery.of(context).size.width *
0.40, 0.250,
child: InkWell( child: InkWell(
onTap: unitsList != null onTap: unitsList != null
? () { ? () {
@ -965,8 +869,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
indication == null || indication == null ||
doseTime == null || doseTime == null ||
duration == null || duration == null ||
selectedDrug == null || selectedDate == null ||
selectedDate == null) { units == null ||
_selectedMedication == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Please Fill All Fields"); "Please Fill All Fields");
return; return;
@ -974,7 +879,32 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
if (formKey.currentState.validate()) { if (formKey.currentState.validate()) {
Navigator.pop(context); Navigator.pop(context);
openDrugToDrug(); {
postProcedure(
dose: strengthController.text,
doseUnit:
units['id'].toString(),
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency: frequency['id']
.toString(),
route: route['id'].toString(),
drugId: _selectedMedication
.itemId
.toString(),
strength:
strengthController.text,
indication:
indicationController.text,
instruction:
instructionController
.text,
doseTime: selectedDate);
}
} }
{ {
// Navigator.push( // Navigator.push(
@ -1070,7 +1000,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
title: TranslationBase.of(context).addMedication, title: TranslationBase.of(context).addMedication,
onPressed: () { onPressed: () {
postProcedure( postProcedure(
dose: strength['id'].toString(), dose: strengthController.text,
doseUnit: units['id'].toString(), doseUnit: units['id'].toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTime['id'].toString(), doseTimeIn: doseTime['id'].toString(),
@ -1079,7 +1009,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
frequency: frequency['id'].toString(), frequency: frequency['id'].toString(),
route: route['id'].toString(), route: route['id'].toString(),
drugId: selectedDrug['ItemId'].toString(), drugId: selectedDrug['ItemId'].toString(),
strength: strength['id'].toString(), strength: strengthController.text,
indication: indicationController.text, indication: indicationController.text,
instruction: instructionController.text, instruction: instructionController.text,
doseTime: selectedDate); doseTime: selectedDate);

@ -754,8 +754,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
route = selectedValue; route = selectedValue;
}); });
if (route == null) { if (route == null) {
helpers route = route['id'];
.showErrorToast('plase fill');
} }
}, },
); );
@ -904,10 +903,15 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
model: model, model: model,
drugId: drugId, drugId: drugId,
remarks: remarksController.text, remarks: remarksController.text,
route: route['id'].toString(), route: route != null
frequency: ? route['id'].toString()
frequencyUpdate['id'].toString(), : rouat,
dose: doseTime['id'].toString(), frequency: frequencyUpdate != null
? frequencyUpdate['id'].toString()
: frequency,
dose: doseTime != null
? doseTime['id'].toString()
: dose,
enteredRemarks: enteredRemarks); enteredRemarks: enteredRemarks);
Navigator.pop(context); Navigator.pop(context);
}, },

Loading…
Cancel
Save