Ambulance request APIs revamped

merge-requests/381/merge
haroon amjad 5 years ago
parent ba245fdfef
commit e9ec2e2faf

@ -0,0 +1,200 @@
import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart';
class PatientER_RC {
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
bool patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
String patientID;
String tokenID;
int patientTypeID;
int patientType;
int orderServiceID;
String patientIdentificationID;
dynamic patientOutSa;
int projectID;
int lineItemNo;
TransportationDetails transportationDetails;
PatientERTransportationMethod patientERTransportationMethod;
PatientER_RC(
{this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType,
this.orderServiceID,
this.patientIdentificationID,
this.patientOutSa,
this.projectID,
this.lineItemNo,
this.transportationDetails});
PatientER_RC.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
orderServiceID = json['OrderServiceID'];
patientIdentificationID = json['PatientIdentificationID'];
patientOutSa = json['patientOutSa'];
projectID = json['projectID'];
lineItemNo = json['lineItemNo'];
transportationDetails = json['transportationDetails'] != null
? new TransportationDetails.fromJson(json['transportationDetails'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
data['OrderServiceID'] = this.orderServiceID;
data['PatientIdentificationID'] = this.patientIdentificationID;
data['patientOutSa'] = this.patientOutSa;
data['projectID'] = this.projectID;
data['lineItemNo'] = this.lineItemNo;
if (this.transportationDetails != null) {
data['transportationDetails'] = this.transportationDetails.toJson();
}
return data;
}
}
class TransportationDetails {
int direction;
int haveAppointment;
int tripType;
int pickupUrgency;
int pickupSpot;
String pickupDateTime;
String transportationType;
int ambulate;
String notes;
int requesterFileNo;
String requesterMobileNo;
bool requesterIsOutSA;
String pickupLocationName;
String dropoffLocationName;
String pickupLatitude;
String pickupLongitude;
String dropoffLatitude;
String dropoffLongitude;
String appointmentNo;
String appointmentClinicName;
String appointmentDoctorName;
String appointmentBranch;
String appointmentTime;
TransportationDetails(
{this.direction,
this.haveAppointment,
this.tripType,
this.pickupUrgency,
this.pickupSpot,
this.pickupDateTime,
this.transportationType,
this.ambulate,
this.notes,
this.requesterFileNo,
this.requesterMobileNo,
this.requesterIsOutSA,
this.pickupLocationName,
this.dropoffLocationName,
this.pickupLatitude,
this.pickupLongitude,
this.dropoffLatitude,
this.dropoffLongitude,
this.appointmentNo,
this.appointmentClinicName,
this.appointmentDoctorName,
this.appointmentBranch,
this.appointmentTime});
TransportationDetails.fromJson(Map<String, dynamic> json) {
direction = json['direction'];
haveAppointment = json['haveAppointment'];
tripType = json['tripType'];
pickupUrgency = json['pickupUrgency'];
pickupSpot = json['pickupSpot'];
pickupDateTime = json['pickupDateTime'];
transportationType = json['transportationType'];
ambulate = json['ambulate'];
notes = json['notes'];
requesterFileNo = json['requesterFileNo'];
requesterMobileNo = json['requesterMobileNo'];
requesterIsOutSA = json['requesterIsOutSA'];
pickupLocationName = json['pickupLocationName'];
dropoffLocationName = json['dropoffLocationName'];
pickupLatitude = json['pickup_Latitude'];
pickupLongitude = json['pickup_Longitude'];
dropoffLatitude = json['dropoff_Latitude'];
dropoffLongitude = json['dropoff_Longitude'];
appointmentNo = json['appointmentNo'];
appointmentClinicName = json['appointmentClinicName'];
appointmentDoctorName = json['appointmentDoctorName'];
appointmentBranch = json['appointmentBranch'];
appointmentTime = json['appointmentTime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['direction'] = this.direction;
data['haveAppointment'] = this.haveAppointment;
data['tripType'] = this.tripType;
data['pickupUrgency'] = this.pickupUrgency;
data['pickupSpot'] = this.pickupSpot;
data['pickupDateTime'] = this.pickupDateTime;
data['transportationType'] = this.transportationType;
data['ambulate'] = this.ambulate;
data['notes'] = this.notes;
data['requesterFileNo'] = this.requesterFileNo;
data['requesterMobileNo'] = this.requesterMobileNo;
data['requesterIsOutSA'] = this.requesterIsOutSA;
data['pickupLocationName'] = this.pickupLocationName;
data['dropoffLocationName'] = this.dropoffLocationName;
data['pickup_Latitude'] = this.pickupLatitude;
data['pickup_Longitude'] = this.pickupLongitude;
data['dropoff_Latitude'] = this.dropoffLatitude;
data['dropoff_Longitude'] = this.dropoffLongitude;
data['appointmentNo'] = this.appointmentNo;
data['appointmentClinicName'] = this.appointmentClinicName;
data['appointmentDoctorName'] = this.appointmentDoctorName;
data['appointmentBranch'] = this.appointmentBranch;
data['appointmentTime'] = this.appointmentTime;
return data;
}
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.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/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.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';
@ -103,14 +104,17 @@ class AmService extends BaseService {
}, body: body); }, body: body);
} }
Future insertERPressOrder({@required PatientER patientER}) async { Future insertERPressOrder({@required PatientER_RC patientER}) async {
hasError = false; hasError = false;
var body = patientER.toJson();
print(body);
await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC,
onSuccess: (dynamic response, int statusCode) {}, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: patientER.toJson()); }, body: body);
} }
} }

