Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into fatima-new

merge-requests/349/head
Fatimah Alshammari 3 years ago
commit bbb8e04066

@ -124,8 +124,8 @@ 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_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';

@ -1274,6 +1274,7 @@ const Map localizedValues = {
"ar": "Approximate Service Fee"
},
"TaxAmount": {"en": "Tax Amount:", "ar": "Tax Amount:"},
"somethingWentWrongTryLater": {"en": "Sorry something went wrong please try again later", "ar": "نعتذر لخدمتكم يرجى المحاولة لاحقا"},
"TotalAmountPayable": {
"en": "Total Amount Payable:",
"ar": "Total Amount Payable:"
@ -1292,8 +1293,27 @@ const Map localizedValues = {
"ar":
"The RRT service provides medical services urgent and stable cases, not life-threatening situation or extremities and the service includes providing medical care from a copmplete medical team at home"
},
"rrtService": {"en": "RRT Service", "ar": "خدمة RRT"},
"rrtService": {"en": "RRT Service", "ar": "خدمة RRT"},
"rrtUserAgreementTitle":{
"en":"Communication via email, text messages and phone calls",
"ar":"الاتصال عبر البريد الإلكتروني، والرسائل النصية، والمكالمات الهاتفية"
},
"rrtUserAgreementP1":{
"en" : "I understand that the contact number or Email that I have provided on registration will be used for communication by HMG. I hereby agree to be notified by HMG through SMS, Email or any other method for appointments notifications, current HMGs medical services, and any services introduced by the HMG in the future or any modifications made to the services offered by the HMG. And these messages may be submitted as evidence where the HMG has the right to use at any time whatsoever and as it sees fit.",
"ar" : "أدرك بأن رقم الهاتف أو البريد الإلكتروني الذي قدمته للمجموعة سيستخدم كوسيلة اتصال بيني وبينها، وأقر بموافقتي على قيام المجموعة بإخطاري عن طريق الرسائل القصيرة أو البريد الإلكتروني أو أي طريقة أخرى بالمواعيد وبأي خدمات طبية تقدمها المجموعة أو قد تطرحها المجموعة للجمهور في المستقبل أو أي تعديلات قد تطرأ على الخدمات المقدمة من قبل المجموعة. وتعتبر هذه الرسائل دليل إثبات يحق للمجموعة استخدامه في أي وقت تشاء. "
},
"rrtUserAgreementP2":{
"en":"I understand the risks of communicating by email and text messages, in particular the privacy risks. I understand that HMG cannot guarantee the security and confidentiality of email or text communication. HMG will not be responsible for messages that are not received or delivered due to technical failure, or for disclosure of confidential information unless caused by intentional misconduct.",
"ar":"أفھم مخاطر التواصل عبر البرید الإلکتروني والرسائل النصیة، خاصة مخاطر الخصوصیة، وادرك أن المجموعة لا يمكنها ضمان أمن وسرية البريد الإلكتروني أو الرسائل النصية ولن تكون المجموعة مسؤولة عن الرسائل التي لم يتم استلامها أو تسليمها بسبب الفشل التقني أو الكشف عن المعلومات السرية ما لم يكن سببها سوء سلوك متعمد."
},
"rrtUserAgreementP3":{
"en":'I hereby agree to receive emails, text messages, phone calls for appointments notifications, special promotions and new features or products introduced by HMG or any third party.',
"ar":"وافق على تلقي رسائل البريد الإلكتروني، والرسائل النصية، والمكالمات الهاتفية للإخطار بالمواعيد والعروض الترويجية والمميزات والمنتجات الجديدة الخاصة بالمجموعة أو اي طرف اخر."
},
"rrtOrderSuccessMessage": {
"en": "The request has been sent successfully, You will be contacted soon.",
"ar": "تم ارسال الطلب بنجاح وسيتم الاتصال بك قريبا."
},
"bill-amount": {"en": "Bill Amount", "ar": "مبلغ الفاتورة"},
"transport-method": {"en": "Transportation Method", "ar": "طريقة النقل"},
"directions": {"en": "Directions", "ar": "الاتجاهات"},

@ -86,4 +86,9 @@ class Addresses {
return data;
}
@override
String toString() {
return "${address1 ?? ""} ${address2 ?? ""}";
}
}

