diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 749928d0..d0751535 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -73,7 +73,7 @@ android:value="2" /> + android:value="AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"/> diff --git a/lib/config/config.dart b/lib/config/config.dart index 56f16be3..40ffc502 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -60,7 +60,8 @@ const GET_NEAREST_HOSPITAL = 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 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'; @@ -334,6 +335,8 @@ const GET_CHECK_UP_ITEMS ="Services/Patients.svc/REST/GetCheckUpItems"; const TIMER_MIN = 10; +const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 033dab5f..a44ffec6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -609,26 +609,7 @@ const Map> localizedValues = { "en": "Order Log", "ar": " سجل الطلبات" }, - "Power":{"en":"Power","ar":"القوة"}, - "Diameter":{"en":"Diameter","ar":"القطر"}, - "Remarks":{"en":"Remarks","ar":"ملاحضات"}, - "ActiveMedications":{"en":"Active Medications","ar":"ادويتي النشطة"}, - "ExpDate":{"en":"Active Exp Date :","VA":"تاريخ الإنتهاء"}, - "Route":{"en":"Route :","ar":"الطريقة"}, - "Frequency":{"en":"Frequency :","ar":"المعدل"}, - "DailyQuantity":{"en":"Daily Quantity :","ar":"جرعات يومية"}, - "AddReminder":{"en":"Add Reminder","ar":"إضافة تذكير"}, - "reminderDes":{"en":"Please select treatment start day and time to be notified when it\'s time to take the medicine","ar":" يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء"}, - "StartDay":{"en":"Start Day","ar":"يوم البداية"}, - "EndDay":{"en":"End Day","ar":"يوم الانتهاء"}, - "Days":{"en":"Days ","ar":"أيام"}, - "ScheduleTime":{"en":"Schedule time","ar":"الجدول الزمني"}, - "AskDoctor":{"en":"Ask Doctor","ar":"اسأل طبيبك"}, - "DoctorResponses":{"en":"Doctor Responses","ar":"ردود الأطباء"}, - "New":{"en":"New","ar":"جديد"}, - "All":{"en":"All","ar":"الكل"}, - "QuestionHere":{"en":"Enter the question here...","ar":"اضف الاستفسار هنا"}, - "ViewDoctorResponses":{"en":"View Doctor Responses","ar":"الاطلاع على ردود الأطباء"}, + "ServiceInformationButton":{"en":"LOGIN / REGISTER","ar":"دخول / تسجيل"}, "ServiceInformationTitle":{"en":"Service Information","ar":"معلومات الخدمة"}, "info-lab": { diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart index 8b300bca..198ae285 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart @@ -18,7 +18,7 @@ class PatientERInsertPresOrderRequestModel { double longitude; int createdBy; int orderServiceID; - List patientERHHCInsertServicesList; + List patientERHHCInsertServicesList =List(); PatientERInsertPresOrderRequestModel( {this.versionID, @@ -38,7 +38,7 @@ class PatientERInsertPresOrderRequestModel { this.longitude, this.createdBy, this.orderServiceID, - this.patientERHHCInsertServicesList}); + }); PatientERInsertPresOrderRequestModel.fromJson(Map json) { versionID = json['VersionID']; diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index ffa823e8..45a871cd 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -16,6 +16,7 @@ class HomeHealthCareService extends BaseService { List hhcAllOrderDetail = List(); bool isOrderUpdated; + Future getHHCAllServices( HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; @@ -31,49 +32,51 @@ class HomeHealthCareService extends BaseService { }, body: hHCGetAllServicesRequestModel.toJson()); } - - Future getHHCAllPresOrders() async { - - GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel= GetHHCAllPresOrdersRequestModel(); + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = + GetHHCAllPresOrdersRequestModel(); hasError = false; await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { - hhcAllPresOrdersList.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if(data['ServiceID'] == 2) - hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getHHCAllPresOrdersRequestModel.toJson()); + hhcAllPresOrdersList.clear(); + response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + if (data['ServiceID'] == 2) + hhcAllPresOrdersList + .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); } - Future getOrderDetailByOrderID(GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel) async { - + Future getOrderDetailByOrderID(int presOrderID) async { hasError = false; + Map body = Map(); + body['PresOrderID'] = presOrderID; + body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { - hhcAllOrderDetail.clear(); - response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { - hhcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getOrderDetailByOrderIDRequestModel.toJson()); + hhcAllOrderDetail.clear(); + response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { + hhcAllOrderDetail + .add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { - + Future updateHHCPresOrder( + UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { - isOrderUpdated = true; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: updatePresOrderRequestModel.toJson()); + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 237245f8..d2bfa4fa 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -83,6 +83,7 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); + var ss = json.encode(body); if (await Utils.checkConnection()) { final response = await http.post(url.trim(), diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 1e8480d4..2e9460b8 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:flutter/cupertino.dart'; @@ -91,4 +92,16 @@ class AmService extends BaseService { super.error = error; }, body: body); } + + Future insertERPressOrder({@required PatientER patientER}) async { + hasError = false; + + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patientER.toJson()); + } } diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 2ef1de93..8a4acd2b 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; @@ -25,6 +26,10 @@ class HomeHealthCareViewModel extends BaseViewModel { bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; + GetHHCAllPresOrdersResponseModel pendingOrder; + + List patientERHHCInsertServicesList = List(); + Future getHHCAllServices() async { HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = new HHCGetAllServicesRequestModel(); @@ -40,17 +45,18 @@ class HomeHealthCareViewModel extends BaseViewModel { } Future getHHCAllPresOrders() async { + pendingOrder = null; setState(ViewState.Busy); await _homeHealthCareService.getHHCAllPresOrders(); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); } else { - var pendingOrder = _homeHealthCareService.hhcAllPresOrdersList + pendingOrder = _homeHealthCareService.hhcAllPresOrdersList .firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); if (pendingOrder != null) { - await getOrderDetailByOrderID(pendingOrder); + await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); setState(ViewState.Idle); } else { getHHCAllServices(); @@ -61,7 +67,7 @@ class HomeHealthCareViewModel extends BaseViewModel { Future updateHHCPresOrder( UpdatePresOrderRequestModel updatePresOrderRequestModel) async { - setState(ViewState.BusyLocal); + setState(ViewState.Busy); await _homeHealthCareService.updateHHCPresOrder( updatePresOrderRequestModel); if (_homeHealthCareService.hasError) { @@ -72,19 +78,6 @@ class HomeHealthCareViewModel extends BaseViewModel { } } - Future getOrderDetailByOrderID(GetHHCAllPresOrdersResponseModel order) async { - GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = GetOrderDetailByOrderIDRequestModel( - presOrderID: order.iD); - // setState(ViewState.Busy); - await _homeHealthCareService.getOrderDetailByOrderID( - getOrderDetailByOrderIDRequestModel); - // if (_homeHealthCareService.hasError) { - // error = _homeHealthCareService.error; - // setState(ViewState.Error); - // } else { - // setState(ViewState.Idle); - // } - } } \ No newline at end of file diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 222a3f8c..2cf8e877 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; @@ -77,8 +78,8 @@ class AmRequestViewModel extends BaseViewModel { Future getOrderDetails() async { setState(ViewState.Busy); await _amService.getOrderDetails(); - if (_hospitalService.hasError) { - error = _hospitalService.error; + if (_amService.hasError) { + error = _amService.error; setState(ViewState.Error); } else setState(ViewState.Idle); @@ -87,10 +88,21 @@ class AmRequestViewModel extends BaseViewModel { Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); await _amService.updatePressOrder(presOrderID: presOrderID); - if (_hospitalService.hasError) { - error = _hospitalService.error; + if (_amService.hasError) { + error = _amService.error; setState(ViewState.Error); } else getPatientAllPresOrdersList(); } + + Future insertERPressOrder({@required PatientER patientER}) async { + setState(ViewState.Busy); + await _amService.insertERPressOrder(patientER: patientER); + if (_amService.hasError) { + error = _amService.error; + setState(ViewState.ErrorLocal); + } else + getAmRequestOrders(); + + } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart index ee06c8bb..e8e9eccc 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart @@ -23,7 +23,7 @@ class CMCIndexPage extends StatelessWidget { "CMC", fontWeight: FontWeight.normal, fontSize: 25, - color: Hexcolor("#60686b"), + color: Color(0xff60686b), ), SizedBox( height: 12, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 37ada2b7..2dd64605 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -14,10 +14,11 @@ class NewHomeHealthCareStepOnePage extends StatefulWidget { patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; + const NewHomeHealthCareStepOnePage( {Key key, this.patientERInsertPresOrderRequestModel, - this.model, + this.model, this.changePageViewIndex}) : super(key: key); @@ -30,10 +31,10 @@ class _NewHomeHealthCareStepOnePageState extends State { @override void initState() { + if(widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList==null) + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = []; + - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList =[]; super.initState(); } @@ -45,18 +46,19 @@ class _NewHomeHealthCareStepOnePageState body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.only( + left: MediaQuery.of(context).size.width * 0.05, + right: MediaQuery.of(context).size.width * 0.05), child: Center( child: FractionallySizedBox( - widthFactor: 0.94, + widthFactor: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 12, ), Texts( -// TranslationBase.of(context).advancePaymentLabel, "Select Home Health Care Services", textAlign: TextAlign.center, ), @@ -65,8 +67,7 @@ class _NewHomeHealthCareStepOnePageState return Container( margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), + border: Border.all(color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( @@ -79,20 +80,13 @@ class _NewHomeHealthCareStepOnePageState activeColor: Colors.black38, onChanged: (bool newValue) { setState(() { - this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .add(new PatientERHHCInsertServicesList( - recordID: this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length, - serviceID: - service.serviceID, - serviceName: - service.description)); + if(!isServiceSelected(service.serviceID)) + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add( PatientERHHCInsertServicesList( + recordID:widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, + serviceID: service.serviceID, + serviceName: service.description)); + else + removeSelected(service.serviceID); // widget.patientERInsertPresOrderRequestModel // isPatientInsured = newValue; }); @@ -119,22 +113,22 @@ class _NewHomeHealthCareStepOnePageState ), ), ), - bottomSheet:Container( + bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, child: Column( children: [ Container( - width: MediaQuery - .of(context) - .size - .width * 0.9, + width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: "Next", - disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length ==0, - textColor: Theme - .of(context) - .backgroundColor), + disabled: this + .widget + .patientERInsertPresOrderRequestModel + .patientERHHCInsertServicesList + .length == + 0, + textColor: Theme.of(context).backgroundColor), ), ], ), @@ -150,4 +144,18 @@ class _NewHomeHealthCareStepOnePageState } return false; } + + removeSelected(int serviceId){ + Iterable patientERHHCInsertServicesList = widget + .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList + .where((element) => serviceId == element.serviceID); + + if(patientERHHCInsertServicesList.length > 0) + setState(() { + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList); + }); + + + + } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 84f59e25..40fb6125 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; +import '../StepsWidget.dart'; import 'new_Home_health_care_step_one_page.dart'; class NewHomeHealthCarePage extends StatefulWidget { @@ -19,8 +20,7 @@ class NewHomeHealthCarePage extends StatefulWidget { final HomeHealthCareViewModel model; @override - _NewHomeHealthCarePageState createState() => - _NewHomeHealthCarePageState(); + _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState(); } class _NewHomeHealthCarePageState extends State @@ -29,8 +29,8 @@ class _NewHomeHealthCarePageState extends State int _currentIndex = 1; int pageSelected = 2; - - PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); + PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = + new PatientERInsertPresOrderRequestModel(); @override void initState() { @@ -43,26 +43,31 @@ class _NewHomeHealthCarePageState extends State super.dispose(); } - changePageViewIndex(pageIndex) { - _controller.jumpToPage(pageIndex); + _changeCurrentTab(int tab) { + setState(() { + _currentIndex = tab; + }); + _controller.animateToPage(tab, + duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override Widget build(BuildContext context) { - void showConfirmMessage( - HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, + GetOrderDetailByOrderIDResponseModel order) { showDialog( context: context, child: ConfirmCancelOrderDialog( model: model, onTap: () async { UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); + UpdatePresOrderRequestModel( + presOrderID: order.presOrderID, + rejectionReason: "", + presOrderStatus: 4, + editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { AppToast.showSuccessToast(message: "Done Successfully"); @@ -72,220 +77,218 @@ class _NewHomeHealthCarePageState extends State }, )); } + return Scaffold( body: SafeArea( child: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 0.8, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.hhcAllOrderDetail.length != 0 - ? FractionallySizedBox( - heightFactor: 0.8, - widthFactor: 0.9, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Request ID", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model.hhcAllOrderDetail[0].iD.toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Status", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - "Pending", - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Pickup Date", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - widget.model.hhcAllOrderDetail[0] - .createdOn)), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + child: Column( + children: [ + + Container( + margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: _changeCurrentTab, + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + widget.model.pendingOrder != null + ? FractionallySizedBox( + widthFactor: 0.9, + child: SingleChildScrollView( + child: Container( + width: double.infinity, + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "Request ID", + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + widget.model.pendingOrder.iD.toString(), + fontSize: 22, + ), + ], + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "Status", + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + widget.model.pendingOrder.description, + fontSize: 22, + ), + ], + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "Pickup Date", + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(widget + .model.pendingOrder.createdOn)), + fontSize: 22, + ), + ], + ), + ), + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + "Service Name", + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + widget.model.hhcAllOrderDetail[index] + .description, + fontSize: 22, + bold: true, + ), + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Center( + child: Container( + width: + MediaQuery.of(context).size.width * 0.85, + child: SecondaryButton( + label: "Cancel".toUpperCase(), + onTap: () { + showConfirmMessage(widget.model, + widget.model.hhcAllOrderDetail[0]); + }, + color: Colors.red[800], + disabled: false, + textColor: + Theme.of(context).backgroundColor), + ), + ), + SizedBox( + height: 12, + ), + ], + ), ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Service Name", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model.hhcAllOrderDetail[0].description - .toString() ?? - widget.model.hhcAllOrderDetail[0] - .descriptionN - .toString(), - fontSize: 22, - ), - ], - ), - ), - SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 12, - ), - ], - ), + ) + : NewHomeHealthCareStepOnePage( + changePageViewIndex: _changeCurrentTab, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + model: widget.model, + ), + + ], ), - ) - : NewHomeHealthCareStepOnePage( - changePageViewIndex: changePageViewIndex, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, ), - // NewEReferralStepTowPage( - // changePageViewIndex: changePageViewIndex, - // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, - // - // ), - // NewEReferralStepThreePage( - // changePageViewIndex: changePageViewIndex, - // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, - // - // ), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart new file mode 100644 index 00000000..ec3020c5 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart @@ -0,0 +1,181 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + + StepsWidget({Key key, this.index, this.changeCurrentTab}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return projectViewModel.isArabic? Stack( + children: [ + Container( + height: 50, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: 10, + left: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '1', + color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: MediaQuery.of(context).size.width * 0.42, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '2', + color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + right: 0, + child: InkWell( + onTap: () => index == 2 ?changeCurrentTab(3) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(color: Colors.black,width: 0.75), + color: index == 2 ? Colors.grey[800] : Colors.white, + ), + child: Center( + child: Texts( + '3', + color: index == 2 ? Colors.white : Colors.grey[800], + ), + ), + ), + ), + ), + + ], + ):Stack( + children: [ + Container( + height: 50, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: 10, + right: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '1', + color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: MediaQuery.of(context).size.width * 0.42, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '2', + color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: 0, + child: InkWell( + onTap: () => index == 2 ?changeCurrentTab(3) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(color: Colors.black,width: 0.75), + color: index == 2 ? Colors.grey[800] : Colors.white, + ), + child: Center( + child: Texts( + '3', + color: index == 2 ? Colors.white : Colors.grey[800], + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart index 3c14c2a7..fa0799f9 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart @@ -24,7 +24,7 @@ class HomeHealthCareIndexPage extends StatelessWidget { TranslationBase.of(context).homeHealthCare, fontWeight: FontWeight.normal, fontSize: 25, - color: Hexcolor("#60686b"), + color: Color(0xff60686b), ), SizedBox( height: 12, diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index e4b923b2..5f303846 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -20,7 +20,8 @@ class AmbulanceRequestIndexPage extends StatefulWidget { AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); @override - _AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); + _AmbulanceRequestIndexPageState createState() => + _AmbulanceRequestIndexPageState(); } class _AmbulanceRequestIndexPageState extends State { @@ -45,112 +46,124 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - body: widget.amRequestViewModel.pickUpRequestPresOrder!=null + body: widget.amRequestViewModel.pickUpRequestPresOrder != null ? Column( - children: [ - SizedBox( - height: 80, - ), - Container( - margin: EdgeInsets.only(left: 18, right: 18), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - OrderLogItem( - title: 'Request ID', - value: widget.amRequestViewModel.pickUpRequestPresOrder.presOrderID.toString(), - ), - OrderLogItem( - title: 'Status', - value: widget.amRequestViewModel.pickUpRequestPresOrder.ambulateDescription, - ), - OrderLogItem( - title: 'Last edit time', - value: DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(widget.amRequestViewModel.pickUpRequestPresOrder.lastEditDate)), - ), - OrderLogItem( - title: 'Pickup Location', - value: widget.amRequestViewModel.pickUpRequestPresOrder.pickupLocationName, - ), - OrderLogItem( - title: 'Drop off Location', - value: widget.amRequestViewModel.pickUpRequestPresOrder.dropoffLocationName, - ), - OrderLogItem( - title: 'Trasfaer way', - value: widget.amRequestViewModel.pickUpRequestPresOrder.title, + SizedBox( + height: 80, ), Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4,left: 4,right: 4), + margin: EdgeInsets.only(left: 18, right: 18), decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), - ), - color: Colors.white + color: Colors.white, + borderRadius: BorderRadius.circular(2), ), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - widget.amRequestViewModel.updatePressOrder(presOrderID:widget.amRequestViewModel.pickUpRequestPresOrder.presOrderID ); - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + OrderLogItem( + title: 'Request ID', + value: widget.amRequestViewModel.pickUpRequestPresOrder + .presOrderID + .toString(), + ), + OrderLogItem( + title: 'Status', + value: widget.amRequestViewModel.pickUpRequestPresOrder + .ambulateDescription, + ), + OrderLogItem( + title: 'Last edit time', + value: DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(widget + .amRequestViewModel + .pickUpRequestPresOrder + .lastEditDate)), + ), + OrderLogItem( + title: 'Pickup Location', + value: widget.amRequestViewModel.pickUpRequestPresOrder + .pickupLocationName, + ), + OrderLogItem( + title: 'Drop off Location', + value: widget.amRequestViewModel.pickUpRequestPresOrder + .dropoffLocationName, + ), + OrderLogItem( + title: 'Trasfaer way', + value: widget + .amRequestViewModel.pickUpRequestPresOrder.title, + ), + Container( + padding: EdgeInsets.all(10), + width: double.maxFinite, + margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12), + bottomLeft: Radius.circular(12), + ), + color: Colors.white), + child: SecondaryButton( + color: Colors.red[900], + textColor: Colors.white, + label: TranslationBase.of(context).cancel, + onTap: () { + widget.amRequestViewModel.updatePressOrder( + presOrderID: widget.amRequestViewModel + .pickUpRequestPresOrder.presOrderID); + }, + ), + ) + ], ), - ) - ], - ), - ), - ], - ):Column( - children: [ - SizedBox( - height: 80, - ), - Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: StepsWidget( - index: currentIndex, - changeCurrentTab: _changeCurrentTab, - )), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: pageController, - children: [ - //Container(), - SelectTransportationMethod( - changeCurrentTab: _changeCurrentTab, - patientER: _patientER, - amRequestViewModel: widget.amRequestViewModel, ), - PickupLocation( - changeCurrentTab: _changeCurrentTab, - patientER: _patientER, - amRequestViewModel: widget.amRequestViewModel, + ], + ) + : Column( + children: [ + SizedBox( + height: 80, ), - BillAmount( - changeCurrentTab: _changeCurrentTab, - patientER: _patientER, - amRequestViewModel: widget.amRequestViewModel, + Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: StepsWidget( + index: currentIndex, + changeCurrentTab: _changeCurrentTab, + ), ), - Summary( - changeCurrentTab: _changeCurrentTab, - patientER: _patientER, - amRequestViewModel: widget.amRequestViewModel, + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + //Container(), + SelectTransportationMethod( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + PickupLocation( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + BillAmount( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + Summary( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + ], + ), ), ], ), - ), - ], - ), ); } } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index bb6db7c0..ee7ed8fa 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -8,8 +8,10 @@ import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dar import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -73,7 +75,7 @@ class _PickupLocationState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (widget.patientER.direction == 0) + if (widget.patientER.direction == 1) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -81,24 +83,42 @@ class _PickupLocationState extends State { SizedBox( height: 15, ), - Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Select From Map'), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) - ], + InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getSelectFromMapName()), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), ), ), SizedBox( @@ -263,7 +283,7 @@ class _PickupLocationState extends State { ), ], ), - if (widget.patientER.direction == 1) + if (widget.patientER.direction == 0) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -309,41 +329,14 @@ class _PickupLocationState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => PlacePicker( - apiKey: 'AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA', - // Put YOUR OWN KEY here. - onPlacePicked: (PickResult result) { - print(result.adrAddress); + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { setState(() { - _result = result; + _result = value; }); - Navigator.of(context).pop(); - }, - selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, // MediaQuery.of(context) will cause rebuild. See MediaQuery document for the information. - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : RaisedButton( - child: Text("Pick Here"), - onPressed: () { - // IMPORTANT: You MUST manage selectedPlace data yourself as using this build will not invoke onPlacePicker as - // this will override default 'Select here' Button. - print("do something with [selectedPlace] data"); - Navigator.of(context).pop(); - }, - ), - ); }, - initialPosition: LatLng(_latitude, _longitude), - useCurrentLocation: true, ), ), ); @@ -359,7 +352,7 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts('Select From Map'), + Texts(getSelectFromMapName()), Icon( FontAwesomeIcons.mapMarkerAlt, size: 24, @@ -384,44 +377,57 @@ class _PickupLocationState extends State { color: Colors.grey[800], textColor: Colors.white, onTap: () { - if(_result==null || _selectedHospital == null) - AppToast.showErrorToast(message: 'please select all fields'); + if (_result == null || _selectedHospital == null) + AppToast.showErrorToast( + message: 'please select all fields'); else - setState(() { - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - if (widget.patientER.direction == 0) { - widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); - widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; - widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; - - } else { - widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; - widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; - widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); - } + setState(() { + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER.direction == 0) { + widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); + widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; + widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; + } else { + widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; + widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; + widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); + } - widget.patientER.latitude = widget.patientER.pickupLocationLattitude; - widget.patientER.longitude = widget.patientER.pickupLocationLongitude; + widget.patientER.latitude = widget.patientER.pickupLocationLattitude; + widget.patientER.longitude = widget.patientER.pickupLocationLongitude; + widget.patientER.dropoffLocationName = _selectedHospital.name; + widget.patientER.createdBy = widget.amRequestViewModel.user.patientID; + widget.patientER.isOutPatient = widget.amRequestViewModel.user.outSA; + widget.patientER.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo; + widget.patientER.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); + widget.patientER.pickupLocationName = _result.formattedAddress; + widget.patientER.projectID = widget.amRequestViewModel.user.projectID; + widget.patientER.requesterFileNo = widget.amRequestViewModel.user.patientID; + widget.patientER.requesterIsOutSA = false; + widget.patientER.lineItemNo =0; + widget.patientER.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; - if(_haveAppointment == HaveAppointment.YES){ - widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); - widget.patientER.appointmentClinicName = myAppointment.clinicName; - widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; - widget.patientER.appointmentBranch = myAppointment.projectName; - widget.patientER.appointmentTime = myAppointment.appointmentDate; - }else{ - widget.patientER.appointmentNo ="0"; - widget.patientER.appointmentClinicName = null; - widget.patientER.appointmentDoctorName = null; - widget.patientER.appointmentBranch = null; - widget.patientER.appointmentTime = null; - } + if (_haveAppointment == HaveAppointment.YES) { + widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); + widget.patientER.appointmentClinicName = myAppointment.clinicName; + widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; + widget.patientER.appointmentBranch = myAppointment.projectName; + widget.patientER.appointmentTime = myAppointment.appointmentDate; + widget.patientER.haveAppointment = true; + } else { + widget.patientER.appointmentNo = "0"; + widget.patientER.appointmentClinicName = null; + widget.patientER.appointmentDoctorName = null; + widget.patientER.appointmentBranch = null; + widget.patientER.appointmentTime = null; + widget.patientER.haveAppointment = false; + } - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - widget.changeCurrentTab(2); - }); + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.changeCurrentTab(2); + }); }, label: 'Next', ), @@ -451,6 +457,10 @@ class _PickupLocationState extends State { return _selectedHospital == null ? title : _selectedHospital.name; } + String getSelectFromMapName() { + return _result != null ? _result.formattedAddress : 'Select From Map'; + } + getAppointment() { ProgressDialogUtil.showProgressDialog(context); widget.amRequestViewModel.getAppointmentHistory().then((value) { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 563e388a..01683b55 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -284,8 +284,9 @@ class _SelectTransportationMethodState textColor: Colors.white, onTap: () { setState(() { - widget.patientER.direction = _direction == Direction.ToHospital ? 0 : 1; - widget.patientER.tripType = _way == Way.TwoWays ? 2 : 1; + widget.patientER.transportationMethodId =(widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0; + widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); widget.patientER.patientERTransportationMethod = _erTransportationMethod; widget.patientER.orderServiceID = _orderService.getIdOrderService(); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 4c189707..7696dd09 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -17,6 +17,7 @@ class Summary extends StatefulWidget { _SummaryState createState() => _SummaryState(); } +//TODO it should be dynamic class _SummaryState extends State { @override Widget build(BuildContext context) { @@ -30,7 +31,6 @@ class _SummaryState extends State { SizedBox(height: 5,), Container( width: double.infinity, - padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, @@ -92,9 +92,11 @@ class _SummaryState extends State { child:SecondaryButton( color: Colors.grey[800], textColor: Colors.white, - label: 'Next', + label: 'Send', + onTap: () async { + await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); - // onTap: ()=> widget.changeCurrentTab(2), + } ), ) ], diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 0155ff10..b35bbcf4 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -27,6 +27,14 @@ class DateUtil { return start + "$milliseconds" + end; } + static String convertDateToStringLocation(DateTime date) { + const start = "/Date("; + const end = ")/"; + int milliseconds = date.millisecondsSinceEpoch; + + return start + "$milliseconds" + end; + } + static String yearMonthDay(DateTime dateTime) { String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}'; return dateFormat; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 4a5e7500..e1559bd4 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -681,11 +681,7 @@ class TranslationBase { String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; String get loginRegister => localizedValues['LoginRegister'][locale.languageCode]; String get orderLog => localizedValues['OrderLog'][locale.languageCode]; - - String get questionHere => - localizedValues['QuestionHere'][locale.languageCode]; - String get viewDoctorResponses => - localizedValues['ViewDoctorResponses'][locale.languageCode];String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; + String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; String get infoLab => localizedValues['info-lab'][locale.languageCode]; String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; diff --git a/lib/widgets/others/close_back.dart b/lib/widgets/others/close_back.dart index 78fe0c86..75fe05e8 100644 --- a/lib/widgets/others/close_back.dart +++ b/lib/widgets/others/close_back.dart @@ -16,7 +16,7 @@ class CloseBack extends StatelessWidget{ onTap: Feedback.wrapForTap(() { onTap!=null ? onTap() : Navigator.pop(context); }, context), - child: Icon(EvaIcons.close, color: Color.fromRGBO(78, 62, 253, 1.0)), + child: Icon(EvaIcons.close, color: Colors.white), ); } } \ No newline at end of file diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart new file mode 100644 index 00000000..2e34ad3e --- /dev/null +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -0,0 +1,77 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:provider/provider.dart'; + +class PickupLocationFromMap extends StatelessWidget { + final Function(PickResult) onPick; + final double latitude; + final double longitude; + + const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude}) + : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Scaffold( + appBar: AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text('Location'), + leading: CloseBack(), + centerTitle: true, + ), + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + onPick(result); + Navigator.of(context).pop(); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + onPick(selectedPlace); + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context).next, + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: true, + ), + ); + } +}