update procedure

merge-requests/994/head
Elham Rababh 4 years ago
parent 33b8d6d78d
commit 5422472ccc

@ -222,9 +222,9 @@ class ProcedureViewModel extends BaseViewModel {
Future updateProcedure( Future updateProcedure(
{UpdateProcedureRequestModel updateProcedureRequestModel, {UpdateProcedureRequestModel updateProcedureRequestModel,
int mrn}) async { int mrn, bool isLocalBusy = false}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); if(isLocalBusy)setState(ViewState.BusyLocal); else
setState(ViewState.Busy); setState(ViewState.Busy);
await _procedureService.updateProcedure(updateProcedureRequestModel); await _procedureService.updateProcedure(updateProcedureRequestModel);
if (_procedureService.hasError) { if (_procedureService.hasError) {
@ -549,6 +549,7 @@ class ProcedureViewModel extends BaseViewModel {
List<ProcedureTempleteModel> masterList, List<ProcedureTempleteModel> masterList,
List<ProcedureTempleteModel> items) { List<ProcedureTempleteModel> items) {
List<ProcedureTempleteModel> dummySearchList = List(); List<ProcedureTempleteModel> dummySearchList = List();
if(masterList!= null)
dummySearchList.addAll(masterList); dummySearchList.addAll(masterList);
if (query.isNotEmpty) { if (query.isNotEmpty) {
List<ProcedureTempleteModel> dummyListData = List(); List<ProcedureTempleteModel> dummyListData = List();

@ -123,9 +123,12 @@ class ProcedureScreen extends StatelessWidget {
procedureId: model.procedureList[0] procedureId: model.procedureList[0]
.entityList[index].procedureId, .entityList[index].procedureId,
limetNo: model.procedureList[0] limetNo: model.procedureList[0]
.entityList[index].lineItemNo); .entityList[index].lineItemNo,
);
}, },
patient: patient, patient: patient,
doctorID: model?.doctorProfile?.doctorID, doctorID: model?.doctorProfile?.doctorID,
); );
}), }),