@ -1,4 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class PrescriptionsOrder {
int iD;
@ -32,6 +35,19 @@ class PrescriptionsOrder {
dynamic projectDescription;
dynamic projectDescriptionN;
String getNearestProjectDescription(){
return isAppArabic ? nearestProjectDescriptionN : nearestProjectDescription;
}
String getStatusName(TranslationBase localize){
if(status == 1)
return localize.pending;
else if(status == 3)
return localize.completed;
return '$status';
}
String getFormattedDateTime()=> DateUtil.getDateFormatted(pickupDateTime);
PrescriptionsOrder(
{this.iD,
this.patientID,

@ -1,5 +1,19 @@
import 'dart:async';
import 'dart:convert';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/cupertino.dart';
import '../base_view_model.dart';
@ -7,42 +21,127 @@ import '../base_view_model.dart';
class RRTService extends BaseService{
}
class _RRTServiceData{
List<PrescriptionsOrder> pendingOrders = [];
List<PrescriptionsOrder> completedOrders = [];
ServicePrice servicePrice;
}
class RRTViewModel extends BaseViewModel{
var _service = RRTService();
var _pharmacy_service = locator<PharmacyModuleService>();
var _pharmacy_address_service = locator<PharmacyAddressService>();
_RRTServiceData rrtServiceData = _RRTServiceData();
Future<_RRTServiceData> loadRequiredData() async{
await getServicePrice();
await getAllOrders();
return rrtServiceData;
}
Future createRequest(){
return null;
Future<int> createOrder(Map<String, dynamic> body) async{
body['IdentificationNo'] = user.patientIdentificationNo;
body['NationalityID'] = user.nationalityID;
body['CreatedBy'] = user.patientIdentificationType;
body['OrderServiceID'] = 5;
int requestNo;
await _service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode){
requestNo = response['RequestNo'];
}, onFailure: (error, statusCode){
AppToast.showErrorToast(message: error);
});
return requestNo;
}
// Service ID: 4 == RRT
Future<_RRTServiceData> 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"] == 5){
if(json["Status"] == 1){ // Pending
rrtServiceData.pendingOrders.clear();
rrtServiceData.pendingOrders.add(PrescriptionsOrder.fromJson(json));
}else if (json["Status"] == 3){ // Completed
rrtServiceData.completedOrders.clear();
rrtServiceData.completedOrders.add(PrescriptionsOrder.fromJson(json));
}
}
return Future.error("404");
});
}
}, onFailure: (error, statusCode){
AppToast.showErrorToast(message: error);
});
return rrtServiceData;
}
Future getAllRequest(){
Future getOrderDetails() async{
return null;
}
Future getRequestDetails(){
return null;
Future getAllQuestions() async{
dynamic response_;
await _service.baseAppClient.post(GET_ALL_RRT_QUESTIONS, body: {}, onSuccess: (response, statusCode){
response_ = response;
}, onFailure: (error, statusCode){
AppToast.showErrorToast(message: error);
});
return response_;
}
Future getAllQuestions(){
return null;
Future<ServicePrice> getServicePrice() async{
Map<String,dynamic> body = {"IdentificationNo":user.patientIdentificationNo};
ServicePrice servicePrice;
await _service.baseAppClient.post(GET_RRT_SERVICE_PRICE, body: body, onSuccess: (response, statusCode){
var data = response['PatientE_RealRRT_GetServicePriceList'];
if(data != null && data is List){
var priceData = data.first;
if(priceData != null){
servicePrice = ServicePrice.fromJson(priceData);
rrtServiceData.servicePrice = servicePrice;
}
}
}, onFailure: (error, statusCode){
AppToast.showErrorToast(message: error);
});
return servicePrice;
}
Future<bool> cancelOrder(PrescriptionsOrder order, {String reason = ""}) async{
var body = {"PresOrderID":order.iD, "PresOrderStatus":4,"EditedBy":3,"RejectionReason":reason};
var success = false;
await _service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode){
success = true;
}, onFailure: (error, statusCode){
AppToast.showErrorToast(message: error);
success = false;
});
return Future.value(success);
}
Future getCancelReasons(){
return null;
}
Future cancelRequest(){
return null;
Future<List<Addresses>> getAddresses() async{
Object error;
try{
var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN);
if(token == null)
await _pharmacy_service.generatePharmacyToken();
await _pharmacy_service.makeVerifyCustomer({'PatientID': user.patientID.toString()});
await _pharmacy_address_service.getAddresses();
return _pharmacy_address_service.addresses;
}catch(e){
error = e;
}
Future.error(error);
}
}

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
var isAppArabic = false;
class ProjectViewModel extends BaseViewModel {
// Platform Bridge
PlatformBridge platformBridge() {
@ -69,19 +70,19 @@ class ProjectViewModel extends BaseViewModel {
currentLanguage =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
_appLocale = Locale(currentLanguage);
_isArabic = currentLanguage == 'ar';
isAppArabic = _isArabic = currentLanguage == 'ar';
notifyListeners();
}
void changeLanguage(String lan) {
if (lan != "en" && currentLanguage != lan) {
_appLocale = Locale("ar");
_isArabic = true;
isAppArabic = _isArabic = true;
currentLanguage = 'ar';
sharedPref.setString(APP_LANGUAGE, 'ar');
} else if (lan != "ar" && currentLanguage != lan) {
_appLocale = Locale("en");
_isArabic = false;
isAppArabic = _isArabic = false;
currentLanguage = 'en';
sharedPref.setString(APP_LANGUAGE, 'en');
}

@ -0,0 +1,53 @@
class ServicePrice {
String currency;
double maxPrice;
double maxTotalPrice;
double maxVAT;
double minPrice;
double minTotalPrice;
double minVAT;
int price;
int totalPrice;
int vat;
ServicePrice({
this.currency,
this.maxPrice,
this.maxTotalPrice,
this.maxVAT,
this.minPrice,
this.minTotalPrice,
this.minVAT,
this.price,
this.totalPrice,
this.vat});
ServicePrice.fromJson(dynamic json) {
currency = json["Currency"];
maxPrice = json["MaxPrice"];
maxTotalPrice = json["MaxTotalPrice"];
maxVAT = json["MaxVAT"];
minPrice = json["MinPrice"];
minTotalPrice = json["MinTotalPrice"];
minVAT = json["MinVAT"];
price = json["Price"];
totalPrice = json["TotalPrice"];
vat = json["VAT"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["Currency"] = currency;
map["MaxPrice"] = maxPrice;
map["MaxTotalPrice"] = maxTotalPrice;
map["MaxVAT"] = maxVAT;
map["MinPrice"] = minPrice;
map["MinTotalPrice"] = minTotalPrice;
map["MinVAT"] = minVAT;
map["Price"] = price;
map["TotalPrice"] = totalPrice;
map["VAT"] = vat;
return map;
}
}

@ -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,

@ -117,7 +117,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,

@ -0,0 +1,49 @@
import 'package:diplomaticquarterapp/pages/conference/clipped_video.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class RRTAgreementPage extends StatelessWidget{
TranslationBase localize;
@override
Widget build(BuildContext context) {
localize = TranslationBase.of(context);
return AppScaffold(
appBarTitle: localize.userAgreement,
isShowAppBar: true,
showHomeAppBarIcon: false,
body: SingleChildScrollView(
padding: EdgeInsets.all(20),
child: Column(
children: [
Text(localize.rrtUserAgreementTitle, style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500, fontSize: 22), maxLines: 100, textAlign: TextAlign.center),
SizedBox(height: 20),
text(localize.rrtUserAgreementP1),
text(localize.rrtUserAgreementP2),
text(localize.rrtUserAgreementP3)
],
),
)
);
}
Widget text(String string)=> Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
clipBehavior: Clip.hardEdge,
width: 10, height: 10,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: Colors.black)
),
SizedBox(width: 20),
Expanded(child: Text(string, style: TextStyle(color: Colors.black87, fontSize: 18), maxLines: 100, textAlign: TextAlign.justify)),
],
),
);
}

