merge-update-with-lab-changes
Aamir Muhammad 5 months ago committed by haroon amjad
parent dac43376e0
commit 2d5b4342a1

@ -0,0 +1 @@
{"nm":"HDFC Success","h":512,"w":512,"meta":{"g":"LottieFiles AE 1.0.0"},"layers":[{"ty":4,"nm":"check","sr":1,"st":0,"op":240,"ip":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[100,100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[256,256,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ef":[],"shapes":[{"ty":"gr","nm":"Shape 1","it":[{"ty":"sh","nm":"Path 1","d":1,"ks":{"a":0,"k":{"c":false,"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-82.5,4.5],[-31,55],[73,-52.5]]}}},{"ty":"tm","nm":"Trim Paths 1","e":{"a":1,"k":[{"o":{"x":1,"y":0.076},"i":{"x":0.667,"y":1},"s":[0],"t":60},{"s":[100],"t":85}]},"o":{"a":0,"k":0},"s":{"a":0,"k":0},"m":1},{"ty":"st","nm":"Stroke 1","lc":2,"lj":2,"ml":1,"o":{"a":0,"k":100},"w":{"a":0,"k":30},"c":{"a":0,"k":[1,1,1]}},{"ty":"tr","a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":1},{"ty":4,"nm":"Shape Layer 2","sr":1,"st":0,"op":240,"ip":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0]},"s":{"a":1,"k":[{"o":{"x":0.656,"y":0.872},"i":{"x":0,"y":0.98},"s":[0,0,100],"t":20},{"s":[150,150,100],"t":60}]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[256,257.86,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ef":[],"shapes":[{"ty":"gr","nm":"Ellipse 1","it":[{"ty":"el","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0]},"s":{"a":0,"k":[236,236]}},{"ty":"fl","nm":"Fill 1","c":{"a":0,"k":[0.094,0.761,0.451]},"r":1,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[0,-3]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":2},{"ty":4,"nm":"Shape Layer 1","sr":1,"st":0,"op":240,"ip":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0]},"s":{"a":1,"k":[{"o":{"x":0.477,"y":0.587},"i":{"x":0,"y":0.999},"s":[0,0,100],"t":10},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[150,150,100],"t":50},{"o":{"x":0.167,"y":0},"i":{"x":0.833,"y":1},"s":[150,150,100],"t":76},{"s":[210,210,100],"t":123}]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[256,257.86,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":1,"k":[{"o":{"x":0.912,"y":0.073},"i":{"x":0.626,"y":0.729},"s":[100],"t":76},{"s":[0],"t":119}]}},"ef":[],"shapes":[{"ty":"gr","nm":"Ellipse 1","it":[{"ty":"el","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0]},"s":{"a":0,"k":[236,236]}},{"ty":"st","nm":"Stroke 1","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100},"w":{"a":0,"k":2},"c":{"a":0,"k":[1,1,1]}},{"ty":"fl","nm":"Fill 1","c":{"a":0,"k":[0.784,0.945,0.878]},"r":1,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[0,-3]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":3},{"ty":4,"nm":"BG","sr":1,"st":0,"op":240,"ip":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[100,100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[256,256,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ef":[],"shapes":[{"ty":"gr","nm":"Rectangle 1","it":[{"ty":"rc","nm":"Rectangle Path 1","d":1,"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0},"s":{"a":0,"k":[554,556]}},{"ty":"fl","nm":"Fill 1","c":{"a":0,"k":[1,1,1]},"r":1,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[-1,6]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":4}],"v":"4.8.0","fr":60,"op":130,"ip":0,"assets":[]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,5 +1,7 @@
import 'package:flutter/gestures.dart';
import 'package:hmg_patient_app/config/size_config.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.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';
@ -11,6 +13,7 @@ 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/text/app_texts_widget.dart';
import 'package:provider/provider.dart';
class RegisterNew extends StatefulWidget {
@ -20,6 +23,7 @@ class RegisterNew extends StatefulWidget {
class _RegisterNew extends State<RegisterNew> {
final nationalIDorFile = TextEditingController();
TextEditingController phoneController = TextEditingController();
final int loginType = LoginType.loginType;
late String mobileNo;
String countryCode = '966';
@ -67,90 +71,184 @@ class _RegisterNew extends State<RegisterNew> {
Utils.changeAppLanguage(context: context);
},
body: SingleChildScrollView(
child: Container(
height: SizeConfig.realScreenHeight! * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 20, right: 20, top: 12),
child: Row(
children: [
Expanded(
child: showProgress(
title: TranslationBase.of(context).enterDetails,
status: _currentIndex == 0
? TranslationBase.of(context).inPrgress
: _currentIndex > 0
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green,
child: Container(
height: SizeConfig.realScreenHeight! * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 20, right: 20, top: 12),
child: Row(
children: [
Expanded(
child: showProgress(
title: TranslationBase.of(context).enterDetails,
status: _currentIndex == 0
? TranslationBase.of(context).inPrgress
: _currentIndex > 0
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green,
),
),
),
Expanded(
child: showProgress(
title: TranslationBase.of(context).patientInfo,
status: _currentIndex == 1
? TranslationBase.of(context).inPrgress
: _currentIndex > 1
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 1
Expanded(
child: showProgress(
title: TranslationBase.of(context).patientInfo,
status: _currentIndex == 1
? TranslationBase.of(context).inPrgress
: _currentIndex > 1
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 1
? CustomColors.orange
: _currentIndex > 1
? CustomColors.green
: CustomColors.grey2,
),
),
showProgress(
title: TranslationBase.of(context).otherInfo,
status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked,
color: _currentIndex == 2
? CustomColors.orange
: _currentIndex > 1
: _currentIndex > 3
? CustomColors.green
: CustomColors.grey2,
isNeedBorder: false,
),
),
showProgress(
title: TranslationBase.of(context).otherInfo,
status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked,
color: _currentIndex == 2
? CustomColors.orange
: _currentIndex > 3
? CustomColors.green
: CustomColors.grey2,
isNeedBorder: false,
),
],
],
),
),
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
Register(
changePageViewIndex: changePageViewIndex,
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
Register(
changePageViewIndex: changePageViewIndex,
),
RegisterInfo(
changePageViewIndex: changePageViewIndex,
RegisterInfo(
changePageViewIndex: changePageViewIndex,
),
RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2),
// NewEReferralStepOnePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
],
),
),
]),
),
),
bottomSheet: Container(
decoration: BoxDecoration(color: Color(0xffF8F8F8)),
// height: 160,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: CustomButton(
text: TranslationBase.of(context).login,
icon: "assets/images/svg/login1.svg",
onPressed: () {
// bool isValid = validateIqama(nationIdController.text);
// print("Iqama is valid: $isValid");
if (true) {
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(
countryCode: "966",
initialPhoneNumber: "",
textController: phoneController, // Assumed to be a TextEditingController
buttons: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: "Send me OTP on SMS",
onPressed: () {
Utils.onOtpBtnPressed(OTPType.sms, phoneController);
},
backgroundColor: Colors.red,
borderColor: Colors.red,
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(
"OR",
fontSize: 16,
fontFamily: 'poppins',
color: Color(0xFF2E3039),
fontWeight: FontWeight.w500,
),
),
],
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: "Send me OTP on WhatsApp",
onPressed: () {
Utils.onOtpBtnPressed(OTPType.whatsapp, phoneController);
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
icon: "assets/images/svg/whatsapp.svg",
),
),
],
),
),
));
} else {
Utils.showErrorToast("Please enter a valid Iqama number.");
}
}),
),
),
RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2),
// NewEReferralStepOnePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
],
),
),
]),
)),
SizedBox(
height: 30,
)
],
),
),
);
}

