Silent Login

development_mirza
mirza.shafique 3 years ago
parent 2b9afe5b58
commit 4eb6faf415

@ -5,9 +5,9 @@
"login": "تسجيل الدخول",
"drSulaiman": "سليمان الحبيب",
"welcomeTo": "مرحبا بك في",
"userID" : "معرف المستخدم",
"password" : "كلمة المرور",
"branch" : "فرع",
"userID": "معرف المستخدم",
"password": "كلمة المرور",
"branch": "فرع",
"pleaseEnterLoginDetails": "الرجاء إدخال التفاصيل أدناه لتسجيل الدخول",
"username": "اسم المستخدم",
"welcomeBack": "مرحبا بعودتك",
@ -47,7 +47,11 @@
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق",
"moreVerificationOpts" :"المزيد من خيارات التحقق",
"select": "Select"
"moreVerificationOpts": "المزيد من خيارات التحقق",
"select": "Select",
"days": "أيام",
"hr": "س",
"min": "د",
"years": "سنة",
"months": "أشهر"
}

@ -48,5 +48,10 @@
"resend": "Resend",
"codeExpire": "The verification code has been expired",
"moreVerificationOpts" :"More verification options",
"select": "Select"
"select": "Select",
"days": "Days",
"hr": "Hr",
"min": "Min",
"years": "Years",
"months": "Months"
}

@ -1,10 +1,9 @@
class ApiConsts {
static const MAX_SMALL_SCREEN = 660;
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
static String baseUrl = 'https://hmgwebservices.com/';
static String baseUrl = 'https://hmgwebservices.com/';
// static String baseUrl = 'https://uat.hmgwebservices.com/';
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
@ -27,14 +26,15 @@ class ApiConsts {
class SharedPrefsConsts {
static String isRememberMe = "remember_me";
static String username = "username";
static String username = "doctorId";
static String password = "password";
static String privilegeList = "privilegeList";
static String firebaseToken = "firebaseToken";
static String memberInformation = "memberInformation";
static String welcomeVideoUrl = "welcomeVideoUrl";
static String doNotShowWelcomeVideo = "doNotShowWelcomeVideo";
static String mohemmWifiSSID = "mohemmWifiSSID";
static String mohemmWifiPassword = "mohemmWifiPassword";
static String editItemForSale = "editItemForSale";
static String logInTokenID = "logInTokenID";
static String vidaAuthTokenID = "vidaAuthTokenID";
static String vidaRefreshTokenID = "vidaRefreshTokenID";
static String authenticationTokenID = "authenticationTokenID";
static String projectID = "projectID";
static String clinicId = "clinicId";
static String lastLoginDate = "lastLoginDate";
static String lastLoginTime = "lastLoginTime";
static String memberModel = "memberModel";
}

@ -0,0 +1,415 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:hmg_nurses/generated/locale_keys.g.dart';
import 'package:intl/intl.dart';
class AppDateUtils {
static String convertDateToFormat(DateTime dateTime, String dateFormat) {
return DateFormat(dateFormat).format(dateTime);
}
static DateTime convertISOStringToDateTime(String date) {
DateTime newDate;
newDate = DateTime.parse(date);
return newDate;
}
static String convertStringToDateFormat(String date, String dateFormat) {
DateTime dateTime;
if (date.contains("/Date"))
dateTime = getDateTimeFromServerFormat(date);
else
dateTime = DateTime.parse(date);
return convertDateToFormat(dateTime, dateFormat);
}
static String convertToServerFormat(String date, String dateFormat) {
return '/Date(${DateFormat(dateFormat).parse(date).millisecondsSinceEpoch})/';
}
static String convertDateToServerFormat(DateTime date) {
return '/Date(${date.millisecondsSinceEpoch})/';
}
static convertDateFromServerFormat(String str, dateFormat) {
var date = getDateTimeFromServerFormat(str);
return DateFormat(dateFormat).format(date);
}
static DateTime getDateTimeFromServerFormat(String str) {
DateTime date = DateTime.now();
if (str != null) {
const start = "/Date(";
const end = "+0300)";
if (str.contains("/Date")) {
final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length);
date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
} else {
date = DateTime.now();
}
} else {
date = DateTime.parse(str);
}
return date;
}
static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) {
DateTime now = DateTime.now();
// now = now.add(Duration(days: 400, minutes: 0));
var difference = firstDate.difference(now);
int years = now.year - firstDate.year;
int months = now.month - firstDate.month;
int days = now.day - firstDate.day;
if (months < 0 || (months == 0 && days < 0)) {
years--;
months += (days < 0 ? 11 : 12);
}
if (days < 0) {
final monthAgo = new DateTime(now.year, now.month - 1, firstDate.day);
days = now.difference(monthAgo).inDays + 1;
}
return "$days ${LocaleKeys.days.tr()}, $months ${LocaleKeys.months.tr()}, $years ${LocaleKeys.years.tr()}";
}
static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context, {bool isShowSecond = false, bool isShowDays = true}) {
DateTime now = DateTime.now();
var difference = now.difference(firstDate);
int minutesInDays = difference.inMinutes;
int secondInDays = difference.inSeconds;
int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int second = secondInDays % 60;
int minutes = minutesInDays % 60;
int days = hoursInDays ~/ 24;
int hours = hoursInDays % 24;
double hoursInOneDay = difference.inHours / difference.inDays;
return (isShowDays ? (days > 0 ? "$days ${LocaleKeys.days.tr()}," : '') : "") +
(hours > 0 ? "$hours ${LocaleKeys.hr.tr()}," : "") +
" $minutes ${LocaleKeys.min.tr()}" +
(isShowSecond ? ", $second Sec" : "");
}
static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) {
const start = "/Date(";
const end = "+0300)";
final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
return differenceBetweenDateAndCurrent(date, context);
}
/// get month by
/// [weekDay] convert week day in int to week day name
static getWeekDay(int weekDay) {
switch (weekDay) {
case 1:
return "Monday";
case 2:
return "Tuesday";
case 3:
return "Wednesday";
case 4:
return "Thursday";
case 5:
return "Friday";
case 6:
return "Saturday ";
case 7:
return "Sunday";
}
}
/// get month by
/// [weekDay] convert week day in int to week day name arabic
static getWeekDayArabic(int weekDay) {
switch (weekDay) {
case 1:
return "الاثنين";
case 2:
return "الثلاثاء";
case 3:
return "الاربعاء";
case 4:
return "الخميس";
case 5:
return "الجمعه";
case 6:
return "السبت ";
case 7:
return "الاحد";
}
}
/// get month by
/// [month] convert month number in to month name
static getMonth(int month) {
switch (month) {
case 1:
return "January";
case 2:
return "February";
case 3:
return "March";
case 4:
return "April";
case 5:
return "May";
case 6:
return "June";
case 7:
return "July";
case 8:
return "August";
case 9:
return "September";
case 10:
return "October";
case 11:
return "November";
case 12:
return "December";
}
}
/// get month by
/// [month] convert month number in to month name in Arabic
static getMonthArabic(int month) {
switch (month) {
case 1:
return "يناير";
case 2:
return " فبراير";
case 3:
return "مارس";
case 4:
return "أبريل";
case 5:
return "مايو";
case 6:
return "يونيو";
case 7:
return "يوليو";
case 8:
return "أغسطس";
case 9:
return "سبتمبر";
case 10:
return " اكتوبر";
case 11:
return " نوفمبر";
case 12:
return "ديسمبر";
}
}
static getMonthByName(String month) {
switch (month.toLowerCase()) {
case 'january':
return 1;
case 'february':
return 2;
case 'march':
return 3;
case 'april':
return 4;
case 'may':
return 5;
case 'june':
return 6;
case 'july':
return 7;
case 'august':
return 8;
case 'september':
return 9;
case 'october':
return 10;
case 'november':
return 11;
case 'december':
return 12;
}
}
static DateTime convertStringToDate(String date) {
// /Date(1585774800000+0300)/
if (date != null) {
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
DateTime newDate = DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
);
return newDate;
} else
return DateTime.now();
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
if (dateTime != null)
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
else
return "";
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted
static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) {
if (dateTime != null)
return isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
else
return "";
}
/// get data formatted like 26 Apr 2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false, bool isMonthShort = true}) {
if (dateTime != null)
return dateTime.day.toString() +
" " +
"${isArabic ? getMonthArabic(dateTime.month) : isMonthShort ? getMonth(dateTime.month).toString().substring(0, 3) : getMonth(dateTime.month)}" +
" " +
dateTime.year.toString();
else
return "";
}
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) {
if (dateTime != null)
return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString();
else
return "";
}
/// get data formatted like 10:45 PM
/// [dateTime] convert DateTime to data formatted
static String getHour(DateTime dateTime) {
return DateFormat('hh:mm a').format(dateTime);
}
static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate;
if (birthOfDate.contains("/Date")) {
birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate);
} else {
birthDate = DateTime.parse(birthOfDate);
}
final now = DateTime.now();
int years = now.year - birthDate.year;
int months = now.month - birthDate.month;
int days = now.day - birthDate.day;
if (months < 0 || (months == 0 && days < 0)) {
years--;
months += (days < 0 ? 11 : 12);
}
if (days < 0) {
final monthAgo = new DateTime(now.year, now.month - 1, birthDate.day);
days = now.difference(monthAgo).inDays + 1;
}
return "$years ${LocaleKeys.years.tr()} $months ${LocaleKeys.months.tr()} $days ${LocaleKeys.days.tr()}";
}
static bool isToday(DateTime dateTime) {
DateTime todayDate = DateTime.now().toUtc();
if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) {
return true;
}
return false;
}
static String getDate(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString();
else
return "";
}
static String getDateFormatted(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
else
return "";
}
static String getTimeHHMMA(DateTime dateTime) {
return DateFormat('hh:mm a').format(dateTime);
}
static String getTimeHHMMA2(DateTime dateTime) {
return DateFormat('hh:mm').format(dateTime);
}
static String getStartTime(String dateTime) {
String time = dateTime;
if (dateTime.length > 7) time = dateTime.substring(0, 5);
return time;
}
static String getTimeFormated(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return dateTime.hour.toString() + ":" + dateTime.minute.toString();
else
return "";
}
// handel date like "09/05/2021 17:00"
static DateTime getDateTimeFromString(String str) {
List<String> array = str.split('/');
int day = int.parse(array[0]);
int month = int.parse(array[1]);
List<String> array2 = array[2].split(' ');
int year = int.parse(array2[0]);
String hour = array2[1];
List<String> hourList = hour.split(":");
DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1]));
return date;
}
static convertDateFormatImproved(String str) {
String newDate = "";
const start = "/Date(";
if (str.isNotEmpty) {
const end = "+0300)";
final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
newDate = date.year.toString() + "/" + date.month.toString().padLeft(2, '0') + "/" + date.day.toString().padLeft(2, '0');
}
return newDate;
}
}

