Ambulance Service first step

er_location
Mohammad Aljammal 4 years ago
parent 0d12210116
commit 3d6eafe473

@ -1,21 +1,21 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class PatientERTransportationMethod {
int id;
dynamic id;
DateTime createDate;
DateTime lastEditDate;
int createdBy;
int lastEditBy;
dynamic createdBy;
dynamic lastEditBy;
bool isActive;
String title;
String titleAR;
int price;
dynamic price;
dynamic isDefault;
int visibility;
dynamic visibility;
dynamic durationId;
String description;
String descriptionAR;
int totalPrice;
int vAT;
dynamic totalPrice;
dynamic vAT;
PatientERTransportationMethod(
{

@ -16,14 +16,13 @@ class AmService extends BaseService {
await baseAppClient.post(GET_AMBULANCE_REQUEST,
onSuccess: (dynamic response, int statusCode) {
amModelList.clear();
response['AmModelList'].forEach((vital) {
amModelList.add(
PatientERTransportationMethod.fromJson(vital));
response['PatientER_RRT_GetAllTransportationMethodList'].forEach((vital) {
amModelList.add(PatientERTransportationMethod.fromJson(vital));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: Map());
}, body: body);
}
Future getPatientAllPresOrdersList() async {

@ -56,6 +56,7 @@ class _AmbulanceRequestIndexState extends State<AmbulanceRequestIndex> {
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: <Widget>[
//Container(),
SelectTransportationMethod(
changeCurrentTab: _changeCurrentTab,
patientER: _patientER,

@ -4,11 +4,20 @@ import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
enum HaveAppointment { YES, NO }
class PickupLocation extends StatefulWidget {
final Function changeCurrentTab;
final PatientER patientER;
PickupLocation({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel});
PickupLocation(
{Key key,
this.changeCurrentTab,
this.patientER,
this.amRequestViewModel});
final AmRequestViewModel amRequestViewModel;
@override
@ -16,24 +25,258 @@ class PickupLocation extends StatefulWidget {
}
class _PickupLocationState extends State<PickupLocation> {
bool _isInsideHome = false;
HaveAppointment _haveAppointment = HaveAppointment.NO;
@override
Widget build(BuildContext context) {
return Column(
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.only(left: 12, right: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.patientER.direction == 1)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('Pickup Location'),
SizedBox(
height: 15,
),
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts('Select From Map'),
Icon(
FontAwesomeIcons.mapMarkerAlt,
size: 24,
color: Colors.black,
)
],
),
),
SizedBox(
height: 12,
),
Texts('Pickup Spot'),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
setState(() {
_isInsideHome = !_isInsideHome;
});
},
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: ListTile(
title: Texts('Inside Home'),
leading: Checkbox(
activeColor: Colors.red[800],
value: _isInsideHome,
onChanged: (value) {
setState(() {
_isInsideHome = value;
});
},
),
),
),
),
SizedBox(
height: 12,
),
Texts('Do you have an appointment ?'),
SizedBox(
height: 5,
),
Row(
children: [
Expanded(
child: InkWell(
onTap: () {
setState(() {
_haveAppointment = HaveAppointment.YES;
});
},
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border:
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: ListTile(
title: Text('Yes'),
leading: Radio(
value: HaveAppointment.YES,
groupValue: _haveAppointment,
activeColor: Colors.red[800],
onChanged: (value) {
setState(() {
_haveAppointment = value;
});
},
),
),
),
),
),
Expanded(
child: InkWell(
onTap: () {
setState(() {
_haveAppointment = HaveAppointment.NO;
});
},
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border:
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: ListTile(
title: Text('No'),
leading: Radio(
value: HaveAppointment.NO,
groupValue: _haveAppointment,
activeColor: Colors.red[800],
onChanged: (value) {
setState(() {
_haveAppointment = value;
});
},
),
),
),
),
),
],
),
SizedBox(
height: 12,
),
Texts('Drop off Location'),
SizedBox(
height: 8,
),
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('Pickup Location'),
Icon(
Icons.arrow_drop_down,
size: 24,
color: Colors.black,
)
],
),
),
],
),
if (widget.patientER.direction == 2)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('Pickup Location'),
SizedBox(
height: 15,
),
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts('Pickup Location'),
Icon(
Icons.arrow_drop_down,
size: 24,
color: Colors.black,
)
],
),
),
SizedBox(
height: 12,
),
Texts('Drop off Location'),
SizedBox(
height: 8,
),
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('PickupLocation 2'),
SizedBox(height: 45,),
Texts('Select From Map'),
Icon(
FontAwesomeIcons.mapMarkerAlt,
size: 24,
color: Colors.black,
)
],
),
),
],
),
//TODO show dialog projects
SizedBox(
height: 45,
),
Container(
padding: EdgeInsets.all(15),
width: double.maxFinite,
height: 76,
child:SecondaryButton(
child: SecondaryButton(
color: Colors.grey[800],
textColor: Colors.white,
onTap: ()=> widget.changeCurrentTab(2),
onTap: () => widget.changeCurrentTab(2),
label: 'Next',
),
)
],
),
),
);
}
}

