mock the calling the second service

merge-requests/877/head
Elham Rababh 4 years ago
parent 324f515253
commit 514fb71c51

@ -17,12 +17,11 @@ class PatientRegistrationViewModel extends BaseViewModel {
GetPatientInfoResponseModel get getPatientInfoResponseModel =>_patientRegistrationService.getPatientInfoResponseModel;
CheckPatientForRegistrationModel checkPatientForRegistrationModel ;
Future checkPatientForRegistration(
CheckPatientForRegistrationModel registrationModel) async {
checkPatientForRegistrationModel =registrationModel;
checkPatientForRegistrationModel =CheckPatientForRegistrationModel.fromJson(registrationModel.toJson());
setState(ViewState.BusyLocal);
await _patientRegistrationService
.checkPatientForRegistration(registrationModel);
@ -36,13 +35,104 @@ class PatientRegistrationViewModel extends BaseViewModel {
Future getPatientInfo(
GetPatientInfoRequestModel getPatientInfoRequestModel) async {
setState(ViewState.BusyLocal);
await _patientRegistrationService.
getPatientInfo(getPatientInfoRequestModel);
if (_patientRegistrationService.hasError) {
error = _patientRegistrationService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
/// TODO Elham* return call service when it working
_patientRegistrationService.getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson({
"Date": null,
"LanguageID": 0,
"ServiceName": 0,
"Time": null,
"AndroidLink": null,
"AuthenticationTokenID": null,
"Data": null,
"Dataw": false,
"DietType": 0,
"ErrorCode": null,
"ErrorEndUserMessage": null,
"ErrorEndUserMessageN": null,
"ErrorMessage": null,
"ErrorType": 0,
"FoodCategory": 0,
"IOSLink": null,
"IsAuthenticated": false,
"MealOrderStatus": 0,
"MealType": 0,
"MessageStatus": 1,
"NumberOfResultRecords": 0,
"PatientBlodType": null,
"SuccessMsg": null,
"SuccessMsgN": null,
"VidaUpdatedResponse": null,
"AccessTokenObject": null,
"Age": 33,
"ClientIdentifierId": null,
"CreatedBy": 0,
"DateOfBirth": "07/31/1988",
"FirstNameAr": "سفيان",
"FirstNameEn": "SUFIAN",
"Gender": "M",
"GenderAr": null,
"GenderEn": null,
"HealthId": "30000018540264",
"IdNumber": "1062938285",
"IdType": "NationalId",
"IsHijri": false,
"IsInstertedOrUpdated": 0,
"IsNull": 0,
"IsPatientExistNHIC": 0,
"IsRecordLockedByCurrentUser": false,
"LastNameAr": "عثمان",
"LastNameEn": "OTHMAN",
"List_ActiveAccessToken": null,
"MaritalStatus": "غير معروف",
"MaritalStatusCode": "U",
"NationalDateOfBirth": "18/12/1408",
"Nationality": "السعودية",
"NationalityCode": "SAU",
"Occupation": "طالب",
"PCDTransactionDataResultList": null,
"PCD_GetVidaPatientForManualVerificationList": null,
"PCD_NHIC_HMG_PatientDetailsMatchCalulationList": null,
"PCD_ReturnValue": 0,
"PatientStatus": "-",
"PlaceofBirth": "فينا",
"PractitionerStatusCode": null,
"PractitionerStatusDescAr": null,
"PractitionerStatusDescEn": null,
"RowCount": 0,
"SecondNameAr": "عبدالهادي",
"SecondNameEn": "ABDULHADI",
"ThirdNameAr": "احمد",
"ThirdNameEn": "A",
"YakeenVidaPatientDataStatisticsByPatientIdList": null,
"YakeenVidaPatientDataStatisticsList": null,
"YakeenVidaPatientDataStatisticsPrefferedList": null,
"accessToken": null,
"categoryCode": 0,
"categoryNameAr": null,
"categoryNameEn": null,
"constraintCode": 0,
"constraintNameAr": null,
"constraintNameEn": null,
"content": null,
"errorList": null,
"licenseExpiryDate": null,
"licenseIssuedDate": null,
"licenseStatusCode": null,
"licenseStatusDescAr": null,
"licenseStatusDescEn": null,
"organizations": null,
"registrationNumber": null,
"specialtyCode": 0,
"specialtyNameAr": null,
"specialtyNameEn": null
});
// await _patientRegistrationService.
// getPatientInfo(getPatientInfoRequestModel);
// if (_patientRegistrationService.hasError) {
// error = _patientRegistrationService.error;
// setState(ViewState.ErrorLocal);
// } else
// setState(ViewState.Idle);
}
Future sendActivationCodeByOTPNotificationType(

@ -56,11 +56,10 @@ class _RegisterConfirmationPatientPageState
extends State<RegisterConfirmationPatientPage> {
bool isSubmitted = false;
ProjectViewModel projectViewModel;
TextEditingController firstName = TextEditingController(text: "Elham");
TextEditingController middleName = TextEditingController(text: "Ali");
TextEditingController lastName = TextEditingController(text: "Rababah");
TextEditingController emailAddressController =
TextEditingController(text: "Elham@Rababah.com");
TextEditingController firstName;
TextEditingController middleName ;
TextEditingController lastName;
TextEditingController emailAddressController;
@override
@ -132,7 +131,7 @@ class _RegisterConfirmationPatientPageState
fontSize: 12,
color: Colors.black),
AppText(
"123456",
"${widget.model.getPatientInfoResponseModel.healthId}",
fontSize: 12,
color: Colors.grey[600],
),
@ -148,7 +147,8 @@ class _RegisterConfirmationPatientPageState
fontSize: 12,
color: Colors.black),
AppText(
"ss",
"${widget.model.getPatientInfoResponseModel.idNumber}",
fontSize: 12,
color: Colors.grey[600],
),
@ -176,7 +176,7 @@ class _RegisterConfirmationPatientPageState
fontSize: 12,
color: Colors.black),
AppText(
"Jordanian",
"${widget.model.getPatientInfoResponseModel.nationality}",
fontSize: 12,
color: Colors.grey[600],
),
@ -192,7 +192,8 @@ class _RegisterConfirmationPatientPageState
fontSize: 12,
color: Colors.black),
AppText(
"--",
"${widget.model.getPatientInfoResponseModel.occupation}",
fontSize: 12,
color: Colors.grey[600],
),
@ -220,7 +221,8 @@ class _RegisterConfirmationPatientPageState
fontSize: 12,
color: Colors.black),
AppText(
"075XXXXXX",
"${widget.model.checkPatientForRegistrationModel.patientMobileNumber}",
fontSize: 12,
color: Colors.grey[600],
),

@ -98,7 +98,7 @@ class _RegisterPatientPageState extends State<RegisterPatientPage>
},
scrollDirection: Axis.horizontal,
children: <Widget>[
RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,),
RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,model: model),
RegisterConfirmationPatientPage(model: model,),
]),