@ -1,94 +1,54 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class RRTLogPage extends StatefulWidget{
final List<PrescriptionsOrder> orders;
const RRTLogPage({this.orders});
@override
State<StatefulWidget> createState() => RRTLogPageState();
}
class RRTLogPageState extends State<RRTLogPage>{
RRTViewModel viewModel;
@override
Widget build(BuildContext context) {
return BaseView<RRTViewModel>(
onModelReady: (viewModel){
},
builder: (ctx, vm, widget){
return BaseView<RRTViewModel>(
onModelReady: (vm) => viewModel = vm,
builder: (ctx, vm, widgetState){
return ListView.builder(
itemCount: 10,
itemBuilder: (ctx, idx) => RRTLogListItem()
itemCount: widget.orders.length,
itemBuilder: (ctx, idx) {
var order = widget.orders[idx];
return RRTLogListItem(order, onCancel: deleteOrder);
}
);
}
);
}
}
// ------------------------
// List Item Widget
// ------------------------
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
class RRTLogListItem extends StatelessWidget{
BuildContext _context;
@override
Widget build(BuildContext context) {
_context = context;
return Container(
padding: EdgeInsets.all(15), margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_contentItem(label: "Request ID", value: "2318"),
_item_content_seperator,
_contentItem(label: "Status", value: "2318"),
_item_content_seperator,
_contentItem(label: "Pickup Date", value: "2318"),
_item_content_seperator,
_contentItem(label: "Location", value: "2318"),
_item_content_seperator,
SizedBox(height: 10),
FractionallySizedBox(child: cancelButton())
],
),
);
}
Widget _contentItem({@required String label, String value}){
return Container(
padding: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),),
SizedBox(height: 5,),
Text(value, style: TextStyle(color: Theme.of(_context).appBarTheme.color,fontWeight: FontWeight.bold, fontSize: 14),),
],
),
);
deleteOrder(PrescriptionsOrder order) async {
GifLoaderDialogUtils.showMyDialog(context);
var success = await viewModel.cancelOrder(order);
GifLoaderDialogUtils.hideDialog(context);
if(success)
setState(() {
widget.orders.remove(order);
});
}
Widget cancelButton() => MaterialButton(
height: 45,
color: Color(0xFFc5272d),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () { },
child: Text("CANCEL", style: TextStyle(color: Colors.white, fontSize: 13),),
);
}

