Pharmacy security updates applied

merge-requests/520/head
haroon amjad 4 years ago
parent 4823919fcb
commit 79d99dd48a

@ -21,6 +21,7 @@ const THEME_VALUE = 'is_vibration';
const MAIN_USER = 'main-user';
const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited';
const PHARMACY_CUSTOMER_ID = 'costumer-id';
const PHARMACY_CUSTOMER_GUID = 'customer-guid';
const PHARMACY_CUSTOMER_OBJECT = 'pharmacy-customer-object';
const IS_ROBOT_VISIBLE = 'robot-visible';
const IS_ROBOT_INIT = 'robot-init';

@ -39,7 +39,8 @@ class CustomerAddressesService extends BaseService {
Map<String, String> queryParams = {'fields': 'addresses'};
hasError = false;
var customerID = await sharedPref.getObject(PHARMACY_CUSTOMER_ID);
await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID", onSuccess: (dynamic response, int statusCode) {
var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID/$customerGUID", onSuccess: (dynamic response, int statusCode) {
addressesList.clear();
response["customers"][0]["addresses"].forEach((data) {
addressesList.add(AddressInfo.fromJson(data));

@ -21,10 +21,11 @@ class OrderPreviewService extends BaseService {
Future getAddresses() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
var customerGUID = await sharedPref.getString(PHARMACY_CUSTOMER_GUID);
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/$customerGUID", onSuccess: (dynamic response, int statusCode) {
addresses.clear();
response['customers'][0]['addresses'].forEach((item) {
addresses.add(Addresses.fromJson(item));
@ -58,13 +59,15 @@ class OrderPreviewService extends BaseService {
Future<Map> getShoppingCart() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
if (customerId == null) return null;
Map<String, String> queryParams = {'shopping_cart_type': '1'};
dynamic localRes;
hasError = false;
try {
await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -22,16 +22,12 @@ class PharmacyModuleService extends BaseService {
List<PharmacyProduct> mostViewedProducts = List();
Future makeVerifyCustomer(dynamic data) async {
Map<String, String> queryParams = {
'FileNumber': data['PatientID'].toString()
};
Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()};
hasError = false;
try {
await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER,
onSuccess: (dynamic response, int statusCode) async {
await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) async {
if (response['UserName'] != null) {
sharedPref.setString(
PHARMACY_CUSTOMER_ID, response['CustomerId'].toString());
sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString());
print(response);
} else {
await createUser();
@ -57,13 +53,14 @@ class PharmacyModuleService extends BaseService {
};
hasError = false;
try {
await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER,
onSuccess: (dynamic response, int statusCode) async {
await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async {
if (!response['IsRegistered']) {
} else {
customerInfo = CustomerInfo.fromJson(response);
await sharedPref.setObject(
PHARMACY_CUSTOMER_ID, customerInfo.customerId);
print(response['customerDto']);
print(response['customerDto']['customerGuid']);
await sharedPref.setObject(PHARMACY_CUSTOMER_ID, customerInfo.customerId);
await sharedPref.setObject(PHARMACY_CUSTOMER_GUID, response['customerDto']['customerGuid']);
}
// await generatePharmacyToken();
}, onFailure: (String error, int statusCode) {
@ -83,11 +80,9 @@ class PharmacyModuleService extends BaseService {
};
hasError = false;
try {
await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER,
onSuccess: (dynamic response, int statusCode) async {
await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async {
if (response['Status'] == 200) {
await sharedPref.setString(
PHARMACY_AUTORZIE_TOKEN, response['token'].toString());
await sharedPref.setString(PHARMACY_AUTORZIE_TOKEN, response['token'].toString());
}
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -101,8 +96,7 @@ class PharmacyModuleService extends BaseService {
Future getBannerListList() async {
hasError = false;
try {
await baseAppClient.getPharmacy(GET_PHARMACY_BANNER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) {
bannerItems.clear();
response['images'].forEach((item) {
bannerItems.add(PharmacyImageObject.fromJson(item));
@ -120,8 +114,7 @@ class PharmacyModuleService extends BaseService {
if (manufacturerList.isNotEmpty) return;
Map<String, String> queryParams = {'page': '1', 'limit': '8'};
try {
await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) {
manufacturerList.clear();
response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item);
@ -147,8 +140,7 @@ class PharmacyModuleService extends BaseService {
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
};
try {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) {
bestSellerProducts.clear();
response['products'].forEach((item) {
bestSellerProducts.add(PharmacyProduct.fromJson(item));
@ -165,23 +157,18 @@ class PharmacyModuleService extends BaseService {
Future getLastVisitedProducts() async {
String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
// lastVisited = "2458,4561";
try {
await baseAppClient
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) {
lastVisitedProducts.clear();
response['products'].forEach((item) {
lastVisitedProducts.add(PharmacyProduct.fromJson(item));
});
hasError = false;
}, onFailure: (String error, int statusCode) {
hasError =
true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, "");
hasError = true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, "");
super.error = error;
});
} catch (error) {
@ -197,8 +184,7 @@ class PharmacyModuleService extends BaseService {
'id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage',
};
try {
await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, onSuccess: (dynamic response, int statusCode) {
mostViewedProducts.clear();
response['products'].forEach((item) {
mostViewedProducts.add(PharmacyProduct.fromJson(item));

@ -37,9 +37,9 @@ class OrderModelViewModel extends BaseViewModel {
Future getOrder(customerId, pageID) async {
Future getOrder(customerId, customerGUID, pageID) async {
setState(ViewState.Busy);
await _orderService.getOrder(customerId, pageID);
await _orderService.getOrder(customerId, customerGUID, pageID);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);

@ -146,7 +146,6 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
description: TranslationBase.of(context).infoCMC,

@ -1,9 +1,13 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
@ -35,8 +39,7 @@ class PaymentBottomWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
Texts(
@ -46,8 +49,7 @@ class PaymentBottomWidget extends StatelessWidget {
color: Color(0xff929295),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
@ -76,26 +78,22 @@ class PaymentBottomWidget extends StatelessWidget {
width: 1,
),
),
onPressed: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
onPressed: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null)
? () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: TranslationBase.of(context).compeleteOrderMsg
// "Order has been placed successfully!!"
);
openPayment(
model.orderListModel[0], model.authenticatedUserObject.user);
AppToast.showSuccessToast(message: TranslationBase.of(context).compeleteOrderMsg);
GifLoaderDialogUtils.hideDialog(context);
openPayment(model.orderListModel[0], model.authenticatedUserObject.user);
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
navigateToCartPage();
// Navigator.pop(context);
// Navigator.pop(context);
// Navigator.pop(context);
// Navigator.pop(context);
}
: null,
child: Padding(
@ -103,34 +101,14 @@ class PaymentBottomWidget extends StatelessWidget {
child: new Text(
"${TranslationBase.of(context).proceedPay}",
style: new TextStyle(
color: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel.paymentCheckoutData
.paymentOption !=
null)
? Colors.white
: Colors.grey.shade400,
color:
(orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.white : Colors.grey.shade400,
fontWeight: FontWeight.bold,
fontSize: 12),
),
),
color:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
disabledColor:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
color: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295),
disabledColor: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295),
),
),
],
@ -144,20 +122,10 @@ class PaymentBottomWidget extends StatelessWidget {
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) {
@ -181,19 +149,20 @@ class PaymentBottomWidget extends StatelessWidget {
});
}
navigateToCartPage() {
Navigator.pushAndRemoveUntil(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 0)), (Route<dynamic> r) => false);
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
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");
Navigator.pop(context);
Navigator.pop(context);
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);
}
}
}

@ -15,15 +15,15 @@ class OrderPage extends StatefulWidget {
// orderList({this.customerId, this.pageId});
String customerID;
String customerGUID;
OrderPage({@required this.customerID});
OrderPage({@required this.customerID, this.customerGUID});
@override
_OrderPageState createState() => _OrderPageState();
}
class _OrderPageState extends State<OrderPage>
with SingleTickerProviderStateMixin {
class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMixin {
String pageID = "1";
String customerId = "";
String order = "";
@ -57,7 +57,7 @@ class _OrderPageState extends State<OrderPage>
@override
Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>(
onModelReady: (model) => model.getOrder(widget.customerID, pageID),
onModelReady: (model) => model.getOrder(widget.customerID, widget.customerGUID, pageID),
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).order,
baseViewModel: model,
@ -105,10 +105,9 @@ class _OrderPageState extends State<OrderPage>
}
Widget getDeliveredOrder(OrderModelViewModel model) {
deliveredOrderList.clear();
for (int i = 0; i < model.orders.length; i++) {
if (model.orders[i].orderStatusId == 30 ||
model.orders[i].orderStatusId == 997 ||
model.orders[i].orderStatusId == 994) {
if (model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 || model.orders[i].orderStatusId == 994) {
deliveredOrderList.add(model.orders[i]);
}
}
@ -132,29 +131,26 @@ class _OrderPageState extends State<OrderPage>
Navigator.push(
context,
FadePage(
page: OrderDetailsPage(
orderModel:
deliveredOrderList[
index]),
));
page: OrderDetailsPage(orderModel: deliveredOrderList[index]),
)).then((value) {
model.getOrder(widget.customerID, widget.customerGUID, pageID);
getDeliveredOrder(model);
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderNumber,
TranslationBase.of(context).orderNumber,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -163,9 +159,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
deliveredOrderList[index]
.id
.toString(),
deliveredOrderList[index].id.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -182,8 +176,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderDate,
TranslationBase.of(context).orderDate,
style: TextStyle(
fontSize: 14.0,
),
@ -191,10 +184,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
deliveredOrderList[index]
.createdOnUtc
.toString()
.substring(0, 10),
deliveredOrderList[index].createdOnUtc.toString().substring(0, 10),
style: TextStyle(
fontSize: 14.0,
),
@ -208,9 +198,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.all(8.0),
child: SvgPicture.asset(
languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg'
: 'assets/images/pharmacy/arrow_right.svg',
languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : 'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,
),
@ -226,14 +214,11 @@ class _OrderPageState extends State<OrderPage>
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(
left: 13.0, right: 13.0),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue[700],
@ -241,16 +226,12 @@ class _OrderPageState extends State<OrderPage>
width: 5.0,
),
color: Colors.blue[700],
borderRadius:
BorderRadius.circular(30.0)),
child: deliveredOrderList[index].orderStatusId == 30 ||
deliveredOrderList[index].orderStatusId == 997 ||
deliveredOrderList[index].orderStatusId == 994
borderRadius: BorderRadius.circular(30.0)),
child: deliveredOrderList[index].orderStatusId == 30 || deliveredOrderList[index].orderStatusId == 997 || deliveredOrderList[index].orderStatusId == 994
// deliveredOrderList[index].orderStatusId == 30
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)
.deliveredOrder,
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -258,13 +239,7 @@ class _OrderPageState extends State<OrderPage>
),
)
: Text(
languageID == "ar"
? deliveredOrderList[index]
.orderStatusn
.toString()
: deliveredOrderList[index]
.orderStatus
.toString(),
languageID == "ar" ? deliveredOrderList[index].orderStatusn.toString() : deliveredOrderList[index].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -272,8 +247,7 @@ class _OrderPageState extends State<OrderPage>
),
)),
Container(
margin: EdgeInsets.only(
left: 8, right: 8, top: 1, bottom: 8),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
@ -282,9 +256,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
deliveredOrderList[index]
.orderTotal
.toString(),
deliveredOrderList[index].orderTotal.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -310,9 +282,7 @@ class _OrderPageState extends State<OrderPage>
children: [
Container(
child: Text(
deliveredOrderList[index]
.productCount
.toString(),
deliveredOrderList[index].productCount.toString(),
style: TextStyle(
fontSize: 14.0,
),
@ -321,8 +291,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.itemsNo,
TranslationBase.of(context).itemsNo,
style: TextStyle(
fontSize: 14.0,
),
@ -371,11 +340,9 @@ class _OrderPageState extends State<OrderPage>
}
Widget getProcessingOrder(OrderModelViewModel model) {
processingOrderList.clear();
for (int i = 0; i < model.orders.length; i++) {
if (model.orders[i].orderStatusId == 20 ||
model.orders[i].orderStatusId == 995 ||
model.orders[i].orderStatusId == 998 ||
model.orders[i].orderStatusId == 999) {
if (model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || model.orders[i].orderStatusId == 998 || model.orders[i].orderStatusId == 999) {
processingOrderList.add(model.orders[i]);
}
}
@ -396,31 +363,26 @@ class _OrderPageState extends State<OrderPage>
children: <Widget>[
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: OrderDetailsPage(
orderModel:
processingOrderList[
index])));
Navigator.push(context, FadePage(page: OrderDetailsPage(orderModel: processingOrderList[index]))).then((value) {
model.getOrder(widget.customerID, widget.customerGUID, pageID).then((value) {
getProcessingOrder(model);
});
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderNumber,
TranslationBase.of(context).orderNumber,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -429,9 +391,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
processingOrderList[index]
.id
.toString(),
processingOrderList[index].id.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -448,8 +408,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderDate,
TranslationBase.of(context).orderDate,
style: TextStyle(
fontSize: 14.0,
),
@ -457,10 +416,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
processingOrderList[index]
.createdOnUtc
.toString()
.substring(0, 10),
processingOrderList[index].createdOnUtc.toString().substring(0, 10),
style: TextStyle(
fontSize: 14.0,
),
@ -474,9 +430,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.all(8.0),
child: SvgPicture.asset(
languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg'
: 'assets/images/pharmacy/arrow_right.svg',
languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : 'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,
),
@ -492,14 +446,11 @@ class _OrderPageState extends State<OrderPage>
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(
left: 13.0, right: 13.0),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
@ -507,17 +458,15 @@ class _OrderPageState extends State<OrderPage>
width: 5.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(30.0)),
child: processingOrderList[index].orderStatusId == 20 ||
processingOrderList[index].orderStatusId == 995 ||
processingOrderList[index].orderStatusId == 998 ||
processingOrderList[index].orderStatusId == 999
borderRadius: BorderRadius.circular(30.0)),
child: processingOrderList[index].orderStatusId == 20 ||
processingOrderList[index].orderStatusId == 995 ||
processingOrderList[index].orderStatusId == 998 ||
processingOrderList[index].orderStatusId == 999
// processingOrderList[index].orderStatusId == 20
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)
.processingOrder,
TranslationBase.of(context).processingOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -525,13 +474,7 @@ class _OrderPageState extends State<OrderPage>
),
)
: Text(
languageID == "ar"
? processingOrderList[index]
.orderStatusn
.toString()
: processingOrderList[index]
.orderStatus
.toString(),
languageID == "ar" ? processingOrderList[index].orderStatusn.toString() : processingOrderList[index].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -539,8 +482,7 @@ class _OrderPageState extends State<OrderPage>
),
)),
Container(
margin: EdgeInsets.only(
left: 8, right: 8, top: 1, bottom: 8),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
@ -549,9 +491,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
processingOrderList[index]
.orderTotal
.toString(),
processingOrderList[index].orderTotal.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -577,9 +517,7 @@ class _OrderPageState extends State<OrderPage>
children: [
Container(
child: Text(
processingOrderList[index]
.productCount
.toString(),
processingOrderList[index].productCount.toString(),
style: TextStyle(
fontSize: 14.0,
),
@ -588,8 +526,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.itemsNo,
TranslationBase.of(context).itemsNo,
style: TextStyle(
fontSize: 14.0,
),
@ -817,6 +754,7 @@ class _OrderPageState extends State<OrderPage>
}
Widget getPendingOrder(OrderModelViewModel model) {
pendingOrderList.clear();
for (int i = 0; i < model.orders.length; i++) {
if (model.orders[i].orderStatusId == 10) {
pendingOrderList.add(model.orders[i]);
@ -839,32 +777,26 @@ class _OrderPageState extends State<OrderPage>
children: <Widget>[
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: OrderDetailsPage(
orderModel:
pendingOrderList[
index])));
Navigator.push(context, FadePage(page: OrderDetailsPage(orderModel: pendingOrderList[index]))).then((value) {
model.getOrder(widget.customerID, widget.customerGUID, pageID).then((value) {
getPendingOrder(model);
});
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Container(
margin:
EdgeInsets.only(right: 5),
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderNumber,
TranslationBase.of(context).orderNumber,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -873,9 +805,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
pendingOrderList[index]
.id
.toString(),
pendingOrderList[index].id.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -890,11 +820,9 @@ class _OrderPageState extends State<OrderPage>
Row(
children: [
Container(
margin:
EdgeInsets.only(right: 5),
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderDate,
TranslationBase.of(context).orderDate,
style: TextStyle(
fontSize: 14.0,
),
@ -902,10 +830,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
pendingOrderList[index]
.createdOnUtc
.toString()
.substring(0, 10),
pendingOrderList[index].createdOnUtc.toString().substring(0, 10),
style: TextStyle(
fontSize: 14.0,
),
@ -919,9 +844,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.all(8.0),
child: SvgPicture.asset(
languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg'
: 'assets/images/pharmacy/arrow_right.svg',
languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : 'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,
),
@ -937,13 +860,11 @@ class _OrderPageState extends State<OrderPage>
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
padding: EdgeInsets.only(
left: 13.0, right: 13.0),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange[300],
@ -951,15 +872,11 @@ class _OrderPageState extends State<OrderPage>
width: 5.0,
),
color: Colors.orange[300],
borderRadius:
BorderRadius.circular(30.0)),
child: pendingOrderList[index]
.orderStatusId ==
10
borderRadius: BorderRadius.circular(30.0)),
child: pendingOrderList[index].orderStatusId == 10
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)
.pendingOrder,
TranslationBase.of(context).pendingOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -967,13 +884,7 @@ class _OrderPageState extends State<OrderPage>
),
)
: Text(
languageID == "ar"
? pendingOrderList[index]
.orderStatusn
.toString()
: pendingOrderList[index]
.orderStatus
.toString(),
languageID == "ar" ? pendingOrderList[index].orderStatusn.toString() : pendingOrderList[index].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -988,12 +899,9 @@ class _OrderPageState extends State<OrderPage>
Row(
children: [
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
pendingOrderList[index]
.orderTotal
.toString(),
pendingOrderList[index].orderTotal.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1001,11 +909,9 @@ class _OrderPageState extends State<OrderPage>
),
),
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.sar,
TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1021,20 +927,16 @@ class _OrderPageState extends State<OrderPage>
children: [
Container(
child: Text(
pendingOrderList[index]
.productCount
.toString(),
pendingOrderList[index].productCount.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.itemsNo,
TranslationBase.of(context).itemsNo,
style: TextStyle(
fontSize: 14.0,
),
@ -1084,10 +986,9 @@ class _OrderPageState extends State<OrderPage>
}
Widget getCancelledOrder(OrderModelViewModel model) {
cancelledOrderList.clear();
for (int i = 0; i < model.orders.length; i++) {
if (model.orders[i].orderStatusId == 40 ||
model.orders[i].orderStatus == 996 ||
model.orders[i].orderStatusId == 200) {
if (model.orders[i].orderStatusId == 40 || model.orders[i].orderStatus == 996 || model.orders[i].orderStatusId == 200) {
cancelledOrderList.add(model.orders[i]);
}
}
@ -1108,32 +1009,26 @@ class _OrderPageState extends State<OrderPage>
children: <Widget>[
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: OrderDetailsPage(
orderModel:
cancelledOrderList[
index])));
Navigator.push(context, FadePage(page: OrderDetailsPage(orderModel: cancelledOrderList[index]))).then((value) {
model.getOrder(widget.customerID, widget.customerGUID, pageID).then((value) {
getCancelledOrder(model);
});
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Container(
margin:
EdgeInsets.only(right: 5),
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderNumber,
TranslationBase.of(context).orderNumber,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1142,9 +1037,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
cancelledOrderList[index]
.id
.toString(),
cancelledOrderList[index].id.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1159,11 +1052,9 @@ class _OrderPageState extends State<OrderPage>
Row(
children: [
Container(
margin:
EdgeInsets.only(right: 5),
margin: EdgeInsets.only(right: 5),
child: Text(
TranslationBase.of(context)
.orderDate,
TranslationBase.of(context).orderDate,
style: TextStyle(
fontSize: 14.0,
),
@ -1171,10 +1062,7 @@ class _OrderPageState extends State<OrderPage>
),
Container(
child: Text(
cancelledOrderList[index]
.createdOnUtc
.toString()
.substring(0, 10),
cancelledOrderList[index].createdOnUtc.toString().substring(0, 10),
style: TextStyle(
fontSize: 14.0,
),
@ -1188,9 +1076,7 @@ class _OrderPageState extends State<OrderPage>
Container(
margin: EdgeInsets.all(8.0),
child: SvgPicture.asset(
languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg'
: 'assets/images/pharmacy/arrow_right.svg',
languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : 'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,
),
@ -1206,17 +1092,11 @@ class _OrderPageState extends State<OrderPage>
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 8,
right: 8,
top: 1,
bottom: 8),
padding: EdgeInsets.only(
left: 10.0, right: 10.0),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.red[900],
@ -1224,15 +1104,11 @@ class _OrderPageState extends State<OrderPage>
width: 5.0,
),
color: Colors.red[900],
borderRadius:
BorderRadius.circular(30.0)),
child: cancelledOrderList[index]
.orderStatusId ==
40
borderRadius: BorderRadius.circular(30.0)),
child: cancelledOrderList[index].orderStatusId == 40
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)
.cancelledOrder,
TranslationBase.of(context).cancelledOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -1240,13 +1116,7 @@ class _OrderPageState extends State<OrderPage>
),
)
: Text(
languageID == "ar"
? cancelledOrderList[index]
.orderStatusn
.toString()
: cancelledOrderList[index]
.orderStatus
.toString(),
languageID == "ar" ? cancelledOrderList[index].orderStatusn.toString() : cancelledOrderList[index].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@ -1254,20 +1124,16 @@ class _OrderPageState extends State<OrderPage>
),
)),
Container(
margin: EdgeInsets.only(
left: 8, right: 8, top: 1, bottom: 8),
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Row(
children: [
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
cancelledOrderList[index]
.orderTotal
.toString(),
cancelledOrderList[index].orderTotal.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1275,11 +1141,9 @@ class _OrderPageState extends State<OrderPage>
),
),
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.sar,
TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@ -1295,20 +1159,16 @@ class _OrderPageState extends State<OrderPage>
children: [
Container(
child: Text(
cancelledOrderList[index]
.productCount
.toString(),
cancelledOrderList[index].productCount.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
Container(
margin:
EdgeInsets.only(left: 5),
margin: EdgeInsets.only(left: 5),
child: Text(
TranslationBase.of(context)
.itemsNo,
TranslationBase.of(context).itemsNo,
style: TextStyle(
fontSize: 14.0,
),

@ -557,8 +557,6 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
? InkWell(
onTap: () {
presentConfirmDialog(model, widget.orderModel.id);
// model.orderListModel[0].id//(widget.orderModel.id));
//
},
child: Container(
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
@ -645,18 +643,12 @@ 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) {
print(":D");
print(value);
// Navigator.pop(context);
Navigator.push(
context,
FadePage(
page: OrderPage(
// customerID: model.ordersList[0].customerId.toString()
customerID: widget.orderModel.customerId.toString())),
);
}),
okFunction: () {
Navigator.pop(context);
cancelFunction.getCanceledOrder(id, context).then((value) {
Navigator.pop(context);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}

@ -41,6 +41,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
bool isLogin = false;
String firstName;
String customerId;
String customerGUID;
String lastName, mobileNo, identificationNo;
int languageId;
@ -50,11 +51,15 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
getCustomer() async {
String custID;
String custGUID;
custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
setState(() {
customerId = custID;
customerGUID = custGUID;
});
print("customer Id is" + customerId);
print("customer GUID is" + customerGUID);
return customerId;
}
@ -91,8 +96,9 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
return BaseView<OrderModelViewModel>(
onModelReady: (model) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
GifLoaderDialogUtils.showMyDialog(context);
model.getOrder(customerId, page_id);
model.getOrder(customerId, customerGUID, page_id);
GifLoaderDialogUtils.hideDialog(context);
},
builder: (_, model, wi) => AppScaffold(
@ -170,7 +176,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
AppToast.showErrorToast(message: "Customer not found");
return;
}
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId)));
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID)));
},
child: Column(
children: <Widget>[

@ -21,8 +21,9 @@ class OrderDetailsService extends BaseService{
Future getOrderDetails(OrderId) async {
var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
hasError = false;
await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId,
await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$customerGUID",
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
response['orders'].forEach((item) {

@ -5,40 +5,38 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class OrderService extends BaseService{
class OrderService extends BaseService {
AppSharedPreferences sharedPref = AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal();
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
List<Orders> _orderList = List();
List<Orders> get orderList => _orderList;
String url ="";
String url = "";
Future getOrder(customerId, pageId) async {
Future getOrder(customerId, customerGUID, pageId) async {
hasError = false;
// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368";
// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId";
url =GET_ORDER+"customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId";
// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId";
url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID";
print(url);
await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
response['orders'].forEach((item) {
_orderList.add(Orders.fromJson(item));
});
print(_orderList.length);
print(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
response['orders'].forEach((item) {
_orderList.add(Orders.fromJson(item));
});
print(_orderList.length);
print(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
// Future getProductReview(orderId) async {
// print("step 1");
// hasError = false;
@ -59,7 +57,6 @@ class OrderService extends BaseService{
// });
// }
// Future<Map> getOrder(BuildContext context ) async {
//
// if (await this.sharedPref.getObject(USER_PROFILE) != null) {
@ -80,4 +77,4 @@ class OrderService extends BaseService{
// });
// return Future.value(localRes);
// }
}
}

@ -15,13 +15,14 @@ class PharmacyAddressService extends BaseService {
Future<List<AddressInfo>> getAddresses() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
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 {
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) async {
addresses.clear();
var savedAddress = await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS);
if (savedAddress != null) {

Loading…
Cancel
Save