|
|
|
@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class ProductDetailService extends BaseService {
|
|
|
|
class ProductDetailService extends BaseService {
|
|
|
|
bool isLogin = false;
|
|
|
|
bool isLogin = false;
|
|
|
|
@ -98,7 +99,7 @@ class ProductDetailService extends BaseService {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
AppToast.showErrorToast(message: super.error??'something went wrong please try again');
|
|
|
|
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
|
|
|
|
}, body: request);
|
|
|
|
}, body: request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,7 +110,7 @@ class ProductDetailService extends BaseService {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
AppToast.showErrorToast(message: 'something went wrong please try again');
|
|
|
|
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -126,12 +127,13 @@ class ProductDetailService extends BaseService {
|
|
|
|
_wishListProducts.clear();
|
|
|
|
_wishListProducts.clear();
|
|
|
|
response['shopping_carts'].forEach((item) {
|
|
|
|
response['shopping_carts'].forEach((item) {
|
|
|
|
_wishListProducts.add(Wishlist.fromJson(item));
|
|
|
|
_wishListProducts.add(Wishlist.fromJson(item));
|
|
|
|
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
|
|
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
AppToast.showErrorToast(message: 'something went wrong please try again');
|
|
|
|
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
|
|
|
|
}, body: request);
|
|
|
|
}, body: request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -149,7 +151,7 @@ class ProductDetailService extends BaseService {
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Future delteItemFromWishlist(itemID) async {
|
|
|
|
Future deleteItemFromWishlist(itemID) async {
|
|
|
|
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
|
|
|
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist",
|
|
|
|
await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist",
|
|
|
|
|