From 9a49b8d84761781531cb417731cb9ef802f63541 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 4 Dec 2024 10:59:21 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Dokumen.jsx | 70 +++++++++++++++++----------
 1 file changed, 44 insertions(+), 26 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/Dokumen.jsx')

diff --git a/src/lib/pengajuan-tempo/component/Dokumen.jsx b/src/lib/pengajuan-tempo/component/Dokumen.jsx
index 8391de4a..f05dc9ce 100644
--- a/src/lib/pengajuan-tempo/component/Dokumen.jsx
+++ b/src/lib/pengajuan-tempo/component/Dokumen.jsx
@@ -72,6 +72,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const dokumenTempatBekerjaRef = useRef(null);
 
   useEffect(() => {
+    validateDokumen();
     // window.scrollTo({
     //   top: 0,
     //   behavior: 'smooth',
@@ -83,7 +84,6 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
           block: 'center',
         };
         if (errorsDokumen.dokumenNib && dokumenNibRef.current) {
-          console.log('errorsDokumen', errorsDokumen);
           dokumenNibRef.current.scrollIntoView(options);
           return;
         }
@@ -165,9 +165,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenNib'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded min-w-40 text-center'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenNib?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen?.dokumenNib?.name}
@@ -207,9 +209,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenNpwp'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenNpwp?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenNpwp}
@@ -247,9 +251,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenSppkp'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenSppkp?.name.length > 0
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenSppkp}
@@ -290,9 +296,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenAktaPerubahan'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenAktaPerubahan?.name.length > 0
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenAktaPerubahan}
@@ -332,9 +340,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenKtpDirut'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenKtpDirut?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenKtpDirut}
@@ -378,9 +388,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenAktaPendirian'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenAktaPendirian?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenAktaPendirian}
@@ -421,9 +433,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenLaporanKeuangan'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenLaporanKeuangan?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenLaporanKeuangan}
@@ -463,9 +477,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenFotoKantor'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenFotoKantor?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenFotoKantor}
@@ -505,9 +521,11 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='flex flex-col items-start'>
                       <label
                         htmlFor='dokumenTempatBekerja'
-                        className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
+                        className='cursor-pointer min-w-40 text-center bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded'
                       >
-                        Upload Dokumen
+                        {formDokumen?.dokumenTempatBekerja?.name
+                          ? 'Ubah Dokumen'
+                          : 'Upload Dokumen'}
                       </label>
                       <input
                         // value={formDokumen.dokumenTempatBekerja}
@@ -588,7 +606,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenNib'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer   bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenNib?.name
                       ? 'Sudah Upload'
@@ -626,7 +644,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenNpwp'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer   bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenNpwp?.name
                       ? 'Sudah Upload'
@@ -662,7 +680,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenSppkp'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer  bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenSppkp?.name
                       ? 'Sudah Upload'
@@ -703,7 +721,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenAktaPerubahan'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer  bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenAktaPerubahan?.name
                       ? 'Sudah Upload'
@@ -745,7 +763,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenKtpDirut'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer  bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenKtpDirut?.name
                       ? 'Sudah Upload'
@@ -828,7 +846,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenLaporanKeuangan'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer  bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenLaporanKeuangan?.name
                       ? 'Sudah Upload'
@@ -910,7 +928,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div className='flex flex-row gap-2'>
                   <label
                     htmlFor='dokumenTempatBekerja'
-                    className='cursor-pointer bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
+                    className='cursor-pointer  bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded w-fit min-w-40 text-nowrap text-center flex items-center justify-center'
                   >
                     {formDokumen?.dokumenTempatBekerja?.name
                       ? 'Sudah Upload'
-- 
cgit v1.2.3

