simpo-component-library 1.4.55 → 1.4.58
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 +35 -24
- package/esm2022/lib/ecommerce/sections/featured-products/featured-products.component.mjs +10 -3
- package/esm2022/lib/services/cart.service.mjs +4 -4
- package/fesm2022/simpo-component-library.mjs +46 -28
- 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/ecommerce/sections/cart/cart.component.d.ts +1 -0
- package/lib/sections/pricing-section/pricing-section.component.d.ts +1 -1
- package/lib/services/cart.service.d.ts +1 -1
- package/package.json +1 -1
- package/simpo-component-library-1.4.57.tgz +0 -0
- package/simpo-component-library-1.4.58.tgz +0 -0
- package/simpo-component-library-1.4.55.tgz +0 -0
|
@@ -4811,7 +4811,7 @@ class CartService {
|
|
|
4811
4811
|
this.storageService = storageService;
|
|
4812
4812
|
this.restService = restService;
|
|
4813
4813
|
}
|
|
4814
|
-
addItemFromCartPage(product) {
|
|
4814
|
+
addItemFromCartPage(product, userCart) {
|
|
4815
4815
|
if (product.quantity) {
|
|
4816
4816
|
// let productIdx: number = -1;
|
|
4817
4817
|
// UserCart.orderedItems.forEach((item: OrderedItems, idx)=> {
|
|
@@ -4819,12 +4819,12 @@ class CartService {
|
|
|
4819
4819
|
// productIdx = idx;
|
|
4820
4820
|
// });
|
|
4821
4821
|
this.storageService.addProductToCart(product);
|
|
4822
|
-
|
|
4822
|
+
return this.restService.addItemToDB(userCart);
|
|
4823
4823
|
}
|
|
4824
4824
|
else {
|
|
4825
4825
|
// remove item from cart
|
|
4826
4826
|
this.removeItemFromCart(product);
|
|
4827
|
-
|
|
4827
|
+
return this.restService.addItemToDB(userCart);
|
|
4828
4828
|
}
|
|
4829
4829
|
}
|
|
4830
4830
|
addItemToCart(product) {
|
|
@@ -4965,6 +4965,9 @@ class FeaturedProductsComponent extends BaseSection {
|
|
|
4965
4965
|
this.storageService.getUserWhishlist().then((wishlistResponse) => {
|
|
4966
4966
|
wishlistResponse.onsuccess = (whislistData) => {
|
|
4967
4967
|
this.USER_WISHLIST = whislistData.target.result;
|
|
4968
|
+
console.log("WHISLIST");
|
|
4969
|
+
console.log(this.USER_WISHLIST);
|
|
4970
|
+
console.log(this.responseData);
|
|
4968
4971
|
this.responseData?.forEach((product) => {
|
|
4969
4972
|
this.USER_WISHLIST?.forEach((item) => {
|
|
4970
4973
|
if (item.itemId == product.itemId)
|
|
@@ -4980,10 +4983,14 @@ class FeaturedProductsComponent extends BaseSection {
|
|
|
4980
4983
|
this.cartService.addItemToCart(product);
|
|
4981
4984
|
}
|
|
4982
4985
|
toggleItemToFav(product, type) {
|
|
4983
|
-
if (type == 'ADD')
|
|
4986
|
+
if (type == 'ADD') {
|
|
4987
|
+
product.whislist = true;
|
|
4984
4988
|
this.cartService.addItemToFavourite(product);
|
|
4985
|
-
|
|
4989
|
+
}
|
|
4990
|
+
else {
|
|
4991
|
+
product.whislist = false;
|
|
4986
4992
|
this.cartService.removeItemFromFavourite(product);
|
|
4993
|
+
}
|
|
4987
4994
|
}
|
|
4988
4995
|
proceedToProductDesc(productId) {
|
|
4989
4996
|
this.router.navigate([`details`], { queryParams: { id: productId } });
|
|
@@ -5659,15 +5666,15 @@ class CartComponent extends BaseSection {
|
|
|
5659
5666
|
this.userDetails = null;
|
|
5660
5667
|
this.userCart = null;
|
|
5661
5668
|
this.USER_CART_ITEMS = null;
|
|
5662
|
-
|
|
5663
|
-
ngOnInit() {
|
|
5664
|
-
const billdetails = {
|
|
5669
|
+
this.billdetails = {
|
|
5665
5670
|
"totalNetValue": 0,
|
|
5666
5671
|
"totalGrossValue": 0,
|
|
5667
5672
|
"totalTax": 0,
|
|
5668
5673
|
"totalOfferedValue": 0,
|
|
5669
5674
|
"deliveryCharges": 0
|
|
5670
5675
|
};
|
|
5676
|
+
}
|
|
5677
|
+
ngOnInit() {
|
|
5671
5678
|
this._eventService.showLoadingScreen.subscribe((response) => {
|
|
5672
5679
|
this.isLoading = response;
|
|
5673
5680
|
});
|
|
@@ -5683,11 +5690,11 @@ class CartComponent extends BaseSection {
|
|
|
5683
5690
|
console.log("cart Data", cartData);
|
|
5684
5691
|
this.USER_CART_ITEMS = cartData.target.result;
|
|
5685
5692
|
[...tempUserCart, ...this.USER_CART_ITEMS].forEach((item) => {
|
|
5686
|
-
billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5687
|
-
billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5693
|
+
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5694
|
+
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5688
5695
|
});
|
|
5689
|
-
billdetails.totalNetValue = billdetails.totalGrossValue + billdetails.totalTax - billdetails.deliveryCharges;
|
|
5690
|
-
this.responseData = { orderedItems: [...tempUserCart, ...this.USER_CART_ITEMS], billdetails };
|
|
5696
|
+
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5697
|
+
this.responseData = { orderedItems: [...tempUserCart, ...this.USER_CART_ITEMS], billdetails: this.billdetails };
|
|
5691
5698
|
console.log(this.responseData);
|
|
5692
5699
|
};
|
|
5693
5700
|
});
|
|
@@ -5698,11 +5705,11 @@ class CartComponent extends BaseSection {
|
|
|
5698
5705
|
console.log("cart Data", cartData);
|
|
5699
5706
|
this.USER_CART_ITEMS = cartData.target.result;
|
|
5700
5707
|
[...this.USER_CART_ITEMS].forEach((item) => {
|
|
5701
|
-
billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5702
|
-
billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5708
|
+
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5709
|
+
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5703
5710
|
});
|
|
5704
|
-
billdetails.totalNetValue = billdetails.totalGrossValue + billdetails.totalTax - billdetails.deliveryCharges;
|
|
5705
|
-
this.responseData = { orderedItems: [...tempUserCart, ...this.USER_CART_ITEMS], billdetails, userId: this.userDetails?.userId };
|
|
5711
|
+
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5712
|
+
this.responseData = { orderedItems: [...tempUserCart, ...this.USER_CART_ITEMS], billdetails: this.billdetails, userId: this.userDetails?.userId };
|
|
5706
5713
|
console.log(this.responseData);
|
|
5707
5714
|
this.restService.addItemToDB(this.responseData).subscribe((response) => {
|
|
5708
5715
|
localStorage.setItem('cartId', response.data?.cartId);
|
|
@@ -5718,11 +5725,11 @@ class CartComponent extends BaseSection {
|
|
|
5718
5725
|
cartResponse.onsuccess = (cartData) => {
|
|
5719
5726
|
this.USER_CART_ITEMS = cartData.target.result;
|
|
5720
5727
|
this.USER_CART_ITEMS.forEach((item) => {
|
|
5721
|
-
billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5722
|
-
billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5728
|
+
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5729
|
+
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5723
5730
|
});
|
|
5724
|
-
billdetails.totalNetValue = billdetails.totalGrossValue + billdetails.totalTax - billdetails.deliveryCharges;
|
|
5725
|
-
this.responseData = { orderedItems: this.USER_CART_ITEMS, billdetails };
|
|
5731
|
+
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5732
|
+
this.responseData = { orderedItems: this.USER_CART_ITEMS, billdetails: this.billdetails };
|
|
5726
5733
|
};
|
|
5727
5734
|
});
|
|
5728
5735
|
// this.responseData = this.storageService.calculateBillingDetails();
|
|
@@ -5753,10 +5760,16 @@ class CartComponent extends BaseSection {
|
|
|
5753
5760
|
removeItem(item) {
|
|
5754
5761
|
item.quantity = 0;
|
|
5755
5762
|
this.loadingItems.push(item.itemId);
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5763
|
+
this.cartService.addItemFromCartPage(item, this.responseData).subscribe((response) => {
|
|
5764
|
+
this.loadingItems = this.loadingItems.filter((idx) => idx != item.itemId);
|
|
5765
|
+
// this.responseData = this.storageService.calculateBillingDetails();
|
|
5766
|
+
response?.data?.orderedItems.forEach((item) => {
|
|
5767
|
+
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5768
|
+
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5769
|
+
});
|
|
5770
|
+
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5771
|
+
this.responseData = { orderedItems: this.USER_CART_ITEMS, billdetails: this.billdetails };
|
|
5772
|
+
});
|
|
5760
5773
|
}
|
|
5761
5774
|
addToCart(item, type) {
|
|
5762
5775
|
if (type == 'ADD') {
|
|
@@ -5766,10 +5779,15 @@ class CartComponent extends BaseSection {
|
|
|
5766
5779
|
item.quantity -= 1;
|
|
5767
5780
|
}
|
|
5768
5781
|
this.loadingItems.push(item.itemId);
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5782
|
+
this.cartService.addItemFromCartPage(item, this.responseData).subscribe((response) => {
|
|
5783
|
+
this.loadingItems = this.loadingItems.filter((idx) => idx != item.itemId);
|
|
5784
|
+
response?.data?.orderedItems.forEach((item) => {
|
|
5785
|
+
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5786
|
+
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5787
|
+
});
|
|
5788
|
+
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5789
|
+
this.responseData = { orderedItems: this.USER_CART_ITEMS, billdetails: this.billdetails };
|
|
5790
|
+
});
|
|
5773
5791
|
}
|
|
5774
5792
|
proceedToPayment() {
|
|
5775
5793
|
if (!this.storageService.getUser()) {
|