[HIMA-1113] on product details to enable or dessable the add to cart button also status codes are checked the same as the popup

This commit is contained in:
Eraldo Hasanaj
2020-03-26 13:35:25 +01:00
parent 5b8882646a
commit 6979b5ed41

View File

@@ -219,14 +219,21 @@ export class ProductDetailsComponent implements OnInit, OnDestroy {
if (isDownload && this.downloadError) {
return true;
}
if (isDownload && this.downloadLoaded && this.availability.filter(t => t.type === CheckoutType.donwload && t.quantity > 0).length < 1) {
if (
isDownload &&
this.downloadLoaded &&
this.availability.filter(t => t.type === CheckoutType.donwload && t.quantity > 0 && allowedAvailabilityStatusCodes(t.status)).length <
1
) {
return true;
}
// TODO: add logic here
if (
!isDownload &&
this.storeAvLoaded &&
this.shippingAvLoaded &&
this.availability.filter(t => t.type !== CheckoutType.donwload && t.quantity > 0).length < 1
this.availability.filter(t => t.type !== CheckoutType.donwload && t.quantity > 0 && allowedAvailabilityStatusCodes(t.status)).length <
1
) {
return true;
}