@ -22,8 +22,10 @@ import 'package:flutter/material.dart';
class RegisterSearchPatientPage extends StatefulWidget {
final Function changePageViewIndex;
final PatientRegistrationViewModel model;
const RegisterSearchPatientPage({Key key, this.changePageViewIndex})
const RegisterSearchPatientPage({Key key, this.changePageViewIndex, this.model})
: super(key: key);
@override
@ -50,9 +52,8 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<PatientRegistrationViewModel>(
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
return AppScaffold(
baseViewModel: widget.model,
isShowAppBar: false,
body: Column(
children: [
@ -82,9 +83,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
? _selectedCountry['nameEn']
: "Saudi Arabia",
enabled: false,
/*onClick: model.dietTypesList != null && model.dietTypesList.length > 0
/*onClick: widget.model.dietTypesList != null && widget.model.dietTypesList.length > 0
? () {
openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
openListDialogField('nameEn', 'id', widget.model.dietTypesList, (selectedValue) {
setState(() {
_selectedCountry = selectedValue;
});
@ -95,14 +96,14 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
await model
.getDietTypes(patient.patientId)
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.dietTypesList.length > 0) {
openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
if (widget.model.state == ViewState.Idle && widget.model.dietTypesList.length > 0) {
openListDialogField('nameEn', 'id', widget.model.dietTypesList, (selectedValue) {
setState(() {
_selectedCountry = selectedValue;
});
});
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else if (widget.model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(widget.model.error);
} else {
DrAppToastMsg.showErrorToast("Empty List");
}
@ -246,7 +247,7 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
generalid: GENERAL_ID,
dOB:
"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}");
await model.checkPatientForRegistration(
await widget.model.checkPatientForRegistration(
checkPatientForRegistrationModel);
GetPatientInfoRequestModel getPatientInfoRequestModel =
GetPatientInfoRequestModel(
@ -260,9 +261,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
dOB:"31/07/1988",//"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}"
);
await model.getPatientInfo(getPatientInfoRequestModel);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
await widget.model.getPatientInfo(getPatientInfoRequestModel);
if (widget.model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(widget.model.error);
} else {
widget.changePageViewIndex(1);
}
@ -275,7 +276,6 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
],
),
),
),
);
}

Loading…
Cancel
Save