ok
This commit is contained in:
@@ -69,7 +69,7 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
String(sub.product_id) === String(product.id) || String(sub.product_parent_id) === String(product.id)
|
String(sub.product_id) === String(product.id) || String(sub.product_parent_id) === String(product.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (matching.length > 0) {
|
if (matching.length > 0 && !product.end_date) {
|
||||||
const uniqueByName = Array.from(
|
const uniqueByName = Array.from(
|
||||||
new Map(matching.map(sub => [sub.product_name, sub])).values()
|
new Map(matching.map(sub => [sub.product_name, sub])).values()
|
||||||
);
|
);
|
||||||
@@ -78,6 +78,11 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
setShowSubscriptionSelector(true);
|
setShowSubscriptionSelector(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
const itemsParam = JSON.stringify([product.id]);
|
||||||
|
window.location.href = `https://checkout.kediritechnopark.com/?token=${token}&itemsId=${itemsParam}&set_name=${product.name}&redirect_uri=https://kediritechnopark.com/products&redirect_failed=https://kediritechnopark.com`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -158,11 +163,24 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
</div>
|
</div>
|
||||||
<p className={styles.description}>{product.description}</p>
|
<p className={styles.description}>{product.description}</p>
|
||||||
<div className={styles.buttonGroup}>
|
<div className={styles.buttonGroup}>
|
||||||
|
{product.end_date && product.site_url && (
|
||||||
|
<button
|
||||||
|
className={`${styles.button} ${styles.checkoutButton}`}
|
||||||
|
onClick={() => {
|
||||||
|
const token = (document.cookie.split('; ').find(row => row.startsWith('token=')) || '').split('=')[1] || '';
|
||||||
|
const url = `${product.site_url}/${product.name.toLowerCase().replace(/\s+/g, '_')}?token=${token}`;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
KUNJUNGI
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
<button className={`${styles.button} ${styles.checkoutButton}`} onClick={onCheckout}>
|
<button className={`${styles.button} ${styles.checkoutButton}`} onClick={onCheckout}>
|
||||||
{Array.isArray(subscriptions) &&
|
{Array.isArray(subscriptions) &&
|
||||||
subscriptions.some(sub =>
|
subscriptions.some(sub =>
|
||||||
sub.product_id === product.id || sub.product_parent_id === product.id
|
sub.product_id === product.id || sub.product_parent_id === product.id
|
||||||
) ? 'Perpanjang' : 'Checkout'}
|
) && product.end_date ? 'Perpanjang' : 'Checkout'}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -188,19 +188,6 @@ const CoursePage = ({ subscriptions }) => {
|
|||||||
setSelectedProduct({});
|
setSelectedProduct({});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* Tombol KUNJUNGI */}
|
|
||||||
{selectedProduct.site_url && (
|
|
||||||
<a
|
|
||||||
href={`${selectedProduct.site_url}?token=${localStorage.getItem("token")}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className={styles.ctaButton}
|
|
||||||
style={{ marginTop: '1rem' }}
|
|
||||||
>
|
|
||||||
KUNJUNGI
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{showedModal === 'login' && (
|
{showedModal === 'login' && (
|
||||||
@@ -208,8 +195,9 @@ const CoursePage = ({ subscriptions }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)
|
||||||
</div>
|
}
|
||||||
|
</div >
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user