simpo-component-library 1.9.8 → 1.9.91
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.
- package/esm2022/lib/ecommerce/sections/cart/cart.component.mjs +38 -37
- package/fesm2022/simpo-component-library.mjs +37 -36
- package/fesm2022/simpo-component-library.mjs.map +1 -1
- package/lib/directive/background-directive.d.ts +1 -1
- package/lib/directive/button-directive.directive.d.ts +1 -1
- package/lib/directive/color.directive.d.ts +1 -1
- package/lib/sections/pricing-section/pricing-section.component.d.ts +1 -1
- package/package.json +1 -1
- package/simpo-component-library-1.9.91.tgz +0 -0
- package/simpo-component-library-1.9.8.tgz +0 -0
@@ -4592,9 +4592,10 @@ class CartComponent extends BaseSection {
|
|
4592
4592
|
this.loadingSubscription = this._eventService.showLoadingScreen.subscribe((response) => {
|
4593
4593
|
this.isLoading = response;
|
4594
4594
|
if (!this.isLoading) {
|
4595
|
-
this.getIndexDBData();
|
4595
|
+
// this.getIndexDBData();
|
4596
4596
|
}
|
4597
4597
|
});
|
4598
|
+
this.getIndexDBData();
|
4598
4599
|
// if (this.storageService.getUser()) {
|
4599
4600
|
// this.updateUserCart();
|
4600
4601
|
// } else {
|
@@ -4622,42 +4623,42 @@ class CartComponent extends BaseSection {
|
|
4622
4623
|
this.cartInfo["cartId"] = response.data?.[0]?.cartId;
|
4623
4624
|
this.getCouponList();
|
4624
4625
|
if (response.data?.[0]?.orderedItems?.length > 0) {
|
4625
|
-
this.mergeOrderItems(tempUserCart);
|
4626
|
-
|
4627
|
-
|
4628
|
-
|
4629
|
-
|
4630
|
-
|
4631
|
-
|
4632
|
-
|
4633
|
-
|
4634
|
-
|
4635
|
-
|
4636
|
-
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
|
4641
|
-
|
4642
|
-
|
4643
|
-
|
4626
|
+
// this.mergeOrderItems(tempUserCart);
|
4627
|
+
this.storageService.addAllProductsToCart(this.cartInfo.orderedItems).oncomplete = () => {
|
4628
|
+
this.storageService.getUserCart().then((cartResponse) => {
|
4629
|
+
cartResponse.onsuccess = (cartData) => {
|
4630
|
+
if (!(localStorage.getItem("couponId") == "undefined" || localStorage.getItem("couponId") == "null"))
|
4631
|
+
this.cartInfo.billdetails.couponId = localStorage.getItem("couponId");
|
4632
|
+
if (!(localStorage.getItem("couponCode") == "undefined" || localStorage.getItem("couponCode") == "null"))
|
4633
|
+
this.cartInfo.billdetails.couponCode = localStorage.getItem("couponCode");
|
4634
|
+
const restResponse = this.restService.addItemToDB(this.cartInfo).toPromise();
|
4635
|
+
restResponse.then((response) => {
|
4636
|
+
this.cartInfo.billdetails.totalGrossValue = 0;
|
4637
|
+
this.cartInfo.billdetails.totalTax = 0;
|
4638
|
+
this.cartInfo.billdetails.deliveryCharges = 0;
|
4639
|
+
this.cartInfo.billdetails.totalNetValue = 0;
|
4640
|
+
this.cartInfo.totalAmount = 0;
|
4641
|
+
this.USER_CART_ITEMS = cartData.target.result;
|
4642
|
+
this.USER_CART_ITEMS.forEach((item) => {
|
4643
|
+
this.cartInfo.billdetails.totalGrossValue += (item.discountedPrice * (item.quantity ?? 1));
|
4644
|
+
this.cartInfo.billdetails.totalTax += (item.quantity * (item.itemTax ?? 0));
|
4645
|
+
});
|
4646
|
+
this.cartInfo.billdetails.deliveryCharges = (deliveryOption?.minOrderAmount > this.cartInfo.billdetails.totalGrossValue) ? 0 : (deliveryOption?.deliveryCharges ?? 0);
|
4647
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue;
|
4648
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
4649
|
+
this.cartInfo.billdetails.discountAmount = response?.data?.billdetails?.discountAmount ?? 0;
|
4650
|
+
this.cartInfo.billdetails.totalTaxAfterDiscount = response?.data?.billdetails?.totalTaxAfterDiscount ?? 0;
|
4651
|
+
this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount() + this.cartInfo.billdetails.deliveryCharges;
|
4652
|
+
// this.storageService.addAllProductsToCart(this.cartInfo.orderedItems)
|
4653
|
+
this.responseData = this.cartInfo;
|
4654
|
+
console.log(this.responseData);
|
4644
4655
|
});
|
4645
|
-
|
4646
|
-
|
4647
|
-
this.
|
4648
|
-
|
4649
|
-
|
4650
|
-
|
4651
|
-
this.storageService.addAllProductsToCart(this.cartInfo.orderedItems);
|
4652
|
-
this.responseData = this.cartInfo;
|
4653
|
-
console.log(this.responseData);
|
4654
|
-
});
|
4655
|
-
};
|
4656
|
-
cartResponse.onerror = (cartData) => {
|
4657
|
-
this.messageService.add({ severity: 'error', summary: 'Error', detail: 'Failed to update cart details' });
|
4658
|
-
};
|
4659
|
-
});
|
4660
|
-
// }
|
4656
|
+
};
|
4657
|
+
cartResponse.onerror = (cartData) => {
|
4658
|
+
this.messageService.add({ severity: 'error', summary: 'Error', detail: 'Failed to update cart details' });
|
4659
|
+
};
|
4660
|
+
});
|
4661
|
+
};
|
4661
4662
|
}
|
4662
4663
|
else {
|
4663
4664
|
this.storageService.getUserCart().then((cartResponse) => {
|