@ -24,7 +24,7 @@ enum ViewState {
enum LoginType {
FROM_LOGIN,
DIRECT_LOGIN,
SILENT_LOGIN,
REGISTER_BIO,
REGISTER_NEW_BIO,
}

@ -70,16 +70,15 @@ class Utils {
}
static void hideLoading() {
try{
try {
if (_isLoadingVisible) {
_isLoadingVisible = false;
Navigator.of(navigatorKey.currentContext!).pop();
}
_isLoadingVisible = false;
}catch(e){
print("exp_while_hide_dialog: "+e.toString());
} catch (e) {
print("exp_while_hide_dialog: " + e.toString());
}
}
static Future<String> getStringFromPrefs(String key) async {
@ -92,6 +91,16 @@ class Utils {
return await prefs.setString(key, value);
}
static Future<int> getIntFromPrefs(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getInt(key) ?? 0;
}
static Future<bool> saveIntFromPrefs(String key, int value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setInt(key, value);
}
static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) {
String errorMessage;
if (exception is APIException) {
@ -244,6 +253,8 @@ class Utils {
return DateFormat('dd-MMM-yyyy').format(date);
}
static String reverseFormatDate(String date) {
String formattedDate;
if (date.isNotEmpty) {
@ -292,7 +303,7 @@ class Utils {
String formattedDate;
if (date.isNotEmpty) {
formattedDate = date.split('T')[0];
if(!formattedDate.contains("00:00:00")) {
if (!formattedDate.contains("00:00:00")) {
formattedDate = formattedDate + ' 00:00:00';
}
} else {
@ -329,21 +340,24 @@ class Utils {
return selectedDate;
}
// static void readNFc({required Function(String) onRead}) {
//
// NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
// print(tag.data);
// var f;
// if (Platform.isAndroid) {
// f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
// } else {
// f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
// }
// String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join('');
// NfcManager.instance.stopSession();
// onRead(identifier);
// }).catchError((err) {
// print(err);
// });
// }
// static void readNFc({required Function(String) onRead}) {
//
// NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
// print(tag.data);
// var f;
// if (Platform.isAndroid) {
// f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
// } else {
// f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
// }
// String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join('');
// NfcManager.instance.stopSession();
// onRead(identifier);
// }).catchError((err) {
// print(err);
// });
// }
}

@ -1,7 +1,9 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
import 'package:hmg_nurses/model/base/post_params_model.dart';
import 'package:hmg_nurses/model/login/imei_details_model.dart';
import 'package:hmg_nurses/model/login/list_doctors_clinic_model.dart';
import 'package:hmg_nurses/model/login/member_login_model.dart';
@ -17,9 +19,15 @@ class AppState {
int projectID = 0;
int clinicId = 0;
List<ListDoctorsClinicModel>? listDoctorsClinic;
int lastLoginTyp = 0;
int? doctorUserId;
String? password;
String? doctorIdFromDB;
String? lastLoginDate;
GetIMEIDetailsModel? lastLoginImeiDate;
List<ListDoctorsClinicModel>? listDoctorsClinic;
GenericResponseModel2? doctorProfile;
bool isAuthenticated = false;
@ -44,7 +52,7 @@ class AppState {
String? get getForgetPasswordTokenID => forgetPasswordTokenID;
PostParamsModel _postParamsInitConfig = PostParamsModel(
tokenID: "@dm!n",
tokenID: "",
languageID: 2,
stamp: "",
iPAdress: "9.9.9.9",

@ -2,6 +2,7 @@
// import 'package:flutter/material.dart';
import 'package:hmg_nurses/config/app_state.dart';
import 'package:hmg_nurses/services/api_client.dart';
import 'package:hmg_nurses/services/api_repo/dashboard_api_repo.dart';
import 'package:hmg_nurses/services/api_repo/login_api_repo.dart';
import 'package:hmg_nurses/services/firebase_service.dart';
@ -19,5 +20,6 @@ class AppDependencies {
//repos
injector.registerSingleton<ILoginApiRepo>(() => LoginApiRepo());
injector.registerSingleton<IDashboardApiRepo>(() => DashboardApiRepo());
}
}

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:hmg_nurses/ui/dashboard/dashbaord_page.dart';
import 'package:hmg_nurses/ui/login/login_method_page.dart';
import 'package:hmg_nurses/ui/login/login_page.dart';
import 'package:hmg_nurses/ui/login/splash_page.dart';
class AppRoutes {
static const String initialPage =login;
static const String initialPage = login;
//Login
static const String splash = "/splash";
@ -13,11 +13,16 @@ class AppRoutes {
static const String loginMethodsPage = "/loginMethodsPage";
static const String login = "/login";
//Dashboard
static const String dashboard = "/dashboard";
static final Map<String, WidgetBuilder> routes = {
//Login
splash: (BuildContext context) => SplashPage(),
login: (BuildContext context) => LoginPage(),
login: (BuildContext context) => LoginPage(),
loginMethodsPage: (BuildContext context) => const LoginMethodsPage(),
//Dashboard
dashboard: (BuildContext context) => DashboardPage(),
};
}

@ -64,7 +64,12 @@ class CodegenLoader extends AssetLoader{
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق",
"moreVerificationOpts": "المزيد من خيارات التحقق",
"select": "Select"
"select": "Select",
"days": "أيام",
"hr": "س",
"min": "د",
"years": "سنة",
"months": "أشهر"
};
static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm",
@ -116,7 +121,12 @@ static const Map<String,dynamic> en_US = {
"resend": "Resend",
"codeExpire": "The verification code has been expired",
"moreVerificationOpts": "More verification options",
"select": "Select"
"select": "Select",
"days": "Days",
"hr": "Hr",
"min": "Min",
"years": "Years",
"months": "Months"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -63,6 +63,9 @@ Future<void> main() async {
),
ChangeNotifierProvider<LoginViewModel>(
create: (_) => LoginViewModel(),
),
ChangeNotifierProvider<DashboardProviderModel>(
create: (_) => DashboardProviderModel(),
)
],
child: MyApp(),

@ -456,7 +456,7 @@ class GenericResponseModel {
listDiabeticChartValues: json["List_DiabeticChartValues"],
listDiagnosisForInPatient: json["List_DiagnosisForInPatient"],
listDischargeSummary: json["List_DischargeSummary"],
listDoctorDeviceDetails: json["List_DoctorDeviceDetails"] == null ? null : List<GetIMEIDetailsModel>.from(json["List_DoctorDeviceDetails"].map((x) => x)),
listDoctorDeviceDetails: json["List_DoctorDeviceDetails"] == null ? null : List<GetIMEIDetailsModel>.from(json["List_DoctorDeviceDetails"].map((x) => GetIMEIDetailsModel.fromJson(x))),
listDoctorProfile: json["List_DoctorProfile"],
listDoctorProgressNote: json["List_DoctorProgressNote"],
listDoctorsClinic: json["List_DoctorsClinic"] == null ? null : List<ListDoctorsClinicModel>.from(json["List_DoctorsClinic"].map((x) => ListDoctorsClinicModel.fromJson(x))),

@ -62,46 +62,46 @@ class PostParamsModel {
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['DeviceTypeID'] = this.deviceTypeID;
data['generalid']=this.generalID;
data['generalid'] = this.generalID;
return data;
}
// Map<String, dynamic> toJsonAfterLogin() {
// Map<String, dynamic> data = new Map<String, dynamic>();
// data['VersionID'] = this.versionID;
// data['Channel'] = this.channel;
// data['LanguageID'] = this.languageID;
// data['MobileType'] = this.mobileType;
// data['LogInTokenID'] = this.logInTokenID;
// data['TokenID'] = this.tokenID;
// data['MobileNumber'] = this.mobileNumber;
// data['UserName'] = this.userName;
// data['P_EMAIL_ADDRESS'] = this.pEmailAddress;
// data['P_SESSION_ID'] = this.pSessionId;
// data['PayrollCodeStr'] = this.payrollCodeStr;
// data['LegislationCodeStr'] = this.pLegislationCode;
// data['P_SELECTED_EMPLOYEE_NUMBER'] = this.pSelectedEmployeeNumber;
// data['P_USER_NAME'] = this.pUserName;
// return data;
// }
//
// set setLogInTokenID(String? token) => logInTokenID = token;
//
// set setTokenID(String? token) => tokenID = token;
//
// set setMobileNumer(String? v) => mobileNumber = v;
//
// set setUserName(String? v) => userName = v;
//
// set setPEmailAddress(String? v) => pEmailAddress = v;
//
// set setPSessionId(int? v) => pSessionId = v;
//
// set setPUserName(String? v) => pUserName = v;
//
// set setPSelectedEmployeeNumber(String? v) => pSelectedEmployeeNumber = v;
//
// set setPLegislationCode(String? v) => pLegislationCode = v;
//
// set setPayrollCodeStr(String? v) => payrollCodeStr = v;
// Map<String, dynamic> toJsonAfterLogin() {
// Map<String, dynamic> data = new Map<String, dynamic>();
// data['VersionID'] = this.versionID;
// data['Channel'] = this.channel;
// data['LanguageID'] = this.languageID;
// data['MobileType'] = this.mobileType;
// data['LogInTokenID'] = this.logInTokenID;
// data['TokenID'] = this.tokenID;
// data['MobileNumber'] = this.mobileNumber;
// data['UserName'] = this.userName;
// data['P_EMAIL_ADDRESS'] = this.pEmailAddress;
// data['P_SESSION_ID'] = this.pSessionId;
// data['PayrollCodeStr'] = this.payrollCodeStr;
// data['LegislationCodeStr'] = this.pLegislationCode;
// data['P_SELECTED_EMPLOYEE_NUMBER'] = this.pSelectedEmployeeNumber;
// data['P_USER_NAME'] = this.pUserName;
// return data;
// }
//
// set setLogInTokenID(String? token) => logInTokenID = token;
//
// set setTokenID(String? token) => tokenID = token;
//
// set setMobileNumer(String? v) => mobileNumber = v;
//
// set setUserName(String? v) => userName = v;
//
// set setPEmailAddress(String? v) => pEmailAddress = v;
//
// set setPSessionId(int? v) => pSessionId = v;
//
// set setPUserName(String? v) => pUserName = v;
//
// set setPSelectedEmployeeNumber(String? v) => pSelectedEmployeeNumber = v;
//
// set setPLegislationCode(String? v) => pLegislationCode = v;
//
// set setPayrollCodeStr(String? v) => payrollCodeStr = v;
}

@ -96,100 +96,100 @@ class DoctorProfileListModel {
final int? serviceId;
factory DoctorProfileListModel.fromJson(Map<String, dynamic> json) => DoctorProfileListModel(
doctorId: json["DoctorID"] == null ? null : json["DoctorID"],
doctorName: json["DoctorName"] == null ? null : json["DoctorName"],
doctorNameN: json["DoctorNameN"],
clinicId: json["ClinicID"] == null ? null : json["ClinicID"],
clinicDescription: json["ClinicDescription"] == null ? null : json["ClinicDescription"],
clinicDescriptionN: json["ClinicDescriptionN"],
licenseExpiry: json["LicenseExpiry"],
employmentType: json["EmploymentType"] == null ? null : json["EmploymentType"],
setupId: json["SetupID"],
projectId: json["ProjectID"] == null ? null : json["ProjectID"],
projectName: json["ProjectName"] == null ? null : json["ProjectName"],
nationalityId: json["NationalityID"] == null ? null : json["NationalityID"],
nationalityName: json["NationalityName"] == null ? null : json["NationalityName"],
nationalityNameN: json["NationalityNameN"],
gender: json["Gender"] == null ? null : json["Gender"],
genderDescription: json["Gender_Description"] == null ? null : json["Gender_Description"],
genderDescriptionN: json["Gender_DescriptionN"],
doctorTitle: json["DoctorTitle"],
projectNameN: json["ProjectNameN"],
isAllowWaitList: json["IsAllowWaitList"] == null ? null : json["IsAllowWaitList"],
titleDescription: json["Title_Description"] == null ? null : json["Title_Description"],
titleDescriptionN: json["Title_DescriptionN"],
isRegistered: json["IsRegistered"],
isDoctorDummy: json["IsDoctorDummy"],
isActive: json["IsActive"] == null ? null : json["IsActive"],
isDoctorAppointmentDisplayed: json["IsDoctorAppointmentDisplayed"],
doctorClinicActive: json["DoctorClinicActive"] == null ? null : json["DoctorClinicActive"],
isbookingAllowed: json["IsbookingAllowed"],
doctorCases: json["DoctorCases"] == null ? null : json["DoctorCases"],
doctorPicture: json["DoctorPicture"],
doctorProfileInfo: json["DoctorProfileInfo"] == null ? null : json["DoctorProfileInfo"],
specialty: json["Specialty"] == null ? null : List<String>.from(json["Specialty"].map((x) => x)),
actualDoctorRate: json["ActualDoctorRate"] == null ? null : json["ActualDoctorRate"],
consultationFee: json["ConsultationFee"] == null ? null : json["ConsultationFee"],
decimalDoctorRate: json["DecimalDoctorRate"] == null ? null : json["DecimalDoctorRate"].toDouble(),
doctorImageUrl: json["DoctorImageURL"] == null ? null : json["DoctorImageURL"],
doctorMobileNumber: json["DoctorMobileNumber"] == null ? null : json["DoctorMobileNumber"],
doctorRate: json["DoctorRate"] == null ? null : json["DoctorRate"],
doctorStarsRate: json["DoctorStarsRate"] == null ? null : json["DoctorStarsRate"],
doctorTitleForProfile: json["DoctorTitleForProfile"] == null ? null : json["DoctorTitleForProfile"],
isAppointmentAllowed: json["IsAppointmentAllowed"] == null ? null : json["IsAppointmentAllowed"],
isDoctorHasPrePostImages: json["IsDoctorHasPrePostImages"] == null ? null : json["IsDoctorHasPrePostImages"],
nationalityFlagUrl: json["NationalityFlagURL"] == null ? null : json["NationalityFlagURL"],
noOfPatientsRate: json["NoOfPatientsRate"] == null ? null : json["NoOfPatientsRate"],
qr: json["QR"] == null ? null : json["QR"],
serviceId: json["ServiceID"] == null ? null : json["ServiceID"],
);
doctorId: json["DoctorID"] == null ? null : json["DoctorID"],
doctorName: json["DoctorName"] == null ? null : json["DoctorName"],
doctorNameN: json["DoctorNameN"],
clinicId: json["ClinicID"] == null ? null : json["ClinicID"],
clinicDescription: json["ClinicDescription"] == null ? null : json["ClinicDescription"],
clinicDescriptionN: json["ClinicDescriptionN"],
licenseExpiry: json["LicenseExpiry"],
employmentType: json["EmploymentType"] == null ? null : json["EmploymentType"],
setupId: json["SetupID"],
projectId: json["ProjectID"] == null ? null : json["ProjectID"],
projectName: json["ProjectName"] == null ? null : json["ProjectName"],
nationalityId: json["NationalityID"] == null ? null : json["NationalityID"],
nationalityName: json["NationalityName"] == null ? null : json["NationalityName"],
nationalityNameN: json["NationalityNameN"],
gender: json["Gender"] == null ? null : json["Gender"],
genderDescription: json["Gender_Description"] == null ? null : json["Gender_Description"],
genderDescriptionN: json["Gender_DescriptionN"],
doctorTitle: json["DoctorTitle"],
projectNameN: json["ProjectNameN"],
isAllowWaitList: json["IsAllowWaitList"] == null ? null : json["IsAllowWaitList"],
titleDescription: json["Title_Description"] == null ? null : json["Title_Description"],
titleDescriptionN: json["Title_DescriptionN"],
isRegistered: json["IsRegistered"],
isDoctorDummy: json["IsDoctorDummy"],
isActive: json["IsActive"] == null ? null : json["IsActive"],
isDoctorAppointmentDisplayed: json["IsDoctorAppointmentDisplayed"],
doctorClinicActive: json["DoctorClinicActive"] == null ? null : json["DoctorClinicActive"],
isbookingAllowed: json["IsbookingAllowed"],
doctorCases: json["DoctorCases"] == null ? null : json["DoctorCases"],
doctorPicture: json["DoctorPicture"],
doctorProfileInfo: json["DoctorProfileInfo"] == null ? null : json["DoctorProfileInfo"],
specialty: json["Specialty"] == null ? null : List<String>.from(json["Specialty"].map((x) => x)),
actualDoctorRate: json["ActualDoctorRate"] == null ? null : json["ActualDoctorRate"],
consultationFee: json["ConsultationFee"] == null ? null : json["ConsultationFee"],
decimalDoctorRate: json["DecimalDoctorRate"] == null ? null : json["DecimalDoctorRate"].toDouble(),
doctorImageUrl: json["DoctorImageURL"] == null ? null : json["DoctorImageURL"],
doctorMobileNumber: json["DoctorMobileNumber"] == null ? null : json["DoctorMobileNumber"],
doctorRate: json["DoctorRate"] == null ? null : json["DoctorRate"],
doctorStarsRate: json["DoctorStarsRate"] == null ? null : json["DoctorStarsRate"],
doctorTitleForProfile: json["DoctorTitleForProfile"] == null ? null : json["DoctorTitleForProfile"],
isAppointmentAllowed: json["IsAppointmentAllowed"] == null ? null : json["IsAppointmentAllowed"],
isDoctorHasPrePostImages: json["IsDoctorHasPrePostImages"] == null ? null : json["IsDoctorHasPrePostImages"],
nationalityFlagUrl: json["NationalityFlagURL"] == null ? null : json["NationalityFlagURL"],
noOfPatientsRate: json["NoOfPatientsRate"] == null ? null : json["NoOfPatientsRate"],
qr: json["QR"] == null ? null : json["QR"],
serviceId: json["ServiceID"] == null ? null : json["ServiceID"],
);
Map<String, dynamic> toJson() => {
"DoctorID": doctorId == null ? null : doctorId,
"DoctorName": doctorName == null ? null : doctorName,
"DoctorNameN": doctorNameN,
"ClinicID": clinicId == null ? null : clinicId,
"ClinicDescription": clinicDescription == null ? null : clinicDescription,
"ClinicDescriptionN": clinicDescriptionN,
"LicenseExpiry": licenseExpiry,
"EmploymentType": employmentType == null ? null : employmentType,
"SetupID": setupId,
"ProjectID": projectId == null ? null : projectId,
"ProjectName": projectName == null ? null : projectName,
"NationalityID": nationalityId == null ? null : nationalityId,
"NationalityName": nationalityName == null ? null : nationalityName,
"NationalityNameN": nationalityNameN,
"Gender": gender == null ? null : gender,
"Gender_Description": genderDescription == null ? null : genderDescription,
"Gender_DescriptionN": genderDescriptionN,
"DoctorTitle": doctorTitle,
"ProjectNameN": projectNameN,
"IsAllowWaitList": isAllowWaitList == null ? null : isAllowWaitList,
"Title_Description": titleDescription == null ? null : titleDescription,
"Title_DescriptionN": titleDescriptionN,
"IsRegistered": isRegistered,
"IsDoctorDummy": isDoctorDummy,
"IsActive": isActive == null ? null : isActive,
"IsDoctorAppointmentDisplayed": isDoctorAppointmentDisplayed,
"DoctorClinicActive": doctorClinicActive == null ? null : doctorClinicActive,
"IsbookingAllowed": isbookingAllowed,
"DoctorCases": doctorCases == null ? null : doctorCases,
"DoctorPicture": doctorPicture,
"DoctorProfileInfo": doctorProfileInfo == null ? null : doctorProfileInfo,
"Specialty": specialty == null ? null : List<dynamic>.from(specialty!.map((x) => x)),
"ActualDoctorRate": actualDoctorRate == null ? null : actualDoctorRate,
"ConsultationFee": consultationFee == null ? null : consultationFee,
"DecimalDoctorRate": decimalDoctorRate == null ? null : decimalDoctorRate,
"DoctorImageURL": doctorImageUrl == null ? null : doctorImageUrl,
"DoctorMobileNumber": doctorMobileNumber == null ? null : doctorMobileNumber,
"DoctorRate": doctorRate == null ? null : doctorRate,
"DoctorStarsRate": doctorStarsRate == null ? null : doctorStarsRate,
"DoctorTitleForProfile": doctorTitleForProfile == null ? null : doctorTitleForProfile,
"IsAppointmentAllowed": isAppointmentAllowed == null ? null : isAppointmentAllowed,
"IsDoctorHasPrePostImages": isDoctorHasPrePostImages == null ? null : isDoctorHasPrePostImages,
"NationalityFlagURL": nationalityFlagUrl == null ? null : nationalityFlagUrl,
"NoOfPatientsRate": noOfPatientsRate == null ? null : noOfPatientsRate,
"QR": qr == null ? null : qr,
"ServiceID": serviceId == null ? null : serviceId,
};
"DoctorID": doctorId == null ? null : doctorId,
"DoctorName": doctorName == null ? null : doctorName,
"DoctorNameN": doctorNameN,
"ClinicID": clinicId == null ? null : clinicId,
"ClinicDescription": clinicDescription == null ? null : clinicDescription,
"ClinicDescriptionN": clinicDescriptionN,
"LicenseExpiry": licenseExpiry,
"EmploymentType": employmentType == null ? null : employmentType,
"SetupID": setupId,
"ProjectID": projectId == null ? null : projectId,
"ProjectName": projectName == null ? null : projectName,
"NationalityID": nationalityId == null ? null : nationalityId,
"NationalityName": nationalityName == null ? null : nationalityName,
"NationalityNameN": nationalityNameN,
"Gender": gender == null ? null : gender,
"Gender_Description": genderDescription == null ? null : genderDescription,
"Gender_DescriptionN": genderDescriptionN,
"DoctorTitle": doctorTitle,
"ProjectNameN": projectNameN,
"IsAllowWaitList": isAllowWaitList == null ? null : isAllowWaitList,
"Title_Description": titleDescription == null ? null : titleDescription,
"Title_DescriptionN": titleDescriptionN,
"IsRegistered": isRegistered,
"IsDoctorDummy": isDoctorDummy,
"IsActive": isActive == null ? null : isActive,
"IsDoctorAppointmentDisplayed": isDoctorAppointmentDisplayed,
"DoctorClinicActive": doctorClinicActive == null ? null : doctorClinicActive,
"IsbookingAllowed": isbookingAllowed,
"DoctorCases": doctorCases == null ? null : doctorCases,
"DoctorPicture": doctorPicture,
"DoctorProfileInfo": doctorProfileInfo == null ? null : doctorProfileInfo,
"Specialty": specialty == null ? null : List<dynamic>.from(specialty!.map((x) => x)),
"ActualDoctorRate": actualDoctorRate == null ? null : actualDoctorRate,
"ConsultationFee": consultationFee == null ? null : consultationFee,
"DecimalDoctorRate": decimalDoctorRate == null ? null : decimalDoctorRate,
"DoctorImageURL": doctorImageUrl == null ? null : doctorImageUrl,
"DoctorMobileNumber": doctorMobileNumber == null ? null : doctorMobileNumber,
"DoctorRate": doctorRate == null ? null : doctorRate,
"DoctorStarsRate": doctorStarsRate == null ? null : doctorStarsRate,
"DoctorTitleForProfile": doctorTitleForProfile == null ? null : doctorTitleForProfile,
"IsAppointmentAllowed": isAppointmentAllowed == null ? null : isAppointmentAllowed,
"IsDoctorHasPrePostImages": isDoctorHasPrePostImages == null ? null : isDoctorHasPrePostImages,
"NationalityFlagURL": nationalityFlagUrl == null ? null : nationalityFlagUrl,
"NoOfPatientsRate": noOfPatientsRate == null ? null : noOfPatientsRate,
"QR": qr == null ? null : qr,
"ServiceID": serviceId == null ? null : serviceId,
};
}

@ -4,6 +4,9 @@
import 'dart:convert';
import 'package:hmg_nurses/classes/consts.dart';
import 'package:shared_preferences/shared_preferences.dart';
MemberLoginModel memberLoginModelFromJson(String str) => MemberLoginModel.fromJson(json.decode(str));
String memberLoginModelToJson(MemberLoginModel data) => json.encode(data.toJson());
@ -98,94 +101,105 @@ class MemberLoginModel {
final bool? isSmsSent;
factory MemberLoginModel.fromJson(Map<String, dynamic> json) => MemberLoginModel(
date: json["Date"],
languageId: json["LanguageID"] == null ? null : json["LanguageID"],
serviceName: json["ServiceName"] == null ? null : json["ServiceName"],
time: json["Time"],
androidLink: json["AndroidLink"],
authenticationTokenId: json["AuthenticationTokenID"],
data: json["Data"],
dataw: json["Dataw"] == null ? null : json["Dataw"],
dietType: json["DietType"] == null ? null : json["DietType"],
dietTypeId: json["DietTypeID"] == null ? null : json["DietTypeID"],
errorCode: json["ErrorCode"],
errorEndUserMessage: json["ErrorEndUserMessage"],
errorEndUserMessageN: json["ErrorEndUserMessageN"],
errorMessage: json["ErrorMessage"],
errorType: json["ErrorType"] == null ? null : json["ErrorType"],
foodCategory: json["FoodCategory"] == null ? null : json["FoodCategory"],
iosLink: json["IOSLink"],
isAuthenticated: json["IsAuthenticated"] == null ? null : json["IsAuthenticated"],
mealOrderStatus: json["MealOrderStatus"] == null ? null : json["MealOrderStatus"],
mealType: json["MealType"] == null ? null : json["MealType"],
messageStatus: json["MessageStatus"] == null ? null : json["MessageStatus"],
numberOfResultRecords: json["NumberOfResultRecords"] == null ? null : json["NumberOfResultRecords"],
patientBlodType: json["PatientBlodType"],
successMsg: json["SuccessMsg"],
successMsgN: json["SuccessMsgN"],
vidaUpdatedResponse: json["VidaUpdatedResponse"],
doctorHaveOneClinic: json["DoctorHaveOneClinic"] == null ? null : json["DoctorHaveOneClinic"],
doctorId: json["DoctorID"] == null ? null : json["DoctorID"],
erpSessionId: json["ERP_SessionID"],
listConsentMember: json["List_Consent_Member"],
listConsentMemberNew: json["List_Consent_MemberNew"],
listDoctorProfile: json["List_DoctorProfile"],
listDoctorsClinic: json["List_DoctorsClinic"],
listMemberInformation: json["List_MemberInformation"] == null ? null : List<ListMemberInformation>.from(json["List_MemberInformation"].map((x) => ListMemberInformation.fromJson(x))),
listModelDbConnect: json["List_Model_DB_Connect"],
logInTokenId: json["LogInTokenID"] == null ? null : json["LogInTokenID"],
mobileNumber: json["MobileNumber"] == null ? null : json["MobileNumber"],
selectDeviceImeIbyImeiList: json["SELECTDeviceIMEIbyIMEI_List"],
userId: json["UserID"] == null ? null : json["UserID"],
zipCode: json["ZipCode"] == null ? null : json["ZipCode"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
isSmsSent: json["isSMSSent"] == null ? null : json["isSMSSent"],
);
date: json["Date"],
languageId: json["LanguageID"] == null ? null : json["LanguageID"],
serviceName: json["ServiceName"] == null ? null : json["ServiceName"],
time: json["Time"],
androidLink: json["AndroidLink"],
authenticationTokenId: json["AuthenticationTokenID"],
data: json["Data"],
dataw: json["Dataw"] == null ? null : json["Dataw"],
dietType: json["DietType"] == null ? null : json["DietType"],
dietTypeId: json["DietTypeID"] == null ? null : json["DietTypeID"],
errorCode: json["ErrorCode"],
errorEndUserMessage: json["ErrorEndUserMessage"],
errorEndUserMessageN: json["ErrorEndUserMessageN"],
errorMessage: json["ErrorMessage"],
errorType: json["ErrorType"] == null ? null : json["ErrorType"],
foodCategory: json["FoodCategory"] == null ? null : json["FoodCategory"],
iosLink: json["IOSLink"],
isAuthenticated: json["IsAuthenticated"] == null ? null : json["IsAuthenticated"],
mealOrderStatus: json["MealOrderStatus"] == null ? null : json["MealOrderStatus"],
mealType: json["MealType"] == null ? null : json["MealType"],
messageStatus: json["MessageStatus"] == null ? null : json["MessageStatus"],
numberOfResultRecords: json["NumberOfResultRecords"] == null ? null : json["NumberOfResultRecords"],
patientBlodType: json["PatientBlodType"],
successMsg: json["SuccessMsg"],
successMsgN: json["SuccessMsgN"],
vidaUpdatedResponse: json["VidaUpdatedResponse"],
doctorHaveOneClinic: json["DoctorHaveOneClinic"] == null ? null : json["DoctorHaveOneClinic"],
doctorId: json["DoctorID"] == null ? null : json["DoctorID"],
erpSessionId: json["ERP_SessionID"],
listConsentMember: json["List_Consent_Member"],
listConsentMemberNew: json["List_Consent_MemberNew"],
listDoctorProfile: json["List_DoctorProfile"],
listDoctorsClinic: json["List_DoctorsClinic"],
listMemberInformation: json["List_MemberInformation"] == null ? null : List<ListMemberInformation>.from(json["List_MemberInformation"].map((x) => ListMemberInformation.fromJson(x))),
listModelDbConnect: json["List_Model_DB_Connect"],
logInTokenId: json["LogInTokenID"] == null ? null : json["LogInTokenID"],
mobileNumber: json["MobileNumber"] == null ? null : json["MobileNumber"],
selectDeviceImeIbyImeiList: json["SELECTDeviceIMEIbyIMEI_List"],
userId: json["UserID"] == null ? null : json["UserID"],
zipCode: json["ZipCode"] == null ? null : json["ZipCode"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
isSmsSent: json["isSMSSent"] == null ? null : json["isSMSSent"],
);
Map<String, dynamic> toJson() => {
"Date": date,
"LanguageID": languageId == null ? null : languageId,
"ServiceName": serviceName == null ? null : serviceName,
"Time": time,
"AndroidLink": androidLink,
"AuthenticationTokenID": authenticationTokenId,
"Data": data,
"Dataw": dataw == null ? null : dataw,
"DietType": dietType == null ? null : dietType,
"DietTypeID": dietTypeId == null ? null : dietTypeId,
"ErrorCode": errorCode,
"ErrorEndUserMessage": errorEndUserMessage,
"ErrorEndUserMessageN": errorEndUserMessageN,
"ErrorMessage": errorMessage,
"ErrorType": errorType == null ? null : errorType,
"FoodCategory": foodCategory == null ? null : foodCategory,
"IOSLink": iosLink,
"IsAuthenticated": isAuthenticated == null ? null : isAuthenticated,
"MealOrderStatus": mealOrderStatus == null ? null : mealOrderStatus,
"MealType": mealType == null ? null : mealType,
"MessageStatus": messageStatus == null ? null : messageStatus,
"NumberOfResultRecords": numberOfResultRecords == null ? null : numberOfResultRecords,
"PatientBlodType": patientBlodType,
"SuccessMsg": successMsg,
"SuccessMsgN": successMsgN,
"VidaUpdatedResponse": vidaUpdatedResponse,
"DoctorHaveOneClinic": doctorHaveOneClinic == null ? null : doctorHaveOneClinic,
"DoctorID": doctorId == null ? null : doctorId,
"ERP_SessionID": erpSessionId,
"List_Consent_Member": listConsentMember,
"List_Consent_MemberNew": listConsentMemberNew,
"List_DoctorProfile": listDoctorProfile,
"List_DoctorsClinic": listDoctorsClinic,
"List_MemberInformation": listMemberInformation == null ? null : List<dynamic>.from(listMemberInformation!.map((x) => x.toJson())),
"List_Model_DB_Connect": listModelDbConnect,
"LogInTokenID": logInTokenId == null ? null : logInTokenId,
"MobileNumber": mobileNumber == null ? null : mobileNumber,
"SELECTDeviceIMEIbyIMEI_List": selectDeviceImeIbyImeiList,
"UserID": userId == null ? null : userId,
"ZipCode": zipCode == null ? null : zipCode,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"isSMSSent": isSmsSent == null ? null : isSmsSent,
};
"Date": date,
"LanguageID": languageId == null ? null : languageId,
"ServiceName": serviceName == null ? null : serviceName,
"Time": time,
"AndroidLink": androidLink,
"AuthenticationTokenID": authenticationTokenId,
"Data": data,
"Dataw": dataw == null ? null : dataw,
"DietType": dietType == null ? null : dietType,
"DietTypeID": dietTypeId == null ? null : dietTypeId,
"ErrorCode": errorCode,
"ErrorEndUserMessage": errorEndUserMessage,
"ErrorEndUserMessageN": errorEndUserMessageN,
"ErrorMessage": errorMessage,
"ErrorType": errorType == null ? null : errorType,
"FoodCategory": foodCategory == null ? null : foodCategory,
"IOSLink": iosLink,
"IsAuthenticated": isAuthenticated == null ? null : isAuthenticated,
"MealOrderStatus": mealOrderStatus == null ? null : mealOrderStatus,
"MealType": mealType == null ? null : mealType,
"MessageStatus": messageStatus == null ? null : messageStatus,
"NumberOfResultRecords": numberOfResultRecords == null ? null : numberOfResultRecords,
"PatientBlodType": patientBlodType,
"SuccessMsg": successMsg,
"SuccessMsgN": successMsgN,
"VidaUpdatedResponse": vidaUpdatedResponse,
"DoctorHaveOneClinic": doctorHaveOneClinic == null ? null : doctorHaveOneClinic,
"DoctorID": doctorId == null ? null : doctorId,
"ERP_SessionID": erpSessionId,
"List_Consent_Member": listConsentMember,
"List_Consent_MemberNew": listConsentMemberNew,
"List_DoctorProfile": listDoctorProfile,
"List_DoctorsClinic": listDoctorsClinic,
"List_MemberInformation": listMemberInformation == null ? null : List<dynamic>.from(listMemberInformation!.map((x) => x.toJson())),
"List_Model_DB_Connect": listModelDbConnect,
"LogInTokenID": logInTokenId == null ? null : logInTokenId,
"MobileNumber": mobileNumber == null ? null : mobileNumber,
"SELECTDeviceIMEIbyIMEI_List": selectDeviceImeIbyImeiList,
"UserID": userId == null ? null : userId,
"ZipCode": zipCode == null ? null : zipCode,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"isSMSSent": isSmsSent == null ? null : isSmsSent,
};
static Future<MemberLoginModel> getFromPrefs() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String decodedJson = prefs.getString(SharedPrefsConsts.memberModel) ?? "";
return MemberLoginModel.fromJson(jsonDecode(decodedJson));
}
static void saveToPrefs(String json) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString(SharedPrefsConsts.memberModel, json);
}
}
class ListMemberInformation {
@ -216,30 +230,30 @@ class ListMemberInformation {
final int? projectid;
factory ListMemberInformation.fromJson(Map<String, dynamic> json) => ListMemberInformation(
setupId: json["SetupID"],
memberId: json["MemberID"] == null ? null : json["MemberID"],
memberName: json["MemberName"] == null ? null : json["MemberName"],
memberNameN: json["MemberNameN"],
preferredLang: json["PreferredLang"] == null ? null : json["PreferredLang"],
pin: json["PIN"],
saltHash: json["SaltHash"],
referenceId: json["ReferenceID"] == null ? null : json["ReferenceID"],
employeeId: json["EmployeeID"] == null ? null : json["EmployeeID"],
roleId: json["RoleID"] == null ? null : json["RoleID"],
projectid: json["projectid"] == null ? null : json["projectid"],
);
setupId: json["SetupID"],
memberId: json["MemberID"] == null ? null : json["MemberID"],
memberName: json["MemberName"] == null ? null : json["MemberName"],
memberNameN: json["MemberNameN"],
preferredLang: json["PreferredLang"] == null ? null : json["PreferredLang"],
pin: json["PIN"],
saltHash: json["SaltHash"],
referenceId: json["ReferenceID"] == null ? null : json["ReferenceID"],
employeeId: json["EmployeeID"] == null ? null : json["EmployeeID"],
roleId: json["RoleID"] == null ? null : json["RoleID"],
projectid: json["projectid"] == null ? null : json["projectid"],
);
Map<String, dynamic> toJson() => {
"SetupID": setupId,
"MemberID": memberId == null ? null : memberId,
"MemberName": memberName == null ? null : memberName,
"MemberNameN": memberNameN,
"PreferredLang": preferredLang == null ? null : preferredLang,
"PIN": pin,
"SaltHash": saltHash,
"ReferenceID": referenceId == null ? null : referenceId,
"EmployeeID": employeeId == null ? null : employeeId,
"RoleID": roleId == null ? null : roleId,
"projectid": projectid == null ? null : projectid,
};
"SetupID": setupId,
"MemberID": memberId == null ? null : memberId,
"MemberName": memberName == null ? null : memberName,
"MemberNameN": memberNameN,
"PreferredLang": preferredLang == null ? null : preferredLang,
"PIN": pin,
"SaltHash": saltHash,
"ReferenceID": referenceId == null ? null : referenceId,
"EmployeeID": employeeId == null ? null : employeeId,
"RoleID": roleId == null ? null : roleId,
"projectid": projectid == null ? null : projectid,
};
}

@ -1,16 +1,35 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
import 'package:hmg_nurses/provider/base_vm.dart';
import 'package:hmg_nurses/services/api_repo/dashboard_api_repo.dart';
import 'package:injector/injector.dart';
import '../classes/utils.dart';
import '../main.dart';
/// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool
// ignore: prefer_mixin
class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
//Attendance Tracking
bool isAttendanceTrackingLoading = true;
int endTime = 0, isTimeRemainingInSeconds = 0;
double progress = 0.0;
class DashboardProviderModel extends BaseViewModel {
final IDashboardApiRepo _loginApiRepo = Injector.appInstance.get<IDashboardApiRepo>();
Future<GenericResponseModel2?> getDocProfile() async {
try {
Utils.showLoading();
void notify() {
notifyListeners();
// Utils.showToast(deviceInfo.length.toString());
GenericResponseModel2 docProfileModel = await _loginApiRepo.getDoctorProfile();
appState.doctorProfile = docProfileModel;
await _loginApiRepo.insertDoctorProfile();
Utils.hideLoading();
return docProfileModel;
} catch (e) {
Utils.hideLoading();
Utils.handleException(e, navigatorKey.currentContext!, (msg) {
Utils.confirmDialog(navigatorKey.currentContext!, msg);
});
}
return null;
}
}

@ -1,17 +1,22 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hmg_nurses/classes/consts.dart';
import 'package:hmg_nurses/classes/enums.dart';
import 'package:hmg_nurses/classes/utils.dart';
import 'package:hmg_nurses/config/routes.dart';
import 'package:hmg_nurses/main.dart';
import 'package:hmg_nurses/model/base/generic_response_model.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
import 'package:hmg_nurses/model/login/imei_details_model.dart';
import 'package:hmg_nurses/model/login/member_login_model.dart';
import 'package:hmg_nurses/model/login/project_info_model.dart';
import 'package:hmg_nurses/provider/base_vm.dart';
import 'package:hmg_nurses/services/api_repo/login_api_repo.dart';
import 'package:hmg_nurses/widgets/dialogs/otp_dialog.dart';
import 'package:http/http.dart';
import 'package:injector/injector.dart';
import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart';
@ -91,11 +96,27 @@ class LoginProviderModel extends BaseViewModel {
}
}
// LoginType getDirectLoginType(type) {
// switch (type) {
// case 1:
// return LoginType.DIRECT_LOGIN;
// case 3:
// return LocaleKeys.fingerPrint.tr();
// case 4:
// return LocaleKeys.face.tr();
// case 2:
// return LocaleKeys.whatsapp.tr();
// default:
// return LocaleKeys.sms.tr();
// }
// }
//API Calls
checkLastSession() async {
try {
Utils.showLoading();
List<GetIMEIDetailsModel> deviceInfo = await _loginApiRepo.getDeviceInfoByIMEI();
if (deviceInfo.isNotEmpty) getSession(deviceInfo.first);
Utils.showToast(deviceInfo.length.toString());
Utils.hideLoading();
} catch (e) {
@ -110,7 +131,7 @@ class LoginProviderModel extends BaseViewModel {
setState(ViewState.idle);
}
performLogin(String userID, String password, int branchId) async {
Future<bool> performLogin(String userID, String password, int branchId) async {
try {
Utils.showLoading();
MemberLoginModel memberLogin = await _loginApiRepo.memberLogin(userID, password, branchId);
@ -120,23 +141,36 @@ class LoginProviderModel extends BaseViewModel {
appState.logInTokenID = memberLogin.logInTokenId;
Utils.hideLoading();
Navigator.pushNamed(navigatorKey.currentContext!, AppRoutes.loginMethodsPage, arguments: LoginType.FROM_LOGIN);
return true;
} catch (e) {
Utils.hideLoading();
Utils.handleException(e, navigatorKey.currentContext!, (msg) {
Utils.confirmDialog(navigatorKey.currentContext!, msg);
});
return false;
}
}
Future<GenericResponseModel?> sendActivationCode(MemberLoginModel memberLoginModel, int facilityID, int sendOtpType,bool isFromSilentLogin) async {
Future<GenericResponseModel?> sendActivationCode(MemberLoginModel memberLoginModel, int facilityID, int sendOtpType, bool isFromSilentLogin) async {
try {
Utils.showLoading();
GenericResponseModel memberLogin = await _loginApiRepo.sendActivationCode(memberLoginModel, facilityID, sendOtpType);
GenericResponseModel memberLogin;
if (isFromSilentLogin) {
memberLogin = await _loginApiRepo.sendActivationCodeForSlientLogin(memberLoginModel, facilityID, sendOtpType);
} else {
memberLogin = await _loginApiRepo.sendActivationCode(memberLoginModel, facilityID, sendOtpType);
}
appState.logInTokenID = memberLogin.logInTokenId.toString();
// Utils.showToast(deviceInfo.length.toString());
Utils.hideLoading();
// Navigator.pushNamed(navigatorKey.currentContext!, AppRoutes.loginMethodsPage, arguments: LoginType.FROM_LOGIN);
startSMSService(sendOtpType,isFromSilentLogin);
if(isFromSilentLogin){
checkActivationCode("0000", sendOtpType, isFromSilentLogin);
}else{
startSMSService(sendOtpType, isFromSilentLogin);
}
return memberLogin;
} catch (e) {
Utils.hideLoading();
@ -150,11 +184,9 @@ class LoginProviderModel extends BaseViewModel {
try {
Utils.showLoading();
GenericResponseModel memberLogin = await _loginApiRepo.checkActivationCode(activationCode, sendOtpType, isFromSilentLogin);
// Utils.showToast(deviceInfo.length.toString());
_loginApiRepo.getDoctorProfile();
Utils.hideLoading();
setSession(memberLogin);
Navigator.pushNamed(navigatorKey.currentContext!, AppRoutes.dashboard);
return memberLogin;
} catch (e) {
Utils.hideLoading();
@ -179,4 +211,47 @@ class LoginProviderModel extends BaseViewModel {
onResendCode: () {},
).displayDialog(navigatorKey.currentContext!);
}
setSession(GenericResponseModel response) {
appState.vidaAuthTokenID = response.vidaAuthTokenId;
appState.vidaRefreshTokenID = response.vidaRefreshTokenId;
appState.authenticationTokenID = response.authenticationTokenId;
appState.listDoctorsClinic = response.listDoctorsClinic;
appState.projectID = response.listDoctorsClinic!.first.projectId!;
appState.clinicId = response.listDoctorsClinic!.first.clinicId!;
MemberLoginModel.saveToPrefs(jsonEncode(appState.memberBeforeLogin!.toJson()));
Utils.saveIntFromPrefs(SharedPrefsConsts.username, appState.doctorUserId ?? 0);
Utils.saveStringFromPrefs(SharedPrefsConsts.password, appState.password ?? "");
Utils.saveStringFromPrefs(SharedPrefsConsts.logInTokenID, appState.logInTokenID ?? "");
Utils.saveStringFromPrefs(SharedPrefsConsts.vidaAuthTokenID, appState.vidaAuthTokenID ?? "");
Utils.saveStringFromPrefs(SharedPrefsConsts.vidaRefreshTokenID, appState.vidaRefreshTokenID ?? "");
Utils.saveStringFromPrefs(SharedPrefsConsts.authenticationTokenID, appState.authenticationTokenID ?? "");
Utils.saveIntFromPrefs(SharedPrefsConsts.projectID, appState.projectID);
Utils.saveIntFromPrefs(SharedPrefsConsts.clinicId, appState.clinicId);
Utils.saveStringFromPrefs(SharedPrefsConsts.lastLoginDate, Utils.getMonthNamedFormat(DateTime.now()));
}
getSession(GetIMEIDetailsModel model) async {
int doctorUserId = await Utils.getIntFromPrefs(SharedPrefsConsts.username);
if (model.doctorID == doctorUserId) {
String password = await Utils.getStringFromPrefs(SharedPrefsConsts.password);
String logInTokenID = await Utils.getStringFromPrefs(SharedPrefsConsts.logInTokenID);
String authenticationTokenID = await Utils.getStringFromPrefs(SharedPrefsConsts.authenticationTokenID);
int clinicId = await Utils.getIntFromPrefs(SharedPrefsConsts.clinicId);
String lastLoginDate = await Utils.getStringFromPrefs(SharedPrefsConsts.lastLoginDate);
appState.setMemberBeforeLogin = await MemberLoginModel.getFromPrefs();
appState.doctorUserId = doctorUserId;
appState.password = password;
appState.logInTokenID = logInTokenID;
appState.vidaAuthTokenID = model.vidaAuthTokenID;
appState.vidaRefreshTokenID = model.vidaRefreshTokenID;
appState.authenticationTokenID = authenticationTokenID;
appState.projectID = model.projectID ?? 0;
appState.clinicId = clinicId;
appState.lastLoginImeiDate = model;
appState.lastLoginDate = lastLoginDate;
Navigator.pushNamed(navigatorKey.currentContext!, AppRoutes.loginMethodsPage, arguments: LoginType.SILENT_LOGIN);
}
}
}

@ -0,0 +1,121 @@
import 'dart:convert';
import 'package:hmg_nurses/exceptions/api_exception.dart';
import 'package:hmg_nurses/main.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
import 'package:hmg_nurses/model/login/member_login_model.dart';
import 'package:hmg_nurses/model/login/project_info_model.dart';
import 'package:hmg_nurses/services/api_client.dart';
import 'package:hmg_nurses/classes/consts.dart';
import 'package:hmg_nurses/model/base/generic_response_model.dart';
import 'package:hmg_nurses/model/login/imei_details_model.dart';
import 'package:hmg_nurses/services/firebase_service.dart';
import 'package:injector/injector.dart';
abstract class IDashboardApiRepo {
Future<GenericResponseModel2> getDoctorProfile();
Future insertDoctorProfile();
}
class DashboardApiRepo implements IDashboardApiRepo {
@override
Future<GenericResponseModel2> getDoctorProfile() async {
String url = "${ApiConsts.baseUrlServices}Doctors.svc/REST/GetDocProfiles";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["ProjectID"] = appState.projectID;
postParams["ClinicID"] = appState.clinicId;
postParams["doctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["IsRegistered"] = true;
postParams["License"] = true;
postParams["TokenID"] = appState.authenticationTokenID;
postParams["DoctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["PatientOutSA"] = false;
GenericResponseModel2 response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel2.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return response;
}
@override
Future insertDoctorProfile() async {
String url = "${ApiConsts.baseUrlServices}DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["IMEI"] = appState.imei;
postParams["LogInTypeID"] = appState.lastLoginTyp;
postParams["OutSA"] = null;
postParams["MobileNo"] = appState.doctorProfile!.doctorProfileList!.first.doctorMobileNumber;
postParams["IdentificationNo"] = null;
postParams["DoctorID"] = appState.doctorUserId;
postParams["DoctorName"] = appState.doctorProfile!.doctorProfileList!.first.doctorName;
postParams["DoctorNameN"] = appState.doctorProfile!.doctorProfileList!.first.doctorNameN;
postParams["ClinicID"] = appState.doctorProfile!.doctorProfileList!.first.clinicId;
postParams["ClinicDescription"] = appState.doctorProfile!.doctorProfileList!.first.clinicDescription;
postParams["ClinicDescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.clinicDescriptionN;
postParams["ProjectName"] = appState.doctorProfile!.doctorProfileList!.first.projectName;
postParams["GenderDescription"] = appState.doctorProfile!.doctorProfileList!.first.genderDescription;
postParams["GenderDescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.genderDescriptionN;
postParams["TitleDescription"] = appState.doctorProfile!.doctorProfileList!.first.titleDescription;
postParams["Title_DescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.titleDescriptionN;
postParams["BioMetricEnabled"] = true;
postParams["PreferredLanguage"] = null;
postParams["IsActive"] = appState.doctorProfile!.doctorProfileList!.first.isActive;
postParams["EditedBy"] = appState.doctorProfile!.doctorProfileList!.first.doctorId;
postParams["ProjectID"] = appState.doctorProfile!.doctorProfileList!.first.projectId;
postParams["TokenID"] = appState.authenticationTokenID;
postParams["LoginDoctorID"] = appState.doctorProfile!.doctorProfileList!.first.doctorId;
postParams["Password"] = appState.password;
logger.d(jsonEncode(postParams));
GenericResponseModel response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return null;
}
}
// {
// "IMEI": "es6V9NcpSzCXR665uSDWGo:APA91bGF_FjdOf8ZOZmw5FU7pkDfzNOvkz-IsSBRrJE6OR0ZE2lyeTxzFtvjZEajUEC_ssD6ytKNEm74lm30KpZEvPdrNgSRR8idlGrRqJ6qK2Lp2lrLtgA1OLMjkkQS1bcpvXcdnEg_",
// "LogInTypeID": 1,
// "OutSA": null,
// "MobileNo": "0553755378",
// "IdentificationNo": null,
// "DoctorID": 13777,
// "DoctorName": "EYAD ISMAIL ABU-JAYAB",
// "DoctorNameN": null,
// "ClinicID": 1,
// "ClinicDescription": "INTERNAL MEDICINE CLINIC",
// "ClinicDescriptionN": null,
// "ProjectName": "Olaya Hospital",
// "GenderDescription": "Male",
// "GenderDescriptionN": null,
// "TitleDescription": "Dr.",
// "Title_DescriptionN": null,
// "BioMetricEnabled": true,
// "PreferredLanguage": null,
// "IsActive": false,
// "EditedBy": 2477,
// "ProjectID": 12,
// "TokenID": "W7qObFELE0+VAtKJoTeq+w==",
// "LanguageID": 2,
// "stamp": "2022-11-27T10:50:25.345098",
// "IPAdress": "9.9.9.9",
// "VersionID": 9,
// "Channel": 9,
// "SessionID": "BlUSkYymTt",
// "IsLoginForDoctorApp": true,
// "PatientOutSA": false,
// "VidaAuthTokenID": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzc3NyIsImp0aSI6IjNiM2U5MTU4LTJhNmEtNGM4MS04OTk5LWU3ZTRhYzUzMmFiOCIsImVtYWlsIjoiUndhaWQuQWxtYWxsYWhAY2xvdWRzb2x1dGlvbnMuY29tLnNhIiwiaWQiOiIxMzc3NyIsIk5hbWUiOiJSd2FpZCBGb3VkIEhhc3NhbiBBbE1hbGxhaCIsIkVtcGxveWVlSWQiOiIyNDc3IiwiRmFjaWxpdHlHcm91cElkIjoiOTE4NzciLCJGYWNpbGl0eUlkIjoiMTIiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NiIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjI0NzciLCJTRVNTSU9OSUQiOiIyMDYzNDY2OCIsIkNsaW5pY0lkIjoiMSIsIm5iZiI6MTY2OTUzNTQxMSwiZXhwIjoxNjcwMzk5NDExLCJpYXQiOjE2Njk1MzU0MTF9.LkZMiDAt9F4yjbuNyMSIcZYIgct6VuPed7uPOw0PTVw",
// "VidaRefreshTokenID": "sm30FcA2iL0lJmSCAVlNJJ8e0AbfYzHxg+wMGTBSoP9VM9do55BRxjATjBtOJyo60u8tLRk9LHrmmH8Xn+B25A==",
// "Password": "Rr123456",
// "LoginDoctorID": 2477,
// "DeviceTypeID": 1
// }

@ -1,27 +0,0 @@
import 'dart:async';
import 'package:hmg_nurses/services/api_client.dart';
import 'package:hmg_nurses/config/app_state.dart';
import 'package:hmg_nurses/classes/consts.dart';
class LoginApiClient {
static final LoginApiClient _instance = LoginApiClient._internal();
LoginApiClient._internal();
factory LoginApiClient() => _instance;
// Future<GetMobileLoginInfoListModel?> getMobileLoginInfoNEW(String deviceToken, String deviceType) async {
// String url = "${ApiConsts.erpRest}Mohemm_GetMobileLoginInfo_NEW";
// Map<String, dynamic> postParams = {};
// postParams["DeviceToken"] = deviceToken;
// postParams["DeviceType"] = deviceType;
// return await ApiClient().postJsonForObject((json) {
// GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
// return (responseData.mohemmGetMobileLoginInfoList?.length ?? 0) > 0 ? (responseData.mohemmGetMobileLoginInfoList!.first) : null;
// }, url, postParams);
// }
}

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:hmg_nurses/classes/utils.dart';
import 'package:hmg_nurses/exceptions/api_exception.dart';
import 'package:hmg_nurses/main.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
@ -21,9 +22,9 @@ abstract class ILoginApiRepo {
Future<GenericResponseModel> sendActivationCode(MemberLoginModel memberLoginModel, int facilityID, int sendOtpType);
Future<GenericResponseModel> checkActivationCode(String activationCode, int sendOtpType, bool isFromSilentLogin);
Future<GenericResponseModel> sendActivationCodeForSlientLogin(MemberLoginModel memberLoginModel, int facilityID, int sendOtpType);
getDoctorProfile();
Future<GenericResponseModel> checkActivationCode(String activationCode, int sendOtpType, bool isFromSilentLogin);
}
class LoginApiRepo implements ILoginApiRepo {
@ -39,7 +40,7 @@ class LoginApiRepo implements ILoginApiRepo {
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["stamp"] = DateTime.now().toIso8601String();
postParams["IMEI"] = token;
postParams["IMEI"] = appState.imei;
GenericResponseModel response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
@ -100,7 +101,36 @@ class LoginApiRepo implements ILoginApiRepo {
// return GenericResponseModel();
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
appState.logInTokenID = response.logInTokenId.toString();
} catch (e) {
rethrow;
}
return response;
}
@override
Future<GenericResponseModel> sendActivationCodeForSlientLogin(MemberLoginModel memberLoginModel, int facilityID, int sendOtpType) async {
String url = "${ApiConsts.baseUrlServices}DoctorApplication.svc/REST/SendVerificationCode";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["MobileNumber"] = memberLoginModel.mobileNumber;
postParams["ZipCode"] = memberLoginModel.zipCode;
postParams["IsMobileFingerPrint"] = sendOtpType;
postParams["IMEI"] = appState.imei;
postParams["LoginDoctorID"] = memberLoginModel.doctorId;
postParams["DoctorID"] = memberLoginModel.doctorId;
postParams["MemberID"] = memberLoginModel.listMemberInformation!.first.memberId;
postParams["facilityId"] = facilityID;
postParams["OTP_SendType"] = sendOtpType;
postParams["LoginDoctorID"] = memberLoginModel.doctorId;
postParams["DoctorID"] = memberLoginModel.doctorId;
postParams["TokenID"] = appState.logInTokenID;
GenericResponseModel response;
print(jsonEncode(postParams));
// return GenericResponseModel();
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
@ -131,37 +161,9 @@ class LoginApiRepo implements ILoginApiRepo {
GenericResponseModel response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
appState.vidaAuthTokenID = response.vidaAuthTokenId;
appState.vidaRefreshTokenID = response.vidaRefreshTokenId;
appState.authenticationTokenID = response.authenticationTokenId;
appState.listDoctorsClinic = response.listDoctorsClinic;
appState.projectID = response.listDoctorsClinic!.first.projectId!;
appState.clinicId = response.listDoctorsClinic!.first.clinicId!;
} catch (e) {
rethrow;
}
return response;
}
@override
getDoctorProfile() async {
String url = "${ApiConsts.baseUrlServices}Doctors.svc/REST/GetDocProfiles";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["ProjectID"] = appState.projectID;
postParams["ClinicID"] = appState.clinicId;
postParams["doctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["IsRegistered"] = true;
postParams["License"] = true;
postParams["TokenID"] = appState.authenticationTokenID;
postParams["DoctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["PatientOutSA"] = false;
GenericResponseModel2 response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel2.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
}
}

@ -0,0 +1,26 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hmg_nurses/main.dart';
import 'package:hmg_nurses/provider/dashboard_provider_model.dart';
import 'package:provider/provider.dart';
class DashboardPage extends StatefulWidget {
@override
State<DashboardPage> createState() => _DashboardPageState();
}
class _DashboardPageState extends State<DashboardPage> {
late DashboardProviderModel provider;
@override
void initState() {
super.initState();
provider = Provider.of<DashboardProviderModel>(navigatorKey.currentContext!);
provider.getDocProfile();
}
@override
Widget build(BuildContext context) {
return Scaffold();
}
}

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:hmg_nurses/classes/colors.dart';
import 'package:hmg_nurses/classes/date-utils.dart';
import 'package:hmg_nurses/classes/enums.dart';
import 'package:hmg_nurses/extensions/int_extensions.dart';
import 'package:hmg_nurses/extensions/string_extensions.dart';
@ -32,10 +33,9 @@ class LoginMethodsPage extends StatefulWidget {
class LoginMethodsPageState extends State<LoginMethodsPage> {
bool isMoreOption = false;
bool onlySMSBox = false;
late AuthMethodTypes fingerPrintBefore;
late AuthMethodTypes selectedOption;
late LoginViewModel loginViewModel;
LoginType? loginType;
AuthMethodTypes? selectedAuthType;
late LoginProviderModel loginProviderModel;
@override
@ -60,6 +60,70 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
padding: const EdgeInsets.all(21),
child: Column(
children: [
if (loginType == LoginType.SILENT_LOGIN && appState.lastLoginImeiDate != null)
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
LocaleKeys.welcomeBack.tr().toText12(),
(appState.lastLoginImeiDate!.titleDescription! + " " + appState.lastLoginImeiDate!.doctorName!).toText20(isBold: true),
heightSpacer3per(),
LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText14(),
heightSpacer3per(),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(10)),
border: Border.all(color: HexColor('#707070'), width: 0.1),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.lastLoginDetails.tr().toText13(),
SizedBox(
width: 55.w,
child: Row(
children: [
"${LocaleKeys.verificationType.tr()} : ".toText11(),
loginViewModel.getType(appState.lastLoginImeiDate!.logInTypeID ?? 1).toText11(isBold: true),
],
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
(appState.lastLoginImeiDate!.editedOn != null
? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(appState.lastLoginImeiDate!.editedOn ?? ""), isMonthShort: true)
: appState.lastLoginImeiDate!.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(appState.lastLoginImeiDate!.createdOn ?? ""), isMonthShort: true)
: '--')
.toText11(isBold: true),
heightSpacer06per(),
(appState.lastLoginImeiDate!.editedOn != null
? AppDateUtils.getHour(AppDateUtils.convertStringToDate(appState.lastLoginImeiDate!.editedOn ?? ""))
: appState.lastLoginImeiDate!.createdOn != null
? AppDateUtils.getHour(AppDateUtils.convertStringToDate(appState.lastLoginImeiDate!.createdOn ?? ""))
: '--')
.toText10()
],
)
],
),
),
heightSpacer3per(),
LocaleKeys.pleaseVerify.tr().toText14().paddingOnly(left: 1.w),
heightSpacer2per(),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -71,7 +135,7 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
21.height,
],
),
if (loginType == LoginType.FROM_LOGIN || loginType == LoginType.DIRECT_LOGIN)
if (loginType == LoginType.FROM_LOGIN || loginType == LoginType.SILENT_LOGIN)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@ -84,11 +148,26 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
// appState.setMemberBeforeLogin
bool isAuthenticated = await loginProviderModel.loginWithFaceIDAndBiometrics();
if (isAuthenticated) {
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(AuthMethodTypes.faceID);
if (loginType == LoginType.FROM_LOGIN) {
print("Authentacted");
print(loginType);
loginType = LoginType.REGISTER_NEW_BIO;
setState(() {});
setState(() {
loginType = LoginType.REGISTER_NEW_BIO;
selectedAuthType = AuthMethodTypes.faceID;
});
} else if (loginType == LoginType.SILENT_LOGIN) {
if (appState.lastLoginImeiDate!.logInTypeID == loginProviderModel.getLoginMethodId(AuthMethodTypes.faceID)) {
loginProviderModel.sendActivationCode(
appState.memberBeforeLogin!,
appState.projectID,
loginProviderModel.getLoginMethodId(AuthMethodTypes.sms),
true,
);
} else {
setState(() {
loginType = LoginType.REGISTER_NEW_BIO;
selectedAuthType = AuthMethodTypes.faceID;
});
}
}
} else {
print("Authentaction Failded");
@ -105,9 +184,9 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
bool isAuthenticated = await loginProviderModel.loginWithFaceIDAndBiometrics();
if (isAuthenticated) {
if (loginType == LoginType.FROM_LOGIN) {
print("Authentacted");
print(loginType);
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(AuthMethodTypes.fingerPrint);
loginType = LoginType.REGISTER_NEW_BIO;
selectedAuthType = AuthMethodTypes.fingerPrint;
setState(() {});
}
} else {
@ -127,6 +206,11 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
authMethodType: AuthMethodTypes.sms,
authenticateUser: (AuthMethodTypes authMethodType, isActive) {
// loginViewModel.startSMSService(authMethodType, context: context);
if (selectedAuthType == null) {
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(AuthMethodTypes.sms);
} else if (selectedAuthType == AuthMethodTypes.faceID || selectedAuthType == AuthMethodTypes.fingerPrint) {
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(selectedAuthType!);
}
loginProviderModel.sendActivationCode(
appState.memberBeforeLogin!,
appState.projectID,
@ -140,10 +224,19 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
Expanded(
child: VerificationMethodsList(
authMethodType: AuthMethodTypes.whatsApp,
onShowMore: () {
setState(() {
isMoreOption = true;
});
authenticateUser: (AuthMethodTypes authMethodType, isActive) {
// loginViewModel.startSMSService(authMethodType, context: context);
if (selectedAuthType == null) {
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(AuthMethodTypes.whatsApp);
} else if (selectedAuthType == AuthMethodTypes.faceID || selectedAuthType == AuthMethodTypes.fingerPrint) {
appState.lastLoginTyp = loginProviderModel.getLoginMethodId(selectedAuthType!);
}
loginProviderModel.sendActivationCode(
appState.memberBeforeLogin!,
appState.projectID,
loginProviderModel.getLoginMethodId(AuthMethodTypes.whatsApp),
false,
);
},
),
),

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hmg_nurses/classes/colors.dart';
import 'package:hmg_nurses/classes/consts.dart';
import 'package:hmg_nurses/classes/enums.dart';
import 'package:hmg_nurses/classes/utils.dart';
import 'package:hmg_nurses/config/routes.dart';
@ -44,6 +45,10 @@ class _LoginPageState extends State<LoginPage> {
void initState() {
super.initState();
provider = Provider.of<LoginProviderModel>(navigatorKey.currentContext!);
checkUserSession();
}
checkUserSession() async {
provider.checkLastSession();
}
@ -138,8 +143,13 @@ class _LoginPageState extends State<LoginPage> {
DefaultButton(
LocaleKeys.login.tr(),
() async {
appState.password = passwordController.text;
provider.performLogin(userIdController.text, passwordController.text, branchID);
// provider.checkLastSession();
bool isSuccess = await provider.performLogin(userIdController.text, passwordController.text, branchID);
if (isSuccess) {
appState.password = passwordController.text;
appState.doctorUserId = int.parse(userIdController.text);
print(appState.doctorUserId);
}
},
colors: const [
MyColors.redColor,

Loading…
Cancel
Save