From b89d57916ec9d2be3db786a8481a0acc5fd74e2f Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 11:11:38 +0700
Subject: <iman> update tampilan desktop switcj account

---
 .../modules/register/components/FormBisnis.tsx     | 85 ++++++++++++++--------
 1 file changed, 54 insertions(+), 31 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 2080ae75..70b6df1f 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -292,7 +292,12 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           />
         </div>
       </BottomPopup>
-      <form className='mt-6 grid grid-cols-1 gap-y-4' onSubmit={handleSubmit}>
+      <form
+        className={`mt-6 grid ${
+          type === 'bisnis' ? 'grid-rows-10' : 'grid-rows-5'
+        } grid-flow-col gap-x-4 gap-y-2`}
+        onSubmit={handleSubmit}
+      >
         <div>
           <label htmlFor='email' className='font-bold'>
             Email Bisnis{' '}
@@ -307,7 +312,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             name='email_partner'
             placeholder='example@email.com'
             value={!required ? form.email_partner : ''}
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input max-h-11 mt-3 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -323,12 +330,12 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           )}
         </div>
 
-        <div className=''>
+        <div>
           <label className='font-bold' htmlFor='company'>
             Nama Bisnis
           </label>
-          <div className='flex justify-between items-start gap-2 max-h-12 min-h-12 text-sm'>
-            <div className='w-4/5 pr-1'>
+          <div className='flex justify-between items-start gap-2 max-h-12 min-h-12 text-sm mt-3'>
+            <div className='w-4/5 pr-1 max-h-11'>
               <Controller
                 name='companyType'
                 control={control}
@@ -347,12 +354,12 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
                 </span>
               )}
             </div>
-            <div className='w-[120%]'>
+            <div className='w-[120%] '>
               <input
                 type='text'
                 name='business_name'
                 id='business_name'
-                className='form-input h-12 '
+                className='form-input max-h-11'
                 placeholder='Nama Perusahaan'
                 autoCapitalize='true'
                 value={form.business_name}
@@ -367,27 +374,29 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           </div>
         </div>
 
-        <div className='mt-8 sm:mt-8'>
+        <div className='mt-8 md:mt-0'>
           <label className='font-bold' htmlFor='business_name'>
             Klasifikasi Jenis Usaha
           </label>
-          <Controller
-            name='industry_id'
-            control={control}
-            render={(props) => (
-              <HookFormSelect
-                {...props}
-                options={industries}
-                disabled={required}
-                placeholder={'Select industry'}
-              />
+          <div className='mt-5 max-h-10'>
+            <Controller
+              name='industry_id'
+              control={control}
+              render={(props) => (
+                <HookFormSelect
+                  {...props}
+                  options={industries}
+                  disabled={required}
+                  placeholder={'Select industry'}
+                />
+              )}
+            />
+            {selectedCategory && (
+              <span className='text-gray_r-11 text-xs'>
+                Kategori : {selectedCategory}
+              </span>
             )}
-          />
-          {selectedCategory && (
-            <span className='text-gray_r-11 text-xs'>
-              Kategori : {selectedCategory}
-            </span>
-          )}
+          </div>
           {chekValid && !required && !!errors.industry_id && (
             <span className='form-msg-danger'>{errors.industry_id}</span>
           )}
@@ -404,7 +413,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             name='alamat_bisnis'
             placeholder='Masukan alamat bisnis anda'
             value={!required ? form.alamat_bisnis : ''}
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input mt-3 max-h-11 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -431,7 +442,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             name='nama_wajib_pajak'
             placeholder='Masukan nama lengkap anda'
             value={!required ? form.nama_wajib_pajak : ''}
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input mt-3 max-h-11 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -483,7 +496,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
                   : form.alamat_wajib_pajak
                 : ''
             }
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input max-h-11 mt-3 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={isChekBox || required}
             contentEditable={required}
             readOnly={required}
@@ -510,7 +525,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             type='tel'
             id='npwp'
             name='npwp'
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input max-h-11 mt-3 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -567,7 +584,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             type='tel'
             id='sppkp'
             name='sppkp'
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input max-h-11 mt-3 ${
+              required ? 'cursor-no-drop' : ''
+            }`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -594,7 +613,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             type='file'
             id='npwp_document'
             name='npwp_document'
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input ${
+              type === 'bisnis' ? '' : 'border-none'
+            } mt-3 ${required ? 'cursor-no-drop' : ''}`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
@@ -619,7 +640,9 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
             type='file'
             id='sppkp_document'
             name='sppkp_document'
-            className={`form-input mt-3 ${required ? 'cursor-no-drop' : ''}`}
+            className={`form-input ${
+              type === 'bisnis' ? '' : 'border-none'
+            } mt-3 ${required ? 'cursor-no-drop' : ''}`}
             disabled={required}
             contentEditable={required}
             readOnly={required}
-- 
cgit v1.2.3


From f67560a48990dddcc820c5233a5bf3270d1d69d0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 11:54:05 +0700
Subject: <iman> update switch account

---
 .../modules/register/components/FormBisnis.tsx       | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 70b6df1f..6631cb3b 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -293,9 +293,11 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
         </div>
       </BottomPopup>
       <form
-        className={`mt-6 grid ${
-          type === 'bisnis' ? 'grid-rows-10' : 'grid-rows-5'
-        } grid-flow-col gap-x-4 gap-y-2`}
+        className={` ${
+          type === 'bisnis'
+            ? 'mt-6 grid grid-cols-1 gap-y-4'
+            : 'mt-6 grid grid-cols-2 gap-x-4 gap-y-2'
+        }`}
         onSubmit={handleSubmit}
       >
         <div>
@@ -378,7 +380,7 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           <label className='font-bold' htmlFor='business_name'>
             Klasifikasi Jenis Usaha
           </label>
-          <div className='mt-5 max-h-10'>
+          <div className='max-h-10'>
             <Controller
               name='industry_id'
               control={control}
@@ -391,12 +393,12 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
                 />
               )}
             />
