simpo-component-library 3.6.279 → 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,24 +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
- console.log(response);
8042
- this.cartInfo.billdetails.totalGrossValue = response?.data?.billdetails?.totalGrossValue ?? 0;
8043
- this.cartInfo.billdetails.totalTax = response?.data?.billdetails?.totalTax ?? 0;
8044
- this.cartInfo.billdetails.deliveryCharges = response?.data?.billdetails?.deliveryCharges ?? 0;
8045
- this.cartInfo.billdetails.totalNetValue = response?.data?.billdetails?.totalNetValue ?? 0;
8046
- // 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;
8047
8047
  this.USER_CART_ITEMS = cartData.target.result;
8048
- // this.USER_CART_ITEMS.forEach((item) => {
8049
- // this.cartInfo.billdetails.totalGrossValue += (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.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();
8054
8054
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8055
8055
  this.cartInfo.billdetails.discountAmount = response?.data?.billdetails?.discountAmount ?? 0;
8056
8056
  this.cartInfo.billdetails.totalTaxAfterDiscount = response?.data?.billdetails?.totalTaxAfterDiscount ?? 0;
8057
- this.cartInfo.totalAmount = response?.data?.billdetails?.finalPrice ?? 0;
8058
- 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)
8059
8059
  this.responseData = this.cartInfo;
8060
8060
  });
8061
8061
  };
@@ -8076,13 +8076,12 @@ class CartComponent extends BaseSection {
8076
8076
  this.cartInfo.billdetails.totalNetValue = 0;
8077
8077
  this.cartInfo.totalAmount = 0;
8078
8078
  this.USER_CART_ITEMS.forEach((item) => {
8079
- this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
8079
+ this.cartInfo.billdetails.totalNetValue += (item.discountedPrice * (item.quantity ?? 1));
8080
8080
  this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8081
8081
  });
8082
8082
  this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8083
- this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.deliveryCharges - this.cartInfo.billdetails.totalTax;
8084
- this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount();
8085
- +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;
8086
8085
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8087
8086
  this.responseData = this.cartInfo;
8088
8087
  this.restService.addItemToDB(this.responseData).subscribe((response) => {
@@ -8103,20 +8102,6 @@ class CartComponent extends BaseSection {
8103
8102
  ? this.userDetails?.addressDetailsList[this.selectedAddressIdx]
8104
8103
  : this.userDetails?.addressDetailsList?.[0];
8105
8104
  }
8106
- // updateUserCart2() {
8107
- // const deliveryOption = JSON.parse(localStorage.getItem("deliveryOptions") ?? "{}");
8108
- // this.userDetails = this.storageService.getUser() as User;
8109
- // this.cartInfo.userDetails = {
8110
- // "userId": this.userDetails?.userId,
8111
- // "userName": this.userDetails?.contact.name,
8112
- // "mobile": this.userDetails?.contact.mobile,
8113
- // "email": this.userDetails?.contact.email,
8114
- // }
8115
- // this.restService.getUserItems(this.userDetails.userId, "CART").subscribe((response: any) => {
8116
- // const tempUserCart = response?.data?.[0]?.orderedItems ?? [];
8117
- // this.mergeOrderItems(tempUserCart);
8118
- // })
8119
- // }
8120
8105
  get stylesLayout() {
8121
8106
  return { ...this.styles?.layout };
8122
8107
  }
@@ -8169,6 +8154,7 @@ class CartComponent extends BaseSection {
8169
8154
  }
8170
8155
  getIndexDBData() {
8171
8156
  this.storageService.getUserCart().then((cartResponse) => {
8157
+ debugger;
8172
8158
  const deliveryOption = JSON.parse(localStorage.getItem("deliveryOptions") ?? "{}");
8173
8159
  this.cartInfo.billdetails.totalGrossValue = 0;
8174
8160
  this.cartInfo.billdetails.totalTax = 0;
@@ -8178,13 +8164,13 @@ class CartComponent extends BaseSection {
8178
8164
  cartResponse.onsuccess = (cartData) => {
8179
8165
  this.USER_CART_ITEMS = cartData.target.result;
8180
8166
  this.USER_CART_ITEMS.forEach((item) => {
8181
- this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
8167
+ this.cartInfo.billdetails.totalNetValue += (item.discountedPrice * (item.quantity ?? 1));
8182
8168
  this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
8183
8169
  });
8184
8170
  this.cartInfo.billdetails.totalTaxAfterDiscount = cartData.billdetails?.totalTaxAfterDiscount ?? 0;
8185
8171
  this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
8186
- this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
8187
- 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;
8188
8174
  this.cartInfo.orderedItems = this.USER_CART_ITEMS;
8189
8175
  if (this.storageService.getUser())
8190
8176
  this.updateUserCart();