|
|
|
|
@ -6,7 +6,6 @@ import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.da
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/ambulanceRequest/locationDetails.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
@ -14,13 +13,13 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/location_util.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../AvailableAppointmentsPage.dart';
|
|
|
|
|
@ -42,6 +41,7 @@ class PickupLocation extends StatefulWidget {
|
|
|
|
|
class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
bool _isInsideHome = false;
|
|
|
|
|
HaveAppointment _haveAppointment = HaveAppointment.NO;
|
|
|
|
|
|
|
|
|
|
// double _latitude;
|
|
|
|
|
// double _longitude;
|
|
|
|
|
AppoitmentAllHistoryResultList myAppointment;
|
|
|
|
|
@ -284,66 +284,77 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
AppointmentCard(
|
|
|
|
|
appointment: myAppointment,
|
|
|
|
|
)
|
|
|
|
|
DoctorCard(
|
|
|
|
|
isInOutPatient: myAppointment.isInOutPatient,
|
|
|
|
|
name: myAppointment.doctorTitle + " " + myAppointment.doctorNameObj,
|
|
|
|
|
profileUrl: myAppointment.doctorImageURL,
|
|
|
|
|
subName: myAppointment.clinicName,
|
|
|
|
|
isLiveCareAppointment: myAppointment.isLiveCareAppointment,
|
|
|
|
|
date: DateUtil.convertStringToDate(myAppointment.appointmentDate),
|
|
|
|
|
isSortByClinic: false,
|
|
|
|
|
rating: myAppointment.actualDoctorRate + 0.0,
|
|
|
|
|
appointmentTime: myAppointment.isLiveCareAppointment
|
|
|
|
|
? DateUtil.convertStringToDate(myAppointment.appointmentDate).toString().split(" ")[1].substring(0, 5)
|
|
|
|
|
: myAppointment.startTime.substring(0, 5),
|
|
|
|
|
remainingTimeInMinutes: null),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
|
|
|
|
|
if (_haveAppointment == HaveAppointment.NO) Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
if (_haveAppointment == HaveAppointment.NO)
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectHospital,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectHospital,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
getHospitalName(""),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
Text(
|
|
|
|
|
getHospitalName(""),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Icon(Icons.arrow_drop_down),
|
|
|
|
|
],
|
|
|
|
|
Icon(Icons.arrow_drop_down),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (widget.patientER_RC.transportationDetails.direction == 1)
|
|
|
|
|
@ -492,8 +503,6 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
padding: EdgeInsets.all(12.0),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
// color: Colors.grey[800],
|
|
|
|
|
// textColor: Colors.white,
|
|
|
|
|
TranslationBase.of(context).next,
|
|
|
|
|
() {
|
|
|
|
|
if (_result == null || _selectedHospital == null)
|
|
|
|
|
@ -501,29 +510,21 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
else
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0;
|
|
|
|
|
if (widget.patientER_RC.transportationDetails.direction == 0) { // To Hospital
|
|
|
|
|
if (widget.patientER_RC.transportationDetails.direction == 0) {
|
|
|
|
|
// To Hospital
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLatitude = _result.lat.toStringAsFixed(6);
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLongitude = _result.long.toStringAsFixed(6);
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
|
|
|
|
|
} else { // From Hospital
|
|
|
|
|
} else {
|
|
|
|
|
// From Hospital
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLatitude = _result.lat.toStringAsFixed(6);
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLongitude = _result.long.toStringAsFixed(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// widget.patientER.latitude =
|
|
|
|
|
// widget.patientER.pickupLocationLattitude;
|
|
|
|
|
// widget.patientER.longitude =
|
|
|
|
|
// widget.patientER.pickupLocationLongitude;
|
|
|
|
|
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLocationName = widget.patientER_RC.transportationDetails.direction == 1 ? _result.formattedAddress : _selectedHospital.name;
|
|
|
|
|
// widget.patientER_RC.crea =
|
|
|
|
|
// widget.amRequestViewModel.user.patientID;
|
|
|
|
|
|
|
|
|
|
// widget.patientER_RC.patientOutSA = widget.amRequestViewModel.user.outSA == 0 ? false : true;
|
|
|
|
|
// widget.patientER_RC.patientOutSa = widget.amRequestViewModel.user.outSA;
|
|
|
|
|
|
|
|
|
|
widget.patientER_RC.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo;
|
|
|
|
|
widget.patientER_RC.transportationDetails.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now());
|
|
|
|
|
@ -531,7 +532,6 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
widget.patientER_RC.projectID = widget.amRequestViewModel.user.projectID;
|
|
|
|
|
widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID;
|
|
|
|
|
widget.patientER_RC.transportationDetails.requesterIsOutSA = false;
|
|
|
|
|
// widget.patientER.lineItemNo = 0;
|
|
|
|
|
widget.patientER_RC.transportationDetails.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber;
|
|
|
|
|
widget.patientER_RC.transportationDetails.requesterFileNo = widget.amRequestViewModel.user.patientID;
|
|
|
|
|
|
|
|
|
|
@ -542,6 +542,9 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
widget.patientER_RC.transportationDetails.appointmentBranch = myAppointment.projectName;
|
|
|
|
|
widget.patientER_RC.transportationDetails.appointmentTime = myAppointment.appointmentDate;
|
|
|
|
|
widget.patientER_RC.transportationDetails.haveAppointment = 1;
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLatitude = myAppointment.latitude;
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLongitude = myAppointment.longitude;
|
|
|
|
|
widget.patientER_RC.transportationDetails.dropoffLocationName = myAppointment.projectName;
|
|
|
|
|
} else {
|
|
|
|
|
widget.patientER_RC.transportationDetails.appointmentNo = "0";
|
|
|
|
|
widget.patientER_RC.transportationDetails.appointmentClinicName = "";
|
|
|
|
|
@ -555,7 +558,6 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
widget.changeCurrentTab(2);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// label: TranslationBase.of(context).next,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -608,6 +610,13 @@ class _PickupLocationState extends State<PickupLocation> {
|
|
|
|
|
if (value != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
myAppointment = value;
|
|
|
|
|
HospitalsModel hospitalsModel = HospitalsModel();
|
|
|
|
|
hospitalsModel.name = myAppointment.projectName;
|
|
|
|
|
hospitalsModel.iD = myAppointment.projectID;
|
|
|
|
|
hospitalsModel.mainProjectID = myAppointment.projectID;
|
|
|
|
|
hospitalsModel.latitude = myAppointment.latitude;
|
|
|
|
|
hospitalsModel.longitude = myAppointment.longitude;
|
|
|
|
|
_selectedHospital = hospitalsModel;
|
|
|
|
|
});
|
|
|
|
|
else {
|
|
|
|
|
ProgressDialogUtil.hideProgressDialog(context);
|
|
|
|
|
|