From b25bdbb6fa9d5f3bb4d12266962e51469459bb3f Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sun, 13 Dec 2020 13:14:03 +0200 Subject: [PATCH] fix LiveChatPage Service LabOrderResult MedicineSearch issues --- ios/Flutter/.last_build_id | 2 +- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 20 +++++ lib/core/model/labs/LabOrderResult.dart | 88 +++++++++++++++++++ lib/core/service/client/base_app_client.dart | 11 +-- .../service/contactus/livechat_service.dart | 1 + lib/core/service/hospital_service.dart | 3 +- lib/core/service/medical/labs_service.dart | 7 +- lib/core/service/pharmacies_service.dart | 45 +++++++--- .../viewModels/medical/labs_view_model.dart | 3 +- .../viewModels/pharmacies_view_model.dart | 4 +- lib/core/viewModels/project_view_model.dart | 3 +- .../LiveChat/hospitalsLivechat_page.dart | 57 ++++++++---- .../ContactUs/LiveChat/livechat_page.dart | 24 +++-- .../LiveChat/pharmaciesLivechat_page.dart | 21 ++--- .../medical/balance/my_balance_page.dart | 9 +- .../prescription_items_page.dart | 3 +- .../pharmacies/medicine_search_screen.dart | 2 + .../pharmacies/pharmacies_list_screen.dart | 2 + lib/splashPage.dart | 10 +-- lib/uitl/translations_delegate_base.dart | 5 ++ lib/widgets/buttons/secondary_button.dart | 2 +- .../LabResult/Lab_Result_details_wideget.dart | 20 +++-- .../lab_result_chart_and_detials.dart | 9 +- lib/widgets/pharmacy/drug_item.dart | 7 +- 25 files changed, 267 insertions(+), 95 deletions(-) create mode 100644 lib/core/model/labs/LabOrderResult.dart diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index 6bca0336..4a225219 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -f4a819c27119d0f472892c1088ad1ca3 \ No newline at end of file +d69545ca05f0ca200eba92121a1458fb \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index 4e2791b1..c9f3186a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -38,8 +38,8 @@ const GET_PRESCRIPTION_REPORT_ENH = const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; -const GET_Patient_LAB_RESULT = - 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f94a41cf..a1fb48bc 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1114,4 +1114,24 @@ const Map localizedValues = { "en":"A copy has been sent to the email", "ar":"تم إرسال نسخة إلى البريد الإلكتروني" }, + "instructions": { + "en": "You can now talk directly to the appointments department by chat or request a call back", + "ar": "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" + }, + "instructions-pharmacies": { + "en": "You can now talk directly to the pharmacist by chat or request a call back", + "ar": "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" + }, + "select-hospital": { + "en": "Choose Hospital", + "ar": "اختر المستشفى" + }, + "start": { + "en": "Start", + "ar": "ابدأ" + }, + "info-chat": { + "en": "This service allows you to chat with customer service directly without the need to call.", + "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." + }, }; diff --git a/lib/core/model/labs/LabOrderResult.dart b/lib/core/model/labs/LabOrderResult.dart new file mode 100644 index 00000000..ecb4ae65 --- /dev/null +++ b/lib/core/model/labs/LabOrderResult.dart @@ -0,0 +1,88 @@ +class LabOrderResult { + String description; + dynamic femaleInterpretativeData; + int gender; + int lineItemNo; + dynamic maleInterpretativeData; + dynamic notes; + String packageID; + int patientID; + String projectID; + String referanceRange; + String resultValue; + String sampleCollectedOn; + String sampleReceivedOn; + String setupID; + dynamic superVerifiedOn; + String testCode; + String uOM; + String verifiedOn; + String verifiedOnDateTime; + + LabOrderResult( + {this.description, + this.femaleInterpretativeData, + this.gender, + this.lineItemNo, + this.maleInterpretativeData, + this.notes, + this.packageID, + this.patientID, + this.projectID, + this.referanceRange, + this.resultValue, + this.sampleCollectedOn, + this.sampleReceivedOn, + this.setupID, + this.superVerifiedOn, + this.testCode, + this.uOM, + this.verifiedOn, + this.verifiedOnDateTime}); + + LabOrderResult.fromJson(Map json) { + description = json['Description']; + femaleInterpretativeData = json['FemaleInterpretativeData']; + gender = json['Gender']; + lineItemNo = json['LineItemNo']; + maleInterpretativeData = json['MaleInterpretativeData']; + notes = json['Notes']; + packageID = json['PackageID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + referanceRange = json['ReferanceRange']; + resultValue = json['ResultValue']; + sampleCollectedOn = json['SampleCollectedOn']; + sampleReceivedOn = json['SampleReceivedOn']; + setupID = json['SetupID']; + superVerifiedOn = json['SuperVerifiedOn']; + testCode = json['TestCode']; + uOM = json['UOM']; + verifiedOn = json['VerifiedOn']; + verifiedOnDateTime = json['VerifiedOnDateTime']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['FemaleInterpretativeData'] = this.femaleInterpretativeData; + data['Gender'] = this.gender; + data['LineItemNo'] = this.lineItemNo; + data['MaleInterpretativeData'] = this.maleInterpretativeData; + data['Notes'] = this.notes; + data['PackageID'] = this.packageID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ReferanceRange'] = this.referanceRange; + data['ResultValue'] = this.resultValue; + data['SampleCollectedOn'] = this.sampleCollectedOn; + data['SampleReceivedOn'] = this.sampleReceivedOn; + data['SetupID'] = this.setupID; + data['SuperVerifiedOn'] = this.superVerifiedOn; + data['TestCode'] = this.testCode; + data['UOM'] = this.uOM; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedOnDateTime'] = this.verifiedOnDateTime; + return data; + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9154b9d3..d58054c4 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -47,15 +47,8 @@ class BaseAppClient { } body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; - body['LanguageID'] = body.containsKey('LanguageID') - ? body['LanguageID'] != null - ? body['LanguageID'] - : languageID == 'ar' - ? 1 - : 2 - : languageID == 'en' - ? 2 - : 1; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; diff --git a/lib/core/service/contactus/livechat_service.dart b/lib/core/service/contactus/livechat_service.dart index b806d56b..025073ca 100644 --- a/lib/core/service/contactus/livechat_service.dart +++ b/lib/core/service/contactus/livechat_service.dart @@ -8,6 +8,7 @@ class LiveChatService extends BaseService { List LivechatModelList = List(); Map body = Map(); + // body['body'] Future getAllLiveChatOrders() async { hasError = false; diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index 194b8256..519fc8c0 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -13,14 +13,13 @@ class HospitalService extends BaseService { double _longitude; _getCurrentLocation() async { - await getLastKnownPosition().then((value) { + await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; _longitude = value.longitude; }).catchError((e) { _longitude = 0; _latitude = 0; }); - // currentLocation = LatLng(position.latitude, position.longitude); } Future getHospitals() async { diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 737b7b1b..8318025e 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; @@ -32,7 +33,7 @@ class LabsService extends BaseService { List patientLabSpecialResult = List(); List labResultList = List(); - List labOrdersResultsList = List(); + List labOrdersResultsList = List(); Future getLaboratoryResult( {String projectID, @@ -88,11 +89,11 @@ class LabsService extends BaseService { body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID; body['Procedure'] = procedure; - await baseAppClient.post(GET_Patient_LAB_RESULT, + await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT, onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { - labOrdersResultsList.add(LabResult.fromJson(lab)); + labOrdersResultsList.add(LabOrderResult.fromJson(lab)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/pharmacies_service.dart b/lib/core/service/pharmacies_service.dart index f89fb425..e2bb225b 100644 --- a/lib/core/service/pharmacies_service.dart +++ b/lib/core/service/pharmacies_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; +import 'package:geolocator/geolocator.dart'; class PharmacyService extends BaseService { List _medicineItem = List(); @@ -59,10 +60,29 @@ class PharmacyService extends BaseService { projectID: 15, ); + double _latitude; + double _longitude; + + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + } + Future getMedicineList({String drugName}) async { hasError = false; - _requestGetPharmaciesModel.pHRItemName = drugName; - try { + // await _getCurrentLocation(); + Map body = Map(); + body['PHR_itemName'] = drugName; + body['isLoginForDoctorApp'] = true; + body['isDentalAllowedBackend'] = true; + // body['Latitude'] = _latitude; + // body['Longitude'] = _longitude; + await baseAppClient.post(GET_PHARMCY_ITEMS, onSuccess: (dynamic response, int statusCode) { _medicineItem.clear(); @@ -72,15 +92,18 @@ class PharmacyService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestGetPharmaciesModel.toJson()); - } catch (error) { - throw error; - } + }, body: body); + } Future getPharmaciesList({int itemID}) async { - _pharmaciesListModel.itemID = itemID; - try { + + await _getCurrentLocation(); + Map body = Map(); + body['ItemID'] = itemID; + body['Latitude'] = _latitude; + body['Longitude'] = _longitude; + await baseAppClient.post(GET_PHARMACY_LIST, onSuccess: (dynamic response, int statusCode) { _pharmaciesList.clear(); @@ -91,9 +114,7 @@ class PharmacyService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _pharmaciesListModel.toJson()); - } catch (error) { - throw error; - } + }, body:body); + } } diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 95be11db..c54084d6 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; @@ -12,7 +13,7 @@ class LabsViewModel extends BaseViewModel { FilterType filterType = FilterType.Clinic; LabsService _labsService = locator(); - List get labOrdersResultsList => _labsService.labOrdersResultsList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; List _patientLabOrdersListClinic = List(); diff --git a/lib/core/viewModels/pharmacies_view_model.dart b/lib/core/viewModels/pharmacies_view_model.dart index 01ad4e72..b9e162fc 100644 --- a/lib/core/viewModels/pharmacies_view_model.dart +++ b/lib/core/viewModels/pharmacies_view_model.dart @@ -23,9 +23,11 @@ class PharmacyViewModel extends BaseViewModel { setState(ViewState.Error); } else setState(ViewState.Idle); - //_pharmacyService.clearPharmaciesList(); } + clearMedicineSearch(){ + _pharmacyService.clearMedicineList(); + } Future getMedicine({String name}) async { hasError = false; _pharmacyService.clearMedicineList(); diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index d2b7cf8b..0c00345e 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -30,7 +30,6 @@ class ProjectViewModel extends BaseViewModel { bool get isArabic => _isArabic; - // BaseViewModel baseViewModel = locator() StreamSubscription subscription; ProjectViewModel() { @@ -54,7 +53,7 @@ class ProjectViewModel extends BaseViewModel { }); } - void loadSharedPrefLanguage() async { + Future loadSharedPrefLanguage() async { currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _appLocale = Locale(currentLanguage); diff --git a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart index 5bffe17c..d85971bb 100644 --- a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart @@ -1,11 +1,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -27,13 +31,14 @@ class _HospitalsLiveChatPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getLiveChatRequestOrders(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, + isShowDecPage: false, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 15, right: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -43,11 +48,11 @@ class _HospitalsLiveChatPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 70, ), Container( width: double.infinity, - height: 200, + height: 230, decoration: BoxDecoration( image: DecorationImage( image: ExactAssetImage( @@ -56,10 +61,29 @@ class _HospitalsLiveChatPageState extends State { ), child: Padding( padding: const EdgeInsets.all(8.0), - child: Texts( - 'You can now talk directly to the appointments department by chat or request a call back\n \nChoose Hospital :', - color: Colors.white, - textAlign: TextAlign.start, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: projectViewModel.isArabic? 10:20, + ), + Texts( + TranslationBase.of(context).instructions, + color: Colors.white, + textAlign: TextAlign.start, + ), + SizedBox( + height:projectViewModel.isArabic? 8:25, + ), + Texts( + TranslationBase.of(context) + .selectHospitalDec + + " :", + color: Colors.white, + fontWeight: FontWeight.w700, + textAlign: TextAlign.start, + ), + ], ), ), ), @@ -91,7 +115,7 @@ class _HospitalsLiveChatPageState extends State { borderRadius: BorderRadius.all( Radius.circular(5)), color: tappedIndex == index - ? Colors.red + ? Theme.of(context).primaryColor : Colors.white, ), child: Padding( @@ -104,8 +128,7 @@ class _HospitalsLiveChatPageState extends State { onTap: () { setState(() { tappedIndex = index; - chat = - "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=en&WorkGroup=${model.LiveChatModelList[index].value}"; + chat = "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.currentLanguage}&WorkGroup=${model.LiveChatModelList[index].value}"; }); }, child: Row( @@ -135,7 +158,8 @@ class _HospitalsLiveChatPageState extends State { .black, textAlign: TextAlign .center, - ))), //model.cOCItemList[index].cOCTitl + ))), + //model.cOCItemList[index].cOCTitl IconButton( icon: Icon( Icons.arrow_forward_ios, @@ -171,18 +195,19 @@ class _HospitalsLiveChatPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, + height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, padding: EdgeInsets.all(8.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.07, width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: 'ٍStart', + child: SecondaryButton( + label: TranslationBase.of(context).start, loading: model.state == ViewState.BusyLocal, + textColor: Colors.white, + disabled: chat.isEmpty, onTap: () { - print("chat=" + chat); launch(chat); }, ), diff --git a/lib/pages/ContactUs/LiveChat/livechat_page.dart b/lib/pages/ContactUs/LiveChat/livechat_page.dart index b870234a..a747db3d 100644 --- a/lib/pages/ContactUs/LiveChat/livechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/livechat_page.dart @@ -1,6 +1,8 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -16,9 +18,15 @@ class LiveChatPage extends StatefulWidget { class _LiveChatPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List imagesInfo = List(); + @override void initState() { super.initState(); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/1.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/2.png')); + _tabController = TabController(length: 2, vsync: this); } @@ -33,7 +41,10 @@ class _LiveChatPageState extends State Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Locations', + imagesInfo: imagesInfo, + title: TranslationBase.of(context).liveChat, + description: TranslationBase.of(context).infoChat, + appBarTitle: TranslationBase.of(context).service, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -71,25 +82,22 @@ class _LiveChatPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Colors.red[800], + indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(' Hospitals '), + child: Texts(TranslationBase.of(context).hospitals), ), ), Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(' Pharmacies '), + child: Texts(TranslationBase.of(context).pharmacies), ), ), ], diff --git a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart index cbda0828..c5300b5d 100644 --- a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart @@ -1,12 +1,15 @@ import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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 'package:url_launcher/url_launcher.dart'; @@ -28,10 +31,11 @@ class _PhamaciesLiveChatPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLiveChatRequestOrders(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, + isShowDecPage: false, body: SingleChildScrollView( child: Container( margin: EdgeInsets.only(left: 15, right: 15), @@ -43,12 +47,9 @@ class _PhamaciesLiveChatPageState extends State { Container( width: double.infinity, height: 200, - decoration: BoxDecoration( - image: DecorationImage( - image: ExactAssetImage(''), fit: BoxFit.cover), - ), + child: Texts( - 'You can now talk directly to the pharmacist by chat or request a call back', + TranslationBase.of(context).instructionsPharmacies, color: Colors.black, textAlign: TextAlign.center, ), @@ -63,20 +64,20 @@ class _PhamaciesLiveChatPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, + height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, padding: EdgeInsets.all(8.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.87, width: MediaQuery.of(context).size.width * 0.8, child: Button( - label: 'ٍStart', + label: TranslationBase.of(context).start, loading: model.state == ViewState.BusyLocal, onTap: () { print("chat=" + chat); chat = - "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=1"; + "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.isArabic? 1:2}"; launch(chat); }, ), diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 2fb8c51c..50bb2dea 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -45,21 +45,22 @@ class MyBalancePage extends StatelessWidget { width: double.infinity, height: 65, decoration: BoxDecoration( - color: HexColor('#B61422'), + color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Texts( - TranslationBase.of(context).totalBalance, + '${model.totalAdvanceBalanceAmount ?? 0} '+ TranslationBase.of(context).sar, color: Colors.white, + bold: true, ), Texts( - '${model.totalAdvanceBalanceAmount ?? 0} '+ TranslationBase.of(context).sar, + TranslationBase.of(context).totalBalance, color: Colors.white, - bold: true, ), ], ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 5037a195..d4a9e500 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -150,7 +150,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.23, + height: MediaQuery.of(context).size.height * 0.1, color: Colors.grey[100], child: Column( children: [ @@ -169,6 +169,7 @@ class PrescriptionItemsPage extends StatelessWidget { loading: model.state == ViewState.BusyLocal, ), ), + if(false) Container( width: MediaQuery.of(context).size.width * 0.8, child: Button( diff --git a/lib/pages/pharmacies/medicine_search_screen.dart b/lib/pages/pharmacies/medicine_search_screen.dart index 62cacb7f..adf99ce1 100644 --- a/lib/pages/pharmacies/medicine_search_screen.dart +++ b/lib/pages/pharmacies/medicine_search_screen.dart @@ -21,6 +21,8 @@ class MedicineSearch extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( + allowAny: true, + onModelReady: (model) => model.clearMedicineSearch(), builder: (BuildContext context, PharmacyViewModel model, Widget child) => AppScaffold( baseViewModel: model, diff --git a/lib/pages/pharmacies/pharmacies_list_screen.dart b/lib/pages/pharmacies/pharmacies_list_screen.dart index ce042462..a35a77c9 100644 --- a/lib/pages/pharmacies/pharmacies_list_screen.dart +++ b/lib/pages/pharmacies/pharmacies_list_screen.dart @@ -24,12 +24,14 @@ class PharmaciesList extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( + allowAny: true, onModelReady: (model) => model.getPharmacies(id: medicineID), builder: (BuildContext context, PharmacyViewModel model, Widget child) => AppScaffold( appBarTitle: TranslationBase.of(context).pharmaciesList, baseViewModel: model, isShowAppBar: true, + isShowDecPage: false, body: Container( height: SizeConfig.screenHeight, child: ListView( diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 2c12d6fd..2d8c3ef9 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -27,7 +27,7 @@ class _SplashScreenState extends State { Timer( Duration(seconds: 1, milliseconds: 500), () { - getUserData().then((value) { + Provider.of(context, listen: false).loadSharedPrefLanguage().then((value) { Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (BuildContext context) => LandingPage(), @@ -39,13 +39,7 @@ class _SplashScreenState extends State { } Future getUserData() async { - var data = await sharedPref.getObject(USER_PROFILE); - if (data != null) { - AuthenticatedUser userData = AuthenticatedUser.fromJson(data); - // Provider.of(context, listen: false).isLogin = true; - //authenticatedUserObject.isLogin = true; - //authenticatedUserObject.user = userData; - } + Provider.of(context, listen: false).loadSharedPrefLanguage(); } @override diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 44280337..73ad2794 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1001,6 +1001,11 @@ class TranslationBase { String get cardDetail => localizedValues['card-detail'][locale.languageCode]; String get dr => localizedValues['Dr'][locale.languageCode]; String get sendSuc => localizedValues['sendSuc'][locale.languageCode]; + String get instructions => localizedValues['instructions'][locale.languageCode]; + String get instructionsPharmacies => localizedValues['instructions-pharmacies'][locale.languageCode]; + String get selectHospitalDec => localizedValues['select-hospital'][locale.languageCode]; + String get start => localizedValues['start'][locale.languageCode]; + String get infoChat => localizedValues['info-chat'][locale.languageCode]; } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index d5687554..71a88554 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -177,7 +177,7 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width, height: 100, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: widget.disabled? Colors.grey: widget.color ?? Theme.of(context).primaryColor, ), ), ), diff --git a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart index 753f3deb..68d01e4a 100644 --- a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart +++ b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart @@ -1,12 +1,16 @@ +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class LabResultDetailsWidget extends StatefulWidget { - final List labResult; + final List labResult; LabResultDetailsWidget({ this.labResult, @@ -19,6 +23,7 @@ class LabResultDetailsWidget extends StatefulWidget { class _VitalSignDetailsWidgetState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( decoration: BoxDecoration( color: Colors.transparent, @@ -36,7 +41,7 @@ class _VitalSignDetailsWidgetState extends State { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(projectViewModel), ), ], ), @@ -44,7 +49,7 @@ class _VitalSignDetailsWidgetState extends State { ); } - List fullData() { + List fullData(ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add(TableRow(children: [ Container( @@ -52,7 +57,8 @@ class _VitalSignDetailsWidgetState extends State { decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), ), ), child: Center( @@ -69,7 +75,8 @@ class _VitalSignDetailsWidgetState extends State { decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), ), ), child: Center( @@ -79,6 +86,7 @@ class _VitalSignDetailsWidgetState extends State { ) ])); widget.labResult.forEach((vital) { + var date =DateUtil.convertStringToDate(vital.verifiedOnDateTime); tableRow.add(TableRow(children: [ Container( child: Container( @@ -86,7 +94,7 @@ class _VitalSignDetailsWidgetState extends State { color: Colors.white, child: Center( child: Texts( - '${vital.verifiedOn}', + '${projectViewModel.isArabic? DateUtil.getWeekDayArabic(date.weekday): DateUtil.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic? DateUtil.getMonthArabic(date.month) : DateUtil.getMonth(date.month)} ${date.year}', textAlign: TextAlign.center, ), ), diff --git a/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart b/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart index 19a95bac..dabad6af 100644 --- a/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart +++ b/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; @@ -15,7 +16,7 @@ class LabResultChartAndDetails extends StatelessWidget { @required this.name, }) : super(key: key); - final List labResult; + final List labResult; final String name; List _timeSeriesData = []; @@ -28,8 +29,8 @@ class LabResultChartAndDetails extends StatelessWidget { headerWidget: AppTimeSeriesChart( seriesList: generateData(), chartName: name, - startDate: DateUtil.convertStringToDateTime(labResult[0].sampleCollectedOn), - endDate: DateTime.now(), + startDate: DateUtil.convertStringToDate(labResult[0].verifiedOnDateTime), + endDate: DateUtil.convertStringToDate(labResult[labResult.length-1].verifiedOnDateTime), ), bodyWidget: LabResultDetailsWidget( labResult: labResult, @@ -49,7 +50,7 @@ class LabResultChartAndDetails extends StatelessWidget { var resultValueInt = resultValueDouble.toInt(); _timeSeriesData.add( TimeSeriesSales( - DateUtil.convertStringToDateTime(element.sampleCollectedOn), + DateUtil.convertStringToDate(element.verifiedOnDateTime), resultValueInt, ), ); diff --git a/lib/widgets/pharmacy/drug_item.dart b/lib/widgets/pharmacy/drug_item.dart index 7736e089..ae64349e 100644 --- a/lib/widgets/pharmacy/drug_item.dart +++ b/lib/widgets/pharmacy/drug_item.dart @@ -38,14 +38,13 @@ class _MedicineItemWidgetState extends State { children: [ if (widget.url != null) Container( - height: 39.0, - width: 39.0, + child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(7)), child: Image.memory( dataFromBase64String(widget.url), - height: SizeConfig.imageSizeMultiplier * 11, - width: SizeConfig.imageSizeMultiplier * 11, + height: SizeConfig.imageSizeMultiplier * 19, + width: SizeConfig.imageSizeMultiplier * 18, fit: BoxFit.cover, ), ),