@ -1,6 +1,9 @@
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-logs-page.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-request-page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -16,27 +19,55 @@ class RRTMainScreenState extends State<RRTMainScreen> with SingleTickerProvider
TabController tabController;
PageController pageController = PageController(initialPage: 0, keepPage: true);
RRTViewModel viewModel;
bool loadingData;
@override
void initState() {
super.initState();
tabController = TabController(length: 2, vsync: this);
}
TranslationBase localize;
@override
Widget build(BuildContext context) {
localize = TranslationBase.of(context);
return AppScaffold(
appBarTitle: 'Rapid Response Team',
appBarTitle: localize.rapidResponseTeam,
isShowAppBar: true,
body: Column(
body: BaseView<RRTViewModel>(
onModelReady: (vm) async {
viewModel = vm;
loadingData = true;
await vm.loadRequiredData().then((value){
}).whenComplete(() => setState(() => loadingData = false));
},
builder: (ctx, vm, widget) => content(),
)
);
}
Widget content(){
if(loadingData == true){
return Center(child: CircularProgressIndicator());
// else if(viewModel.state == ViewState.Error)
}else if(viewModel.rrtServiceData != null && viewModel.rrtServiceData.servicePrice != null){
return Column(
children: [
tabBar(),
Expanded(
child: contentPager()
)
],
),
);
);
}else{
return Container(
alignment: Alignment.center,
child: Text(localize.somethingWentWrongTryLater, style: TextStyle(color: Colors.red), maxLines: 5,),
);
}
}
Widget tabBar() => Container(
@ -52,10 +83,10 @@ class RRTMainScreenState extends State<RRTMainScreen> with SingleTickerProvider
indicatorSize: TabBarIndicatorSize.label,
tabs: [
Tab(
child: Text("Rapid Response Team", style: TextStyle(color: Theme.of(context).appBarTheme.color),),
child: Text(localize.rapidResponseTeam, style: TextStyle(color: Theme.of(context).appBarTheme.color),),
),
Tab(
child: Text("Order Log", style: TextStyle(color: Theme.of(context).appBarTheme.color),),
child: Text(localize.orderLog, style: TextStyle(color: Theme.of(context).appBarTheme.color),),
),
]
),
@ -65,8 +96,8 @@ class RRTMainScreenState extends State<RRTMainScreen> with SingleTickerProvider
onPageChanged: onPageChanged,
controller: pageController,
children: [
RRTRequestPage(),
RRTLogPage(),
RRTRequestPage(servicePrice: viewModel.rrtServiceData.servicePrice, pendingOrders: viewModel.rrtServiceData.pendingOrders),
RRTLogPage(orders: viewModel.rrtServiceData.completedOrders),
],
);