@ -32,9 +32,24 @@ class _SelectTransportationMethodState
Direction _direction = Direction.FromHospital;
Way _way = Way.OneWay;
@override
void initState() {
super.initState();
if (widget.patientER.direction != null) {
_direction = widget.patientER.direction == 1
? Direction.ToHospital
: Direction.FromHospital;
_way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays;
_erTransportationMethod = widget.amRequestViewModel
.amRequestModeList[(widget.patientER.selectedAmbulate - 1)];
}
}
@override
Widget build(BuildContext context) {
return Container(
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.only(left: 12, right: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -53,6 +68,7 @@ class _SelectTransportationMethodState
});
},
child: Container(
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
@ -64,8 +80,8 @@ class _SelectTransportationMethodState
Expanded(
flex: 3,
child: ListTile(
title: Text(widget
.amRequestViewModel.amRequestModeList[index].title),
title: Text(widget.amRequestViewModel
.amRequestModeList[index].title),
leading: Radio(
value: widget
.amRequestViewModel.amRequestModeList[index],
@ -96,7 +112,11 @@ class _SelectTransportationMethodState
SizedBox(
height: 5,
),
Row(
Container(
width: double.maxFinite,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: InkWell(
@ -106,15 +126,14 @@ class _SelectTransportationMethodState
});
},
child: Container(
width: double.maxFinite,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
children: [
ListTile(
child: ListTile(
title: Text('To Hospital'),
leading: Radio(
value: Direction.ToHospital,
@ -127,8 +146,6 @@ class _SelectTransportationMethodState
},
),
),
],
),
),
),
),
@ -140,16 +157,15 @@ class _SelectTransportationMethodState
});
},
child: Container(
width: double.maxFinite,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
children: [
ListTile(
title: Text('To Hospital'),
child: ListTile(
title: Text('Form Hospital'),
leading: Radio(
value: Direction.FromHospital,
groupValue: _direction,
@ -161,16 +177,19 @@ class _SelectTransportationMethodState
},
),
),
],
),
),
),
),
],
),
),
if (_direction == Direction.ToHospital)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 8,
),
Texts('Select Direction'),
SizedBox(
height: 5,
@ -188,12 +207,11 @@ class _SelectTransportationMethodState
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
border:
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
children: [
ListTile(
child: ListTile(
title: Text('One Way'),
leading: Radio(
value: Way.OneWay,
@ -206,8 +224,6 @@ class _SelectTransportationMethodState
},
),
),
],
),
),
),
),
@ -222,12 +238,11 @@ class _SelectTransportationMethodState
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 0.5),
border:
Border.all(color: Colors.grey, width: 0.5),
color: Colors.white,
),
child: Row(
children: [
ListTile(
child: ListTile(
title: Text('Two Ways'),
leading: Radio(
value: Way.TwoWays,
@ -240,8 +255,6 @@ class _SelectTransportationMethodState
},
),
),
],
),
),
),
),
@ -261,9 +274,13 @@ class _SelectTransportationMethodState
textColor: Colors.white,
onTap: () {
setState(() {
widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 2;
widget.patientER.tripType = _way == Way.TwoWays ? 1 : 2;
widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod)+1);
widget.patientER.direction =
_direction == Direction.ToHospital ? 1 : 2;
widget.patientER.tripType = _way == Way.TwoWays ? 2 : 1;
widget.patientER.selectedAmbulate = (widget
.amRequestViewModel.amRequestModeList
.indexOf(_erTransportationMethod) +
1);
widget.changeCurrentTab(1);
});
},
@ -272,6 +289,7 @@ class _SelectTransportationMethodState
)
],
),
),
);
}
}

Loading…
Cancel
Save