diff --git a/lib/config/config.dart b/lib/config/config.dart index f4659076..e6cc3f1d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,8 +6,9 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; + +//const BASE_URL = 'https://uat.hmgwebservices.com/'; + const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Doctor @@ -182,7 +183,8 @@ const CHECK_PAYMENT_STATUS = //URL create advance payment const CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; -const HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; +const HIS_CREATE_ADVANCE_PAYMENT = + "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; const ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; @@ -242,8 +244,8 @@ const LANGUAGE = 2; const PATIENT_OUT_SA = 0; const SESSION_ID = 'TMRhVmkGhOsvamErw'; const IS_DENTAL_ALLOWED_BACKEND = false; -const PATIENT_TYPE = 1; -const PATIENT_TYPE_ID = 1; +const PATIENT_TYPE = 2; +const PATIENT_TYPE_ID = 2; var DEVICE_TOKEN = ""; var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; @@ -253,6 +255,10 @@ const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; + +const INSURANCE_DETAILS = + "Services/Patients.svc/REST/Get_InsuranceCheckList"; + const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; const GET_PAtIENTS_INSURANCE_APPROVALS = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4e15c74c..b75baf2e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -111,10 +111,13 @@ const Map localizedValues = { 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'تسجيل الدخول'}, 'poweredBy': {'en': 'Powered By', 'ar': 'مشغل بواسطة'}, - 'welcome': {'en': 'Welcome', 'ar': 'أهلا بك'}, - 'welcome_text': { - 'en': 'Dr. Sulaiman Al Habib Mobile Application ', - 'ar': 'الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك' + "welcome": { + "en": "Welcome", + "ar": "مرحبا" + }, + "welcome_text": { + "en": "Dr. Sulaiman Al Habib Mobile Application", + "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك" }, 'welcome_text2': { 'en': 'Have you visited AlHabib Medical Group before? ', @@ -127,8 +130,14 @@ const Map localizedValues = { "ar": "اختر من الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي." }, "registernow": {"en": "Register Now", "ar": "تسجيل الان"}, - "nationalID": {"en": "National ID", "ar": "رقم الهوية"}, + "nationalID": { "en": "Enter the Identification Number", + "ar": "أدخل رقم الهوية الوطنية او الاقامة"}, + "national-id": { + "en": "National ID", + "ar": "رقم الهوية" + }, "fileNo": {"en": "File Number", "ar": "رقم الملف"}, + "fileno": {"en": "File No", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, "forgotFileNoTitle": { "en": "Forgot medical file Number", @@ -136,8 +145,8 @@ const Map localizedValues = { }, "enter-national-id": { - "en": "Please enter mobile number and national ID / Iqama", - "ar": "الرجاء إدخال رقم الجوال والهوية الوطنية / الاقامة" + "en": "Please enter mobile number and identification number", + "ar": "الرجاء إدخال رقم الجوال ورقم الهوية" }, "profile-info": { "en": "Please enter profile information", @@ -823,6 +832,43 @@ const Map localizedValues = { "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, + "language-setting": { + "en": "SMS and Confirmation Calls Language", + "ar": "لغة الرسائل القصيرة و الاتصال الآلي" + }, + "alert": {"en": "Alerts", "ar": "التنبيهات"}, + "email-alert": { + "en": "Alert By Email", + "ar": "استلام التنبيهات بالبريد الالكتروني" + }, + "sms-alert": { + "en": "Alert By SMS", + "ar": "استلام التنبيهات بالرسائل القصيرة" + }, + "contact-info": {"en": "Contact Information", "ar": "معلومات التواصل"}, + "emrg-name": { + "en": "Emergency Contact Name", + "ar": "اسم للتواصل في حالة الطوارئ" + }, + "emrg-no": { + "en": "Emergency Contact Number", + "ar": "رقم للتواصل في حالة الطوارئ" + }, + "modes": {"en": "Modes", "ar": "الاوضاع"}, + "vibration": {"en": "Vibration Touch Feedback", "ar": "الاهتزاز عند اللمس"}, + "blind-modes": { + "en": "Modes for Partially Blind", + "ar": "تأثيرات لدعم ضعاف البصر" + }, + "invert-theme": {"en": "Invert", "ar": "ألوان سلبية"}, + "off-theme": {"en": "Off", "ar": "إيقاف"}, + "dim-theme": {"en": "Dim", "ar": "ضوء خافت"}, + "bw-theme": {"en": "Black and White", "ar": "أبيض و أسود"}, + "permissions": {"en": "Permission", "ar": "الصلاحيات"}, + "camera-permission": {"en": "Camera", "ar": "الكاميرا"}, + "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, + + "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, "FindUs": {"en": "Find Us", "ar": "اين تجدنا"}, diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 7422052d..ac611c71 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -16,3 +16,6 @@ const USER_LONG = 'user-long'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; const IS_SEARCH_APPO = 'is-search-appo'; const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; +const IS_VIBRATION = 'is_vibration'; +const THEME_VALUE = 'is_vibration'; +const MAIN_USER = 'main-user'; \ No newline at end of file diff --git a/lib/core/model/insurance/insurance_card.dart b/lib/core/model/insurance/insurance_card.dart index 998df241..ebab8d71 100644 --- a/lib/core/model/insurance/insurance_card.dart +++ b/lib/core/model/insurance/insurance_card.dart @@ -16,7 +16,9 @@ class InsuranceCardModel { int patientType; String groupName; String companyName; + int companyID; String subCategoryDesc; + int subCategoryID; String patientCardID; String insurancePolicyNumber; bool isActive; @@ -25,6 +27,7 @@ class InsuranceCardModel { InsuranceCardModel({ this.insurancePolicyNumber, this.subCategoryDesc, + this.subCategoryID, this.versionID, this.channel, this.languageID, @@ -40,6 +43,7 @@ class InsuranceCardModel { this.patientType, this.groupName, this.companyName, + this.companyID, this.patientCardID, this.isActive, this.cardValidTo @@ -50,6 +54,7 @@ class InsuranceCardModel { insurancePolicyNumber = json['InsurancePolicyNo']; patientCardID = json['PatientCardID']; companyName = json['CompanyName']; + companyID = json['CompanyID']; groupName = json['GroupName']; versionID = json['VersionID']; channel = json['Channel']; @@ -65,6 +70,7 @@ class InsuranceCardModel { patientTypeID = json['PatientTypeID']; patientType = json['PatientType']; subCategoryDesc = json['SubCategoryDesc']; + subCategoryID = json["SubCategoryID"]; cardValidTo = json['CardValidTo']; } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 172e338a..115485a6 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -35,7 +35,7 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') @@ -79,15 +79,18 @@ class BaseAppClient { body['PatientType'] = body.containsKey('PatientType') ? body['PatientType'] != null ? body['PatientType'] - : PATIENT_TYPE + : user['PatientType'] != null + ? user['PatientType'] + : PATIENT_TYPE : PATIENT_TYPE; body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null ? body['PatientTypeID'] - : PATIENT_TYPE_ID + : user['PatientTypeID'] != null + ? user['PatientTypeID'] + : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - if (user != null) { body['TokenID'] = token; body['PatientID'] = diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 4b9e0c3a..790003e9 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -125,4 +125,15 @@ class InsuranceCardService extends BaseService { throw error; } } + Future getInsuranceDetails(data) async{ + dynamic localRes; + await baseAppClient.post(INSURANCE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + localRes = response['List_InsuranceCheckList']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body:{'CompanyID': data.companyID,'SubCategoryID':data.subCategoryID },); + return Future.value(localRes); + } } diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index 003135c9..7029f082 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -72,4 +72,5 @@ class InsuranceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + } diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 91e9b9a3..d2b7cf8b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -18,7 +18,8 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; - bool isLogin = false; + bool isLogin + = false; dynamic get searchValue => searchvalue; diff --git a/lib/main.dart b/lib/main.dart index bd310dbc..e6fc0bfa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -14,13 +16,15 @@ import 'locator.dart'; void main() async { setupLocator(); - runApp(MyApp()); + runApp(ChangeNotifierProvider( + create: (context) => ThemeNotifier(defaultTheme), child: MyApp() )); } class MyApp extends StatelessWidget { - /// static final _myTabbedPageKey = new GlobalKey<_LandingPageState>(); @override Widget build(BuildContext context) { + + final themeNotifier = Provider.of(context); return LayoutBuilder( builder: (context, constraints) { return OrientationBuilder( @@ -59,7 +63,7 @@ class MyApp extends StatelessWidget { const Locale('en', ''), // English ], theme: ThemeData( - fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + fontFamily: projectProvider.isArabic? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, @@ -76,12 +80,13 @@ class MyApp extends StatelessWidget { textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), + backgroundColor: Colors.white, highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff40ACC9), bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), cursorColor: Colors.grey, + cardColor: Colors.white, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( color: Color(0xff40ACC9), diff --git a/lib/models/Authentication/authenticated_user.dart b/lib/models/Authentication/authenticated_user.dart index efccc068..4c7974a3 100644 --- a/lib/models/Authentication/authenticated_user.dart +++ b/lib/models/Authentication/authenticated_user.dart @@ -60,6 +60,7 @@ class AuthenticatedUser { dynamic strDateofBirth; dynamic tempAddress; dynamic zipCode; + dynamic isFamily; // dynamic patientPayType; // dynamic patientType; // dynamic status; @@ -123,6 +124,7 @@ class AuthenticatedUser { this.strDateofBirth, this.tempAddress, this.zipCode, + this.isFamily }); AuthenticatedUser.fromJson(Map json) { @@ -190,6 +192,7 @@ class AuthenticatedUser { strDateofBirth = json['StrDateofBirth']; tempAddress = json['TempAddress']; zipCode = json['ZipCode']; + isFamily = json['IsFamily']; } Map toJson() { @@ -255,7 +258,7 @@ class AuthenticatedUser { data['StrDateofBirth'] = this.strDateofBirth; data['TempAddress'] = this.tempAddress; data['ZipCode'] = this.zipCode; - + data['IsFamily'] = this.isFamily; return data; } } diff --git a/lib/models/Authentication/check_activation_code_request.dart b/lib/models/Authentication/check_activation_code_request.dart index a4bf79c3..af139ba5 100644 --- a/lib/models/Authentication/check_activation_code_request.dart +++ b/lib/models/Authentication/check_activation_code_request.dart @@ -2,7 +2,7 @@ class CheckActivationCodeReq { int patientMobileNumber; String mobileNo; String deviceToken; - int projectOutSA; + bool projectOutSA; int loginType; String zipCode; bool isRegister; diff --git a/lib/models/Authentication/register_user_requet.dart b/lib/models/Authentication/register_user_requet.dart index ebefcfcf..7758ce5b 100644 --- a/lib/models/Authentication/register_user_requet.dart +++ b/lib/models/Authentication/register_user_requet.dart @@ -76,6 +76,9 @@ class Patientobject { String firstName; String middleName; String lastName; + String firstNameN; + String middleNameN; + String lastNameN; dynamic strDateofBirth; String dateofBirth; int gender; @@ -93,8 +96,11 @@ class Patientobject { this.mobileNumber, this.patientOutSA, this.firstName, - this.middleName, - this.lastName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, this.strDateofBirth, this.dateofBirth, this.gender, @@ -114,6 +120,9 @@ class Patientobject { firstName = json['FirstName']; middleName = json['MiddleName']; lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; strDateofBirth = json['StrDateofBirth']; dateofBirth = json['DateofBirth']; gender = json['Gender']; @@ -136,6 +145,9 @@ class Patientobject { data['FirstName'] = this.firstName; data['MiddleName'] = this.middleName; data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; data['StrDateofBirth'] = this.strDateofBirth; data['DateofBirth'] = this.dateofBirth; data['Gender'] = this.gender; diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index 804f6ef0..b53e19b8 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -2,7 +2,7 @@ class SendActivationRequest { int patientMobileNumber; String mobileNo; String deviceToken; - int projectOutSA; + bool projectOutSA; int loginType; String zipCode; bool isRegister; diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 642bbd33..70b6aaa0 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -224,7 +224,7 @@ class _DocAvailableAppointmentsState extends State ), ); }, - markersBuilder: (context, date, events, holidays) { + markersBuilder: (context, date, events, _) { final children = []; if (events.isNotEmpty) { children.add( @@ -239,8 +239,8 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events, holidays) { - _onDaySelected(date, events); + onDaySelected: (date, event, _) { + _onDaySelected(date, event); _animationController.forward(from: 0.0); }, onVisibleDaysChanged: _onVisibleDaysChanged, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 1e1fc444..3e58b657 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event, holidays) { + onDaySelected: (date, event, _) { _onDaySelected( date, event, diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 535c09ce..d3de1b62 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; @@ -19,6 +20,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/routes.dart'; class MyFamily extends StatefulWidget { + final bool isAppbarVisible; + MyFamily({this.isAppbarVisible =true}); @override _MyFamily createState() => _MyFamily(); } @@ -38,65 +41,66 @@ class _MyFamily extends State with TickerProviderStateMixin { bool expandFlag = false; Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - bottom: TabBar( - indicatorColor: Colors.red, - tabs: [ - Padding( - padding: EdgeInsets.all(6), - child: AppText( - TranslationBase.of(context).family, - color: Colors.white, - )), - Padding( - padding: EdgeInsets.all(6), - child: AppText( - TranslationBase.of(context).request, - color: Colors.white, - )), - ], - controller: _tabController, - ), - title: AppText(TranslationBase.of(context).myFamilyFiles, - color: Colors.white)), - body: TabBarView( - // physics: NeverScrollableScrollPhysics(), - children: [myFamilyDetails(context), myFamilyRequest(context)], - controller: _tabController), - bottomNavigationBar: BottomBarSearch()); + // return Scaffold( + // appBar: AppBar( + // bottom: TabBar( + // indicatorColor: Colors.red, + // tabs: [ + // Padding( + // padding: EdgeInsets.all(6), + // child: AppText( + // TranslationBase.of(context).family, + // color: Colors.white, + // )), + // Padding( + // padding: EdgeInsets.all(6), + // child: AppText( + // TranslationBase.of(context).request, + // color: Colors.white, + // )), + // ], + // controller: _tabController, + // ), + // + // ), + // body: TabBarView( + // // physics: NeverScrollableScrollPhysics(), + // children: [myFamilyDetails(context), myFamilyRequest(context)], + // controller: _tabController), + // ); + // //bottomNavigationBar: BottomBarSearch()); - // AppScaffold( - // appBarTitle: TranslationBase.of(context).myFamilyFiles, - // isShowAppBar: true, - // body: SingleChildScrollView( - // child: Container( - // height: SizeConfig.screenHeight, - // width: SizeConfig.realScreenWidth, - // padding: EdgeInsets.all(20), - // child: Stack( - // children: [ - // TabBar( - // controller: _tabController, - // indicatorColor: Colors.red, - // tabs: [ - // Padding( - // padding: EdgeInsets.all(6), - // child: Text(TranslationBase.of(context).family)), - // Padding( - // padding: EdgeInsets.all(6), - // child: Text(TranslationBase.of(context).request)), - // ], - // ), - // TabBarView( - // controller: _tabController, - // children: [ - // myFamilyDetails(context), - // myFamilyRequest(context) - // ], - // ) - // ], - // )))); + return AppScaffold( + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: widget.isAppbarVisible, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight, + width: SizeConfig.realScreenWidth, + padding: EdgeInsets.all(20), + child: Stack( + children: [ + TabBar( + controller: _tabController, + indicatorColor: Colors.red, + tabs: [ + Padding( + padding: EdgeInsets.all(6), + child: Text(TranslationBase.of(context).family)), + Padding( + padding: EdgeInsets.all(6), + child: Text(TranslationBase.of(context).request)), + ], + ), + TabBarView( + controller: _tabController, + children: [ + myFamilyDetails(context), + myFamilyRequest(context) + ], + ) + ], + )))); } Widget myFamilyDetails(context) { @@ -218,12 +222,15 @@ class _MyFamily extends State with TickerProviderStateMixin { } Widget myFamilyRequest(context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: SingleChildScrollView( - child: Column( + return //Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: + SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height, + margin: EdgeInsets.only(top:50), + child: Column( children: [ - // SizedBox(height: 20.0), RoundedContainer( child: ExpansionTile( title: Text( @@ -512,17 +519,19 @@ class _MyFamily extends State with TickerProviderStateMixin { } switchUser(user, context) { - Utils.showProgressDialog(context); + GifLoaderDialogUtils.showMyDialog(context); this .familyFileProvider .silentLoggin(user) .then((value) => loginAfter(value, context)); } - loginAfter(result, context) { - Utils.hideProgressDialog(); + loginAfter(result, context) async{ + GifLoaderDialogUtils.hideDialog(context); + var familyFile = await sharedPref.getObject(FAMILY_FILE); result = CheckActivationCode.fromJson(result); this.sharedPref.clear(); + this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index a7065399..d5fac63f 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -1,11 +1,16 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,6 +26,7 @@ class InsuranceCard extends StatefulWidget { } //TODO fix it class _InsuranceCardState extends State { + InsuranceCardService _insuranceCardService = locator(); @override Widget build(BuildContext context) { return BaseView( @@ -140,6 +146,7 @@ class _InsuranceCardState extends State { Container( color: Colors.transparent, child: SecondaryButton( + onTap:()=>{ getDetails(model.insurance[index])}, label: TranslationBase.of(context).seeDetails, textColor: Colors.white, ), @@ -179,4 +186,13 @@ class _InsuranceCardState extends State { return newDate.toString(); } + getDetails(data){ + GifLoaderDialogUtils.showMyDialog(context); + _insuranceCardService.getInsuranceDetails(data).then((value) => { + GifLoaderDialogUtils.hideDialog(context), + Navigator.push(context, + FadePage(page: InsuranceCardDetails(data:value[0]['CheckList']))) + + }); + } } diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart new file mode 100644 index 00000000..d0a829be --- /dev/null +++ b/lib/pages/insurance/insurance_details.dart @@ -0,0 +1,35 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:html/dom.dart' as dom; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class InsuranceCardDetails extends StatefulWidget { + final String data; + + InsuranceCardDetails({this.data}); + + @override + _InsuranceCardInsuranceCardDetailsState createState() => _InsuranceCardInsuranceCardDetailsState(); +} +//TODO fix it +class _InsuranceCardInsuranceCardDetailsState extends State { + @override + Widget build(BuildContext context) { + return + AppScaffold( + isShowAppBar: true, + + body: Center( + child: SingleChildScrollView( + child: Html( + data:widget.data, + ) + ) + ), + ); + } + +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 6716535b..b2c421fe 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -42,13 +42,13 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { ToDoCountProviderModel toDoProvider; - @override - void initState() { - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - getToDoCount(); - }); - super.initState(); - } + // @override + // void initState() { + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // getToDoCount(); + // }); + // super.initState(); + // } AuthenticatedUserObject authenticatedUserObject = locator(); @@ -57,7 +57,7 @@ class _HomePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientRadOrders(), + onModelReady: (model) => {},//model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( isShowDecPage: false, body: Container( diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8caba808..3b6aee91 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; @@ -85,7 +86,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { print(route.settings.name); } - setState(() { + //setState(() { print("didChangeAppLifecycleState"); print('state = $state'); AppGlobal.context = context; @@ -113,7 +114,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (state == AppLifecycleState.inactive) { isPageNavigated = false; } - }); + //}); } @override @@ -126,9 +127,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - setState(() { + //setState(() { AppGlobal.context = context; - }); + // }); _requestIOSPermissions(); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); @@ -139,7 +140,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); - if (token != null) { + if (token != null && DEVICE_TOKEN =="") { DEVICE_TOKEN = token; checkUserStatus(token); } @@ -387,7 +388,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ), MedicalProfilePage(), BookingOptions(), - Container(), + MyFamily(isAppbarVisible:false), ToDo(), ], // Please do not remove the BookingOptions from this array ), @@ -432,11 +433,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) - authService.registeredAuthenticatedUser(data, token, 0, 0); - // setState(() { - // this.user = data; - // print(this.user); - // }); + authService + .registeredAuthenticatedUser(data, token, 0, 0) + .then((res) => {print(res)}); + } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index e7de718e..94778902 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -291,7 +291,9 @@ class _ConfirmLogin extends State { checkUserAuthentication(type) { showLoader(true); - var req = getCommonRequest(); + var req = getCommonRequest(type: type); + req.logInTokenID = ""; + var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); GifLoaderDialogUtils.showMyDialog(context); @@ -321,7 +323,7 @@ class _ConfirmLogin extends State { } sendActivationCode(type) async { - var request = this.getCommonRequest(); + var request = this.getCommonRequest(type: type); GifLoaderDialogUtils.showMyDialog(context); await this.authService.sendActivationCode(request).then((result) { GifLoaderDialogUtils.hideDialog(context); @@ -352,10 +354,16 @@ class _ConfirmLogin extends State { localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true); - print(authenticated); + if (authenticated == true) { - var request = this.getCommonRequest(); + + if(user.logInType==2 || user.logInType ==3){ + this.checkActivationCode(); + }else{ + var request = this.getCommonRequest(type: type); this.getMobileInfo(request); + } + } } } @@ -444,30 +452,40 @@ class _ConfirmLogin extends State { //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); } - getCommonRequest() { + getCommonRequest({type}) { var request = SendActivationRequest(); request.patientMobileNumber = this.mobileNumber; request.mobileNo = '0' + this.mobileNumber.toString(); request.deviceToken = this.deviceToken; - request.projectOutSA = this.patientOutSA == true ? 1 : 0; + request.projectOutSA = this.patientOutSA == true ? true : false; request.loginType = this.selectedOption; - request.oTPSendType = this.selectedOption == 1 ? 1 : 2; + request.oTPSendType = + type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; request.zipCode = this.zipCode; request.logInTokenID = this.loginTokenID ?? ""; if (this.registerd_data != null) { - request.searchType = this.registerd_data.searchType ?? 1; - request.patientID = this.registerd_data.patientID ?? 0; + request.searchType = this.registerd_data.searchType != null + ? this.registerd_data.searchType + : 1; + request.patientID = this.registerd_data.patientID != null + ? this.registerd_data.patientID + : 0; request.patientIdentificationID = request.nationalID = - this.registerd_data.patientIdentificationID ?? '0'; + this.registerd_data.patientIdentificationID != null + ? this.registerd_data.patientIdentificationID + : '0'; request.isRegister = this.registerd_data.isRegister; } else { - request.searchType = request.searchType ?? 2; - request.patientID = this.user.patientID ?? 0; - request.nationalID = request.nationalID ?? '0'; - request.patientIdentificationID = request.patientIdentificationID ?? '0'; + request.searchType = request.searchType != null ? request.searchType : 2; + request.patientID = this.user.patientID != null ? this.user.patientID : 0; + request.nationalID = + request.nationalID != null ? request.nationalID : '0'; + request.patientIdentificationID = request.patientIdentificationID != null + ? request.patientIdentificationID + : '0'; request.isRegister = false; } request.deviceTypeID = request.searchType; @@ -493,8 +511,9 @@ class _ConfirmLogin extends State { } else { + result.list.isFamily = false, userData = result.list, - //AuthenticatedUser.fromJson(result['List'][0]), + sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index edd1bf3d..dcd58b9d 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -14,7 +14,7 @@ class LoginType extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).welcome, + appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, isShowDecPage: false, body: Padding( @@ -73,7 +73,7 @@ class LoginType extends StatelessWidget { ), AppText( TranslationBase.of(context) - .nationalID, + .idNo, fontSize: SizeConfig.textMultiplier * 2, @@ -122,6 +122,7 @@ class LoginType extends StatelessWidget { )))) ], ), + SizedBox(height: 25,), Divider( color: Colors.grey, height: 2, @@ -144,8 +145,14 @@ class LoginType extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ + Expanded( child: DefaultButton( TranslationBase.of(context).registerNow, diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index dd4911e1..700a0d0c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -64,7 +65,7 @@ class _Login extends State { @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, @@ -116,6 +117,11 @@ class _Login extends State { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ Expanded( @@ -195,8 +201,22 @@ class _Login extends State { } }) .catchError((err) { - print(err); GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context), + Navigator.of(context).pushNamed( + REGISTER, + ), + + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + }); // SMSOTP.showLoadingDialog(context, false), } @@ -222,14 +242,16 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), - this.sharedPref.setObject(USER_PROFILE, result.list), + result.list.isFamily =false, + this.sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), authenticatedUserObject.getUser(), - // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), + // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), authenticatedUserObject.isLogin = true, appointmentRateViewModel.isLogin = true, - projectViewModel.isLogin = true, + projectViewModel.isLogin = true, appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 83e4fc53..467068cc 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -8,9 +8,11 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -86,7 +88,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.firstNameEn, + hintText: registerInfo.firstNameEn == '-' + ? registerInfo.firstNameAr + : registerInfo.firstNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -95,7 +99,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.secondNameEn, + hintText: registerInfo.secondNameEn == '-' + ? registerInfo.secondNameAr + : registerInfo.secondNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -104,7 +110,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.lastNameEn, + hintText: registerInfo.lastNameEn == '-' + ? registerInfo.lastNameAr + : registerInfo.lastNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -202,7 +210,7 @@ class _RegisterInfo extends State { child: DropdownButtonHideUnderline( child: DropdownButton( isExpanded: true, - value: language, + value: location, iconSize: 40, elevation: 16, onChanged: (value) => { @@ -269,17 +277,46 @@ class _RegisterInfo extends State { registerNow() { dynamic request = getTempUserRequest(); - + GifLoaderDialogUtils.showMyDialog(context); this.authService.registerUser(request).then((result) => { - print(result), + GifLoaderDialogUtils.hideDialog(context), // userData = result.list; //AuthenticatedUser.fromJson(result['List'][0]), - sharedPref.setObject(USER_PROFILE, result.list), + if(result is String){ + new ConfirmDialog( + context: context, + confirmMessage: result, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}) + .showAlertDialog(context) + }else + { + result.list.isFamily = false, + sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), Navigator.of(context).pushNamed(HOME) - }); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + + }); } getRegisterInfo() async { @@ -310,9 +347,12 @@ class _RegisterInfo extends State { "PatientIdentificationNo": registerInfo.idNumber, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, - "FirstName": registerInfo.firstNameEn, - "MiddleName": registerInfo.secondNameEn, - "LastName": registerInfo.lastNameEn, + "FirstNameN":registerInfo.firstNameAr =='-' ?"": registerInfo.firstNameAr, + "FirstName": registerInfo.firstNameEn =='-' ?"":registerInfo.firstNameEn, + "MiddleNameN":registerInfo.secondNameAr =='-' ? "" : registerInfo.secondNameAr, + "MiddleName":registerInfo.secondNameEn == '-' ? "": registerInfo.secondNameEn, + "LastNameN": registerInfo.lastNameAr =='-'? "" : registerInfo.lastNameAr, + "LastName": registerInfo.lastNameEn =='-' ? "": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, "DateofBirth": DateUtil.convertISODateToJsonDate( registerInfo.dateOfBirth.replaceAll('/', '-')), @@ -331,30 +371,6 @@ class _RegisterInfo extends State { "PatientIdentificationID": registerInfo.idNumber, "PatientMobileNumber": registerd_data.patientMobileNumber, }; - - // var patientObject ={}; - // var request ={}; - // patientObject['PatientIdentificationType'] = this.identificationType; - // patientObject['PatientIdentificationNo'] = this.id; - // request['PatientIdentificationID'] = this.id; - // request['PatientMobileNumber'] = this.registerInfo.MobileNumber; - // patientObject['MobileNumber'] = this.registerInfo.MobileNumber; - // patientObject['PatientOutSA'] = this.registerInfo.PatientOutSA; - // request['LogInTokenID'] = this.registerInfo.LogInTokenID; - // request['activationCode'] = this.registerInfo.activationCode; - // request['ProjectID'] = this.selectedProjectID; - // patientObject['ProjectID'] = this.selectedProjectID; - // request - // request.setBirthDate(this.dateOfBirth, this.cs.convertISODateToJsonDate(this.dateOfBirth)); - // request.setGender(this.gender); - // request.Patientobject.NationalityID = this.selectedNationalityID; - // request.Patientobject.StrDateofBirth = this.dateOfBirth; - // request.Patientobject.DateofBirthN = this.dateHijri; - // request.Patientobject.EmailAddress = this.eMail; - // request.Patientobject.SourceType = this.iSOCountryID - // request.Patientobject.PreferredLanguage = this.preferredLanguage - // request.Patientobject.Marital = this.maritalStatus; - //return request; } bool isValid() { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 03e7e1ca..ea47a4fa 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -8,11 +8,14 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -46,9 +49,7 @@ class _Register extends State { appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, isShowDecPage: false, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( + body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), @@ -120,8 +121,12 @@ class _Register extends State { ), ], ), - Row(children: [ - Expanded( + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + width: SizeConfig.realScreenWidth * .9, + height:60, child: isHijri == 1 ? TextFields( onChanged: (value) => {dob = value}, @@ -129,6 +134,11 @@ class _Register extends State { prefixIcon: Icon(Icons.date_range), ) : RaisedButton.icon( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + + ), + color:Colors.white, onPressed: () => { if (isHijri != null) _selectDate(context) @@ -147,6 +157,11 @@ class _Register extends State { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ Expanded( @@ -196,11 +211,28 @@ class _Register extends State { } checkPatientForRegisteration(request) { - showLoader(true); + GifLoaderDialogUtils.showMyDialog(context); this .authService .checkPatientForRegisteration(request) - .then((response) => {checkUserStatus(response, request)}); + .then((response) => {checkUserStatus(response, request)}).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context), + Navigator.of(context).pushNamed( + REGISTER, + ), + + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + + }); } void validateForm() { @@ -219,12 +251,20 @@ class _Register extends State { } checkUserStatus(response, CheckPatientForRegistration request) async { - showLoader(false); + GifLoaderDialogUtils.hideDialog(context); if (response is Map) { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { - AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + AlertDialogBox( + context: context, + confirmMessage: response['ErrorEndUserMessage'], + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + }).showAlertDialog(context); } else { nRequest['forRegister'] = true; nRequest['isRegister'] = true; @@ -236,7 +276,15 @@ class _Register extends State { } } else { // if (response['ErrorCode'] == '-986') { - AppToast.showErrorToast(message: response); + //AppToast.showErrorToast(message: response); + AlertDialogBox( + context: context, + confirmMessage: response, + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + }).showAlertDialog(context); //} } } diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index ef1ec052..7fef62a5 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,7 +1,15 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:screen/screen.dart'; class GeneralSettings extends StatefulWidget { @override @@ -10,15 +18,30 @@ class GeneralSettings extends StatefulWidget { class _GeneralSettings extends State with TickerProviderStateMixin { + var themeNotifier; + int blindValue = 0; + bool vibration =false; + bool accessibility =false; + bool camera =false; + bool location =false; + var sharedPref = new AppSharedPreferences(); + var permission = new PermissionService(); + @override + void initState() { + getValues(); + super.initState(); + } + + Widget build(BuildContext context) { - bool isVibration = true; - var bindValue; + + themeNotifier = Provider.of(context); return Container( child: ListView(scrollDirection: Axis.vertical, children: [ Container( padding: EdgeInsets.all(10), child: AppText( - 'Modes', + TranslationBase.of(context).modes, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -29,13 +52,15 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Vibration touch feedback'), + AppText(TranslationBase.of(context).vibration), Switch( - value: isVibration, + value: vibration, onChanged: (value) { setState(() { - isVibration = value; + vibration = value; + }); + setVibration(value); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -48,12 +73,12 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Accsibility Mode'), + AppText(TranslationBase.of(context).accessibility), Switch( - value: isVibration, + value: accessibility, onChanged: (value) { setState(() { - isVibration = value; + accessibility = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -64,7 +89,7 @@ class _GeneralSettings extends State Container( padding: EdgeInsets.all(10), child: AppText( - 'Modes for Partially Blind', + TranslationBase.of(context).blindMode, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -82,14 +107,15 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Off', + TranslationBase.of(context).offTheme, style: new TextStyle(fontSize: 16.0), ), - new Radio( + Radio( value: 0, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ), ], @@ -98,16 +124,17 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Invert', + TranslationBase.of(context).invertTheme, style: new TextStyle( fontSize: 16.0, ), ), new Radio( value: 1, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ) ], @@ -116,14 +143,15 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Dim', + TranslationBase.of(context).dimTheme, style: new TextStyle(fontSize: 16.0), ), new Radio( value: 2, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ), ], @@ -132,14 +160,16 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Black and White', + TranslationBase.of(context).bwTheme, style: new TextStyle(fontSize: 16.0), ), new Radio( - value: 2, - groupValue: bindValue, + value: 3, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + + setTheme(value); }, ), ], @@ -150,7 +180,7 @@ class _GeneralSettings extends State Container( padding: EdgeInsets.all(10), child: AppText( - 'Permission', + TranslationBase.of(context).permissions, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -161,12 +191,12 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Camera'), + AppText(TranslationBase.of(context).cameraPermission), Switch( - value: isVibration, + value: camera, onChanged: (value) { setState(() { - isVibration = value; + camera = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -180,12 +210,12 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Location'), + AppText(TranslationBase.of(context).locationPermission), Switch( - value: isVibration, + value: location, onChanged: (value) { setState(() { - isVibration = value; + location = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -195,4 +225,165 @@ class _GeneralSettings extends State )) ])); } + + setTheme(value) async{ + switch (value) { + case 0: + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } + break; + case 1: + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } + break; + case 2: + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(0.01); + break; + case 3: + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } + break; + default: + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } + break; + } + permission.setTheme(value); + + } + setVibration(value){ + permission.setVibrationPermission(value); + } + + getValues() async{ + blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled(); + } + getTheme(value) async{ + if(value ==1){ + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.grey, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + + }else if(value ==3){ + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.black45, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + + }else { + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.white, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + cardColor: Colors.white, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), + ); + + } + } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 3a8f01dc..0658e2e6 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -15,168 +17,180 @@ class _ProfileSettings extends State Widget build(BuildContext context) { bool isVibration = true; var language = 1; - return Container( - child: ListView(scrollDirection: Axis.vertical, children: [ - Container( - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - 'File No', - color: Colors.black, - ), - AppText( - '124545', - color: Colors.black, - ), - ], - ), - ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], - ), - ), - Padding( - child: AppText('SMS and Confirmation Calls Language ', - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('English'), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - language = value; - }, - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Arabic'), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - language = value; - }, - ) - ], - )), - Padding( - child: AppText('Alert'), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Alert by Email'), - Switch( - value: isVibration, - onChanged: (value) { - setState(() { - isVibration = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Alert by SMS'), - Switch( - value: isVibration, - onChanged: (value) { - setState(() { - isVibration = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText('Alert'), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Email'), - TextField( - style: TextStyle(color: Colors.red), - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Emergency contact name'), - TextField( - style: TextStyle(color: Colors.red), - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Emergency contact number'), - TextField( - style: TextStyle(color: Colors.red), - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), + return BaseView( + onModelReady: (model) => model.getPatientRadOrders(), + builder: (_, model, wi) => Container( + child: + ListView(scrollDirection: Axis.vertical, children: [ + Container( + padding: EdgeInsets.all(15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + ), + AppText( + model.user.patientID.toString(), + color: Colors.black, + ), + ], + ), + ), + SizedBox( + height: 1, + width: MediaQuery.of(context).size.width, + child: Container( + color: Colors.grey[300], ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).submit, - () { + ), + Padding( + child: AppText(TranslationBase.of(context).languageSetting, + fontWeight: FontWeight.bold), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).english), + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + language = value; + }, + ) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).arabic), + new Radio( + value: 1, + groupValue: language, + onChanged: (value) { + language = value; + }, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).alert), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).emailAlert), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).smsAlert), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).contactInfo), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).email), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).emergencyName), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).emergencyContact), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + ), + ) + ], + )), + Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).submit, + () { // print(mobileNo.text); - }, - )), - ], - )) - ])); + }, + )), + ], + )) + ]))); } } diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 6e23dc70..d9d829e9 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -233,7 +233,7 @@ class AuthProvider with ChangeNotifier { neRequest.languageID = LANGUAGE_ID; neRequest.deviceTypeID = DeviceTypeID; neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1; - neRequest.projectOutSA = neRequest.zipCode == '966' ? 0 : 1; + neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true; neRequest.isDentalAllowedBackend = false; neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false; @@ -345,11 +345,14 @@ class AuthProvider with ChangeNotifier { request.gender = user.gender; request.patientID = user.patientID; request.patientOutSA = user.outSA; - request.loginType = await sharedPref.getInt(LAST_LOGIN) ?? 1; + request.loginType = await sharedPref.getInt(LAST_LOGIN) != null + ? await sharedPref.getInt(LAST_LOGIN) + : 1; request.mACAddress = '00:00:00:00:00:00'; request.latitude = lat; request.longitude = long; request.languageID = int.parse(user.preferredLanguage); + request.patientTypeID = 2; dynamic localRes; try { await new BaseAppClient().post(LOGGED_IN_USER_URL, diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 4e7c95d0..79ea67d0 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -55,6 +55,7 @@ class FamilyFilesProvider with ChangeNotifier { AppToast.showErrorToast(message: error); throw error; }, body: request.toJson()); + sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( GetAllSharedRecordsByStatusResponse.fromJson(localRes)); @@ -64,7 +65,8 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserViewRequest(responseID) async { + Future getUserViewRequest( + responseID) async { try { dynamic localRes; Map request = {}; @@ -75,12 +77,13 @@ class FamilyFilesProvider with ChangeNotifier { }, onFailure: (String error, int statusCode) { return Future.error(error); }, body: request); - if(localRes!=null){ - sharedPref.setObject(FAMILY_FILE, localRes); - allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); - return Future.value(allSharedRecordsByStatusResponse);} - else - return Future.error("No Data"); + if (localRes != null) { + sharedPref.setObject(FAMILY_FILE, localRes); + allSharedRecordsByStatusResponse = + GetAllSharedRecordsByStatusResponse.fromJson(localRes); + return Future.value(allSharedRecordsByStatusResponse); + } else + return Future.error("No Data"); } catch (error) { print(error); return Future.error(error); @@ -157,7 +160,7 @@ class FamilyFilesProvider with ChangeNotifier { request.zipCode = zipCode; request.patientMobileNumber = int.parse(cellNumber); request.patientIdentificationID = patientIdentificationID; - request.projectOutSA = zipCode == '966' ? 0 : 1; + request.projectOutSA = zipCode == '966' ? false : true; request.loginType = request.searchType = 1; request.oTPSendType = 1; request.isRegister = false; @@ -175,6 +178,7 @@ class FamilyFilesProvider with ChangeNotifier { throw error; } } + //TODO Future checkActivationCode( loginTokenID, activationCode, indentification, mobileNo) async { @@ -243,29 +247,42 @@ class FamilyFilesProvider with ChangeNotifier { } Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, - {onSuccess}) async { - //var currentUser = this.authService.getAuthenticatedUser(); - var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - //const request = new SwitchUserRequest(); + {onSuccess, mainUser}) async { Map request = {}; - request['LogInTokenID'] = ''; - request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; - request['PatientMobileNumber'] = - switchUser.mobileNumber; //['MobileNumber']; - request['SearchType'] = 2; - request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; - request['PatientIdentificationID'] = ''; - request['IsSilentLogin'] = true; - if (switchUser.mobileNumber != null && - switchUser.patientID != currentUser.patientID) { - request['PatientID'] = switchUser.patientID; //['PatientID']; - } else { - request['PatientID'] = switchUser.responseID; //['ResponseID']; + if(mainUser ==true){ + var currentUser = + AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); + //const request = new SwitchUserRequest(); + request['LogInTokenID'] = ''; + request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; + request['PatientMobileNumber'] = + currentUser.mobileNumber; //['MobileNumber']; + request['SearchType'] = 2; + request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; + request['PatientIdentificationID'] = ''; + request['IsSilentLogin'] = true; + request['PatientID'] = currentUser.patientID; //['PatientID']; + request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; + request['activationCode'] = '0000'; + request['isRegister'] = false; + }else { + var currentUser = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + //const request = new SwitchUserRequest(); + + request['LogInTokenID'] = ''; + request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; + request['PatientMobileNumber'] = + switchUser.mobileNumber; //['MobileNumber']; + request['SearchType'] = 2; + request['SuperUser'] = switchUser.patientID; //currentUser.PatientID; + request['PatientIdentificationID'] = ''; + request['IsSilentLogin'] = true; + request['PatientID'] = switchUser.responseID; //['PatientID']; + request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; + request['activationCode'] = '0000'; + request['isRegister'] = false; } - request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; - request['activationCode'] = '0000'; - request['isRegister'] = false; try { dynamic localRes; diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart new file mode 100644 index 00000000..292724f2 --- /dev/null +++ b/lib/services/permission/permission_service.dart @@ -0,0 +1,32 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; +import 'package:localstorage/localstorage.dart'; + +class PermissionService extends BaseService { + final LocalStorage storage = new LocalStorage("permission"); + + AppGlobal appGlobal = new AppGlobal(); + + setVibrationPermission(flag) async { + storage.setItem('isVibration', flag); + } + + isVibrationEnabled() { + return storage.getItem('isVibration'); + } + + + setTheme(flag) async { + storage.setItem('isTheme', flag); + } + + isThemeEnabled() { + return storage.getItem('isTheme'); + } +} diff --git a/lib/theme/theme_notifier.dart b/lib/theme/theme_notifier.dart new file mode 100644 index 00000000..e414d159 --- /dev/null +++ b/lib/theme/theme_notifier.dart @@ -0,0 +1,15 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:flutter/material.dart'; + +class ThemeNotifier with ChangeNotifier { + ThemeData _themeData = defaultTheme; + ThemeNotifier(this._themeData); + getTheme() => _themeData; + + setTheme(ThemeData themeData) async { + _themeData = themeData; + + notifyListeners(); + } +} diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart new file mode 100644 index 00000000..d19e13b2 --- /dev/null +++ b/lib/theme/theme_value.dart @@ -0,0 +1,129 @@ +import 'dart:ui'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +/// ---- Default Theme ---- +/// + +//final projectProvider = Provider.of(AppGlobal.context); +final bluePrimary = Color(0xFF3F51B5); +final blueAccent = Color(0xFFFF9800); +final blueBackground = Color(0xFFFFFFFF); + +// ProjectViewModel projectProvider = Provider.of(AppGlobal.context); + final bwTheme = ThemeData( + //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.black45, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + + final defaultTheme = ThemeData( + //fontFamily: ProjectViewModel().isArabic? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.white, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + cardColor: Colors.white, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), + ); + + final invertTheme = ThemeData( + //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.grey, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 63cae066..c5fc8852 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -145,8 +145,10 @@ class TranslationBase { String get nationalID => localizedValues['nationalID'][locale.languageCode]; - String get fileNo => localizedValues['fileNo'][locale.languageCode]; + String get idNo => localizedValues['national-id'][locale.languageCode]; + String get fileNo => localizedValues['fileNo'][locale.languageCode]; +String get fileno => localizedValues['fileno'][locale.languageCode]; String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; @@ -776,6 +778,31 @@ class TranslationBase { localizedValues['month-report'][locale.languageCode]; String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + String get languageSetting => + localizedValues['language-setting'][locale.languageCode]; + String get alert => localizedValues['alert'][locale.languageCode]; + String get emailAlert => localizedValues['email-alert'][locale.languageCode]; + String get smsAlert => localizedValues['sms-alert'][locale.languageCode]; + String get contactInfo => + localizedValues['contact-info'][locale.languageCode]; + String get emergencyName => localizedValues['emrg-name'][locale.languageCode]; + String get emergencyContact => + localizedValues['emrg-no'][locale.languageCode]; + String get modes => localizedValues['modes'][locale.languageCode]; + String get vibration => localizedValues['vibration'][locale.languageCode]; + String get blindMode => localizedValues['blind-modes'][locale.languageCode]; + String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; + String get offTheme => localizedValues['off-theme'][locale.languageCode]; + String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; + String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; + + String get permissions => localizedValues['permissions'][locale.languageCode]; + String get cameraPermission => + localizedValues['camera-permission'][locale.languageCode]; + String get locationPermission => + localizedValues['location-permission'][locale.languageCode]; + String get accessibility => + localizedValues['accessibility'][locale.languageCode]; String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; String get reviews => diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index d37eb039..5b0e6489 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -1,4 +1,6 @@ +import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; /// Button widget @@ -33,7 +35,7 @@ class _ButtonState extends State