@ -0,0 +1,71 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
class RRTLogListItem extends StatelessWidget{
final PrescriptionsOrder order;
final Function(PrescriptionsOrder) onCancel;
RRTLogListItem(this.order, {this.onCancel});
BuildContext _context;
TranslationBase localize;
@override
Widget build(BuildContext context) {
_context = context;
localize = TranslationBase.of(context);
return Container(
padding: EdgeInsets.all(15), margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_contentItem(label: localize.reqId, value: order.iD.toString()),
_item_content_seperator,
_contentItem(label: localize.status, value: order.getStatusName(localize)),
_item_content_seperator,
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
_item_content_seperator,
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
_item_content_seperator,
SizedBox(height: 10),
if(onCancel != null)
FractionallySizedBox(child: cancelButton())
],
),
);
}
Widget _contentItem({@required String label, String value}){
return Container(
padding: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),),
SizedBox(height: 5,),
Text(value, style: TextStyle(color: Theme.of(_context).appBarTheme.color,fontWeight: FontWeight.bold, fontSize: 14),),
],
),
);
}
Widget cancelButton() => MaterialButton(
height: 45,
color: Color(0xFFc5272d),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () => onCancel(order),
child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13),),
);
}

@ -1,52 +1,137 @@
import 'dart:async';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.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:diplomaticquarterapp/widgets/transitions/fade_page.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';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart';
import 'rrt-place-order.dart';
class RRTRequestPickupAddressPage extends StatefulWidget{
final ServicePrice servicePrice;
RRTRequestPickupAddressPage({@required this.servicePrice});
@override
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<Addresses> myAddresses = [];
Addresses selectedAddress;
StreamController<int> addressStreamController = StreamController();
Stream<int> addressStream;
StreamController<int> addressLoadingStreamController = StreamController();
Stream<int> addressLoadingStream;
@override
void initState(){
super.initState();
goToCurrentLocation();
addressStream = addressStreamController.stream;
addressLoadingStream = addressLoadingStreamController.stream;
}
void loadAddresses() async{
// GifLoaderDialogUtils.showMyDialog(context);
myAddresses = await viewModel.getAddresses();
// GifLoaderDialogUtils.hideDialog(context);
if(myAddresses.isNotEmpty)
setState(() {});
}
TranslationBase localize;
RRTViewModel viewModel;
@override
Widget build(BuildContext context) {
return BaseView<RRTViewModel>(
onModelReady: (viewModel){
localize = TranslationBase.of(context);
ProjectViewModel projectViewModel = Provider.of(context);
addressStreamController.sink.add(0);
return BaseView<RRTViewModel>(
onModelReady: (vm){
viewModel = vm;
loadAddresses();
},
builder: (ctx, vm, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).pickupLocation,
appBarTitle: localize.pickupLocation,
isShowAppBar: true,
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
selectAddress(),
StreamBuilder<Object>(
stream: addressStream,
builder: (context, snapshot) {
return selectAddressField();
}
),
StreamBuilder<Object>(
stream: addressLoadingStream,
builder: (context, snapshot) {
return snapshot.hasData ? LinearProgressIndicator(backgroundColor: Colors.transparent) : Container(height: 4,);
}
),
Expanded(
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: mapCamera,
onCameraIdle: (){
},
onMapCreated: (controller){
mapController.complete(controller);
},
)
child:
PlacePicker(
apiKey: GOOGLE_API_KEY,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteOnTrailingWhitespace: true,
selectInitialPosition: true,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
searchForInitialValue: false,
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
if(state == SearchingState.Idle){
addressLoadingStreamController.sink.add(null);
if(selectedPlace != null){
var loc = selectedPlace.geometry.location;
var address1 = selectedPlace.addressComponents.first.longName;
var address2 = "";
if(selectedPlace.addressComponents.length > 1)
address2 = selectedPlace.addressComponents[1].longName;
selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2);
addressStreamController.sink.add(0);
}
}else{
addressLoadingStreamController.sink.add(0);
}
return Container();
},
initialPosition: LatLng(24.7114693, 46.67469582),
useCurrentLocation: false,
),
),
continueButton()
],
@ -55,22 +140,39 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
);
}
Widget selectAddress(){
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 selectAddressField(){
var text = selectedAddress == null ? localize.selectAddress : selectedAddress.toString();
return Container(
margin: EdgeInsets.all(15),
child: Expanded(
child: MaterialButton(
height: 50,
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () { },
child: Row(
children: [
Text(TranslationBase.of(context).selectAddress, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
Spacer(),
Icon(Icons.keyboard_arrow_down, size: 15, color: Colors.grey,)
],
),
margin: EdgeInsets.all(10),
height: 50,
child: MaterialButton(
height: 50, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: openAddressSelectDialog,
child: Row(
children: [
Expanded(child: Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1))),
Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.grey,)
],
),
),
);
@ -83,10 +185,68 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
height: 50,
color: Theme.of(context).appBarTheme.color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () { },
child: Text(TranslationBase.of(context).continues, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),),
onPressed: () =>
Navigator.push(
context,
FadePage(page: RRTPlaceOrderPage(selectedAddress: selectedAddress, servicePrice: widget.servicePrice,))
),
child: Text(localize.continues, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),),
),
);
}
openAddressSelectDialog(){
showMaterialResponsiveDialog(
hideButtons: true,
context: context,
title: localize.selectAddress,
child: ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.all(10),
itemCount: myAddresses.length,
itemBuilder: (ctx,idx) {
var itm = myAddresses[idx];
return ListTile(
title: Text(itm.toString()),
onTap: (){
setState(() {
selectedAddress = itm;
Navigator.pop(context);
if(itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1){
var cordinates = itm.latLong.split(',');
var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last));
moveToLocation(latlng);
}else{
AppToast.showErrorToast(message: 'Invalid address coordinates');
}
});
},
);
},
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);
}
}

