diff --git a/lib/config/config.dart b/lib/config/config.dart index 1fcad6ba..f37bbaea 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -7,7 +7,7 @@ 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 GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Doctor @@ -57,11 +57,16 @@ const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; -const GET_PATIENT_ALL_PRES_ORDERS= 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID= 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; -const UPDATE_PRESS_ORDER = 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; -const INSERT_ER_INERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const GET_AMBULANCE_REQUEST = + 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS = + 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = + 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; +const UPDATE_PRESS_ORDER = + 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; +const INSERT_ER_INERT_PRES_ORDER = + 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; ///FindUs const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; @@ -120,7 +125,8 @@ const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; //URL to get active appointment list -const GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; +const GET_ACTIVE_APPOINTMENTS_LIST_URL = + "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; //URL to get projects list const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; @@ -144,7 +150,8 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = + "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to get patient appointment curfew history const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = @@ -270,13 +277,14 @@ const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; +const GET_COVID_DRIVETHRU_PROJECT_LIST = + 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; -const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; - -const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; - -const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; +const GET_COVID_DRIVETHRU_PAYMENT_INFO = + 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; +const GET_COVID_DRIVETHRU_FREE_SLOTS = + 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; ///Smartwatch Integration Services const GET_PATIENT_LAST_RECORD = @@ -334,14 +342,18 @@ const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; - // Home Health Care -const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; -const HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; -const PATIENT_ER_UPDATE_PRES_ORDER ="Services/Patients.svc/REST/PatientER_UpdatePresOrder"; -const GET_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; -const GET_CMC_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; -const GET_CHECK_UP_ITEMS ="Services/Patients.svc/REST/GetCheckUpItems"; +const HHC_GET_ALL_SERVICES = + "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; +const HHC_GET_ALL_CMC_SERVICES = + "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; +const PATIENT_ER_UPDATE_PRES_ORDER = + "Services/Patients.svc/REST/PatientER_UpdatePresOrder"; +const GET_ORDER_DETAIL_BY_ID = + "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; +const GET_CMC_ORDER_DETAIL_BY_ID = + "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; +const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems"; const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 223620df..62b6ab53 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -684,6 +684,8 @@ const Map localizedValues = { "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"}, + "general": {"en": "General", "ar": "عام"}, + "profile": {"en": "Profile", "ar": "ملفي"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, "notificationDetailsa": { @@ -816,8 +818,9 @@ const Map localizedValues = { "month-report": {"en": "Monthly Reports", "ar": "تقاريري الشهرية"}, "info-month-report": { - "en": "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", - "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." + "en": + "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", + "ar": + "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, - }; diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index 3bdf5358..cb2604b1 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -4,8 +4,10 @@ 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/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,11 +19,13 @@ class ForgotPassword extends StatefulWidget { class _ForgotPassword extends State { String selectedType = 'Saudi Arabia'; + String countryCode = '966'; final TextEditingController nationalIDorFile = null; - final TextEditingController mobileNo = TextEditingController(); - + String mobileNo; + var con; @override Widget build(BuildContext context) { + con = context; return AppScaffold( appBarTitle: TranslationBase.of(context).forgotFileNoTitle, isShowAppBar: true, @@ -47,33 +51,11 @@ class _ForgotPassword extends State { children: [ Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ -// Expanded( -// // add Expanded to have your dropdown button fill remaining space -// child: DropdownButtonHideUnderline( -// child: DropdownButton( -// isExpanded: true, -// value: selectedType, -// iconSize: 40, -// elevation: 16, -// onChanged: (String newValue) => { -// setState(() { -// selectedType = newValue; -// }) -// }, -// items: [ -// 'Saudi Arabia', -// 'Dubai', -// ].map>( -// (String value) { -// return DropdownMenuItem( -// value: value, -// child: Text(value), -// ); -// }).toList()))), - ], + children: [], ), - MobileNo(controller: mobileNo), + MobileNo( + onNumberChange: (value) => {mobileNo = value}, + onCountryChange: (value) => countryCode = value), ], ), ), @@ -103,10 +85,10 @@ class _ForgotPassword extends State { sendPatientIDBySMS() { GifLoaderDialogUtils.showMyDialog(context); final authService = new AuthProvider(); - authService.sendPatientIDSMS(mobileNo.text, context).then((res) { + authService.sendPatientIDSMS(mobileNo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - setState(() {}); + this.startSMSService(mobileNo, res['LogInTokenID']); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -116,4 +98,49 @@ class _ForgotPassword extends State { print(err); }); } + + startSMSService(mobile, token) { + new SMSOTP( + context, + 1, + mobile, + (value) => {this.checkActivationCode(value, token, int.parse(mobileNo))}, + () => { + print('Faild..'), + }, + ).displayDialog(context); + } + + checkActivationCode(value, token, mobileNo) { + GifLoaderDialogUtils.showMyDialog(context); + final authService = new AuthProvider(); + var request = { + "LogInTokenID": token, + "PatientOutSA": countryCode == '966' ? 0 : 1, + "PatientMobileNumber": mobileNo, + "ZipCode": countryCode, + "activationCode": value, + "isRegister": false, + "IsSilentLogin": false + }; + authService.forgotPasswordActivation(request, value).then((res) { + if (res is String) { + GifLoaderDialogUtils.hideDialog(con); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: res); + }); + } else { + GifLoaderDialogUtils.hideDialog(con); + Navigator.of(context).pop(); + AlertDialogBox( + context: con, + confirmMessage: res['ReturnMessage'], + okText: TranslationBase.of(con).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(con); + Navigator.of(context).pop(); + }).showAlertDialog(context); + } + }); + } } diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 7aa95696..83e4fc53 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_user_requet.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +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'; @@ -15,6 +16,8 @@ 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:hijri/hijri_calendar.dart'; +import 'package:intl/intl.dart'; class RegisterInfo extends StatefulWidget { @override @@ -31,15 +34,15 @@ class _RegisterInfo extends State { new Location(name: 'KSA', value: '1'), new Location(name: 'Dubai', value: '2'), ]; - var language; + String language = '1'; var registerd_data; final List languageList = [ new Language(name: 'English', value: '2'), new Language(name: 'Arabic', value: '1'), ]; - var email = ''; + String email = ''; - var location; + String location = '1'; @override void initState() { @@ -56,18 +59,13 @@ class _RegisterInfo extends State { isShowAppBar: true, isShowDecPage: false, body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, + padding: EdgeInsets.all(20), child: Column(children: [ - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context).patientInfo, - fontSize: SizeConfig.textMultiplier * 3, - textAlign: TextAlign.left, - )), + AppText( + TranslationBase.of(context).patientInfo, + fontSize: SizeConfig.textMultiplier * 3, + textAlign: TextAlign.left, + ), registerInfo != null && page == 1 ? Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -146,7 +144,8 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText:registerd_data.patientMobileNumber, + hintText: + registerd_data.patientMobileNumber.toString(), padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -223,9 +222,10 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - onChanged: (value) { - this.email = value; - this.isValid(); + onChanged: (value) => { + setState(() { + email = value; + }) }, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), @@ -233,30 +233,28 @@ class _RegisterInfo extends State { ], ) : SizedBox(), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - page == 1 - ? TranslationBase.of(context).next - : TranslationBase.of(context).register, - () => {nextPage()}, - textColor: Colors.white, - color: this.isValid() == false && page == 2 - ? Colors.grey - : Colors.black, - )) - ], - ), + Expanded( + child: DefaultButton( + page == 1 + ? TranslationBase.of(context).next + : TranslationBase.of(context).register, + () => {nextPage()}, + textColor: Colors.white, + color: this.isValid() == false && page == 2 + ? Colors.grey + : Colors.black, + )) ], - )) + ), + ], + ) ]), - ))); + )); } nextPage() { @@ -271,8 +269,17 @@ class _RegisterInfo extends State { registerNow() { dynamic request = getTempUserRequest(); - request = RegisterUserRequest.fromJson(request); - this.authService.registerUser(request); + + this.authService.registerUser(request).then((result) => { + print(result), + // userData = result.list; + //AuthenticatedUser.fromJson(result['List'][0]), + sharedPref.setObject(USER_PROFILE, result.list), + + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString(TOKEN, result.authenticationTokenID), + Navigator.of(context).pushNamed(HOME) + }); } getRegisterInfo() async { @@ -291,25 +298,30 @@ class _RegisterInfo extends State { } getTempUserRequest() { + DateFormat dateFormat = DateFormat("mm/dd/yyyy"); + print(dateFormat.parse(registerInfo.dateOfBirth)); + var hDate = + new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth)); + var date = hDate.toString(); return { "Patientobject": { "TempValue": true, "PatientIdentificationType": 1, "PatientIdentificationNo": registerInfo.idNumber, - "MobileNumber": registerd_data['patientMobileNumber'], - "PatientOutSA": registerd_data['zipCode'] == '966' ? '0' : '1', + "MobileNumber": registerd_data.patientMobileNumber, + "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, "FirstName": registerInfo.firstNameEn, "MiddleName": registerInfo.secondNameEn, "LastName": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, - "DateofBirth": - DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth), - "Gender": registerInfo.gender, + "DateofBirth": DateUtil.convertISODateToJsonDate( + registerInfo.dateOfBirth.replaceAll('/', '-')), + "Gender": registerInfo.gender == 'M' ? 1 : 2, "NationalityID": registerInfo.nationality, - "DateofBirthN": registerInfo.dateOfBirth, + "DateofBirthN": date, "EmailAddress": email, "SourceType": location, - "PreferredLanguage": registerd_data['languageID'], + "PreferredLanguage": registerd_data.languageID.toString(), "Marital": registerInfo.maritalStatusCode == 'U' ? '0' : registerInfo.maritalStatusCode == 'M' @@ -317,7 +329,7 @@ class _RegisterInfo extends State { : '2', }, "PatientIdentificationID": registerInfo.idNumber, - "PatientMobileNumber": registerd_data['PatientMobileNumber'], + "PatientMobileNumber": registerd_data.patientMobileNumber, }; // var patientObject ={}; diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart new file mode 100644 index 00000000..ef1ec052 --- /dev/null +++ b/lib/pages/settings/general_setting.dart @@ -0,0 +1,198 @@ +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'; + +class GeneralSettings extends StatefulWidget { + @override + _GeneralSettings createState() => _GeneralSettings(); +} + +class _GeneralSettings extends State + with TickerProviderStateMixin { + Widget build(BuildContext context) { + bool isVibration = true; + var bindValue; + return Container( + child: ListView(scrollDirection: Axis.vertical, children: [ + Container( + padding: EdgeInsets.all(10), + child: AppText( + 'Modes', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Vibration touch feedback'), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Accsibility Mode'), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + 'Modes for Partially Blind', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + new Container( + color: Colors.white, + padding: EdgeInsets.all(8.0), + child: new Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + new Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + 'Off', + style: new TextStyle(fontSize: 16.0), + ), + new Radio( + value: 0, + groupValue: bindValue, + onChanged: (value) { + bindValue = value; + }, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + 'Invert', + style: new TextStyle( + fontSize: 16.0, + ), + ), + new Radio( + value: 1, + groupValue: bindValue, + onChanged: (value) { + bindValue = value; + }, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + 'Dim', + style: new TextStyle(fontSize: 16.0), + ), + new Radio( + value: 2, + groupValue: bindValue, + onChanged: (value) { + bindValue = value; + }, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + 'Black and White', + style: new TextStyle(fontSize: 16.0), + ), + new Radio( + value: 2, + groupValue: bindValue, + onChanged: (value) { + bindValue = value; + }, + ), + ], + ), + ], + ) + ])), + Container( + padding: EdgeInsets.all(10), + child: AppText( + 'Permission', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Camera'), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Location'), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )) + ])); + } +} diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart new file mode 100644 index 00000000..3a8f01dc --- /dev/null +++ b/lib/pages/settings/profile_setting.dart @@ -0,0 +1,182 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; + +class ProfileSettings extends StatefulWidget { + @override + _ProfileSettings createState() => _ProfileSettings(); +} + +class _ProfileSettings extends State + with TickerProviderStateMixin { + 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), + ), + ) + ], + )), + Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).submit, + () { +// print(mobileNo.text); + }, + )), + ], + )) + ])); + } +} diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart new file mode 100644 index 00000000..abdac118 --- /dev/null +++ b/lib/pages/settings/settings.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/settings/profile_setting.dart'; +import 'package:diplomaticquarterapp/pages/settings/general_setting.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; +import 'package:flutter/material.dart'; + +class Settings extends StatefulWidget { + final int type; + + Settings({this.type = 0}); + @override + _Settings createState() => _Settings(); +} + +class _Settings extends State with TickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + _tabController = + new TabController(length: 2, vsync: this, initialIndex: widget.type); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + AppGlobal.context = context; + return Scaffold( + appBar: AppBar( + bottom: TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).general), + Tab( + text: TranslationBase.of(context).profile, + ) + ], + controller: _tabController, + ), + title: Text(TranslationBase.of(context).settings, + style: TextStyle(color: Colors.white)), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + ), + body: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [GeneralSettings(), ProfileSettings()], + controller: _tabController), + ); + } +} diff --git a/lib/routes.dart b/lib/routes.dart index ae2df812..b11025c2 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart'; @@ -33,6 +34,7 @@ const String LIVE_CARE = 'live-care'; const String SYMPTOM_CHECKER = 'symptom-checker'; const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info'; const String SELECT_GENDER = 'select-gender'; +const String SETTINGS = 'settings'; var routes = { SPLASH: (_) => SplashScreen(), HOME: (_) => LandingPage(), @@ -49,5 +51,6 @@ var routes = { LIVE_CARE: (_) => LiveCareHome(), SYMPTOM_CHECKER: (_) => SymptomChecker(), SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), - SELECT_GENDER: (_) => SelectGender() + SELECT_GENDER: (_) => SelectGender(), + SETTINGS: (_) => Settings() }; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index fcf1069c..8e4191ec 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -35,6 +35,8 @@ const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType'; const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode'; +const FORGOT_PASSWORD = + 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration"; @@ -111,7 +113,7 @@ class AuthProvider with ChangeNotifier { var imei = await sharedPref.getString(PUSH_TOKEN); // if (!request.) { - newRequest.iMEI =imei; //imei!=null ? imei : ''; + newRequest.iMEI = imei; //imei!=null ? imei : ''; newRequest.firstName = request.firstName + " " + request.lastName; newRequest.firstNameN = request.firstNameN + " " + request.lastNameN; newRequest.lastNameN = request.lastNameN ?? ""; @@ -307,14 +309,14 @@ class AuthProvider with ChangeNotifier { } } - Future registerUser(RegisterUserRequest request) async { - request.versionID = VERSION_ID; - request.channel = CHANNEL; - request.iPAdress = IP_ADDRESS; - request.generalid = GENERAL_ID; - request.deviceTypeID = DeviceTypeID; - request.languageID = LANGUAGE_ID; - + Future registerUser(request) async { + request['VersionID'] = VERSION_ID; + request['Channel'] = CHANNEL; + request['IPAdress'] = IP_ADDRESS; + request['Generalid'] = GENERAL_ID; + request['DeviceTypeID'] = DeviceTypeID; + request['LanguageID'] = LANGUAGE_ID; + var requestN = RegisterUserRequest.fromJson(request); // request.tokenID = ''; dynamic localRes; try { @@ -324,7 +326,7 @@ class AuthProvider with ChangeNotifier { }, onFailure: (String error, int statusCode) { localRes = error; return Future.value(error); - }, body: request.toJson()); + }, body: requestN.toJson()); return Future.value(localRes); } catch (error) { throw error; @@ -394,4 +396,32 @@ class AuthProvider with ChangeNotifier { }, body: request); return Future.value(localRes); } + + Future forgotPasswordActivation(request, [value]) async { + // var neRequest = CheckActivationCodeReq.fromJson(request); + // neRequest.activationCode = value ?? "0000"; + // neRequest.isSilentLogin = value != null ? false : true; + request['VersionID'] = VERSION_ID; + request['Channel'] = CHANNEL; + request['IPAdress'] = IP_ADDRESS; + request['generalid'] = GENERAL_ID; + request['LanguageID'] = LANGUAGE_ID; + request['DeviceTypeID'] = DeviceTypeID; + + dynamic localRes; + try { + await new BaseAppClient().post(FORGOT_PASSWORD, + onSuccess: (dynamic response, int statusCode) { + localRes = response; //CheckActivationCode.fromJson(); + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + // throw error; + }, body: request); + return Future.value(localRes); + } catch (error) { + throw error; + //return Future.value(error); + } + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 87d6c257..6029f46d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -738,30 +738,44 @@ class TranslationBase { localizedValues['loginToUseService'][locale.languageCode]; String get maritalStatus => localizedValues['marital-status'][locale.languageCode]; - String get notifications => localizedValues['notifications'][locale.languageCode]; - String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; - List get infoMyDoctorPoints => localizedValues['info-my-doctor-points'][locale.languageCode]; - String get infoMyDoctor => localizedValues['info-my-doctor'][locale.languageCode]; - String get infoPrescriptions => localizedValues['info-prescriptions'][locale.languageCode]; - List get infoPrescriptionsPoints => localizedValues['info-my-prescription-points'][locale.languageCode]; - - String get infoInsuranceCards => localizedValues['info-insurance-cards'][locale.languageCode]; - List get infoInsuranceCardsPoints => localizedValues['info-insurance-cards-points'][locale.languageCode]; - - String get infoAllergies => localizedValues['info-allergies'][locale.languageCode]; + String get general => localizedValues['general'][locale.languageCode]; + String get profile => localizedValues['profile'][locale.languageCode]; + String get notifications => + localizedValues['notifications'][locale.languageCode]; + String get notificationDetails => + localizedValues['notificationDetails'][locale.languageCode]; + List get infoMyDoctorPoints => + localizedValues['info-my-doctor-points'][locale.languageCode]; + String get infoMyDoctor => + localizedValues['info-my-doctor'][locale.languageCode]; + String get infoPrescriptions => + localizedValues['info-prescriptions'][locale.languageCode]; + List get infoPrescriptionsPoints => + localizedValues['info-my-prescription-points'][locale.languageCode]; + + String get infoInsuranceCards => + localizedValues['info-insurance-cards'][locale.languageCode]; + List get infoInsuranceCardsPoints => + localizedValues['info-insurance-cards-points'][locale.languageCode]; + + String get infoAllergies => + localizedValues['info-allergies'][locale.languageCode]; String get sickLeaves => localizedValues['sick-leaves'][locale.languageCode]; - String get infoSickLeaves => localizedValues['info-sick-leaves'][locale.languageCode]; - List get infoSickLeavePoints => localizedValues['info-sick-leave-points'][locale.languageCode]; - - String get infoApprovals => localizedValues['info-approvals'][locale.languageCode]; - List get infoApprovalPoints => localizedValues['info-approval-points'][locale.languageCode]; - - String get monthReport => localizedValues['month-report'][locale.languageCode]; - String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; - - - + String get infoSickLeaves => + localizedValues['info-sick-leaves'][locale.languageCode]; + List get infoSickLeavePoints => + localizedValues['info-sick-leave-points'][locale.languageCode]; + + String get infoApprovals => + localizedValues['info-approvals'][locale.languageCode]; + List get infoApprovalPoints => + localizedValues['info-approval-points'][locale.languageCode]; + + String get monthReport => + localizedValues['month-report'][locale.languageCode]; + String get infoMonthReport => + localizedValues['info-month-report'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 32f98915..66be3e48 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -100,7 +100,8 @@ class _AppDrawerState extends State { 'File No:' + user.patientID .toString(), - color: Color(0xFF40ACC9), + color: + Color(0xFF40ACC9), fontSize: SizeConfig .textMultiplier * 1.5, @@ -254,7 +255,7 @@ class _AppDrawerState extends State { Icons.settings_input_composite), onTap: () { Navigator.of(context).pushNamed( - WELCOME_LOGIN, + SETTINGS, ); }, ),