// import HookFormSelect from '@/core/components/elements/Select/HookFormSelect'; // import cityApi from '@/lib/address/api/cityApi'; // import stateApi from '@/lib/address/api/stateApi.js'; // import districtApi from '@/lib/address/api/districtApi'; // import subDistrictApi from '@/lib/address/api/subDistrictApi'; // import { yupResolver } from '@hookform/resolvers/yup'; // import React, { // useEffect, // useRef, // useState, // forwardRef, // useImperativeHandle, // } from 'react'; // import ReCAPTCHA from 'react-google-recaptcha'; // import { Controller, useForm } from 'react-hook-form'; // import { toast } from 'react-hot-toast'; // import * as Yup from 'yup'; // import createMerchantApi from '../api/createMerchantApi'; // import getMerchantApi from '../api/getMerchantApi'; // import addressApi from '@/lib/address/api/addressApi'; // import PageContent from '@/lib/content/components/PageContent'; // import { useRouter } from 'next/router'; // import useAuth from '@/core/hooks/useAuth'; // import { Radio, RadioGroup, Stack, Checkbox, Button } from '@chakra-ui/react'; // 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 MobileView from '@/core/components/views/MobileView'; // import DesktopView from '@/core/components/views/DesktopView'; // import getFileBase64 from '@/core/utils/getFileBase64'; // import odooApi from '~/libs/odooApi'; // const SyaratDagang = forwardRef(({ handleIsError, isKonfirmasi }, ref) => { // const isError = (value) => { // // Logika menentukan error // const result = value ? true : false; // handleIsError(result); // Panggil handleIsError dari Merchant // return result; // }; // const { // register, // handleSubmit, // formState: { errors }, // control, // reset, // watch, // setValue, // getValues, // } = useForm({ // resolver: yupResolver(validationSchema), // defaultValues, // }); // const [bigData, setbigData] = useState([]); // const [isExample, setIsExample] = useState(false); // const recaptchaRef = useRef(null); // const router = useRouter(); // useEffect(() => { // const loadData = async () => { // const data = await getMerchantApi(); // setbigData(data); // if (data) { // reset({ // isKembaliBarang: data.isKembaliBarang || '', // textReturn: data.textReturn || '', // tenggatWaktu: (() => { // const waktu = data.tenggatWaktu // ? data.tenggatWaktu.split(' ')[0] // : ''; // if (waktu === '14') return '14'; // if (waktu === '30') return '30'; // return 'custom'; // })(), // customTenggatWaktu: (() => { // if (watch('tenggatWaktu') === 'custom') // return data.tenggatWaktu ? data.tenggatWaktu : ''; // return ''; // })(), // sertifikatProduk: data.sertifikatProduk || '', // customSertifikatProduk: data.customSertifikatProduk || '', // tempoGaransi: parseInt(data.tempoGaransi) || '', // explainGaransi: data.explainGaransi || '', // minimumPembelian: // data.isOrderQuantity == 'tidak' ? '' : data.minimumPembelian || '', // isOrderQuantity: data.isOrderQuantity || '', // }); // // handleKreditLimitChange(data.kreditLimit); // if (watch('sertifikatProduk') != false) { // setSelectedIds(watch('sertifikatProduk').split(',').map(Number)); // } // if (watch('customSertifikatProduk')) { // // setSelectedIds([...selectedIds, 4]); // } // } // }; // loadData(); // }, []); // useEffect(() => { // if (!isKonfirmasi) { // window.scrollTo({ // top: 0, // behavior: 'smooth', // }); // } // }, []); // useImperativeHandle(ref, () => () => { // handleSubmit(onSubmitHandler)(); // }); // const auth = useAuth(); // if (auth == false) { // router.push(`/login?next=${encodeURIComponent('/daftar-merchant')}`); // } // const dataGaransi = [ // { value: 1, label: '6 Bulan Garansi' }, // { value: 2, label: '1 Tahun Garansi' }, // { value: 3, label: '2 Tahun Garansi' }, // ]; // const dataMinimumOrderQuantity = [ // { value: 'dus', label: 'Dus' }, // { value: 'lusin', label: 'Lusin' }, // { value: 'minimum pembelian', label: 'Minimum pembelian' }, // ]; // const category_produk = [ // { id: 0, name: 'TKDN' }, // { id: 1, name: 'SNI' }, // { id: 2, name: 'K3L' }, // { id: 3, name: '' }, // ]; // const [selectedIds, setSelectedIds] = useState( // watch('sertifikatProduk') // ? watch('sertifikatProduk').split(',').map(Number) // : [] // // form.sertifikatProduk ? form.sertifikatProduk.split(',').map(Number) : [] // Parse string menjadi array angka // // [] // Parse string menjadi array angka // ); // const handleCheckboxChange = (id) => { // const updatedSelected = selectedIds.includes(id) // ? selectedIds.filter((selectedId) => selectedId !== id) // : [...selectedIds, id]; // setSelectedIds(updatedSelected); // // Mengubah array kembali menjadi string yang dipisahkan oleh koma // setValue('sertifikatProduk', updatedSelected.join(',')); // }; // const custom_sertifikat_produk_handle = () => { // const updatedSelected = [...selectedIds, 3]; // setSelectedIds(updatedSelected); // // Mengubah array kembali menjadi string yang dipisahkan oleh koma // setValue('sertifikatProduk', updatedSelected.join(',')); // }; // const isChecked = (id) => selectedIds.includes(id); // const handleCheckboxReturChange = (value) => { // setValue('isKembaliBarang', `${value}`); // }; // const handleCheckboxOrderQuantityChange = (value) => { // setValue('isOrderQuantity', `${value}`); // }; // const handleCheckboxTenggatWaktuChange = (value) => { // setValue('tenggatWaktu', `${value}`); // }; // const onSubmitHandler = async (values) => { // const toastId = toast.loading('Mengirimkan formulir merchant...'); // const data = { // is_kembali_barang: values.isKembaliBarang, // text_return: values.textReturn, // tenggat_waktu: values.tenggatWaktu, // custom_tenggat_waktu: values.customTenggatWaktu, // sertifikat_produk: values.sertifikatProduk, // custom_sertifikat_produk: // values.customSertifikatProduk == '' // ? false // : values.customSertifikatProduk, // tempo_garansi: values.tempoGaransi, // explain_garansi: values.explainGaransi, // is_order_quantity: values.isOrderQuantity, // minimum_pembelian: values.minimumPembelian, // }; // const create_leads = await createMerchantApi({ data }); // if (create_leads) { // toast.dismiss(toastId); // toast.success('Berhasil menambahkan data'); // isError(false); // reset(); // // router.push('/'); // } else { // toast.dismiss(toastId); // toast.error('Gagal menambahkan data'); // } // }; // // const DownLoadSurat = () => { // // download surat dari /public/file/Surat Pernyataan Nomor Rekening.docx // // }; // if (!auth) { // return; // } // // Tetap di bagian atas, tidak boleh ada kondisi sebelum hook // return ( // <> // setIsExample(false)} // > //
// Contoh SPPKP //
//
// //
//

// Syarat Perdagangan //

//
//
//
//
// //
//
//
// // //
// // Ya, dapat diretur // // {watch('isKembaliBarang') == 'ya' && ( //