simpo-component-library 3.6.277 → 3.6.280

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7956,8 +7956,8 @@ class CartComponent extends BaseSection {
7956
7956
  if (param && param['checkout'])
7957
7957
  this.currentTab = "ADDRESS";
7958
7958
  });
7959
- this.getIndexDBData();
7960
7959
  this.getTrialCart();
7960
+ this.getIndexDBData();
7961
7961
  this.getSchemeDetails();
7962
7962
  this.getEcommerceConfigs();
7963
7963
  this.styles = this.data?.styles;
@@ -8010,10 +8010,11 @@ class CartComponent extends BaseSection {
8010
8010
  });
8011
8011
  }
8012
8012
  updateUserCart() {
8013
+ debugger;
8013
8014
  const deliveryOption = JSON.parse(localStorage.getItem("deliveryOptions") ?? "{}");
8014
8015
  this.userDetails = this.storageService.getUser();
8015
8016
  this.cartInfo.userDetails = {
8016
- "userId": "4be7eebf-bd8a-4bbe-8c53-66b7f3d10361",
8017
+ "userId": this.userDetails?.userId,
8017
8018
  "userName": this.userDetails?.contact.name,
8018
8019
  "mobile": this.userDetails?.contact.mobile,
8019
8020
  "email": this.userDetails?.contact.email,
@@ -8038,23 +8039,23 @@ class CartComponent extends BaseSection {
8038
8039
  this.cartInfo.billdetails.couponCode = localStorage.getItem("couponCode");
8039
8040
  const restResponse = this.restService.addItemToDB(this.cartInfo).toPromise();
8040
8041
  restResponse.then((response) => {
8041
- this.cartInfo.billdetails.totalGrossValue = response?.data?.billdetails?.totalGrossValue ?? 0;
8042
- this.cartInfo.billdetails.totalTax = response?.data?.billdetails?.totalTax ?? 0;
8043
- this.cartInfo.billdetails.deliveryCharges = response?.data?.billdetails?.deliveryCharges ?? 0;
8044
- this.cartInfo.billdetails.totalNetValue = response?.data?.billdetails?.totalNetValue ?? 0;
8045
- // this.cartInfo.totalAmount = response?.data?.totalAmount ?? 0;
8042
+ this.cartInfo.billdetails.totalGrossValue = 0;
8043
+ this.cartInfo.billdetails.totalTax = 0;
8044
+ this.cartInfo.billdetails.deliveryCharges = 0;
8045
+ this.cartInfo.billdetails.totalNetValue = 0;
8046
+ this.cartInfo.totalAmount = 0;
8046
8047
  this.USER_CART_ITEMS = cartData.target.result;
8047
- // this.USER_CART_ITEMS.forEach((item) => {
8048
- // this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
8049
- // this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8050
- // })
8051
- // this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8052
- // this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
8048
+ this.USER_CART_ITEMS.forEach((item) => {
8049
+ this.cartInfo.billdetails.totalNetValue += (item.discountedPrice * (item.quantity ?? 1));
8050
+ this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8051
+ });
8052
+ this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8053
+ this.cartInfo.billdetails.totalGrossValue = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount();
8053
8054
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8054
8055
  this.cartInfo.billdetails.discountAmount = response?.data?.billdetails?.discountAmount ?? 0;
8055
8056
  this.cartInfo.billdetails.totalTaxAfterDiscount = response?.data?.billdetails?.totalTaxAfterDiscount ?? 0;
8056
- this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount() + this.cartInfo.billdetails.deliveryCharges + this.cartInfo.billdetails.discountAmount;
8057
- this.storageService.addAllProductsToCart(this.cartInfo.orderedItems);
8057
+ this.cartInfo.totalAmount = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.deliveryCharges + this.cartInfo.billdetails.discountAmount;
8058
+ // this.storageService.addAllProductsToCart(this.cartInfo.orderedItems)
8058
8059
  this.responseData = this.cartInfo;
8059
8060
  });
8060
8061
  };
@@ -8075,13 +8076,12 @@ class CartComponent extends BaseSection {
8075
8076
  this.cartInfo.billdetails.totalNetValue = 0;
8076
8077
  this.cartInfo.totalAmount = 0;
8077
8078
  this.USER_CART_ITEMS.forEach((item) => {
8078
- this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
8079
+ this.cartInfo.billdetails.totalNetValue += (item.discountedPrice * (item.quantity ?? 1));
8079
8080
  this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8080
8081
  });
8081
8082
  this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8082
- this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.deliveryCharges - this.cartInfo.billdetails.totalTax;
8083
- this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount();
8084
- +this.cartInfo.billdetails.deliveryCharges;
8083
+ this.cartInfo.billdetails.totalGrossValue = this.cartInfo.billdetails.totalNetValue + this.cartInfo.billdetails.totalTax;
8084
+ this.cartInfo.totalAmount = this.cartInfo.billdetails.finalPrice ?? this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.deliveryCharges;
8085
8085
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8086
8086
  this.responseData = this.cartInfo;
8087
8087
  this.restService.addItemToDB(this.responseData).subscribe((response) => {
@@ -8102,20 +8102,6 @@ class CartComponent extends BaseSection {
8102
8102
  ? this.userDetails?.addressDetailsList[this.selectedAddressIdx]
8103
8103
  : this.userDetails?.addressDetailsList?.[0];
8104
8104
  }
8105
- // updateUserCart2() {
8106
- // const deliveryOption = JSON.parse(localStorage.getItem("deliveryOptions") ?? "{}");
8107
- // this.userDetails = this.storageService.getUser() as User;
8108
- // this.cartInfo.userDetails = {
8109
- // "userId": this.userDetails?.userId,
8110
- // "userName": this.userDetails?.contact.name,
8111
- // "mobile": this.userDetails?.contact.mobile,
8112
- // "email": this.userDetails?.contact.email,
8113
- // }
8114
- // this.restService.getUserItems(this.userDetails.userId, "CART").subscribe((response: any) => {
8115
- // const tempUserCart = response?.data?.[0]?.orderedItems ?? [];
8116
- // this.mergeOrderItems(tempUserCart);
8117
- // })
8118
- // }
8119
8105
  get stylesLayout() {
8120
8106
  return { ...this.styles?.layout };
8121
8107
  }
@@ -8168,6 +8154,7 @@ class CartComponent extends BaseSection {
8168
8154
  }
8169
8155
  getIndexDBData() {
8170
8156
  this.storageService.getUserCart().then((cartResponse) => {
8157
+ debugger;
8171
8158
  const deliveryOption = JSON.parse(localStorage.getItem("deliveryOptions") ?? "{}");
8172
8159
  this.cartInfo.billdetails.totalGrossValue = 0;
8173
8160
  this.cartInfo.billdetails.totalTax = 0;
@@ -8177,13 +8164,13 @@ class CartComponent extends BaseSection {
8177
8164
  cartResponse.onsuccess = (cartData) => {
8178
8165
  this.USER_CART_ITEMS = cartData.target.result;
8179
8166
  this.USER_CART_ITEMS.forEach((item) => {
8180
- this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
8167
+ this.cartInfo.billdetails.totalNetValue += (item.discountedPrice * (item.quantity ?? 1));
8181
8168
  this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8182
8169
  });
8183
8170
  this.cartInfo.billdetails.totalTaxAfterDiscount = cartData.billdetails?.totalTaxAfterDiscount ?? 0;
8184
8171
  this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8185
- this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
8186
- this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount() + this.cartInfo.billdetails.deliveryCharges;
8172
+ this.cartInfo.billdetails.totalGrossValue = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount();
8173
+ this.cartInfo.totalAmount = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.deliveryCharges + this.cartInfo.billdetails.discountAmount;
8187
8174
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8188
8175
  if (this.storageService.getUser())
8189
8176
  this.updateUserCart();