call service after accept or reject

merge-requests/953/head
Elham Rababh 4 years ago
parent 211990518f
commit a829532717

@ -44,10 +44,14 @@ class InterventionMedicationViewModel extends BaseViewModel {
}) async { }) async {
InterventionMedicationReqModel interventionMedicationReqModel = InterventionMedicationReqModel interventionMedicationReqModel =
InterventionMedicationReqModel( InterventionMedicationReqModel(
projectID: 15, //projectId, projectID: 15,
patientID: 79941, //patientId, //projectId,
fromDate: "\/Date(1488322922)\/",//AppDateUtils.convertDateToServerFormat(fromDate), patientID: 79941,
toDate: "\/Date(1635886800000)\/",//AppDateUtils.convertDateToServerFormat(toDate), //patientId,
fromDate: "\/Date(1488322922)\/",
//AppDateUtils.convertDateToServerFormat(fromDate),
toDate:
"\/Date(1635886800000)\/", //AppDateUtils.convertDateToServerFormat(toDate),
); );
hasError = false; hasError = false;
setState(ViewState.Busy); setState(ViewState.Busy);
@ -61,29 +65,39 @@ class InterventionMedicationViewModel extends BaseViewModel {
} }
} }
Future getInterventionMedicationHistory({ Future getInterventionMedicationHistory(
int projectId, {int projectId,
int patientId, int patientId,
int admissionNo, int admissionNo,
int prescriptionNo, int prescriptionNo,
int orderNo, int orderNo,
}) async { bool isBusyLocal = false}) async {
InterventionMedicationHistoryReqModel InterventionMedicationHistoryReqModel
interventionMedicationHistoryReqModel = interventionMedicationHistoryReqModel =
InterventionMedicationHistoryReqModel( InterventionMedicationHistoryReqModel(
projectID: 15, //projectId, projectID: 15,
patientID: 79941, //patientId, //projectId,
admissionNo: 2018013900,//admissionNo, patientID: 79941,
prescriptionNo: 2045165, //prescriptionNo, //patientId,
admissionNo: 2018013900,
//admissionNo,
prescriptionNo: 2045165,
//prescriptionNo,
orderNo: 1171570, //orderNo, orderNo: 1171570, //orderNo,
); );
hasError = false; hasError = false;
if (isBusyLocal)
setState(ViewState.Busy);
else
setState(ViewState.Busy); setState(ViewState.Busy);
await _interventionMedicationService.getInterventionMedicationHistory( await _interventionMedicationService.getInterventionMedicationHistory(
interventionMedicationHistoryReqModel: interventionMedicationHistoryReqModel:
interventionMedicationHistoryReqModel); interventionMedicationHistoryReqModel);
if (_interventionMedicationService.hasError) { if (_interventionMedicationService.hasError) {
error = _interventionMedicationService.error; error = _interventionMedicationService.error;
if (isBusyLocal)
setState(ViewState.ErrorLocal);
else
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
setState(ViewState.Idle); setState(ViewState.Idle);
@ -101,15 +115,21 @@ class InterventionMedicationViewModel extends BaseViewModel {
int interventionStatus, int interventionStatus,
}) async { }) async {
AcceptOrRejectReqModel acceptOrRejectReqModel = AcceptOrRejectReqModel( AcceptOrRejectReqModel acceptOrRejectReqModel = AcceptOrRejectReqModel(
projectID: 15, //projectId, projectID: 15,
patientID: 79941, //patientID, //projectId,
admissionNo: 2018013900, //admissionNo, patientID: 79941,
prescriptionNo: 2045165, //prescriptionNo, //patientID,
orderNo: 1171570, //orderNo, admissionNo: 2018013900,
//admissionNo,
prescriptionNo: 2045165,
//prescriptionNo,
orderNo: 1171570,
//orderNo,
accessLevel: 4, accessLevel: 4,
lineItemNo: 1, lineItemNo: 1,
remarks: remarks, remarks: remarks,
memberID: 2804, //memberId, memberID: 2804,
//memberId,
interventionStatus: interventionStatus, interventionStatus: interventionStatus,
); );
hasError = false; hasError = false;

@ -234,10 +234,17 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
admissionNo: model.allInterventionHistoryList[index].admissionNo, admissionNo: model.allInterventionHistoryList[index].admissionNo,
interventionStatus: 1, interventionStatus: 1,
); );
GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal) { if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
projectId: widget.interventionMedication.projectID,
admissionNo: widget.interventionMedication.admissionNo,
prescriptionNo: widget.interventionMedication.prescriptionNo,
orderNo: widget.interventionMedication.orderNo,);
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
"Has been Successfully accepted"); "Has been Successfully accepted");
} }
@ -283,10 +290,18 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
admissionNo: model.allInterventionHistoryList[index].admissionNo, admissionNo: model.allInterventionHistoryList[index].admissionNo,
interventionStatus: 2 interventionStatus: 2
); );
GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal) { if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
projectId: widget.interventionMedication.projectID,
admissionNo: widget.interventionMedication.admissionNo,
prescriptionNo: widget.interventionMedication.prescriptionNo,
orderNo: widget.interventionMedication.orderNo,);
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
"Has been Successfully Rejected"); "Has been Successfully Rejected");
} }

Loading…
Cancel
Save