creating part 2
This commit is contained in:
@@ -83,12 +83,12 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
public static final java.lang.String FRAGMENT_NAME = "cartFragment";
|
||||
private int REQUEST_CODE_CAMPAIGN_PRODUCT_LIST = 7847;
|
||||
private String pizzapassCampaignCategoryId = "";
|
||||
private String pizzaPromotionCampaignCategoryId = "";
|
||||
|
||||
private CartInfoModel cartInfoModel;
|
||||
private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
|
||||
private CartRecyclerAdapter cartRecyclerAdapter;
|
||||
private ArrayList<MenuProductModel> pizzapassCampaignProductList = new ArrayList<>();
|
||||
private ArrayList<MenuProductModel> pizzaPromotionCampaignProductList = new ArrayList<>();
|
||||
|
||||
public CartFragment() {}
|
||||
|
||||
@@ -146,8 +146,8 @@ public class CartFragment extends BaseFragment {
|
||||
case R.id.continueCartButton:
|
||||
|
||||
// without minimum price control for store. minimum price is contorlled by addOrder2() service.
|
||||
if(!pizzapassCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzapassOnContinueButtonClicked();
|
||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
openCreateOrderActivity();
|
||||
@@ -161,8 +161,8 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
if(cartCurrentPrice >= storeMinimumPrice){
|
||||
|
||||
if(!pizzapassCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzapassOnContinueButtonClicked();
|
||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
openCreateOrderActivity();
|
||||
@@ -228,7 +228,7 @@ public class CartFragment extends BaseFragment {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
}
|
||||
else {
|
||||
checkPizzapassCampaign();
|
||||
checkPizzaPromotionCampaign();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -410,10 +410,10 @@ public class CartFragment extends BaseFragment {
|
||||
}
|
||||
);
|
||||
|
||||
if(!pizzapassCampaignProductList.isEmpty()){
|
||||
cartInfoModel.setPizzapassCampaignUsed(
|
||||
if(!pizzaPromotionCampaignProductList.isEmpty()){
|
||||
cartInfoModel.setPizzaPromotionCampaignUsed(
|
||||
isBasketContainsCampaignProduct(
|
||||
pizzapassCampaignProductList));
|
||||
pizzaPromotionCampaignProductList));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -467,10 +467,10 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
private void checkPizzapassCampaign(){
|
||||
private void checkPizzaPromotionCampaign(){
|
||||
ApiService
|
||||
.apiInterface
|
||||
.checkPizzapassCampaign(
|
||||
.checkPizzaPromotionCampaign(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
SessionHelper.getCustomerToken().getToken())
|
||||
.enqueue(new Callback<ResponseObject<CampaignModel>>() {
|
||||
@@ -486,7 +486,7 @@ public class CartFragment extends BaseFragment {
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||
}
|
||||
else {
|
||||
pizzapassCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
pizzaPromotionCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
getCampaignProducts(response.body().getData());
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ public class CartFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void showPizzapassCampaignDialog(final CampaignModel campaignModel){
|
||||
private void showPizzaPromotionCampaignDialog(final CampaignModel campaignModel){
|
||||
DialogHelper.showTwoButtonsDialog(
|
||||
campaignModel.getName(),
|
||||
campaignModel.getDescription(),
|
||||
@@ -540,7 +540,7 @@ public class CartFragment extends BaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
if(!isBasketContainsCampaignProduct(response.body().getData())){
|
||||
showPizzapassCampaignDialog(campaignModel);
|
||||
showPizzaPromotionCampaignDialog(campaignModel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -555,13 +555,13 @@ public class CartFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void getCampaignProductsForPizzapassOnContinueButtonClicked(){
|
||||
private void getCampaignProductsForPizzaPromotionOnContinueButtonClicked(){
|
||||
|
||||
DialogHelper.showLoadingDialog();
|
||||
|
||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
pizzapassCampaignCategoryId);
|
||||
pizzaPromotionCampaignCategoryId);
|
||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
||||
@@ -570,9 +570,9 @@ public class CartFragment extends BaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
|
||||
pizzapassCampaignProductList.clear();
|
||||
pizzapassCampaignProductList.addAll(response.body().getData());
|
||||
cartInfoModel.setPizzapassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
pizzaPromotionCampaignProductList.clear();
|
||||
pizzaPromotionCampaignProductList.addAll(response.body().getData());
|
||||
cartInfoModel.setPizzaPromotionCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
|
||||
DialogHelper.hideLoadingDialog();
|
||||
openCreateOrderActivity();
|
||||
|
||||
Reference in New Issue
Block a user