summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/merchant/components/Dokumen.jsx44
-rw-r--r--src/lib/merchant/components/InformasiPerusahaan.jsx41
-rw-r--r--src/lib/merchant/components/Merchant.jsx10
3 files changed, 60 insertions, 35 deletions
diff --git a/src/lib/merchant/components/Dokumen.jsx b/src/lib/merchant/components/Dokumen.jsx
index a701a36d..fb4d1914 100644
--- a/src/lib/merchant/components/Dokumen.jsx
+++ b/src/lib/merchant/components/Dokumen.jsx
@@ -84,12 +84,12 @@ const Dokumen = ({ handleIsError }) => {
const recaptchaRef = useRef(null);
const npwpRef = useRef(null);
const sppkpRef = useRef(null);
+ const ktpDirutRef = useRef(null);
const kartuNamaRef = useRef(null);
const suratPernyataanRef = useRef(null);
const fotoKantorRef = useRef(null);
const dataProdukRef = useRef(null);
const pricelistRef = useRef(null);
- const ktpDirutRef = useRef(null);
const router = useRouter();
const auth = useAuth();
@@ -274,27 +274,38 @@ const Dokumen = ({ handleIsError }) => {
const dataProduk = DeatailFile.dataProduk;
const pricelist = DeatailFile.pricelist;
if (!npwp && isPkp) {
+ if (npwpRef?.current) {
+ npwpRef.current.scrollIntoView(options);
+ }
toast.error('NPWP wajib di tambahkan');
return;
}
if (!sppkp && isPkp) {
toast.error('SPPKP wajib di tambahkan');
+ if (sppkpRef?.current) {
+ sppkpRef.current.scrollIntoView(options);
+ }
return;
}
if (!dokumenKtpDirut && !isPkp) {
- if (ktpDirutRef.current) {
+ toast.error('KTP Dirut/Direktur wajib di tambahkan');
+ if (ktpDirutRef?.current) {
ktpDirutRef.current.scrollIntoView(options);
- console.log('MASUK SINI BANG');
}
- toast.error('KTP Dirut/Direktur wajib di tambahkan');
return;
}
if (!fotoKantor) {
toast.error('Foto Gudang / Kantor Bagian Depan wajib di tambahkan');
+ if (fotoKantorRef?.current) {
+ fotoKantorRef.current.scrollIntoView(options);
+ }
return;
}
if (!pricelist) {
toast.error('Pricelist wajib di tambahkan');
+ if (pricelistRef?.current) {
+ pricelistRef.current.scrollIntoView(options);
+ }
return;
}
const toastId = toast.loading('Mengirimkan formulir merchant...');
@@ -447,7 +458,7 @@ const Dokumen = ({ handleIsError }) => {
<div className='w-full flex flex-row items-start'>
<div className='w-2/5 flex flex-row justify-between items-center'>
<div>
- <label className='form-label text-nowrap'>
+ <label className='form-label text-nowrap' ref={sppkpRef}>
SPPKP{' '}
{!isPkp && (
<span className=' opacity-60'>(Opsional)</span>
@@ -545,7 +556,7 @@ const Dokumen = ({ handleIsError }) => {
<div className='w-full flex flex-row'>
<div className='w-2/5'>
- <label className='form-label text-nowrap'>
+ <label className='form-label text-nowrap' ref={kartuNamaRef}>
Kartu Nama <span className=' opacity-60'>(Opsional)</span>{' '}
</label>
<span className='opacity-65 text-xs'>
@@ -586,7 +597,10 @@ const Dokumen = ({ handleIsError }) => {
<div className='w-full flex flex-row items-start '>
<div className='w-2/5 flex flex-row justify-between items-center '>
<div>
- <label className='form-label text-nowrap'>
+ <label
+ className='form-label text-nowrap'
+ ref={suratPernyataanRef}
+ >
Surat Pernyataan Nomor Rekening{' '}
<span className=' opacity-60'>(Opsional)</span>
</label>
@@ -637,7 +651,10 @@ const Dokumen = ({ handleIsError }) => {
</div>
<div className='w-full flex flex-row items-start '>
<div className='w-2/5 flex flex-col justify-start items-start '>
- <label className='form-label text-nowrap'>
+ <label
+ className='form-label text-nowrap'
+ ref={fotoKantorRef}
+ >
Foto Gudang / Kantor Bagian Depan
</label>
<span className='opacity-65 text-xs'>
@@ -676,7 +693,10 @@ const Dokumen = ({ handleIsError }) => {
</div>
<div className='w-full flex flex-row items-start '>
<div className='w-2/5 flex flex-col justify-start items-start '>
- <label className='form-label text-nowrap'>
+ <label
+ className='form-label text-nowrap'
+ ref={dataProdukRef}
+ >
Data Produk (Item Name, Gambar, Deskripsi){' '}
<span className=' opacity-60'>(Opsional)</span>{' '}
</label>
@@ -710,13 +730,15 @@ const Dokumen = ({ handleIsError }) => {
</span>
<div className='text-caption-2 text-danger-500 mt-1'>
- {errors.fotoKantor?.message}
+ {errors.dataProduk?.message}
</div>
</div>
</div>
<div className='w-full flex flex-row items-start '>
<div className='w-2/5 flex flex-col justify-start items-start '>
- <label className='form-label text-nowrap'>Pricelist</label>
+ <label className='form-label text-nowrap' ref={pricelistRef}>
+ Pricelist
+ </label>
<span className='opacity-65 text-xs'>
Pastikan dokumen yang anda upload sudah benar
</span>
diff --git a/src/lib/merchant/components/InformasiPerusahaan.jsx b/src/lib/merchant/components/InformasiPerusahaan.jsx
index bf968aad..60e61e2e 100644
--- a/src/lib/merchant/components/InformasiPerusahaan.jsx
+++ b/src/lib/merchant/components/InformasiPerusahaan.jsx
@@ -19,7 +19,7 @@ import { EyeIcon } from '@heroicons/react/24/outline';
import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
import Image from 'next/image';
import ImageBanner from '~/components/ui/image';
-import { ChevronRightIcon } from '@heroicons/react/24/outline';
+import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
import MobileView from '@/core/components/views/MobileView';
import DesktopView from '@/core/components/views/DesktopView';
import getFileBase64 from '@/core/utils/getFileBase64';
@@ -297,21 +297,19 @@ const CreateMerchant = ({ handleIsError }) => {
' \r\n No Hp : ' +
values.mobile,
};
- isError(true);
- toast.dismiss(toastId);
- toast.success('Berhasil menambahkan data');
- // const formData = new FormData();
- // formData.append('npwp', values.npwp[0]);
- // const create_leads = await createMerchantApi({ data });
- // if (create_leads) {
- // toast.dismiss(toastId);
- // toast.success('Berhasil menambahkan data');
- // reset();
- // router.push('/');
- // } else {
- // toast.dismiss(toastId);
- // toast.error('Gagal menambahkan data');
- // }
+ // isError(true);
+ // toast.dismiss(toastId);
+ // toast.success('Berhasil menambahkan data');
+ const create_leads = await createMerchantApi({ data });
+ if (create_leads) {
+ toast.dismiss(toastId);
+ toast.success('Berhasil menambahkan data');
+ reset();
+ router.push('/');
+ } else {
+ toast.dismiss(toastId);
+ toast.error('Gagal menambahkan data');
+ }
};
// const DownLoadSurat = () => {
@@ -834,7 +832,7 @@ const CreateMerchant = ({ handleIsError }) => {
/>
</div> */}
</div>
- <div className='flex justify-start'>
+ <div className='flex justify-end'>
{/* <Button
colorScheme='red'
className='w-full md:w-fit'
@@ -843,12 +841,17 @@ const CreateMerchant = ({ handleIsError }) => {
Daftar Merchant{' '}
{<ChevronRightIcon className='w-5' color='white' />}
</Button> */}
+
<div>
+ <span className='text-xs opacity-60'>
+ *Pastikan data yang anda masukan sudah benar dan sesuai
+ </span>
<button
type='submit'
- className='btn-light bg-red-500 rounded-lg text-white w-full md:w-fit mt-6 ml-0 md:ml-auto flex justify-between hover:bg-red-400'
+ className='btn-light bg-red-500 rounded-lg text-white w-fit py-2 px-4 md:w-fit mt-2 ml-0 md:ml-auto flex justify-between hover:bg-red-400'
>
- <span>Daftar Merchant </span>
+ <span className={` `}>Langkah Selanjutnya</span>
+ {<ChevronRightIcon className='w-5' />}
</button>
</div>
</div>
diff --git a/src/lib/merchant/components/Merchant.jsx b/src/lib/merchant/components/Merchant.jsx
index a6f923e3..59f80be5 100644
--- a/src/lib/merchant/components/Merchant.jsx
+++ b/src/lib/merchant/components/Merchant.jsx
@@ -40,10 +40,10 @@ const Merchant = () => {
setError(value); // Memperbarui state berdasarkan isError
};
const stepDivs = [
- <Dokumen handleIsError={handleIsError} />,
- <SyaratDagang handleIsError={handleIsError} />,
- <InformasiVendor handleIsError={handleIsError} />,
<InformasiPerusahaan handleIsError={handleIsError} />,
+ <InformasiVendor handleIsError={handleIsError} />,
+ <SyaratDagang handleIsError={handleIsError} />,
+ <Dokumen handleIsError={handleIsError} />,
];
const stepLabels = [
@@ -208,7 +208,7 @@ const Merchant = () => {
{isMobile && (
<div className='h-[2px] bg-gray-300 w-[120%] inset-0 mt-4 mb-4 relative transform -translate-x-5'></div>
)}
- <div
+ {/* <div
className={`flex ${
isMobile
? 'flex-col justify-start items-start'
@@ -269,7 +269,7 @@ const Merchant = () => {
</Button>
</div>
)}
- </div>
+ </div> */}
</div>
</>
);