Pharmacy fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 6495e931d7
commit d630c6c45f

@ -636,7 +636,7 @@ const Map localizedValues = {
"compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"}, "compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"},
"addQuantity": {"en": "You should add quantity", "ar": "اختر الكمية"}, "addQuantity": {"en": "You should add quantity", "ar": "اختر الكمية"},
"addToCartMsg": {"en": "You have added a product to the cart", "ar": "تمت اضافة المنتج بنجاح"}, "addToCartMsg": {"en": "You have added a product to the cart", "ar": "تمت اضافة المنتج بنجاح"},
"addToWishlistMsg": {"en": "You have added a product to the Wishlist", "ar": "تمت الاضافة لقائمة الرغبات"}, "addToWishlistMsg": {"en": "You have added a product to the Wishlist", "ar": "تمت الاضافة لقائمة المفضله"},
"notifyMeMsg": {"en": "You will be notified when product available", "ar": "سيتم اخبارك في حال توفر المنتج"}, "notifyMeMsg": {"en": "You will be notified when product available", "ar": "سيتم اخبارك في حال توفر المنتج"},
"removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"}, "removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"},
"min": {"en": "Min", "ar": "اقل"}, "min": {"en": "Min", "ar": "اقل"},

@ -46,10 +46,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getProductLocationData() async { Future getProductLocationData(String productSKU) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _productDetailService.getProductAvailabiltyDetail(); await _productDetailService.getProductAvailabiltyDetail(productSKU);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
error = _productDetailService.error; error = _productDetailService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
@ -15,8 +14,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -111,8 +108,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
await addToWishlistFunction(itemID: itemID, model: model); await addToWishlistFunction(itemID: itemID, model: model);
}, },
deleteFromWishlistFunction: () async { deleteFromWishlistFunction: () async {
await deleteFromWishlistFunction( await deleteFromWishlistFunction(itemID: itemID, model: model);
itemID: itemID, model: model);
}, },
isInWishList: isInWishList, isInWishList: isInWishList,
addToCartFunction: addToCartFunction, addToCartFunction: addToCartFunction,
@ -133,8 +129,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
if (widget.product.discountDescription != null) if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
DiscountDescription(product: widget.product)
], ],
), ),
), ),
@ -152,21 +147,15 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
setState(() {}); setState(() {});
}, },
deleteFromWishlistFunction: (item) { deleteFromWishlistFunction: (item) {
deleteFromWishlistFunction( deleteFromWishlistFunction(itemID: item, model: model);
itemID: item, model: model);
setState(() {}); setState(() {});
}, },
notifyMeWhenAvailable: (context, itemId) { notifyMeWhenAvailable: (context, itemId) {
notifyMeWhenAvailable( notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model);
itemId: itemId,
customerId: customerId,
model: model);
}, },
isInWishList: isInWishList, isInWishList: isInWishList,
isStockAvailable: model.isStockAvailable, isStockAvailable: model.isStockAvailable,
stockAvailability: projectViewModel.isArabic stockAvailability: projectViewModel.isArabic ? model.stockAvailabilityn : model.stockAvailability,
? model.stockAvailabilityn
: model.stockAvailability,
), ),
), ),
SizedBox( SizedBox(
@ -179,8 +168,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
vertical: 15, horizontal: 10),
child: Texts( child: Texts(
TranslationBase.of(context).specification, TranslationBase.of(context).specification,
fontSize: 15, fontSize: 15,
@ -217,16 +205,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isDetails color: isDetails ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
) )
], ],
), ),
@ -237,14 +221,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
if (widget.product.approvedTotalReviews > if (widget.product.approvedTotalReviews > 0) {
0) { GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog( await model.getProductReviewsData(widget.product.id);
context); GifLoaderDialogUtils.hideDialog(context);
await model.getProductReviewsData(
widget.product.id);
GifLoaderDialogUtils.hideDialog(
context);
} else { } else {
model.clearReview(); model.clearReview();
} }
@ -256,16 +236,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isReviews color: isReviews ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -276,9 +252,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model.getProductLocationData(widget.product.sku);
await model.getProductLocationData();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
setState(() { setState(() {
@ -289,16 +264,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isAvailability color: isAvailability ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -327,24 +298,22 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
RecommendedProducts( if (projectViewModel.isLogin)
product: widget.product, RecommendedProducts(
productDetailViewModel: model, product: widget.product,
addToWishlistFunction: (itemID) async { productDetailViewModel: model,
await addToWishlistFunction( addToWishlistFunction: (itemID) async {
itemID: itemID, model: model); await addToWishlistFunction(itemID: itemID, model: model);
}, },
deleteFromWishlistFunction: (itemID) async { deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction( await deleteFromWishlistFunction(itemID: itemID, model: model);
itemID: itemID, model: model); },
}, )
)
], ],
), ),
), ),
// : AppCircularProgressIndicator(), // : AppCircularProgressIndicator(),
bottomSheet: model.state == ViewState.Idle || bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal
model.state == ViewState.ErrorLocal
? FooterWidget( ? FooterWidget(
model.isStockAvailable, model.isStockAvailable,
widget.product.orderMaximumQuantity, widget.product.orderMaximumQuantity,
@ -361,8 +330,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)); ));
} }
addToShoppingCartFunction( addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
{quantity, itemID, ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID, context); await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -392,7 +360,6 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
} }
} }
notifyMeWhenAvailable( notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async {
{itemId, customerId, ProductDetailViewModel model, context}) async {
await model.notifyMe(customerId, itemId, context); await model.notifyMe(customerId, itemId, context);
} }

File diff suppressed because it is too large Load Diff

@ -66,7 +66,7 @@ class ProductDetailService extends BaseService {
}); });
} }
Future getProductAvailabiltyDetail() async { Future getProductAvailabiltyDetail(String productSKU) async {
hasError = false; hasError = false;
Map<String, dynamic> request; Map<String, dynamic> request;
@ -76,7 +76,7 @@ class ProductDetailService extends BaseService {
// "IPAdress": "10.20.10.20", // "IPAdress": "10.20.10.20",
// "LanguageID": 2, // "LanguageID": 2,
// "PatientOutSA": 0, // "PatientOutSA": 0,
// "SKU": "6720020025", "SKU": productSKU,
// "SessionID": null, // "SessionID": null,
// "VersionID": 5.6, // "VersionID": 5.6,
// "generalid": "Cs2020@2016\$2958", // "generalid": "Cs2020@2016\$2958",

Loading…
Cancel
Save