new home health service
parent
9126934ef4
commit
d0ed776ff6
@ -0,0 +1,165 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class NewCMCStepThreePage extends StatefulWidget {
|
||||
final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel;
|
||||
final Function changePageViewIndex;
|
||||
final CMCViewModel model;
|
||||
|
||||
NewCMCStepThreePage(
|
||||
{Key key,
|
||||
this.changePageViewIndex,
|
||||
this.model,
|
||||
this.cmcInsertPresOrderRequestModel});
|
||||
|
||||
@override
|
||||
_NewCMCStepThreePageState createState() =>
|
||||
_NewCMCStepThreePageState();
|
||||
}
|
||||
|
||||
class _NewCMCStepThreePageState
|
||||
extends State<NewCMCStepThreePage> {
|
||||
Completer<GoogleMapController> _controller = Completer();
|
||||
|
||||
static CameraPosition _kGooglePlex = CameraPosition(
|
||||
target: LatLng(37.42796133580664, -122.085749655962),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
final Set<Marker> markers = new Set();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.cmcInsertPresOrderRequestModel.latitude != null) {
|
||||
markers.clear();
|
||||
markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(
|
||||
widget.cmcInsertPresOrderRequestModel.latitude.hashCode
|
||||
.toString(),
|
||||
),
|
||||
position: LatLng(
|
||||
widget.cmcInsertPresOrderRequestModel.latitude,
|
||||
widget.cmcInsertPresOrderRequestModel.longitude)),
|
||||
);
|
||||
_kGooglePlex = CameraPosition(
|
||||
target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude,
|
||||
widget.cmcInsertPresOrderRequestModel.longitude),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowDecPage: false,
|
||||
baseViewModel: widget.model,
|
||||
body: SingleChildScrollView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Container(
|
||||
height: 400,
|
||||
width: double.maxFinite,
|
||||
margin: EdgeInsets.only(left: 12, right: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Order Details'),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Location :'),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
height: 200,
|
||||
child: GoogleMap(
|
||||
mapType: MapType.normal,
|
||||
markers: markers,
|
||||
initialCameraPosition: _kGooglePlex,
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
_controller.complete(controller);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Texts('Selected Service :'),
|
||||
...List.generate(
|
||||
widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList.length,
|
||||
(index) => Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
'Service Name :',
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
widget
|
||||
.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index]
|
||||
.selectedServiceName,
|
||||
fontSize: 15,
|
||||
bold: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.10,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: SecondaryButton(
|
||||
label: "Confirm",
|
||||
onTap: () async {
|
||||
await widget.model.insertPresPresOrder(order: widget.cmcInsertPresOrderRequestModel);
|
||||
if (widget.model.state != ViewState.ErrorLocal) {
|
||||
widget.changePageViewIndex(0);
|
||||
}
|
||||
},
|
||||
textColor: Theme.of(context).backgroundColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.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/app_scaffold_widget.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 NewCMCStepTowPage extends StatefulWidget {
|
||||
final Function(PickResult) onPick;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel;
|
||||
final Function changePageViewIndex;
|
||||
final CMCViewModel model;
|
||||
|
||||
const NewCMCStepTowPage(
|
||||
{Key key,
|
||||
this.onPick,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.cmcInsertPresOrderRequestModel,
|
||||
this.changePageViewIndex,
|
||||
this.model})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_NewCMCStepTowPageState createState() =>
|
||||
_NewCMCStepTowPageState();
|
||||
}
|
||||
|
||||
class _NewCMCStepTowPageState
|
||||
extends State<NewCMCStepTowPage> {
|
||||
double latitude = 0;
|
||||
double longitude = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.cmcInsertPresOrderRequestModel.latitude == null) {
|
||||
latitude = widget.latitude;
|
||||
longitude = widget.longitude;
|
||||
} else {
|
||||
latitude = widget.cmcInsertPresOrderRequestModel.latitude;
|
||||
longitude = widget.cmcInsertPresOrderRequestModel.longitude;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return AppScaffold(
|
||||
isShowDecPage: false,
|
||||
body: PlacePicker(
|
||||
apiKey: GOOGLE_API_KEY,
|
||||
enableMyLocationButton: true,
|
||||
automaticallyImplyAppBarLeading: false,
|
||||
autocompleteOnTrailingWhitespace: true,
|
||||
selectInitialPosition: true,
|
||||
autocompleteLanguage: projectViewModel.currentLanguage,
|
||||
enableMapTypeButton: true,
|
||||
onPlacePicked: (PickResult result) {
|
||||
print(result.adrAddress);
|
||||
widget.changePageViewIndex(3);
|
||||
},
|
||||
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: () {
|
||||
setState(() {
|
||||
widget.cmcInsertPresOrderRequestModel
|
||||
.latitude =
|
||||
selectedPlace.geometry.location.lat;
|
||||
widget.cmcInsertPresOrderRequestModel
|
||||
.longitude =
|
||||
selectedPlace.geometry.location.lng;
|
||||
});
|
||||
widget.changePageViewIndex(3);
|
||||
},
|
||||
label: TranslationBase.of(context).next,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
initialPosition: LatLng(latitude, longitude),
|
||||
useCurrentLocation: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class NewHomeHealthCareStepThreePage extends StatefulWidget {
|
||||
final PatientERInsertPresOrderRequestModel
|
||||
patientERInsertPresOrderRequestModel;
|
||||
final Function changePageViewIndex;
|
||||
final HomeHealthCareViewModel model;
|
||||
|
||||
NewHomeHealthCareStepThreePage(
|
||||
{Key key,
|
||||
this.patientERInsertPresOrderRequestModel,
|
||||
this.changePageViewIndex,
|
||||
this.model});
|
||||
|
||||
@override
|
||||
_NewHomeHealthCareStepThreePageState createState() =>
|
||||
_NewHomeHealthCareStepThreePageState();
|
||||
}
|
||||
|
||||
class _NewHomeHealthCareStepThreePageState
|
||||
extends State<NewHomeHealthCareStepThreePage> {
|
||||
Completer<GoogleMapController> _controller = Completer();
|
||||
|
||||
static CameraPosition _kGooglePlex = CameraPosition(
|
||||
target: LatLng(37.42796133580664, -122.085749655962),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
final Set<Marker> markers = new Set();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.patientERInsertPresOrderRequestModel.latitude != null) {
|
||||
markers.clear();
|
||||
markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(
|
||||
widget.patientERInsertPresOrderRequestModel.latitude.hashCode
|
||||
.toString(),
|
||||
),
|
||||
position: LatLng(
|
||||
widget.patientERInsertPresOrderRequestModel.latitude,
|
||||
widget.patientERInsertPresOrderRequestModel.longitude)),
|
||||
);
|
||||
_kGooglePlex = CameraPosition(
|
||||
target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude,
|
||||
widget.patientERInsertPresOrderRequestModel.longitude),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowDecPage: false,
|
||||
baseViewModel: widget.model,
|
||||
body: SingleChildScrollView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
margin: EdgeInsets.only(left: 12, right: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Order Details'),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Location :'),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
height: 200,
|
||||
child: GoogleMap(
|
||||
mapType: MapType.normal,
|
||||
markers: markers,
|
||||
initialCameraPosition: _kGooglePlex,
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
_controller.complete(controller);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Texts('Selected Service :'),
|
||||
...List.generate(
|
||||
widget.patientERInsertPresOrderRequestModel
|
||||
.patientERHHCInsertServicesList.length,
|
||||
(index) => Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
'Service Name :',
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
widget
|
||||
.patientERInsertPresOrderRequestModel
|
||||
.patientERHHCInsertServicesList[index]
|
||||
.serviceName,
|
||||
fontSize: 15,
|
||||
bold: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 57,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.10,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: SecondaryButton(
|
||||
label: "Confirm",
|
||||
disabled: widget.patientERInsertPresOrderRequestModel
|
||||
.patientERHHCInsertServicesList.length ==
|
||||
0,
|
||||
onTap: () async {
|
||||
await widget.model.insertPresPresOrder(
|
||||
order: widget.patientERInsertPresOrderRequestModel);
|
||||
if (widget.model.state != ViewState.ErrorLocal) {
|
||||
widget.changePageViewIndex(0);
|
||||
}
|
||||
},
|
||||
textColor: Theme.of(context).backgroundColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.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/app_scaffold_widget.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 NewHomeHealthCareStepTowPage extends StatefulWidget {
|
||||
final Function(PickResult) onPick;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final PatientERInsertPresOrderRequestModel
|
||||
patientERInsertPresOrderRequestModel;
|
||||
final Function changePageViewIndex;
|
||||
final HomeHealthCareViewModel model;
|
||||
|
||||
const NewHomeHealthCareStepTowPage(
|
||||
{Key key,
|
||||
this.onPick,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.patientERInsertPresOrderRequestModel,
|
||||
this.changePageViewIndex,
|
||||
this.model})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_NewHomeHealthCareStepTowPageState createState() =>
|
||||
_NewHomeHealthCareStepTowPageState();
|
||||
}
|
||||
|
||||
class _NewHomeHealthCareStepTowPageState
|
||||
extends State<NewHomeHealthCareStepTowPage> {
|
||||
double latitude = 0;
|
||||
double longitude = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.patientERInsertPresOrderRequestModel.latitude == null) {
|
||||
latitude = widget.latitude;
|
||||
longitude = widget.longitude;
|
||||
} else {
|
||||
latitude = widget.patientERInsertPresOrderRequestModel.latitude;
|
||||
longitude = widget.patientERInsertPresOrderRequestModel.longitude;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return AppScaffold(
|
||||
isShowDecPage: false,
|
||||
body: PlacePicker(
|
||||
apiKey: GOOGLE_API_KEY,
|
||||
enableMyLocationButton: true,
|
||||
automaticallyImplyAppBarLeading: false,
|
||||
autocompleteOnTrailingWhitespace: true,
|
||||
selectInitialPosition: true,
|
||||
autocompleteLanguage: projectViewModel.currentLanguage,
|
||||
enableMapTypeButton: true,
|
||||
onPlacePicked: (PickResult result) {
|
||||
print(result.adrAddress);
|
||||
widget.changePageViewIndex(3);
|
||||
},
|
||||
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: () {
|
||||
setState(() {
|
||||
widget.patientERInsertPresOrderRequestModel
|
||||
.latitude =
|
||||
selectedPlace.geometry.location.lat;
|
||||
widget.patientERInsertPresOrderRequestModel
|
||||
.longitude =
|
||||
selectedPlace.geometry.location.lng;
|
||||
});
|
||||
widget.changePageViewIndex(3);
|
||||
},
|
||||
label: TranslationBase.of(context).next,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
initialPosition: LatLng(latitude, longitude),
|
||||
useCurrentLocation: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue