register & changes
parent
9c52a6122f
commit
6f98690929
@ -1,385 +1,579 @@
|
|||||||
import 'dart:convert';
|
// import'dart:convert';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
//
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
// import 'package:flutter/gestures.dart';
|
||||||
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
|
// import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
// import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
|
||||||
import 'package:provider/provider.dart';
|
// import 'package:hmg_patient_app/config/config.dart';
|
||||||
|
// import 'package:hmg_patient_app/config/shared_pref_kay.dart';
|
||||||
class Register extends StatefulWidget {
|
// import 'package:hmg_patient_app/config/size_config.dart';
|
||||||
final Function? changePageViewIndex;
|
// import 'package:hmg_patient_app/core/service/client/base_app_client.dart';
|
||||||
|
// import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
||||||
const Register({Key? key, this.changePageViewIndex}) : super(key: key);
|
// import 'package:hmg_patient_app/models/Appointments/toDoCountProviderModel.dart';
|
||||||
|
// import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart';
|
||||||
@override
|
// import 'package:hmg_patient_app/models/Authentication/check_paitent_authentication_req.dart';
|
||||||
_Register createState() => _Register();
|
// import 'package:hmg_patient_app/models/Authentication/check_user_status_reponse.dart';
|
||||||
}
|
// import 'package:hmg_patient_app/models/Authentication/check_user_status_req.dart';
|
||||||
|
// import 'package:hmg_patient_app/models/Authentication/checkpatient_for_registration.dart';
|
||||||
class _Register extends State<Register> {
|
// import 'package:hmg_patient_app/models/Authentication/register_info_response.dart';
|
||||||
@override
|
// import 'package:hmg_patient_app/models/Authentication/send_activation_request.dart';
|
||||||
void initState() {
|
// import 'package:hmg_patient_app/new_ui/new_ext.dart';
|
||||||
getPatientOccupationList();
|
// import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
|
||||||
super.initState();
|
// import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
|
||||||
}
|
// import 'package:hmg_patient_app/pages/login/login-type.dart';
|
||||||
|
// import 'package:hmg_patient_app/pages/login/register-info.dart';
|
||||||
@override
|
// import 'package:hmg_patient_app/pages/login/register.dart';
|
||||||
Widget build(BuildContext context) {
|
// import 'package:hmg_patient_app/pages/login/register_new_step_2.dart';
|
||||||
return Scaffold(
|
// import 'package:hmg_patient_app/pages/login/user-login-agreement-page.dart';
|
||||||
appBar: CustomAppBar(
|
// import 'package:hmg_patient_app/pages/login/welcome.dart';
|
||||||
onBackPressed: () {},
|
// import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
|
||||||
onLanguageChanged: (String value) {},
|
// import 'package:hmg_patient_app/theme/colors.dart';
|
||||||
),
|
// import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
|
||||||
body: Column(
|
// import 'package:hmg_patient_app/uitl/app_toast.dart';
|
||||||
children: [
|
// import 'package:hmg_patient_app/uitl/font_utils.dart';
|
||||||
Expanded(
|
// import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
|
||||||
child: ListView(
|
// import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
||||||
padding: EdgeInsets.all(21),
|
// import 'package:hmg_patient_app/uitl/utils.dart';
|
||||||
physics: BouncingScrollPhysics(),
|
// import 'package:hmg_patient_app/uitl/utils_new.dart';
|
||||||
children: [
|
// import 'package:hmg_patient_app/widgets/drawer/langauge_picker.dart';
|
||||||
SizedBox(height: 10),
|
// import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
|
||||||
Padding(
|
// import 'package:flutter/material.dart';
|
||||||
padding: EdgeInsets.all(10),
|
// import 'package:hmg_patient_app/widgets/otp/sms-popup.dart';
|
||||||
child: Text(
|
// import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
|
||||||
LocaleKeys.enterNationalId.tr(),
|
// import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
|
// import 'package:hmg_patient_app_new/core/enums.dart';
|
||||||
)),
|
// import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||||
SizedBox(height: 10),
|
// import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
PhoneNumberSelectorWidget(onNumberChange: (value) => {}, onCountryChange: (value) => ),
|
// import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||||
SizedBox(height: 12),
|
// import 'package:hmg_patient_app_new/widgets/dropdown_widget.dart';
|
||||||
TextInputWidget(labelText: LocaleKeys.nationalIdNumber.tr(), hintText: "Xxxxxxxxx", controller: TextEditingController()),
|
// import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
||||||
SizedBox(height: 20),
|
// import 'package:provider/provider.dart';
|
||||||
Row(
|
//
|
||||||
children: <Widget>[
|
// import '../../core/viewModels/appointment_rate_view_model.dart';
|
||||||
Expanded(
|
// import '../../locator.dart';
|
||||||
child: Row(
|
// import '../../models/Authentication/authenticated_user.dart';
|
||||||
children: <Widget>[
|
// import '../../models/Authentication/select_device_imei_res.dart';
|
||||||
Radio(
|
// import '../../models/InPatientServices/get_admission_info_response_model.dart';
|
||||||
value: 1,
|
// import '../../models/InPatientServices/get_admission_request_info_response_model.dart';
|
||||||
groupValue: isHijri,
|
// import '../../new_ui/exception_widget/ExceptionBottomSheet.dart';
|
||||||
onChanged: (value) {
|
// import '../../services/clinic_services/get_clinic_service.dart';
|
||||||
},
|
// import '../../widgets/dialogs/alert_dialog.dart';
|
||||||
),
|
// import '../../widgets/dialogs/confirm_dialog.dart';
|
||||||
Text(LocaleKeys.hijriDate.tr()),
|
// import '../../widgets/transitions/fade_page.dart';
|
||||||
],
|
// import 'package:intl/intl.dart' as intl;
|
||||||
),
|
//
|
||||||
),
|
// import '../landing/landing_page.dart';
|
||||||
Expanded(
|
// import '../rateAppointment/rate_appointment_doctor.dart';
|
||||||
child: Row(
|
//
|
||||||
children: <Widget>[
|
// class RegisterNew extends StatefulWidget {
|
||||||
Radio(
|
// @override
|
||||||
value: 0,
|
// _RegisterNew createState() => _RegisterNew();
|
||||||
groupValue: isHijri,
|
// }
|
||||||
onChanged: (value) {
|
//
|
||||||
},
|
// class _RegisterNew extends State<RegisterNew> {
|
||||||
),
|
// @override
|
||||||
Text(LocaleKeys.gregorianDate.tr()),
|
// void initState() {
|
||||||
],
|
// super.initState();
|
||||||
),
|
// }
|
||||||
),
|
//
|
||||||
],
|
// @override
|
||||||
),
|
// void dispose() {
|
||||||
Row(children: <Widget>[
|
// super.dispose();
|
||||||
Container(
|
// }
|
||||||
width: SizeConfig.realScreenWidth! * .89,
|
//
|
||||||
child: isHijri == 1
|
// @override
|
||||||
? Directionality(
|
// Widget build(BuildContext context) {
|
||||||
textDirection: TextDirection.ltr,
|
//
|
||||||
child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dob,
|
// AppState appState = getIt.get<AppState>();
|
||||||
isNumber: false,
|
// return Scaffold(
|
||||||
suffix: Icon(
|
// body: GestureDetector(
|
||||||
Icons.calendar_today,
|
// onTap: () {
|
||||||
size: 16,
|
// FocusScope.of(context).unfocus();
|
||||||
)))
|
// },
|
||||||
: Container(
|
// child: ScrollConfiguration(
|
||||||
child: InkWell(
|
// behavior: ScrollConfiguration.of(context).copyWith(overscroll: false, physics: const ClampingScrollPhysics()),
|
||||||
onTap: () {
|
// child: NotificationListener<OverscrollIndicatorNotification>(
|
||||||
if (isHijri != null) _selectDate(context);
|
// onNotification: (notification) {
|
||||||
},
|
// notification.disallowIndicator();
|
||||||
child: Directionality(
|
// return true;
|
||||||
textDirection: TextDirection.ltr,
|
// },
|
||||||
child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dobEn,
|
// child: SingleChildScrollView(
|
||||||
isNumber: false,
|
// physics: ClampingScrollPhysics(),
|
||||||
isEnable: false,
|
// padding: EdgeInsets.only(
|
||||||
suffix: Icon(
|
// left: 24,
|
||||||
Icons.calendar_today,
|
// right: 24,
|
||||||
size: 16,
|
// ),
|
||||||
)))))),
|
// child: Column(
|
||||||
])
|
// mainAxisSize: MainAxisSize.min,
|
||||||
],
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
// children: [
|
||||||
),
|
// Utils.showLottie(
|
||||||
Container(
|
// context: context,
|
||||||
width: double.maxFinite,
|
// assetPath: 'assets/animations/lottie/register.json',
|
||||||
// height: 80.0,
|
// width: MediaQuery
|
||||||
color: Colors.white,
|
// .of(context)
|
||||||
// margin: EdgeInsets.only(bottom: 50.0),
|
// .size
|
||||||
child: Row(
|
// .width * 0.45,
|
||||||
children: [
|
// height: MediaQuery
|
||||||
Expanded(
|
// .of(context)
|
||||||
child: Padding(
|
// .size
|
||||||
padding: EdgeInsets.all(10),
|
// .height * 0.22,
|
||||||
child: DefaultButton(TranslationBase.of(context).cancel, () {
|
// fit: BoxFit.cover,
|
||||||
Navigator.of(context).pop();
|
// repeat: true),
|
||||||
locator<GAnalytics>().loginRegistration.registration_cancel(step: 'enter details');
|
// SizedBox(height: 8),
|
||||||
}, textColor: Colors.white, color: Color(0xffD02127))),
|
// LocaleKeys.prepareToElevate.tr().toText28(
|
||||||
),
|
// textScaler: TextScaler.linear(MediaQuery.textScalerOf(context).scale(1)),
|
||||||
Expanded(
|
// ),
|
||||||
child: Padding(
|
// SizedBox(height: 24),
|
||||||
padding: EdgeInsets.all(10),
|
// Directionality(
|
||||||
child: DefaultButton(TranslationBase.of(context).next, () {
|
// textDirection: Directionality.of(context),
|
||||||
startRegistration();
|
// child: Container(
|
||||||
locator<GAnalytics>().loginRegistration.registration_enter_details();
|
// decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
|
||||||
}, textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Color(0xff359846))),
|
// padding: EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 0),
|
||||||
),
|
// child: Column(
|
||||||
],
|
// children: [
|
||||||
),
|
// DropdownWidget(
|
||||||
)
|
// labelText: LocaleKeys.country.tr(),
|
||||||
],
|
// hintText: LocaleKeys.ksa.tr(),
|
||||||
),
|
// isEnable: true,
|
||||||
);
|
// selectedValue: AppStat.selectedLanguage == "ar" ? selectedCountry.nameArabic : selectedCountry.displayName,
|
||||||
}
|
// dropdownItems: Country.values.map((e) => "ar" ? e.displayName : e.displayName).toList(),
|
||||||
|
//
|
||||||
Future<dynamic> _selectDate(BuildContext context) async {
|
// // dropdownItems: Country.values.map((e) => (e.name).first).toList(),
|
||||||
DatePicker.showDatePicker(
|
// // dropdownItems: Country.values.map((e) => "ar" ? e.nameArabic : e.displayName).toList(),
|
||||||
context,
|
// // selectedValue: context.selectedLanguage == "ar" ? selectedCountry.nameArabic : selectedCountry.displayName,
|
||||||
showTitleActions: true,
|
// // selectionType: SelectionType.dropdown,
|
||||||
minTime: DateTime(DateTime.now().year - 100, 1, 1),
|
// onChange: (val) {
|
||||||
maxTime: DateTime.now(),
|
// if (val != null) {
|
||||||
onConfirm: (date) {
|
// }
|
||||||
selectedDate = date;
|
// },
|
||||||
setState(() {
|
// isBorderAllowed: false,
|
||||||
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
|
// isAllowLeadingIcon: true,
|
||||||
dobEn.text = dateFormat.format(date);
|
// hasSelectionCustomIcon: true,
|
||||||
});
|
// removePadding: true,
|
||||||
},
|
// isLeadingCountry: true,
|
||||||
currentTime: DateTime.now(),
|
// isAllowRadius: false,
|
||||||
);
|
// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
||||||
}
|
// selectionCustomIcon: "assets/images/svg/arrow-down.svg",
|
||||||
|
// leadingIcon: selectedCountry.iconPath,
|
||||||
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon? suffix}) {
|
// ).withVerticalPadding(8),
|
||||||
return Container(
|
// Divider(height: 1),
|
||||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
// Directionality(
|
||||||
alignment: Alignment.center,
|
// textDirection: TextDirection.ltr,
|
||||||
decoration: BoxDecoration(
|
// child: newInputWidget(TranslationBase
|
||||||
borderRadius: BorderRadius.circular(15),
|
// .of(context)
|
||||||
color: Colors.white,
|
// .nationalIdNumber, "xxxxxxxxx", nationalIDorFile,
|
||||||
border: Border.all(
|
// isEnable: true,
|
||||||
color: Color(0xffefefef),
|
// prefix: null,
|
||||||
width: 1,
|
// removePadding: true,
|
||||||
),
|
// isAllowRadius: false,
|
||||||
),
|
// hasSelection: false,
|
||||||
child: InkWell(
|
// isBorderAllowed: false,
|
||||||
onTap: hasSelection ? () {} : null,
|
// isAllowLeadingIcon: true,
|
||||||
child: Row(
|
// autoFocus: true,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
||||||
children: [
|
// leadingIcon: "assets/images/svg/student-card.svg",
|
||||||
Expanded(
|
// onChange: (value) {
|
||||||
child: Column(
|
// print(value);
|
||||||
mainAxisSize: MainAxisSize.min,
|
// }).withVerticalPadding(8),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// ),
|
||||||
children: [
|
// Divider(height: 1),
|
||||||
Text(
|
// Directionality(
|
||||||
_labelText,
|
// textDirection: TextDirection.ltr,
|
||||||
style: TextStyle(
|
// child: newInputWidget(TranslationBase
|
||||||
fontSize: 11,
|
// .of(context)
|
||||||
fontWeight: FontWeight.w600,
|
// .dob, "11 July, 1994", nationalIDorFile,
|
||||||
color: Color(0xff2B353E),
|
// isEnable: true,
|
||||||
letterSpacing: -0.44,
|
// prefix: null,
|
||||||
),
|
// hasSelection: true,
|
||||||
),
|
// removePadding: true,
|
||||||
TextField(
|
// isBorderAllowed: false,
|
||||||
enabled: isEnable,
|
// isAllowLeadingIcon: true,
|
||||||
scrollPadding: EdgeInsets.zero,
|
// hasSelectionCustomIcon: true,
|
||||||
keyboardType: isNumber ? TextInputType.numberWithOptions(signed: true) : TextInputType.datetime,
|
// selectionType: SelectionType.calendar,
|
||||||
controller: _controller,
|
// selectedValue: selectedDOB != null
|
||||||
onChanged: (value) => {validateForm()},
|
// ? isHijri == 1
|
||||||
style: TextStyle(
|
// ? Utils.formatHijriDateToDisplay(selectedDOB!.toIso8601String())
|
||||||
fontSize: 14,
|
// : Utils.formatDateToDisplay(selectedDOB.toString())
|
||||||
height: 21 / 14,
|
// : null,
|
||||||
fontWeight: FontWeight.w400,
|
// selectionCustomIcon: "assets/images/svg/calendar.svg",
|
||||||
color: Color(0xff2B353E),
|
// lang: context.selectedLanguage,
|
||||||
letterSpacing: -0.44,
|
// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
|
||||||
),
|
// leadingIcon: "assets/images/svg/birthday-cake.svg",
|
||||||
decoration: InputDecoration(
|
// onChange: (value) {
|
||||||
isDense: true,
|
// selectedDOB = DateTime.parse(value!);
|
||||||
hintText: _hintText,
|
// if (isHijri == 1) {
|
||||||
hintStyle: TextStyle(
|
// var hijriDate = HijriGregConverter.gregorianToHijri(DateTime.parse(value));
|
||||||
fontSize: 14,
|
// selectedDOB = DateTime(hijriDate.year, hijriDate.month, hijriDate.day);
|
||||||
height: 21 / 14,
|
// } else {
|
||||||
fontWeight: FontWeight.w400,
|
// selectedDOB = DateTime.parse(value);
|
||||||
color: Color(0xff575757),
|
// }
|
||||||
letterSpacing: -0.56,
|
// print(selectedDOB!.toIso8601String());
|
||||||
),
|
// setState(() {});
|
||||||
prefixIconConstraints: BoxConstraints(minWidth: 50),
|
// },
|
||||||
prefixIcon: prefix == null
|
// onCalendarTypeChanged: (bool value) {
|
||||||
? null
|
// if (value) {
|
||||||
: Text(
|
// isHijri = 0;
|
||||||
"+" + prefix,
|
// } else {
|
||||||
style: TextStyle(
|
// isHijri = 1;
|
||||||
fontSize: 14,
|
// }
|
||||||
height: 21 / 14,
|
// }).withVerticalPadding(8),
|
||||||
fontWeight: FontWeight.w500,
|
// ),
|
||||||
color: Color(0xff2E303A),
|
// ],
|
||||||
letterSpacing: -0.56,
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
contentPadding: EdgeInsets.zero,
|
// SizedBox(height: 25),
|
||||||
border: InputBorder.none,
|
// GestureDetector(
|
||||||
focusedBorder: InputBorder.none,
|
// onTap: () {
|
||||||
enabledBorder: InputBorder.none,
|
// setState(() {
|
||||||
),
|
// isTermsAccepted = !isTermsAccepted;
|
||||||
),
|
// });
|
||||||
],
|
// },
|
||||||
),
|
// child: Row(
|
||||||
),
|
// children: [
|
||||||
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
|
// AnimatedContainer(
|
||||||
if (suffix != null) suffix
|
// duration: const Duration(milliseconds: 200),
|
||||||
],
|
// height: 24,
|
||||||
),
|
// width: 24,
|
||||||
),
|
// decoration: BoxDecoration(
|
||||||
);
|
// color: isTermsAccepted ? const Color(0xFFE92227) : Colors.transparent,
|
||||||
}
|
// borderRadius: BorderRadius.circular(6),
|
||||||
|
// border: Border.all(
|
||||||
startRegistration() {
|
// color: isTermsAccepted ? const Color(0xFFE92227) : Colors.grey,
|
||||||
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
|
// width: 2,
|
||||||
if (isButtonDisabled == false) {
|
// ),
|
||||||
var request = CheckPatientForRegistration();
|
// ),
|
||||||
request.patientMobileNumber = int.parse(mobileNo);
|
// child: isTermsAccepted ? const Icon(Icons.check, size: 16, color: Colors.white) : null,
|
||||||
request.zipCode = countryCode;
|
// ),
|
||||||
request.patientOutSA = countryCode == '966' ? 0 : 1;
|
// SizedBox(width: 12),
|
||||||
|
// Expanded(
|
||||||
request.patientIdentificationID = int.parse(nationalIDorFile.text);
|
// child: Text(
|
||||||
request.patientID = 0;
|
// TranslationBase
|
||||||
request.isRegister = true;
|
// .of(context)
|
||||||
request.dob = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
|
// .iAcceptTermsConditions,
|
||||||
request.isHijri = isHijri;
|
// style: context.dynamicTextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFF2E3039)),
|
||||||
this.checkPatientForRegisteration(request);
|
// ),
|
||||||
}
|
// ),
|
||||||
}
|
// ],
|
||||||
|
// ),
|
||||||
checkPatientForRegisteration(request) {
|
// ),
|
||||||
int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;
|
// SizedBox(height: 25),
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
// CustomButton(
|
||||||
this.authService.checkPatientForRegisteration(request, languageID).then((response) => {checkUserStatus(response, request)}).catchError((err) {
|
// text: TranslationBase
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
// .of(context)
|
||||||
ConfirmDialog dialog = new ConfirmDialog(
|
// .register,
|
||||||
context: context,
|
// icon: "assets/images/svg/note-edit.svg",
|
||||||
confirmMessage: err,
|
// onPressed: () {
|
||||||
okText: TranslationBase.of(context).confirm,
|
// // bool isValid = Utils.validateIqama(nationalIDorFile.text);
|
||||||
cancelText: TranslationBase.of(context).cancel_nocaps,
|
// if (nationalIDorFile == null || nationalIDorFile.text.isEmpty) {
|
||||||
okFunction: () => {
|
// context.showBottomSheet(
|
||||||
ConfirmDialog.closeAlertDialog(context),
|
// child: ExceptionBottomSheet(
|
||||||
Navigator.of(context).push(FadePage(page: Register())),
|
// message: TranslationBase
|
||||||
},
|
// .of(context)
|
||||||
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
|
// .pleaseEnterNationalId,
|
||||||
dialog.showAlertDialog(context);
|
// showCancel: false,
|
||||||
});
|
// onOkPressed: () {
|
||||||
}
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
void validateForm() {
|
// ),
|
||||||
if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
|
// );
|
||||||
mobileNo.length >= 9 &&
|
// // Utils.showErrorToast(TranslationBase.of(context).pleaseEnterNationalId);
|
||||||
util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true &&
|
// return;
|
||||||
isHijri != null &&
|
// }
|
||||||
(dobEn.text != null || dob.text != null)) {
|
// if ((!Utils.validateIqama(nationalIDorFile.text) && selectedCountry.countryCode == '966') ||
|
||||||
setState(() {
|
// (!Utils.validateUaeNationalId(nationalIDorFile.text) && selectedCountry.countryCode == '971')) {
|
||||||
isButtonDisabled = false;
|
// context.showBottomSheet(
|
||||||
});
|
// child: ExceptionBottomSheet(
|
||||||
} else {
|
// message: TranslationBase
|
||||||
setState(() {
|
// .of(context)
|
||||||
isButtonDisabled = true;
|
// .incorrectNationalId,
|
||||||
});
|
// showCancel: false,
|
||||||
}
|
// onOkPressed: () {
|
||||||
}
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
checkUserStatus(response, CheckPatientForRegistration request) async {
|
// ),
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
// );
|
||||||
if (response is Map) {
|
// return;
|
||||||
var nRequest = request.toJson();
|
// }
|
||||||
nRequest['LogInTokenID'] = response['LogInTokenID'];
|
// if (selectedCountry == null || selectedCountry.countryCode.isEmpty) {
|
||||||
if (response['hasFile'] == true) {
|
// context.showBottomSheet(
|
||||||
ConfirmDialog dialog = new ConfirmDialog(
|
// child: ExceptionBottomSheet(
|
||||||
context: context,
|
// message: TranslationBase
|
||||||
confirmMessage: response['ErrorEndUserMessage'],
|
// .of(context)
|
||||||
okText: TranslationBase.of(context).ok,
|
// .pleaseSelectCountry,
|
||||||
cancelText: TranslationBase.of(context).cancel,
|
// showCancel: false,
|
||||||
okFunction: () {
|
// onOkPressed: () {
|
||||||
AlertDialogBox.closeAlertDialog(context);
|
// Navigator.of(context).pop();
|
||||||
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
|
// },
|
||||||
LoginRegistration.loginMethod = 1; // 1=NationalID, by default from Registration
|
// ),
|
||||||
Navigator.of(context).push(FadePage(page: Login()));
|
// );
|
||||||
},
|
// return;
|
||||||
cancelFunction: () {})
|
// }
|
||||||
.showAlertDialog(context);
|
//
|
||||||
} else {
|
// if (selectedDOB == null) {
|
||||||
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
|
// context.showBottomSheet(
|
||||||
nRequest['forRegister'] = true;
|
// child: ExceptionBottomSheet(
|
||||||
nRequest['isRegister'] = true;
|
// message: TranslationBase
|
||||||
nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString();
|
// .of(context)
|
||||||
nRequest['dob'] = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
|
// .pleaseSelectDOB,
|
||||||
nRequest['isHijri'] = isHijri;
|
// showCancel: false,
|
||||||
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
|
// onOkPressed: () {
|
||||||
sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']);
|
// Navigator.of(context).pop();
|
||||||
if (request.patientOutSA == 0) {
|
// },
|
||||||
this.chekUserData(response['LogInTokenID']);
|
// ),
|
||||||
} else {
|
// );
|
||||||
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true)));
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// if (!isTermsAccepted) {
|
||||||
} else {
|
// context.showBottomSheet(
|
||||||
// if (response['ErrorCode'] == '-986') {
|
// child: ExceptionBottomSheet(
|
||||||
//AppToast.showErrorToast(message: response);
|
// message: TranslationBase
|
||||||
AlertDialogBox(
|
// .of(context)
|
||||||
context: context,
|
// .pleaseAcceptTermsConditions,
|
||||||
confirmMessage: response,
|
// showCancel: false,
|
||||||
okText: TranslationBase.of(context).ok,
|
// onOkPressed: () {
|
||||||
okFunction: () {
|
// Navigator.of(context).pop();
|
||||||
AlertDialogBox.closeAlertDialog(context);
|
// },
|
||||||
Navigator.of(context).pop();
|
// ),
|
||||||
}).showAlertDialog(context);
|
// );
|
||||||
//}
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
|
// if (phoneController != null) {
|
||||||
chekUserData(loginToken) {
|
// phoneController.clear();
|
||||||
// let m = hijri(this.dateOfBirth).locale('en');
|
// }
|
||||||
// // const dateHijri = m.format('iDD/iMM/iYYYY');
|
// showModalBottomSheet(
|
||||||
// const request = {
|
// context: context,
|
||||||
// PatientIdentificationID: this.id.toString(),
|
// isScrollControlled: true,
|
||||||
// // TokenID: token,
|
// isDismissible: false,
|
||||||
// DOB: this.dateOption === '1' ? this.dateOfBirth : moment(this.dateOfBirth).format('DD/MM/YYYY'),
|
// backgroundColor: Colors.transparent,
|
||||||
// IsHijri: Number(this.dateOption)
|
// builder: (bottomSheetContext) =>
|
||||||
// }
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(bottom: MediaQuery
|
||||||
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
|
// .of(bottomSheetContext)
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
// .viewInsets
|
||||||
var request = CheckUserStatusRequest();
|
// .bottom),
|
||||||
request.patientIdentificationID = nationalIDorFile.text;
|
// child: SingleChildScrollView(
|
||||||
request.dOB = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
|
// child: GenericBottomSheet(
|
||||||
request.isHijri = isHijri;
|
// countryCode: selectedCountry.countryCode,
|
||||||
request.patientOutSA = countryCode == '966' ? 0 : 1;
|
// initialPhoneNumber: "",
|
||||||
this.authService.checkUserStatus(request).then((result) => {
|
// textController: phoneController,
|
||||||
GifLoaderDialogUtils.hideDialog(context),
|
// onChange: (String? value) {
|
||||||
if (result is Map)
|
// mobileNo = value!;
|
||||||
{
|
// },
|
||||||
result = CheckUserStatusResponse.fromJson(result as Map<String, dynamic>),
|
// buttons: [
|
||||||
sharedPref.setObject(NHIC_DATA, result),
|
// Padding(
|
||||||
// widget.changePageViewIndex!(1),
|
// padding: const EdgeInsets.only(bottom: 10),
|
||||||
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))),
|
// child: CustomButton(
|
||||||
}
|
// text: TranslationBase
|
||||||
else
|
// .of(context)
|
||||||
{
|
// .sendOTPSMS,
|
||||||
AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong),
|
// onPressed: () {
|
||||||
}
|
// if (mobileNo.isEmpty) {
|
||||||
});
|
// context.showBottomSheet(
|
||||||
}
|
// child: ExceptionBottomSheet(
|
||||||
|
// message: TranslationBase
|
||||||
getPatientOccupationList() async {
|
// .of(context)
|
||||||
patientOccupationList.clear();
|
// .pleaseEnterMobile,
|
||||||
await authService.getPatientOccupationList().then((result) {
|
// showCancel: false,
|
||||||
sharedPref.setString(PATIENT_OCCUPATION_LIST, json.encode(result['GetOccupationLst']));
|
// onOkPressed: () {
|
||||||
}).catchError((err) {
|
// Navigator.of(context).pop();
|
||||||
AppToast.showErrorToast(message: err);
|
// },
|
||||||
});
|
// ),
|
||||||
}
|
// );
|
||||||
}
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
||||||
|
// context.showBottomSheet(
|
||||||
|
// child: ExceptionBottomSheet(
|
||||||
|
// message: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .pleaseEnterValidMobile,
|
||||||
|
// showCancel: false,
|
||||||
|
// onOkPressed: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// registerUser(1);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// backgroundColor: CustomColors.bgRedColor,
|
||||||
|
// borderColor: CustomColors.bgRedBorderColor,
|
||||||
|
// textColor: Colors.white,
|
||||||
|
// icon: "assets/images/svg/message.svg",
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Row(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
// children: [
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
// child: AppText(
|
||||||
|
// TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .oR,
|
||||||
|
// fontSize: 16,
|
||||||
|
// fontFamily: context.fontFamily,
|
||||||
|
// color: Color(0xFF2E3039),
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.only(bottom: 10, top: 10),
|
||||||
|
// child: CustomButton(
|
||||||
|
// text: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .sendOTPWHATSAPP,
|
||||||
|
// onPressed: () {
|
||||||
|
// if (mobileNo.isEmpty) {
|
||||||
|
// context.showBottomSheet(
|
||||||
|
// child: ExceptionBottomSheet(
|
||||||
|
// message: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .pleaseEnterMobile,
|
||||||
|
// showCancel: false,
|
||||||
|
// onOkPressed: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
||||||
|
// context.showBottomSheet(
|
||||||
|
// child: ExceptionBottomSheet(
|
||||||
|
// message: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .pleaseEnterValidMobile,
|
||||||
|
// showCancel: false,
|
||||||
|
// onOkPressed: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// registerUser(4);
|
||||||
|
// }
|
||||||
|
// // int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
|
||||||
|
// // registerUser(val);
|
||||||
|
// },
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
// borderColor: Color(0xFF2E3039),
|
||||||
|
// textColor: Color(0xFF2E3039),
|
||||||
|
// icon: "assets/images/svg/whatsapp.svg",
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// myFocusNode: myFocusNode,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// Future.delayed(Duration(milliseconds: 500), () {
|
||||||
|
// myFocusNode.requestFocus();
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// fontFamily: context.fontFamily,
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 14),
|
||||||
|
// Center(
|
||||||
|
// child: RichText(
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// text: TextSpan(
|
||||||
|
// style: context.dynamicTextStyle(
|
||||||
|
// color: Colors.black,
|
||||||
|
// fontSize: 16,
|
||||||
|
// height: 26 / 16,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// children: <TextSpan>[
|
||||||
|
// TextSpan(text: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .alreadyHaveAccount, style: context.dynamicTextStyle()),
|
||||||
|
// TextSpan(text: " "),
|
||||||
|
// TextSpan(
|
||||||
|
// text: TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .loginNow,
|
||||||
|
// style: context.dynamicTextStyle(
|
||||||
|
// color: CustomColors.bgRedColor,
|
||||||
|
// fontSize: 16,
|
||||||
|
// height: 26 / 16,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// recognizer: TapGestureRecognizer()
|
||||||
|
// ..onTap = () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 30),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// 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,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||||
|
|
||||||
class AuthenticationViewModel extends ChangeNotifier {
|
class AuthenticationViewModel extends ChangeNotifier {
|
||||||
// Add properties and methods related to authentication here
|
// Add properties and methods related to authentication here
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue