|
|
|
|
@ -63,6 +63,9 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
TextEditingController middleNameAr;
|
|
|
|
|
TextEditingController lastNameAr;
|
|
|
|
|
TextEditingController emailAddressController;
|
|
|
|
|
TextEditingController langController = TextEditingController(
|
|
|
|
|
text: "English");
|
|
|
|
|
int selectedLang = 1;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -84,6 +87,8 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
///TODO Elham* add translation
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
backgroundColor: Color(0xFFF8F8F8),
|
|
|
|
|
@ -107,36 +112,44 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
children: [
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: firstNameN,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: TranslationBase.of(context).firstName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: middleNameN,
|
|
|
|
|
isEditable: middleNameN.text.isEmpty,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: TranslationBase.of(context).middleName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: lastNameN,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: TranslationBase.of(context).lastName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: firstNameAr,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: "First Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: middleNameAr,
|
|
|
|
|
isEditable: middleNameN.text.isEmpty,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: "Middle Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: lastNameAr,
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
|
hint: "Last Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
@ -294,6 +307,7 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
onClick: () {
|
|
|
|
|
openLangList(context);
|
|
|
|
|
},
|
|
|
|
|
controller: langController,
|
|
|
|
|
hintText: TranslationBase.of(context).lanEnglish,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
@ -315,6 +329,11 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
validationError:
|
|
|
|
|
emailAddressController.text.isEmpty &&
|
|
|
|
|
isSubmitted
|
|
|
|
|
? TranslationBase.of(context).emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 400,
|
|
|
|
|
@ -367,79 +386,93 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
fontSize: 2.0,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
print(widget.model
|
|
|
|
|
.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
setState(() {
|
|
|
|
|
isSubmitted = true;
|
|
|
|
|
});
|
|
|
|
|
if (isFormValid()) {
|
|
|
|
|
print(
|
|
|
|
|
widget.model.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
|
|
|
|
|
var dateFormat = DateFormat('MM/dd/yyyy').parse(
|
|
|
|
|
widget.model.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
String wellFormat =
|
|
|
|
|
"${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}";
|
|
|
|
|
print(dateFormat.toUtc().toString());
|
|
|
|
|
HijriCalendar hijriDate = HijriCalendar.fromDate(
|
|
|
|
|
new DateTime(dateFormat.year, dateFormat.month,
|
|
|
|
|
dateFormat.day));
|
|
|
|
|
// return ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dateFormat = DateFormat('MM/dd/yyyy').parse(widget.model
|
|
|
|
|
.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
String wellFormat = "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}";
|
|
|
|
|
print (dateFormat.toUtc().toString());
|
|
|
|
|
HijriCalendar hijriDate = HijriCalendar.fromDate(new DateTime(dateFormat.year, dateFormat.month, dateFormat.day));
|
|
|
|
|
// return ;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
PatientRegistrationModel patientRegistrationModel =
|
|
|
|
|
PatientRegistrationModel(
|
|
|
|
|
patientobject: Patientobject(
|
|
|
|
|
tempValue: true,
|
|
|
|
|
patientIdentificationNo: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientIdentificationID
|
|
|
|
|
.toString(),
|
|
|
|
|
patientIdentificationType: 1,
|
|
|
|
|
firstName: firstNameAr.text,
|
|
|
|
|
firstNameN: firstNameN.text,
|
|
|
|
|
lastName: lastNameAr.text,
|
|
|
|
|
lastNameN: lastNameN.text,
|
|
|
|
|
middleName: middleNameAr.text,
|
|
|
|
|
middleNameN: middleNameN.text,
|
|
|
|
|
strDateofBirth: dateFormat.toUtc().toString(),
|
|
|
|
|
dateofBirth: AppDateUtils.convertToServerFormat(
|
|
|
|
|
widget.model.getPatientInfoResponseModel
|
|
|
|
|
.dateOfBirth,
|
|
|
|
|
'MM/dd/yyyy'),
|
|
|
|
|
dateofBirthN: '$hijriDate',
|
|
|
|
|
gender: (widget.model.getPatientInfoResponseModel.gender == "M")
|
|
|
|
|
? 1
|
|
|
|
|
: 2,
|
|
|
|
|
sourceType: "1",
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
nationalityID: widget
|
|
|
|
|
.model
|
|
|
|
|
.getPatientInfoResponseModel
|
|
|
|
|
.nationalityCode,
|
|
|
|
|
//todo Elham* change static value to dynamic
|
|
|
|
|
preferredLanguage: selectedLang.toString(),
|
|
|
|
|
marital: "0",
|
|
|
|
|
eHealthIDField: widget.model
|
|
|
|
|
.getPatientInfoResponseModel.healthId,
|
|
|
|
|
emailAddress: emailAddressController.text,
|
|
|
|
|
mobileNumber: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientMobileNumber),
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==",
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: null,
|
|
|
|
|
patientMobileNumber: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientMobileNumber
|
|
|
|
|
.toString(),
|
|
|
|
|
healthId:
|
|
|
|
|
widget.model.getPatientInfoResponseModel.healthId,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
patientIdentificationID: widget.model.checkPatientForRegistrationModel.patientIdentificationID.toString(),
|
|
|
|
|
dOB: wellFormat,
|
|
|
|
|
zipCode: widget.model.checkPatientForRegistrationModel.zipCode);
|
|
|
|
|
await widget.model
|
|
|
|
|
.registrationPatient(patientRegistrationModel);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(widget.model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
"Patient added Successfully");
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
PatientRegistrationModel patientRegistrationModel =
|
|
|
|
|
PatientRegistrationModel(
|
|
|
|
|
patientobject: Patientobject(
|
|
|
|
|
tempValue: true,
|
|
|
|
|
patientIdentificationNo: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientIdentificationID
|
|
|
|
|
.toString(),
|
|
|
|
|
patientIdentificationType: 1,
|
|
|
|
|
firstName: firstNameAr.text,
|
|
|
|
|
firstNameN: firstNameN.text,
|
|
|
|
|
lastName: lastNameAr.text,
|
|
|
|
|
lastNameN: lastNameN.text,
|
|
|
|
|
middleName: middleNameAr.text,
|
|
|
|
|
middleNameN: middleNameN.text,
|
|
|
|
|
strDateofBirth: dateFormat.toUtc().toString(),
|
|
|
|
|
dateofBirth: AppDateUtils.convertToServerFormat(widget.model.getPatientInfoResponseModel.dateOfBirth, 'MM/dd/yyyy'),
|
|
|
|
|
dateofBirthN: '$hijriDate',
|
|
|
|
|
gender: (widget.model.getPatientInfoResponseModel.gender == "M")
|
|
|
|
|
? 1
|
|
|
|
|
: 2,
|
|
|
|
|
sourceType: "1",
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
nationalityID: widget
|
|
|
|
|
.model
|
|
|
|
|
.getPatientInfoResponseModel
|
|
|
|
|
.nationalityCode,
|
|
|
|
|
//todo Elham* change static value to dynamic
|
|
|
|
|
preferredLanguage: "1",
|
|
|
|
|
marital: "0",
|
|
|
|
|
eHealthIDField: widget
|
|
|
|
|
.model.getPatientInfoResponseModel.healthId,
|
|
|
|
|
emailAddress: emailAddressController.text,
|
|
|
|
|
mobileNumber: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientMobileNumber),
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==",
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: null,
|
|
|
|
|
patientMobileNumber:
|
|
|
|
|
widget.model.checkPatientForRegistrationModel.patientMobileNumber.toString(),
|
|
|
|
|
healthId: widget.model.getPatientInfoResponseModel.healthId,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
patientIdentificationID: widget.model.checkPatientForRegistrationModel.patientIdentificationID.toString(),
|
|
|
|
|
dOB:wellFormat,
|
|
|
|
|
zipCode: widget.model.checkPatientForRegistrationModel.zipCode);
|
|
|
|
|
await widget.model
|
|
|
|
|
.registrationPatient(patientRegistrationModel);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(widget.model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast("Patient added Successfully");
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -598,14 +631,16 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
onTap: () {
|
|
|
|
|
setSelectedLang(1);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Radio(
|
|
|
|
|
value: 1,
|
|
|
|
|
groupValue: 1,
|
|
|
|
|
groupValue: selectedLang,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
setSelectedLang(value);
|
|
|
|
|
},
|
|
|
|
|
activeColor: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
@ -619,14 +654,17 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
onTap: () {
|
|
|
|
|
setSelectedLang(2);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Radio(
|
|
|
|
|
value: 1,
|
|
|
|
|
groupValue: 1,
|
|
|
|
|
value: 2,
|
|
|
|
|
groupValue: selectedLang,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
setSelectedLang(value);
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
activeColor: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
@ -644,4 +682,23 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
setSelectedLang(lang){
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedLang = lang;
|
|
|
|
|
langController.text = lang==1?"English": "العربيه";
|
|
|
|
|
});
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isFormValid() {
|
|
|
|
|
if (middleNameAr.text != null &&
|
|
|
|
|
middleNameAr.text.isNotEmpty &&
|
|
|
|
|
middleNameN.text != null &&
|
|
|
|
|
middleNameN.text.isNotEmpty &&
|
|
|
|
|
emailAddressController.text != null &&
|
|
|
|
|
emailAddressController.text.isNotEmpty) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|