done ER service

merge-update-with-lab-changes
jammal 5 years ago
parent 7dc55f3378
commit 9328f942ba

@ -73,7 +73,7 @@
android:value="2" /> android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY" <meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA"/> android:value="AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"/>
</application> </application>

@ -60,7 +60,8 @@ const GET_NEAREST_HOSPITAL =
const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; 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_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 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 ///FindUs
const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; 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 TIMER_MIN = 10;
const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";
class AppGlobal { class AppGlobal {
static var context; static var context;

@ -609,26 +609,7 @@ const Map<String, Map<String, String>> localizedValues = {
"en": "Order Log", "en": "Order Log",
"ar": " سجل الطلبات" "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":"دخول / تسجيل"}, "ServiceInformationButton":{"en":"LOGIN / REGISTER","ar":"دخول / تسجيل"},
"ServiceInformationTitle":{"en":"Service Information","ar":"معلومات الخدمة"}, "ServiceInformationTitle":{"en":"Service Information","ar":"معلومات الخدمة"},
"info-lab": { "info-lab": {

@ -18,7 +18,7 @@ class PatientERInsertPresOrderRequestModel {
double longitude; double longitude;
int createdBy; int createdBy;
int orderServiceID; int orderServiceID;
List<PatientERHHCInsertServicesList> patientERHHCInsertServicesList; List<PatientERHHCInsertServicesList> patientERHHCInsertServicesList =List();
PatientERInsertPresOrderRequestModel( PatientERInsertPresOrderRequestModel(
{this.versionID, {this.versionID,
@ -38,7 +38,7 @@ class PatientERInsertPresOrderRequestModel {
this.longitude, this.longitude,
this.createdBy, this.createdBy,
this.orderServiceID, this.orderServiceID,
this.patientERHHCInsertServicesList}); });
PatientERInsertPresOrderRequestModel.fromJson(Map<String, dynamic> json) { PatientERInsertPresOrderRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID']; versionID = json['VersionID'];

@ -16,6 +16,7 @@ class HomeHealthCareService extends BaseService {
List<GetOrderDetailByOrderIDResponseModel> hhcAllOrderDetail = List(); List<GetOrderDetailByOrderIDResponseModel> hhcAllOrderDetail = List();
bool isOrderUpdated; bool isOrderUpdated;
Future getHHCAllServices( Future getHHCAllServices(
HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async {
hasError = false; hasError = false;
@ -31,49 +32,51 @@ class HomeHealthCareService extends BaseService {
}, body: hHCGetAllServicesRequestModel.toJson()); }, body: hHCGetAllServicesRequestModel.toJson());
} }
Future getHHCAllPresOrders() async { Future getHHCAllPresOrders() async {
GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel =
GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel= GetHHCAllPresOrdersRequestModel(); GetHHCAllPresOrdersRequestModel();
hasError = false; hasError = false;
await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
hhcAllPresOrdersList.clear(); hhcAllPresOrdersList.clear();
response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { response['PatientER_GetPatientAllPresOrdersList'].forEach((data) {
if(data['ServiceID'] == 2) if (data['ServiceID'] == 2)
hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); hhcAllPresOrdersList
}); .add(GetHHCAllPresOrdersResponseModel.fromJson(data));
}, onFailure: (String error, int statusCode) { });
hasError = true; }, onFailure: (String error, int statusCode) {
super.error = error; hasError = true;
}, body: getHHCAllPresOrdersRequestModel.toJson()); super.error = error;
}, body: getHHCAllPresOrdersRequestModel.toJson());
} }
Future getOrderDetailByOrderID(GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel) async { Future getOrderDetailByOrderID(int presOrderID) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map();
body['PresOrderID'] = presOrderID;
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, await baseAppClient.post(GET_ORDER_DETAIL_BY_ID,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
hhcAllOrderDetail.clear(); hhcAllOrderDetail.clear();
response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) {
hhcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); hhcAllOrderDetail
}); .add(GetOrderDetailByOrderIDResponseModel.fromJson(data));
}, onFailure: (String error, int statusCode) { });
hasError = true; }, onFailure: (String error, int statusCode) {
super.error = error; hasError = true;
}, body: getOrderDetailByOrderIDRequestModel.toJson()); super.error = error;
}, body: body);
} }
Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { Future updateHHCPresOrder(
UpdatePresOrderRequestModel updatePresOrderRequestModel) async {
hasError = false; hasError = false;
await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
isOrderUpdated = true; isOrderUpdated = true;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: updatePresOrderRequestModel.toJson()); }, body: updatePresOrderRequestModel.toJson());
} }
} }