-            {selectedCategory && (
-              <span className='text-gray_r-11 text-xs'>
-                Kategori : {selectedCategory}
-              </span>
-            )}
           </div>
+          {selectedCategory && (
+            <span className='text-gray_r-11 text-xs'>
+              Kategori : {selectedCategory}
+            </span>
+          )}
           {chekValid && !required && !!errors.industry_id && (
             <span className='form-msg-danger'>{errors.industry_id}</span>
           )}
-- 
cgit v1.2.3


From ab39764b288b4d60923cc8cc6146ccdc1b4bfbac Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 14:01:53 +0700
Subject: <iman> update switch acc

---
 src-migrate/modules/register/components/FormBisnis.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 6631cb3b..73de60cb 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -296,7 +296,7 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
         className={` ${
           type === 'bisnis'
             ? 'mt-6 grid grid-cols-1 gap-y-4'
-            : 'mt-6 grid grid-cols-2 gap-x-4 gap-y-2'
+            : 'mt-6 grid grid-cols-2 gap-x-4 gap-y-5 auto-rows-min'
         }`}
         onSubmit={handleSubmit}
       >
@@ -332,11 +332,11 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           )}
         </div>
 
-        <div>
+        <div className='bg-red-400 h-full'>
           <label className='font-bold' htmlFor='company'>
             Nama Bisnis
           </label>
-          <div className='flex justify-between items-start gap-2 max-h-12 min-h-12 text-sm mt-3'>
+          <div className='flex justify-between items-start gap-2 max-h-11 min-h-11 text-sm mt-3'>
             <div className='w-4/5 pr-1 max-h-11'>
               <Controller
                 name='companyType'
@@ -380,7 +380,7 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           <label className='font-bold' htmlFor='business_name'>
             Klasifikasi Jenis Usaha
           </label>
-          <div className='max-h-10'>
+          <div className='max-h-10 mt-3'>
             <Controller
               name='industry_id'
               control={control}
-- 
cgit v1.2.3


From 752e55686dfee0d536f9e4e128336e91681ba794 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 17:07:49 +0700
Subject: <iman> update switch account

---
 src-migrate/modules/register/components/FormBisnis.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 73de60cb..85bb491d 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -296,7 +296,7 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
         className={` ${
           type === 'bisnis'
             ? 'mt-6 grid grid-cols-1 gap-y-4'
-            : 'mt-6 grid grid-cols-2 gap-x-4 gap-y-5 auto-rows-min'
+            : 'mt-6 grid grid-cols-2 gap-x-4 gap-y-6 auto-rows-min'
         }`}
         onSubmit={handleSubmit}
       >
