You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
619 lines
29 KiB
Dart
619 lines
29 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
|
|
import 'package:hmg_patient_app/config/size_config.dart';
|
|
import 'package:hmg_patient_app/core/service/AuthenticatedUserObject.dart';
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
import 'package:hmg_patient_app/extensions/string_extensions.dart';
|
|
import 'package:hmg_patient_app/locator.dart';
|
|
import 'package:hmg_patient_app/models/Appointments/toDoCountProviderModel.dart';
|
|
import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart' hide List;
|
|
import 'package:hmg_patient_app/models/Authentication/check_user_status_reponse.dart';
|
|
import 'package:hmg_patient_app/models/Authentication/register_info_response.dart';
|
|
import 'package:hmg_patient_app/models/Authentication/send_activation_request.dart';
|
|
import 'package:hmg_patient_app/models/Nationality_countires_model.dart';
|
|
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
|
|
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
|
|
import 'package:hmg_patient_app/pages/Blood/blood_donation.dart';
|
|
import 'package:hmg_patient_app/pages/login/login-type.dart';
|
|
import 'package:hmg_patient_app/pages/login/register-info.dart';
|
|
import 'package:hmg_patient_app/pages/login/register.dart';
|
|
import 'package:hmg_patient_app/pages/login/register_new.dart';
|
|
import 'package:hmg_patient_app/pages/login/welcome.dart';
|
|
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
|
|
import 'package:hmg_patient_app/services/clinic_services/get_clinic_service.dart';
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
|
|
import 'package:hmg_patient_app/uitl/app_toast.dart';
|
|
import 'package:hmg_patient_app/uitl/date_uitl.dart';
|
|
import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
|
|
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
|
import 'package:hmg_patient_app/uitl/utils.dart';
|
|
import 'package:hmg_patient_app/uitl/utils_new.dart';
|
|
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hmg_patient_app/widgets/transitions/fade_page.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../../widgets/dialogs/confirm_dialog.dart';
|
|
import 'package:hijri/hijri_calendar.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class RegisterNewStep2 extends StatefulWidget {
|
|
CheckUserStatusResponse? nHICData;
|
|
SendActivationRequest payload;
|
|
|
|
RegisterNewStep2(this.nHICData, this.payload, {Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_RegisterNew createState() => _RegisterNew();
|
|
}
|
|
|
|
class _RegisterNew extends State<RegisterNewStep2> {
|
|
final emailAddress = TextEditingController();
|
|
final authService = new AuthProvider();
|
|
final sharedPref = new AppSharedPreferences();
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
late ProjectViewModel projectViewModel;
|
|
bool isFromDubai = false;
|
|
List<NationalityCountries> countriesList = [];
|
|
|
|
// TextEditingController nationality = TextEditingController();
|
|
String? name, nationalId;
|
|
|
|
NationalityCountries? selectedCountry;
|
|
GenderType? selectedGenderType;
|
|
MaritalStatusType? selectedMaritalStatusType;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
isFromDubai = widget.payload.zipCode!.contains("971") || widget.payload.zipCode!.contains("+971");
|
|
loadCountriesList();
|
|
// if (isFromDubai) {
|
|
// // getCountries();
|
|
// }
|
|
// isFromDubai = widget.payload.zipCode!.contains("971") || widget.payload.zipCode!.contains("+971");
|
|
}
|
|
|
|
loadCountriesList() async {
|
|
final String response = await DefaultAssetBundle.of(context).loadString('assets/json/countriesList.json');
|
|
final List<dynamic> data = json.decode(response);
|
|
countriesList = data.map((e) => NationalityCountries.fromJson(e)).toList();
|
|
setState(() {});
|
|
}
|
|
|
|
// getCountries() {
|
|
// ClinicListService service = ClinicListService();
|
|
// service.getCountries().then((res) {
|
|
// if (res['MessageStatus'] == 1) {
|
|
// print(res['ListNationality']);
|
|
// countriesList = (res['ListNationality'] as List).map((e) => NationalityCountries.fromJson(e)).toList();
|
|
// setState(() {});
|
|
// }
|
|
// }).catchError((err) {
|
|
// print(err);
|
|
// });
|
|
// }
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
projectViewModel = Provider.of(context);
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).personalDetailsVerificaion,
|
|
isShowDecPage: false,
|
|
isShowAppBar: true,
|
|
isshowBackButton: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
showNewAppBarTitle: true,
|
|
showDropDown: false,
|
|
isShowLanguageChanger: false,
|
|
showHomeAppBarIcon: false,
|
|
resizeToAvoidBottomInset: true,
|
|
appBarIcons: [],
|
|
dropDownIndexChange: (value) {
|
|
Utils.changeAppLanguage(context: context);
|
|
},
|
|
body: SingleChildScrollView(
|
|
reverse: false,
|
|
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Directionality(
|
|
textDirection: Directionality.of(context),
|
|
child: Container(
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
|
|
padding: EdgeInsets.only(left: 16, right: 16),
|
|
child: Column(
|
|
children: [
|
|
inputWidget(isFromDubai ? TranslationBase.of(context).fullName : TranslationBase.of(context).name,
|
|
isFromDubai ? name ?? "" : (widget.nHICData!.firstNameEn!.toUpperCase() + " " + widget.nHICData!.lastNameEn!.toUpperCase()), null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
keyboardType: TextInputType.text,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: isFromDubai ? false : true,
|
|
leadingIcon: "assets/images/svg/user-circle.svg", onChange: (value) {
|
|
name = value;
|
|
setState(() {});
|
|
}),
|
|
Divider(height: 1),
|
|
inputWidget(TranslationBase.of(context).nationalIdNumber, isFromDubai ? widget.payload.nationalID! : (widget.nHICData!.idNumber ?? ""), null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: true,
|
|
leadingIcon: "assets/images/svg/student-card.svg",
|
|
onChange: (value) {}),
|
|
Divider(height: 1),
|
|
isFromDubai
|
|
? inputWidget(
|
|
TranslationBase.of(context).gender,
|
|
TranslationBase.of(context).male,
|
|
null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
hasSelection: true,
|
|
dropdownItems: GenderType.values.map((e) => context.selectedLanguage == "ar" ? e.typeAr : e.type).toList(),
|
|
selectedValue: context.selectedLanguage == "ar" ? selectedGenderType!.typeAr : selectedGenderType?.type,
|
|
selectionType: SelectionType.dropdown,
|
|
onChange: (val) {
|
|
if (val != null) {
|
|
print(val);
|
|
setState(() {
|
|
selectedGenderType = GenderTypeExtension.fromType(val);
|
|
});
|
|
}
|
|
},
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
hasSelectionCustomIcon: true,
|
|
removePadding: true,
|
|
isLeadingCountry: false,
|
|
isAllowRadius: false,
|
|
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
|
selectionCustomIcon: "assets/images/svg/arrow-down.svg",
|
|
leadingIcon: 'assets/images/svg/user-full.svg',
|
|
).withVerticalPadding(8)
|
|
: inputWidget(TranslationBase.of(context).gender, (widget.nHICData!.gender ?? ""), null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: isFromDubai ? false : true,
|
|
leadingIcon: "assets/images/svg/user-full.svg",
|
|
onChange: (value) {}),
|
|
Divider(height: 1),
|
|
isFromDubai
|
|
? inputWidget(
|
|
TranslationBase.of(context).maritalStatus,
|
|
TranslationBase.of(context).married,
|
|
null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
hasSelection: true,
|
|
dropdownItems: MaritalStatusType.values.map((e) => context.selectedLanguage == "ar" ? e.typeAr : e.type).toList(),
|
|
selectedValue: context.selectedLanguage == "ar" ? selectedMaritalStatusType!.typeAr : selectedMaritalStatusType?.type,
|
|
selectionType: SelectionType.dropdown,
|
|
onChange: (val) {
|
|
if (val != null) {
|
|
setState(() {
|
|
selectedMaritalStatusType = MaritalStatusTypeExtension.fromType(val);
|
|
});
|
|
}
|
|
},
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
hasSelectionCustomIcon: true,
|
|
removePadding: true,
|
|
isLeadingCountry: false,
|
|
isAllowRadius: false,
|
|
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
|
selectionCustomIcon: "assets/images/svg/arrow-down.svg",
|
|
leadingIcon: 'assets/images/svg/smart-phone.svg',
|
|
).withVerticalPadding(8)
|
|
: inputWidget(
|
|
TranslationBase.of(context).maritalStatus,
|
|
context.selectedLanguage == "ar"
|
|
? (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.typeAr)
|
|
: (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.type),
|
|
null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: true,
|
|
leadingIcon: "assets/images/svg/smart-phone.svg",
|
|
onChange: (value) {}),
|
|
Divider(height: 1),
|
|
isFromDubai
|
|
? inputWidget(
|
|
TranslationBase.of(context).country,
|
|
TranslationBase.of(context).uae,
|
|
null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
hasSelection: true,
|
|
dropdownItems: countriesList.map((e) => context.selectedLanguage == "ar" ? e.nameN ?? "" : e.name ?? "").toList(),
|
|
selectedValue: context.selectedLanguage == "ar" ? selectedCountry!.nameN ?? "" : selectedCountry?.name ?? "",
|
|
selectionType: SelectionType.dropdown,
|
|
onChange: (val) {
|
|
if (val != null) {
|
|
setState(() {
|
|
selectedCountry = countriesList.firstWhere((element) => element.name == val);
|
|
});
|
|
}
|
|
},
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
hasSelectionCustomIcon: true,
|
|
removePadding: true,
|
|
isLeadingCountry: false,
|
|
isAllowRadius: false,
|
|
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
|
selectionCustomIcon: "assets/images/svg/arrow-down.svg",
|
|
leadingIcon: 'assets/images/svg/globe.svg',
|
|
).withVerticalPadding(8)
|
|
: inputWidget(
|
|
TranslationBase.of(context).nationality,
|
|
context.selectedLanguage == "ar"
|
|
? (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
|
|
: (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""),
|
|
|
|
// (widget.nHICData!.nationalityCode ?? "")
|
|
|
|
null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: true,
|
|
leadingIcon: "assets/images/svg/globe.svg",
|
|
onChange: (value) {}),
|
|
Divider(height: 1),
|
|
inputWidget(TranslationBase.of(context).mobileNumber, (widget.payload.mobileNo ?? ""), null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
removePadding: true,
|
|
isAllowRadius: false,
|
|
hasSelection: false,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
isReadOnly: true,
|
|
leadingIcon: "assets/images/svg/call.svg",
|
|
onChange: (value) {}),
|
|
Divider(height: 1),
|
|
inputWidget(TranslationBase.of(context).dob, isFromDubai ? widget.payload.dob! : (widget.nHICData!.dateOfBirth ?? ""), null,
|
|
isEnable: true,
|
|
prefix: null,
|
|
hasSelection: false,
|
|
removePadding: true,
|
|
isBorderAllowed: false,
|
|
isAllowLeadingIcon: true,
|
|
hasSelectionCustomIcon: false,
|
|
isReadOnly: true,
|
|
selectionType: SelectionType.calendar,
|
|
selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null,
|
|
selectionCustomIcon: "assets/images/svg/calendar.svg",
|
|
leadingIcon: "assets/images/svg/birthday-cake.svg",
|
|
onChange: (value) {}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 50,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: CustomButton(
|
|
text: TranslationBase.of(context).cancel,
|
|
icon: "assets/images/svg/cancel.svg",
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
fontFamily: context.fontFamily,
|
|
backgroundColor: Color(0xFFFEE9EA),
|
|
borderColor: Color(0xFFFEE9EA),
|
|
textColor: Color(0xFFED1C2B),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 16,
|
|
),
|
|
Expanded(
|
|
child: CustomButton(
|
|
text: TranslationBase.of(context).confirm,
|
|
icon: "assets/images/svg/confirm.svg",
|
|
onPressed: () {
|
|
if (isFromDubai) {
|
|
if (name == null) {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).enterFullName);
|
|
return;
|
|
}
|
|
if (!name!.contains(" ")) if (selectedGenderType == null) {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).enterFullName);
|
|
return;
|
|
}
|
|
if (selectedMaritalStatusType == null) {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).chooseMaritalStatus);
|
|
return;
|
|
}
|
|
if (selectedCountry == null) {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).chooseCountry);
|
|
return;
|
|
}
|
|
}
|
|
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
isDismissible: false,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (bottomSheetContext) => Padding(
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
|
|
child: SingleChildScrollView(
|
|
child: GenericBottomSheet(
|
|
textController: emailAddress,
|
|
isForEmail: true,
|
|
buttons: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
child: CustomButton(
|
|
text: TranslationBase.of(context).submiT,
|
|
onPressed: () {
|
|
if (emailAddress.text.isEmpty) {
|
|
Utils.showErrorToast(TranslationBase.of(context).enterEmailAddress);
|
|
return;
|
|
} else {
|
|
Navigator.of(context).pop();
|
|
registerNow();
|
|
}
|
|
},
|
|
backgroundColor: Color(0xFFED1C2B),
|
|
borderColor: Color(0xFFED1C2B),
|
|
textColor: Colors.white),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
fontFamily: context.fontFamily,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget showProgress({String? title, String? status, Color? color, bool isNeedBorder = true}) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 26,
|
|
height: 26,
|
|
decoration: containerRadius(color!, 200),
|
|
child: Icon(
|
|
Icons.done,
|
|
color: Colors.white,
|
|
size: 16,
|
|
),
|
|
),
|
|
if (isNeedBorder)
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: mDivider(Colors.grey),
|
|
)),
|
|
],
|
|
),
|
|
mHeight(8),
|
|
Text(
|
|
title!,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.44,
|
|
),
|
|
),
|
|
mHeight(2),
|
|
Container(
|
|
padding: EdgeInsets.all(5),
|
|
decoration: containerRadius(color.withOpacity(0.2), 4),
|
|
child: Text(
|
|
status!,
|
|
style: TextStyle(
|
|
fontSize: 8,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.32,
|
|
color: color,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
registerNow() {
|
|
dynamic request;
|
|
if (isFromDubai)
|
|
request = getTempUserRequestDubai();
|
|
else
|
|
request = getTempUserRequest();
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: true);
|
|
dynamic res;
|
|
|
|
authService
|
|
.registerUser(request)
|
|
.then((result) async => {
|
|
if (result is String)
|
|
{
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
new ConfirmDialog(
|
|
context: context,
|
|
confirmMessage: result,
|
|
okText: TranslationBase.of(context).ok,
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
okFunction: () => {ConfirmDialog.closeAlertDialog(context)},
|
|
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}).showAlertDialog(context)
|
|
}
|
|
else
|
|
{
|
|
res = result,
|
|
result = CheckActivationCode.fromJson(result),
|
|
// result.list.isFamily = false,
|
|
// sharedPref.setObject(USER_PROFILE, result.list),
|
|
// this.sharedPref.setObject(MAIN_USER, result.list),
|
|
// sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
// sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
// this.setUser(result),
|
|
sharedPref.remove(FAMILY_FILE),
|
|
result.list.isFamily = false,
|
|
|
|
await sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? ""),
|
|
authenticatedUserObject.user = result.list,
|
|
projectViewModel.setPrivilege(privilegeList: res),
|
|
await sharedPref.setObject(MAIN_USER, result.list),
|
|
await sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
await sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
await sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).successRegister),
|
|
projectViewModel.analytics.loginRegistration.registration_confirmation(),
|
|
Navigator.of(context).pushReplacement(FadePage(page: WelcomeLogin())),
|
|
}
|
|
})
|
|
.catchError((err) {
|
|
print(err);
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
ConfirmDialog dialog = ConfirmDialog(
|
|
context: context,
|
|
confirmMessage: err,
|
|
okText: TranslationBase.of(context).confirm,
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
okFunction: () => {ConfirmDialog.closeAlertDialog(context)},
|
|
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
|
|
dialog.showAlertDialog(context);
|
|
projectViewModel.analytics.loginRegistration.registration_fail(errorType: "");
|
|
});
|
|
}
|
|
|
|
getTempUserRequest() {
|
|
DateFormat dateFormat = DateFormat("mm/dd/yyyy");
|
|
print(dateFormat.parse(widget.nHICData!.dateOfBirth!));
|
|
var hDate = new HijriCalendar.fromDate(dateFormat.parse(widget.nHICData!.dateOfBirth!));
|
|
var date = hDate.toString();
|
|
return {
|
|
"Patientobject": {
|
|
"TempValue": true,
|
|
"PatientIdentificationType": widget.nHICData!.idNumber!.substring(0, 1) == "1" ? 1 : 2,
|
|
"PatientIdentificationNo": widget.nHICData!.idNumber,
|
|
"MobileNumber": int.parse(widget.payload.mobileNo!),
|
|
"PatientOutSA": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 0 : 1,
|
|
"FirstNameN": widget.nHICData!.firstNameAr,
|
|
"FirstName": widget.nHICData!.firstNameEn,
|
|
"MiddleNameN": widget.nHICData!.secondNameAr,
|
|
"MiddleName": widget.nHICData!.secondNameEn,
|
|
"LastNameN": widget.nHICData!.lastNameAr,
|
|
"LastName": widget.nHICData!.lastNameEn,
|
|
"StrDateofBirth": widget.nHICData!.dateOfBirth,
|
|
"DateofBirth": DateUtil.convertISODateToJsonDate(widget.nHICData!.dateOfBirth!.replaceAll('/', '-')),
|
|
"Gender": widget.nHICData!.gender == 'M' ? 1 : 2,
|
|
"NationalityID": widget.nHICData!.nationalityCode,
|
|
"eHealthIDField": widget.nHICData!.healthId,
|
|
"DateofBirthN": date,
|
|
"EmailAddress": emailAddress.text,
|
|
"SourceType": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 1 : 2,
|
|
"PreferredLanguage": context.selectedLanguage == "ar" ? 1 : 2,
|
|
// "OccupationID": registerInfo.occupationID,
|
|
"Marital": widget.nHICData!.maritalStatusCode == 'U'
|
|
? '0'
|
|
: widget.nHICData!.maritalStatusCode == 'M'
|
|
? '1'
|
|
: '2',
|
|
},
|
|
"PatientIdentificationID": widget.nHICData!.idNumber,
|
|
"PatientMobileNumber": widget.payload.mobileNo.toString()[0] == '0' ? widget.payload.mobileNo : '0' + widget.payload.mobileNo.toString()
|
|
};
|
|
}
|
|
|
|
getTempUserRequestDubai() {
|
|
DateFormat dateFormat = DateFormat("mm/dd/yyyy");
|
|
// print(dateFormat.parse(registerd_data.dob!));
|
|
var hDate = new HijriCalendar.fromDate(dateFormat.parse(widget.payload.dob!));
|
|
var date = hDate.toString();
|
|
final DateFormat dateFormat1 = DateFormat('MM/dd/yyyy');
|
|
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
|
|
List<String> names = name!.split(" ");
|
|
return {
|
|
"Patientobject": {
|
|
"TempValue": true,
|
|
"PatientIdentificationType": widget.payload.nationalID!.substring(0, 1) == "1" ? 1 : 2,
|
|
"PatientIdentificationNo": widget.payload.nationalID,
|
|
"MobileNumber": int.parse(widget.payload.mobileNo ?? ""),
|
|
"PatientOutSA": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 0 : 1,
|
|
"FirstNameN": "...",
|
|
"FirstName": names[0],
|
|
"MiddleNameN": "...",
|
|
"MiddleName": "...",
|
|
"LastNameN": "...",
|
|
"LastName": names.length > 1 ? names[1] : "...",
|
|
"StrDateofBirth": dateFormat1.format(dateFormat2.parse(widget.payload.dob!)),
|
|
"DateofBirth": DateUtil.convertISODateToJsonDate(widget.payload.dob!.replaceAll('/', '-')),
|
|
"Gender": selectedGenderType == GenderType.male ? 1 : 2,
|
|
"NationalityID": "UAE",
|
|
"eHealthIDField": null,
|
|
"DateofBirthN": date,
|
|
"EmailAddress": emailAddress.text,
|
|
"SourceType": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 1 : 2,
|
|
"PreferredLanguage": context.selectedLanguage == "ar" ? "1" : "2",
|
|
"Marital": selectedMaritalStatusType == MaritalStatusType.single
|
|
? '0'
|
|
: selectedMaritalStatusType == MaritalStatusType.married
|
|
? '1'
|
|
: '2',
|
|
},
|
|
"PatientIdentificationID": widget.payload.nationalID,
|
|
"PatientMobileNumber": widget.payload.mobileNo.toString()[0] == '0' ? widget.payload.mobileNo : '0' + widget.payload.mobileNo.toString(),
|
|
"DOB": widget.payload.dob,
|
|
"IsHijri": widget.payload.isHijri
|
|
};
|
|
}
|
|
|
|
getName() {}
|
|
}
|