child Vaccines add new child modified
parent
cb2a78e2ee
commit
67e3a13a95
@ -0,0 +1,165 @@
|
|||||||
|
class CreateNewUser_New {
|
||||||
|
Null date;
|
||||||
|
int languageID;
|
||||||
|
int serviceName;
|
||||||
|
Null time;
|
||||||
|
Null androidLink;
|
||||||
|
Null authenticationTokenID;
|
||||||
|
Null data;
|
||||||
|
bool dataw;
|
||||||
|
int dietType;
|
||||||
|
Null errorCode;
|
||||||
|
Null errorEndUserMessage;
|
||||||
|
Null errorEndUserMessageN;
|
||||||
|
Null errorMessage;
|
||||||
|
int errorType;
|
||||||
|
int foodCategory;
|
||||||
|
Null iOSLink;
|
||||||
|
bool isAuthenticated;
|
||||||
|
int mealOrderStatus;
|
||||||
|
int mealType;
|
||||||
|
int messageStatus;
|
||||||
|
int numberOfResultRecords;
|
||||||
|
Null patientBlodType;
|
||||||
|
Null successMsg;
|
||||||
|
Null successMsgN;
|
||||||
|
Null htmlResult;
|
||||||
|
bool isHMGPatient;
|
||||||
|
bool isRegister;
|
||||||
|
bool isSendSMS;
|
||||||
|
Null listBabyInformationModel;
|
||||||
|
Null listBabyNeedReminderModel;
|
||||||
|
Null listCreateVaccinationTableModel;
|
||||||
|
Null listHisPatientModel;
|
||||||
|
Null listUserInformationModel;
|
||||||
|
Null listUserInformationModelNew;
|
||||||
|
Null listVaccinationTableModel;
|
||||||
|
Null tokinID;
|
||||||
|
int userID;
|
||||||
|
Null verificationCode;
|
||||||
|
|
||||||
|
CreateNewUser_New(
|
||||||
|
{this.date,
|
||||||
|
this.languageID,
|
||||||
|
this.serviceName,
|
||||||
|
this.time,
|
||||||
|
this.androidLink,
|
||||||
|
this.authenticationTokenID,
|
||||||
|
this.data,
|
||||||
|
this.dataw,
|
||||||
|
this.dietType,
|
||||||
|
this.errorCode,
|
||||||
|
this.errorEndUserMessage,
|
||||||
|
this.errorEndUserMessageN,
|
||||||
|
this.errorMessage,
|
||||||
|
this.errorType,
|
||||||
|
this.foodCategory,
|
||||||
|
this.iOSLink,
|
||||||
|
this.isAuthenticated,
|
||||||
|
this.mealOrderStatus,
|
||||||
|
this.mealType,
|
||||||
|
this.messageStatus,
|
||||||
|
this.numberOfResultRecords,
|
||||||
|
this.patientBlodType,
|
||||||
|
this.successMsg,
|
||||||
|
this.successMsgN,
|
||||||
|
this.htmlResult,
|
||||||
|
this.isHMGPatient,
|
||||||
|
this.isRegister,
|
||||||
|
this.isSendSMS,
|
||||||
|
this.listBabyInformationModel,
|
||||||
|
this.listBabyNeedReminderModel,
|
||||||
|
this.listCreateVaccinationTableModel,
|
||||||
|
this.listHisPatientModel,
|
||||||
|
this.listUserInformationModel,
|
||||||
|
this.listUserInformationModelNew,
|
||||||
|
this.listVaccinationTableModel,
|
||||||
|
this.tokinID,
|
||||||
|
this.userID,
|
||||||
|
this.verificationCode});
|
||||||
|
|
||||||
|
CreateNewUser_New.fromJson(Map<String, dynamic> json) {
|
||||||
|
date = json['Date'];
|
||||||
|
languageID = json['LanguageID'];
|
||||||
|
serviceName = json['ServiceName'];
|
||||||
|
time = json['Time'];
|
||||||
|
androidLink = json['AndroidLink'];
|
||||||
|
authenticationTokenID = json['AuthenticationTokenID'];
|
||||||
|
data = json['Data'];
|
||||||
|
dataw = json['Dataw'];
|
||||||
|
dietType = json['DietType'];
|
||||||
|
errorCode = json['ErrorCode'];
|
||||||
|
errorEndUserMessage = json['ErrorEndUserMessage'];
|
||||||
|
errorEndUserMessageN = json['ErrorEndUserMessageN'];
|
||||||
|
errorMessage = json['ErrorMessage'];
|
||||||
|
errorType = json['ErrorType'];
|
||||||
|
foodCategory = json['FoodCategory'];
|
||||||
|
iOSLink = json['IOSLink'];
|
||||||
|
isAuthenticated = json['IsAuthenticated'];
|
||||||
|
mealOrderStatus = json['MealOrderStatus'];
|
||||||
|
mealType = json['MealType'];
|
||||||
|
messageStatus = json['MessageStatus'];
|
||||||
|
numberOfResultRecords = json['NumberOfResultRecords'];
|
||||||
|
patientBlodType = json['PatientBlodType'];
|
||||||
|
successMsg = json['SuccessMsg'];
|
||||||
|
successMsgN = json['SuccessMsgN'];
|
||||||
|
htmlResult = json['HtmlResult'];
|
||||||
|
isHMGPatient = json['IsHMGPatient'];
|
||||||
|
isRegister = json['IsRegister'];
|
||||||
|
isSendSMS = json['IsSendSMS'];
|
||||||
|
listBabyInformationModel = json['List_BabyInformationModel'];
|
||||||
|
listBabyNeedReminderModel = json['List_BabyNeedReminderModel'];
|
||||||
|
listCreateVaccinationTableModel = json['List_CreateVaccinationTableModel'];
|
||||||
|
listHisPatientModel = json['List_His_PatientModel'];
|
||||||
|
listUserInformationModel = json['List_UserInformationModel'];
|
||||||
|
listUserInformationModelNew = json['List_UserInformationModel_New'];
|
||||||
|
listVaccinationTableModel = json['List_VaccinationTableModel'];
|
||||||
|
tokinID = json['TokinID'];
|
||||||
|
userID = json['UserID'];
|
||||||
|
verificationCode = json['VerificationCode'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['Date'] = this.date;
|
||||||
|
data['LanguageID'] = this.languageID;
|
||||||
|
data['ServiceName'] = this.serviceName;
|
||||||
|
data['Time'] = this.time;
|
||||||
|
data['AndroidLink'] = this.androidLink;
|
||||||
|
data['AuthenticationTokenID'] = this.authenticationTokenID;
|
||||||
|
data['Data'] = this.data;
|
||||||
|
data['Dataw'] = this.dataw;
|
||||||
|
data['DietType'] = this.dietType;
|
||||||
|
data['ErrorCode'] = this.errorCode;
|
||||||
|
data['ErrorEndUserMessage'] = this.errorEndUserMessage;
|
||||||
|
data['ErrorEndUserMessageN'] = this.errorEndUserMessageN;
|
||||||
|
data['ErrorMessage'] = this.errorMessage;
|
||||||
|
data['ErrorType'] = this.errorType;
|
||||||
|
data['FoodCategory'] = this.foodCategory;
|
||||||
|
data['IOSLink'] = this.iOSLink;
|
||||||
|
data['IsAuthenticated'] = this.isAuthenticated;
|
||||||
|
data['MealOrderStatus'] = this.mealOrderStatus;
|
||||||
|
data['MealType'] = this.mealType;
|
||||||
|
data['MessageStatus'] = this.messageStatus;
|
||||||
|
data['NumberOfResultRecords'] = this.numberOfResultRecords;
|
||||||
|
data['PatientBlodType'] = this.patientBlodType;
|
||||||
|
data['SuccessMsg'] = this.successMsg;
|
||||||
|
data['SuccessMsgN'] = this.successMsgN;
|
||||||
|
data['HtmlResult'] = this.htmlResult;
|
||||||
|
data['IsHMGPatient'] = this.isHMGPatient;
|
||||||
|
data['IsRegister'] = this.isRegister;
|
||||||
|
data['IsSendSMS'] = this.isSendSMS;
|
||||||
|
data['List_BabyInformationModel'] = this.listBabyInformationModel;
|
||||||
|
data['List_BabyNeedReminderModel'] = this.listBabyNeedReminderModel;
|
||||||
|
data['List_CreateVaccinationTableModel'] =
|
||||||
|
this.listCreateVaccinationTableModel;
|
||||||
|
data['List_His_PatientModel'] = this.listHisPatientModel;
|
||||||
|
data['List_UserInformationModel'] = this.listUserInformationModel;
|
||||||
|
data['List_UserInformationModel_New'] = this.listUserInformationModelNew;
|
||||||
|
data['List_VaccinationTableModel'] = this.listVaccinationTableModel;
|
||||||
|
data['TokinID'] = this.tokinID;
|
||||||
|
data['UserID'] = this.userID;
|
||||||
|
data['VerificationCode'] = this.verificationCode;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,26 +1,41 @@
|
|||||||
import 'package:diplomaticquarterapp/config/config.dart';
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||||
import '../base_service.dart';
|
import '../base_service.dart';
|
||||||
|
|
||||||
class CreteNewBabyService extends BaseService {
|
class CreteNewBabyService extends BaseService {
|
||||||
List<CreateNewBaby> createNewBabyModelList = List();
|
List<CreateNewBaby> createNewBabyModelList = List();
|
||||||
|
List<List_UserInformationModel> userModelList = List();
|
||||||
|
List<CreateNewUser_New> newUserModelList = List();
|
||||||
|
|
||||||
|
|
||||||
Future getCreateNewBabyOrders({ CreateNewBaby newChild}) async {
|
|
||||||
|
Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async {
|
||||||
hasError = false;
|
hasError = false;
|
||||||
|
await getUser();
|
||||||
|
Map<String, dynamic> body = Map.from(newChild.toJson());
|
||||||
|
body['CreatedBy'] = 102;
|
||||||
|
body['EditedBy'] = 102;
|
||||||
|
body['UserID'] = userID;
|
||||||
|
body['AlertBy'] = 2;
|
||||||
|
body['EmailAddress'] = user.emailAddress;
|
||||||
|
body['IsLogin'] = true;
|
||||||
|
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||||
|
body['MobileNumber'] = user.mobileNumber;
|
||||||
|
body['NationalID'] = user.nationalityID;
|
||||||
|
body['ZipCode'] = user.zipCode;
|
||||||
|
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
|
||||||
await baseAppClient.post(GET_NEWCHILD_REQUEST,
|
await baseAppClient.post(GET_NEWCHILD_REQUEST,
|
||||||
onSuccess: (dynamic response, int statusCode) {
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
createNewBabyModelList.clear();
|
var asd ="";
|
||||||
|
},
|
||||||
response['List_UserInformationModel_New'].forEach((vital) {
|
onFailure: (String error, int statusCode) {
|
||||||
createNewBabyModelList.add(
|
|
||||||
CreateNewBaby.fromJson(vital));
|
|
||||||
});
|
|
||||||
}, onFailure: (String error, int statusCode) {
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
super.error = error;
|
super.error = error;
|
||||||
}, body: newChild.toJson());
|
}, body: body);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,28 +1,36 @@
|
|||||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||||
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
|
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart';
|
||||||
|
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../base_view_model.dart';
|
import '../base_view_model.dart';
|
||||||
|
|
||||||
|
|
||||||
class AddNewChildViewModel extends BaseViewModel{
|
class AddNewChildViewModel extends BaseViewModel {
|
||||||
|
|
||||||
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
|
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
|
||||||
|
ChildVaccinesService _childVaccinesService = locator<ChildVaccinesService>();
|
||||||
|
bool isAdded = false;
|
||||||
|
///create new baby
|
||||||
List<CreateNewBaby> get creteNewBabyModelList=> _creteNewBabyService.createNewBabyModelList;
|
createNewBabyOrders({ CreateNewBaby newChild}) async {
|
||||||
getNewBabyOrders({ CreateNewBaby newChild}) async {
|
|
||||||
setState(ViewState.Busy);
|
setState(ViewState.Busy);
|
||||||
|
await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID);
|
||||||
await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild);
|
if (_creteNewBabyService.hasError) {
|
||||||
|
|
||||||
if ( _creteNewBabyService.hasError) {
|
|
||||||
error = _creteNewBabyService.error;
|
error = _creteNewBabyService.error;
|
||||||
setState(ViewState.Error);
|
setState(ViewState.Error);
|
||||||
} else
|
} else {
|
||||||
|
isAdded = true;
|
||||||
setState(ViewState.Idle);
|
setState(ViewState.Idle);
|
||||||
|
// await _childVaccinesService.getAllBabyInformationOrders();
|
||||||
|
// if (_childVaccinesService.hasError) {
|
||||||
|
// error = _childVaccinesService.error;
|
||||||
|
// setState(ViewState.Error);
|
||||||
|
// } else{
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue