Pharmacy fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent f4ccecc1af
commit 4823919fcb

@ -704,6 +704,7 @@ class BaseAppClient {
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: user['PatientType'] != null
? user['PatientType']
@ -738,7 +739,7 @@ class BaseAppClient {
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
var parsed = json.decode(utf8.decode(response.bodyBytes));
onFailure(parsed['error']['ErrorEndUserMsg'] ?? 'Error While Fetching data', statusCode);
onFailure(parsed['error']['ErrorEndUserMsgN'] ?? 'Error While Fetching data', statusCode);
} else {
// var parsed = json.decode(response.body.toString());
var parsed = json.decode(utf8.decode(response.bodyBytes));

@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:flutter/cupertino.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class OrderPreviewService extends BaseService {
@ -25,8 +24,7 @@ class OrderPreviewService extends BaseService {
Map<String, String> queryParams = {'fields': 'addresses'};
hasError = false;
try {
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) {
addresses.clear();
response['customers'][0]['addresses'].forEach((item) {
addresses.add(Addresses.fromJson(item));
@ -46,9 +44,7 @@ class OrderPreviewService extends BaseService {
dynamic localRes;
hasError = false;
try {
await baseAppClient
.getPharmacy("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", onSuccess: (dynamic response, int statusCode) {
localRes = response['shipping_option'][0];
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -68,8 +64,7 @@ class OrderPreviewService extends BaseService {
dynamic localRes;
hasError = false;
try {
await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -81,8 +76,7 @@ class OrderPreviewService extends BaseService {
return Future.value(localRes);
}
Future<Map> changeProductQuantity(
String productId, ShoppingCart product) async {
Future<Map> changeProductQuantity(String productId, ShoppingCart product) async {
hasError = false;
super.error = "";
dynamic localRes;
@ -96,8 +90,7 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
body["shopping_cart_item"] = choppingCartObject;
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -114,8 +107,7 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -132,9 +124,7 @@ class OrderPreviewService extends BaseService {
super.error = "";
dynamic localRes;
await baseAppClient
.getPharmacy("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart",
onSuccess: (response, statusCode) async {
await baseAppClient.getPharmacy("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -152,8 +142,7 @@ class OrderPreviewService extends BaseService {
body['IdentificationNo'] = identificationNo;
try {
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
onSuccess: (response, statusCode) async {
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, onSuccess: (response, statusCode) async {
lacumInformation = LacumAccountInformation.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -173,8 +162,7 @@ class OrderPreviewService extends BaseService {
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
try {
await baseAppClient.post(GET_LACUM_GROUP_INFORMATION,
onSuccess: (response, statusCode) async {
await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, onSuccess: (response, statusCode) async {
lacumGroupInformation = LacumAccountInformation.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -185,31 +173,29 @@ class OrderPreviewService extends BaseService {
}
}
Future makeOrder(PaymentCheckoutData paymentCheckoutData,
List<ShoppingCart> shoppingCarts) async {
Future makeOrder(PaymentCheckoutData paymentCheckoutData, List<ShoppingCart> shoppingCarts) async {
paymentCheckoutData.address.isChecked = true;
hasError = false;
super.error = "";
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en');
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en');
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
Map<String, dynamic> orderBody = Map();
orderBody['rx_attachments'] = "";
orderBody['customer_language_id'] = languageID == 'ar' ? 1 : 2;
orderBody['customer_language_id'] = languageID == 'ar' ? 2 : 1;
orderBody['billing_address'] = paymentCheckoutData.address;
orderBody['pick_up_in_store'] = false;
orderBody['payment_method_system_name'] = "Payments.PayFort";
orderBody['shipping_method'] = languageID == 'ar'
? paymentCheckoutData.shippingOption.namen
: paymentCheckoutData.shippingOption.name;
orderBody['shipping_rate_computation_method_system_name'] =
paymentCheckoutData
.shippingOption.shippingRateComputationMethodSystemName;
if (paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.Aramex")
orderBody['shipping_method'] = "Aramex Domestic";
else
orderBody['shipping_method'] = "Fixed Price";
orderBody['shipping_rate_computation_method_system_name'] = paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName;
orderBody['customer_id'] = int.parse(customerId);
orderBody['custom_values_xml'] =
"PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}";
orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}";
orderBody['shippingOption'] = paymentCheckoutData.shippingOption;
orderBody['shipping_address'] = paymentCheckoutData.address;
orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints;
@ -227,9 +213,7 @@ class OrderPreviewService extends BaseService {
body['order'] = orderBody;
try {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART,
isExternal: false,
isAllowAny: true, onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, isExternal: false, isAllowAny: true, onSuccess: (response, statusCode) async {
orderList.clear();
response['orders'].forEach((item) {
orderList.add(OrderDetailModel.fromJson(item));
@ -271,8 +255,7 @@ class OrderPreviewService extends BaseService {
jsonBody['DriverID'] = driverId;
LatLng coordinates;
await baseAppClient.post(DRIVER_LOCATION,
onSuccess: (response, statusCode) async {
await baseAppClient.post(DRIVER_LOCATION, onSuccess: (response, statusCode) async {
if (statusCode == 200) {
dynamic locationObject = response['PatientER_GetDriverLocationList'][0];
double lat = locationObject['Latitude'];

@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart';
import 'package:fit_kit/fit_kit.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@ -85,7 +84,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
type,
dateFrom: firstDayOfTheYear,
dateTo: DateTime.now(),
limit: 1000500,
limit: 1000,
);
if (type == DataType.DISTANCE) {
@ -241,30 +240,33 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: ""));
Med_InsertTransactionsInputsList2.add(
new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: ""));
// Med_InsertTransactionsInputsList2.add(new healthData(MedCategoryID: 8 , MedSubCategoryID: 0 , MachineDate: DateUtil.convertDateToStringWithBackSlash(date) , Value: totalCalories , TransactionsListID: TransactionsListID++ , Notes: ""));
});
addInsertTransactionsInputsList();
GifLoaderDialogUtils.hideDialog(context);
AlertDialogBox dialog = new AlertDialogBox(
context: context,
confirmMessage: TranslationBase.of(context).alreadySynced,
okText: TranslationBase.of(context).ok,
okFunction: () => {
AlertDialogBox.closeAlertDialog(context),
},
);
// AlertDialogBox dialog = new AlertDialogBox(
// context: context,
// confirmMessage: TranslationBase.of(context).alreadySynced,
// okText: TranslationBase.of(context).ok,
// okFunction: () => {
// AlertDialogBox.closeAlertDialog(context),
// },
// );
dialog.showAlertDialog(context);
// dialog.showAlertDialog(context);
}
addInsertTransactionsInputsList() {
if (Med_InsertTransactionsInputsList2.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
SmartWatchIntegrationService service = new SmartWatchIntegrationService();
service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
print(res);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
} else {

@ -192,6 +192,8 @@ class PaymentBottomWidget extends StatelessWidget {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
Navigator.pop(context);
Navigator.pop(context);
}
}
}

@ -114,7 +114,7 @@ class _OrderPageState extends State<OrderPage>
}
return Container(
width: MediaQuery.of(context).size.width,
child: model.orders.length != 0
child: deliveredOrderList.length != 0
? SingleChildScrollView(
child: Column(
children: <Widget>[
@ -381,7 +381,7 @@ class _OrderPageState extends State<OrderPage>
}
return Container(
width: MediaQuery.of(context).size.width,
child: model.orders.length != 0
child: processingOrderList.length != 0
? SingleChildScrollView(
child: Column(
children: <Widget>[
@ -823,7 +823,7 @@ class _OrderPageState extends State<OrderPage>
}
}
return Container(
child: model.orders.length != 0
child: pendingOrderList.length != 0
? SingleChildScrollView(
child: Column(
children: <Widget>[
@ -1092,7 +1092,7 @@ class _OrderPageState extends State<OrderPage>
}
}
return Container(
child: model.orders.length != 0
child: cancelledOrderList.length != 0
? SingleChildScrollView(
child: Column(
children: <Widget>[

@ -72,8 +72,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
onModelReady: (model) {
model.getOrderDetails(widget.orderModel.id).then((value) {
setState(() {
isActiveDelivery = (value.orderStatusId == 995 &&
(value.driverID != null && value.driverID.isNotEmpty));
isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty));
});
});
},
@ -111,39 +110,35 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
Container(
margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration(
border: Border.all(
margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration(
border: Border.all(
color: getStatusBackgroundColor(),
style: BorderStyle.solid,
width: 5.0,
),
color: getStatusBackgroundColor(),
style: BorderStyle.solid,
width: 5.0,
),
color: getStatusBackgroundColor(),
borderRadius: BorderRadius.circular(30.0)),
child: model.orderListModel[0].orderStatusId == 30 ||
model.orderListModel[0].orderStatusId == 997 ||
model.orderListModel[0].orderStatusId == 994
borderRadius: BorderRadius.circular(30.0)),
child: model.orderListModel[0].orderStatusId == 30 || model.orderListModel[0].orderStatusId == 997 || model.orderListModel[0].orderStatusId == 994
// deliveredOrderList[index].orderStatusId == 30
? Text(
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
: Text(
languageID == "ar"
? model.orderListModel[0].orderStatusn.toString()
: model.orderListModel[0].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
)
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
: Text(
languageID == "ar" ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
)
// Text(
// languageID == "ar"
// ? model.orderListModel[0].orderStatusn
@ -155,64 +150,50 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
// fontWeight: FontWeight.bold,
// ),
// ),
),
),
],
),
Container(
margin: EdgeInsets.only(left: 10.0, top: 13.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}",
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
"${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}",
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address1
.toString()
,
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
]),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address1.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
]),
),
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address2
.toString()
+
' ' +
model.orderListModel[0].shippingAddress
.country
.toString() +
' ' +
model.orderListModel[0].shippingAddress
.zipPostalCode
.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
]),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address2.toString() +
' ' +
model.orderListModel[0].shippingAddress.country.toString() +
' ' +
model.orderListModel[0].shippingAddress.zipPostalCode.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
]),
),
Container(
child: Row(
@ -227,9 +208,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text(
model.orderListModel[0].shippingAddress
.phoneNumber
.toString(),
model.orderListModel[0].shippingAddress.phoneNumber.toString(),
style: TextStyle(
fontSize: 15.0,
),
@ -267,9 +246,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
Container(
child: flutterImage.Image.asset(
model.orderListModel[0]
.shippingRateComputationMethodSystemName !=
"Shipping.Aramex"
model.orderListModel[0].shippingRateComputationMethodSystemName != "Shipping.Aramex"
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,
@ -320,8 +297,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: Text(
model.orderListModel[0].paymentName
.toString(),
model.orderListModel[0].paymentName.toString(),
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
@ -368,9 +344,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}",
qyt: model.orderListModel[0].orderItems[index].quantity.toString(),
isOrderDetails: true,
imgs: model.orderListModel[0].orderItems[index].product.images != null &&
model.orderListModel[0].orderItems[index].product.images.length != 0
? model.orderListModel[0].orderItems[index].product.images[0].src.toString() : null,
imgs: model.orderListModel[0].orderItems[index].product.images != null && model.orderListModel[0].orderItems[index].product.images.length != 0
? model.orderListModel[0].orderItems[index].product.images[0].src.toString()
: null,
status: model.orderListModel[0].orderStatusId,
product: model.orderListModel[0].orderItems[index].product,
),
@ -421,8 +397,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
Text(
model.orderListModel[0].orderSubtotalExclTax
.toString(),
model.orderListModel[0].orderSubtotalExclTax.toString(),
style: TextStyle(
fontSize: 13.0,
),
@ -460,8 +435,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
Text(
model.orderListModel[0].orderShippingExclTax
.toString(),
model.orderListModel[0].orderShippingExclTax.toString(),
style: TextStyle(
fontSize: 13.0,
),
@ -555,23 +529,16 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
print(model.orderListModel.toString());
print("calc = ${5.9 * 3}");
// TODO MOSA
openPayment(
model.orderListModel[0], model.user);
openPayment(model.orderListModel[0], model.user);
},
child: Container(
// margin: EdgeInsets.only(top: 20.0),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
height: 50.0,
color: Colors.transparent,
child: Container(
padding: EdgeInsets.only(
left: 130.0, right: 130.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 4.0),
color: Colors.green,
borderRadius: BorderRadius.circular(5.0)),
padding: EdgeInsets.only(left: 130.0, right: 130.0),
decoration:
BoxDecoration(border: Border.all(color: Colors.green, style: BorderStyle.solid, width: 4.0), color: Colors.green, borderRadius: BorderRadius.circular(5.0)),
child: Center(
child: Text(
TranslationBase.of(context).payOnline,
@ -589,8 +556,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
isCancel
? InkWell(
onTap: () {
presentConfirmDialog(
model, widget.orderModel.id);
presentConfirmDialog(model, widget.orderModel.id);
// model.orderListModel[0].id//(widget.orderModel.id));
//
},
@ -601,10 +567,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Center(
child: Text(
TranslationBase.of(context).cancelOrder,
style: TextStyle(
color: Colors.red[900],
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline),
style: TextStyle(color: Colors.red[900], fontWeight: FontWeight.bold, decoration: TextDecoration.underline),
),
),
),
@ -623,12 +586,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
color: Colors.transparent,
child: Center(
child: Text(
TranslationBase.of(context)
.trackDeliveryDriver,
style: TextStyle(
color: Colors.green[900],
fontWeight: FontWeight.normal,
decoration: TextDecoration.none),
TranslationBase.of(context).trackDeliveryDriver,
style: TextStyle(color: Colors.green[900], fontWeight: FontWeight.normal, decoration: TextDecoration.none),
),
),
),
@ -646,20 +605,13 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Color getStatusBackgroundColor() {
print(widget.orderModel.orderStatusId);
// if(orderStatus == 'delivered')
if (widget.orderModel.orderStatusId == 30 ||
widget.orderModel.orderStatusId == 997 ||
widget.orderModel.orderStatusId == 994)
if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994)
return Colors.blue[700];
else if (widget.orderModel.orderStatusId == 20 ||
widget.orderModel.orderStatusId == 995 ||
widget.orderModel.orderStatusId == 998 ||
widget.orderModel.orderStatusId == 999)
else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999)
return Colors.green;
else if (widget.orderModel.orderStatusId == 10)
return Colors.orange[300];
else if (widget.orderModel.orderStatusId == 40 ||
widget.orderModel.orderStatusId == 996 ||
widget.orderModel.orderStatusId == 200) return Colors.red[900];
else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900];
}
getCancelOrder(dataIsCancel) {
@ -693,8 +645,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
confirmMessage: TranslationBase.of(context).confirmCancellation,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () =>
cancelFunction.getCanceledOrder(id, context).then((value) {
okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value) {
print(":D");
print(value);
// Navigator.pop(context);
@ -730,20 +681,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
OrderDetailModel order,
AuthenticatedUser authenticatedUser,
) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(
order,
order.orderTotal,
'ePharmacy Order',
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);
browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser);
}
onBrowserLoadStart(String url) {
@ -770,14 +711,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
AppToast.showSuccessToast(message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
} else {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
}
}
}

@ -23,17 +23,14 @@ class PharmacyAddressesPage extends StatefulWidget {
final bool isUpdate;
const PharmacyAddressesPage(
{Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState})
: super(key: key);
const PharmacyAddressesPage({Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState}) : super(key: key);
@override
_PharmacyAddressesState createState() => _PharmacyAddressesState();
}
class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
void navigateToAddressPage(
BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) {
void navigateToAddressPage(BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) {
Navigator.push(
ctx,
FadePage(
@ -49,7 +46,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
return BaseView<PharmacyAddressesViewModel>(
onModelReady: (model) => model.getAddressesList(),
builder: (_, model, wi) => AppScaffold(
appBarTitle: widget.isUpdate?TranslationBase.of(context).changeAddress:"Add Address",
appBarTitle: widget.isUpdate ? TranslationBase.of(context).changeAddress : TranslationBase.of(context).addAddress,
isShowAppBar: true,
isPharmacy: true,
baseViewModel: model,
@ -124,20 +121,15 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
vPadding: 8,
handler: () async {
//TODO Elham*
widget.orderPreviewViewModel.paymentCheckoutData
.address =
Addresses.fromJson(
model.addresses[model.selectedAddressIndex].toJson());
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
GifLoaderDialogUtils.showMyDialog(context);
await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo);
await widget.orderPreviewViewModel.getShoppingCart();
// widget.changeMainState();
GifLoaderDialogUtils.hideDialog(context);
model.saveSelectedAddressLocally(
model.addresses[model.selectedAddressIndex]);
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
_navigateToPaymentOption(model);
},
),
@ -150,7 +142,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
}
_navigateToPaymentOption(model) {
if(widget.isUpdate) {
if (widget.isUpdate) {
print("sfsf");
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
@ -168,8 +160,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
setState(() {
if (result != null) {
var paymentOption = result;
widget.orderPreviewViewModel.paymentCheckoutData.paymentOption =
paymentOption;
widget.orderPreviewViewModel.paymentCheckoutData.paymentOption = paymentOption;
}
// widget.changeMainState();
})
@ -184,8 +175,7 @@ class AddressItemWidget extends StatelessWidget {
final bool isSelected;
final Function(AddressInfo) onTabEditAddress;
AddressItemWidget(this.model, this.address, this.selectAddress,
this.isSelected, this.onTabEditAddress);
AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress);
@override
Widget build(BuildContext context) {
@ -211,18 +201,13 @@ class AddressItemWidget extends StatelessWidget {
decoration: new BoxDecoration(
color: !isSelected ? Colors.white : Colors.green,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0),
border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0),
),
child: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: isSelected
? Colors.white
: Colors.transparent,
color: isSelected ? Colors.white : Colors.transparent,
size: 25,
),
),
@ -235,8 +220,7 @@ class AddressItemWidget extends StatelessWidget {
Expanded(
child: Container(
child: Container(
margin:
EdgeInsets.symmetric(vertical: 12, horizontal: 12),
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -299,8 +283,7 @@ class AddressItemWidget extends StatelessWidget {
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: SizedBox(
child: Container(
width: 1,
@ -318,21 +301,13 @@ class AddressItemWidget extends StatelessWidget {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
title: "Are you sure want to delete",
confirmMessage:
"${address.address1} ${address.address2}",
okText:
TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context)
.cancel_nocaps,
confirmMessage: "${address.address1} ${address.address2}",
okText: TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
model
.deleteAddresses(address)
.then((_) {
ConfirmDialog.closeAlertDialog(
context);
AppToast.showErrorToast(
message:
"Address has been deleted");
model.deleteAddresses(address).then((_) {
ConfirmDialog.closeAlertDialog(context);
AppToast.showErrorToast(message: "Address has been deleted");
})
},
cancelFunction: () => {});

Loading…
Cancel
Save