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'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class PatientERTransportationMethod { class PatientERTransportationMethod {
int id; dynamic id;
DateTime createDate; DateTime createDate;
DateTime lastEditDate; DateTime lastEditDate;
int createdBy; dynamic createdBy;
int lastEditBy; dynamic lastEditBy;
bool isActive; bool isActive;
String title; String title;
String titleAR; String titleAR;
int price; dynamic price;
dynamic isDefault; dynamic isDefault;
int visibility; dynamic visibility;
dynamic durationId; dynamic durationId;
String description; String description;
String descriptionAR; String descriptionAR;
int totalPrice; dynamic totalPrice;
int vAT; dynamic vAT;
PatientERTransportationMethod( PatientERTransportationMethod(
{ {

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

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

@ -4,11 +4,20 @@ 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/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
enum HaveAppointment { YES, NO }
class PickupLocation extends StatefulWidget { class PickupLocation extends StatefulWidget {
final Function changeCurrentTab; final Function changeCurrentTab;
final PatientER patientER; final PatientER patientER;
PickupLocation({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel});
PickupLocation(
{Key key,
this.changeCurrentTab,
this.patientER,
this.amRequestViewModel});
final AmRequestViewModel amRequestViewModel; final AmRequestViewModel amRequestViewModel;
@override @override
@ -16,24 +25,258 @@ class PickupLocation extends StatefulWidget {
} }
class _PickupLocationState extends State<PickupLocation> { class _PickupLocationState extends State<PickupLocation> {
bool _isInsideHome = false;
HaveAppointment _haveAppointment = HaveAppointment.NO;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return SingleChildScrollView(
children: [ physics: BouncingScrollPhysics(),
Texts('PickupLocation 2'), child: Container(
SizedBox(height: 45,), margin: EdgeInsets.only(left: 12, right: 12),
Container( child: Column(
padding: EdgeInsets.all(15), crossAxisAlignment: CrossAxisAlignment.start,
width: double.maxFinite, children: [
height: 76, if (widget.patientER.direction == 1)
child:SecondaryButton( Column(
color: Colors.grey[800], crossAxisAlignment: CrossAxisAlignment.start,
textColor: Colors.white, children: [
onTap: ()=> widget.changeCurrentTab(2), Texts('Pickup Location'),
label: 'Next', 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('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(
color: Colors.grey[800],
textColor: Colors.white,
onTap: () => widget.changeCurrentTab(2),
label: 'Next',
),
)
],
),
),
); );
} }
} }

@ -32,89 +32,108 @@ class _SelectTransportationMethodState
Direction _direction = Direction.FromHospital; Direction _direction = Direction.FromHospital;
Way _way = Way.OneWay; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return SingleChildScrollView(
margin: EdgeInsets.only(left: 12, right: 12), physics: BouncingScrollPhysics(),
child: Column( child: Container(
crossAxisAlignment: CrossAxisAlignment.start, margin: EdgeInsets.only(left: 12, right: 12),
children: [ child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.start,
height: 12, children: [
), SizedBox(
Texts('Select Transportation Method'), height: 12,
...List.generate( ),
widget.amRequestViewModel.amRequestModeList.length, Texts('Select Transportation Method'),
(index) => InkWell( ...List.generate(
onTap: () { widget.amRequestViewModel.amRequestModeList.length,
setState(() { (index) => InkWell(
_erTransportationMethod = onTap: () {
widget.amRequestViewModel.amRequestModeList[index]; setState(() {
}); _erTransportationMethod =
}, widget.amRequestViewModel.amRequestModeList[index];
child: Container( });
decoration: BoxDecoration( },
shape: BoxShape.rectangle, child: Container(
borderRadius: BorderRadius.circular(8), margin: EdgeInsets.all(5),
border: Border.all(color: Colors.grey, width: 0.5), decoration: BoxDecoration(
color: Colors.white, shape: BoxShape.rectangle,
), borderRadius: BorderRadius.circular(8),
child: Row( border: Border.all(color: Colors.grey, width: 0.5),
children: [ color: Colors.white,
Expanded( ),
flex: 3, child: Row(
child: ListTile( children: [
title: Text(widget Expanded(
.amRequestViewModel.amRequestModeList[index].title), flex: 3,
leading: Radio( child: ListTile(
value: widget title: Text(widget.amRequestViewModel
.amRequestViewModel.amRequestModeList[index], .amRequestModeList[index].title),
groupValue: _erTransportationMethod, leading: Radio(
activeColor: Colors.red[800], value: widget
onChanged: (value) { .amRequestViewModel.amRequestModeList[index],
setState(() { groupValue: _erTransportationMethod,
_erTransportationMethod = value; activeColor: Colors.red[800],
}); onChanged: (value) {
}, setState(() {
_erTransportationMethod = value;
});
},
),
), ),
), ),
), Expanded(
Expanded( flex: 1,
flex: 1, child: Texts(
child: Texts( 'SR ${widget.amRequestViewModel.amRequestModeList[index].price}'),
'SR ${widget.amRequestViewModel.amRequestModeList[index].price}'), )
) ],
], ),
), ),
), ),
), ),
), SizedBox(
SizedBox( height: 12,
height: 12, ),
), Texts('Select Direction'),
Texts('Select Direction'), SizedBox(
SizedBox( height: 5,
height: 5, ),
), Container(
Row( width: double.maxFinite,
children: [ child: Row(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: InkWell( mainAxisAlignment: MainAxisAlignment.start,
onTap: () { children: [
setState(() { Expanded(
_direction = Direction.ToHospital; child: InkWell(
}); onTap: () {
}, setState(() {
child: Container( _direction = Direction.ToHospital;
decoration: BoxDecoration( });
shape: BoxShape.rectangle, },
borderRadius: BorderRadius.circular(8), child: Container(
border: Border.all(color: Colors.grey, width: 0.5), width: double.maxFinite,
color: Colors.white, decoration: BoxDecoration(
), shape: BoxShape.rectangle,
child: Row( borderRadius: BorderRadius.circular(8),
children: [ border: Border.all(color: Colors.grey, width: 0.5),
ListTile( color: Colors.white,
),
child: ListTile(
title: Text('To Hospital'), title: Text('To Hospital'),
leading: Radio( leading: Radio(
value: Direction.ToHospital, value: Direction.ToHospital,
@ -127,29 +146,26 @@ class _SelectTransportationMethodState
}, },
), ),
), ),
], ),
), ),
), ),
), Expanded(
), child: InkWell(
Expanded( onTap: () {
child: InkWell( setState(() {
onTap: () { _direction = Direction.FromHospital;
setState(() { });
_direction = Direction.FromHospital; },
}); child: Container(
}, width: double.maxFinite,
child: Container( decoration: BoxDecoration(
decoration: BoxDecoration( shape: BoxShape.rectangle,
shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8),
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,
color: Colors.white, ),
), child: ListTile(
child: Row( title: Text('Form Hospital'),
children: [
ListTile(
title: Text('To Hospital'),
leading: Radio( leading: Radio(
value: Direction.FromHospital, value: Direction.FromHospital,
groupValue: _direction, groupValue: _direction,
@ -161,116 +177,118 @@ class _SelectTransportationMethodState
}, },
), ),
), ),
], ),
), ),
), ),
), ],
), ),
], ),
), if (_direction == Direction.ToHospital)
if (_direction == Direction.ToHospital) Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts('Select Direction'), SizedBox(
SizedBox( height: 8,
height: 5, ),
), Texts('Select Direction'),
Row( SizedBox(
children: [ height: 5,
Expanded( ),
child: InkWell( Row(
onTap: () { children: [
setState(() { Expanded(
_way = Way.OneWay; child: InkWell(
}); onTap: () {
}, setState(() {
child: Container( _way = Way.OneWay;
decoration: BoxDecoration( });
shape: BoxShape.rectangle, },
borderRadius: BorderRadius.circular(8), child: Container(
border: Border.all(color: Colors.grey, width: 0.5), decoration: BoxDecoration(
color: Colors.white, shape: BoxShape.rectangle,
), borderRadius: BorderRadius.circular(8),
child: Row( border:
children: [ Border.all(color: Colors.grey, width: 0.5),
ListTile( color: Colors.white,
title: Text('One Way'), ),
leading: Radio( child: ListTile(
value: Way.OneWay, title: Text('One Way'),
groupValue: _way, leading: Radio(
activeColor: Colors.red[800], value: Way.OneWay,
onChanged: (value) { groupValue: _way,
setState(() { activeColor: Colors.red[800],
_way = value; onChanged: (value) {
}); setState(() {
}, _way = value;
), });
},
), ),
], ),
), ),
), ),
), ),
), Expanded(
Expanded( child: InkWell(
child: InkWell( onTap: () {
onTap: () { setState(() {
setState(() { _way = Way.TwoWays;
_way = Way.TwoWays; });
}); },
}, child: Container(
child: Container( 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: Row( child: ListTile(
children: [ title: Text('Two Ways'),
ListTile( leading: Radio(
title: Text('Two Ways'), value: Way.TwoWays,
leading: Radio( groupValue: _way,
value: Way.TwoWays, activeColor: Colors.red[800],
groupValue: _way, onChanged: (value) {
activeColor: Colors.red[800], setState(() {
onChanged: (value) { _way = value;
setState(() { });
_way = value; },
});
},
),
), ),
], ),
), ),
), ),
), ),
), ],
], ),
), ],
], ),
), SizedBox(
SizedBox( height: 15,
height: 15,
),
Container(
padding: EdgeInsets.all(15),
width: double.maxFinite,
height: 76,
child: SecondaryButton(
color: Colors.grey[800],
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.changeCurrentTab(1);
});
},
label: 'Next',
), ),
) Container(
], padding: EdgeInsets.all(15),
width: double.maxFinite,
height: 76,
child: SecondaryButton(
color: Colors.grey[800],
textColor: Colors.white,
onTap: () {
setState(() {
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);
});
},
label: 'Next',
),
)
],
),
), ),
); );
} }

Loading…
Cancel
Save