@ -83,6 +83,7 @@ class BaseAppClient {
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
var ss = json.encode(body);
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), final response = await http.post(url.trim(),

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.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/PickUpRequestPresOrder.dart';
import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -91,4 +92,16 @@ class AmService extends BaseService {
super.error = error; super.error = error;
}, body: body); }, 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());
}
} }

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; 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_request_modle.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.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_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_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_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; bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated;
GetHHCAllPresOrdersResponseModel pendingOrder;
List<PatientERHHCInsertServicesList> patientERHHCInsertServicesList = List();
Future getHHCAllServices() async { Future getHHCAllServices() async {
HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel =
new HHCGetAllServicesRequestModel(); new HHCGetAllServicesRequestModel();
@ -40,17 +45,18 @@ class HomeHealthCareViewModel extends BaseViewModel {
} }
Future getHHCAllPresOrders() async { Future getHHCAllPresOrders() async {
pendingOrder = null;
setState(ViewState.Busy); setState(ViewState.Busy);
await _homeHealthCareService.getHHCAllPresOrders(); await _homeHealthCareService.getHHCAllPresOrders();
if (_homeHealthCareService.hasError) { if (_homeHealthCareService.hasError) {
error = _homeHealthCareService.error; error = _homeHealthCareService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
var pendingOrder = _homeHealthCareService.hhcAllPresOrdersList pendingOrder = _homeHealthCareService.hhcAllPresOrdersList
.firstWhere((element) => element.status == 1 || element.status == 2, .firstWhere((element) => element.status == 1 || element.status == 2,
orElse: () => null); orElse: () => null);
if (pendingOrder != null) { if (pendingOrder != null) {
await getOrderDetailByOrderID(pendingOrder); await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD);
setState(ViewState.Idle); setState(ViewState.Idle);
} else { } else {
getHHCAllServices(); getHHCAllServices();
@ -61,7 +67,7 @@ class HomeHealthCareViewModel extends BaseViewModel {
Future updateHHCPresOrder( Future updateHHCPresOrder(
UpdatePresOrderRequestModel updatePresOrderRequestModel) async { UpdatePresOrderRequestModel updatePresOrderRequestModel) async {
setState(ViewState.BusyLocal); setState(ViewState.Busy);
await _homeHealthCareService.updateHHCPresOrder( await _homeHealthCareService.updateHHCPresOrder(
updatePresOrderRequestModel); updatePresOrderRequestModel);
if (_homeHealthCareService.hasError) { 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);
// }
}
} }

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.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/PickUpRequestPresOrder.dart';
import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
@ -77,8 +78,8 @@ class AmRequestViewModel extends BaseViewModel {
Future getOrderDetails() async { Future getOrderDetails() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _amService.getOrderDetails(); await _amService.getOrderDetails();
if (_hospitalService.hasError) { if (_amService.hasError) {
error = _hospitalService.error; error = _amService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
@ -87,10 +88,21 @@ class AmRequestViewModel extends BaseViewModel {
Future updatePressOrder({@required int presOrderID}) async { Future updatePressOrder({@required int presOrderID}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _amService.updatePressOrder(presOrderID: presOrderID); await _amService.updatePressOrder(presOrderID: presOrderID);
if (_hospitalService.hasError) { if (_amService.hasError) {
error = _hospitalService.error; error = _amService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else } else
getPatientAllPresOrdersList(); 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();
}
} }

@ -23,7 +23,7 @@ class CMCIndexPage extends StatelessWidget {
"CMC", "CMC",
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 25, fontSize: 25,
color: Hexcolor("#60686b"), color: Color(0xff60686b),
), ),
SizedBox( SizedBox(
height: 12, height: 12,

@ -14,10 +14,11 @@ class NewHomeHealthCareStepOnePage extends StatefulWidget {
patientERInsertPresOrderRequestModel; patientERInsertPresOrderRequestModel;
final Function changePageViewIndex; final Function changePageViewIndex;
final HomeHealthCareViewModel model; final HomeHealthCareViewModel model;
const NewHomeHealthCareStepOnePage( const NewHomeHealthCareStepOnePage(
{Key key, {Key key,
this.patientERInsertPresOrderRequestModel, this.patientERInsertPresOrderRequestModel,
this.model, this.model,
this.changePageViewIndex}) this.changePageViewIndex})
: super(key: key); : super(key: key);
@ -30,10 +31,10 @@ class _NewHomeHealthCareStepOnePageState
extends State<NewHomeHealthCareStepOnePage> { extends State<NewHomeHealthCareStepOnePage> {
@override @override
void initState() { void initState() {
if(widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList==null)
widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = [];
widget
.patientERInsertPresOrderRequestModel
.patientERHHCInsertServicesList =[];
super.initState(); super.initState();
} }
@ -45,18 +46,19 @@ class _NewHomeHealthCareStepOnePageState
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( 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: Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.94, widthFactor: 1,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 20, height: 12,
), ),
Texts( Texts(
// TranslationBase.of(context).advancePaymentLabel,
"Select Home Health Care Services", "Select Home Health Care Services",
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -65,8 +67,7 @@ class _NewHomeHealthCareStepOnePageState
return Container( return Container(
margin: EdgeInsets.only(top: 15), margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: border: Border.all(color: Colors.grey, width: 1),
Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white), color: Colors.white),
child: Column( child: Column(
@ -79,20 +80,13 @@ class _NewHomeHealthCareStepOnePageState
activeColor: Colors.black38, activeColor: Colors.black38,
onChanged: (bool newValue) { onChanged: (bool newValue) {
setState(() { setState(() {
this if(!isServiceSelected(service.serviceID))
.widget widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add( PatientERHHCInsertServicesList(
.patientERInsertPresOrderRequestModel recordID:widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length,
.patientERHHCInsertServicesList serviceID: service.serviceID,
.add(new PatientERHHCInsertServicesList( serviceName: service.description));
recordID: this else
.widget removeSelected(service.serviceID);
.patientERInsertPresOrderRequestModel
.patientERHHCInsertServicesList
.length,
serviceID:
service.serviceID,
serviceName:
service.description));
// widget.patientERInsertPresOrderRequestModel // widget.patientERInsertPresOrderRequestModel
// isPatientInsured = newValue; // isPatientInsured = newValue;
}); });
@ -119,22 +113,22 @@ class _NewHomeHealthCareStepOnePageState
), ),
), ),
), ),
bottomSheet:Container( bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.10, height: MediaQuery.of(context).size.height * 0.10,
width: double.infinity, width: double.infinity,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
width: MediaQuery width: MediaQuery.of(context).size.width * 0.9,
.of(context)
.size
.width * 0.9,
child: SecondaryButton( child: SecondaryButton(
label: "Next", label: "Next",
disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length ==0, disabled: this
textColor: Theme .widget
.of(context) .patientERInsertPresOrderRequestModel
.backgroundColor), .patientERHHCInsertServicesList
.length ==
0,
textColor: Theme.of(context).backgroundColor),
), ),
], ],
), ),
@ -150,4 +144,18 @@ class _NewHomeHealthCareStepOnePageState
} }
return false; return false;
} }
removeSelected(int serviceId){
Iterable <PatientERHHCInsertServicesList> patientERHHCInsertServicesList = widget
.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList
.where((element) => serviceId == element.serviceID);
if(patientERHHCInsertServicesList.length > 0)
setState(() {
widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList);
});
}
} }

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../StepsWidget.dart';
import 'new_Home_health_care_step_one_page.dart'; import 'new_Home_health_care_step_one_page.dart';
class NewHomeHealthCarePage extends StatefulWidget { class NewHomeHealthCarePage extends StatefulWidget {
@ -19,8 +20,7 @@ class NewHomeHealthCarePage extends StatefulWidget {
final HomeHealthCareViewModel model; final HomeHealthCareViewModel model;
@override @override
_NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState();
_NewHomeHealthCarePageState();
} }
class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage> class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
@ -29,8 +29,8 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
int _currentIndex = 1; int _currentIndex = 1;
int pageSelected = 2; int pageSelected = 2;
PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel =
PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); new PatientERInsertPresOrderRequestModel();
@override @override
void initState() { void initState() {
@ -43,26 +43,31 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
super.dispose(); super.dispose();
} }
changePageViewIndex(pageIndex) { _changeCurrentTab(int tab) {
_controller.jumpToPage(pageIndex); setState(() {
_currentIndex = tab;
});
_controller.animateToPage(tab,
duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
void showConfirmMessage( void showConfirmMessage(HomeHealthCareViewModel model,
HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) { GetOrderDetailByOrderIDResponseModel order) {
showDialog( showDialog(
context: context, context: context,
child: ConfirmCancelOrderDialog( child: ConfirmCancelOrderDialog(
model: model, model: model,
onTap: () async { onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel updatePresOrderRequestModel =
UpdatePresOrderRequestModel( UpdatePresOrderRequestModel(
presOrderID: order.presOrderID, presOrderID: order.presOrderID,
rejectionReason: "", rejectionReason: "",
presOrderStatus: 4, editedBy: 3); presOrderStatus: 4,
editedBy: 3);
await model.updateHHCPresOrder(updatePresOrderRequestModel); await model.updateHHCPresOrder(updatePresOrderRequestModel);
if(model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
AppToast.showSuccessToast(message: "Done Successfully"); AppToast.showSuccessToast(message: "Done Successfully");
@ -72,220 +77,218 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
}, },
)); ));
} }
return Scaffold( return Scaffold(
body: SafeArea( body: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.8, height: MediaQuery.of(context).size.height * 0.8,
child: PageView( child: Column(
physics: NeverScrollableScrollPhysics(), children: [
controller: _controller,
onPageChanged: (index) { Container(
setState(() { margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05),
_currentIndex = index; child: StepsWidget(
}); index: _currentIndex,
}, changeCurrentTab: _changeCurrentTab,
scrollDirection: Axis.horizontal, ),
children: <Widget>[ ),
widget.model.hhcAllOrderDetail.length != 0 Expanded(
? FractionallySizedBox( child: PageView(
heightFactor: 0.8, physics: NeverScrollableScrollPhysics(),
widthFactor: 0.9, controller: _controller,
child: Container( onPageChanged: (index) {
width: double.infinity, setState(() {
margin: EdgeInsets.only(top: 15), _currentIndex = index;
decoration: BoxDecoration( });
border: },
Border.all(color: Colors.grey, width: 1), scrollDirection: Axis.horizontal,
borderRadius: BorderRadius.circular(12), children: <Widget>[
color: Colors.white), widget.model.pendingOrder != null
child: Column( ? FractionallySizedBox(
crossAxisAlignment: CrossAxisAlignment.start, widthFactor: 0.9,
children: [ child: SingleChildScrollView(
SizedBox( child: Container(
height: 12, width: double.infinity,
), margin: EdgeInsets.only(top: 15),
Container( decoration: BoxDecoration(
width: double.infinity, border: Border.all(color: Colors.grey, width: 1),
padding: EdgeInsets.only( borderRadius: BorderRadius.circular(12),
left: 15, bottom: 15, top: 15), color: Colors.white),
decoration: BoxDecoration( child: Column(
border: Border( crossAxisAlignment: CrossAxisAlignment.start,
bottom: BorderSide( children: [
color: Colors.grey, SizedBox(
width: 1.0, height: 12,
), ),
), Container(
// borderRadius: BorderRadius.circular(12), width: double.infinity,
color: Colors.white), padding: EdgeInsets.only(
child: Column( left: 15, bottom: 15, top: 15),
crossAxisAlignment: decoration: BoxDecoration(
CrossAxisAlignment.start, border: Border(
children: [ bottom: BorderSide(
Texts( color: Colors.grey,
"Request ID", width: 1.0,
bold: false, ),
fontSize: 13, ),
), // borderRadius: BorderRadius.circular(12),
SizedBox( color: Colors.white),
height: 4, child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
Texts( children: [
widget.model.hhcAllOrderDetail[0].iD.toString(), Texts(
fontSize: 22, "Request ID",
), bold: false,
], fontSize: 13,
), ),
), SizedBox(
Container( height: 4,
width: double.infinity, ),
padding: EdgeInsets.only( Texts(
left: 15, bottom: 15, top: 15), widget.model.pendingOrder.iD.toString(),
decoration: BoxDecoration( fontSize: 22,
border: Border( ),
bottom: BorderSide( ],
color: Colors.grey, ),
width: 1.0, ),
), Container(
), width: double.infinity,
// borderRadius: BorderRadius.circular(12), padding: EdgeInsets.only(
color: Colors.white), left: 15, bottom: 15, top: 15),
child: Column( decoration: BoxDecoration(
crossAxisAlignment: border: Border(
CrossAxisAlignment.start, bottom: BorderSide(
children: [ color: Colors.grey,
Texts( width: 1.0,
"Status", ),
bold: false, ),
fontSize: 13, // borderRadius: BorderRadius.circular(12),
), color: Colors.white),
SizedBox( child: Column(
height: 4, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
Texts( Texts(
"Pending", "Status",
fontSize: 22, bold: false,
), fontSize: 13,
], ),
), SizedBox(
), height: 4,
Container( ),
width: double.infinity, Texts(
padding: EdgeInsets.only( widget.model.pendingOrder.description,
left: 15, bottom: 15, top: 15), fontSize: 22,
decoration: BoxDecoration( ),
border: Border( ],
bottom: BorderSide( ),
color: Colors.grey, ),
width: 1.0, Container(
), width: double.infinity,
), padding: EdgeInsets.only(
// borderRadius: BorderRadius.circular(12), left: 15, bottom: 15, top: 15),
color: Colors.white), decoration: BoxDecoration(
child: Column( border: Border(
crossAxisAlignment: bottom: BorderSide(
CrossAxisAlignment.start, color: Colors.grey,
children: [ width: 1.0,
Texts( ),
"Pickup Date", ),
bold: false, // borderRadius: BorderRadius.circular(12),
fontSize: 13, color: Colors.white),
), child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.start,
height: 4, children: [
), Texts(
Texts( "Pickup Date",
DateUtil.getDayMonthYearDateFormatted( bold: false,
DateUtil.convertStringToDate( fontSize: 13,
widget.model.hhcAllOrderDetail[0] ),
.createdOn)), SizedBox(
fontSize: 22, height: 4,
), ),
], Texts(
), DateUtil.getDayMonthYearDateFormatted(
), DateUtil.convertStringToDate(widget
Container( .model.pendingOrder.createdOn)),
width: double.infinity, fontSize: 22,
padding: EdgeInsets.only( ),
left: 15, bottom: 15, top: 15), ],
decoration: BoxDecoration( ),
border: Border( ),
bottom: BorderSide( ...List.generate(
color: Colors.grey, widget.model.hhcAllOrderDetail.length,
width: 1.0, (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), : NewHomeHealthCareStepOnePage(
child: Column( changePageViewIndex: _changeCurrentTab,
crossAxisAlignment: patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
CrossAxisAlignment.start, model: widget.model,
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: changePageViewIndex,
patientERInsertPresOrderRequestModel:
patientERInsertPresOrderRequestModel,
model: widget.model,
), ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
//
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
//
// ),
], ],
), ),
), ),

@ -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],
),
),
),
),
),
],
);
}
}

@ -24,7 +24,7 @@ class HomeHealthCareIndexPage extends StatelessWidget {
TranslationBase.of(context).homeHealthCare, TranslationBase.of(context).homeHealthCare,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 25, fontSize: 25,
color: Hexcolor("#60686b"), color: Color(0xff60686b),
), ),
SizedBox( SizedBox(
height: 12, height: 12,

@ -20,7 +20,8 @@ class AmbulanceRequestIndexPage extends StatefulWidget {
AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); AmbulanceRequestIndexPage({Key key, this.amRequestViewModel});
@override @override
_AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); _AmbulanceRequestIndexPageState createState() =>
_AmbulanceRequestIndexPageState();
} }
class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> { class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
@ -45,112 +46,124 @@ class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
body: widget.amRequestViewModel.pickUpRequestPresOrder!=null body: widget.amRequestViewModel.pickUpRequestPresOrder != null
? Column( ? 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: [ children: [
OrderLogItem( SizedBox(
title: 'Request ID', height: 80,
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( Container(
padding: EdgeInsets.all(10), margin: EdgeInsets.only(left: 18, right: 18),
width: double.maxFinite,
margin: EdgeInsets.only(bottom: 4,left: 4,right: 4),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( color: Colors.white,
bottomRight: Radius.circular(12), borderRadius: BorderRadius.circular(2),
bottomLeft: Radius.circular(12),
),
color: Colors.white
), ),
child: SecondaryButton( child: Column(
color: Colors.red[900], crossAxisAlignment: CrossAxisAlignment.start,
textColor: Colors.white, children: [
label: TranslationBase.of(context).cancel, OrderLogItem(
onTap: () { title: 'Request ID',
widget.amRequestViewModel.updatePressOrder(presOrderID:widget.amRequestViewModel.pickUpRequestPresOrder.presOrderID ); 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: <Widget>[
//Container(),
SelectTransportationMethod(
changeCurrentTab: _changeCurrentTab,
patientER: _patientER,
amRequestViewModel: widget.amRequestViewModel,
), ),
PickupLocation( ],
changeCurrentTab: _changeCurrentTab, )
patientER: _patientER, : Column(
amRequestViewModel: widget.amRequestViewModel, children: [
SizedBox(
height: 80,
), ),
BillAmount( Container(
changeCurrentTab: _changeCurrentTab, margin: EdgeInsets.only(left: 12, right: 12),
patientER: _patientER, child: StepsWidget(
amRequestViewModel: widget.amRequestViewModel, index: currentIndex,
changeCurrentTab: _changeCurrentTab,
),
), ),
Summary( Expanded(
changeCurrentTab: _changeCurrentTab, child: PageView(
patientER: _patientER, physics: NeverScrollableScrollPhysics(),
amRequestViewModel: widget.amRequestViewModel, controller: pageController,
children: <Widget>[
//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,
),
],
),
), ),
], ],
), ),
),
],
),
); );
} }
} }

@ -8,8 +8,10 @@ import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dar
import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.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/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -73,7 +75,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (widget.patientER.direction == 0) if (widget.patientER.direction == 1)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -81,24 +83,42 @@ class _PickupLocationState extends State<PickupLocation> {
SizedBox( SizedBox(
height: 15, height: 15,
), ),
Container( InkWell(
padding: EdgeInsets.all(12), onTap: (){
decoration: BoxDecoration( Navigator.push(
shape: BoxShape.rectangle, context,
borderRadius: BorderRadius.circular(8), MaterialPageRoute(
border: Border.all(color: Colors.grey, width: 0.5), builder: (context) => PickupLocationFromMap(
color: Colors.white, latitude: _latitude,
), longitude: _longitude,
child: Row( onPick: (value) {
mainAxisAlignment: MainAxisAlignment.spaceBetween, setState(() {
children: [ _result = value;
Texts('Select From Map'), });
Icon( },
FontAwesomeIcons.mapMarkerAlt, ),
size: 24, ),
color: Colors.black, );
) },
], 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( SizedBox(
@ -263,7 +283,7 @@ class _PickupLocationState extends State<PickupLocation> {
), ),
], ],
), ),
if (widget.patientER.direction == 1) if (widget.patientER.direction == 0)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -309,41 +329,14 @@ class _PickupLocationState extends State<PickupLocation> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => PlacePicker( builder: (context) => PickupLocationFromMap(
apiKey: 'AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA', latitude: _latitude,
// Put YOUR OWN KEY here. longitude: _longitude,
onPlacePicked: (PickResult result) { onPick: (value) {
print(result.adrAddress);
setState(() { 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<PickupLocation> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts('Select From Map'), Texts(getSelectFromMapName()),
Icon( Icon(
FontAwesomeIcons.mapMarkerAlt, FontAwesomeIcons.mapMarkerAlt,
size: 24, size: 24,
@ -384,44 +377,57 @@ class _PickupLocationState extends State<PickupLocation> {
color: Colors.grey[800], color: Colors.grey[800],
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () {
if(_result==null || _selectedHospital == null) if (_result == null || _selectedHospital == null)
AppToast.showErrorToast(message: 'please select all fields'); AppToast.showErrorToast(
message: 'please select all fields');
else else
setState(() { setState(() {
widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; widget.patientER.pickupSpot = _isInsideHome ? 1 : 0;
if (widget.patientER.direction == 0) { if (widget.patientER.direction == 0) {
widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString();
widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString();
widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude;
widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude;
} else {
} else { widget.patientER.pickupLocationLattitude = _selectedHospital.latitude;
widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; widget.patientER.pickupLocationLongitude = _selectedHospital.longitude;
widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString();
widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString();
widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); }
}
widget.patientER.latitude = widget.patientER.pickupLocationLattitude; widget.patientER.latitude = widget.patientER.pickupLocationLattitude;
widget.patientER.longitude = widget.patientER.pickupLocationLongitude; 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){ if (_haveAppointment == HaveAppointment.YES) {
widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); widget.patientER.appointmentNo = myAppointment.appointmentNo.toString();
widget.patientER.appointmentClinicName = myAppointment.clinicName; widget.patientER.appointmentClinicName = myAppointment.clinicName;
widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj;
widget.patientER.appointmentBranch = myAppointment.projectName; widget.patientER.appointmentBranch = myAppointment.projectName;
widget.patientER.appointmentTime = myAppointment.appointmentDate; widget.patientER.appointmentTime = myAppointment.appointmentDate;
}else{ widget.patientER.haveAppointment = true;
widget.patientER.appointmentNo ="0"; } else {
widget.patientER.appointmentClinicName = null; widget.patientER.appointmentNo = "0";
widget.patientER.appointmentDoctorName = null; widget.patientER.appointmentClinicName = null;
widget.patientER.appointmentBranch = null; widget.patientER.appointmentDoctorName = null;
widget.patientER.appointmentTime = null; widget.patientER.appointmentBranch = null;
} widget.patientER.appointmentTime = null;
widget.patientER.haveAppointment = false;
}
widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; widget.patientER.pickupSpot = _isInsideHome ? 1 : 0;
widget.changeCurrentTab(2); widget.changeCurrentTab(2);
}); });
}, },
label: 'Next', label: 'Next',
), ),
@ -451,6 +457,10 @@ class _PickupLocationState extends State<PickupLocation> {
return _selectedHospital == null ? title : _selectedHospital.name; return _selectedHospital == null ? title : _selectedHospital.name;
} }
String getSelectFromMapName() {
return _result != null ? _result.formattedAddress : 'Select From Map';
}
getAppointment() { getAppointment() {
ProgressDialogUtil.showProgressDialog(context); ProgressDialogUtil.showProgressDialog(context);
widget.amRequestViewModel.getAppointmentHistory().then((value) { widget.amRequestViewModel.getAppointmentHistory().then((value) {

@ -284,8 +284,9 @@ class _SelectTransportationMethodState
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () {
setState(() { setState(() {
widget.patientER.direction = _direction == Direction.ToHospital ? 0 : 1; widget.patientER.transportationMethodId =(widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
widget.patientER.tripType = _way == Way.TwoWays ? 2 : 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.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
widget.patientER.patientERTransportationMethod = _erTransportationMethod; widget.patientER.patientERTransportationMethod = _erTransportationMethod;
widget.patientER.orderServiceID = _orderService.getIdOrderService(); widget.patientER.orderServiceID = _orderService.getIdOrderService();

@ -17,6 +17,7 @@ class Summary extends StatefulWidget {
_SummaryState createState() => _SummaryState(); _SummaryState createState() => _SummaryState();
} }
//TODO it should be dynamic
class _SummaryState extends State<Summary> { class _SummaryState extends State<Summary> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -30,7 +31,6 @@ class _SummaryState extends State<Summary> {
SizedBox(height: 5,), SizedBox(height: 5,),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -92,9 +92,11 @@ class _SummaryState extends State<Summary> {
child:SecondaryButton( child:SecondaryButton(
color: Colors.grey[800], color: Colors.grey[800],
textColor: Colors.white, textColor: Colors.white,
label: 'Next', label: 'Send',
onTap: () async {
await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER);
// onTap: ()=> widget.changeCurrentTab(2), }
), ),
) )
], ],

@ -27,6 +27,14 @@ class DateUtil {
return start + "$milliseconds" + end; 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) { static String yearMonthDay(DateTime dateTime) {
String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}'; String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}';
return dateFormat; return dateFormat;

@ -681,11 +681,7 @@ class TranslationBase {
String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode];
String get loginRegister => localizedValues['LoginRegister'][locale.languageCode]; String get loginRegister => localizedValues['LoginRegister'][locale.languageCode];
String get orderLog => localizedValues['OrderLog'][locale.languageCode]; String get orderLog => localizedValues['OrderLog'][locale.languageCode];
String get serviceInformationButton => localizedValues['ServiceInformationButton'][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 serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode];
String get infoLab => localizedValues['info-lab'][locale.languageCode]; String get infoLab => localizedValues['info-lab'][locale.languageCode];
String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; String get infoRadiology => localizedValues['info-radiology'][locale.languageCode];

@ -16,7 +16,7 @@ class CloseBack extends StatelessWidget{
onTap: Feedback.wrapForTap(() { onTap: Feedback.wrapForTap(() {
onTap!=null ? onTap() : Navigator.pop(context); onTap!=null ? onTap() : Navigator.pop(context);
}, context), }, context),
child: Icon(EvaIcons.close, color: Color.fromRGBO(78, 62, 253, 1.0)), child: Icon(EvaIcons.close, color: Colors.white),
); );
} }
} }

@ -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,
),
);
}
}
Loading…
Cancel
Save