diff --git a/lib/config/config.dart b/lib/config/config.dart index 5c9912e4..e93af7c8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/lib/core/model/insurance/insuranceManualUpdateRequest.dart b/lib/core/model/insurance/insuranceManualUpdateRequest.dart index 13fee506..5eb8ebb9 100644 --- a/lib/core/model/insurance/insuranceManualUpdateRequest.dart +++ b/lib/core/model/insurance/insuranceManualUpdateRequest.dart @@ -12,21 +12,23 @@ class InsuranceManualUpdateRequest { String policyNo; String schemeClass; int requestType; + int patientID; InsuranceManualUpdateRequest( {this.setupID, - this.patientIdentificationID, - this.projectID, - this.mobileNo, - this.activityId, - this.component, - this.enableLogging, - this.insuranceCompanyName, - this.cardHolderName, - this.memberShipNo, - this.policyNo, - this.schemeClass, - this.requestType}); + this.patientIdentificationID, + this.projectID, + this.mobileNo, + this.activityId, + this.component, + this.enableLogging, + this.insuranceCompanyName, + this.cardHolderName, + this.memberShipNo, + this.policyNo, + this.schemeClass, + this.requestType, + this.patientID}); InsuranceManualUpdateRequest.fromJson(Map json) { setupID = json['SetupID']; @@ -42,6 +44,7 @@ class InsuranceManualUpdateRequest { policyNo = json['PolicyNo']; schemeClass = json['SchemeClass']; requestType = json['RequestType']; + patientID = json['PatientID']; } Map toJson() { @@ -59,6 +62,7 @@ class InsuranceManualUpdateRequest { data['PolicyNo'] = this.policyNo; data['SchemeClass'] = this.schemeClass; data['RequestType'] = this.requestType; + data['PatientID'] = this.patientID; return data; } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9cb81a41..fb3c900a 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -149,7 +149,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 2001273; //3844083 + // body['PatientID'] = 4767370; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index e7d57363..c331da2a 100644 --- a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -13,9 +13,11 @@ import 'package:flutter/material.dart'; class AttachInsuranceCardImageDialog extends StatefulWidget { final String name; final String fileNo; + final String identificationNo; + final String mobileNo; final Function(File file, String image) image; - const AttachInsuranceCardImageDialog({Key key, this.name, this.fileNo, this.image}) : super(key: key); + const AttachInsuranceCardImageDialog({Key key, this.name, this.fileNo, this.identificationNo, this.mobileNo, this.image}) : super(key: key); @override _AttachInsuranceCardImageDialogState createState() => _AttachInsuranceCardImageDialogState(); @@ -134,7 +136,16 @@ class _AttachInsuranceCardImageDialogState extends State createState() => _UpdateInsuranceManuallyState(); @@ -51,7 +55,7 @@ class _UpdateInsuranceManuallyState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - _nationalIDTextController.text = projectViewModel.user.patientIdentificationNo; + _nationalIDTextController.text = widget.patientIdentificationNo; return AppScaffold( isShowAppBar: true, isShowDecPage: false, @@ -160,7 +164,7 @@ class _UpdateInsuranceManuallyState extends State { child: DefaultButton( TranslationBase.of(context).submit, () { - if(isFormValid()) + if (isFormValid()) submitManualInsuranceUpdateRequest(); else AppToast.showErrorToast(message: TranslationBase.of(context).enterInsuranceDetails); @@ -240,16 +244,18 @@ class _UpdateInsuranceManuallyState extends State { insuranceManualUpdateRequest.projectID = selectedInsuranceCompanyObj.projectID; insuranceManualUpdateRequest.requestType = 2; - insuranceManualUpdateRequest.mobileNo = projectViewModel.user.mobileNumber; + insuranceManualUpdateRequest.mobileNo = widget.patientMobileNumber; insuranceManualUpdateRequest.cardHolderName = _cardHolderNameTextController.text; insuranceManualUpdateRequest.insuranceCompanyName = selectedInsuranceCompanyObj.companyName; insuranceManualUpdateRequest.memberShipNo = _membershipNoTextController.text; insuranceManualUpdateRequest.policyNo = _policyNoTextController.text; - insuranceManualUpdateRequest.patientIdentificationID = projectViewModel.user.patientIdentificationNo; + insuranceManualUpdateRequest.patientIdentificationID = widget.patientIdentificationNo; insuranceManualUpdateRequest.schemeClass = selectedInsuranceCompaniesSchemesObj.subCategoryDesc; insuranceManualUpdateRequest.setupID = selectedInsuranceCompanyObj.setupID; + insuranceManualUpdateRequest.patientID = widget.patientID; _insuranceCardService.submitManualInsuranceUpdateRequest(insuranceManualUpdateRequest).then((value) { + print(value); AppToast.showSuccessToast(message: TranslationBase.of(context).insuranceRequestSubmit); Navigator.pop(context); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 3fb1c19d..2f0cc5a5 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -22,8 +22,9 @@ class InsuranceCardUpdateDetails extends StatelessWidget { final String patientIdentificationID; final int patientID; final String name; + final String mobileNo; - const InsuranceCardUpdateDetails({Key key, this.insuranceCardDetailsModel, this.patientIdentificationID, this.patientID, this.name}) : super(key: key); + const InsuranceCardUpdateDetails({Key key, this.insuranceCardDetailsModel, this.patientIdentificationID, this.patientID, this.name, this.mobileNo}) : super(key: key); @override Widget build(BuildContext context) { @@ -304,7 +305,8 @@ class InsuranceCardUpdateDetails extends StatelessWidget { color: CustomColors.accentColor, small: true, onTap: () async { - confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + confirmAttachInsuranceCardImageDialogDialog( + context: context, name: name, fileNo: patientID.toString(), identificationNo: patientIdentificationID, mobileNo: mobileNo, model: model); }, ), if (insuranceCardDetailsModel.isNotEmpty) @@ -334,7 +336,8 @@ class InsuranceCardUpdateDetails extends StatelessWidget { label: TranslationBase.of(context).disagree.toUpperCase(), color: Colors.grey[800], onTap: () async { - confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + confirmAttachInsuranceCardImageDialogDialog( + context: context, name: name, fileNo: patientID.toString(), identificationNo: patientIdentificationID, mobileNo: mobileNo, model: model); }, ) ], @@ -346,12 +349,14 @@ class InsuranceCardUpdateDetails extends StatelessWidget { ); } - void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, InsuranceViewModel model}) { + void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, String identificationNo, String mobileNo, InsuranceViewModel model}) { showDialog( context: context, builder: (cxt) => AttachInsuranceCardImageDialog( fileNo: fileNo, name: name, + identificationNo: identificationNo, + mobileNo: mobileNo, image: (file, image) async { GifLoaderDialogUtils.showMyDialog(context); await model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID, image: image); diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 324c9fa1..f8b2da65 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/insurance/UpdateInsuranceManually.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../locator.dart'; import '../../widgets/dialogs/confirm_dialog.dart'; @@ -18,8 +20,11 @@ class InsurancePage extends StatelessWidget { InsurancePage({Key key, this.model}) : super(key: key); + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(12.0), @@ -36,11 +41,16 @@ class InsurancePage extends StatelessWidget { getDetails( setupID: '010266', projectID: 15, - patientIdentificationID: model.user.patientIdentificationNo, - patientID: model.user.patientID, + patientIdentificationID: projectViewModel.user.patientIdentificationNo, + //model.user.patientIdentificationNo, + patientID: projectViewModel.user.patientID, + //model.user.patientID, parentID: 0, - isFamily: false, - name: model.user.firstName + " " + model.user.lastName, + isFamily: projectViewModel.isLoginChild, + //false, + name: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + mobileNumber: projectViewModel.user.mobileNumber, + //model.user.firstName + " " + model.user.lastName, context: context, ); }, @@ -54,7 +64,7 @@ class InsurancePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.user.firstName + " " + model.user.lastName, + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -62,7 +72,7 @@ class InsurancePage extends StatelessWidget { ), ), Text( - TranslationBase.of(context).fileno + ": " + model.user.patientID.toString(), + TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), //model.user.patientID.toString(), style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, @@ -79,71 +89,73 @@ class InsurancePage extends StatelessWidget { ), ), ), - if (model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - return model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 - ? InkWell( - onTap: () { - getDetails( - projectID: 15, - patientIdentificationID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientIdenficationNumber, - setupID: '010266', - patientID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID, - name: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, - parentID: model.user.patientID, - isFamily: true, - context: context); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 12.0), + if (!projectViewModel.isLoginChild) + if (model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 + ? InkWell( + onTap: () { + getDetails( + projectID: 15, + patientIdentificationID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientIdenficationNumber, + setupID: '010266', + patientID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID, + name: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + parentID: model.user.patientID, + isFamily: true, + mobileNumber: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].mobileNumber, + context: context); + }, child: Container( - decoration: cardRadius(12), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46), - ), - Text( - TranslationBase.of(context).fileno + ": " + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID.toString(), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46), - ), - ], + width: double.infinity, + margin: EdgeInsets.only(top: 12.0), + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46), + ), + Text( + TranslationBase.of(context).fileno + ": " + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID.toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46), + ), + ], + ), ), - ), - Icon(Icons.arrow_forward), - ], + Icon(Icons.arrow_forward), + ], + ), ), ), ), - ), - ) - : Container(); - }, - separatorBuilder: (context, index) { - return mHeight(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 ? 8 : 0); - }, - itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, - ), + ) + : Container(); + }, + separatorBuilder: (context, index) { + return mHeight(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 ? 8 : 0); + }, + itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, + ), ], ), ), ); } - getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, bool isFamily, int parentID = 0, BuildContext context}) { + getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, String mobileNumber, bool isFamily, int parentID = 0, BuildContext context}) { GifLoaderDialogUtils.showMyDialog(context); _insuranceCardService .getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID) @@ -158,23 +170,34 @@ class InsurancePage extends StatelessWidget { patientID: patientID, patientIdentificationID: patientIdentificationID, name: name, + mobileNo: mobileNumber, ))).then((value) { model.getInsuranceUpdated(); }); } else { // AppToast.showErrorToast(message: _insuranceCardService.error); - updateManually(context, _insuranceCardService.error); + updateManually(context, _insuranceCardService.error, patientIdentificationID, patientID, mobileNumber); } }); } - void updateManually(BuildContext context, String errorMsg) { + void updateManually(BuildContext context, String errorMsg, String patientIdentificationID, int patientID, String mobileNumber) { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: errorMsg + ". " + TranslationBase.of(context).updateInsuranceManuallyDialog, okText: TranslationBase.of(context).yes, cancelText: TranslationBase.of(context).no, - okFunction: () => {Navigator.pop(context), Navigator.push(context, FadePage(page: UpdateInsuranceManually()))}, + okFunction: () => { + Navigator.pop(context), + Navigator.push( + context, + FadePage( + page: UpdateInsuranceManually( + patientIdentificationNo: patientIdentificationID, + patientID: patientID, + patientMobileNumber: mobileNumber, + ))) + }, cancelFunction: () => {}); dialog.showAlertDialog(context); } diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 5b68687f..56f67282 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; import 'insurance_page.dart'; @@ -17,6 +19,7 @@ class InsuranceUpdate extends StatefulWidget { class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); + ProjectViewModel projectViewModel; @override void initState() { @@ -33,6 +36,7 @@ class _InsuranceUpdateState extends State with SingleTickerProv } Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getInsuranceUpdated(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( @@ -123,7 +127,7 @@ class _InsuranceUpdateState extends State with SingleTickerProv crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.user.firstName + " " + model.user.lastName, + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -141,7 +145,6 @@ class _InsuranceUpdateState extends State with SingleTickerProv letterSpacing: -0.46, ), ), - Text( model.insuranceUpdate[index].createdOn, style: TextStyle( diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 4ceb5bf5..4c21e826 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -110,7 +110,7 @@ class _RequestTypePageState extends State { TranslationBase.of(context).submit, () => { model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { - if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { + if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) { Navigator.pop(context); AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 016fad79..adaef00e 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -18,7 +18,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.d import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:open_file/open_file.dart'; +import 'package:open_filex/open_filex.dart'; import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -183,7 +183,7 @@ class ReportListWidget extends StatelessWidget { GifLoaderDialogUtils.hideDialog(AppGlobal.context); try { String path = await _createFileFromString(value["MedicalReportBase64"], "pdf"); - OpenFile.open(path); + OpenFilex.open(path); } catch (ex) { AppToast.showErrorToast(message: "Cannot open file."); } diff --git a/pubspec.yaml b/pubspec.yaml index 1170b282..9f3755da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -207,7 +207,8 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 - open_file: ^3.2.1 +# open_file: ^3.2.1 + open_filex: ^4.3.2 path_provider: ^2.0.8 # flutter_callkit_incoming: ^1.0.3+3 # firebase_core: 1.12.0