@@ -332,7 +332,7 @@ const form: React.FC<FormProps> = ({ type, required, isPKP, chekValid }) => {
           )}
         </div>
 
-        <div className='bg-red-400 h-full'>
+        <div className=''>
           <label className='font-bold' htmlFor='company'>
             Nama Bisnis
           </label>
-- 
cgit v1.2.3


From 935066853ab4847fbff605eed21f98ddbb445864 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 26 Sep 2024 17:02:45 +0700
Subject: <iman> update form bisnis

---
 .../modules/register/components/FormBisnis.tsx     | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 6185179f..c88ec735 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -87,16 +87,31 @@ const form: React.FC<FormProps> = ({
           label: o.name,
         }))
       );
+      // setValue('companyType', form.company_type_id);
     };
     loadCompanyTypes();
   }, []);
 
+  useEffect(() => {
+    if (form.company_type_id) {
+      console.log('form.company_type_id', form.company_type_id);
+      setValue('companyType', form.company_type_id);
+    }
+  }, [form.company_type_id]);
+
   useEffect(() => {
     const selectedCompanyType = companyTypes.find(
       (company) => company.value === watch('companyType')
     );
     if (selectedCompanyType) {
+      console.log('selectedCompanyType', selectedCompanyType);
       updateForm('company_type_id', `${selectedCompanyType?.value}`);
+      // setCompanyTypes([
+      //   {
+      //     value: '2',
+      //     label: 'Distributor',
+      //   },
+      // ]);
       validate();
     }
   }, [watch('companyType'), companyTypes]);
@@ -122,6 +137,7 @@ const form: React.FC<FormProps> = ({
           category: o.category,
         }))
       );
+      // setValue('industry_id', form.industry_id);
     };
     loadIndustries();
   }, []);
