From 721067120c2756554829070b3fa10de7f04ae705 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 12 Jul 2024 11:34:23 +0700
Subject: <iman>  update input note

---
 src/lib/quotation/components/Quotation.jsx | 35 ++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

(limited to 'src/lib/quotation/components/Quotation.jsx')

diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx
index 8855c6c4..19419f61 100644
--- a/src/lib/quotation/components/Quotation.jsx
+++ b/src/lib/quotation/components/Quotation.jsx
@@ -67,17 +67,19 @@ const Quotation = () => {
   const [selectedExpedisiService, setselectedExpedisiService] = useState(null);
   const [etd, setEtd] = useState(null);
   const [etdFix, setEtdFix] = useState(null);
-
+  
   const [isApproval, setIsApproval] = useState(false);
-
+  
   const expedisiValidation = useRef(null);
-
+  
   const [selectedAddress, setSelectedAddress] = useState({
     shipping: null,
     invoicing: null,
   });
-
+  
   const [addresses, setAddresses] = useState(null);
+  
+  const [note_websiteText, setselectedNote_websiteText] = useState(null);
 
   useEffect(() => {
     if (!auth) return;
@@ -262,6 +264,12 @@ const Quotation = () => {
     }
 
     if (!products || products.length == 0) return;
+
+    if (auth?.feature?.soApproval && !note_websiteText.trim()) {
+      toast.error('Note harus diisi karena fitur soApproval aktif.');
+      return;
+    }
+    
     setIsLoading(true);
     const productOrder = products.map((product) => ({
       product_id: product.id,
@@ -276,6 +284,7 @@ const Quotation = () => {
       carrier_id: selectedCarrierId,
       estimated_arrival_days: splitDuration(etd),
       delivery_service_type: selectedExpedisiService,
+      note_website : note_websiteText,
     };
     console.log('data checkout', data);
     const isSuccess = await checkoutApi({ data });
@@ -291,6 +300,8 @@ const Quotation = () => {
 
   const taxTotal = (totalAmount - totalDiscountAmount) * 0.11;
 
+  console.log("note_websiteText",note_websiteText)
+
   return (
     <>
       <MobileView>
@@ -576,6 +587,22 @@ const Quotation = () => {
                 yang berlaku
               </p>
 
+                <div>
+                  <hr className='my-4 border-gray_r-6' />
+
+                  <div className='flex gap-x-1 flex-col mb-4'>
+                    <div className='mb-2'>Note</div>
+                    <div className='font-semibold text-gray_r-12'>
+                      <textarea
+                        rows="4"
+                        cols="50"
+                        className={`w-full p-1 rounded border  border-gray_r-6`}
+                        onChange={(e) => setselectedNote_websiteText(e.target.value)}
+                      />
+                    </div>
+                  </div>
+                </div>
+        
               <hr className='my-4 border-gray_r-6' />
 
               <button
-- 
cgit v1.2.3


From 8c2c97c064e39983755f5789244a032702363944 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 12 Jul 2024 14:37:06 +0700
Subject: <iman> add note

---
 src/lib/quotation/components/Quotation.jsx | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'src/lib/quotation/components/Quotation.jsx')

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 (
     <>
       <MobileView>
@@ -592,7 +591,7 @@ const Quotation = () => {
 
                   <div className='flex gap-x-1 flex-col mb-4'>
                     <div className='mb-2'>Note</div>
-                    <div className='font-semibold text-gray_r-12'>
+                    <div className='text-caption-2 text-gray_r-11'>
                       <textarea
                         rows="4"
                         cols="50"
-- 
cgit v1.2.3


From 87f4b126a5d487aef2170a1f2147618bbcb0ad70 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 15 Jul 2024 10:05:47 +0700
Subject: <iman> add harus diisi

---
 src/lib/quotation/components/Quotation.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/lib/quotation/components/Quotation.jsx')

diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx
index d6cc4866..86b0664d 100644
--- a/src/lib/quotation/components/Quotation.jsx
+++ b/src/lib/quotation/components/Quotation.jsx
@@ -590,7 +590,12 @@ const Quotation = () => {
                   <hr className='my-4 border-gray_r-6' />
 
                   <div className='flex gap-x-1 flex-col mb-4'>
-                    <div className='mb-2'>Note</div>
+                    <div className='flex flex-row gap-x-1'>
+                      <div className=''>Note</div>
+                      {isApproval && (
+                        <div className='text-caption-1 text-red-500 items-center flex'>*harus diisi</div>
+                      )}
+                    </div>
                     <div className='text-caption-2 text-gray_r-11'>
                       <textarea
                         rows="4"
-- 
cgit v1.2.3


From 60d0eda46a7a09a70285350cf19e09c40da05887 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 16 Jul 2024 15:44:23 +0700
Subject: <iman> add mobile note

---
 src/lib/quotation/components/Quotation.jsx | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

(limited to 'src/lib/quotation/components/Quotation.jsx')

diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx
index 86b0664d..df234dc2 100644
--- a/src/lib/quotation/components/Quotation.jsx
+++ b/src/lib/quotation/components/Quotation.jsx
@@ -452,8 +452,25 @@ const Quotation = () => {
             </Link>{' '}
             yang berlaku
           </p>
+            <hr className='my-4 border-gray_r-6' />
+             
+                  <div className='flex gap-x-2 justify-start mb-4'>
+                    <div className=''>Note</div>
+                      {isApproval && (
+                        <div className='text-caption-1 text-red-500 items-center flex'>*harus diisi</div>
+                      )}
+                    </div>
+                    <div className='text-caption-2 text-gray_r-11'>
+                      <textarea
+                        rows="4"
+                        cols="50"
+                        className={`w-full p-1 rounded border  border-gray_r-6`}
+                        onChange={(e) => setselectedNote_websiteText(e.target.value)}
+                      />
+                  </div>
         </div>
-
+      
+            
         <Divider />
 
         <div className='flex gap-x-3 p-4'>
-- 
cgit v1.2.3

