RRT in progress (Service implementations)

merge-update-with-lab-changes
Zohaib Iqbal Kambrani 5 years ago
parent 4da163d186
commit e4256d6874

@ -125,6 +125,7 @@ const INSERT_ER_INERT_PRES_ORDER =
/// ER RRT
const GET_ALL_RC_TRANSPORTATION = 'rc/api/Transportation/getalltransportation';
const GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions';
const GET_RRT_SERVICE_PRICE = 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice';
///FindUs
const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations';

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import '../base_view_model.dart';
@ -7,42 +9,91 @@ import '../base_view_model.dart';
class RRTService extends BaseService{
}
class _RRTServiceOrders{
List<PrescriptionsOrder> pendingOrders = [];
List<PrescriptionsOrder> completedOrders = [];
}
class RRTViewModel extends BaseViewModel{
var _service = RRTService();
_RRTServiceOrders rrtOrders = _RRTServiceOrders();
Future createRequest(){
return null;
Future getRequiredData() async{
getServicePrice();
getAllOrders();
}
Future createOrder(){
var body = {"Latitude":24.828170776367188,"Longitude":46.63229029757938,"IdentificationNo":"2344670985","NationalityID":"JOR","CreatedBy":1231755,"OrderServiceID":5,"Notes":""};
_service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode){
print(response);
}, onFailure: (error, statusCode){
Future getAllRequest(){
});
return null;
}
// Service ID: 4 == RRT
Future<_RRTServiceOrders> getAllOrders() async{
await _service.baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, body: {}, onSuccess: (response, statusCode){
var data = response["PatientER_GetPatientAllPresOrdersList"];
if(data != null && data is List){
data.forEach((json){
if(json["ServiceID"] == 4){
if(json["Status"] == 1){ // Pending
rrtOrders.pendingOrders.clear();
rrtOrders.pendingOrders.add(PrescriptionsOrder.fromJson(json));
}else if (json["Status"] == 3){ // Completed
rrtOrders.completedOrders.clear();
rrtOrders.completedOrders.add(PrescriptionsOrder.fromJson(json));
}
}
});
}
}, onFailure: (error, statusCode){
print(error);
});
return rrtOrders;
}
Future getRequestDetails(){
Future getOrderDetails(){
return null;
}
Future getAllQuestions(){
_service.baseAppClient.post(GET_ALL_RRT_QUESTIONS, body: {}, onSuccess: (response, statusCode){
print(response);
}, onFailure: (error, statusCode){
print(error);
});
return null;
}
Future getCancelReasons(){
Future getServicePrice(){
var body = {"IdentificationNo":user.patientIdentificationNo};
_service.baseAppClient.post(GET_RRT_SERVICE_PRICE, body: body, onSuccess: (response, statusCode){
print(response);
}, onFailure: (error, statusCode){
print(error);
});
return null;
}
Future cancelOrder(){
var body = {"PresOrderID":"2318","PresOrderStatus":4,"EditedBy":3,"RejectionReason":""};
_service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode){
print(response);
}, onFailure: (error, statusCode){
print(error);
});
return null;
}
Future cancelRequest(){
return null;
Future getCancelReasons(){
}
}