@@ -582,7 +598,13 @@ const form: React.FC<FormProps> = ({
             readOnly={required}
             ref={npwpRef}
             placeholder='000.000.000.0-000.000'
-            value={!required ? formattedNpwp : ''}
+            value={
+              !required
+                ? formattedNpwp === ''
+                  ? form.npwp
+                  : formattedNpwp
+                : ''
+            }
             maxLength={21} // Set maximum length to 16 characters
             onChange={(e) => {
               if (!required) {
-- 
cgit v1.2.3


From 11f415a8c9438362078d0eceee37701edbdeaafc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 09:28:14 +0700
Subject: <iman> update fetch data

---
 .../modules/register/components/FormBisnis.tsx     | 72 ++++++++++++----------
 1 file changed, 41 insertions(+), 31 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index c88ec735..d4fdbbbd 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -1,4 +1,11 @@
-import { ChangeEvent, useEffect, useMemo, useRef, useState } from 'react';
+import {
+  ChangeEvent,
+  useEffect,
+  useMemo,
+  useRef,
+  useState,
+  MouseEvent,
+} from 'react';
 import { useMutation } from 'react-query';
 import { useRegisterStore } from '../stores/useRegisterStore';
 import { RegisterProps } from '~/types/auth';
@@ -62,7 +69,6 @@ const form: React.FC<FormProps> = ({
 
   const router = useRouter();
   const toast = useToast();
-
   const emailRef = useRef<HTMLInputElement>(null);
   const businessNameRef = useRef<HTMLInputElement>(null);
   const companyTypeRef = useRef<HTMLInputElement>(null);
@@ -94,38 +100,14 @@ const form: React.FC<FormProps> = ({
 
   useEffect(() => {
     if (form.company_type_id) {
-      console.log('form.company_type_id', form.company_type_id);
-      setValue('companyType', form.company_type_id);
+      setValue('companyType', parseInt(form.company_type_id));
     }
-  }, [form.company_type_id]);
-
-  useEffect(() => {
-    const selectedCompanyType = companyTypes.find(
-      (company) => company.value === watch('companyType')
-    );
-    if (selectedCompanyType) {
-      console.log('selectedCompanyType', selectedCompanyType);
-      updateForm('company_type_id', `${selectedCompanyType?.value}`);
-      // setCompanyTypes([
-      //   {
-      //     value: '2',
-      //     label: 'Distributor',
-      //   },
-      // ]);
-      validate();
-    }
-  }, [watch('companyType'), companyTypes]);
-
+  }, []);
   useEffect(() => {
-    const selectedIndustryType = industries.find(
-      (industry) => industry.value === watch('industry_id')
-    );
-    if (selectedIndustryType) {
-      updateForm('industry_id', `${selectedIndustryType?.value}`);
-      setSelectedCategory(selectedIndustryType.category);
-      validate();
+    if (form.industry_id) {
+      setValue('industry_id', parseInt(form.industry_id));
     }
-  }, [watch('industry_id'), industries]);
+  }, []);
 
   useEffect(() => {
     const loadIndustries = async () => {
@@ -326,6 +308,32 @@ const form: React.FC<FormProps> = ({
     };
     loadIndustries();
   }, [buttonSubmitClick, chekValid]);
+
+  const handleCompanyTypeChange = (event: MouseEvent<HTMLDivElement>) => {
+    const selectedCompanyTypeValue = watch('companyType');
+    const selectedCompanyType = companyTypes.find(
+      (company) => company.value === selectedCompanyTypeValue
+    );
+
+    if (selectedCompanyType !== undefined) {
+      updateForm('company_type_id', `${selectedCompanyType.value}`);
+      validate();
+    }
+  };
+  useEffect(() => {}, [watch('industry_id'), industries]);
+
+  const handleIndustriIdChange = (event: MouseEvent<HTMLDivElement>) => {
+    const selectedIndustriIdValue = watch('industry_id');
+    const selectedIndustryType = industries.find(
+      (industry) => industry.value === selectedIndustriIdValue
+    );
+    if (selectedIndustryType) {
+      updateForm('industry_id', `${selectedIndustryType?.value}`);
+      setSelectedCategory(selectedIndustryType.category);
+      validate();
+    }
+  };
+
   return (
     <>
       <BottomPopup
@@ -393,6 +401,7 @@ const form: React.FC<FormProps> = ({
             <div
               className='w-4/5 pr-1 max-h-11 transition-all duration-500'
               ref={companyTypeRef}
+              onClick={handleCompanyTypeChange}
             >
               <Controller
                 name='companyType'
@@ -440,6 +449,7 @@ const form: React.FC<FormProps> = ({
           <div
             className='max-h-10 transition-all duration-500'
             ref={industryRef}
+            onClick={handleIndustriIdChange}
           >
             <Controller
               name='industry_id'
-- 
cgit v1.2.3


From 31ef67c8c2c3d80bf0c0cc040e551b4a45c3dedc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 15:36:39 +0700
Subject: <iman> update form bisnis to switch account

---
 .../modules/register/components/FormBisnis.tsx     | 126 +++++++++++++++++++--
 1 file changed, 115 insertions(+), 11 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index d4fdbbbd..ad92948e 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -24,10 +24,15 @@ import { Controller, useForm } from 'react-hook-form';
 import HookFormSelect from '@/core/components/elements/Select/HookFormSelect';
 import odooApi from '~/libs/odooApi';
 import { toast } from 'react-hot-toast';
-import { EyeIcon } from '@heroicons/react/24/outline';
+import {
+  EyeIcon,
+  CheckCircleIcon,
+  XCircleIcon,
+} from '@heroicons/react/24/outline';
 import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
 import Image from 'next/image';
 import useDevice from '@/core/hooks/useDevice';
+import useAuth from '@/core/hooks/useAuth';
 interface FormProps {
   type: string;
   required: boolean;
@@ -101,14 +106,16 @@ const form: React.FC<FormProps> = ({
   useEffect(() => {
     if (form.company_type_id) {
       setValue('companyType', parseInt(form.company_type_id));
+      updateForm('sppkp_document', 'fileBase64.jpg');
     }
-  }, []);
+  }, [form.company_type_id]);
   useEffect(() => {
     if (form.industry_id) {
       setValue('industry_id', parseInt(form.industry_id));
     }
-  }, []);
+  }, [form.industry_id]);
 
+  console.log('form', form);
   useEffect(() => {
     const loadIndustries = async () => {
       const dataIndustries = await odooApi('GET', '/api/v1/partner/industry');
@@ -230,7 +237,7 @@ const form: React.FC<FormProps> = ({
         toast({
           ...toastProps,
           title:
-            'Format file yang diijinkan adalah .pdf, .doc, .docx, .png, .jpg, atau .jpeg',
+            'Format file yang diijinkan adalah .pdf, .png, .jpg, atau .jpeg',
           status: 'error',
         });
         event.target.value = '';
@@ -238,10 +245,10 @@ const form: React.FC<FormProps> = ({
       }
 
       // Check for file size
-      if (file.size > 5000000) {
+      if (file.size > 2000000) {
         toast({
           ...toastProps,
-          title: 'Maksimal ukuran file adalah 5MB',
+          title: 'Maksimal ukuran file adalah 2MB',
           status: 'error',
         });
         event.target.value = '';
@@ -320,7 +327,6 @@ const form: React.FC<FormProps> = ({
       validate();
     }
   };
-  useEffect(() => {}, [watch('industry_id'), industries]);
 
   const handleIndustriIdChange = (event: MouseEvent<HTMLDivElement>) => {
     const selectedIndustriIdValue = watch('industry_id');
@@ -334,13 +340,65 @@ const form: React.FC<FormProps> = ({
     }
   };
 
+  const [fileUrl, setFileUrl] = useState('');
+  const [popUpNPWP, setPopUpNpwp] = useState(false);
+  const [popSppkp, setPopUpSppkp] = useState(false);
+  const [hasNPWP, sethasNpwp] = useState(false);
+  const [hasSPPKP, sethasSPPKP] = useState(false);
+  const [fileUrlSppkp, setFileUrlSppkp] = useState('');
+
+  useEffect(() => {
+    const url = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/npwp/109119`;
+    if (url) {
+      setFileUrl(url);
+      sethasNpwp(true);
+    }
+    const urlSppkp = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/sppkp/109119`;
+    if (urlSppkp) {
+      setFileUrlSppkp(urlSppkp);
+      sethasSPPKP(true);
+    }
+  }, []);
+
   return (
     <>
+      <BottomPopup
+        className='h-full object-contain object-center w-full'
+        title='Dokumen NPWP'
+        active={popUpNPWP}
+        close={() => setPopUpNpwp(false)}
+      >
+        <div className='flex p-2'>
+          <iframe
+            src={fileUrl}
+            width='800px'
+            height='600px'
+            title='NPWP File'
+            frameBorder='0'
+          ></iframe>
+        </div>
+      </BottomPopup>
+      <BottomPopup
+        className='h-full object-contain object-center w-full'
+        title='Dokumen SPPKP'
+        active={popSppkp}
+        close={() => setPopUpSppkp(false)}
+      >
+        <div className='flex p-2'>
+          <iframe
+            src={fileUrlSppkp}
+            width='800px'
+            height='600px'
+            title='NPWP File'
+            frameBorder='0'
+          ></iframe>
+        </div>
+      </BottomPopup>
       <BottomPopup
         className=''
         title='Contoh SPPKP'
         active={isExample}
-        close={() => setIsExample(false)}
+        close={() => setPopUpNpwp(false)}
       >
         <div className='flex p-2'>
           <Image
@@ -704,14 +762,36 @@ const form: React.FC<FormProps> = ({
             ref={docsNpwpRef}
             readOnly={required}
             onChange={handleFileChange}
-            accept='.pdf,.doc,.docx,.png,.jpg,.jpeg' // Filter file types
+            accept='.pdf,.png,.jpg,.jpeg' // Filter file types
           />
 
           {chekValid && isPKP && !required && !!errors.npwp_document && (
             <span className='form-msg-danger'>{errors.npwp_document}</span>
           )}
+          <span className='form-msg-danger ml-4 text-xs mb-2'>
+            Format: .pdf, .png, .jpg, atau .jpeg, Maks 2MB
+          </span>
+          {hasNPWP && (
+            <div className='px-3'>
+              <div className='inline-flex flex-row items-center justify-between w-full rounded-md h-12 bg-green-50 px-2 py-1 text-sm font-medium text-green-700 ring-1 ring-inset ring-green-600/20'>
+                <div className='w-4/5  flex flex-row items-center justify-start '>
+                  <CheckCircleIcon className='w-6 mr-2' />
+                  Dokumen sudah diupload
+                </div>
+                <div className='w-1/5  flex flex-row  justify-end'>
+                  <EyeIcon
+                    onClick={() => setPopUpNpwp(true)}
+                    className={`w-6 mr-2 hover:scale-110 transition-transform duration-200}`}
+                  />
+                  <XCircleIcon
+                    onClick={() => sethasNpwp(false)}
+                    className='w-6 hover:scale-110 transition-transform duration-200'
+                  />
+                </div>
+              </div>
+            </div>
+          )}
         </div>
-
         <div>
           <label htmlFor='sppkp_document' className='font-bold'>
             Dokumen SPPKP{' '}
@@ -732,8 +812,32 @@ const form: React.FC<FormProps> = ({
             ref={docsSppkpRef}
             readOnly={required}
             onChange={handleFileChange}
-            accept='.pdf,.doc,.docx,.png,.jpg,.jpeg' // Filter file types
+            accept='.pdf,.png,.jpg,.jpeg'
+            content='lagu.jpg'
           />
+          <span className='form-msg-danger ml-4 text-xs mb-2'>
+            Format: .pdf, .png, .jpg, atau .jpeg, Maks 2MB
+          </span>
+          {hasSPPKP && (
+            <div className='px-3'>
+              <div className='inline-flex flex-row items-center justify-between w-full rounded-md h-12 bg-green-50 px-2 py-1 text-sm font-medium text-green-700 ring-1 ring-inset ring-green-600/20'>
+                <div className='w-4/5  flex flex-row items-center justify-start '>
+                  <CheckCircleIcon className='w-6 mr-2' />
+                  Dokumen sudah di upload
+                </div>
+                <div className='w-1/5  flex flex-row  justify-end'>
+                  <EyeIcon
+                    onClick={() => setPopUpSppkp(true)}
+                    className={`w-6 mr-2 hover:scale-110 transition-transform duration-200}`}
+                  />
+                  <XCircleIcon
+                    onClick={() => sethasSPPKP(false)}
+                    className='w-6 hover:scale-110 transition-transform duration-200'
+                  />
+                </div>
+              </div>
+            </div>
+          )}
 
           {chekValid && isPKP && !required && !!errors.sppkp_document && (
             <span className='form-msg-danger'>{errors.sppkp_document}</span>
-- 
cgit v1.2.3


From 016cbe790dd698ee258f17c8218ef6fdc667ad0d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 17:00:00 +0700
Subject: <iman> update switch account

---
 src-migrate/modules/register/components/FormBisnis.tsx | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index ad92948e..cc05a3bf 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -115,7 +115,6 @@ const form: React.FC<FormProps> = ({
     }
   }, [form.industry_id]);
 
-  console.log('form', form);
   useEffect(() => {
     const loadIndustries = async () => {
       const dataIndustries = await odooApi('GET', '/api/v1/partner/industry');
-- 
cgit v1.2.3


From 3eb78e21b89bd0bdddb803767ea6ec983794994b Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 28 Sep 2024 10:01:30 +0700
Subject: <iman> update temp switch account

---
 .../modules/register/components/FormBisnis.tsx     | 52 +++++++++++++++-------
 1 file changed, 37 insertions(+), 15 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index cc05a3bf..932bd326 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -51,6 +51,10 @@ interface companyType {
   value: string;
   label: string;
 }
+interface Auth {
+  id: string;
+  parentId: string;
+}
 
 const form: React.FC<FormProps> = ({
   type,
@@ -68,7 +72,7 @@ const form: React.FC<FormProps> = ({
   // Inside your component
   const [formattedNpwp, setFormattedNpwp] = useState<string>(''); // State for formatted NPWP
   const [unformattedNpwp, setUnformattedNpwp] = useState<string>(''); // State for unformatted NPWP
-
+  const auth = useAuth() as unknown as Auth;
   const [industries, setIndustries] = useState<industry_id[]>([]);
   const [companyTypes, setCompanyTypes] = useState<companyType[]>([]);
 
@@ -342,22 +346,40 @@ const form: React.FC<FormProps> = ({
   const [fileUrl, setFileUrl] = useState('');
   const [popUpNPWP, setPopUpNpwp] = useState(false);
   const [popSppkp, setPopUpSppkp] = useState(false);
-  const [hasNPWP, sethasNpwp] = useState(false);
-  const [hasSPPKP, sethasSPPKP] = useState(false);
+  const [hasNPWP, setHasNpwp] = useState(false);
+  const [hasSPPKP, setHasSPPKP] = useState(false);
   const [fileUrlSppkp, setFileUrlSppkp] = useState('');
 
   useEffect(() => {
-    const url = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/npwp/109119`;
-    if (url) {
-      setFileUrl(url);
-      sethasNpwp(true);
-    }
-    const urlSppkp = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/sppkp/109119`;
-    if (urlSppkp) {
-      setFileUrlSppkp(urlSppkp);
-      sethasSPPKP(true);
+    const checkUrl = async (url: string | URL | Request) => {
+      try {
+        const response = await fetch(url, { method: 'HEAD' });
+        return response.ok; // Returns true if status is 200-299
+      } catch (error) {
+        console.error('Error accessing URL:', url, error);
+        return false;
+      }
+    };
+
+    const npwpUrl = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/npwp/${auth?.parentId}`;
+    const sppkpUrl = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/sppkp/${auth?.parentId}`;
+
+    if (auth?.parentId) {
+      checkUrl(npwpUrl).then((isAccessible) => {
+        if (isAccessible) {
+          setFileUrl(npwpUrl);
+          setHasNpwp(true);
+        }
+      });
+
+      checkUrl(sppkpUrl).then((isAccessible) => {
+        if (isAccessible) {
+          setFileUrlSppkp(sppkpUrl);
+          setHasSPPKP(true);
+        }
+      });
     }
-  }, []);
+  }, [auth?.parentId]);
 
   return (
     <>
@@ -783,7 +805,7 @@ const form: React.FC<FormProps> = ({
                     className={`w-6 mr-2 hover:scale-110 transition-transform duration-200}`}
                   />
                   <XCircleIcon
-                    onClick={() => sethasNpwp(false)}
+                    onClick={() => setHasNpwp(false)}
                     className='w-6 hover:scale-110 transition-transform duration-200'
                   />
                 </div>
@@ -830,7 +852,7 @@ const form: React.FC<FormProps> = ({
                     className={`w-6 mr-2 hover:scale-110 transition-transform duration-200}`}
                   />
                   <XCircleIcon
-                    onClick={() => sethasSPPKP(false)}
+                    onClick={() => setHasSPPKP(false)}
                     className='w-6 hover:scale-110 transition-transform duration-200'
                   />
                 </div>
-- 
cgit v1.2.3


From a8aabf3a4a2fb0208684d10b6eefa9b81b2bcc25 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 28 Sep 2024 11:24:04 +0700
Subject: <iman> update code

---
 src-migrate/modules/register/components/FormBisnis.tsx | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 932bd326..97c0acad 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -110,7 +110,6 @@ const form: React.FC<FormProps> = ({
   useEffect(() => {
     if (form.company_type_id) {
       setValue('companyType', parseInt(form.company_type_id));
-      updateForm('sppkp_document', 'fileBase64.jpg');
     }
   }, [form.company_type_id]);
   useEffect(() => {
-- 
cgit v1.2.3


From 2a030239105dba1f78a3fdc51ccc49a46bc60ca2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 30 Sep 2024 13:57:59 +0700
Subject: <iman> update switch account

---
 .../modules/register/components/FormBisnis.tsx     | 31 +++++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 97c0acad..16747ff3 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -348,12 +348,22 @@ const form: React.FC<FormProps> = ({
   const [hasNPWP, setHasNpwp] = useState(false);
   const [hasSPPKP, setHasSPPKP] = useState(false);
   const [fileUrlSppkp, setFileUrlSppkp] = useState('');
-
   useEffect(() => {
-    const checkUrl = async (url: string | URL | Request) => {
+    const checkUrlNPWP = async (url: string | URL | Request) => {
+      try {
+        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/npwp/${auth?.parentId}`;
+
+        return response; // Returns true if status is 200-299
+      } catch (error) {
+        console.error('Error accessing URL:', url, error);
+        return false;
+      }
+    };
+    const checkUrlSPPKP = async (url: string | URL | Request) => {
       try {
-        const response = await fetch(url, { method: 'HEAD' });
-        return response.ok; // Returns true if status is 200-299
+        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/sppkp/${auth?.parentId}`;
+
+        return response; // Returns true if status is 200-299
       } catch (error) {
         console.error('Error accessing URL:', url, error);
         return false;
@@ -364,14 +374,16 @@ const form: React.FC<FormProps> = ({
     const sppkpUrl = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/sppkp/${auth?.parentId}`;
 
     if (auth?.parentId) {
-      checkUrl(npwpUrl).then((isAccessible) => {
+      checkUrlNPWP(npwpUrl).then((isAccessible) => {
         if (isAccessible) {
           setFileUrl(npwpUrl);
           setHasNpwp(true);
+          updateForm('npwp_document', ' ');
+          updateForm('sppkp_document', ' ');
         }
       });
 
-      checkUrl(sppkpUrl).then((isAccessible) => {
+      checkUrlSPPKP(sppkpUrl).then((isAccessible) => {
         if (isAccessible) {
           setFileUrlSppkp(sppkpUrl);
           setHasSPPKP(true);
@@ -835,6 +847,9 @@ const form: React.FC<FormProps> = ({
             accept='.pdf,.png,.jpg,.jpeg'
             content='lagu.jpg'
           />
+          {chekValid && isPKP && !required && !!errors.sppkp_document && (
+            <span className='form-msg-danger'>{errors.sppkp_document}</span>
+          )}
           <span className='form-msg-danger ml-4 text-xs mb-2'>
             Format: .pdf, .png, .jpg, atau .jpeg, Maks 2MB
           </span>
@@ -858,10 +873,6 @@ const form: React.FC<FormProps> = ({
               </div>
             </div>
           )}
-
-          {chekValid && isPKP && !required && !!errors.sppkp_document && (
-            <span className='form-msg-danger'>{errors.sppkp_document}</span>
-          )}
         </div>
       </form>
     </>
-- 
cgit v1.2.3


From ed679c9b8ea85e8f181cf67465effc4b5ff1a7bc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 09:42:51 +0700
Subject: <iman> update code has npwp atau sppkp

---
 src-migrate/modules/register/components/FormBisnis.tsx | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 16747ff3..9e5a0c07 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -351,9 +351,11 @@ const form: React.FC<FormProps> = ({
   useEffect(() => {
     const checkUrlNPWP = async (url: string | URL | Request) => {
       try {
-        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/npwp/${auth?.parentId}`;
-
-        return response; // Returns true if status is 200-299
+        const response = await odooApi(
+          'GET',
+          `/api/v1/user/chek/npwp/${auth?.parentId}`
+        );
+        return response.status; // Returns true if status is 200-299
       } catch (error) {
         console.error('Error accessing URL:', url, error);
         return false;
@@ -361,9 +363,12 @@ const form: React.FC<FormProps> = ({
     };
     const checkUrlSPPKP = async (url: string | URL | Request) => {
       try {
-        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/sppkp/${auth?.parentId}`;
+        const response = await odooApi(
+          'GET',
+          `/api/v1/user/chek/sppkp/${auth?.parentId}`
+        );
 
-        return response; // Returns true if status is 200-299
+        return response.status; // Returns true if status is 200-299
       } catch (error) {
         console.error('Error accessing URL:', url, error);
         return false;
@@ -379,7 +384,6 @@ const form: React.FC<FormProps> = ({
           setFileUrl(npwpUrl);
           setHasNpwp(true);
           updateForm('npwp_document', ' ');
-          updateForm('sppkp_document', ' ');
         }
       });
 
@@ -387,6 +391,7 @@ const form: React.FC<FormProps> = ({
         if (isAccessible) {
           setFileUrlSppkp(sppkpUrl);
           setHasSPPKP(true);
+          updateForm('sppkp_document', ' ');
         }
       });
     }
-- 
cgit v1.2.3


From bdfe0ad9b7cc5ef819b7b74fec6159d03280ab91 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 25 Oct 2024 10:19:56 +0700
Subject: <iman> update switch account

---
 src-migrate/modules/register/components/FormBisnis.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 9e5a0c07..9f9f1ca5 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -435,7 +435,7 @@ const form: React.FC<FormProps> = ({
         className=''
         title='Contoh SPPKP'
         active={isExample}
-        close={() => setPopUpNpwp(false)}
+        close={() => setIsExample(false)}
       >
         <div className='flex p-2'>
           <Image
-- 
cgit v1.2.3

