From 8c2c97c064e39983755f5789244a032702363944 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 12 Jul 2024 14:37:06 +0700 Subject: add note --- src/lib/quotation/components/Quotation.jsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/lib/quotation/components') diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index 19419f61..d6cc4866 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -79,7 +79,7 @@ const Quotation = () => { const [addresses, setAddresses] = useState(null); - const [note_websiteText, setselectedNote_websiteText] = useState(null); + const [note_websiteText, setselectedNote_websiteText] = useState(''); useEffect(() => { if (!auth) return; @@ -265,8 +265,8 @@ const Quotation = () => { if (!products || products.length == 0) return; - if (auth?.feature?.soApproval && !note_websiteText.trim()) { - toast.error('Note harus diisi karena fitur soApproval aktif.'); + if (isApproval && note_websiteText == '') { + toast.error('Maaf, Note wajib dimasukkan.'); return; } @@ -286,22 +286,21 @@ const Quotation = () => { delivery_service_type: selectedExpedisiService, note_website : note_websiteText, }; - console.log('data checkout', data); + const isSuccess = await checkoutApi({ data }); - console.log('isSuccess', isSuccess); + ; setIsLoading(false); if (isSuccess?.id) { for (const product of products) deleteItemCart({ productId: product.id }); router.push(`/shop/quotation/finish?id=${isSuccess.id}`); return; } + toast.error('Gagal melakukan transaksi, terjadi kesalahan internal'); }; const taxTotal = (totalAmount - totalDiscountAmount) * 0.11; - console.log("note_websiteText",note_websiteText) - return ( <> @@ -592,7 +591,7 @@ const Quotation = () => {
Note
-
+