@ -0,0 +1,195 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class RRTPlaceOrderPage extends StatelessWidget{
TranslationBase localize;
RRTViewModel viewModel;
Addresses selectedAddress;
final ServicePrice servicePrice;
RRTPlaceOrderPage({@required this.selectedAddress, @required this.servicePrice});
TextEditingController noteController = TextEditingController(text: '');
BuildContext _context;
@override
Widget build(BuildContext context) {
_context = context;
localize = TranslationBase.of(context);
var lat = selectedAddress.latLong.split(',').first;
var lng = selectedAddress.latLong.split(',').last;
return BaseView<RRTViewModel>(
onModelReady: (vm) => viewModel = vm,
builder: (ctx,vm,wState){
return AppScaffold(
appBarTitle: localize.rapidResponseTeam,
isShowAppBar: true,
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SingleChildScrollView(
padding: EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(localize.selectedLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),),
selectedAddressField(),
AspectRatio(
aspectRatio: 3/1,
child: ClipRRect(
clipBehavior: Clip.hardEdge,
borderRadius: BorderRadius.circular(10),
child: Image.network(
"https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng &zoom=16&size=800x400&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8",
fit: BoxFit.cover,
),
),
),
SizedBox(height: 10,),
Container(
height: 70,
margin: EdgeInsets.symmetric(vertical: 5),
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))]
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(localize.totalAmountPayable, style: TextStyle(fontSize: 13),),
SizedBox(height: 5,),
Text("${servicePrice.totalPrice ?? '- - -'} ${localize.sar}" , style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),),
],
),
),
Container(
height: 70,
margin: EdgeInsets.symmetric(vertical: 5),
padding: EdgeInsets.symmetric(horizontal: 0, vertical: 10),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))]
),
child: TextField(
controller: noteController,
style: TextStyle(fontSize: 18.0),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
labelText: localize.notes,
contentPadding: const EdgeInsets.only(left: 14.0, bottom: 8.0, top: 8.0),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.circular(10),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.circular(10),
),
)
),
),
],
),
),
),
submitButton(context)
],
)
);
},
);
}
Widget selectedAddressField(){
var address = "${selectedAddress.address1 ?? ''} ${selectedAddress.address2 ?? ''}";
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Expanded(
child: MaterialButton(
height: 50, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: (){},
child: Row(
children: [
Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 15, letterSpacing: 1))),
Icon(Icons.location_on_rounded, size: 30, color: Colors.black,)
],
),
),
),
);
}
Widget submitButton(BuildContext context){
return Padding(
padding: const EdgeInsets.all(15),
child: MaterialButton(
height: 50,
color: Theme.of(context).appBarTheme.color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
onPressed: () => placeOrder(),
child: Text(localize.submit, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),),
),
);
}
placeOrder() async{
if(selectedAddress != null && selectedAddress.latLong != null && selectedAddress.latLong.isNotEmpty && selectedAddress.latLong.split(',').length > 1){
GifLoaderDialogUtils.showMyDialog(_context);
Map<String, dynamic> params = {};
var cordinates = selectedAddress.latLong.split(',');
var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last));
params['Latitude'] = latlng.latitude;
params['Longitude'] = latlng.longitude;
params['Notes'] = noteController.text;
var requestId = await viewModel.createOrder(params);
GifLoaderDialogUtils.hideDialog(_context);
if(requestId != null){
AlertDialogBox(
context: _context,
title: '',
confirmMessage: localize.rrtOrderSuccessMessage,
okText: localize.ok,
okFunction: (){
AlertDialogBox.closeAlertDialog(_context);
gotoRRTRoot();
}
).showAlertDialog(_context);
}
}else{
AppToast.showErrorToast(message: 'Invalid location selected');
}
}
gotoRRTRoot(){
Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: ErOptions));
}
}

