diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 54a04592..aef5913f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -636,7 +636,7 @@ const Map localizedValues = { "compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"}, "addQuantity": {"en": "You should add quantity", "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": "سيتم اخبارك في حال توفر المنتج"}, "removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"}, "min": {"en": "Min", "ar": "اقل"}, diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 68483a93..df895e28 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -46,10 +46,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProductLocationData() async { + Future getProductLocationData(String productSKU) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.getProductAvailabiltyDetail(); + await _productDetailService.getProductAvailabiltyDetail(productSKU); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 51580c2c..ad802349 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -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/project_view_model.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/recommended_products.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/widgets/data_display/text.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:provider/provider.dart'; @@ -111,8 +108,7 @@ class __ProductDetailPageState extends State { await addToWishlistFunction(itemID: itemID, model: model); }, deleteFromWishlistFunction: () async { - await deleteFromWishlistFunction( - itemID: itemID, model: model); + await deleteFromWishlistFunction(itemID: itemID, model: model); }, isInWishList: isInWishList, addToCartFunction: addToCartFunction, @@ -133,8 +129,7 @@ class __ProductDetailPageState extends State { fit: BoxFit.contain, ), ), - if (widget.product.discountDescription != null) - DiscountDescription(product: widget.product) + if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) ], ), ), @@ -152,21 +147,15 @@ class __ProductDetailPageState extends State { setState(() {}); }, deleteFromWishlistFunction: (item) { - deleteFromWishlistFunction( - itemID: item, model: model); + deleteFromWishlistFunction(itemID: item, model: model); setState(() {}); }, notifyMeWhenAvailable: (context, itemId) { - notifyMeWhenAvailable( - itemId: itemId, - customerId: customerId, - model: model); + notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model); }, isInWishList: isInWishList, isStockAvailable: model.isStockAvailable, - stockAvailability: projectViewModel.isArabic - ? model.stockAvailabilityn - : model.stockAvailability, + stockAvailability: projectViewModel.isArabic ? model.stockAvailabilityn : model.stockAvailability, ), ), SizedBox( @@ -179,8 +168,7 @@ class __ProductDetailPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 15, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -217,16 +205,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isDetails - ? Colors.green - : Colors.transparent, + color: isDetails ? Colors.green : Colors.transparent, ) ], ), @@ -237,14 +221,10 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - if (widget.product.approvedTotalReviews > - 0) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductReviewsData( - widget.product.id); - GifLoaderDialogUtils.hideDialog( - context); + if (widget.product.approvedTotalReviews > 0) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductReviewsData(widget.product.id); + GifLoaderDialogUtils.hideDialog(context); } else { model.clearReview(); } @@ -256,16 +236,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isReviews - ? Colors.green - : Colors.transparent, + color: isReviews ? Colors.green : Colors.transparent, ), ], ), @@ -276,9 +252,8 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductLocationData(); + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductLocationData(widget.product.sku); GifLoaderDialogUtils.hideDialog(context); setState(() { @@ -289,16 +264,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isAvailability - ? Colors.green - : Colors.transparent, + color: isAvailability ? Colors.green : Colors.transparent, ), ], ), @@ -327,24 +298,22 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - RecommendedProducts( - product: widget.product, - productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction( - itemID: itemID, model: model); - }, - deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction( - itemID: itemID, model: model); - }, - ) + if (projectViewModel.isLogin) + RecommendedProducts( + product: widget.product, + productDetailViewModel: model, + addToWishlistFunction: (itemID) async { + await addToWishlistFunction(itemID: itemID, model: model); + }, + deleteFromWishlistFunction: (itemID) async { + await deleteFromWishlistFunction(itemID: itemID, model: model); + }, + ) ], ), ), // : AppCircularProgressIndicator(), - bottomSheet: model.state == ViewState.Idle || - model.state == ViewState.ErrorLocal + bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal ? FooterWidget( model.isStockAvailable, widget.product.orderMaximumQuantity, @@ -361,8 +330,7 @@ class __ProductDetailPageState extends State { )); } - addToShoppingCartFunction( - {quantity, itemID, ProductDetailViewModel model}) async { + addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { GifLoaderDialogUtils.showMyDialog(context); await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); @@ -392,7 +360,6 @@ class __ProductDetailPageState extends State { } } -notifyMeWhenAvailable( - {itemId, customerId, ProductDetailViewModel model, context}) async { +notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { await model.notifyMe(customerId, itemId, context); } diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 25c0f939..070749d8 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -13,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; @@ -30,14 +28,12 @@ class SubCategorisePage extends StatefulWidget { String title; String parentId; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); SubCategorisePage({this.id, this.parentId, this.title}); @override - _SubCategorisePageState createState() => - _SubCategorisePageState(id: id, title: title, parentId: parentId); + _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); } class _SubCategorisePageState extends State { @@ -72,6 +68,7 @@ class _SubCategorisePageState extends State { builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( appBarTitle: title, isBottomBar: false, isShowAppBar: true, @@ -293,24 +290,24 @@ class _SubCategorisePageState extends State { ), ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon(Icons.wrap_text), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon(Icons.wrap_text), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of(context).refine, // 'Refine', fontWeight: FontWeight.w600, ), @@ -592,8 +589,8 @@ class _SubCategorisePageState extends State { ""; for (CategoriseParentModel category in entityList) { - if (categoriesId == - "") { + if (categoriesId =="") { + categoriesId = category.id; } else { @@ -602,12 +599,12 @@ class _SubCategorisePageState extends State { } } String - brandIds = - ""; + brandIds =""; + for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == - "") { + if (brandIds =="") { + brandIds = brand.id; } else { @@ -1270,8 +1267,7 @@ class _SubCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1279,8 +1275,7 @@ class _SubCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 47fefded..e3e0fb7f 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -66,7 +66,7 @@ class ProductDetailService extends BaseService { }); } - Future getProductAvailabiltyDetail() async { + Future getProductAvailabiltyDetail(String productSKU) async { hasError = false; Map request; @@ -76,7 +76,7 @@ class ProductDetailService extends BaseService { // "IPAdress": "10.20.10.20", // "LanguageID": 2, // "PatientOutSA": 0, - // "SKU": "6720020025", + "SKU": productSKU, // "SessionID": null, // "VersionID": 5.6, // "generalid": "Cs2020@2016\$2958",