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);
}
Future notifyMe(customerId, itemID, ) async {
Future notifyMe(customerId, itemID) async {
hasError = false;
setState(ViewState.BusyLocal);
await _productDetailService.notifyMe(customerId, itemID, );
await _productDetailService.notifyMe(customerId, itemID);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);

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

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

Loading…
Cancel
Save