@ -31,7 +31,7 @@ class _SummaryState extends State<Summary> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(TranslationBase.of(context).RRTSummary),
Texts(TranslationBase.of(context).rrtSummary),
SizedBox(height: 5,),
Container(
width: double.infinity,

@ -116,7 +116,7 @@ class _ErOptionsState extends State<ErOptions> {
locked: rrtLocked,
image: 'assets/images/new-design/AM.PNG',
text: TranslationBase.of(context).rrtService,
subText: TranslationBase.of(context).RapidResponseTeam,
subText: TranslationBase.of(context).rapidResponseTeam,
onTap:(){
Navigator.push(
context,

@ -3,9 +3,12 @@ import 'dart:async';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class RRTRequestPickupAddressPage extends StatefulWidget{
@ -14,15 +17,26 @@ class RRTRequestPickupAddressPage extends StatefulWidget{
State<StatefulWidget> createState() => RRTRequestPickupAddressPageState();
}
class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage>{
class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage> with SingleTickerProviderStateMixin{
bool acceptTerms = false;
Completer<GoogleMapController> mapController = Completer();
static final CameraPosition mapCamera = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
bool mapIdle = true;
Completer<GoogleMapController> mapController = Completer();
CameraPosition mapCameraPosition = CameraPosition(
target: LatLng(24.7114693, 46.67469582),
zoom: 14.4746,
);
List<dynamic> myAdresses = ["One","Two","Three",];
dynamic selectedAddress;
@override
void initState(){
super.initState();
goToCurrentLocation();
}
@override
Widget build(BuildContext context) {
return BaseView<RRTViewModel>(
@ -37,15 +51,31 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
children: [
selectAddress(),
Expanded(
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: mapCamera,
onCameraIdle: (){
},
onMapCreated: (controller){
mapController.complete(controller);
},
child: Stack(
children: [
GoogleMap(
myLocationEnabled: true,
onTap: moveToLocation,
mapType: MapType.normal,
initialCameraPosition: mapCameraPosition,
onCameraIdle: (){
mapIdle = true;
setState((){});
},
onCameraMove: (camPosition){
mapCameraPosition = camPosition;
},
onCameraMoveStarted: (){
mapIdle = false;
setState((){});
},
onMapCreated: (controller){
mapController.complete(controller);
},
),
centerTargetPoint()
],
)
),
continueButton()
@ -55,20 +85,40 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
);
}
Widget centerTargetPoint(){
double size = mapIdle ? 20 : 30;
double margin = mapIdle ? 3 : 10;
return Center(
child: Container(
width: size, height: size,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), border: Border.all(width: 2, color: Theme.of(context).appBarTheme.color)
),
child: Container(
margin: EdgeInsets.all(margin),
decoration: BoxDecoration(
color: Theme.of(context).appBarTheme.color,
borderRadius: BorderRadius.circular(20))
),
),
);
}
Widget selectAddress(){
var text = selectedAddress == null ? TranslationBase.of(context).selectAddress : selectedAddress;
return Container(
margin: EdgeInsets.all(15),
child: Expanded(
child: MaterialButton(
height: 50,
color: Colors.white,
height: 50, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () { },
onPressed: openAddressSelectDialog,
child: Row(
children: [
Text(TranslationBase.of(context).selectAddress, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1),),
Spacer(),
Icon(Icons.keyboard_arrow_down, size: 15, color: Colors.grey,)
Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.grey,)
],
),
),
@ -89,4 +139,51 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
);
}
openAddressSelectDialog(){
showMaterialResponsiveDialog(
hideButtons: true,
context: context,
title: "Select Address",
child: ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.all(10),
itemCount: myAdresses.length,
itemBuilder: (ctx,idx) {
var itm = myAdresses[idx];
return ListTile(
title: Text(itm.toString()),
onTap: (){
setState(() {
selectedAddress = itm;
Navigator.pop(context);
});
},
);
},
separatorBuilder: (ctx,idx) => Container(height: 0.25, color: Colors.grey.withOpacity(0.7),)
)
);
}
moveToLocation(LatLng location, {bool animate = true}) async{
await Future.delayed(Duration(milliseconds: 200));
mapCameraPosition = CameraPosition(target: location, zoom: 16.4746,);
if(animate)
(await mapController.future).animateCamera(CameraUpdate.newCameraPosition(mapCameraPosition),);
else
(await mapController.future).moveCamera(CameraUpdate.newCameraPosition(mapCameraPosition),);
}
goToCurrentLocation() async{
var location = await Geolocator.getLastKnownPosition();
if(location == null){
Geolocator.getCurrentPosition().then((value){
moveToLocation(LatLng(value.latitude, value.longitude));
});
return;
}
moveToLocation(LatLng(location.latitude, location.longitude), animate: false);
}
}

@ -18,8 +18,8 @@ class RRTRequestPageState extends State<RRTRequestPage>{
@override
Widget build(BuildContext context) {
return BaseView<RRTViewModel>(
onModelReady: (viewModel){
onModelReady: (viewModel) async{
await viewModel.getRequiredData();
},
builder: (ctx, vm, widget) => Column(
children: [
@ -38,7 +38,7 @@ class RRTRequestPageState extends State<RRTRequestPage>{
Container(
padding: EdgeInsets.only(top: 20, bottom: 5),
alignment: Alignment.center,
child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)
child: Text(TranslationBase.of(context).youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)
),
paymentOptions(),
@ -56,7 +56,7 @@ class RRTRequestPageState extends State<RRTRequestPage>{
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
TranslationBase.of(context).RRTDDetails,
TranslationBase.of(context).rrtDDetails,
textAlign: TextAlign.justify,
style: TextStyle(color: Theme.of(context).appBarTheme.color, fontSize: 15, height: 1.5, fontWeight: FontWeight.w300),
),
@ -70,16 +70,16 @@ class RRTRequestPageState extends State<RRTRequestPage>{
Container(
height: 30,
decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.only(topLeft: radius, topRight: radius)),
child: Center(child: Text(TranslationBase.of(context).ApproximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))),
child: Center(child: Text(TranslationBase.of(context).approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))),
),
pricingRow(label: TranslationBase.of(context).AmountBeforeTax, value: '500 SAR'),
pricingRow(label: TranslationBase.of(context).amountBeforeTax, value: '500 SAR'),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
pricingRow(label: TranslationBase.of(context).TaxAmount, value: '50 SAR'),
pricingRow(label: TranslationBase.of(context).taxAmount, value: '50 SAR'),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
pricingRow(label: TranslationBase.of(context).TotalAmountPayable, value: '550 SAR', labelBold: true),
pricingRow(label: TranslationBase.of(context).totalAmountPayable, value: '550 SAR', labelBold: true),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
],
);

@ -1158,15 +1158,15 @@ class TranslationBase {
String get walker => localizedValues['walker'][locale.languageCode];
String get stretcher => localizedValues['stretcher'][locale.languageCode];
String get none => localizedValues['none'][locale.languageCode];
String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode];
String get RapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode];
String get RRTDDetails => localizedValues['RRTDDetails'][locale.languageCode];
String get ApproximateServiceFee => localizedValues['ApproximateServiceFee'][locale.languageCode];
String get AmountBeforeTax => localizedValues['AmountBeforeTax'][locale.languageCode];
String get TaxAmount => localizedValues['TaxAmount'][locale.languageCode];
String get TotalAmountPayable => localizedValues['TotalAmountPayable'][locale.languageCode];
String get rrtSummary => localizedValues['RRT-Summary'][locale.languageCode];
String get rapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode];
String get rrtDDetails => localizedValues['RRTDDetails'][locale.languageCode];
String get approximateServiceFee => localizedValues['ApproximateServiceFee'][locale.languageCode];
String get amountBeforeTax => localizedValues['AmountBeforeTax'][locale.languageCode];
String get taxAmount => localizedValues['TaxAmount'][locale.languageCode];
String get totalAmountPayable => localizedValues['TotalAmountPayable'][locale.languageCode];
String get iAcceptTermsConditions => localizedValues['iAcceptTermsConditions'][locale.languageCode];
String get YouCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode];
String get youCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode];
String get rrtService => localizedValues['rrtService'][locale.languageCode];
String get billAmount => localizedValues['bill-amount'][locale.languageCode];
String get transportMethod =>

@ -0,0 +1,56 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SelectionDialog<T> extends StatefulWidget{
@override
State<StatefulWidget> createState() => SelectionDialogState();
String title;
List<T> items;
show({@required String title, @required List<T> items}){
this.title = title;
}
}
class SelectionDialogState extends State<SelectionDialog>{
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15)),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(15),
child: Text(widget.title,),
),
Container(height: 0.5, color: Colors.grey,),
ListView.separated(
padding: EdgeInsets.all(10),
itemCount: widget.items.length,
itemBuilder: (ctx,idx) => item(idx),
separatorBuilder: (ctx,idx) => Container(height: 0.25, color: Colors.grey.withOpacity(0.7),))
],
),
)
],
);
}
Widget item(int idx){
var model = widget.items[idx];
return Container(
padding: EdgeInsets.all(10),
height: 20,
color: Colors.blue,
child: Text(model.toString()),
);
}
}
Loading…
Cancel
Save