@ -1,6 +1,7 @@
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/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.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';
@ -95,7 +96,7 @@ class AmRequestViewModel extends BaseViewModel {
getPatientAllPresOrdersList(); getPatientAllPresOrdersList();
} }
Future insertERPressOrder({@required PatientER patientER}) async { Future insertERPressOrder({@required PatientER_RC patientER}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _amService.insertERPressOrder(patientER: patientER); await _amService.insertERPressOrder(patientER: patientER);
if (_amService.hasError) { if (_amService.hasError) {

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -29,6 +30,10 @@ class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
PageController pageController; PageController pageController;
PatientER _patientER = PatientER(); PatientER _patientER = PatientER();
PatientER_RC _patientER_RC = PatientER_RC();
TransportationDetails transportationDetails = new TransportationDetails();
_changeCurrentTab(int tab) { _changeCurrentTab(int tab) {
setState(() { setState(() {
currentIndex = tab; currentIndex = tab;
@ -41,6 +46,7 @@ class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
void initState() { void initState() {
super.initState(); super.initState();
pageController = new PageController(); pageController = new PageController();
_patientER_RC.transportationDetails = transportationDetails;
} }
@override @override
@ -143,21 +149,25 @@ class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
SelectTransportationMethod( SelectTransportationMethod(
changeCurrentTab: _changeCurrentTab, changeCurrentTab: _changeCurrentTab,
patientER: _patientER, patientER: _patientER,
patientER_RC: _patientER_RC,
amRequestViewModel: widget.amRequestViewModel, amRequestViewModel: widget.amRequestViewModel,
), ),
PickupLocation( PickupLocation(
changeCurrentTab: _changeCurrentTab, changeCurrentTab: _changeCurrentTab,
patientER: _patientER, patientER: _patientER,
patientER_RC: _patientER_RC,
amRequestViewModel: widget.amRequestViewModel, amRequestViewModel: widget.amRequestViewModel,
), ),
BillAmount( BillAmount(
changeCurrentTab: _changeCurrentTab, changeCurrentTab: _changeCurrentTab,
patientER: _patientER, patientER: _patientER,
patientER_RC: _patientER_RC,
amRequestViewModel: widget.amRequestViewModel, amRequestViewModel: widget.amRequestViewModel,
), ),
Summary( Summary(
changeCurrentTab: _changeCurrentTab, changeCurrentTab: _changeCurrentTab,
patientER: _patientER, patientER: _patientER,
patientER_RC: _patientER_RC,
amRequestViewModel: widget.amRequestViewModel, amRequestViewModel: widget.amRequestViewModel,
), ),
], ],

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/enum/Ambulate.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -9,17 +10,13 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BillAmount extends StatefulWidget { class BillAmount extends StatefulWidget {
final Function changeCurrentTab; final Function changeCurrentTab;
final PatientER patientER; final PatientER patientER;
final PatientER_RC patientER_RC;
final AmRequestViewModel amRequestViewModel; final AmRequestViewModel amRequestViewModel;
BillAmount( BillAmount({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel});
{Key key,
this.changeCurrentTab,
this.patientER,
this.amRequestViewModel});
@override @override
_BillAmountState createState() => _BillAmountState(); _BillAmountState createState() => _BillAmountState();
@ -27,23 +24,19 @@ class BillAmount extends StatefulWidget {
class _BillAmountState extends State<BillAmount> { class _BillAmountState extends State<BillAmount> {
Ambulate _ambulate = Ambulate.None; Ambulate _ambulate = Ambulate.None;
String note =""; String note = "";
@override @override
void initState() { void initState() {
// if (widget.patientER_RC.transportationDetails.ambulate != null) {
if(widget.patientER.ambulate!=null) // setState(() {
{ // _ambulate = widget.patientER.ambulate;
setState(() { // note = widget.patientER.requesterNote;
_ambulate = widget.patientER.ambulate; // });
note = widget.patientER.requesterNote; // }
});
}
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -61,9 +54,7 @@ class _BillAmountState extends State<BillAmount> {
height: 10, height: 10,
), ),
Table( Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(inside: BorderSide(width: 1.0, color: Colors.grey[300]), outside: BorderSide(width: 1.0, color: Colors.grey[300])),
inside: BorderSide(width: 1.0, color: Colors.grey[300]),
outside: BorderSide(width: 1.0, color: Colors.grey[300])),
children: [ children: [
TableRow( TableRow(
children: [ children: [
@ -96,7 +87,7 @@ class _BillAmountState extends State<BillAmount> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Texts(
TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.price}', TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}',
color: Colors.black, color: Colors.black,
textAlign: TextAlign.start, textAlign: TextAlign.start,
fontSize: 15, fontSize: 15,
@ -126,7 +117,7 @@ class _BillAmountState extends State<BillAmount> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Texts(
TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceVAT}', TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}',
color: Colors.black, color: Colors.black,
fontSize: 15, fontSize: 15,
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -167,7 +158,7 @@ class _BillAmountState extends State<BillAmount> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Texts(
TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceTotal}', TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}',
color: Colors.black, color: Colors.black,
fontSize: 15, fontSize: 15,
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -181,8 +172,13 @@ class _BillAmountState extends State<BillAmount> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Texts(TranslationBase.of(context).selectAmbulate,bold: true,), Texts(
SizedBox(height: 5,), TranslationBase.of(context).selectAmbulate,
bold: true,
),
SizedBox(
height: 5,
),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -196,8 +192,7 @@ class _BillAmountState extends State<BillAmount> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -226,8 +221,7 @@ class _BillAmountState extends State<BillAmount> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -235,7 +229,6 @@ class _BillAmountState extends State<BillAmount> {
leading: Radio( leading: Radio(
value: Ambulate.Walker, value: Ambulate.Walker,
groupValue: _ambulate, groupValue: _ambulate,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_ambulate = value; _ambulate = value;
@ -248,7 +241,9 @@ class _BillAmountState extends State<BillAmount> {
), ),
], ],
), ),
SizedBox(height: 5,), SizedBox(
height: 5,
),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -262,8 +257,7 @@ class _BillAmountState extends State<BillAmount> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -271,7 +265,6 @@ class _BillAmountState extends State<BillAmount> {
leading: Radio( leading: Radio(
value: Ambulate.Stretcher, value: Ambulate.Stretcher,
groupValue: _ambulate, groupValue: _ambulate,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_ambulate = value; _ambulate = value;
@ -293,8 +286,7 @@ class _BillAmountState extends State<BillAmount> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -302,7 +294,6 @@ class _BillAmountState extends State<BillAmount> {
leading: Radio( leading: Radio(
value: Ambulate.None, value: Ambulate.None,
groupValue: _ambulate, groupValue: _ambulate,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_ambulate = value; _ambulate = value;
@ -315,17 +306,18 @@ class _BillAmountState extends State<BillAmount> {
), ),
], ],
), ),
SizedBox(height: 12,), SizedBox(
height: 12,
),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).notes, hintText: TranslationBase.of(context).notes,
initialValue: note, initialValue: note,
onChanged: (value){ onChanged: (value) {
setState(() { setState(() {
note = value; note = value;
}); });
}, },
), ),
SizedBox( SizedBox(
height: 100, height: 100,
), ),
@ -342,9 +334,9 @@ class _BillAmountState extends State<BillAmount> {
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () {
setState(() { setState(() {
widget.patientER.ambulate = _ambulate; widget.patientER_RC.transportationDetails.ambulate = _ambulate.selectAmbulateNumber();
widget.patientER.requesterNote = note; widget.patientER_RC.transportationDetails.notes = note;
widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); // widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber();
widget.changeCurrentTab(3); widget.changeCurrentTab(3);
}); });
}, },

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
@ -28,13 +29,10 @@ enum HaveAppointment { YES, NO }
class PickupLocation extends StatefulWidget { class PickupLocation extends StatefulWidget {
final Function changeCurrentTab; final Function changeCurrentTab;
final PatientER patientER; final PatientER patientER;
final PatientER_RC patientER_RC;
final AmRequestViewModel amRequestViewModel; final AmRequestViewModel amRequestViewModel;
PickupLocation( PickupLocation({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel});
{Key key,
this.changeCurrentTab,
this.patientER,
this.amRequestViewModel});
@override @override
_PickupLocationState createState() => _PickupLocationState(); _PickupLocationState createState() => _PickupLocationState();
@ -77,7 +75,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (widget.patientER.direction == 1) if (widget.patientER_RC.transportationDetails.direction == 1)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -112,8 +110,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(child: Texts(getSelectFromMapName(context))),
child: Texts(getSelectFromMapName(context))),
Icon( Icon(
FontAwesomeIcons.mapMarkerAlt, FontAwesomeIcons.mapMarkerAlt,
size: 24, size: 24,
@ -179,8 +176,7 @@ class _PickupLocationState extends State<PickupLocation> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -213,8 +209,7 @@ class _PickupLocationState extends State<PickupLocation> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
@ -254,11 +249,9 @@ class _PickupLocationState extends State<PickupLocation> {
SizedBox( SizedBox(
height: 8, height: 8,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
confirmSelectHospitalDialog( confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals);
widget.amRequestViewModel.hospitals);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
@ -271,8 +264,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(getHospitalName( Texts(getHospitalName(TranslationBase.of(context).pickupLocation)),
TranslationBase.of(context).pickupLocation)),
Icon( Icon(
Icons.arrow_drop_down, Icons.arrow_drop_down,
size: 24, size: 24,
@ -284,7 +276,7 @@ class _PickupLocationState extends State<PickupLocation> {
), ),
], ],
), ),
if (widget.patientER.direction == 0) if (widget.patientER_RC.transportationDetails.direction == 0)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -294,8 +286,7 @@ class _PickupLocationState extends State<PickupLocation> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
confirmSelectHospitalDialog( confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals);
widget.amRequestViewModel.hospitals);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
@ -308,8 +299,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(getHospitalName( Texts(getHospitalName(TranslationBase.of(context).pickupLocation)),
TranslationBase.of(context).pickupLocation)),
Icon( Icon(
Icons.arrow_drop_down, Icons.arrow_drop_down,
size: 24, size: 24,
@ -354,8 +344,7 @@ class _PickupLocationState extends State<PickupLocation> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(child: Texts(getSelectFromMapName(context))),
child: Texts(getSelectFromMapName(context))),
Icon( Icon(
FontAwesomeIcons.mapMarkerAlt, FontAwesomeIcons.mapMarkerAlt,
size: 24, size: 24,
@ -387,77 +376,59 @@ class _PickupLocationState extends State<PickupLocation> {
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () {
if (_result == null || _selectedHospital == null) if (_result == null || _selectedHospital == null)
AppToast.showErrorToast( AppToast.showErrorToast(message: TranslationBase.of(context).selectAll);
message: TranslationBase.of(context).selectAll);
else else
setState(() { setState(() {
widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0;
if (widget.patientER.direction == 0) { if (widget.patientER_RC.transportationDetails.direction == 0) {
widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString();
widget.patientER.dropoffLocationLattitude = widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString();
_result.geometry.location.lat.toString(); widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
widget.patientER.dropoffLocationLongitude = widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
_result.geometry.location.lng.toString();
widget.patientER.pickupLocationLattitude =
_selectedHospital.latitude;
widget.patientER.pickupLocationLongitude =
_selectedHospital.longitude;
} else { } else {
widget.patientER.pickupLocationLattitude = widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
_selectedHospital.latitude; widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
widget.patientER.pickupLocationLongitude = widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString();
_selectedHospital.longitude; widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString();
widget.patientER.dropoffLocationLattitude =
_result.geometry.location.lat.toString();
widget.patientER.dropoffLocationLongitude =
_result.geometry.location.lng.toString();
} }
widget.patientER.latitude = // widget.patientER.latitude =
widget.patientER.pickupLocationLattitude; // widget.patientER.pickupLocationLattitude;
widget.patientER.longitude = // widget.patientER.longitude =
widget.patientER.pickupLocationLongitude; // widget.patientER.pickupLocationLongitude;
widget.patientER.dropoffLocationName = widget.patientER.direction == 0?_result.formattedAddress:_selectedHospital.name;
widget.patientER.createdBy = widget.patientER_RC.transportationDetails.dropoffLocationName = widget.patientER.direction == 0 ? _result.formattedAddress : _selectedHospital.name;
widget.amRequestViewModel.user.patientID; // widget.patientER_RC.crea =
widget.patientER.isOutPatient = // widget.amRequestViewModel.user.patientID;
widget.amRequestViewModel.user.outSA; widget.patientER_RC.patientOutSA = widget.amRequestViewModel.user.outSA == 0 ? true : false;
widget.patientER.patientIdentificationID = widget.patientER_RC.patientOutSa = widget.amRequestViewModel.user.outSA;
widget.amRequestViewModel.user.patientIdentificationNo;
widget.patientER.pickupDateTime = widget.patientER_RC.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo;
DateUtil.convertDateToStringLocation(DateTime.now()); widget.patientER_RC.transportationDetails.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now());
widget.patientER.pickupLocationName = widget.patientER.direction == 0?_selectedHospital.name:_result.formattedAddress; widget.patientER_RC.transportationDetails.pickupLocationName = widget.patientER.direction == 0 ? _selectedHospital.name : _result.formattedAddress;
widget.patientER.projectID = widget.patientER_RC.projectID = widget.amRequestViewModel.user.projectID;
widget.amRequestViewModel.user.projectID; widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID.toString();
widget.patientER.requesterFileNo = widget.patientER_RC.transportationDetails.requesterIsOutSA = false;
widget.amRequestViewModel.user.patientID; // widget.patientER.lineItemNo = 0;
widget.patientER.requesterIsOutSA = false; widget.patientER_RC.transportationDetails.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber;
widget.patientER.lineItemNo = 0;
widget.patientER.requesterMobileNo =
widget.amRequestViewModel.user.mobileNumber;
if (_haveAppointment == HaveAppointment.YES) { if (_haveAppointment == HaveAppointment.YES) {
widget.patientER.appointmentNo = widget.patientER_RC.transportationDetails.appointmentNo = myAppointment.appointmentNo.toString();
myAppointment.appointmentNo.toString(); widget.patientER_RC.transportationDetails.appointmentClinicName = myAppointment.clinicName;
widget.patientER.appointmentClinicName = widget.patientER_RC.transportationDetails.appointmentDoctorName = myAppointment.doctorNameObj;
myAppointment.clinicName; widget.patientER_RC.transportationDetails.appointmentBranch = myAppointment.projectName;
widget.patientER.appointmentDoctorName = widget.patientER_RC.transportationDetails.appointmentTime = myAppointment.appointmentDate;
myAppointment.doctorNameObj; widget.patientER_RC.transportationDetails.haveAppointment = 1;
widget.patientER.appointmentBranch =
myAppointment.projectName;
widget.patientER.appointmentTime =
myAppointment.appointmentDate;
widget.patientER.haveAppointment = true;
} else { } else {
widget.patientER.appointmentNo = "0"; widget.patientER_RC.transportationDetails.appointmentNo = "0";
widget.patientER.appointmentClinicName = null; widget.patientER_RC.transportationDetails.appointmentClinicName = "";
widget.patientER.appointmentDoctorName = null; widget.patientER_RC.transportationDetails.appointmentDoctorName = "";
widget.patientER.appointmentBranch = null; widget.patientER_RC.transportationDetails.appointmentBranch = "";
widget.patientER.appointmentTime = null; widget.patientER_RC.transportationDetails.appointmentTime = "";
widget.patientER.haveAppointment = false; widget.patientER_RC.transportationDetails.haveAppointment = 0;
} }
widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0;
widget.changeCurrentTab(2); widget.changeCurrentTab(2);
}); });
}, },
@ -487,27 +458,21 @@ class _PickupLocationState extends State<PickupLocation> {
} }
String getSelectFromMapName(context) { String getSelectFromMapName(context) {
return _result != null return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap;
? _result.formattedAddress
: TranslationBase.of(context).selectMap;
} }
getAppointment() { getAppointment() {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
widget.amRequestViewModel.getAppointmentHistory().then((value) { widget.amRequestViewModel.getAppointmentHistory().then((value) {
if (widget.amRequestViewModel.state == ViewState.Error || if (widget.amRequestViewModel.state == ViewState.Error || widget.amRequestViewModel.state == ViewState.ErrorLocal) {
widget.amRequestViewModel.state == ViewState.ErrorLocal) {
AppToast.showErrorToast(message: widget.amRequestViewModel.error); AppToast.showErrorToast(message: widget.amRequestViewModel.error);
} else if (widget } else if (widget.amRequestViewModel.appoitmentAllHistoryResultList.length > 0) {
.amRequestViewModel.appoitmentAllHistoryResultList.length >
0) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: AvailableAppointmentsPage( page: AvailableAppointmentsPage(
appointmentsAllHistoryList: appointmentsAllHistoryList: widget.amRequestViewModel.appoitmentAllHistoryResultList,
widget.amRequestViewModel.appoitmentAllHistoryResultList,
), ),
), ),
).then((value) { ).then((value) {
@ -527,8 +492,7 @@ class _PickupLocationState extends State<PickupLocation> {
setState(() { setState(() {
_haveAppointment = HaveAppointment.NO; _haveAppointment = HaveAppointment.NO;
}); });
AppToast.showErrorToast( AppToast.showErrorToast(message: TranslationBase.of(context).noAppointment);
message: TranslationBase.of(context).noAppointment);
} }
}).catchError((e) { }).catchError((e) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.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/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -17,23 +18,17 @@ enum Way { OneWay, TwoWays }
class SelectTransportationMethod extends StatefulWidget { class SelectTransportationMethod extends StatefulWidget {
final Function changeCurrentTab; final Function changeCurrentTab;
final PatientER patientER; final PatientER patientER;
final PatientER_RC patientER_RC;
final AmRequestViewModel amRequestViewModel; final AmRequestViewModel amRequestViewModel;
SelectTransportationMethod( SelectTransportationMethod({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel});
{Key key,
this.changeCurrentTab,
this.patientER,
this.amRequestViewModel});
@override @override
_SelectTransportationMethodState createState() => _SelectTransportationMethodState createState() => _SelectTransportationMethodState();
_SelectTransportationMethodState();
} }
class _SelectTransportationMethodState class _SelectTransportationMethodState extends State<SelectTransportationMethod> {
extends State<SelectTransportationMethod> { PatientERTransportationMethod _erTransportationMethod = PatientERTransportationMethod();
PatientERTransportationMethod _erTransportationMethod =
PatientERTransportationMethod();
Direction _direction = Direction.FromHospital; Direction _direction = Direction.FromHospital;
Way _way = Way.OneWay; Way _way = Way.OneWay;
@ -42,18 +37,23 @@ class _SelectTransportationMethodState
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.patientER.direction != null) { // if (widget.patientER.direction != null) {
_direction = widget.patientER.direction == 0 // _direction = widget.patientER.direction == 0 ? Direction.ToHospital : Direction.FromHospital;
? Direction.ToHospital // _way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays;
: Direction.FromHospital; // _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[(widget.patientER.selectedAmbulate - 1)];
_way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays; // } else {
_erTransportationMethod = widget.amRequestViewModel // if (widget.amRequestViewModel.amRequestModeList.length != 0) _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[widget.amRequestViewModel.amRequestModeList.length - 1];
.amRequestModeList[(widget.patientER.selectedAmbulate - 1)]; // }
//RC API Revamp
if (widget.patientER_RC.transportationDetails.direction != null) {
_direction = widget.patientER_RC.transportationDetails.direction == 0 ? Direction.ToHospital : Direction.FromHospital;
_way = widget.patientER_RC.transportationDetails.tripType == 1 ? Way.OneWay : Way.TwoWays;
_erTransportationMethod = widget.amRequestViewModel.amRequestModeList[(widget.patientER_RC.transportationDetails.ambulate - 1)];
} else { } else {
if (widget.amRequestViewModel.amRequestModeList.length != 0) if (widget.amRequestViewModel.amRequestModeList.length != 0) _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[widget.amRequestViewModel.amRequestModeList.length - 1];
_erTransportationMethod = widget.amRequestViewModel.amRequestModeList[
widget.amRequestViewModel.amRequestModeList.length - 1];
} }
} }
@override @override
@ -78,8 +78,7 @@ class _SelectTransportationMethodState
(index) => InkWell( (index) => InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
_erTransportationMethod = _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index];
widget.amRequestViewModel.amRequestModeList[index];
}); });
}, },
child: Container( child: Container(
@ -95,14 +94,9 @@ class _SelectTransportationMethodState
Expanded( Expanded(
flex: 3, flex: 3,
child: ListTile( child: ListTile(
title: Texts(projectViewModel.isArabic title: Texts(projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text),
? widget.amRequestViewModel
.amRequestModeList[index].textN
: widget.amRequestViewModel
.amRequestModeList[index].text),
leading: Radio( leading: Radio(
value: widget value: widget.amRequestViewModel.amRequestModeList[index],
.amRequestViewModel.amRequestModeList[index],
groupValue: _erTransportationMethod, groupValue: _erTransportationMethod,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@ -114,8 +108,7 @@ class _SelectTransportationMethodState
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: Texts(TranslationBase.of(context).sar + child: Texts(TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'),
' ${widget.amRequestViewModel.amRequestModeList[index].price}'),
) )
], ],
), ),
@ -181,8 +174,7 @@ class _SelectTransportationMethodState
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
title: title: Texts(TranslationBase.of(context).fromHospital),
Texts(TranslationBase.of(context).fromHospital),
leading: Radio( leading: Radio(
value: Direction.FromHospital, value: Direction.FromHospital,
groupValue: _direction, groupValue: _direction,
@ -211,7 +203,7 @@ class _SelectTransportationMethodState
height: 5, height: 5,
), ),
Container( Container(
margin: EdgeInsets.only(bottom:65 ), margin: EdgeInsets.only(bottom: 65),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -225,13 +217,11 @@ class _SelectTransportationMethodState
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
title: title: Texts(TranslationBase.of(context).oneDirec),
Texts(TranslationBase.of(context).oneDirec),
leading: Radio( leading: Radio(
value: Way.OneWay, value: Way.OneWay,
groupValue: _way, groupValue: _way,
@ -256,13 +246,11 @@ class _SelectTransportationMethodState
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: border: Border.all(color: Colors.grey, width: 0.5),
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white, color: Colors.white,
), ),
child: ListTile( child: ListTile(
title: title: Texts(TranslationBase.of(context).twoDirec),
Texts(TranslationBase.of(context).twoDirec),
leading: Radio( leading: Radio(
value: Way.TwoWays, value: Way.TwoWays,
groupValue: _way, groupValue: _way,
@ -300,28 +288,33 @@ class _SelectTransportationMethodState
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () {
setState(() { setState(() {
widget.patientER.transportationMethodId = (widget // widget.patientER.transportationMethodId = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
.amRequestViewModel.amRequestModeList // widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0;
.indexOf(_erTransportationMethod) + // widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1;
1); // widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
widget.patientER.direction = // widget.patientER.patientERTransportationMethod = _erTransportationMethod;
_direction == Direction.ToHospital ? 1 : 0; // widget.patientER.orderServiceID = _orderService.getIdOrderService();
widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; // widget.patientER.pickupUrgency = 1;
widget.patientER.selectedAmbulate = (widget // widget.patientER.lineItemNo = 1;
.amRequestViewModel.amRequestModeList // widget.patientER.cost = _erTransportationMethod.price.toDouble();
.indexOf(_erTransportationMethod) + // widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0;
1); // widget.patientER.totalPrice = _erTransportationMethod.priceTotal.toDouble();
widget.patientER.patientERTransportationMethod = // widget.changeCurrentTab(1);
_erTransportationMethod;
widget.patientER.orderServiceID = // widget.patientER_RC.transportationDetails.id = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
_orderService.getIdOrderService(); widget.patientER_RC.transportationDetails.direction = _direction == Direction.ToHospital ? 1 : 0;
widget.patientER.pickupUrgency = 1; widget.patientER_RC.transportationDetails.tripType = _way == Way.TwoWays ? 0 : 1;
widget.patientER.lineItemNo = 1; widget.patientER_RC.transportationDetails.ambulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1);
widget.patientER.cost = _erTransportationMethod.price.toDouble(); widget.patientER_RC.transportationDetails.transportationType = _erTransportationMethod.id.toString();
widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0; widget.patientER_RC.patientERTransportationMethod = _erTransportationMethod;
widget.patientER.totalPrice = widget.patientER_RC.transportationDetails.pickupUrgency = 1;
_erTransportationMethod.priceTotal.toDouble(); // widget.patientER.orderServiceID = _orderService.getIdOrderService();
// widget.patientER.lineItemNo = 1;
// widget.patientER.cost = _erTransportationMethod.price.toDouble();
// widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0;
// widget.patientER.totalPrice = _erTransportationMethod.priceTotal.toDouble();
widget.changeCurrentTab(1); widget.changeCurrentTab(1);
}); });
}, },
label: TranslationBase.of(context).next, label: TranslationBase.of(context).next,

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/Ambulate.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@ -6,14 +8,14 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/enum/Ambulate.dart';
class Summary extends StatefulWidget { class Summary extends StatefulWidget {
final Function changeCurrentTab; final Function changeCurrentTab;
final PatientER patientER; final PatientER patientER;
final PatientER_RC patientER_RC;
final AmRequestViewModel amRequestViewModel; final AmRequestViewModel amRequestViewModel;
Summary({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel}); Summary({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel});
@override @override
_SummaryState createState() => _SummaryState(); _SummaryState createState() => _SummaryState();
@ -32,7 +34,9 @@ class _SummaryState extends State<Summary> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts(TranslationBase.of(context).rrtSummary), Texts(TranslationBase.of(context).rrtSummary),
SizedBox(height: 5,), SizedBox(
height: 5,
),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
@ -43,54 +47,95 @@ class _SummaryState extends State<Summary> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts(TranslationBase.of(context).transportMethod,color: Colors.grey,), Texts(
Texts('${widget.patientER.patientERTransportationMethod.text}',bold: true,), TranslationBase.of(context).transportMethod,
SizedBox(height: 8,), color: Colors.grey,
),
Texts(TranslationBase.of(context).directions,color: Colors.grey,), Texts(
Texts(widget.patientER.direction ==0? TranslationBase.of(context).toHospital:TranslationBase.of(context).fromHospital,bold: true,), '${widget.patientER_RC.patientERTransportationMethod.text}',
SizedBox(height: 8,), bold: true,
),
Texts(TranslationBase.of(context).pickupLocation,color: Colors.grey,), SizedBox(
Texts('${widget.patientER.pickupLocationName}',bold: true,), height: 8,
SizedBox(height: 8,), ),
Texts(
Texts(TranslationBase.of(context).dropoffLocation,color: Colors.grey,), TranslationBase.of(context).directions,
Texts('${widget.patientER.dropoffLocationName}',bold: true,), color: Colors.grey,
SizedBox(height: 8,), ),
Texts(
Texts(TranslationBase.of(context).selectAmbulate,color: Colors.grey,), widget.patientER_RC.transportationDetails.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital,
Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), bold: true,
SizedBox(height: 8,), ),
SizedBox(
Texts(TranslationBase.of(context).notes,color: Colors.grey,), height: 8,
Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), ),
SizedBox(height: 8,), Texts(
TranslationBase.of(context).pickupLocation,
color: Colors.grey,
),
Texts(
'${widget.patientER_RC.transportationDetails.pickupLocationName}',
bold: true,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context).dropoffLocation,
color: Colors.grey,
),
Texts(
'${widget.patientER_RC.transportationDetails.dropoffLocationName}',
bold: true,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context).selectAmbulate,
color: Colors.grey,
),
Texts(
'${widget.patientER_RC.transportationDetails.ambulate}',
bold: true,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context).notes,
color: Colors.grey,
),
Texts(
'${widget.patientER_RC.transportationDetails.notes ?? '---'}',
bold: true,
),
SizedBox(
height: 8,
),
], ],
), ),
), ),
SizedBox(height: 20,), SizedBox(
Texts(TranslationBase.of(context).billAmount,textAlign: TextAlign.start,), height: 20,
SizedBox(height: 5,), ),
Texts(
TranslationBase.of(context).billAmount,
textAlign: TextAlign.start,
),
SizedBox(
height: 5,
),
Container( Container(
height: 55, height: 55,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
decoration: BoxDecoration( decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
color: Colors.white,
borderRadius: BorderRadius.circular(8)
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [Texts(TranslationBase.of(context).patientShareTotal + ':'), Texts(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}')],
Texts(TranslationBase.of(context).patientShareTotal+':'),
Texts(TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceTotal}')
],
), ),
), ),
SizedBox(height: 130), SizedBox(height: 130),
], ],
), ),
), ),
@ -99,15 +144,13 @@ class _SummaryState extends State<Summary> {
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
width: double.maxFinite, width: double.maxFinite,
height: 90, height: 90,
child:SecondaryButton( child: SecondaryButton(
color: Colors.grey[800], color: Colors.grey[800],
textColor: Colors.white, textColor: Colors.white,
label: TranslationBase.of(context).send, label: TranslationBase.of(context).send,
onTap: () async { onTap: () async {
await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC);
}),
}
),
), ),
); );
} }

Loading…
Cancel
Save