|
|
|
|
@ -1,6 +1,10 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
@ -9,7 +13,9 @@ import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as checkActivation;
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/countries_list.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/get_patient_occupation_list_response.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
|
|
|
|
|
@ -84,11 +90,20 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
String gender = 'M';
|
|
|
|
|
String maritalStatus = 'M';
|
|
|
|
|
String nationality = 'SAU';
|
|
|
|
|
String selectedOccupationID = "";
|
|
|
|
|
|
|
|
|
|
List<GetPatientOccupationListResponse> patientOccupationList = [];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
GetPatientOccupationListResponse? selectedPatientOccupation;
|
|
|
|
|
|
|
|
|
|
final GlobalKey projectDropdownKey = GlobalKey();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
if (widget.page == 1) {
|
|
|
|
|
getCountries();
|
|
|
|
|
// getPatientOccupationList();
|
|
|
|
|
}
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
|
|
|
getRegisterInfo();
|
|
|
|
|
@ -121,7 +136,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
Expanded(child: SizedBox())
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
(isDubai && page == 1)
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
@ -232,13 +247,13 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
: (registerInfo.healthId != null && page == 1)
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
getnameField(TranslationBase.of(context).identificationNumber, registerInfo.idNumber, TranslationBase.of(context).firstName,
|
|
|
|
|
registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
getnameField(TranslationBase.of(context).middleName, registerInfo.secondNameEn == '-' ? registerInfo.secondNameEn : registerInfo.secondNameEn,
|
|
|
|
|
TranslationBase.of(context).lastName, registerInfo.lastNameEn == '-' ? registerInfo.lastNameEn : registerInfo.lastNameEn),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
getnameField(
|
|
|
|
|
TranslationBase.of(context).gender,
|
|
|
|
|
registerInfo.maritalStatusCode == 'U'
|
|
|
|
|
@ -248,17 +263,82 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
: 'Female',
|
|
|
|
|
TranslationBase.of(context).maritalStatus,
|
|
|
|
|
registerInfo.maritalStatus),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
getnameField(TranslationBase.of(context).nationality, registerInfo.nationality, TranslationBase.of(context).mobileNumber, registerd_data.patientMobileNumber.toString()),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
getnameField(TranslationBase.of(context).dateOfBirth, registerInfo.dateOfBirth, "", ""),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: widget.page == 2
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
(!isDubai)
|
|
|
|
|
? Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: containerRadius(Colors.white, 12),
|
|
|
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Flexible(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectOccupation,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 18,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<GetPatientOccupationListResponse>(
|
|
|
|
|
key: projectDropdownKey,
|
|
|
|
|
hint: Text(TranslationBase.of(context).selectOccupation),
|
|
|
|
|
value: selectedPatientOccupation,
|
|
|
|
|
iconSize: 0,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black),
|
|
|
|
|
items: patientOccupationList.map((GetPatientOccupationListResponse item) {
|
|
|
|
|
return DropdownMenuItem<GetPatientOccupationListResponse>(
|
|
|
|
|
value: item,
|
|
|
|
|
child: AutoSizeText(
|
|
|
|
|
projectViewModel.isArabic ? item.descriptionN! : item.description!,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minFontSize: 10,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.6,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.39,
|
|
|
|
|
height: 0.8,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Text('${item.name!}'),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (GetPatientOccupationListResponse? newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedPatientOccupation = newValue!;
|
|
|
|
|
selectedOccupationID = selectedPatientOccupation!.occupationID!;
|
|
|
|
|
registerInfo.occupationID = selectedOccupationID;
|
|
|
|
|
});
|
|
|
|
|
debugPrint("Selected Occupation ID: ${registerInfo.occupationID}");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Icon(Icons.keyboard_arrow_down),
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
mHeight(20),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: containerRadius(Colors.white, 12),
|
|
|
|
|
@ -407,6 +487,8 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: DefaultButton(TranslationBase.of(context).cancel, () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
// widget.changePageViewIndex!(0);
|
|
|
|
|
// getPatientOccupationList();
|
|
|
|
|
locator<GAnalytics>().loginRegistration.registration_cancel(step: page == 1 ? 'personal info' : 'other details');
|
|
|
|
|
}, textColor: Colors.white, color: Color(0xffD02127))),
|
|
|
|
|
),
|
|
|
|
|
@ -431,7 +513,15 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
widget.changePageViewIndex!(2);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
registerNow();
|
|
|
|
|
if (isDubai) {
|
|
|
|
|
registerNow();
|
|
|
|
|
} else {
|
|
|
|
|
if (selectedPatientOccupation != null) {
|
|
|
|
|
registerNow();
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).selectOccupationError);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -445,12 +535,15 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
|
|
|
|
|
registerNow() {
|
|
|
|
|
dynamic request;
|
|
|
|
|
|
|
|
|
|
if (isDubai)
|
|
|
|
|
request = getTempUserRequestDubai();
|
|
|
|
|
else
|
|
|
|
|
request = getTempUserRequest();
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
|
|
|
|
|
print(request);
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: true);
|
|
|
|
|
dynamic res;
|
|
|
|
|
this
|
|
|
|
|
.authService
|
|
|
|
|
@ -503,7 +596,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
okFunction: () => {ConfirmDialog.closeAlertDialog(context)},
|
|
|
|
|
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
projectViewModel.analytics.loginRegistration.registration_fail(errorType: err);
|
|
|
|
|
projectViewModel.analytics.loginRegistration.registration_fail(errorType: "");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -530,6 +623,16 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
if (isDubai) location = '2';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var patientOccupationListVal = json.decode(await sharedPref.getString(PATIENT_OCCUPATION_LIST));
|
|
|
|
|
patientOccupationListVal.forEach((v) {
|
|
|
|
|
patientOccupationList.add(new GetPatientOccupationListResponse.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
print(ex.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getTempUserRequest() {
|
|
|
|
|
@ -559,6 +662,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
"EmailAddress": email,
|
|
|
|
|
"SourceType": location,
|
|
|
|
|
"PreferredLanguage": registerd_data.languageID.toString(),
|
|
|
|
|
"OccupationID": registerInfo.occupationID,
|
|
|
|
|
"Marital": registerInfo.maritalStatusCode == 'U'
|
|
|
|
|
? '0'
|
|
|
|
|
: registerInfo.maritalStatusCode == 'M'
|
|
|
|
|
@ -718,7 +822,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
);
|
|
|
|
|
Navigator.push(context, FadePage(page: InsuranceUpdate()));
|
|
|
|
|
},
|
|
|
|
|
@ -726,7 +830,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
@ -911,6 +1015,25 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void openDropdown(GlobalKey key) {
|
|
|
|
|
GestureDetector? detector;
|
|
|
|
|
void searchForGestureDetector(BuildContext element) {
|
|
|
|
|
element.visitChildElements((element) {
|
|
|
|
|
if (element.widget != null && element.widget is GestureDetector) {
|
|
|
|
|
detector = element.widget as GestureDetector?;
|
|
|
|
|
// return false;
|
|
|
|
|
} else {
|
|
|
|
|
searchForGestureDetector(element);
|
|
|
|
|
}
|
|
|
|
|
// return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchForGestureDetector(key.currentContext!);
|
|
|
|
|
assert(detector != null);
|
|
|
|
|
detector!.onTap!();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Language {
|
|
|
|
|
|