|
|
|
|
@ -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,41 +52,40 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientRegistrationViewModel>(
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
margin: EdgeInsets.all(16.0),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
"Please enter mobile number or Identification number",
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.2,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Country",
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: countryError,
|
|
|
|
|
dropDownText: _selectedCountry != null
|
|
|
|
|
? _selectedCountry['nameEn']
|
|
|
|
|
: "Saudi Arabia",
|
|
|
|
|
enabled: false,
|
|
|
|
|
/*onClick: model.dietTypesList != null && model.dietTypesList.length > 0
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
baseViewModel: widget.model,
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
margin: EdgeInsets.all(16.0),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
"Please enter mobile number or Identification number",
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.2,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Country",
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: countryError,
|
|
|
|
|
dropDownText: _selectedCountry != null
|
|
|
|
|
? _selectedCountry['nameEn']
|
|
|
|
|
: "Saudi Arabia",
|
|
|
|
|
enabled: false,
|
|
|
|
|
/*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,185 +96,184 @@ 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");
|
|
|
|
|
}
|
|
|
|
|
},*/
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.3,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.3,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Code",
|
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
|
controller: _phoneCode,
|
|
|
|
|
validationError: phoneError,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
// width: MediaQuery.of(context).size.width*0.7,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Code",
|
|
|
|
|
hintText: "Phone Number",
|
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
|
controller: _phoneCode,
|
|
|
|
|
controller: _phoneController,
|
|
|
|
|
validationError: phoneError,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
// width: MediaQuery.of(context).size.width*0.7,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Phone Number",
|
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
|
controller: _phoneController,
|
|
|
|
|
validationError: phoneError,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "ID Number",
|
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
|
controller: _idController,
|
|
|
|
|
validationError: idError,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"Calender",
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Birthdate",
|
|
|
|
|
dropDownText: _birthDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: birthdateError,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
onPressed: null,
|
|
|
|
|
),
|
|
|
|
|
onClick: () {
|
|
|
|
|
if (_birthDate == null) {
|
|
|
|
|
_birthDate = DateTime.now();
|
|
|
|
|
}
|
|
|
|
|
_selectDate(context, _birthDate, (picked) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_birthDate = picked;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "ID Number",
|
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
|
controller: _idController,
|
|
|
|
|
validationError: idError,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"Calender",
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: "Birthdate",
|
|
|
|
|
dropDownText: _birthDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: birthdateError,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
onPressed: null,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
onClick: () {
|
|
|
|
|
if (_birthDate == null) {
|
|
|
|
|
_birthDate = DateTime.now();
|
|
|
|
|
}
|
|
|
|
|
_selectDate(context, _birthDate, (picked) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_birthDate = picked;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: 60,
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).cancel,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
borderColor: Color(0xFFeaeaea),
|
|
|
|
|
color: Color(0xFFeaeaea),
|
|
|
|
|
fontColor: Colors.black,
|
|
|
|
|
fontSize: 2.2,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: 60,
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).cancel,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
borderColor: Color(0xFFeaeaea),
|
|
|
|
|
color: Color(0xFFeaeaea),
|
|
|
|
|
fontColor: Colors.black,
|
|
|
|
|
fontSize: 2.2,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).next,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
|
color: Color(0xFFB8382B),
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
fontSize: 2.0,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
CheckPatientForRegistrationModel
|
|
|
|
|
checkPatientForRegistrationModel =
|
|
|
|
|
CheckPatientForRegistrationModel(
|
|
|
|
|
patientIdentificationID:
|
|
|
|
|
int.parse(_idController.text),
|
|
|
|
|
patientMobileNumber:
|
|
|
|
|
int.parse(_phoneController.text),
|
|
|
|
|
zipCode: _phoneCode.text,
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
patientID: 0,
|
|
|
|
|
isRegister: false,
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
dOB:
|
|
|
|
|
"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}");
|
|
|
|
|
await model.checkPatientForRegistration(
|
|
|
|
|
checkPatientForRegistrationModel);
|
|
|
|
|
GetPatientInfoRequestModel getPatientInfoRequestModel =
|
|
|
|
|
GetPatientInfoRequestModel(
|
|
|
|
|
//TODO Elham* this return the static to dynamic
|
|
|
|
|
patientIdentificationID:"1062938285", //_idController.text,
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
sessionID: null,
|
|
|
|
|
dOB:"31/07/1988",//"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}"
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).next,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
|
color: Color(0xFFB8382B),
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
fontSize: 2.0,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
CheckPatientForRegistrationModel
|
|
|
|
|
checkPatientForRegistrationModel =
|
|
|
|
|
CheckPatientForRegistrationModel(
|
|
|
|
|
patientIdentificationID:
|
|
|
|
|
int.parse(_idController.text),
|
|
|
|
|
patientMobileNumber:
|
|
|
|
|
int.parse(_phoneController.text),
|
|
|
|
|
zipCode: _phoneCode.text,
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
patientID: 0,
|
|
|
|
|
isRegister: false,
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
dOB:
|
|
|
|
|
"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}");
|
|
|
|
|
await widget.model.checkPatientForRegistration(
|
|
|
|
|
checkPatientForRegistrationModel);
|
|
|
|
|
GetPatientInfoRequestModel getPatientInfoRequestModel =
|
|
|
|
|
GetPatientInfoRequestModel(
|
|
|
|
|
//TODO Elham* this return the static to dynamic
|
|
|
|
|
patientIdentificationID:"1062938285", //_idController.text,
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
sessionID: null,
|
|
|
|
|
dOB:"31/07/1988",//"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}"
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
await model.getPatientInfo(getPatientInfoRequestModel);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
widget.changePageViewIndex(1);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
await widget.model.getPatientInfo(getPatientInfoRequestModel);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(widget.model.error);
|
|
|
|
|
} else {
|
|
|
|
|
widget.changePageViewIndex(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|