@ -1,6 +1,13 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-agreement-page.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart';
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
@ -8,47 +15,79 @@ import 'package:flutter/material.dart';
class RRTRequestPage extends StatefulWidget{
final List<PrescriptionsOrder> pendingOrders;
final ServicePrice servicePrice;
RRTRequestPage({this.pendingOrders, this.servicePrice});
@override
State<StatefulWidget> createState() => RRTRequestPageState();
State<StatefulWidget> createState() => RRTRequestPageState();
}
class RRTRequestPageState extends State<RRTRequestPage>{
bool acceptTerms = false;
TranslationBase localize;
RRTViewModel viewModel;
@override
Widget build(BuildContext context) {
localize = TranslationBase.of(context);
return BaseView<RRTViewModel>(
onModelReady: (viewModel){
onModelReady: (vm){
viewModel = vm;
},
builder: (ctx, vm, widgetState){
},
builder: (ctx, vm, widget) => Column(
children: [
Expanded(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
children: [
serviceDescription(context),
SizedBox(height: 20),
priceTable(context),
acceptPolicy(),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),// Seperator
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)
),
paymentOptions(),
],
if(widget.pendingOrders.isNotEmpty)
return currentOrderContent();
else
return requestContent();
},
);
}
Widget requestContent(){
return Column(
children: [
Expanded(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
children: [
serviceDescription(context),
SizedBox(height: 20),
priceTable(context),
acceptPolicy(),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),// Seperator
Container(
padding: EdgeInsets.only(top: 20, bottom: 5),
alignment: Alignment.center,
child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)
),
),
actionButtons()
],
)
paymentOptions(),
],
),
),
actionButtons()
],
);
}
Widget currentOrderContent(){
var orders = widget.pendingOrders;
return ListView.builder(
itemCount: orders.length,
itemBuilder: (ctx, idx) {
var order = orders[idx];
return RRTLogListItem(order, onCancel: deleteOrder);
}
);
}
@ -56,7 +95,7 @@ class RRTRequestPageState extends State<RRTRequestPage>{
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
TranslationBase.of(context).RRTDDetails,
localize.rrtDDetails,
textAlign: TextAlign.justify,
style: TextStyle(color: Theme.of(context).appBarTheme.color, fontSize: 15, height: 1.5, fontWeight: FontWeight.w300),
),
@ -64,22 +103,25 @@ class RRTRequestPageState extends State<RRTRequestPage>{
Widget priceTable(BuildContext context){
var radius = Radius.circular(8);
String amount = widget.servicePrice.price.toString();
String vat = widget.servicePrice.vat.toString();
String total = widget.servicePrice.totalPrice.toString();
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
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(localize.approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))),
),
pricingRow(label: TranslationBase.of(context).AmountBeforeTax, value: '500 SAR'),
pricingRow(label: localize.amountBeforeTax, value: '$amount ${localize.sar}'),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
pricingRow(label: TranslationBase.of(context).TaxAmount, value: '50 SAR'),
pricingRow(label: localize.taxAmount, value: '$vat ${localize.sar}'),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
pricingRow(label: TranslationBase.of(context).TotalAmountPayable, value: '550 SAR', labelBold: true),
pricingRow(label: localize.totalAmountPayable, value: '$total ${localize.sar}', labelBold: true),
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
],
);
@ -115,15 +157,18 @@ class RRTRequestPageState extends State<RRTRequestPage>{
}),
SizedBox(width: 10),
Expanded(
child: Text(TranslationBase.of(context).iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)
child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)
),
Container(
alignment: Alignment.center,
width: MediaQuery.of(context).size.width * 0.25,
child: TextButton(
child: Text(TranslationBase.of(context).clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)),
child: Text(localize.clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)),
onPressed: (){
Navigator.push(
context,
FadePage(
page: RRTAgreementPage()));
}
),
)
@ -133,10 +178,10 @@ class RRTRequestPageState extends State<RRTRequestPage>{
}
Widget paymentOptions()=> Container(
height: 30,
alignment: Alignment.center,
child: Image.asset("assets/payment_options/payment_options.png", fit: BoxFit.fill,)
);
height: 30,
alignment: Alignment.center,
child: Image.asset("assets/payment_options/payment_options.png", fit: BoxFit.fill,)
);
Widget actionButtons(){
return Container(
@ -149,28 +194,46 @@ class RRTRequestPageState extends State<RRTRequestPage>{
color: Theme.of(context).appBarTheme.color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
onPressed: () { },
child: Text(TranslationBase.of(context).cancel, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
),
),
SizedBox(width: 20,),
Expanded(
child: MaterialButton(
height: 50,
color: Theme.of(context).appBarTheme.color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
child: Text(TranslationBase.of(context).ok, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
onPressed: () {
Navigator.push(
context,
FadePage(
page: RRTRequestPickupAddressPage()));
},
height: 50,
color: Theme.of(context).appBarTheme.color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
child: Text(localize.ok, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
onPressed: () {
if(acceptTerms)
goToPickupAddress();
else
AppToast.showErrorToast(message: localize.pleaseAcceptTerms);
}
),
)
],
),
);
}
goToPickupAddress()async{
Navigator.push(
context,
FadePage(page: RRTRequestPickupAddressPage(servicePrice: widget.servicePrice,))
);
}
deleteOrder(PrescriptionsOrder order) async {
GifLoaderDialogUtils.showMyDialog(context);
var success = await viewModel.cancelOrder(order);
GifLoaderDialogUtils.hideDialog(context);
if(success)
setState(() {
widget.pendingOrders.remove(order);
});
}
}

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
@ -10,12 +12,14 @@ class PharmacyAddressService extends BaseService {
CountryData country;
int selectedAddressIndex = 0;
Future getAddresses() async {
Future<List<Addresses>> getAddresses() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
Map<String, String> queryParams = {'fields': 'addresses'};
hasError = false;
Addresses selectedAddress;
try {
var completer = Completer();
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId",
onSuccess: (dynamic response, int statusCode) async {
addresses.clear();
@ -33,13 +37,19 @@ class PharmacyAddressService extends BaseService {
addresses.add(address);
index++;
});
completer.complete();
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, queryParams: queryParams);
} catch (error) {
await completer.future;
} catch (error){
throw error;
}
return addresses;
}
Future getCountries(String countryName) async {

@ -1162,22 +1162,22 @@ 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 iAcceptTermsConditions =>
localizedValues['iAcceptTermsConditions'][locale.languageCode];
String get YouCanPayByTheFollowingOptions =>
localizedValues['YouCanPayByTheFollowingOptions'][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 somethingWentWrongTryLater => localizedValues['somethingWentWrongTryLater'][locale.languageCode];
String get youCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode];
String get rrtService => localizedValues['rrtService'][locale.languageCode];
String get rrtUserAgreementTitle => localizedValues['rrtUserAgreementTitle'][locale.languageCode];
String get rrtUserAgreementP1 => localizedValues['rrtUserAgreementP1'][locale.languageCode];
String get rrtUserAgreementP2 => localizedValues['rrtUserAgreementP2'][locale.languageCode];
String get rrtUserAgreementP3 => localizedValues['rrtUserAgreementP3'][locale.languageCode];
String get rrtOrderSuccessMessage => localizedValues['rrtOrderSuccessMessage'][locale.languageCode];
String get billAmount => localizedValues['bill-amount'][locale.languageCode];
String get transportMethod =>
localizedValues['transport-method'][locale.languageCode];

@ -504,6 +504,13 @@ class Utils {
);
});
}
static bool route(Route route, {@required Type equalsTo}){
if((route is FadePage)){
return route.page.runtimeType == equalsTo;
}
return route.runtimeType == equalsTo;
}
}
Widget applyShadow(

@ -5,23 +5,27 @@ import 'package:flutter/material.dart';
class AlertDialogBox {
final BuildContext context;
final title;
final confirmMessage;
final okText;
final Function okFunction;
AlertDialogBox(
{@required this.context,
this.title,
@required this.confirmMessage,
@required this.okText,
@required this.okFunction});
showAlertDialog(BuildContext context) {
Widget continueButton =
FlatButton(child: Text(this.okText), onPressed: this.okFunction);
FlatButton(child: Text(this.okText), onPressed: (){
this.okFunction();
});
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text(TranslationBase.of(context).confirm),
title: Text(title ?? TranslationBase.of(context).confirm),
content: Text(this.confirmMessage),
actions: [
continueButton,
@ -31,7 +35,7 @@ class AlertDialogBox {
// show the dialog
showDialog(
barrierDismissible: false,
context: context,
context: this.context,
builder: (BuildContext context) {
return alert;
},

@ -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