@ -44,8 +44,6 @@ import 'package:flutter_svg/svg.dart';
import 'package:intl/src/intl/date_format.dart';
import 'package:provider/provider.dart';
enum OTPType { sms, whatsapp }
class WelcomeLogin extends StatefulWidget {
@override
_WelcomeLogin createState() => _WelcomeLogin();
@ -55,6 +53,8 @@ class _WelcomeLogin extends State<WelcomeLogin> {
bool isLoading = true;
TextEditingController nationIdController = TextEditingController();
TextEditingController phoneController = TextEditingController();
//checkUserAuthentication();
bool isDubai = false;
var _availableBiometrics;
final authService = AuthProvider();
@ -122,7 +122,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Utils.showLottie(context: context, assetPath: 'assets/anims/lottie/login.json', width: 238, repeat: true),
Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/login.json', width: 238, repeat: true),
// SvgPicture.asset("assets/images/new/hmg_icon.svg", height: 62, width: 62),
Spacer(flex: 1),
Text(
@ -163,7 +163,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
text: TranslationBase.of(context).login,
icon: "assets/images/svg/login1.svg",
onPressed: () {
bool isValid = validateIqama(nationIdController.text);
bool isValid = Utils.validateIqama(nationIdController.text);
print("Iqama is valid: $isValid");
if (isValid) {
showModalBottomSheet(
@ -184,7 +184,10 @@ class _WelcomeLogin extends State<WelcomeLogin> {
child: CustomButton(
text: "Send me OTP on SMS",
onPressed: () {
onOtpBtnPressed(OTPType.sms);
int? val = Utils.onOtpBtnPressed(OTPType.sms, phoneController);
if (val != null) {
checkUserAuthentication(val);
}
},
backgroundColor: Colors.red,
borderColor: Colors.red,
@ -213,7 +216,10 @@ class _WelcomeLogin extends State<WelcomeLogin> {
child: CustomButton(
text: "Send me OTP on WhatsApp",
onPressed: () {
onOtpBtnPressed(OTPType.whatsapp);
int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, phoneController);
if (val != null) {
checkUserAuthentication(val);
}
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
@ -287,49 +293,6 @@ class _WelcomeLogin extends State<WelcomeLogin> {
);
}
void onOtpBtnPressed(OTPType type) {
if (phoneController.text.isEmpty) {
Utils.showErrorToast("Please enter your phone number.");
return;
}
if (type == OTPType.whatsapp && !phoneController.text.startsWith("+966")) {
Utils.showErrorToast("WhatsApp OTP requires a phone number starting with +966.");
return;
}
print("Requesting OTP for ${phoneController.text} via ${type == OTPType.whatsapp ? "WhatsApp" : "SMS"} and ${nationIdController.text}");
// Navigator.pop(context);
checkUserAuthentication(type == OTPType.sms ? 1 : 2);
}
bool validateIqama(String iqamaNumber) {
// Remove any non-digit characters
String cleanedIqama = iqamaNumber.replaceAll(RegExp(r'[^0-9]'), '');
// Check if length is 10 digits
if (cleanedIqama.length != 10) {
return false;
}
// Check if first digit is 2 or 1 (common for Iqama)
int firstDigit = int.parse(cleanedIqama[0]);
if (firstDigit != 2 && firstDigit != 1) {
return false;
}
// Checksum validation (similar to Saudi National ID)
int sum = 0;
for (int i = 0; i < 10; i++) {
int digit = int.parse(cleanedIqama[i]);
int weight = (i % 2 == 0) ? 2 : 1; // Alternate weights: 2, 1, 2, 1...
int product = digit * weight;
sum += (product > 9) ? product - 9 : product; // Sum digits if product > 9
}
return sum % 10 == 0;
}
checkUserAuthentication(type) {
showLoader(true);
var req = getCommonRequest(type: type);

@ -66,7 +66,52 @@ import 'navigation_service.dart';
AppSharedPreferences sharedPref = new AppSharedPreferences();
enum OTPType { sms, whatsapp }
class Utils {
static int? onOtpBtnPressed(OTPType type, TextEditingController controller) {
if (controller.text.isEmpty) {
Utils.showErrorToast("Please enter your phone number.");
return null;
}
if (type == OTPType.whatsapp && !controller.text.startsWith("+966")) {
Utils.showErrorToast("WhatsApp OTP requires a phone number starting with +966.");
return null;
}
print("Requesting OTP for ${controller.text} via ${type == OTPType.whatsapp ? "WhatsApp" : "SMS"} and "
//$"{nationIdController.text}"
);
return type == OTPType.sms ? 1 : 2;
}
static bool validateIqama(String iqamaNumber) {
// Remove any non-digit characters
String cleanedIqama = iqamaNumber.replaceAll(RegExp(r'[^0-9]'), '');
// Check if length is 10 digits
if (cleanedIqama.length != 10) {
return false;
}
// Check if first digit is 2 or 1 (common for Iqama)
int firstDigit = int.parse(cleanedIqama[0]);
if (firstDigit != 2 && firstDigit != 1) {
return false;
}
// Checksum validation (similar to Saudi National ID)
int sum = 0;
for (int i = 0; i < 10; i++) {
int digit = int.parse(cleanedIqama[i]);
int weight = (i % 2 == 0) ? 2 : 1; // Alternate weights: 2, 1, 2, 1...
int product = digit * weight;
sum += (product > 9) ? product - 9 : product; // Sum digits if product > 9
}
return sum % 10 == 0;
}
static void changeAppLanguage({required BuildContext context}) {
sharedPref.setBool(IS_ROBOT_INIT, false);
sharedPref.remove(CLINICS_LIST);

Loading…
Cancel
Save