@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_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/utils/utils.dart';
@ -38,18 +38,19 @@ void updateProcedureForm(context,
remarks: remarks, remarks: remarks,
remarksController: remarksController, remarksController: remarksController,
patient: patient, patient: patient,
model: model, previousModel: model,
procedureId: procedureId, procedureId: procedureId,
categoryId: categoreId, categoryId: categoreId,
orderNo: orderNo, orderNo: orderNo,
limetNo: limetNo, limetNo: limetNo,
selectedType: int.parse(orderType),
); );
}); });
} }
class UpdateProcedureWidget extends StatefulWidget { class UpdateProcedureWidget extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final ProcedureViewModel model; final ProcedureViewModel previousModel;
final String procedureName; final String procedureName;
final String remarks; final String remarks;
final TextEditingController remarksController; final TextEditingController remarksController;
@ -57,9 +58,11 @@ class UpdateProcedureWidget extends StatefulWidget {
final String categoryId; final String categoryId;
final int orderNo; final int orderNo;
final int limetNo; final int limetNo;
int selectedType;
UpdateProcedureWidget( UpdateProcedureWidget(
{this.model, {this.previousModel,
this.procedureName, this.procedureName,
this.remarks, this.remarks,
this.remarksController, this.remarksController,
@ -67,18 +70,17 @@ class UpdateProcedureWidget extends StatefulWidget {
this.procedureId, this.procedureId,
this.categoryId, this.categoryId,
this.orderNo, this.orderNo,
this.limetNo}); this.limetNo, this.selectedType});
@override @override
_UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState();
} }
class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> { class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
int selectedType = 0;
setSelectedType(int val) { setSelectedType(int val) {
setState(() { setState(() {
selectedType = val; widget.selectedType = val;
}); });
} }
@ -93,102 +95,99 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
/// TODO Roaa Add translation and make sure it working fine /// TODO Roaa Add translation and make sure it working fine
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder(builder: return BaseView<ProcedureViewModel>(
(BuildContext context, StateSetter setState /*You can rename this!*/) { onModelReady: (model) => model.getCategory(),
return BaseView<ProcedureViewModel>( builder:
onModelReady: (model) => model.getCategory(), (BuildContext context, ProcedureViewModel _model, Widget child) =>
builder: AppScaffold(
(BuildContext context, ProcedureViewModel model, Widget child) => baseViewModel: widget.previousModel,
AppScaffold( isShowAppBar: true,
baseViewModel: model, appBar: BottomSheetTitle(title: "Update Procedure"),
isShowAppBar: true, body: SingleChildScrollView(
appBar: PatientSearchHeader(title: "Update Procedure"), child: Container(
body: SingleChildScrollView( height: MediaQuery.of(context).size.height * 0.9,
child: Container( child: Form(
height: MediaQuery.of(context).size.height * 0.9, child: Padding(
child: Form( padding:
child: Padding( EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
padding: child: Column(
EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, AppText(
children: [ Utils.convertToTitleCase(widget.procedureName),
AppText( fontWeight: FontWeight.w700,
widget.procedureName.toUpperCase(), ),
fontWeight: FontWeight.w700, SizedBox(
), height: 30.0,
SizedBox( ),
height: 30.0, Container(
), child: Row(
Container( children: [
child: Row( AppText(TranslationBase.of(context).orderType),
children: [ Radio(
AppText(TranslationBase.of(context).orderType), activeColor: AppGlobal.appRedColor,
Radio( value: 0,
activeColor: AppGlobal.appRedColor, groupValue: widget.selectedType,
value: 0, onChanged: (value) {
groupValue: selectedType, setSelectedType(value);
onChanged: (value) { },
setSelectedType(value); ),
}, Text('routine'),
), Radio(
Text('routine'), activeColor: AppGlobal.appRedColor,
Radio( groupValue: widget.selectedType,
activeColor: AppGlobal.appRedColor, value: 1,
groupValue: selectedType, onChanged: (value) {
value: 1, setSelectedType(value);
onChanged: (value) { },
setSelectedType(value); ),
}, Text(TranslationBase.of(context).urgent),
), ],
Text(TranslationBase.of(context).urgent), ),
], ),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: TextFields(
fontSize: 15.0,
controller: widget.remarksController,
hintText: widget.remarksController.text.isEmpty
? 'No Remarks Added'
: '',
maxLines: 3,
minLines: 2,
onChanged: (value) {},
),
), ),
), SizedBox(
SizedBox( height: 70.0,
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: TextFields(
fontSize: 15.0,
controller: widget.remarksController,
hintText: widget.remarksController.text.isEmpty
? 'No Remarks Added'
: '',
maxLines: 3,
minLines: 2,
onChanged: (value) {},
), ),
), ],
SizedBox( ),
height: 70.0,
),
],
), ),
), )),
)), ),
bottomSheet: CustomBottomSheetContainer(
label: TranslationBase.of(context).updateProcedure,
onTap: () => updateProcedure(
lineItemNo: widget.limetNo,
orderNo: widget.orderNo,
orderType: widget.selectedType.toString(),
categoryId: widget.categoryId,
procedureId: widget.procedureId,
entityList: entityList,
patient: widget.patient,
model: widget.previousModel,
remarks: widget.remarksController.text),
),
), ),
bottomSheet: CustomBottomSheetContainer( );
label: TranslationBase.of(context).updateProcedure.toUpperCase(),
onTap: () => updateProcedure(
lineItemNo: widget.limetNo,
orderNo: widget.orderNo,
orderType: selectedType.toString(),
categoryId: widget.categoryId,
procedureId: widget.procedureId,
entityList: entityList,
patient: widget.patient,
model: widget.model,
remarks: widget.remarksController.text),
),
),
);
});
} }
updateProcedure( updateProcedure(
@ -231,17 +230,18 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
} }
updateProcedureReqModel.procedureDetail = controlsProcedure; updateProcedureReqModel.procedureDetail = controlsProcedure;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.updateProcedure( await widget.previousModel.updateProcedure(
updateProcedureRequestModel: updateProcedureReqModel, updateProcedureRequestModel: updateProcedureReqModel,
mrn: patient.patientMRN); mrn: patient.patientMRN, isLocalBusy: true);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) { } else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been updated'); DrAppToastMsg.showSuccesToast('procedure has been updated');
await model.getProcedure(mrn: patient.patientMRN, isLocalBusy: true); await widget.previousModel.getProcedure(mrn: patient.patientMRN, isLocalBusy: true);
} Navigator.of(context).pop();
}
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
} }

Loading…
Cancel
Save