simpo-component-library 1.4.62 → 1.4.64
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 +92 -53
- package/esm2022/lib/services/storage.service.mjs +3 -2
- package/fesm2022/simpo-component-library.mjs +93 -53
- 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 -1
- package/lib/sections/pricing-section/pricing-section.component.d.ts +1 -1
- package/package.json +1 -1
- package/simpo-component-library-1.4.63.tgz +0 -0
- package/simpo-component-library-1.4.64.tgz +0 -0
|
@@ -3284,7 +3284,7 @@ class StorageServiceService {
|
|
|
3284
3284
|
const response = transaction.objectStore(this.cartCollectionName).get(product.itemId);
|
|
3285
3285
|
response.onsuccess = (cartResponse) => {
|
|
3286
3286
|
console.log("Cart Resppnse : ", cartResponse);
|
|
3287
|
-
if (cartResponse.target.result
|
|
3287
|
+
if (cartResponse.target.result) { }
|
|
3288
3288
|
else {
|
|
3289
3289
|
this.totalCartItems += 1;
|
|
3290
3290
|
}
|
|
@@ -3294,6 +3294,7 @@ class StorageServiceService {
|
|
|
3294
3294
|
addAllProductsToCart(products) {
|
|
3295
3295
|
const transaction = this.database.transaction(this.cartCollectionName, "readwrite");
|
|
3296
3296
|
products.forEach((product) => {
|
|
3297
|
+
console.log(product + "info");
|
|
3297
3298
|
const response = transaction.objectStore(this.cartCollectionName).put(product);
|
|
3298
3299
|
});
|
|
3299
3300
|
return transaction;
|
|
@@ -5653,12 +5654,42 @@ class CartComponent extends BaseSection {
|
|
|
5653
5654
|
this.userDetails = null;
|
|
5654
5655
|
this.userCart = null;
|
|
5655
5656
|
this.USER_CART_ITEMS = null;
|
|
5656
|
-
this.
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5657
|
+
this.cartInfo = {
|
|
5658
|
+
orderedItems: null,
|
|
5659
|
+
billdetails: {
|
|
5660
|
+
"totalNetValue": 0,
|
|
5661
|
+
"totalGrossValue": 0,
|
|
5662
|
+
"totalTax": 0,
|
|
5663
|
+
"totalOfferedValue": 0,
|
|
5664
|
+
"deliveryCharges": 0
|
|
5665
|
+
},
|
|
5666
|
+
platform: "WEB",
|
|
5667
|
+
cartType: "CART",
|
|
5668
|
+
userDetails: {
|
|
5669
|
+
"userId": "",
|
|
5670
|
+
"userName": "",
|
|
5671
|
+
"mobile": "",
|
|
5672
|
+
"email": "",
|
|
5673
|
+
"deliveryAddress": {
|
|
5674
|
+
"addressType": "",
|
|
5675
|
+
"receiverName": "",
|
|
5676
|
+
"receiverPhone": "",
|
|
5677
|
+
"countryName": "",
|
|
5678
|
+
"stateName": "",
|
|
5679
|
+
"cityName": "",
|
|
5680
|
+
"localityName": "",
|
|
5681
|
+
"addressLine1": "",
|
|
5682
|
+
"addressLine2": "",
|
|
5683
|
+
"landmark": "",
|
|
5684
|
+
"zipCode": "",
|
|
5685
|
+
"geolocation": {
|
|
5686
|
+
"latitude": 0,
|
|
5687
|
+
"longitude": 0
|
|
5688
|
+
},
|
|
5689
|
+
"stateCode": ""
|
|
5690
|
+
}
|
|
5691
|
+
},
|
|
5692
|
+
totalAmount: 0
|
|
5662
5693
|
};
|
|
5663
5694
|
}
|
|
5664
5695
|
ngOnInit() {
|
|
@@ -5667,6 +5698,13 @@ class CartComponent extends BaseSection {
|
|
|
5667
5698
|
});
|
|
5668
5699
|
if (this.storageService.getUser()) {
|
|
5669
5700
|
this.userDetails = this.storageService.getUser();
|
|
5701
|
+
this.cartInfo.userDetails = {
|
|
5702
|
+
"userId": this.userDetails?.userId,
|
|
5703
|
+
"userName": this.userDetails?.contact.name,
|
|
5704
|
+
"mobile": this.userDetails?.contact.mobile,
|
|
5705
|
+
"email": this.userDetails?.contact.email,
|
|
5706
|
+
"deliveryAddress": null,
|
|
5707
|
+
};
|
|
5670
5708
|
this.restService.getUserItems(this.userDetails.userId, "CART").subscribe((response) => {
|
|
5671
5709
|
const tempUserCart = response?.data?.orderedItems ?? [];
|
|
5672
5710
|
localStorage.setItem('cartId', response.data?.cartId);
|
|
@@ -5674,53 +5712,55 @@ class CartComponent extends BaseSection {
|
|
|
5674
5712
|
console.log(tempUserCart);
|
|
5675
5713
|
console.log("ASYNC AWAIT TEST");
|
|
5676
5714
|
this.storageService.addAllProductsToCart(tempUserCart).oncomplete = () => {
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5715
|
+
console.log("completed");
|
|
5716
|
+
this.storageService.getUserCart().then((cartData) => {
|
|
5717
|
+
// cartResponse.onsuccess = (cartData: any) => {
|
|
5718
|
+
console.log("cart Data", cartData);
|
|
5719
|
+
this.USER_CART_ITEMS = cartData.result;
|
|
5720
|
+
[...tempUserCart, ...this.USER_CART_ITEMS].forEach((item) => {
|
|
5721
|
+
this.cartInfo.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5722
|
+
this.cartInfo.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5723
|
+
});
|
|
5724
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
|
|
5725
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
|
5726
|
+
this.responseData = this.cartInfo;
|
|
5727
|
+
console.log(this.responseData);
|
|
5728
|
+
// }
|
|
5689
5729
|
});
|
|
5690
5730
|
};
|
|
5691
5731
|
}
|
|
5692
5732
|
else {
|
|
5693
|
-
this.storageService.getUserCart().then((
|
|
5694
|
-
cartResponse.onsuccess = (cartData) => {
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
}
|
|
5733
|
+
this.storageService.getUserCart().then((cartData) => {
|
|
5734
|
+
// cartResponse.onsuccess = (cartData: any) => {
|
|
5735
|
+
console.log("cart Data", cartData);
|
|
5736
|
+
this.USER_CART_ITEMS = cartData.result;
|
|
5737
|
+
[...this.USER_CART_ITEMS].forEach((item) => {
|
|
5738
|
+
this.cartInfo.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5739
|
+
this.cartInfo.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5740
|
+
});
|
|
5741
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
|
|
5742
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
|
5743
|
+
console.log(this.responseData);
|
|
5744
|
+
this.restService.addItemToDB(this.responseData).subscribe((response) => {
|
|
5745
|
+
localStorage.setItem('cartId', response.data?.cartId);
|
|
5746
|
+
});
|
|
5747
|
+
// }
|
|
5708
5748
|
});
|
|
5709
5749
|
}
|
|
5710
5750
|
});
|
|
5711
5751
|
}
|
|
5712
5752
|
else {
|
|
5713
|
-
this.storageService.getUserCart().then((
|
|
5714
|
-
console.log(cartResponse);
|
|
5715
|
-
cartResponse.onsuccess = (cartData) => {
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
}
|
|
5753
|
+
this.storageService.getUserCart().then((cartData) => {
|
|
5754
|
+
// console.log(cartResponse);
|
|
5755
|
+
// cartResponse.onsuccess = (cartData: any) => {
|
|
5756
|
+
this.USER_CART_ITEMS = cartData.result;
|
|
5757
|
+
this.USER_CART_ITEMS.forEach((item) => {
|
|
5758
|
+
this.cartInfo.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5759
|
+
this.cartInfo.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5760
|
+
});
|
|
5761
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
|
|
5762
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
|
5763
|
+
// }
|
|
5724
5764
|
});
|
|
5725
5765
|
// this.responseData = this.storageService.calculateBillingDetails();
|
|
5726
5766
|
console.log(this.responseData);
|
|
@@ -5756,11 +5796,11 @@ class CartComponent extends BaseSection {
|
|
|
5756
5796
|
if (this.USER_CART_ITEMS)
|
|
5757
5797
|
this.USER_CART_ITEMS = this.USER_CART_ITEMS.filter((product) => product.id != item.itemId);
|
|
5758
5798
|
response?.data?.orderedItems.forEach((item) => {
|
|
5759
|
-
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5760
|
-
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5799
|
+
this.cartInfo.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5800
|
+
this.cartInfo.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5761
5801
|
});
|
|
5762
|
-
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5763
|
-
this.
|
|
5802
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
|
|
5803
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
|
5764
5804
|
});
|
|
5765
5805
|
}
|
|
5766
5806
|
addToCart(item, type) {
|
|
@@ -5774,11 +5814,11 @@ class CartComponent extends BaseSection {
|
|
|
5774
5814
|
this.cartService.addItemFromCartPage(item, this.responseData).subscribe((response) => {
|
|
5775
5815
|
this.loadingItems = this.loadingItems.filter((idx) => idx != item.itemId);
|
|
5776
5816
|
response?.data?.orderedItems.forEach((item) => {
|
|
5777
|
-
this.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5778
|
-
this.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5817
|
+
this.cartInfo.billdetails.totalGrossValue += (item.price * (item.quantity ?? 1));
|
|
5818
|
+
this.cartInfo.billdetails.totalTax += (item.price * (item.itemTax ?? 1));
|
|
5779
5819
|
});
|
|
5780
|
-
this.billdetails.totalNetValue = this.billdetails.totalGrossValue + this.billdetails.totalTax - this.billdetails.deliveryCharges;
|
|
5781
|
-
this.
|
|
5820
|
+
this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue + this.cartInfo.billdetails.totalTax - this.cartInfo.billdetails.deliveryCharges;
|
|
5821
|
+
this.cartInfo.orderedItems = this.USER_CART_ITEMS;
|
|
5782
5822
|
});
|
|
5783
5823
|
}
|
|
5784
5824
|
proceedToPayment() {
|