merge-update-with-lab-changes
haroon amjad 4 years ago
parent 13a07ea7ae
commit 333b41632c

@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future notifyMe(customerId, itemID, ) async { Future notifyMe(customerId, itemID) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _productDetailService.notifyMe(customerId, itemID, ); await _productDetailService.notifyMe(customerId, itemID);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
error = _productDetailService.error; error = _productDetailService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
@ -5,7 +6,6 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta
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/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/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -252,17 +252,19 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Column( Column(
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: model.isStockAvailable
GifLoaderDialogUtils.showMyDialog(context); ? () async {
await model.getProductLocationData(widget.product.sku); GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.hideDialog(context); await model.getProductLocationData(widget.product.sku);
GifLoaderDialogUtils.hideDialog(context);
// //
setState(() { setState(() {
isDetails = false; isDetails = false;
isReviews = false; isReviews = false;
isAvailability = true; isAvailability = true;
}); });
}, }
: null,
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
@ -289,20 +291,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
previousModel: model, previousModel: model,
) )
: isAvailability && widget.product.stockAvailability != "Out of stock" : isAvailability && widget.product.stockAvailability != "Out of stock"
? AvailabilityInfo( ? AvailabilityInfo(previousModel: model)
previousModel: model
)
: isAvailability && widget.product.stockAvailability == "Out of stock" : isAvailability && widget.product.stockAvailability == "Out of stock"
? Container( ? Container(
// padding: EdgeInsets.all(15), // padding: EdgeInsets.all(15),
padding: EdgeInsets.fromLTRB(15,15,15,20), padding: EdgeInsets.fromLTRB(15, 15, 15, 20),
margin: EdgeInsets.only(bottom: 20), margin: EdgeInsets.only(bottom: 20),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
TranslationBase.of(context).noLocationAvailable, TranslationBase.of(context).noLocationAvailable,
), ),
) )
: Container(), : Container(),
], ],
), ),
), ),
@ -369,8 +369,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
await model.addToCartData(quantity, itemID, context); await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
}
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, }) async { notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId, ); await model.notifyMe(customerId, itemId);
}
} }

@ -123,7 +123,7 @@ class ProductDetailService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future notifyMe(customerId, itemID, ) async { Future notifyMe(customerId, itemID) async {
hasError = false; hasError = false;
await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) {
AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).notifyMeMsg AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).notifyMeMsg

Loading…
Cancel
Save