|
|
|
@ -16,8 +16,8 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/country_textfield_custom.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/country_textfield_custom.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hijri/hijri_calendar.dart';
|
|
|
|
import 'package:jhijri/jHijri.dart';
|
|
|
|
import 'package:hijri_picker/hijri_picker.dart';
|
|
|
|
import 'package:jhijri_picker/jhijri_picker.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class RegisterSearchPatientPage extends StatefulWidget {
|
|
|
|
class RegisterSearchPatientPage extends StatefulWidget {
|
|
|
|
final Function? changePageViewIndex;
|
|
|
|
final Function? changePageViewIndex;
|
|
|
|
@ -43,18 +43,20 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
bool isSubmitted = false;
|
|
|
|
bool isSubmitted = false;
|
|
|
|
|
|
|
|
|
|
|
|
TextEditingController _phoneController =
|
|
|
|
TextEditingController _phoneController =
|
|
|
|
TextEditingController(text: "508079569");
|
|
|
|
TextEditingController(text: "508079569");
|
|
|
|
TextEditingController _phoneCode = TextEditingController(text: "966");
|
|
|
|
TextEditingController _phoneCode = TextEditingController(text: "966");
|
|
|
|
|
|
|
|
|
|
|
|
String phoneError = '';
|
|
|
|
String phoneError = '';
|
|
|
|
|
|
|
|
|
|
|
|
TextEditingController _idController =
|
|
|
|
TextEditingController _idController =
|
|
|
|
TextEditingController(text: "1062938285");
|
|
|
|
TextEditingController(text: "1062938285");
|
|
|
|
String idError = '';
|
|
|
|
String idError = '';
|
|
|
|
|
|
|
|
|
|
|
|
DateTime? _birthDateInGregorian;
|
|
|
|
DateTime? _birthDateInGregorian;
|
|
|
|
String birthdateError = '';
|
|
|
|
String birthdateError = '';
|
|
|
|
var birthDateInHijri = new HijriCalendar.now();
|
|
|
|
|
|
|
|
|
|
|
|
// var birthDateInHijri = new HijriCalendar.now();
|
|
|
|
|
|
|
|
var birthDateInHijri = JDateModel(jhijri: JHijri.now());
|
|
|
|
CalenderType calenderType = CalenderType.Gregorian;
|
|
|
|
CalenderType calenderType = CalenderType.Gregorian;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -109,7 +111,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
final screenSize = MediaQuery
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.size;
|
|
|
|
|
|
|
|
|
|
|
|
/// TODO Elham* add transaltion
|
|
|
|
/// TODO Elham* add transaltion
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,7 +131,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).askForIdentification,
|
|
|
|
TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.askForIdentification,
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 2.2,
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 2.2,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
@ -157,10 +163,15 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width: MediaQuery.of(context).size.width * 0.28,
|
|
|
|
width: MediaQuery
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.size
|
|
|
|
|
|
|
|
.width * 0.28,
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
hintText: TranslationBase.of(context).codeNo,
|
|
|
|
hintText: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.codeNo,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
controller: _phoneCode,
|
|
|
|
controller: _phoneCode,
|
|
|
|
validationError: phoneError,
|
|
|
|
validationError: phoneError,
|
|
|
|
@ -181,13 +192,17 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
// width: MediaQuery.of(context).size.width*0.7,
|
|
|
|
// width: MediaQuery.of(context).size.width*0.7,
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
hintText: TranslationBase.of(context).phoneNumber,
|
|
|
|
hintText: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.phoneNumber,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
controller: _phoneController,
|
|
|
|
controller: _phoneController,
|
|
|
|
validationError:
|
|
|
|
validationError:
|
|
|
|
_phoneController.text.isEmpty && isSubmitted
|
|
|
|
_phoneController.text.isEmpty && isSubmitted
|
|
|
|
? TranslationBase.of(context).emptyMessage
|
|
|
|
? TranslationBase
|
|
|
|
: "",
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage
|
|
|
|
|
|
|
|
: "",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -198,18 +213,24 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
hintText: TranslationBase.of(context).iDNumber,
|
|
|
|
hintText: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.iDNumber,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
inputType: TextInputType.phone,
|
|
|
|
controller: _idController,
|
|
|
|
controller: _idController,
|
|
|
|
validationError: _idController.text.isEmpty && isSubmitted
|
|
|
|
validationError: _idController.text.isEmpty && isSubmitted
|
|
|
|
? TranslationBase.of(context).emptyMessage
|
|
|
|
? TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage
|
|
|
|
: "",
|
|
|
|
: "",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 12,
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).calender,
|
|
|
|
TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.calender,
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -221,7 +242,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: RadioListTile<CalenderType>(
|
|
|
|
child: RadioListTile<CalenderType>(
|
|
|
|
title:
|
|
|
|
title:
|
|
|
|
AppText(TranslationBase.of(context).gregorian),
|
|
|
|
AppText(TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.gregorian),
|
|
|
|
value: CalenderType.Gregorian,
|
|
|
|
value: CalenderType.Gregorian,
|
|
|
|
groupValue: calenderType,
|
|
|
|
groupValue: calenderType,
|
|
|
|
onChanged: (CalenderType? value) {
|
|
|
|
onChanged: (CalenderType? value) {
|
|
|
|
@ -233,7 +256,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: RadioListTile<CalenderType>(
|
|
|
|
child: RadioListTile<CalenderType>(
|
|
|
|
title: AppText(TranslationBase.of(context).hijri),
|
|
|
|
title: AppText(TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.hijri),
|
|
|
|
value: CalenderType.Hijri,
|
|
|
|
value: CalenderType.Hijri,
|
|
|
|
groupValue: calenderType,
|
|
|
|
groupValue: calenderType,
|
|
|
|
onChanged: (CalenderType? value) {
|
|
|
|
onChanged: (CalenderType? value) {
|
|
|
|
@ -250,14 +275,18 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
hintText: TranslationBase.of(context).birthdate,
|
|
|
|
hintText: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.birthdate,
|
|
|
|
dropDownText: getBirthdate(),
|
|
|
|
dropDownText: getBirthdate(),
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
validationError:
|
|
|
|
validationError:
|
|
|
|
_birthDateInGregorian == null && isSubmitted
|
|
|
|
_birthDateInGregorian == null && isSubmitted
|
|
|
|
? TranslationBase.of(context).emptyMessage
|
|
|
|
? TranslationBase
|
|
|
|
: "",
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage
|
|
|
|
|
|
|
|
: "",
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
icon: Icon(
|
|
|
|
icon: Icon(
|
|
|
|
Icons.calendar_today,
|
|
|
|
Icons.calendar_today,
|
|
|
|
@ -270,30 +299,43 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
_birthDateInGregorian = DateTime.now();
|
|
|
|
_birthDateInGregorian = DateTime.now();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_selectDate(context, _birthDateInGregorian!,
|
|
|
|
_selectDate(context, _birthDateInGregorian!,
|
|
|
|
(dynamic selectedDate) {
|
|
|
|
(dynamic selectedDate) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
if (calenderType == CalenderType.Hijri) {
|
|
|
|
if (calenderType == CalenderType.Hijri) {
|
|
|
|
birthDateInHijri = selectedDate;
|
|
|
|
birthDateInHijri = selectedDate;
|
|
|
|
_birthDateInGregorian = HijriCalendar()
|
|
|
|
// _birthDateInGregorian = HijriCalendar()
|
|
|
|
.hijriToGregorian(
|
|
|
|
// .hijriToGregorian(
|
|
|
|
birthDateInHijri.hYear,
|
|
|
|
// birthDateInHijri.hYear,
|
|
|
|
birthDateInHijri.hMonth,
|
|
|
|
// birthDateInHijri.hMonth,
|
|
|
|
birthDateInHijri.hDay);
|
|
|
|
// birthDateInHijri.hDay);
|
|
|
|
print(_birthDateInGregorian);
|
|
|
|
//
|
|
|
|
print(birthDateInHijri);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
_birthDateInGregorian = selectedDate;
|
|
|
|
|
|
|
|
birthDateInHijri = HijriCalendar()
|
|
|
|
|
|
|
|
.gregorianToHijri(
|
|
|
|
|
|
|
|
selectedDate.year,
|
|
|
|
|
|
|
|
selectedDate.month,
|
|
|
|
|
|
|
|
selectedDate.day) as HijriCalendar;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(_birthDateInGregorian);
|
|
|
|
_birthDateInGregorian = DateTime.parse(JHijri(
|
|
|
|
print(birthDateInHijri);
|
|
|
|
fDay: birthDateInHijri.jhijri!.day,
|
|
|
|
}
|
|
|
|
fMonth: birthDateInHijri.jhijri!.month,
|
|
|
|
});
|
|
|
|
fYear: birthDateInHijri.jhijri!.year)
|
|
|
|
});
|
|
|
|
.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(_birthDateInGregorian);
|
|
|
|
|
|
|
|
print(birthDateInHijri);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
_birthDateInGregorian = selectedDate;
|
|
|
|
|
|
|
|
// birthDateInHijri = HijriCalendar()
|
|
|
|
|
|
|
|
// .gregorianToHijri(
|
|
|
|
|
|
|
|
// selectedDate.year,
|
|
|
|
|
|
|
|
// selectedDate.month,
|
|
|
|
|
|
|
|
// selectedDate.day) as HijriCalendar;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
birthDateInHijri =
|
|
|
|
|
|
|
|
JDateModel(dateTime: selectedDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(_birthDateInGregorian);
|
|
|
|
|
|
|
|
print(birthDateInHijri.dateTime);
|
|
|
|
|
|
|
|
print(birthDateInHijri.jhijri);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
@ -314,7 +356,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
child: AppButton(
|
|
|
|
child: AppButton(
|
|
|
|
title: TranslationBase.of(context).cancel,
|
|
|
|
title: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.cancel,
|
|
|
|
hasBorder: true,
|
|
|
|
hasBorder: true,
|
|
|
|
// vPadding: 12,
|
|
|
|
// vPadding: 12,
|
|
|
|
hPadding: 8,
|
|
|
|
hPadding: 8,
|
|
|
|
@ -333,7 +377,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
child: AppButton(
|
|
|
|
child: AppButton(
|
|
|
|
title: TranslationBase.of(context).next,
|
|
|
|
title: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.next,
|
|
|
|
hasBorder: true,
|
|
|
|
hasBorder: true,
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
@ -343,32 +389,36 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
isSubmitted = true;
|
|
|
|
isSubmitted = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (country == null) {
|
|
|
|
if (country == null) {
|
|
|
|
countryError = TranslationBase.of(context).fieldRequired;
|
|
|
|
countryError = TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
countryError = "";
|
|
|
|
countryError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isFormValid()) {
|
|
|
|
if (isFormValid()) {
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
CheckPatientForRegistrationModel
|
|
|
|
CheckPatientForRegistrationModel
|
|
|
|
checkPatientForRegistrationModel =
|
|
|
|
checkPatientForRegistrationModel =
|
|
|
|
CheckPatientForRegistrationModel(
|
|
|
|
CheckPatientForRegistrationModel(
|
|
|
|
patientIdentificationID:
|
|
|
|
patientIdentificationID:
|
|
|
|
int.parse(_idController.text),
|
|
|
|
int.parse(_idController.text),
|
|
|
|
patientMobileNumber:
|
|
|
|
patientMobileNumber:
|
|
|
|
int.parse(_phoneController.text),
|
|
|
|
int.parse(_phoneController.text),
|
|
|
|
zipCode: _phoneCode.text,
|
|
|
|
zipCode: _phoneCode.text,
|
|
|
|
isHijri: 0,
|
|
|
|
isHijri: 0,
|
|
|
|
patientID: 0,
|
|
|
|
patientID: 0,
|
|
|
|
isRegister: false,
|
|
|
|
isRegister: false,
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
patientOutSA: 0,
|
|
|
|
patientOutSA: 0,
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
dOB:
|
|
|
|
dOB:
|
|
|
|
"${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}");
|
|
|
|
"${AppDateUtils.convertStringToDateFormat(
|
|
|
|
|
|
|
|
_birthDateInGregorian.toString(),
|
|
|
|
|
|
|
|
"yyyy/MM/dd")}");
|
|
|
|
await widget.model!.checkPatientForRegistration(
|
|
|
|
await widget.model!.checkPatientForRegistration(
|
|
|
|
checkPatientForRegistrationModel);
|
|
|
|
checkPatientForRegistrationModel);
|
|
|
|
GetPatientInfoRequestModel getPatientInfoRequestModel =
|
|
|
|
GetPatientInfoRequestModel getPatientInfoRequestModel =
|
|
|
|
GetPatientInfoRequestModel(
|
|
|
|
GetPatientInfoRequestModel(
|
|
|
|
//TODO Elham* this return the static to dynamic
|
|
|
|
//TODO Elham* this return the static to dynamic
|
|
|
|
patientIdentificationID: "1062938285",
|
|
|
|
patientIdentificationID: "1062938285",
|
|
|
|
// _idController.text,
|
|
|
|
// _idController.text,
|
|
|
|
@ -378,13 +428,13 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
sessionID: null,
|
|
|
|
sessionID: null,
|
|
|
|
dOB:
|
|
|
|
dOB:
|
|
|
|
"31/07/1988", //"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}"
|
|
|
|
"31/07/1988", //"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (widget.model!.state == ViewState.ErrorLocal) {
|
|
|
|
if (widget.model!.state == ViewState.ErrorLocal) {
|
|
|
|
Utils.showErrorToast(widget.model!.error);
|
|
|
|
Utils.showErrorToast(widget.model!.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
await widget.model
|
|
|
|
await widget.model!
|
|
|
|
!.getPatientInfo(getPatientInfoRequestModel);
|
|
|
|
.getPatientInfo(getPatientInfoRequestModel);
|
|
|
|
if (widget.model!.state == ViewState.ErrorLocal) {
|
|
|
|
if (widget.model!.state == ViewState.ErrorLocal) {
|
|
|
|
Utils.showErrorToast(widget.model!.error);
|
|
|
|
Utils.showErrorToast(widget.model!.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -417,26 +467,29 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
Future _selectDate(BuildContext context, DateTime dateTime,
|
|
|
|
Future _selectDate(BuildContext context, DateTime dateTime,
|
|
|
|
Function(dynamic) updateDate) async {
|
|
|
|
Function(dynamic) updateDate) async {
|
|
|
|
if (calenderType == CalenderType.Hijri) {
|
|
|
|
if (calenderType == CalenderType.Hijri) {
|
|
|
|
HijriCalendar hijriDate = HijriCalendar.fromDate(DateTime.now());
|
|
|
|
JDateModel hijriDate = JDateModel(dateTime: DateTime.now());
|
|
|
|
final HijriCalendar? pickedH = await showHijriDatePicker(
|
|
|
|
final JPickerValue? pickedH = await showGlobalDatePicker(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialDate: birthDateInHijri ?? hijriDate,
|
|
|
|
pickerType: PickerType.JHijri,
|
|
|
|
lastDate: new HijriCalendar()
|
|
|
|
startDate: birthDateInHijri ?? hijriDate,
|
|
|
|
..hYear = hijriDate.hYear
|
|
|
|
endDate: JDateModel(
|
|
|
|
..hMonth = hijriDate.hMonth
|
|
|
|
jhijri: JHijri(fDate: hijriDate.dateTime),
|
|
|
|
..hDay = hijriDate.hDay,
|
|
|
|
),
|
|
|
|
firstDate: new HijriCalendar()
|
|
|
|
|
|
|
|
..hYear = 1438
|
|
|
|
// firstDate: new HijriCalendar()
|
|
|
|
..hMonth = 12
|
|
|
|
// ..hYear = 1438
|
|
|
|
..hDay = 25,
|
|
|
|
// ..hMonth = 12
|
|
|
|
initialDatePickerMode: DatePickerMode.day,
|
|
|
|
// ..hDay = 25,
|
|
|
|
|
|
|
|
pickerMode: DatePickerMode.day,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (pickedH != null && birthDateInHijri != pickedH) updateDate(pickedH);
|
|
|
|
if (pickedH != null && birthDateInHijri != pickedH) updateDate(pickedH);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
final DateTime? picked = await showDatePicker(
|
|
|
|
final DateTime? picked = await showDatePicker(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialDate: dateTime ?? DateTime.now(),
|
|
|
|
initialDate: dateTime ?? DateTime.now(),
|
|
|
|
firstDate: DateTime(DateTime.now().year - 150),
|
|
|
|
firstDate: DateTime(DateTime
|
|
|
|
|
|
|
|
.now()
|
|
|
|
|
|
|
|
.year - 150),
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -453,7 +506,9 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
attributeName: attributeName,
|
|
|
|
attributeName: attributeName,
|
|
|
|
attributeValueId: attributeValueId,
|
|
|
|
attributeValueId: attributeValueId,
|
|
|
|
usingSearch: true,
|
|
|
|
usingSearch: true,
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
okText: TranslationBase
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.ok,
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
okFunction(selectedValue);
|
|
|
|
okFunction(selectedValue);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -472,7 +527,8 @@ class _RegisterSearchPatientPageState extends State<RegisterSearchPatientPage> {
|
|
|
|
return birthDateInHijri != null ? "$birthDateInHijri" : null;
|
|
|
|
return birthDateInHijri != null ? "$birthDateInHijri" : null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return _birthDateInGregorian != null
|
|
|
|
return _birthDateInGregorian != null
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}"
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(
|
|
|
|
|
|
|
|
_birthDateInGregorian.toString(), "yyyy/MM/dd")}"
|
|
|
|
: null;
|
|
|
|
: null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|