From 548e2b48b1c2f6521037765f96083a8d79f611d6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 17:08:55 +0700
Subject: <iman> add pengiriman section

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 604 +++++++++++++++++++++++
 1 file changed, 604 insertions(+)
 create mode 100644 src/lib/pengajuan-tempo/component/Pengiriman.jsx

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
new file mode 100644
index 00000000..91772c7f
--- /dev/null
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -0,0 +1,604 @@
+import React, { useState, useEffect, useMemo, useRef } from 'react';
+import { Controller, set, useForm } from 'react-hook-form';
+import HookFormSelect from '@/core/components/elements/Select/HookFormSelect';
+import odooApi from '~/libs/odooApi';
+import stateApi from '@/lib/address/api/stateApi.js';
+import cityApi from '@/lib/address/api/cityApi';
+import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
+import { usePengajuanTempoStorePengiriman } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
+  const { control, watch } = useForm();
+  const {
+    formPengiriman,
+    errorsPengiriman,
+    validatePengiriman,
+    updateFormPengiriman,
+  } = usePengajuanTempoStorePengiriman();
+  const [states, setState] = useState([]);
+  const [cities, setCities] = useState([]);
+  const [sameAddress, setSameAddress] = useState(false);
+
+  useEffect(() => {
+    const loadState = async () => {
+      let dataState = await stateApi();
+      dataState = dataState.map((state) => ({
+        value: state.id,
+        label: state.name,
+      }));
+      setState(dataState);
+    };
+    loadState();
+  }, []);
+
+  const watchState = watch('state');
+  useEffect(() => {
+    updateFormPengiriman('city', '');
+    if (watchState) {
+      updateFormPengiriman('state', `${watchState}`);
+      validate();
+      const loadCities = async () => {
+        let dataCities = await cityApi({ stateId: watchState });
+        dataCities = dataCities.map((city) => ({
+          value: city.id,
+          label: city.name,
+        }));
+        setCities(dataCities);
+      };
+      loadCities();
+    }
+  }, [watchState]);
+
+  const handleInputChange = (event) => {
+    const { name, value } = event.target;
+    updateFormPengiriman(name, value);
+    validatePengiriman();
+  };
+
+  const isFormValid = useMemo(
+    () => Object.keys(errorsPengiriman).length === 0,
+    [errorsPengiriman]
+  );
+
+  const PICNameRef = useRef(null);
+  const streetPengirimanRef = useRef(null);
+  const statePengirimanRef = useRef(null);
+  const cityPengirimanRef = useRef(null);
+  const zipRef = useRef(null);
+  const invoicePicRef = useRef(null);
+
+  const direkturEmailRef = useRef(null);
+  const purchasingNameRef = useRef(null);
+  const purchasingEmailRef = useRef(null);
+  const purchasingMobileRef = useRef(null);
+  const financeNameRef = useRef(null);
+  const financeMobileRef = useRef(null);
+  const financeEmailRef = useRef(null);
+
+  useEffect(() => {
+    const loadIndustries = async () => {
+      if (!isFormValid) {
+        const options = {
+          behavior: 'smooth',
+          block: 'center',
+        };
+        if (errorsPengiriman.PICName && PICNameRef.current) {
+          PICNameRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.streetPengiriman && streetPengirimanRef.current) {
+          streetPengirimanRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.statePengiriman && statePengirimanRef.current) {
+          statePengirimanRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.cityPengiriman && cityPengirimanRef.current) {
+          cityPengirimanRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.zip && zipRef.current) {
+          zipRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.invoicePic && invoicePicRef.current) {
+          invoicePicRef.current.scrollIntoView(options);
+          return;
+        }
+
+        if (errorsPengiriman.direkturEmail && direkturEmailRef.current) {
+          direkturEmailRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.purchasingName && purchasingNameRef.current) {
+          purchasingNameRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.purchasingMobile && purchasingMobileRef.current) {
+          purchasingMobileRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.purchasingEmail && purchasingEmailRef.current) {
+          purchasingEmailRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.financeName && financeNameRef.current) {
+          financeNameRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.financeMobile && financeMobileRef.current) {
+          financeMobileRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.financeEmail && financeEmailRef.current) {
+          financeEmailRef.current.scrollIntoView(options);
+          return;
+        }
+      }
+    };
+    loadIndustries();
+  }, [buttonSubmitClick, chekValid]);
+
+  useEffect(() => {
+    validatePengiriman();
+  }, [buttonSubmitClick]);
+  useEffect(() => {
+    if (sameAddress) {
+      updateFormPengiriman('streetPengiriman', formPengiriman.streetPengiriman);
+      updateFormPengiriman('statePengiriman', formPengiriman.statePengiriman);
+      updateFormPengiriman('cityPengiriman', formPengiriman.cityPengiriman);
+      updateFormPengiriman('zip', formPengiriman.zip);
+    }
+  }, [sameAddress]);
+  return (
+    <>
+      <div className='flex justify-start'>
+        <h1 className='font-bold'>Pengiriman</h1>
+      </div>
+      <form className='flex mt-4 flex-col w-full '>
+        <div className='w-full grid grid-row-2 gap-5'>
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Nama PIC Penerimaan Barang
+              </label>
+            </div>
+            <div className='w-3/5'>
+              <input
+                value={formPengiriman.PICName}
+                id='PICName'
+                name='PICName'
+                placeholder='Masukkan nama pic pengiriman disini'
+                type='text'
+                className='form-input'
+                aria-invalid={errorsPengiriman.PICName}
+                ref={PICNameRef}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.PICName}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Alamat Pengiriman Barang
+              </label>
+              <span className='text-xs opacity-60'>
+                pastikan alamat yang anda isi sesuai dengan alamat kirim barang
+              </span>
+            </div>
+            <div className='w-3/5 flex gap-3 flex-col'>
+              <div>
+                <input
+                  id='streetPengiriman'
+                  name='streetPengiriman'
+                  ref={streetPengirimanRef}
+                  placeholder='Masukkan alamat lengkap pengiriman barang'
+                  type='text'
+                  value={formPengiriman.streetPengiriman}
+                  className='form-input'
+                  onChange={handleInputChange}
+                />
+                {chekValid && (
+                  <div className='text-caption-2 text-danger-500 mt-1'>
+                    {errorsPengiriman.streetPengiriman}
+                  </div>
+                )}
+              </div>
+              <div className='sub-alamat flex flex-row w-full gap-3'>
+                <div className='w-2/5' ref={statePengirimanRef}>
+                  <Controller
+                    name='statePengiriman'
+                    control={control}
+                    render={(props) => (
+                      <HookFormSelect
+                        {...props}
+                        options={states}
+                        placeholder='Provinsi'
+                      />
+                    )}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.statePengiriman}
+                    </div>
+                  )}
+                </div>
+                <div className='w-1/3' ref={cityPengirimanRef}>
+                  <Controller
+                    name='cityPengiriman'
+                    control={control}
+                    render={(props) => (
+                      <HookFormSelect
+                        {...props}
+                        options={cities}
+                        disabled={!watchState}
+                        placeholder='Kota'
+                      />
+                    )}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.cityPengiriman}
+                    </div>
+                  )}
+                </div>
+                <div className='w-1/3'>
+                  <input
+                    id='zip'
+                    name='zip'
+                    ref={zipRef}
+                    placeholder='Kode Pos'
+                    type='number'
+                    value={formPengiriman.zip}
+                    className='form-input'
+                    onChange={handleInputChange}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.zip}
+                    </div>
+                  )}
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Nama PIC Penerimaan Invoice
+              </label>
+            </div>
+            <div className='w-3/5'>
+              <input
+                value={formPengiriman.invoicePic}
+                id='invoicePic'
+                name='invoicePic'
+                placeholder='Masukkan nama pic invoice disini'
+                type='text'
+                className='form-input'
+                aria-invalid={errorsPengiriman.invoicePic}
+                ref={invoicePicRef}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.invoicePic}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Alamat Pengiriman Invoice
+              </label>
+              <span className='text-xs opacity-60'>
+                Pastikan alamat yang anda isi sesuai dengan alamat kirim invoice
+              </span>
+            </div>
+            <div className='w-3/5 flex gap-3 flex-col'>
+              <div>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={sameAddress}
+                  onChange={() => setSameAddress(!sameAddress)}
+                >
+                  Alamat invoice sama dengan alamat pengiriman
+                </Checkbox>
+              </div>
+              {!sameAddress && (
+                <>
+                  <div>
+                    <input
+                      id='streetPengiriman'
+                      name='streetPengiriman'
+                      ref={streetPengirimanRef}
+                      placeholder='Masukkan alamat lengkap pengiriman barang'
+                      type='text'
+                      value={formPengiriman.streetPengiriman}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errorsPengiriman.streetPengiriman}
+                      </div>
+                    )}
+                  </div>
+                  <div className='sub-alamat flex flex-row w-full gap-3'>
+                    <div className='w-2/5' ref={statePengirimanRef}>
+                      <Controller
+                        name='statePengiriman'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={states}
+                            placeholder='Provinsi'
+                          />
+                        )}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.statePengiriman}
+                        </div>
+                      )}
+                    </div>
+                    <div className='w-1/3' ref={cityPengirimanRef}>
+                      <Controller
+                        name='cityPengiriman'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={cities}
+                            disabled={!watchState}
+                            placeholder='Kota'
+                          />
+                        )}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.cityPengiriman}
+                        </div>
+                      )}
+                    </div>
+                    <div className='w-1/3'>
+                      <input
+                        id='zip'
+                        name='zip'
+                        ref={zipRef}
+                        placeholder='Kode Pos'
+                        type='number'
+                        value={formPengiriman.zip}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.zip}
+                        </div>
+                      )}
+                    </div>
+                  </div>
+                </>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Email Direktur
+              </label>
+              <span className='text-xs opacity-60'>
+                isi email Direktur yang sesuai
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='direkturEmail'
+                name='direkturEmail'
+                ref={direkturEmailRef}
+                placeholder='contoh@email.com'
+                type='email'
+                value={formPengiriman.direkturEmail}
+                className='form-input'
+                aria-invalid={errorsPengiriman.direkturEmail}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.direkturEmail}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Nama Purchasing
+              </label>
+              <span className='text-xs opacity-60'>
+                isi nama purchasing yang bertanggung jawab di perusahaan anda
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='purchasingName'
+                name='purchasingName'
+                ref={purchasingNameRef}
+                placeholder='Masukkan nama purchasing anda'
+                value={formPengiriman.purchasingName}
+                type='text'
+                className='form-input'
+                aria-invalid={errorsPengiriman.purchasingName}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.purchasingName}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                No. Telpon Purchasing
+              </label>
+              <span className='text-xs opacity-60'>
+                isi nomor purchasing yang bertanggung jawab di perusahaan anda
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='purchasingMobile'
+                name='purchasingMobile'
+                ref={financeMobileRef}
+                placeholder='Masukkan nomor purchasing anda'
+                value={formPengiriman.purchasingMobile}
+                type='tel'
+                className='form-input'
+                aria-invalid={errorsPengiriman.purchasingMobile}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.purchasingMobile}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Email Purchasing
+              </label>
+              <span className='text-xs opacity-60'>
+                isi email purchasing benar
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='purchasingEmail'
+                name='purchasingEmail'
+                ref={purchasingEmailRef}
+                placeholder='contoh@email.com'
+                value={formPengiriman.purchasingEmail}
+                type='email'
+                className='form-input'
+                aria-invalid={errorsPengiriman.purchasingEmail}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.purchasingEmail}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Nama Finance
+              </label>
+              <span className='text-xs opacity-60'>
+                isi nama finance yang bertanggung jawab di perusahaan anda
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='financeName'
+                name='financeName'
+                ref={financeNameRef}
+                placeholder='Masukkan nama finance'
+                value={formPengiriman.financeName}
+                type='text'
+                className='form-input'
+                aria-invalid={errorsPengiriman.financeName}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.financeName}
+                </div>
+              )}
+            </div>
+          </div>
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                No. Telpon Finance
+              </label>
+              <span className='text-xs opacity-60'>
+                isi nomor finance yang bertanggung jawab di perusahaan anda
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='financeMobile'
+                name='financeMobile'
+                ref={financeMobileRef}
+                placeholder='Masukkan nomor finance'
+                value={formPengiriman.financeMobile}
+                type='tel'
+                className='form-input'
+                aria-invalid={errorsPengiriman.financeMobile}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.financeMobile}
+                </div>
+              )}
+            </div>
+          </div>
+
+          <div className='flex flex-row  justify-between items-start'>
+            <div>
+              <label className='form-label w-2/5 text-nowrap'>
+                Email Finance
+              </label>
+              <span className='text-xs opacity-60'>
+                isi email finance dengan benar
+              </span>
+            </div>
+            <div className='w-3/5'>
+              <input
+                id='financeEmail'
+                name='financeEmail'
+                ref={financeEmailRef}
+                placeholder='contoh@email.com'
+                type='email'
+                value={formPengiriman.financeEmail}
+                className='form-input'
+                aria-invalid={errorsPengiriman.financeEmail}
+                onChange={handleInputChange}
+              />
+              {chekValid && (
+                <div className='text-caption-2 text-danger-500 mt-1'>
+                  {errorsPengiriman.financeEmail}
+                </div>
+              )}
+            </div>
+          </div>
+        </div>
+      </form>
+    </>
+  );
+};
+
+export default Pengiriman;
-- 
cgit v1.2.3


From c61477111b95d83a9b862f242923b911364f3612 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 19 Oct 2024 11:49:38 +0700
Subject: <iman> fix section pengiriman

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 657 +++++++++++++++--------
 1 file changed, 444 insertions(+), 213 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 91772c7f..a281916c 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -7,7 +7,7 @@ import cityApi from '@/lib/address/api/cityApi';
 import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
 import { usePengajuanTempoStorePengiriman } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
-  const { control, watch } = useForm();
+  const { control, watch, setValue } = useForm();
   const {
     formPengiriman,
     errorsPengiriman,
@@ -17,6 +17,65 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
   const [states, setState] = useState([]);
   const [cities, setCities] = useState([]);
   const [sameAddress, setSameAddress] = useState(false);
+  const [everyWeekday, setEveryWeekday] = useState(false);
+  const [everyWeek, setEveryWeek] = useState(false);
+  const [tukarInvoice, setTukarInvoice] = useState(false);
+  const [everyWeekdayPembayaran, setEveryWeekdayPembayaran] = useState(false);
+  const [everyWeekPembayaran, setEveryWeekPembayaran] = useState(false);
+  const [tukarInvoicePembayaran, setTukarInvoicePembayaran] = useState(false);
+  const [selectedIds, setSelectedIds] = useState(
+    formPengiriman.dokumenPengiriman
+      ? formPengiriman.dokumenPengiriman.split(',').map(Number)
+      : []
+  );
+  const [selectedIdsDokumenInvoice, setSelectedIdsselectedIdsDokumenInvoice] =
+    useState(
+      formPengiriman.dokumenPengirimanInvoice
+        ? formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
+        : []
+    );
+
+  const handleCheckboxChange = (id) => {
+    const updatedSelected = selectedIds.includes(id)
+      ? selectedIds.filter((selectedId) => selectedId !== id)
+      : [...selectedIds, id];
+
+    setSelectedIds(updatedSelected);
+
+    // Jika checkbox 'Lainnya' dipilih, aktifkan input custom
+
+    updateFormPengiriman('dokumenPengiriman', updatedSelected.join(','));
+    validatePengiriman();
+  };
+  const handleCheckboxChangeDokumenPengirimanInvoice = (id) => {
+    const updatedSelected = selectedIdsDokumenInvoice.includes(id)
+      ? selectedIdsDokumenInvoice.filter((selectedId) => selectedId !== id)
+      : [...selectedIdsDokumenInvoice, id];
+
+    setSelectedIdsselectedIdsDokumenInvoice(updatedSelected);
+
+    // Jika checkbox 'Lainnya' dipilih, aktifkan input custom
+
+    updateFormPengiriman('dokumenPengirimanInvoice', updatedSelected.join(','));
+    validatePengiriman();
+  };
+
+  useEffect(() => {
+    if (formPengiriman.dokumenPengiriman) {
+      setSelectedIds(formPengiriman.dokumenPengiriman.split(',').map(Number)); // Parse string menjadi array angka
+    }
+  }, [formPengiriman.dokumenPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.dokumenPengirimanInvoice) {
+      setSelectedIdsselectedIdsDokumenInvoice(
+        formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
+      ); // Parse string menjadi array angka
+    }
+  }, [formPengiriman.dokumenPengirimanInvoice]);
+
+  // Fungsi untuk memeriksa apakah item sudah dipilih
+  const isChecked = (id) => selectedIds.includes(id);
+  const isCheckedInvoice = (id) => selectedIdsDokumenInvoice.includes(id);
 
   useEffect(() => {
     const loadState = async () => {
@@ -30,12 +89,12 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
     loadState();
   }, []);
 
-  const watchState = watch('state');
+  const watchState = watch('statePengiriman');
   useEffect(() => {
-    updateFormPengiriman('city', '');
+    updateFormPengiriman('cityPengiriman', '');
     if (watchState) {
-      updateFormPengiriman('state', `${watchState}`);
-      validate();
+      updateFormPengiriman('statePengiriman', `${watchState}`);
+      validatePengiriman();
       const loadCities = async () => {
         let dataCities = await cityApi({ stateId: watchState });
         dataCities = dataCities.map((city) => ({
@@ -48,12 +107,50 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
     }
   }, [watchState]);
 
+  const watchCity = watch('cityPengiriman');
+  useEffect(() => {
+    if (watchCity) {
+      updateFormPengiriman('cityPengiriman', `${watchCity}`);
+      validatePengiriman();
+    }
+  }, [watchCity]);
   const handleInputChange = (event) => {
     const { name, value } = event.target;
     updateFormPengiriman(name, value);
     validatePengiriman();
   };
 
+  const handleEveryWeekday = () => {
+    setEveryWeekday(!everyWeekday);
+    updateFormPengiriman('everyWeekday', everyWeekday);
+    validatePengiriman();
+  };
+  const handleEveryWeek = () => {
+    setEveryWeek(!everyWeek);
+    updateFormPengiriman('everyWeek', everyWeek);
+    validatePengiriman();
+  };
+  const handleTukarInvoice = () => {
+    setTukarInvoice(!tukarInvoice);
+    updateFormPengiriman('tukarInvoice', tukarInvoice);
+    validatePengiriman();
+  };
+  const handleEveryWeekdayPembayaran = () => {
+    setEveryWeekdayPembayaran(!everyWeekdayPembayaran);
+    updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
+    validatePengiriman();
+  };
+  const handleEveryWeekPembayaran = () => {
+    setEveryWeekPembayaran(!everyWeekPembayaran);
+    updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
+    validatePengiriman();
+  };
+  const handleTukarInvoicePembayaran = () => {
+    setTukarInvoicePembayaran(!tukarInvoicePembayaran);
+    updateFormPengiriman('tukarInvoicePembayaran', tukarInvoicePembayaran);
+    validatePengiriman();
+  };
+
   const isFormValid = useMemo(
     () => Object.keys(errorsPengiriman).length === 0,
     [errorsPengiriman]
@@ -65,14 +162,15 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
   const cityPengirimanRef = useRef(null);
   const zipRef = useRef(null);
   const invoicePicRef = useRef(null);
-
-  const direkturEmailRef = useRef(null);
-  const purchasingNameRef = useRef(null);
-  const purchasingEmailRef = useRef(null);
-  const purchasingMobileRef = useRef(null);
-  const financeNameRef = useRef(null);
-  const financeMobileRef = useRef(null);
-  const financeEmailRef = useRef(null);
+  const streetInvoiceRef = useRef(null);
+  const stateInvoiceRef = useRef(null);
+  const cityInvoiceRef = useRef(null);
+  const everyWeekdayInputRef = useRef(null);
+  const everyWeekInputRef = useRef(null);
+  const dokumenPengirimanRef = useRef(null);
+  const dokumenPengirimanInputRef = useRef(null);
+  const dokumenPengirimanInvoiceRef = useRef(null);
+  const dokumenPengirimanInvoiceInputRef = useRef(null);
 
   useEffect(() => {
     const loadIndustries = async () => {
@@ -105,33 +203,57 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           invoicePicRef.current.scrollIntoView(options);
           return;
         }
-
-        if (errorsPengiriman.direkturEmail && direkturEmailRef.current) {
-          direkturEmailRef.current.scrollIntoView(options);
+        if (errorsPengiriman.streetInvoice && streetInvoiceRef.current) {
+          streetInvoiceRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.stateInvoice && stateInvoiceRef.current) {
+          stateInvoiceRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.purchasingName && purchasingNameRef.current) {
-          purchasingNameRef.current.scrollIntoView(options);
+        if (errorsPengiriman.cityInvoice && cityInvoiceRef.current) {
+          cityInvoiceRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.purchasingMobile && purchasingMobileRef.current) {
-          purchasingMobileRef.current.scrollIntoView(options);
+        if (
+          errorsPengiriman.everyWeekdayInput &&
+          everyWeekdayInputRef.current
+        ) {
+          everyWeekdayInputRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.purchasingEmail && purchasingEmailRef.current) {
-          purchasingEmailRef.current.scrollIntoView(options);
+        if (errorsPengiriman.everyWeekInput && everyWeekInputRef.current) {
+          everyWeekInputRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.financeName && financeNameRef.current) {
-          financeNameRef.current.scrollIntoView(options);
+        if (
+          errorsPengiriman.dokumenPengiriman &&
+          dokumenPengirimanRef.current
+        ) {
+          dokumenPengirimanRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.financeMobile && financeMobileRef.current) {
-          financeMobileRef.current.scrollIntoView(options);
+        if (
+          errorsPengiriman.dokumenInvoice &&
+          dokumenPengirimanInvoiceRef.current
+        ) {
+          dokumenPengirimanInvoiceRef.current.scrollIntoView(options);
           return;
         }
-        if (errorsPengiriman.financeEmail && financeEmailRef.current) {
-          financeEmailRef.current.scrollIntoView(options);
+        if (
+          selectedIds &&
+          formPengiriman.dokumenPengirimanInput === '' &&
+          dokumenPengirimanInputRef.current
+        ) {
+          dokumenPengirimanInputRef.current.scrollIntoView(options);
+          return;
+        }
+        if (
+          selectedIdsDokumenInvoice &&
+          formPengiriman.dokumenPengirimanInvoiceInput === '' &&
+          dokumenPengirimanInvoiceInputRef.current
+        ) {
+          dokumenPengirimanInvoiceInputRef.current.scrollIntoView(options);
           return;
         }
       }
@@ -144,12 +266,36 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
   }, [buttonSubmitClick]);
   useEffect(() => {
     if (sameAddress) {
-      updateFormPengiriman('streetPengiriman', formPengiriman.streetPengiriman);
-      updateFormPengiriman('statePengiriman', formPengiriman.statePengiriman);
-      updateFormPengiriman('cityPengiriman', formPengiriman.cityPengiriman);
-      updateFormPengiriman('zip', formPengiriman.zip);
+      updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
+      updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
+      updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
     }
   }, [sameAddress]);
+
+  useEffect(() => {
+    if (formPengiriman.statePengiriman) {
+      setValue('statePengiriman', parseInt(formPengiriman.statePengiriman));
+    }
+    if (formPengiriman.stateInvoice) {
+      setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
+    }
+    if (formPengiriman.cityInvoice) {
+      setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
+    }
+  }, [formPengiriman]);
+  useEffect(() => {
+    const cachedData = getFromLocalStorage('Pengiriman');
+    if (cachedData) {
+      setValue('cityPengiriman', parseInt(cachedData.cityPengiriman));
+    }
+  }, [formPengiriman]);
+  const getFromLocalStorage = (key) => {
+    const itemStr = localStorage.getItem(key);
+    if (!itemStr) return null;
+
+    const item = JSON.parse(itemStr);
+    return item;
+  };
   return (
     <>
       <div className='flex justify-start'>
@@ -318,25 +464,25 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
                 <>
                   <div>
                     <input
-                      id='streetPengiriman'
-                      name='streetPengiriman'
-                      ref={streetPengirimanRef}
-                      placeholder='Masukkan alamat lengkap pengiriman barang'
+                      id='streetInvoice'
+                      name='streetInvoice'
+                      ref={streetInvoiceRef}
+                      placeholder='Masukkan alamat lengkap pengiriman invoice'
                       type='text'
-                      value={formPengiriman.streetPengiriman}
+                      value={formPengiriman.streetInvoice}
                       className='form-input'
                       onChange={handleInputChange}
                     />
                     {chekValid && (
                       <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errorsPengiriman.streetPengiriman}
+                        {errorsPengiriman.streetInvoice}
                       </div>
                     )}
                   </div>
                   <div className='sub-alamat flex flex-row w-full gap-3'>
-                    <div className='w-2/5' ref={statePengirimanRef}>
+                    <div className='w-3/5' ref={stateInvoiceRef}>
                       <Controller
-                        name='statePengiriman'
+                        name='stateInvoice'
                         control={control}
                         render={(props) => (
                           <HookFormSelect
@@ -348,13 +494,13 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.statePengiriman}
+                          {errorsPengiriman.stateInvoice}
                         </div>
                       )}
                     </div>
-                    <div className='w-1/3' ref={cityPengirimanRef}>
+                    <div className='w-2/5' ref={cityInvoiceRef}>
                       <Controller
-                        name='cityPengiriman'
+                        name='cityInvoice'
                         control={control}
                         render={(props) => (
                           <HookFormSelect
@@ -367,24 +513,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.cityPengiriman}
-                        </div>
-                      )}
-                    </div>
-                    <div className='w-1/3'>
-                      <input
-                        id='zip'
-                        name='zip'
-                        ref={zipRef}
-                        placeholder='Kode Pos'
-                        type='number'
-                        value={formPengiriman.zip}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                      {chekValid && (
-                        <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.zip}
+                          {errorsPengiriman.cityInvoice}
                         </div>
                       )}
                     </div>
@@ -397,114 +526,216 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           <div className='flex flex-row  justify-between items-start'>
             <div>
               <label className='form-label w-2/5 text-nowrap'>
-                Email Direktur
+                Jadwal Penukaran Invoice{' '}
+                <span className=' opacity-60'>(Opsional)</span>
               </label>
               <span className='text-xs opacity-60'>
-                isi email Direktur yang sesuai
+                Pilih jika bisnis anda memiliki jadwal penukaran invoice
               </span>
             </div>
-            <div className='w-3/5'>
-              <input
-                id='direkturEmail'
-                name='direkturEmail'
-                ref={direkturEmailRef}
-                placeholder='contoh@email.com'
-                type='email'
-                value={formPengiriman.direkturEmail}
-                className='form-input'
-                aria-invalid={errorsPengiriman.direkturEmail}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.direkturEmail}
-                </div>
-              )}
+            <div className='w-3/5 flex gap-3 flex-col'>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={everyWeekday}
+                  onChange={handleEveryWeekday}
+                >
+                  Setiap Minggu dihari
+                </Checkbox>
+                <input
+                  id='everyWeekdayInput'
+                  name='everyWeekdayInput'
+                  ref={everyWeekdayInputRef}
+                  placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                  type='text'
+                  value={formPengiriman.everyWeekdayInput}
+                  className='form-input'
+                  onChange={handleInputChange}
+                />
+              </div>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={everyWeek}
+                  onChange={handleEveryWeek}
+                >
+                  Setiap Bulan di minggu ke
+                </Checkbox>
+                <input
+                  id='everyWeekInput'
+                  name='everyWeekInput'
+                  ref={everyWeekInputRef}
+                  placeholder='Format: Minggu 1 & Minggu 2'
+                  type='text'
+                  value={formPengiriman.everyWeekInput}
+                  className='form-input'
+                  onChange={handleInputChange}
+                />
+              </div>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={tukarInvoice}
+                  onChange={handleTukarInvoice}
+                >
+                  Lainnya
+                </Checkbox>
+                <textarea
+                  id='tukarInvoiceInput'
+                  name='tukarInvoiceInput'
+                  placeholder='isi manual dokumen yang anda mau'
+                  type='textarea'
+                  value={formPengiriman.tukarInvoiceInput}
+                  className='form-input'
+                  rows={4}
+                  cols={40}
+                  onChange={handleInputChange}
+                />
+              </div>
             </div>
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
             <div>
               <label className='form-label w-2/5 text-nowrap'>
-                Nama Purchasing
+                Jadwal Pembayaran{' '}
+                <span className=' opacity-60'>(Opsional)</span>
               </label>
               <span className='text-xs opacity-60'>
-                isi nama purchasing yang bertanggung jawab di perusahaan anda
+                Pilih jika bisnis anda memiliki jadwal pembayaran
               </span>
             </div>
-            <div className='w-3/5'>
-              <input
-                id='purchasingName'
-                name='purchasingName'
-                ref={purchasingNameRef}
-                placeholder='Masukkan nama purchasing anda'
-                value={formPengiriman.purchasingName}
-                type='text'
-                className='form-input'
-                aria-invalid={errorsPengiriman.purchasingName}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.purchasingName}
-                </div>
-              )}
+            <div className='w-3/5 flex gap-3 flex-col'>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={everyWeekdayPembayaran}
+                  onChange={handleEveryWeekdayPembayaran}
+                >
+                  Setiap Minggu dihari
+                </Checkbox>
+                <input
+                  id='everyWeekdayInputPembayaran'
+                  name='everyWeekdayInputPembayaran'
+                  placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                  type='text'
+                  value={formPengiriman.everyWeekdayInputPembayaran}
+                  className='form-input'
+                  onChange={handleInputChange}
+                />
+              </div>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={everyWeekPembayaran}
+                  onChange={handleEveryWeekPembayaran}
+                >
+                  Setiap Bulan di minggu ke
+                </Checkbox>
+                <input
+                  id='everyWeekInputPembayaran'
+                  name='everyWeekInputPembayaran'
+                  placeholder='Format: Minggu 1 & Minggu 2'
+                  type='text'
+                  value={formPengiriman.everyWeekInputPembayaran}
+                  className='form-input'
+                  onChange={handleInputChange}
+                />
+              </div>
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={tukarInvoicePembayaran}
+                  onChange={handleTukarInvoicePembayaran}
+                >
+                  Lainnya
+                </Checkbox>
+                <textarea
+                  id='tukarInvoiceInputPembayaran'
+                  name='tukarInvoiceInputPembayaran'
+                  placeholder='isi manual dokumen yang anda mau'
+                  type='textarea'
+                  value={formPengiriman.tukarInvoiceInputPembayaran}
+                  className='form-input'
+                  rows={4}
+                  cols={40}
+                  onChange={handleInputChange}
+                />
+              </div>
             </div>
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
             <div>
               <label className='form-label w-2/5 text-nowrap'>
-                No. Telpon Purchasing
+                Dokumen saat Pengiriman Barang
               </label>
               <span className='text-xs opacity-60'>
-                isi nomor purchasing yang bertanggung jawab di perusahaan anda
+                Pilih dokumen lampiran saat pengiriman barang
               </span>
             </div>
-            <div className='w-3/5'>
-              <input
-                id='purchasingMobile'
-                name='purchasingMobile'
-                ref={financeMobileRef}
-                placeholder='Masukkan nomor purchasing anda'
-                value={formPengiriman.purchasingMobile}
-                type='tel'
-                className='form-input'
-                aria-invalid={errorsPengiriman.purchasingMobile}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.purchasingMobile}
-                </div>
-              )}
-            </div>
-          </div>
+            <div
+              className='w-3/5 flex gap-3 flex-col'
+              ref={dokumenPengirimanRef}
+            >
+              <Checkbox
+                colorScheme='red'
+                key='1'
+                isChecked={isChecked(1)}
+                onChange={() => handleCheckboxChange(1)}
+              >
+                Surat Tanda Terima Barang (STTB)
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='2'
+                isChecked={isChecked(2)}
+                onChange={() => handleCheckboxChange(2)}
+              >
+                Good Receipt (GR)
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='3'
+                isChecked={isChecked(3)}
+                onChange={() => handleCheckboxChange(3)}
+              >
+                Surat Terima Barang (STB)
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='4'
+                isChecked={isChecked(4)}
+                onChange={() => handleCheckboxChange(4)}
+              >
+                Lembar Penerimaan Barang (LPB)
+              </Checkbox>
 
-          <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
-                Email Purchasing
-              </label>
-              <span className='text-xs opacity-60'>
-                isi email purchasing benar
-              </span>
-            </div>
-            <div className='w-3/5'>
-              <input
-                id='purchasingEmail'
-                name='purchasingEmail'
-                ref={purchasingEmailRef}
-                placeholder='contoh@email.com'
-                value={formPengiriman.purchasingEmail}
-                type='email'
-                className='form-input'
-                aria-invalid={errorsPengiriman.purchasingEmail}
-                onChange={handleInputChange}
-              />
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  key='4'
+                  isChecked={isChecked(5)}
+                  onChange={() => handleCheckboxChange(5)}
+                >
+                  Lainnya
+                </Checkbox>
+                <textarea
+                  id='dokumenPengirimanInput'
+                  name='dokumenPengirimanInput'
+                  placeholder='isi manual dokumen yang anda mau'
+                  type='textarea'
+                  ref={dokumenPengirimanInputRef}
+                  value={formPengiriman.dokumenPengirimanInput}
+                  className='form-input'
+                  rows={4}
+                  cols={40}
+                  onChange={handleInputChange}
+                />
+              </div>
               {chekValid && (
                 <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.purchasingEmail}
+                  {errorsPengiriman.dokumenPengiriman}
                 </div>
               )}
             </div>
@@ -513,84 +744,84 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           <div className='flex flex-row  justify-between items-start'>
             <div>
               <label className='form-label w-2/5 text-nowrap'>
-                Nama Finance
+                Dokumen yang dilampirkan saat Pengiriman Invoice
               </label>
               <span className='text-xs opacity-60'>
-                isi nama finance yang bertanggung jawab di perusahaan anda
+                Dokumen akan dikirimkan sesuai dengan yang anda pilih
               </span>
             </div>
-            <div className='w-3/5'>
-              <input
-                id='financeName'
-                name='financeName'
-                ref={financeNameRef}
-                placeholder='Masukkan nama finance'
-                value={formPengiriman.financeName}
-                type='text'
-                className='form-input'
-                aria-invalid={errorsPengiriman.financeName}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.financeName}
-                </div>
-              )}
-            </div>
-          </div>
-          <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
-                No. Telpon Finance
-              </label>
-              <span className='text-xs opacity-60'>
-                isi nomor finance yang bertanggung jawab di perusahaan anda
-              </span>
-            </div>
-            <div className='w-3/5'>
-              <input
-                id='financeMobile'
-                name='financeMobile'
-                ref={financeMobileRef}
-                placeholder='Masukkan nomor finance'
-                value={formPengiriman.financeMobile}
-                type='tel'
-                className='form-input'
-                aria-invalid={errorsPengiriman.financeMobile}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.financeMobile}
-                </div>
-              )}
-            </div>
-          </div>
+            <div
+              className='w-3/5 flex gap-3 flex-col'
+              ref={dokumenPengirimanInvoiceRef}
+            >
+              <Checkbox
+                colorScheme='red'
+                key='1'
+                isChecked={isCheckedInvoice(1)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(1)}
+              >
+                Invoice Pembelian
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='2'
+                isChecked={isCheckedInvoice(2)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(2)}
+              >
+                Surat Jalan
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='3'
+                isChecked={isCheckedInvoice(3)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(3)}
+              >
+                Berita Acara Serah Terima (BAST)
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='4'
+                isChecked={isCheckedInvoice(4)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(4)}
+              >
+                Faktur Pajak
+              </Checkbox>
+              <Checkbox
+                colorScheme='red'
+                key='4'
+                isChecked={isCheckedInvoice(5)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(5)}
+              >
+                Good Receipt (GR)
+              </Checkbox>
 
-          <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
-                Email Finance
-              </label>
-              <span className='text-xs opacity-60'>
-                isi email finance dengan benar
-              </span>
-            </div>
-            <div className='w-3/5'>
-              <input
-                id='financeEmail'
-                name='financeEmail'
-                ref={financeEmailRef}
-                placeholder='contoh@email.com'
-                type='email'
-                value={formPengiriman.financeEmail}
-                className='form-input'
-                aria-invalid={errorsPengiriman.financeEmail}
-                onChange={handleInputChange}
-              />
+              <div className='flex gap-3 flex-col'>
+                <Checkbox
+                  colorScheme='red'
+                  key='4'
+                  isChecked={isCheckedInvoice(6)}
+                  onChange={() =>
+                    handleCheckboxChangeDokumenPengirimanInvoice(6)
+                  }
+                >
+                  Lainnya
+                </Checkbox>
+                <textarea
+                  id='dokumenPengirimanInvoiceInput'
+                  name='dokumenPengirimanInvoiceInput'
+                  placeholder='isi manual dokumen yang anda mau'
+                  type='textarea'
+                  ref={dokumenPengirimanInvoiceInputRef}
+                  value={formPengiriman.dokumenPengirimanInvoiceInput}
+                  className='form-input'
+                  rows={4}
+                  cols={40}
+                  onChange={handleInputChange}
+                />
+              </div>
               {chekValid && (
                 <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.financeEmail}
+                  {errorsPengiriman.dokumenInvoicePengiriman}
                 </div>
               )}
             </div>
-- 
cgit v1.2.3


From 3a0f3c6ed7ef886d3205d51937b1ecbb035b1a87 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 21 Oct 2024 16:16:34 +0700
Subject: <iman> update and fix section dokumen

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 33 ++++++++++++------------
 1 file changed, 16 insertions(+), 17 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index a281916c..2e1b1bba 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -272,23 +272,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
     }
   }, [sameAddress]);
 
-  useEffect(() => {
-    if (formPengiriman.statePengiriman) {
-      setValue('statePengiriman', parseInt(formPengiriman.statePengiriman));
-    }
-    if (formPengiriman.stateInvoice) {
-      setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
-    }
-    if (formPengiriman.cityInvoice) {
-      setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
-    }
-  }, [formPengiriman]);
-  useEffect(() => {
-    const cachedData = getFromLocalStorage('Pengiriman');
-    if (cachedData) {
-      setValue('cityPengiriman', parseInt(cachedData.cityPengiriman));
-    }
-  }, [formPengiriman]);
   const getFromLocalStorage = (key) => {
     const itemStr = localStorage.getItem(key);
     if (!itemStr) return null;
@@ -296,6 +279,22 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
     const item = JSON.parse(itemStr);
     return item;
   };
+  const cachedData = getFromLocalStorage('Pengiriman');
+  useEffect(() => {
+    if (cachedData) {
+      setValue('cityPengiriman', parseInt(cachedData.cityPengiriman));
+      updateFormPengiriman('cityPengiriman', `${cachedData.cityPengiriman}`);
+    }
+    if (cachedData.statePengiriman) {
+      setValue('statePengiriman', parseInt(cachedData.statePengiriman));
+    }
+    if (cachedData.stateInvoice) {
+      setValue('stateInvoice', parseInt(cachedData.stateInvoice));
+    }
+    if (cachedData.cityInvoice) {
+      setValue('cityInvoice', parseInt(cachedData.cityInvoice));
+    }
+  }, [cachedData.cityPengiriman]);
   return (
     <>
       <div className='flex justify-start'>
-- 
cgit v1.2.3


From c19c7eee924b70d25cb47d40fd7c8e00d5efa867 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 23 Oct 2024 17:07:37 +0700
Subject: <iman> update pengajuan tempo section konfirmasi

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 101 ++++++++++++++---------
 1 file changed, 64 insertions(+), 37 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 2e1b1bba..2497fb00 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -6,7 +6,7 @@ import stateApi from '@/lib/address/api/stateApi.js';
 import cityApi from '@/lib/address/api/cityApi';
 import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
 import { usePengajuanTempoStorePengiriman } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
-const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
+const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const { control, watch, setValue } = useForm();
   const {
     formPengiriman,
@@ -263,6 +263,14 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
 
   useEffect(() => {
     validatePengiriman();
+    if (formPengiriman.isSameAddrees) {
+      const isSame = formPengiriman.isSameAddrees;
+      if (isSame == 'true') {
+        setSameAddress(true);
+      } else {
+        setSameAddress(false);
+      }
+    }
   }, [buttonSubmitClick]);
   useEffect(() => {
     if (sameAddress) {
@@ -270,6 +278,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
       updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
       updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
     }
+    updateFormPengiriman('isSameAddrees', `${sameAddress}`);
   }, [sameAddress]);
 
   const getFromLocalStorage = (key) => {
@@ -294,17 +303,23 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
     if (cachedData.cityInvoice) {
       setValue('cityInvoice', parseInt(cachedData.cityInvoice));
     }
+    if (cachedData.isSameAddrees) {
+      updateFormPengiriman('isSameAddrees', `${cachedData.isSameAddrees}`);
+    }
   }, [cachedData.cityPengiriman]);
+  const handleChangeSameAddress = () => {
+    setSameAddress(!sameAddress);
+  };
   return (
     <>
-      <div className='flex justify-start'>
-        <h1 className='font-bold'>Pengiriman</h1>
-      </div>
-      <form className='flex mt-4 flex-col w-full '>
+      <h1 className={`font-bold ${isKonfirmasi ? 'text-xl' : ''}`}>
+        Pengiriman
+      </h1>
+      <form className='flex flex-col w-full '>
         <div className='w-full grid grid-row-2 gap-5'>
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label  text-nowrap'>
                 Nama PIC Penerimaan Barang
               </label>
             </div>
@@ -329,13 +344,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label   text-nowrap'>
                 Alamat Pengiriman Barang
               </label>
-              <span className='text-xs opacity-60'>
-                pastikan alamat yang anda isi sesuai dengan alamat kirim barang
-              </span>
+              {!isKonfirmasi && (
+                <span className='text-xs opacity-60'>
+                  pastikan alamat yang anda isi sesuai dengan alamat kirim
+                  barang
+                </span>
+              )}
             </div>
             <div className='w-3/5 flex gap-3 flex-col'>
               <div>
@@ -415,8 +433,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label  text-nowrap'>
                 Nama PIC Penerimaan Invoice
               </label>
             </div>
@@ -441,20 +459,23 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label text-nowrap'>
                 Alamat Pengiriman Invoice
               </label>
-              <span className='text-xs opacity-60'>
-                Pastikan alamat yang anda isi sesuai dengan alamat kirim invoice
-              </span>
+              {!isKonfirmasi && (
+                <span className='text-xs opacity-60'>
+                  Pastikan alamat yang anda isi sesuai dengan alamat kirim
+                  invoice
+                </span>
+              )}
             </div>
             <div className='w-3/5 flex gap-3 flex-col'>
               <div>
                 <Checkbox
                   colorScheme='red'
                   isChecked={sameAddress}
-                  onChange={() => setSameAddress(!sameAddress)}
+                  onChange={handleChangeSameAddress}
                 >
                   Alamat invoice sama dengan alamat pengiriman
                 </Checkbox>
@@ -523,14 +544,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label   text-wrap'>
                 Jadwal Penukaran Invoice{' '}
                 <span className=' opacity-60'>(Opsional)</span>
               </label>
-              <span className='text-xs opacity-60'>
-                Pilih jika bisnis anda memiliki jadwal penukaran invoice
-              </span>
+              {!isKonfirmasi && (
+                <span className='text-xs opacity-60'>
+                  Pilih jika bisnis anda memiliki jadwal penukaran invoice
+                </span>
+              )}
             </div>
             <div className='w-3/5 flex gap-3 flex-col'>
               <div className='flex gap-3 flex-col'>
@@ -595,14 +618,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label text-nowrap'>
                 Jadwal Pembayaran{' '}
                 <span className=' opacity-60'>(Opsional)</span>
               </label>
-              <span className='text-xs opacity-60'>
-                Pilih jika bisnis anda memiliki jadwal pembayaran
-              </span>
+              {!isKonfirmasi && (
+                <span className='text-xs opacity-60'>
+                  Pilih jika bisnis anda memiliki jadwal pembayaran
+                </span>
+              )}
             </div>
             <div className='w-3/5 flex gap-3 flex-col'>
               <div className='flex gap-3 flex-col'>
@@ -665,13 +690,15 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label   text-wrap'>
                 Dokumen saat Pengiriman Barang
               </label>
-              <span className='text-xs opacity-60'>
-                Pilih dokumen lampiran saat pengiriman barang
-              </span>
+              {!isKonfirmasi && (
+                <span className='text-xs opacity-60'>
+                  Pilih dokumen lampiran saat pengiriman barang
+                </span>
+              )}
             </div>
             <div
               className='w-3/5 flex gap-3 flex-col'
@@ -741,8 +768,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick }) => {
           </div>
 
           <div className='flex flex-row  justify-between items-start'>
-            <div>
-              <label className='form-label w-2/5 text-nowrap'>
+            <div className='w-2/5'>
+              <label className='form-label  text-wrap'>
                 Dokumen yang dilampirkan saat Pengiriman Invoice
               </label>
               <span className='text-xs opacity-60'>
-- 
cgit v1.2.3


From daaf32f9dd3af860013b70d04c89f4cca84724b1 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 29 Oct 2024 16:22:33 +0700
Subject: <iman> updarte pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 2497fb00..89d8ed44 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -413,8 +413,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </div>
                 <div className='w-1/3'>
                   <input
-                    id='zip'
-                    name='zip'
+                    id='zipPengiriman'
+                    name='zipPengiriman'
                     ref={zipRef}
                     placeholder='Kode Pos'
                     type='number'
@@ -424,7 +424,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   />
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.zip}
+                      {errorsPengiriman.zipPengiriman}
                     </div>
                   )}
                 </div>
-- 
cgit v1.2.3


From b5701645ce23deed5e32afc4a0f98bd523c6c92c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 31 Oct 2024 13:58:23 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 124 ++++++++++++++++-------
 1 file changed, 86 insertions(+), 38 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 89d8ed44..c2308aed 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -122,34 +122,39 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
   const handleEveryWeekday = () => {
     setEveryWeekday(!everyWeekday);
-    updateFormPengiriman('everyWeekday', everyWeekday);
-    validatePengiriman();
   };
   const handleEveryWeek = () => {
     setEveryWeek(!everyWeek);
-    updateFormPengiriman('everyWeek', everyWeek);
-    validatePengiriman();
   };
   const handleTukarInvoice = () => {
     setTukarInvoice(!tukarInvoice);
-    updateFormPengiriman('tukarInvoice', tukarInvoice);
-    validatePengiriman();
   };
   const handleEveryWeekdayPembayaran = () => {
     setEveryWeekdayPembayaran(!everyWeekdayPembayaran);
-    updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
-    validatePengiriman();
   };
   const handleEveryWeekPembayaran = () => {
     setEveryWeekPembayaran(!everyWeekPembayaran);
-    updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
-    validatePengiriman();
   };
   const handleTukarInvoicePembayaran = () => {
     setTukarInvoicePembayaran(!tukarInvoicePembayaran);
+  };
+
+  useEffect(() => {
+    updateFormPengiriman('everyWeekday', everyWeekday);
+    updateFormPengiriman('everyWeek', everyWeek);
+    updateFormPengiriman('tukarInvoice', tukarInvoice);
+    updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
+    updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
     updateFormPengiriman('tukarInvoicePembayaran', tukarInvoicePembayaran);
     validatePengiriman();
-  };
+  }, [
+    everyWeekday,
+    everyWeek,
+    tukarInvoice,
+    everyWeekdayPembayaran,
+    everyWeekPembayaran,
+    tukarInvoicePembayaran,
+  ]);
 
   const isFormValid = useMemo(
     () => Object.keys(errorsPengiriman).length === 0,
@@ -288,6 +293,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     const item = JSON.parse(itemStr);
     return item;
   };
+
   const cachedData = getFromLocalStorage('Pengiriman');
   useEffect(() => {
     if (cachedData) {
@@ -307,6 +313,48 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       updateFormPengiriman('isSameAddrees', `${cachedData.isSameAddrees}`);
     }
   }, [cachedData.cityPengiriman]);
+  useEffect(() => {
+    if (cachedData.everyWeek) {
+      updateFormPengiriman('everyWeek', cachedData.everyWeek);
+      setEveryWeek(cachedData.everyWeek);
+    }
+    if (cachedData.everyWeekday) {
+      updateFormPengiriman('everyWeekday', cachedData.everyWeekday);
+      setEveryWeekday(cachedData.everyWeekday);
+    }
+    if (cachedData.tukarInvoice) {
+      updateFormPengiriman('tukarInvoice', cachedData.tukarInvoice);
+      setTukarInvoice(cachedData.tukarInvoice);
+    }
+    if (cachedData.everyWeekPembayaran) {
+      updateFormPengiriman(
+        'everyWeekPembayaran',
+        cachedData.everyWeekPembayaran
+      );
+      setEveryWeekPembayaran(cachedData.everyWeekPembayaran);
+    }
+    if (cachedData.everyWeekdayPembayaran) {
+      updateFormPengiriman(
+        'everyWeekdayPembayaran',
+        cachedData.everyWeekdayPembayaran
+      );
+      setEveryWeekdayPembayaran(cachedData.everyWeekdayPembayaran);
+    }
+    if (cachedData.tukarInvoicePembayaran) {
+      updateFormPengiriman(
+        'tukarInvoicePembayaran',
+        cachedData.tukarInvoicePembayaran
+      );
+      setTukarInvoicePembayaran(cachedData.tukarInvoicePembayaran);
+    }
+  }, [
+    cachedData.everyWeek,
+    cachedData.everyWeekday,
+    cachedData.tukarInvoice,
+    cachedData.everyWeekdayPembayaran,
+    cachedData.everyWeekPembayaran,
+    cachedData.tukarInvoicePembayaran,
+  ]);
   const handleChangeSameAddress = () => {
     setSameAddress(!sameAddress);
   };
@@ -706,33 +754,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
             >
               <Checkbox
                 colorScheme='red'
-                key='1'
-                isChecked={isChecked(1)}
-                onChange={() => handleCheckboxChange(1)}
+                key='0'
+                isChecked={isChecked(0)}
+                onChange={() => handleCheckboxChange(0)}
               >
                 Surat Tanda Terima Barang (STTB)
               </Checkbox>
               <Checkbox
                 colorScheme='red'
-                key='2'
+                key='1'
                 isChecked={isChecked(2)}
-                onChange={() => handleCheckboxChange(2)}
+                onChange={() => handleCheckboxChange(1)}
               >
                 Good Receipt (GR)
               </Checkbox>
               <Checkbox
                 colorScheme='red'
-                key='3'
-                isChecked={isChecked(3)}
-                onChange={() => handleCheckboxChange(3)}
+                key='2'
+                isChecked={isChecked(2)}
+                onChange={() => handleCheckboxChange(2)}
               >
                 Surat Terima Barang (STB)
               </Checkbox>
               <Checkbox
                 colorScheme='red'
-                key='4'
-                isChecked={isChecked(4)}
-                onChange={() => handleCheckboxChange(4)}
+                key='3'
+                isChecked={isChecked(3)}
+                onChange={() => handleCheckboxChange(3)}
               >
                 Lembar Penerimaan Barang (LPB)
               </Checkbox>
@@ -741,8 +789,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <Checkbox
                   colorScheme='red'
                   key='4'
-                  isChecked={isChecked(5)}
-                  onChange={() => handleCheckboxChange(5)}
+                  isChecked={isChecked(4)}
+                  onChange={() => handleCheckboxChange(4)}
                 >
                   Lainnya
                 </Checkbox>
@@ -780,13 +828,21 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               className='w-3/5 flex gap-3 flex-col'
               ref={dokumenPengirimanInvoiceRef}
             >
+              <Checkbox
+                colorScheme='red'
+                key='0'
+                isChecked={isCheckedInvoice(0)}
+                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(0)}
+              >
+                Invoice Pembelian
+              </Checkbox>
               <Checkbox
                 colorScheme='red'
                 key='1'
                 isChecked={isCheckedInvoice(1)}
                 onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(1)}
               >
-                Invoice Pembelian
+                Surat Jalan
               </Checkbox>
               <Checkbox
                 colorScheme='red'
@@ -794,7 +850,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 isChecked={isCheckedInvoice(2)}
                 onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(2)}
               >
-                Surat Jalan
+                Berita Acara Serah Terima (BAST)
               </Checkbox>
               <Checkbox
                 colorScheme='red'
@@ -802,21 +858,13 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 isChecked={isCheckedInvoice(3)}
                 onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(3)}
               >
-                Berita Acara Serah Terima (BAST)
+                Faktur Pajak
               </Checkbox>
               <Checkbox
                 colorScheme='red'
                 key='4'
                 isChecked={isCheckedInvoice(4)}
                 onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(4)}
-              >
-                Faktur Pajak
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='4'
-                isChecked={isCheckedInvoice(5)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(5)}
               >
                 Good Receipt (GR)
               </Checkbox>
@@ -824,10 +872,10 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               <div className='flex gap-3 flex-col'>
                 <Checkbox
                   colorScheme='red'
-                  key='4'
-                  isChecked={isCheckedInvoice(6)}
+                  key='5'
+                  isChecked={isCheckedInvoice(5)}
                   onChange={() =>
-                    handleCheckboxChangeDokumenPengirimanInvoice(6)
+                    handleCheckboxChangeDokumenPengirimanInvoice(5)
                   }
                 >
                   Lainnya
-- 
cgit v1.2.3


From 803d93cd36abdf5de5882ba9e9cda24e9a32ab80 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 31 Oct 2024 16:07:18 +0700
Subject: update pengajuan tempo fix suplier ids

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 85 +++++++++++++-----------
 1 file changed, 48 insertions(+), 37 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index c2308aed..9817ab12 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -277,6 +277,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       }
     }
   }, [buttonSubmitClick]);
+  useEffect(() => {
+    if (formPengiriman.isSameAddrees) {
+      const isSame = formPengiriman.isSameAddrees;
+      if (isSame == 'true') {
+        setSameAddress(true);
+      } else {
+        setSameAddress(false);
+      }
+    }
+  }, [formPengiriman.isSameAddrees]);
   useEffect(() => {
     if (sameAddress) {
       updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
@@ -297,67 +307,68 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const cachedData = getFromLocalStorage('Pengiriman');
   useEffect(() => {
     if (cachedData) {
-      setValue('cityPengiriman', parseInt(cachedData.cityPengiriman));
-      updateFormPengiriman('cityPengiriman', `${cachedData.cityPengiriman}`);
+      setValue('cityPengiriman', parseInt(cachedData?.cityPengiriman));
+      updateFormPengiriman('cityPengiriman', `${cachedData?.cityPengiriman}`);
     }
-    if (cachedData.statePengiriman) {
-      setValue('statePengiriman', parseInt(cachedData.statePengiriman));
+    if (cachedData?.statePengiriman) {
+      setValue('statePengiriman', parseInt(cachedData?.statePengiriman));
     }
-    if (cachedData.stateInvoice) {
-      setValue('stateInvoice', parseInt(cachedData.stateInvoice));
+    if (cachedData?.stateInvoice) {
+      setValue('stateInvoice', parseInt(cachedData?.stateInvoice));
     }
-    if (cachedData.cityInvoice) {
-      setValue('cityInvoice', parseInt(cachedData.cityInvoice));
+    if (cachedData?.cityInvoice) {
+      setValue('cityInvoice', parseInt(cachedData?.cityInvoice));
     }
-    if (cachedData.isSameAddrees) {
-      updateFormPengiriman('isSameAddrees', `${cachedData.isSameAddrees}`);
+    if (cachedData?.isSameAddrees) {
+      updateFormPengiriman('isSameAddrees', `${cachedData?.isSameAddrees}`);
     }
-  }, [cachedData.cityPengiriman]);
+  }, [cachedData?.cityPengiriman]);
   useEffect(() => {
-    if (cachedData.everyWeek) {
-      updateFormPengiriman('everyWeek', cachedData.everyWeek);
-      setEveryWeek(cachedData.everyWeek);
+    if (cachedData?.everyWeek) {
+      updateFormPengiriman('everyWeek', cachedData?.everyWeek);
+      setEveryWeek(cachedData?.everyWeek);
     }
-    if (cachedData.everyWeekday) {
-      updateFormPengiriman('everyWeekday', cachedData.everyWeekday);
-      setEveryWeekday(cachedData.everyWeekday);
+    if (cachedData?.everyWeekday) {
+      updateFormPengiriman('everyWeekday', cachedData?.everyWeekday);
+      setEveryWeekday(cachedData?.everyWeekday);
     }
-    if (cachedData.tukarInvoice) {
-      updateFormPengiriman('tukarInvoice', cachedData.tukarInvoice);
-      setTukarInvoice(cachedData.tukarInvoice);
+    if (cachedData?.tukarInvoice) {
+      updateFormPengiriman('tukarInvoice', cachedData?.tukarInvoice);
+      setTukarInvoice(cachedData?.tukarInvoice);
     }
-    if (cachedData.everyWeekPembayaran) {
+    if (cachedData?.everyWeekPembayaran) {
       updateFormPengiriman(
         'everyWeekPembayaran',
-        cachedData.everyWeekPembayaran
+        cachedData?.everyWeekPembayaran
       );
-      setEveryWeekPembayaran(cachedData.everyWeekPembayaran);
+      setEveryWeekPembayaran(cachedData?.everyWeekPembayaran);
     }
-    if (cachedData.everyWeekdayPembayaran) {
+    if (cachedData?.everyWeekdayPembayaran) {
       updateFormPengiriman(
         'everyWeekdayPembayaran',
-        cachedData.everyWeekdayPembayaran
+        cachedData?.everyWeekdayPembayaran
       );
-      setEveryWeekdayPembayaran(cachedData.everyWeekdayPembayaran);
+      setEveryWeekdayPembayaran(cachedData?.everyWeekdayPembayaran);
     }
-    if (cachedData.tukarInvoicePembayaran) {
+    if (cachedData?.tukarInvoicePembayaran) {
       updateFormPengiriman(
         'tukarInvoicePembayaran',
-        cachedData.tukarInvoicePembayaran
+        cachedData?.tukarInvoicePembayaran
       );
-      setTukarInvoicePembayaran(cachedData.tukarInvoicePembayaran);
+      setTukarInvoicePembayaran(cachedData?.tukarInvoicePembayaran);
     }
   }, [
-    cachedData.everyWeek,
-    cachedData.everyWeekday,
-    cachedData.tukarInvoice,
-    cachedData.everyWeekdayPembayaran,
-    cachedData.everyWeekPembayaran,
-    cachedData.tukarInvoicePembayaran,
+    cachedData?.everyWeek,
+    cachedData?.everyWeekday,
+    cachedData?.tukarInvoice,
+    cachedData?.everyWeekdayPembayaran,
+    cachedData?.everyWeekPembayaran,
+    cachedData?.tukarInvoicePembayaran,
   ]);
   const handleChangeSameAddress = () => {
     setSameAddress(!sameAddress);
   };
+  console.log('formPengiriman', formPengiriman);
   return (
     <>
       <h1 className={`font-bold ${isKonfirmasi ? 'text-xl' : ''}`}>
@@ -466,7 +477,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     ref={zipRef}
                     placeholder='Kode Pos'
                     type='number'
-                    value={formPengiriman.zip}
+                    value={formPengiriman.zipPengiriman}
                     className='form-input'
                     onChange={handleInputChange}
                   />
@@ -763,7 +774,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               <Checkbox
                 colorScheme='red'
                 key='1'
-                isChecked={isChecked(2)}
+                isChecked={isChecked(1)}
                 onChange={() => handleCheckboxChange(1)}
               >
                 Good Receipt (GR)
-- 
cgit v1.2.3


From ff388c53fcd23d108ae81b055caf59ec9e731617 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 09:58:20 +0700
Subject: <iman> edit code

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 1 -
 1 file changed, 1 deletion(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 9817ab12..956febcc 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -368,7 +368,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const handleChangeSameAddress = () => {
     setSameAddress(!sameAddress);
   };
-  console.log('formPengiriman', formPengiriman);
   return (
     <>
       <h1 className={`font-bold ${isKonfirmasi ? 'text-xl' : ''}`}>
-- 
cgit v1.2.3


From 3550c262e5eeb1b861ae100cd26ae853c7f153fe Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 4 Nov 2024 14:25:02 +0700
Subject: <iman> update pengajuan tempo mobile 80%

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 1486 +++++++++++++++-------
 1 file changed, 1028 insertions(+), 458 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 956febcc..3ff14e18 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -6,8 +6,10 @@ import stateApi from '@/lib/address/api/stateApi.js';
 import cityApi from '@/lib/address/api/cityApi';
 import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
 import { usePengajuanTempoStorePengiriman } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+import useDevice from '@/core/hooks/useDevice';
 const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const { control, watch, setValue } = useForm();
+  const { isDesktop, isMobile } = useDevice();
   const {
     formPengiriman,
     errorsPengiriman,
@@ -292,8 +294,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
       updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
       updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
+    } else {
+      updateFormPengiriman('streetInvoice', '');
+      updateFormPengiriman('stateInvoice', '');
+      updateFormPengiriman('cityInvoice', '');
+      setValue('streetInvoice', '');
+      setValue('stateInvoice', '');
+      setValue('cityInvoice', '');
     }
     updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+    validatePengiriman();
   }, [sameAddress]);
 
   const getFromLocalStorage = (key) => {
@@ -322,6 +332,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     if (cachedData?.isSameAddrees) {
       updateFormPengiriman('isSameAddrees', `${cachedData?.isSameAddrees}`);
     }
+    validatePengiriman();
   }, [cachedData?.cityPengiriman]);
   useEffect(() => {
     if (cachedData?.everyWeek) {
@@ -357,6 +368,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       );
       setTukarInvoicePembayaran(cachedData?.tukarInvoicePembayaran);
     }
+    validatePengiriman();
   }, [
     cachedData?.everyWeek,
     cachedData?.everyWeekday,
@@ -370,197 +382,73 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   };
   return (
     <>
-      <h1 className={`font-bold ${isKonfirmasi ? 'text-xl' : ''}`}>
-        Pengiriman
-      </h1>
-      <form className='flex flex-col w-full '>
-        <div className='w-full grid grid-row-2 gap-5'>
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label  text-nowrap'>
-                Nama PIC Penerimaan Barang
-              </label>
-            </div>
-            <div className='w-3/5'>
-              <input
-                value={formPengiriman.PICName}
-                id='PICName'
-                name='PICName'
-                placeholder='Masukkan nama pic pengiriman disini'
-                type='text'
-                className='form-input'
-                aria-invalid={errorsPengiriman.PICName}
-                ref={PICNameRef}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.PICName}
+      {isDesktop && (
+        <div>
+          <h1 className={`font-bold ${isKonfirmasi ? 'text-xl' : ''}`}>
+            Pengiriman
+          </h1>
+          <form className='flex flex-col w-full '>
+            <div className='w-full grid grid-row-2 gap-5'>
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label  text-nowrap'>
+                    Nama PIC Penerimaan Barang
+                  </label>
                 </div>
-              )}
-            </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label   text-nowrap'>
-                Alamat Pengiriman Barang
-              </label>
-              {!isKonfirmasi && (
-                <span className='text-xs opacity-60'>
-                  pastikan alamat yang anda isi sesuai dengan alamat kirim
-                  barang
-                </span>
-              )}
-            </div>
-            <div className='w-3/5 flex gap-3 flex-col'>
-              <div>
-                <input
-                  id='streetPengiriman'
-                  name='streetPengiriman'
-                  ref={streetPengirimanRef}
-                  placeholder='Masukkan alamat lengkap pengiriman barang'
-                  type='text'
-                  value={formPengiriman.streetPengiriman}
-                  className='form-input'
-                  onChange={handleInputChange}
-                />
-                {chekValid && (
-                  <div className='text-caption-2 text-danger-500 mt-1'>
-                    {errorsPengiriman.streetPengiriman}
-                  </div>
-                )}
-              </div>
-              <div className='sub-alamat flex flex-row w-full gap-3'>
-                <div className='w-2/5' ref={statePengirimanRef}>
-                  <Controller
-                    name='statePengiriman'
-                    control={control}
-                    render={(props) => (
-                      <HookFormSelect
-                        {...props}
-                        options={states}
-                        placeholder='Provinsi'
-                      />
-                    )}
-                  />
-                  {chekValid && (
-                    <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.statePengiriman}
-                    </div>
-                  )}
-                </div>
-                <div className='w-1/3' ref={cityPengirimanRef}>
-                  <Controller
-                    name='cityPengiriman'
-                    control={control}
-                    render={(props) => (
-                      <HookFormSelect
-                        {...props}
-                        options={cities}
-                        disabled={!watchState}
-                        placeholder='Kota'
-                      />
-                    )}
-                  />
-                  {chekValid && (
-                    <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.cityPengiriman}
-                    </div>
-                  )}
-                </div>
-                <div className='w-1/3'>
+                <div className='w-3/5'>
                   <input
-                    id='zipPengiriman'
-                    name='zipPengiriman'
-                    ref={zipRef}
-                    placeholder='Kode Pos'
-                    type='number'
-                    value={formPengiriman.zipPengiriman}
+                    value={formPengiriman.PICName}
+                    id='PICName'
+                    name='PICName'
+                    placeholder='Masukkan nama pic pengiriman disini'
+                    type='text'
                     className='form-input'
+                    aria-invalid={errorsPengiriman.PICName}
+                    ref={PICNameRef}
                     onChange={handleInputChange}
                   />
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.zipPengiriman}
+                      {errorsPengiriman.PICName}
                     </div>
                   )}
                 </div>
               </div>
-            </div>
-          </div>
 
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label  text-nowrap'>
-                Nama PIC Penerimaan Invoice
-              </label>
-            </div>
-            <div className='w-3/5'>
-              <input
-                value={formPengiriman.invoicePic}
-                id='invoicePic'
-                name='invoicePic'
-                placeholder='Masukkan nama pic invoice disini'
-                type='text'
-                className='form-input'
-                aria-invalid={errorsPengiriman.invoicePic}
-                ref={invoicePicRef}
-                onChange={handleInputChange}
-              />
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.invoicePic}
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label   text-nowrap'>
+                    Alamat Pengiriman Barang
+                  </label>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      pastikan alamat yang anda isi sesuai dengan alamat kirim
+                      barang
+                    </span>
+                  )}
                 </div>
-              )}
-            </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label text-nowrap'>
-                Alamat Pengiriman Invoice
-              </label>
-              {!isKonfirmasi && (
-                <span className='text-xs opacity-60'>
-                  Pastikan alamat yang anda isi sesuai dengan alamat kirim
-                  invoice
-                </span>
-              )}
-            </div>
-            <div className='w-3/5 flex gap-3 flex-col'>
-              <div>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={sameAddress}
-                  onChange={handleChangeSameAddress}
-                >
-                  Alamat invoice sama dengan alamat pengiriman
-                </Checkbox>
-              </div>
-              {!sameAddress && (
-                <>
+                <div className='w-3/5 flex gap-3 flex-col'>
                   <div>
                     <input
-                      id='streetInvoice'
-                      name='streetInvoice'
-                      ref={streetInvoiceRef}
-                      placeholder='Masukkan alamat lengkap pengiriman invoice'
+                      id='streetPengiriman'
+                      name='streetPengiriman'
+                      ref={streetPengirimanRef}
+                      placeholder='Masukkan alamat lengkap pengiriman barang'
                       type='text'
-                      value={formPengiriman.streetInvoice}
+                      value={formPengiriman.streetPengiriman}
                       className='form-input'
                       onChange={handleInputChange}
                     />
                     {chekValid && (
                       <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errorsPengiriman.streetInvoice}
+                        {errorsPengiriman.streetPengiriman}
                       </div>
                     )}
                   </div>
                   <div className='sub-alamat flex flex-row w-full gap-3'>
-                    <div className='w-3/5' ref={stateInvoiceRef}>
+                    <div className='w-2/5' ref={statePengirimanRef}>
                       <Controller
-                        name='stateInvoice'
+                        name='statePengiriman'
                         control={control}
                         render={(props) => (
                           <HookFormSelect
@@ -572,13 +460,13 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.stateInvoice}
+                          {errorsPengiriman.statePengiriman}
                         </div>
                       )}
                     </div>
-                    <div className='w-2/5' ref={cityInvoiceRef}>
+                    <div className='w-1/3' ref={cityPengirimanRef}>
                       <Controller
-                        name='cityInvoice'
+                        name='cityPengiriman'
                         control={control}
                         render={(props) => (
                           <HookFormSelect
@@ -591,327 +479,1009 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.cityInvoice}
+                          {errorsPengiriman.cityPengiriman}
+                        </div>
+                      )}
+                    </div>
+                    <div className='w-1/3'>
+                      <input
+                        id='zipPengiriman'
+                        name='zipPengiriman'
+                        ref={zipRef}
+                        placeholder='Kode Pos'
+                        type='number'
+                        value={formPengiriman.zipPengiriman}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.zipPengiriman}
                         </div>
                       )}
                     </div>
                   </div>
-                </>
-              )}
-            </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label   text-wrap'>
-                Jadwal Penukaran Invoice{' '}
-                <span className=' opacity-60'>(Opsional)</span>
-              </label>
-              {!isKonfirmasi && (
-                <span className='text-xs opacity-60'>
-                  Pilih jika bisnis anda memiliki jadwal penukaran invoice
-                </span>
-              )}
-            </div>
-            <div className='w-3/5 flex gap-3 flex-col'>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={everyWeekday}
-                  onChange={handleEveryWeekday}
-                >
-                  Setiap Minggu dihari
-                </Checkbox>
-                <input
-                  id='everyWeekdayInput'
-                  name='everyWeekdayInput'
-                  ref={everyWeekdayInputRef}
-                  placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                  type='text'
-                  value={formPengiriman.everyWeekdayInput}
-                  className='form-input'
-                  onChange={handleInputChange}
-                />
+                </div>
+              </div>
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label  text-nowrap'>
+                    Nama PIC Penerimaan Invoice
+                  </label>
+                </div>
+                <div className='w-3/5'>
+                  <input
+                    value={formPengiriman.invoicePic}
+                    id='invoicePic'
+                    name='invoicePic'
+                    placeholder='Masukkan nama pic invoice disini'
+                    type='text'
+                    className='form-input'
+                    aria-invalid={errorsPengiriman.invoicePic}
+                    ref={invoicePicRef}
+                    onChange={handleInputChange}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.invoicePic}
+                    </div>
+                  )}
+                </div>
+              </div>
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label text-nowrap'>
+                    Alamat Pengiriman Invoice
+                  </label>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      Pastikan alamat yang anda isi sesuai dengan alamat kirim
+                      invoice
+                    </span>
+                  )}
+                </div>
+                <div className='w-3/5 flex gap-3 flex-col'>
+                  <div>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={sameAddress}
+                      onChange={handleChangeSameAddress}
+                    >
+                      Alamat invoice sama dengan alamat pengiriman
+                    </Checkbox>
+                  </div>
+                  {!sameAddress && (
+                    <>
+                      <div>
+                        <input
+                          id='streetInvoice'
+                          name='streetInvoice'
+                          ref={streetInvoiceRef}
+                          placeholder='Masukkan alamat lengkap pengiriman invoice'
+                          type='text'
+                          value={formPengiriman.streetInvoice}
+                          className='form-input'
+                          onChange={handleInputChange}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.streetInvoice}
+                          </div>
+                        )}
+                      </div>
+                      <div className='sub-alamat flex flex-row w-full gap-3'>
+                        <div className='w-3/5' ref={stateInvoiceRef}>
+                          <Controller
+                            name='stateInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={states}
+                                placeholder='Provinsi'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.stateInvoice}
+                            </div>
+                          )}
+                        </div>
+                        <div className='w-2/5' ref={cityInvoiceRef}>
+                          <Controller
+                            name='cityInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={cities}
+                                disabled={!watchState}
+                                placeholder='Kota'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.cityInvoice}
+                            </div>
+                          )}
+                        </div>
+                      </div>
+                    </>
+                  )}
+                </div>
+              </div>
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label   text-wrap'>
+                    Jadwal Penukaran Invoice{' '}
+                    <span className=' opacity-60'>(Opsional)</span>
+                  </label>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      Pilih jika bisnis anda memiliki jadwal penukaran invoice
+                    </span>
+                  )}
+                </div>
+                <div className='w-3/5 flex gap-3 flex-col'>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={everyWeekday}
+                      onChange={handleEveryWeekday}
+                    >
+                      Setiap Minggu dihari
+                    </Checkbox>
+                    <input
+                      id='everyWeekdayInput'
+                      name='everyWeekdayInput'
+                      ref={everyWeekdayInputRef}
+                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                      type='text'
+                      value={formPengiriman.everyWeekdayInput}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={everyWeek}
+                      onChange={handleEveryWeek}
+                    >
+                      Setiap Bulan di minggu ke
+                    </Checkbox>
+                    <input
+                      id='everyWeekInput'
+                      name='everyWeekInput'
+                      ref={everyWeekInputRef}
+                      placeholder='Format: Minggu 1 & Minggu 2'
+                      type='text'
+                      value={formPengiriman.everyWeekInput}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={tukarInvoice}
+                      onChange={handleTukarInvoice}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='tukarInvoiceInput'
+                      name='tukarInvoiceInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      value={formPengiriman.tukarInvoiceInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                </div>
+              </div>
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label text-nowrap'>
+                    Jadwal Pembayaran{' '}
+                    <span className=' opacity-60'>(Opsional)</span>
+                  </label>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      Pilih jika bisnis anda memiliki jadwal pembayaran
+                    </span>
+                  )}
+                </div>
+                <div className='w-3/5 flex gap-3 flex-col'>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={everyWeekdayPembayaran}
+                      onChange={handleEveryWeekdayPembayaran}
+                    >
+                      Setiap Minggu dihari
+                    </Checkbox>
+                    <input
+                      id='everyWeekdayInputPembayaran'
+                      name='everyWeekdayInputPembayaran'
+                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                      type='text'
+                      value={formPengiriman.everyWeekdayInputPembayaran}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={everyWeekPembayaran}
+                      onChange={handleEveryWeekPembayaran}
+                    >
+                      Setiap Bulan di minggu ke
+                    </Checkbox>
+                    <input
+                      id='everyWeekInputPembayaran'
+                      name='everyWeekInputPembayaran'
+                      placeholder='Format: Minggu 1 & Minggu 2'
+                      type='text'
+                      value={formPengiriman.everyWeekInputPembayaran}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      isChecked={tukarInvoicePembayaran}
+                      onChange={handleTukarInvoicePembayaran}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='tukarInvoiceInputPembayaran'
+                      name='tukarInvoiceInputPembayaran'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      value={formPengiriman.tukarInvoiceInputPembayaran}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                </div>
               </div>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={everyWeek}
-                  onChange={handleEveryWeek}
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label   text-wrap'>
+                    Dokumen saat Pengiriman Barang
+                  </label>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      Pilih dokumen lampiran saat pengiriman barang
+                    </span>
+                  )}
+                </div>
+                <div
+                  className='w-3/5 flex gap-3 flex-col'
+                  ref={dokumenPengirimanRef}
                 >
-                  Setiap Bulan di minggu ke
-                </Checkbox>
-                <input
-                  id='everyWeekInput'
-                  name='everyWeekInput'
-                  ref={everyWeekInputRef}
-                  placeholder='Format: Minggu 1 & Minggu 2'
-                  type='text'
-                  value={formPengiriman.everyWeekInput}
-                  className='form-input'
-                  onChange={handleInputChange}
-                />
+                  <Checkbox
+                    colorScheme='red'
+                    key='0'
+                    isChecked={isChecked(0)}
+                    onChange={() => handleCheckboxChange(0)}
+                  >
+                    Surat Tanda Terima Barang (STTB)
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='1'
+                    isChecked={isChecked(1)}
+                    onChange={() => handleCheckboxChange(1)}
+                  >
+                    Good Receipt (GR)
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='2'
+                    isChecked={isChecked(2)}
+                    onChange={() => handleCheckboxChange(2)}
+                  >
+                    Surat Terima Barang (STB)
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='3'
+                    isChecked={isChecked(3)}
+                    onChange={() => handleCheckboxChange(3)}
+                  >
+                    Lembar Penerimaan Barang (LPB)
+                  </Checkbox>
+
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      key='4'
+                      isChecked={isChecked(4)}
+                      onChange={() => handleCheckboxChange(4)}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='dokumenPengirimanInput'
+                      name='dokumenPengirimanInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      ref={dokumenPengirimanInputRef}
+                      value={formPengiriman.dokumenPengirimanInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenPengiriman}
+                    </div>
+                  )}
+                </div>
               </div>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={tukarInvoice}
-                  onChange={handleTukarInvoice}
+
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label  text-wrap'>
+                    Dokumen yang dilampirkan saat Pengiriman Invoice
+                  </label>
+                  <span className='text-xs opacity-60'>
+                    Dokumen akan dikirimkan sesuai dengan yang anda pilih
+                  </span>
+                </div>
+                <div
+                  className='w-3/5 flex gap-3 flex-col'
+                  ref={dokumenPengirimanInvoiceRef}
                 >
-                  Lainnya
-                </Checkbox>
-                <textarea
-                  id='tukarInvoiceInput'
-                  name='tukarInvoiceInput'
-                  placeholder='isi manual dokumen yang anda mau'
-                  type='textarea'
-                  value={formPengiriman.tukarInvoiceInput}
-                  className='form-input'
-                  rows={4}
-                  cols={40}
-                  onChange={handleInputChange}
-                />
+                  <Checkbox
+                    colorScheme='red'
+                    key='0'
+                    isChecked={isCheckedInvoice(0)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(0)
+                    }
+                  >
+                    Invoice Pembelian
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='1'
+                    isChecked={isCheckedInvoice(1)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(1)
+                    }
+                  >
+                    Surat Jalan
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='2'
+                    isChecked={isCheckedInvoice(2)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(2)
+                    }
+                  >
+                    Berita Acara Serah Terima (BAST)
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='3'
+                    isChecked={isCheckedInvoice(3)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(3)
+                    }
+                  >
+                    Faktur Pajak
+                  </Checkbox>
+                  <Checkbox
+                    colorScheme='red'
+                    key='4'
+                    isChecked={isCheckedInvoice(4)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(4)
+                    }
+                  >
+                    Good Receipt (GR)
+                  </Checkbox>
+
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      key='5'
+                      isChecked={isCheckedInvoice(5)}
+                      onChange={() =>
+                        handleCheckboxChangeDokumenPengirimanInvoice(5)
+                      }
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='dokumenPengirimanInvoiceInput'
+                      name='dokumenPengirimanInvoiceInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      ref={dokumenPengirimanInvoiceInputRef}
+                      value={formPengiriman.dokumenPengirimanInvoiceInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenInvoicePengiriman}
+                    </div>
+                  )}
+                </div>
               </div>
             </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label text-nowrap'>
-                Jadwal Pembayaran{' '}
-                <span className=' opacity-60'>(Opsional)</span>
-              </label>
-              {!isKonfirmasi && (
-                <span className='text-xs opacity-60'>
-                  Pilih jika bisnis anda memiliki jadwal pembayaran
-                </span>
-              )}
-            </div>
-            <div className='w-3/5 flex gap-3 flex-col'>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={everyWeekdayPembayaran}
-                  onChange={handleEveryWeekdayPembayaran}
-                >
-                  Setiap Minggu dihari
-                </Checkbox>
+          </form>
+        </div>
+      )}
+      {isMobile && (
+        <div className='text-sm'>
+          <h1
+            className={`font-bold py-4 mt-8 ${
+              isKonfirmasi ? 'text-xl' : 'text-xl'
+            }`}
+          >
+            Pengiriman
+          </h1>
+          <form className='flex flex-col w-full '>
+            <div className='w-full grid grid-row-2 gap-2'>
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label  text-nowrap'>
+                  Nama PIC Penerimaan Barang
+                </label>
                 <input
-                  id='everyWeekdayInputPembayaran'
-                  name='everyWeekdayInputPembayaran'
-                  placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                  value={formPengiriman.PICName}
+                  id='PICName'
+                  name='PICName'
+                  placeholder='Masukkan nama pic pengiriman disini'
                   type='text'
-                  value={formPengiriman.everyWeekdayInputPembayaran}
                   className='form-input'
+                  aria-invalid={errorsPengiriman.PICName}
+                  ref={PICNameRef}
                   onChange={handleInputChange}
                 />
+                {chekValid && (
+                  <div className='text-caption-2 text-danger-500 mt-1'>
+                    {errorsPengiriman.PICName}
+                  </div>
+                )}
               </div>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={everyWeekPembayaran}
-                  onChange={handleEveryWeekPembayaran}
-                >
-                  Setiap Bulan di minggu ke
-                </Checkbox>
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label   text-nowrap'>
+                  Alamat Pengiriman Barang
+                </label>
+                <div className='w-full'>
+                  <input
+                    id='streetPengiriman'
+                    name='streetPengiriman'
+                    ref={streetPengirimanRef}
+                    placeholder='Masukkan alamat lengkap pengiriman barang'
+                    type='text'
+                    value={formPengiriman.streetPengiriman}
+                    className='form-input'
+                    onChange={handleInputChange}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.streetPengiriman}
+                    </div>
+                  )}
+                </div>
+                <div className='sub-alamat flex flex-row w-full gap-2'>
+                  <div className='w-2/5' ref={statePengirimanRef}>
+                    <Controller
+                      name='statePengiriman'
+                      control={control}
+                      render={(props) => (
+                        <HookFormSelect
+                          {...props}
+                          options={states}
+                          placeholder='Provinsi'
+                        />
+                      )}
+                    />
+                  </div>
+                  <div className='w-1/3' ref={cityPengirimanRef}>
+                    <Controller
+                      name='cityPengiriman'
+                      control={control}
+                      render={(props) => (
+                        <HookFormSelect
+                          {...props}
+                          options={cities}
+                          disabled={!watchState}
+                          placeholder='Kota'
+                        />
+                      )}
+                    />
+                  </div>
+                  <div className='w-1/3'>
+                    <input
+                      id='zipPengiriman'
+                      name='zipPengiriman'
+                      ref={zipRef}
+                      placeholder='Kode Pos'
+                      type='number'
+                      value={formPengiriman.zipPengiriman}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.statePengiriman}
+                    </div>
+                  )}
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.cityPengiriman}
+                    </div>
+                  )}
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.zipPengiriman}
+                    </div>
+                  )}
+                </div>
+              </div>
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label  text-nowrap'>
+                  Nama PIC Penerimaan Invoice
+                </label>
                 <input
-                  id='everyWeekInputPembayaran'
-                  name='everyWeekInputPembayaran'
-                  placeholder='Format: Minggu 1 & Minggu 2'
+                  value={formPengiriman.invoicePic}
+                  id='invoicePic'
+                  name='invoicePic'
+                  placeholder='Masukkan nama pic invoice disini'
                   type='text'
-                  value={formPengiriman.everyWeekInputPembayaran}
                   className='form-input'
+                  aria-invalid={errorsPengiriman.invoicePic}
+                  ref={invoicePicRef}
                   onChange={handleInputChange}
                 />
+                {chekValid && (
+                  <div className='text-caption-2 text-danger-500 mt-1'>
+                    {errorsPengiriman.invoicePic}
+                  </div>
+                )}
               </div>
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  isChecked={tukarInvoicePembayaran}
-                  onChange={handleTukarInvoicePembayaran}
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label text-nowrap'>
+                  Alamat Pengiriman Invoice
+                </label>
+                <div>
+                  <Checkbox
+                    colorScheme='red'
+                    isChecked={sameAddress}
+                    onChange={handleChangeSameAddress}
+                    size='sm'
+                  >
+                    Alamat invoice sama dengan alamat pengiriman
+                  </Checkbox>
+                </div>
+                {!sameAddress && (
+                  <>
+                    <div className='w-full'>
+                      <input
+                        id='streetInvoice'
+                        name='streetInvoice'
+                        ref={streetInvoiceRef}
+                        placeholder='Masukkan alamat lengkap pengiriman invoice'
+                        type='text'
+                        value={formPengiriman.streetInvoice}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.streetInvoice}
+                        </div>
+                      )}
+                    </div>
+                    <div className='sub-alamat flex flex-row w-full gap-3'>
+                      <div className='w-3/5' ref={stateInvoiceRef}>
+                        <Controller
+                          name='stateInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={states}
+                              placeholder='Provinsi'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.stateInvoice}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-2/5' ref={cityInvoiceRef}>
+                        <Controller
+                          name='cityInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={cities}
+                              disabled={!watchState}
+                              placeholder='Kota'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.cityInvoice}
+                          </div>
+                        )}
+                      </div>
+                    </div>
+                  </>
+                )}
+              </div>
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label   text-wrap'>
+                  Jadwal Penukaran Invoice
+                  <span className=' opacity-60'>(Opsional)</span>
+                </label>
+                {!isKonfirmasi && (
+                  <span className='text-xs opacity-60'>
+                    Pilih jika bisnis anda memiliki jadwal penukaran invoice
+                  </span>
+                )}
+                <div className='w-full flex gap-2 flex-col'>
+                  <div className='flex gap-2 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={everyWeekday}
+                      onChange={handleEveryWeekday}
+                    >
+                      Setiap Minggu dihari
+                    </Checkbox>
+                    <input
+                      id='everyWeekdayInput'
+                      name='everyWeekdayInput'
+                      ref={everyWeekdayInputRef}
+                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                      type='text'
+                      value={formPengiriman.everyWeekdayInput}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-2 w-full flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={everyWeek}
+                      onChange={handleEveryWeek}
+                    >
+                      Setiap Bulan di minggu ke
+                    </Checkbox>
+                    <input
+                      id='everyWeekInput'
+                      name='everyWeekInput'
+                      ref={everyWeekInputRef}
+                      placeholder='Format: Minggu 1 & Minggu 2'
+                      type='text'
+                      value={formPengiriman.everyWeekInput}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-2 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={tukarInvoice}
+                      onChange={handleTukarInvoice}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='tukarInvoiceInput'
+                      name='tukarInvoiceInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      value={formPengiriman.tukarInvoiceInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                </div>
+                <div className='w-2/5'></div>
+              </div>
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label text-nowrap'>
+                  Jadwal Pembayaran
+                  <span className=' opacity-60'>(Opsional)</span>
+                </label>
+                {!isKonfirmasi && (
+                  <span className='text-xs opacity-60'>
+                    Pilih jika bisnis anda memiliki jadwal pembayaran
+                  </span>
+                )}
+                <div className='w-full flex gap-2 flex-col'>
+                  <div className='flex gap-2 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={everyWeekdayPembayaran}
+                      onChange={handleEveryWeekdayPembayaran}
+                    >
+                      Setiap Minggu dihari
+                    </Checkbox>
+                    <input
+                      id='everyWeekdayInputPembayaran'
+                      name='everyWeekdayInputPembayaran'
+                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                      type='text'
+                      value={formPengiriman.everyWeekdayInputPembayaran}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-2 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={everyWeekPembayaran}
+                      onChange={handleEveryWeekPembayaran}
+                    >
+                      Setiap Bulan di minggu ke
+                    </Checkbox>
+                    <input
+                      id='everyWeekInputPembayaran'
+                      name='everyWeekInputPembayaran'
+                      placeholder='Format: Minggu 1 & Minggu 2'
+                      type='text'
+                      value={formPengiriman.everyWeekInputPembayaran}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  <div className='flex gap-2 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      isChecked={tukarInvoicePembayaran}
+                      onChange={handleTukarInvoicePembayaran}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='tukarInvoiceInputPembayaran'
+                      name='tukarInvoiceInputPembayaran'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      value={formPengiriman.tukarInvoiceInputPembayaran}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                </div>
+              </div>
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label   text-wrap'>
+                  Dokumen saat Pengiriman Barang
+                </label>
+                {!isKonfirmasi && (
+                  <span className='text-xs opacity-60'>
+                    Pilih dokumen lampiran saat pengiriman barang
+                  </span>
+                )}
+                <div
+                  className='w-full flex gap-2 flex-col'
+                  ref={dokumenPengirimanRef}
                 >
-                  Lainnya
-                </Checkbox>
-                <textarea
-                  id='tukarInvoiceInputPembayaran'
-                  name='tukarInvoiceInputPembayaran'
-                  placeholder='isi manual dokumen yang anda mau'
-                  type='textarea'
-                  value={formPengiriman.tukarInvoiceInputPembayaran}
-                  className='form-input'
-                  rows={4}
-                  cols={40}
-                  onChange={handleInputChange}
-                />
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='0'
+                    isChecked={isChecked(0)}
+                    onChange={() => handleCheckboxChange(0)}
+                  >
+                    Surat Tanda Terima Barang (STTB)
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='1'
+                    isChecked={isChecked(1)}
+                    onChange={() => handleCheckboxChange(1)}
+                  >
+                    Good Receipt (GR)
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='2'
+                    isChecked={isChecked(2)}
+                    onChange={() => handleCheckboxChange(2)}
+                  >
+                    Surat Terima Barang (STB)
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='3'
+                    isChecked={isChecked(3)}
+                    onChange={() => handleCheckboxChange(3)}
+                  >
+                    Lembar Penerimaan Barang (LPB)
+                  </Checkbox>
+
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      key='4'
+                      isChecked={isChecked(4)}
+                      onChange={() => handleCheckboxChange(4)}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='dokumenPengirimanInput'
+                      name='dokumenPengirimanInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      ref={dokumenPengirimanInputRef}
+                      value={formPengiriman.dokumenPengirimanInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenPengiriman}
+                    </div>
+                  )}
+                </div>
               </div>
-            </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label   text-wrap'>
-                Dokumen saat Pengiriman Barang
-              </label>
-              {!isKonfirmasi && (
+
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label  text-wrap'>
+                  Dokumen yang dilampirkan saat Pengiriman Invoice
+                </label>
                 <span className='text-xs opacity-60'>
-                  Pilih dokumen lampiran saat pengiriman barang
+                  Pilih dokumen lampiran saat pengiriman invoice
                 </span>
-              )}
-            </div>
-            <div
-              className='w-3/5 flex gap-3 flex-col'
-              ref={dokumenPengirimanRef}
-            >
-              <Checkbox
-                colorScheme='red'
-                key='0'
-                isChecked={isChecked(0)}
-                onChange={() => handleCheckboxChange(0)}
-              >
-                Surat Tanda Terima Barang (STTB)
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='1'
-                isChecked={isChecked(1)}
-                onChange={() => handleCheckboxChange(1)}
-              >
-                Good Receipt (GR)
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='2'
-                isChecked={isChecked(2)}
-                onChange={() => handleCheckboxChange(2)}
-              >
-                Surat Terima Barang (STB)
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='3'
-                isChecked={isChecked(3)}
-                onChange={() => handleCheckboxChange(3)}
-              >
-                Lembar Penerimaan Barang (LPB)
-              </Checkbox>
-
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  key='4'
-                  isChecked={isChecked(4)}
-                  onChange={() => handleCheckboxChange(4)}
+                <div
+                  className='w-full flex gap-2 flex-col'
+                  ref={dokumenPengirimanInvoiceRef}
                 >
-                  Lainnya
-                </Checkbox>
-                <textarea
-                  id='dokumenPengirimanInput'
-                  name='dokumenPengirimanInput'
-                  placeholder='isi manual dokumen yang anda mau'
-                  type='textarea'
-                  ref={dokumenPengirimanInputRef}
-                  value={formPengiriman.dokumenPengirimanInput}
-                  className='form-input'
-                  rows={4}
-                  cols={40}
-                  onChange={handleInputChange}
-                />
-              </div>
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.dokumenPengiriman}
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='0'
+                    isChecked={isCheckedInvoice(0)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(0)
+                    }
+                  >
+                    Invoice Pembelian
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='1'
+                    isChecked={isCheckedInvoice(1)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(1)
+                    }
+                  >
+                    Surat Jalan
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='2'
+                    isChecked={isCheckedInvoice(2)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(2)
+                    }
+                  >
+                    Berita Acara Serah Terima (BAST)
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='3'
+                    isChecked={isCheckedInvoice(3)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(3)
+                    }
+                  >
+                    Faktur Pajak
+                  </Checkbox>
+                  <Checkbox
+                    size='sm'
+                    colorScheme='red'
+                    key='4'
+                    isChecked={isCheckedInvoice(4)}
+                    onChange={() =>
+                      handleCheckboxChangeDokumenPengirimanInvoice(4)
+                    }
+                  >
+                    Good Receipt (GR)
+                  </Checkbox>
+
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      size='sm'
+                      colorScheme='red'
+                      key='5'
+                      isChecked={isCheckedInvoice(5)}
+                      onChange={() =>
+                        handleCheckboxChangeDokumenPengirimanInvoice(5)
+                      }
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='dokumenPengirimanInvoiceInput'
+                      name='dokumenPengirimanInvoiceInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      ref={dokumenPengirimanInvoiceInputRef}
+                      value={formPengiriman.dokumenPengirimanInvoiceInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenInvoicePengiriman}
+                    </div>
+                  )}
                 </div>
-              )}
-            </div>
-          </div>
-
-          <div className='flex flex-row  justify-between items-start'>
-            <div className='w-2/5'>
-              <label className='form-label  text-wrap'>
-                Dokumen yang dilampirkan saat Pengiriman Invoice
-              </label>
-              <span className='text-xs opacity-60'>
-                Dokumen akan dikirimkan sesuai dengan yang anda pilih
-              </span>
-            </div>
-            <div
-              className='w-3/5 flex gap-3 flex-col'
-              ref={dokumenPengirimanInvoiceRef}
-            >
-              <Checkbox
-                colorScheme='red'
-                key='0'
-                isChecked={isCheckedInvoice(0)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(0)}
-              >
-                Invoice Pembelian
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='1'
-                isChecked={isCheckedInvoice(1)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(1)}
-              >
-                Surat Jalan
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='2'
-                isChecked={isCheckedInvoice(2)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(2)}
-              >
-                Berita Acara Serah Terima (BAST)
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='3'
-                isChecked={isCheckedInvoice(3)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(3)}
-              >
-                Faktur Pajak
-              </Checkbox>
-              <Checkbox
-                colorScheme='red'
-                key='4'
-                isChecked={isCheckedInvoice(4)}
-                onChange={() => handleCheckboxChangeDokumenPengirimanInvoice(4)}
-              >
-                Good Receipt (GR)
-              </Checkbox>
-
-              <div className='flex gap-3 flex-col'>
-                <Checkbox
-                  colorScheme='red'
-                  key='5'
-                  isChecked={isCheckedInvoice(5)}
-                  onChange={() =>
-                    handleCheckboxChangeDokumenPengirimanInvoice(5)
-                  }
-                >
-                  Lainnya
-                </Checkbox>
-                <textarea
-                  id='dokumenPengirimanInvoiceInput'
-                  name='dokumenPengirimanInvoiceInput'
-                  placeholder='isi manual dokumen yang anda mau'
-                  type='textarea'
-                  ref={dokumenPengirimanInvoiceInputRef}
-                  value={formPengiriman.dokumenPengirimanInvoiceInput}
-                  className='form-input'
-                  rows={4}
-                  cols={40}
-                  onChange={handleInputChange}
-                />
+                <div className='w-2/5'></div>
               </div>
-              {chekValid && (
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errorsPengiriman.dokumenInvoicePengiriman}
-                </div>
-              )}
             </div>
-          </div>
+          </form>
         </div>
-      </form>
+      )}
     </>
   );
 };
-- 
cgit v1.2.3


From f751fa6d398a8aab96380c832da927c60c6ccbe4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 4 Nov 2024 16:10:09 +0700
Subject: <iman> update pengajuan tempo mobile view fix

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 3ff14e18..842e43ef 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -942,7 +942,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
         <div className='text-sm'>
           <h1
             className={`font-bold py-4 mt-8 ${
-              isKonfirmasi ? 'text-xl' : 'text-xl'
+              isKonfirmasi ? 'hidden' : 'text-xl'
             }`}
           >
             Pengiriman
-- 
cgit v1.2.3


From 6bbf1dbd94355f34f58f4b72f134f3dbeac776aa Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 23 Nov 2024 11:55:59 +0700
Subject: <iman> update tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 438 +++++++++++++----------
 1 file changed, 253 insertions(+), 185 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 842e43ef..adf2ee37 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -5,7 +5,11 @@ import odooApi from '~/libs/odooApi';
 import stateApi from '@/lib/address/api/stateApi.js';
 import cityApi from '@/lib/address/api/cityApi';
 import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
-import { usePengajuanTempoStorePengiriman } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+import {
+  usePengajuanTempoStorePengiriman,
+  usePengajuanTempoStore,
+} from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+
 import useDevice from '@/core/hooks/useDevice';
 const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const { control, watch, setValue } = useForm();
@@ -16,15 +20,20 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman,
     updateFormPengiriman,
   } = usePengajuanTempoStorePengiriman();
+  const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const [states, setState] = useState([]);
   const [cities, setCities] = useState([]);
   const [sameAddress, setSameAddress] = useState(false);
+  const [sameAddressStreet, setSameAddressStreet] = useState(false);
   const [everyWeekday, setEveryWeekday] = useState(false);
   const [everyWeek, setEveryWeek] = useState(false);
   const [tukarInvoice, setTukarInvoice] = useState(false);
   const [everyWeekdayPembayaran, setEveryWeekdayPembayaran] = useState(false);
   const [everyWeekPembayaran, setEveryWeekPembayaran] = useState(false);
   const [tukarInvoicePembayaran, setTukarInvoicePembayaran] = useState(false);
+  const [selectedRadio, setSelectedRadio] = useState('');
+  const [selectedRadioInvoice, setSelectedRadioInvoice] = useState('');
+
   const [selectedIds, setSelectedIds] = useState(
     formPengiriman.dokumenPengiriman
       ? formPengiriman.dokumenPengiriman.split(',').map(Number)
@@ -121,7 +130,29 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     updateFormPengiriman(name, value);
     validatePengiriman();
   };
-
+  const handleRadioChange = (value) => {
+    console.log('value', value);
+    setSelectedRadio(value);
+    if (value == 'everyWeekday') {
+      setEveryWeekday(!everyWeekday);
+    } else if (value == 'everyWeek') {
+      setEveryWeek(!everyWeek);
+    } else {
+      setTukarInvoice(!tukarInvoice);
+    }
+    validatePengiriman();
+  };
+  const handleRadioChangeInvoice = (value) => {
+    setSelectedRadioInvoice(value);
+    if (value == 'everyWeekdayPembayaran') {
+      setEveryWeekdayPembayaran(!everyWeekdayPembayaran);
+    } else if (value == 'everyWeekPembayaran') {
+      setEveryWeekPembayaran(!everyWeekPembayaran);
+    } else {
+      setTukarInvoicePembayaran(!tukarInvoicePembayaran);
+    }
+    validatePengiriman();
+  };
   const handleEveryWeekday = () => {
     setEveryWeekday(!everyWeekday);
   };
@@ -278,6 +309,15 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
         setSameAddress(false);
       }
     }
+    if (formPengiriman.isSameAddreesStreet) {
+      const isSame = formPengiriman.isSameAddreesStreet;
+      if (isSame == 'true') {
+        setSameAddressStreet(true);
+      } else {
+        setSameAddressStreet(false);
+      }
+    }
+    validatePengiriman();
   }, [buttonSubmitClick]);
   useEffect(() => {
     if (formPengiriman.isSameAddrees) {
@@ -288,7 +328,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
         setSameAddress(false);
       }
     }
-  }, [formPengiriman.isSameAddrees]);
+    if (formPengiriman.isSameAddreesStreet) {
+      const isSame = formPengiriman.isSameAddreesStreet;
+      if (isSame == 'true') {
+        setSameAddressStreet(true);
+      } else {
+        setSameAddressStreet(false);
+      }
+    }
+    validatePengiriman();
+  }, [formPengiriman.isSameAddrees, formPengiriman.isSameAddreesStreet]);
   useEffect(() => {
     if (sameAddress) {
       updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
@@ -306,6 +355,25 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman();
   }, [sameAddress]);
 
+  useEffect(() => {
+    if (sameAddressStreet) {
+      updateFormPengiriman('streetPengiriman', form.street);
+      updateFormPengiriman('statePengiriman', form.state);
+      updateFormPengiriman('cityPengiriman', form.city);
+      updateFormPengiriman('zipPengiriman', form.zip);
+    } else {
+      updateFormPengiriman('streetPengiriman', '');
+      updateFormPengiriman('statePengiriman', '');
+      updateFormPengiriman('cityPengiriman', '');
+      updateFormPengiriman('zipPengiriman', '');
+      setValue('streetPengiriman', '');
+      setValue('statePengiriman', '');
+      setValue('cityPengiriman', '');
+    }
+    updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+    validatePengiriman();
+  }, [sameAddressStreet]);
+
   const getFromLocalStorage = (key) => {
     const itemStr = localStorage.getItem(key);
     if (!itemStr) return null;
@@ -380,6 +448,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const handleChangeSameAddress = () => {
     setSameAddress(!sameAddress);
   };
+  const handleChangeSameAddressStreet = () => {
+    setSameAddressStreet(!sameAddressStreet);
+  };
+  console.log('formPengiriman', formPengiriman);
+  console.log('errorsPengiriman', errorsPengiriman);
   return (
     <>
       {isDesktop && (
@@ -428,79 +501,90 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='w-3/5 flex gap-3 flex-col'>
-                  <div>
-                    <input
-                      id='streetPengiriman'
-                      name='streetPengiriman'
-                      ref={streetPengirimanRef}
-                      placeholder='Masukkan alamat lengkap pengiriman barang'
-                      type='text'
-                      value={formPengiriman.streetPengiriman}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                    {chekValid && (
-                      <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errorsPengiriman.streetPengiriman}
+                  <Checkbox
+                    colorScheme='red'
+                    isChecked={sameAddressStreet}
+                    onChange={handleChangeSameAddressStreet}
+                  >
+                    Alamat Pengiriman sama dengan alamat pengiriman
+                  </Checkbox>
+                  {!sameAddressStreet && (
+                    <>
+                      <div>
+                        <input
+                          id='streetPengiriman'
+                          name='streetPengiriman'
+                          ref={streetPengirimanRef}
+                          placeholder='Masukkan alamat lengkap pengiriman barang'
+                          type='text'
+                          value={formPengiriman.streetPengiriman}
+                          className='form-input'
+                          onChange={handleInputChange}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.streetPengiriman}
+                          </div>
+                        )}
                       </div>
-                    )}
-                  </div>
-                  <div className='sub-alamat flex flex-row w-full gap-3'>
-                    <div className='w-2/5' ref={statePengirimanRef}>
-                      <Controller
-                        name='statePengiriman'
-                        control={control}
-                        render={(props) => (
-                          <HookFormSelect
-                            {...props}
-                            options={states}
-                            placeholder='Provinsi'
+                      <div className='sub-alamat flex flex-row w-full gap-3'>
+                        <div className='w-2/5' ref={statePengirimanRef}>
+                          <Controller
+                            name='statePengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={states}
+                                placeholder='Provinsi'
+                              />
+                            )}
                           />
-                        )}
-                      />
-                      {chekValid && (
-                        <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.statePengiriman}
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.statePengiriman}
+                            </div>
+                          )}
                         </div>
-                      )}
-                    </div>
-                    <div className='w-1/3' ref={cityPengirimanRef}>
-                      <Controller
-                        name='cityPengiriman'
-                        control={control}
-                        render={(props) => (
-                          <HookFormSelect
-                            {...props}
-                            options={cities}
-                            disabled={!watchState}
-                            placeholder='Kota'
+                        <div className='w-1/3' ref={cityPengirimanRef}>
+                          <Controller
+                            name='cityPengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={cities}
+                                disabled={!watchState}
+                                placeholder='Kota'
+                              />
+                            )}
                           />
-                        )}
-                      />
-                      {chekValid && (
-                        <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.cityPengiriman}
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.cityPengiriman}
+                            </div>
+                          )}
                         </div>
-                      )}
-                    </div>
-                    <div className='w-1/3'>
-                      <input
-                        id='zipPengiriman'
-                        name='zipPengiriman'
-                        ref={zipRef}
-                        placeholder='Kode Pos'
-                        type='number'
-                        value={formPengiriman.zipPengiriman}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                      {chekValid && (
-                        <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.zipPengiriman}
+                        <div className='w-1/3'>
+                          <input
+                            id='zipPengiriman'
+                            name='zipPengiriman'
+                            ref={zipRef}
+                            placeholder='Kode Pos'
+                            type='number'
+                            value={formPengiriman.zipPengiriman}
+                            className='form-input'
+                            onChange={handleInputChange}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.zipPengiriman}
+                            </div>
+                          )}
                         </div>
-                      )}
-                    </div>
-                  </div>
+                      </div>
+                    </>
+                  )}
                 </div>
               </div>
 
@@ -628,64 +712,56 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='w-3/5 flex gap-3 flex-col'>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={everyWeekday}
-                      onChange={handleEveryWeekday}
-                    >
-                      Setiap Minggu dihari
-                    </Checkbox>
-                    <input
-                      id='everyWeekdayInput'
-                      name='everyWeekdayInput'
-                      ref={everyWeekdayInputRef}
-                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                      type='text'
-                      value={formPengiriman.everyWeekdayInput}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={everyWeek}
-                      onChange={handleEveryWeek}
-                    >
-                      Setiap Bulan di minggu ke
-                    </Checkbox>
-                    <input
-                      id='everyWeekInput'
-                      name='everyWeekInput'
-                      ref={everyWeekInputRef}
-                      placeholder='Format: Minggu 1 & Minggu 2'
-                      type='text'
-                      value={formPengiriman.everyWeekInput}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={tukarInvoice}
-                      onChange={handleTukarInvoice}
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='tukarInvoiceInput'
-                      name='tukarInvoiceInput'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      value={formPengiriman.tukarInvoiceInput}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                  <RadioGroup
+                    onChange={handleRadioChange}
+                    value={selectedRadio}
+                  >
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='everyWeekday' colorScheme='red'>
+                        Setiap Minggu di hari
+                      </Radio>
+                      <input
+                        id='everyWeekdayInput'
+                        name='everyWeekdayInput'
+                        ref={everyWeekdayInputRef}
+                        placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                        type='text'
+                        value={formPengiriman.everyWeekdayInput}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='everyWeek' colorScheme='red'>
+                        Setiap Bulan di minggu ke
+                      </Radio>
+                      <input
+                        id='everyWeekInput'
+                        name='everyWeekInput'
+                        ref={everyWeekInputRef}
+                        placeholder='Format: Minggu 1 & Minggu 2'
+                        type='text'
+                        value={formPengiriman.everyWeekInput}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='tukarInvoice' colorScheme='red'>
+                        Lainnya
+                      </Radio>
+                      <textarea
+                        id='tukarInvoiceInput'
+                        name='tukarInvoiceInput'
+                        placeholder='Isi manual dokumen yang anda mau'
+                        value={formPengiriman.tukarInvoiceInput}
+                        className='form-input'
+                        rows={4}
+                        cols={40}
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                  </RadioGroup>
                 </div>
               </div>
 
@@ -702,62 +778,54 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='w-3/5 flex gap-3 flex-col'>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={everyWeekdayPembayaran}
-                      onChange={handleEveryWeekdayPembayaran}
-                    >
-                      Setiap Minggu dihari
-                    </Checkbox>
-                    <input
-                      id='everyWeekdayInputPembayaran'
-                      name='everyWeekdayInputPembayaran'
-                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                      type='text'
-                      value={formPengiriman.everyWeekdayInputPembayaran}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={everyWeekPembayaran}
-                      onChange={handleEveryWeekPembayaran}
-                    >
-                      Setiap Bulan di minggu ke
-                    </Checkbox>
-                    <input
-                      id='everyWeekInputPembayaran'
-                      name='everyWeekInputPembayaran'
-                      placeholder='Format: Minggu 1 & Minggu 2'
-                      type='text'
-                      value={formPengiriman.everyWeekInputPembayaran}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      isChecked={tukarInvoicePembayaran}
-                      onChange={handleTukarInvoicePembayaran}
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='tukarInvoiceInputPembayaran'
-                      name='tukarInvoiceInputPembayaran'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      value={formPengiriman.tukarInvoiceInputPembayaran}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                  <RadioGroup
+                    onChange={handleRadioChangeInvoice}
+                    value={selectedRadioInvoice}
+                  >
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='everyWeekdayPembayaran' colorScheme='red'>
+                        Setiap Minggu di hari
+                      </Radio>
+                      <input
+                        id='everyWeekdayInputPembayaran'
+                        name='everyWeekdayInputPembayaran'
+                        placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
+                        type='text'
+                        value={formPengiriman.everyWeekdayInputPembayaran}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='everyWeekPembayaran' colorScheme='red'>
+                        Setiap Bulan di minggu ke
+                      </Radio>
+                      <input
+                        id='everyWeekInputPembayaran'
+                        name='everyWeekInputPembayaran'
+                        placeholder='Format: Minggu 1 & Minggu 2'
+                        type='text'
+                        value={formPengiriman.everyWeekInputPembayaran}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                    <div className='flex gap-3 flex-col'>
+                      <Radio value='tukarInvoicePembayaran' colorScheme='red'>
+                        Lainnya
+                      </Radio>
+                      <textarea
+                        id='tukarInvoiceInputPembayaran'
+                        name='tukarInvoiceInputPembayaran'
+                        placeholder='isi manual dokumen yang anda mau'
+                        value={formPengiriman.tukarInvoiceInputPembayaran}
+                        className='form-input'
+                        rows={4}
+                        cols={40}
+                        onChange={handleInputChange}
+                      />
+                    </div>
+                  </RadioGroup>
                 </div>
               </div>
 
@@ -929,7 +997,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.dokumenInvoicePengiriman}
+                      {errorsPengiriman.dokumenPengirimanInvoice}
                     </div>
                   )}
                 </div>
-- 
cgit v1.2.3


From 654fbb128ab331c3272d6e8733dda1b5b71f4253 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 25 Nov 2024 10:05:02 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 34 ++++++++++++++++--------
 1 file changed, 23 insertions(+), 11 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index adf2ee37..bae3214b 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -33,12 +33,24 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const [tukarInvoicePembayaran, setTukarInvoicePembayaran] = useState(false);
   const [selectedRadio, setSelectedRadio] = useState('');
   const [selectedRadioInvoice, setSelectedRadioInvoice] = useState('');
-
-  const [selectedIds, setSelectedIds] = useState(
-    formPengiriman.dokumenPengiriman
-      ? formPengiriman.dokumenPengiriman.split(',').map(Number)
-      : []
-  );
+  const dokumen_kirim = [
+    ['Surat Tanda Terima Barang (STTB)', '0'],
+    ['Good Receipt (GR)', '1'],
+    ['Surat Terima Barang (STB)', '2'],
+    ['Lembar Penerimaan Barang (LPB)', '3'],
+  ];
+  const [selectedIds, setSelectedIds] = useState(() => {
+    if (formPengiriman.dokumenPengiriman) {
+      const selectedDocuments = formPengiriman.dokumenPengiriman
+        .split(',')
+        .map((item) => item.trim());
+      return dokumen_kirim
+        .filter(([name]) => selectedDocuments.includes(name))
+        .map(([, id]) => Number(id));
+    }
+    return [];
+  });
+  console.log('selectedIds', selectedIds);
   const [selectedIdsDokumenInvoice, setSelectedIdsselectedIdsDokumenInvoice] =
     useState(
       formPengiriman.dokumenPengirimanInvoice
@@ -71,11 +83,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman();
   };
 
-  useEffect(() => {
-    if (formPengiriman.dokumenPengiriman) {
-      setSelectedIds(formPengiriman.dokumenPengiriman.split(',').map(Number)); // Parse string menjadi array angka
-    }
-  }, [formPengiriman.dokumenPengiriman]);
+  // useEffect(() => {
+  //   if (formPengiriman.dokumenPengiriman) {
+  //     setSelectedIds(formPengiriman.dokumenPengiriman.split(',').map(Number)); // Parse string menjadi array angka
+  //   }
+  // }, [formPengiriman.dokumenPengiriman]);
   useEffect(() => {
     if (formPengiriman.dokumenPengirimanInvoice) {
       setSelectedIdsselectedIdsDokumenInvoice(
-- 
cgit v1.2.3


From b94c0181d2e8b3b1f8a48879a059813d213b09d5 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 25 Nov 2024 14:01:45 +0700
Subject: <iman> update data

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 118 +++++++++++++++++------
 1 file changed, 87 insertions(+), 31 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index bae3214b..0c96c060 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -39,24 +39,43 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     ['Surat Terima Barang (STB)', '2'],
     ['Lembar Penerimaan Barang (LPB)', '3'],
   ];
+  const Dokumen_invoice = [
+    ['Invoice Pembelian', '0'],
+    ['Surat Jalan', '1'],
+    ['Berita Acara Serah Terima (BAST)', '2'],
+    ['Faktur Pajak', '3'],
+    ['Good Receipt (GR)', '4'],
+  ];
   const [selectedIds, setSelectedIds] = useState(() => {
     if (formPengiriman.dokumenPengiriman) {
       const selectedDocuments = formPengiriman.dokumenPengiriman
         .split(',')
         .map((item) => item.trim());
-      return dokumen_kirim
-        .filter(([name]) => selectedDocuments.includes(name))
-        .map(([, id]) => Number(id));
+
+      return selectedDocuments.map((docName) => {
+        const match = dokumen_kirim.find(([name]) => name === docName);
+        return match ? Number(match[1]) : 5; // Jika cocok, gunakan ID; jika tidak, gunakan 5
+      });
     }
     return [];
   });
-  console.log('selectedIds', selectedIds);
-  const [selectedIdsDokumenInvoice, setSelectedIdsselectedIdsDokumenInvoice] =
-    useState(
-      formPengiriman.dokumenPengirimanInvoice
-        ? formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
-        : []
-    );
+
+  const [selectedIdsDokumenInvoice, setSelectedIdsDokumenInvoice] = useState(
+    () => {
+      if (formPengiriman.dokumenPengirimanInvoice) {
+        // Pisahkan string dokumen berdasarkan koma dan hilangkan spasi ekstra
+        const selectedDocuments = formPengiriman.dokumenPengirimanInvoice
+          .split(',')
+          .map((item) => item.trim());
+        // Cari ID berdasarkan posisi nama dokumen di array Dokumen_invoice
+        return selectedDocuments.map((docName) => {
+          const match = Dokumen_invoice.find(([name]) => name === docName);
+          return match ? Number(match[1]) : 5; // Jika cocok, gunakan ID; jika tidak, gunakan 5
+        });
+      }
+      return [];
+    }
+  );
 
   const handleCheckboxChange = (id) => {
     const updatedSelected = selectedIds.includes(id)
@@ -75,7 +94,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       ? selectedIdsDokumenInvoice.filter((selectedId) => selectedId !== id)
       : [...selectedIdsDokumenInvoice, id];
 
-    setSelectedIdsselectedIdsDokumenInvoice(updatedSelected);
+    setSelectedIdsDokumenInvoice(updatedSelected);
 
     // Jika checkbox 'Lainnya' dipilih, aktifkan input custom
 
@@ -83,16 +102,39 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman();
   };
 
-  // useEffect(() => {
-  //   if (formPengiriman.dokumenPengiriman) {
-  //     setSelectedIds(formPengiriman.dokumenPengiriman.split(',').map(Number)); // Parse string menjadi array angka
-  //   }
-  // }, [formPengiriman.dokumenPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.dokumenPengiriman) {
+      // Pisahkan string berdasarkan koma dan trim spasi
+      const selectedDocuments = formPengiriman.dokumenPengiriman
+        .split(',')
+        .map((item) => item.trim());
+
+      // Map setiap dokumen, cocokkan nama dokumen dengan ID yang sesuai, atau set ke 5 jika tidak cocok
+      const matchingIds = selectedDocuments.map((docName) => {
+        const match = dokumen_kirim.find(([name]) => name === docName);
+        return match ? Number(match[1]) : 5; // Jika cocok gunakan ID; jika tidak, gunakan 5
+      });
+
+      // Set hasil ID yang sesuai atau default ke state selectedIds
+      setSelectedIds(matchingIds);
+    }
+  }, [formPengiriman.dokumenPengiriman]);
+
   useEffect(() => {
     if (formPengiriman.dokumenPengirimanInvoice) {
-      setSelectedIdsselectedIdsDokumenInvoice(
-        formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
-      ); // Parse string menjadi array angka
+      // Pisahkan string berdasarkan koma dan trim spasi
+      const selectedDocuments = formPengiriman.dokumenPengirimanInvoice
+        .split(',')
+        .map((item) => item.trim());
+
+      // Temukan ID berdasarkan posisi dokumen di dalam array Dokumen_invoice
+      const matchingIds = selectedDocuments.map((docName) => {
+        const match = Dokumen_invoice.find(([name]) => name === docName);
+        return match ? Number(match[1]) : 5; // Jika cocok gunakan ID; jika tidak, gunakan 5
+      });
+
+      // Set hasil ID yang cocok ke state selectedIdsDokumenInvoice
+      setSelectedIdsDokumenInvoice(matchingIds);
     }
   }, [formPengiriman.dokumenPengirimanInvoice]);
 
@@ -859,8 +901,10 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   <Checkbox
                     colorScheme='red'
                     key='0'
-                    isChecked={isChecked(0)}
-                    onChange={() => handleCheckboxChange(0)}
+                    isChecked={isChecked('Surat Tanda Terima Barang (STTB)')}
+                    onChange={() =>
+                      handleCheckboxChange('Surat Tanda Terima Barang (STTB)')
+                    }
                   >
                     Surat Tanda Terima Barang (STTB)
                   </Checkbox>
@@ -868,7 +912,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='1'
                     isChecked={isChecked(1)}
-                    onChange={() => handleCheckboxChange(1)}
+                    onChange={() => handleCheckboxChange('Good Receipt (GR)')}
                   >
                     Good Receipt (GR)
                   </Checkbox>
@@ -876,7 +920,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='2'
                     isChecked={isChecked(2)}
-                    onChange={() => handleCheckboxChange(2)}
+                    onChange={() =>
+                      handleCheckboxChange('Surat Terima Barang (STB)')
+                    }
                   >
                     Surat Terima Barang (STB)
                   </Checkbox>
@@ -884,7 +930,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='3'
                     isChecked={isChecked(3)}
-                    onChange={() => handleCheckboxChange(3)}
+                    onChange={() =>
+                      handleCheckboxChange('Lembar Penerimaan Barang (LPB)')
+                    }
                   >
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
@@ -894,7 +942,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       colorScheme='red'
                       key='4'
                       isChecked={isChecked(4)}
-                      onChange={() => handleCheckboxChange(4)}
+                      onChange={() => handleCheckboxChange('Lainnya')}
                     >
                       Lainnya
                     </Checkbox>
@@ -937,7 +985,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='0'
                     isChecked={isCheckedInvoice(0)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(0)
+                      handleCheckboxChangeDokumenPengirimanInvoice(
+                        'Invoice Pembelian'
+                      )
                     }
                   >
                     Invoice Pembelian
@@ -947,7 +997,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='1'
                     isChecked={isCheckedInvoice(1)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(1)
+                      handleCheckboxChangeDokumenPengirimanInvoice(
+                        ' Surat Jalan'
+                      )
                     }
                   >
                     Surat Jalan
@@ -957,7 +1009,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='2'
                     isChecked={isCheckedInvoice(2)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(2)
+                      handleCheckboxChangeDokumenPengirimanInvoice('')
                     }
                   >
                     Berita Acara Serah Terima (BAST)
@@ -967,7 +1019,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='3'
                     isChecked={isCheckedInvoice(3)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(3)
+                      handleCheckboxChangeDokumenPengirimanInvoice(
+                        'Faktur Pajak'
+                      )
                     }
                   >
                     Faktur Pajak
@@ -977,7 +1031,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='4'
                     isChecked={isCheckedInvoice(4)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(4)
+                      handleCheckboxChangeDokumenPengirimanInvoice(
+                        'Good Receipt (GR)'
+                      )
                     }
                   >
                     Good Receipt (GR)
@@ -989,7 +1045,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       key='5'
                       isChecked={isCheckedInvoice(5)}
                       onChange={() =>
-                        handleCheckboxChangeDokumenPengirimanInvoice(5)
+                        handleCheckboxChangeDokumenPengirimanInvoice('Lainnya')
                       }
                     >
                       Lainnya
-- 
cgit v1.2.3


From 494909f40b918e4273d6258a74f12ac42253a4a7 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 25 Nov 2024 17:04:51 +0700
Subject: <iman> pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 125 ++++++-----------------
 1 file changed, 29 insertions(+), 96 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 0c96c060..7b0a9455 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -33,49 +33,19 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const [tukarInvoicePembayaran, setTukarInvoicePembayaran] = useState(false);
   const [selectedRadio, setSelectedRadio] = useState('');
   const [selectedRadioInvoice, setSelectedRadioInvoice] = useState('');
-  const dokumen_kirim = [
-    ['Surat Tanda Terima Barang (STTB)', '0'],
-    ['Good Receipt (GR)', '1'],
-    ['Surat Terima Barang (STB)', '2'],
-    ['Lembar Penerimaan Barang (LPB)', '3'],
-  ];
-  const Dokumen_invoice = [
-    ['Invoice Pembelian', '0'],
-    ['Surat Jalan', '1'],
-    ['Berita Acara Serah Terima (BAST)', '2'],
-    ['Faktur Pajak', '3'],
-    ['Good Receipt (GR)', '4'],
-  ];
-  const [selectedIds, setSelectedIds] = useState(() => {
-    if (formPengiriman.dokumenPengiriman) {
-      const selectedDocuments = formPengiriman.dokumenPengiriman
-        .split(',')
-        .map((item) => item.trim());
-
-      return selectedDocuments.map((docName) => {
-        const match = dokumen_kirim.find(([name]) => name === docName);
-        return match ? Number(match[1]) : 5; // Jika cocok, gunakan ID; jika tidak, gunakan 5
-      });
-    }
-    return [];
-  });
 
-  const [selectedIdsDokumenInvoice, setSelectedIdsDokumenInvoice] = useState(
-    () => {
-      if (formPengiriman.dokumenPengirimanInvoice) {
-        // Pisahkan string dokumen berdasarkan koma dan hilangkan spasi ekstra
-        const selectedDocuments = formPengiriman.dokumenPengirimanInvoice
-          .split(',')
-          .map((item) => item.trim());
-        // Cari ID berdasarkan posisi nama dokumen di array Dokumen_invoice
-        return selectedDocuments.map((docName) => {
-          const match = Dokumen_invoice.find(([name]) => name === docName);
-          return match ? Number(match[1]) : 5; // Jika cocok, gunakan ID; jika tidak, gunakan 5
-        });
-      }
-      return [];
-    }
+  const [selectedIds, setSelectedIds] = useState(
+    formPengiriman.dokumenPengiriman
+      ? formPengiriman.dokumenPengiriman.split(',').map(Number)
+      : []
   );
+  console.log('selectedIds', selectedIds);
+  const [selectedIdsDokumenInvoice, setSelectedIdsselectedIdsDokumenInvoice] =
+    useState(
+      formPengiriman.dokumenPengirimanInvoice
+        ? formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
+        : []
+    );
 
   const handleCheckboxChange = (id) => {
     const updatedSelected = selectedIds.includes(id)
@@ -94,7 +64,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       ? selectedIdsDokumenInvoice.filter((selectedId) => selectedId !== id)
       : [...selectedIdsDokumenInvoice, id];
 
-    setSelectedIdsDokumenInvoice(updatedSelected);
+    setSelectedIdsselectedIdsDokumenInvoice(updatedSelected);
 
     // Jika checkbox 'Lainnya' dipilih, aktifkan input custom
 
@@ -104,37 +74,14 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
   useEffect(() => {
     if (formPengiriman.dokumenPengiriman) {
-      // Pisahkan string berdasarkan koma dan trim spasi
-      const selectedDocuments = formPengiriman.dokumenPengiriman
-        .split(',')
-        .map((item) => item.trim());
-
-      // Map setiap dokumen, cocokkan nama dokumen dengan ID yang sesuai, atau set ke 5 jika tidak cocok
-      const matchingIds = selectedDocuments.map((docName) => {
-        const match = dokumen_kirim.find(([name]) => name === docName);
-        return match ? Number(match[1]) : 5; // Jika cocok gunakan ID; jika tidak, gunakan 5
-      });
-
-      // Set hasil ID yang sesuai atau default ke state selectedIds
-      setSelectedIds(matchingIds);
+      setSelectedIds(formPengiriman.dokumenPengiriman.split(',').map(Number)); // Parse string menjadi array angka
     }
   }, [formPengiriman.dokumenPengiriman]);
-
   useEffect(() => {
     if (formPengiriman.dokumenPengirimanInvoice) {
-      // Pisahkan string berdasarkan koma dan trim spasi
-      const selectedDocuments = formPengiriman.dokumenPengirimanInvoice
-        .split(',')
-        .map((item) => item.trim());
-
-      // Temukan ID berdasarkan posisi dokumen di dalam array Dokumen_invoice
-      const matchingIds = selectedDocuments.map((docName) => {
-        const match = Dokumen_invoice.find(([name]) => name === docName);
-        return match ? Number(match[1]) : 5; // Jika cocok gunakan ID; jika tidak, gunakan 5
-      });
-
-      // Set hasil ID yang cocok ke state selectedIdsDokumenInvoice
-      setSelectedIdsDokumenInvoice(matchingIds);
+      setSelectedIdsselectedIdsDokumenInvoice(
+        formPengiriman.dokumenPengirimanInvoice.split(',').map(Number)
+      ); // Parse string menjadi array angka
     }
   }, [formPengiriman.dokumenPengirimanInvoice]);
 
@@ -424,7 +371,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       setValue('statePengiriman', '');
       setValue('cityPengiriman', '');
     }
-    updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+    updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
     validatePengiriman();
   }, [sameAddressStreet]);
 
@@ -901,10 +848,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   <Checkbox
                     colorScheme='red'
                     key='0'
-                    isChecked={isChecked('Surat Tanda Terima Barang (STTB)')}
-                    onChange={() =>
-                      handleCheckboxChange('Surat Tanda Terima Barang (STTB)')
-                    }
+                    isChecked={isChecked(0)}
+                    onChange={() => handleCheckboxChange(0)}
                   >
                     Surat Tanda Terima Barang (STTB)
                   </Checkbox>
@@ -912,7 +857,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='1'
                     isChecked={isChecked(1)}
-                    onChange={() => handleCheckboxChange('Good Receipt (GR)')}
+                    onChange={() => handleCheckboxChange(1)}
                   >
                     Good Receipt (GR)
                   </Checkbox>
@@ -920,9 +865,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='2'
                     isChecked={isChecked(2)}
-                    onChange={() =>
-                      handleCheckboxChange('Surat Terima Barang (STB)')
-                    }
+                    onChange={() => handleCheckboxChange(2)}
                   >
                     Surat Terima Barang (STB)
                   </Checkbox>
@@ -930,9 +873,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     colorScheme='red'
                     key='3'
                     isChecked={isChecked(3)}
-                    onChange={() =>
-                      handleCheckboxChange('Lembar Penerimaan Barang (LPB)')
-                    }
+                    onChange={() => handleCheckboxChange(3)}
                   >
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
@@ -942,7 +883,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       colorScheme='red'
                       key='4'
                       isChecked={isChecked(4)}
-                      onChange={() => handleCheckboxChange('Lainnya')}
+                      onChange={() => handleCheckboxChange(4)}
                     >
                       Lainnya
                     </Checkbox>
@@ -985,9 +926,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='0'
                     isChecked={isCheckedInvoice(0)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(
-                        'Invoice Pembelian'
-                      )
+                      handleCheckboxChangeDokumenPengirimanInvoice(0)
                     }
                   >
                     Invoice Pembelian
@@ -997,9 +936,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='1'
                     isChecked={isCheckedInvoice(1)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(
-                        ' Surat Jalan'
-                      )
+                      handleCheckboxChangeDokumenPengirimanInvoice(1)
                     }
                   >
                     Surat Jalan
@@ -1009,7 +946,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='2'
                     isChecked={isCheckedInvoice(2)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice('')
+                      handleCheckboxChangeDokumenPengirimanInvoice(2)
                     }
                   >
                     Berita Acara Serah Terima (BAST)
@@ -1019,9 +956,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='3'
                     isChecked={isCheckedInvoice(3)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(
-                        'Faktur Pajak'
-                      )
+                      handleCheckboxChangeDokumenPengirimanInvoice(3)
                     }
                   >
                     Faktur Pajak
@@ -1031,9 +966,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     key='4'
                     isChecked={isCheckedInvoice(4)}
                     onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(
-                        'Good Receipt (GR)'
-                      )
+                      handleCheckboxChangeDokumenPengirimanInvoice(4)
                     }
                   >
                     Good Receipt (GR)
@@ -1045,7 +978,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       key='5'
                       isChecked={isCheckedInvoice(5)}
                       onChange={() =>
-                        handleCheckboxChangeDokumenPengirimanInvoice('Lainnya')
+                        handleCheckboxChangeDokumenPengirimanInvoice(5)
                       }
                     >
                       Lainnya
-- 
cgit v1.2.3


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/Pengiriman.jsx | 309 ++++++++++++++---------
 1 file changed, 184 insertions(+), 125 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 7b0a9455..8b8961c5 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -39,7 +39,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       ? formPengiriman.dokumenPengiriman.split(',').map(Number)
       : []
   );
-  console.log('selectedIds', selectedIds);
   const [selectedIdsDokumenInvoice, setSelectedIdsselectedIdsDokumenInvoice] =
     useState(
       formPengiriman.dokumenPengirimanInvoice
@@ -132,7 +131,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman();
   };
   const handleRadioChange = (value) => {
-    console.log('value', value);
     setSelectedRadio(value);
     if (value == 'everyWeekday') {
       setEveryWeekday(!everyWeekday);
@@ -173,22 +171,22 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     setTukarInvoicePembayaran(!tukarInvoicePembayaran);
   };
 
-  useEffect(() => {
-    updateFormPengiriman('everyWeekday', everyWeekday);
-    updateFormPengiriman('everyWeek', everyWeek);
-    updateFormPengiriman('tukarInvoice', tukarInvoice);
-    updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
-    updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
-    updateFormPengiriman('tukarInvoicePembayaran', tukarInvoicePembayaran);
-    validatePengiriman();
-  }, [
-    everyWeekday,
-    everyWeek,
-    tukarInvoice,
-    everyWeekdayPembayaran,
-    everyWeekPembayaran,
-    tukarInvoicePembayaran,
-  ]);
+  // useEffect(() => {
+  //   updateFormPengiriman('everyWeekday', everyWeekday);
+  //   updateFormPengiriman('everyWeek', everyWeek);
+  //   updateFormPengiriman('tukarInvoice', tukarInvoice);
+  //   updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
+  //   updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
+  //   updateFormPengiriman('tukarInvoicePembayaran', tukarInvoicePembayaran);
+  //   validatePengiriman();
+  // }, [
+  //   everyWeekday,
+  //   everyWeek,
+  //   tukarInvoice,
+  //   everyWeekdayPembayaran,
+  //   everyWeekPembayaran,
+  //   tukarInvoicePembayaran,
+  // ]);
 
   const isFormValid = useMemo(
     () => Object.keys(errorsPengiriman).length === 0,
@@ -301,44 +299,55 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   }, [buttonSubmitClick, chekValid]);
 
   useEffect(() => {
-    validatePengiriman();
-    if (formPengiriman.isSameAddrees) {
-      const isSame = formPengiriman.isSameAddrees;
-      if (isSame == 'true') {
-        setSameAddress(true);
-      } else {
-        setSameAddress(false);
-      }
+    if (formPengiriman.isSameAddreesStreet == 'true') {
+      setSameAddressStreet(true);
     }
-    if (formPengiriman.isSameAddreesStreet) {
-      const isSame = formPengiriman.isSameAddreesStreet;
-      if (isSame == 'true') {
-        setSameAddressStreet(true);
-      } else {
-        setSameAddressStreet(false);
-      }
-    }
-    validatePengiriman();
-  }, [buttonSubmitClick]);
+  }, [formPengiriman.isSameAddreesStreet]);
   useEffect(() => {
-    if (formPengiriman.isSameAddrees) {
-      const isSame = formPengiriman.isSameAddrees;
-      if (isSame == 'true') {
-        setSameAddress(true);
-      } else {
-        setSameAddress(false);
-      }
+    if (formPengiriman.isSameAddrees == 'true') {
+      setSameAddress(true);
     }
-    if (formPengiriman.isSameAddreesStreet) {
-      const isSame = formPengiriman.isSameAddreesStreet;
-      if (isSame == 'true') {
-        setSameAddressStreet(true);
-      } else {
-        setSameAddressStreet(false);
-      }
-    }
-    validatePengiriman();
-  }, [formPengiriman.isSameAddrees, formPengiriman.isSameAddreesStreet]);
+  }, [formPengiriman.isSameAddrees]);
+
+  // useEffect(() => {
+  //   validatePengiriman();
+  //   if (formPengiriman.isSameAddrees) {
+  //     const isSame = formPengiriman.isSameAddrees;
+  //     if (isSame == 'true') {
+  //       setSameAddress(true);
+  //     } else {
+  //       setSameAddress(false);
+  //     }
+  //   }
+  //   if (formPengiriman.isSameAddreesStreet) {
+  //     const isSame = formPengiriman.isSameAddreesStreet;
+  //     if (isSame == 'true') {
+  //       setSameAddressStreet(true);
+  //     } else {
+  //       setSameAddressStreet(false);
+  //     }
+  //   }
+  //   validatePengiriman();
+  // }, [buttonSubmitClick]);
+  // useEffect(() => {
+  //   if (formPengiriman.isSameAddrees) {
+  //     const isSame = formPengiriman.isSameAddrees;
+  //     if (isSame == 'true') {
+  //       setSameAddress(true);
+  //     } else {
+  //       setSameAddress(false);
+  //     }
+  //   }
+  //   if (formPengiriman.isSameAddreesStreet) {
+  //     const isSame = formPengiriman.isSameAddreesStreet;
+  //     if (isSame == 'true') {
+  //       setSameAddressStreet(true);
+  //     } else {
+  //       setSameAddressStreet(false);
+  //     }
+  //   }
+  //   validatePengiriman();
+  // }, [formPengiriman.isSameAddrees, formPengiriman.isSameAddreesStreet]);
   useEffect(() => {
     if (sameAddress) {
       updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
@@ -383,77 +392,75 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     return item;
   };
 
-  const cachedData = getFromLocalStorage('Pengiriman');
-  useEffect(() => {
-    if (cachedData) {
-      setValue('cityPengiriman', parseInt(cachedData?.cityPengiriman));
-      updateFormPengiriman('cityPengiriman', `${cachedData?.cityPengiriman}`);
-    }
-    if (cachedData?.statePengiriman) {
-      setValue('statePengiriman', parseInt(cachedData?.statePengiriman));
-    }
-    if (cachedData?.stateInvoice) {
-      setValue('stateInvoice', parseInt(cachedData?.stateInvoice));
-    }
-    if (cachedData?.cityInvoice) {
-      setValue('cityInvoice', parseInt(cachedData?.cityInvoice));
-    }
-    if (cachedData?.isSameAddrees) {
-      updateFormPengiriman('isSameAddrees', `${cachedData?.isSameAddrees}`);
-    }
-    validatePengiriman();
-  }, [cachedData?.cityPengiriman]);
-  useEffect(() => {
-    if (cachedData?.everyWeek) {
-      updateFormPengiriman('everyWeek', cachedData?.everyWeek);
-      setEveryWeek(cachedData?.everyWeek);
-    }
-    if (cachedData?.everyWeekday) {
-      updateFormPengiriman('everyWeekday', cachedData?.everyWeekday);
-      setEveryWeekday(cachedData?.everyWeekday);
-    }
-    if (cachedData?.tukarInvoice) {
-      updateFormPengiriman('tukarInvoice', cachedData?.tukarInvoice);
-      setTukarInvoice(cachedData?.tukarInvoice);
-    }
-    if (cachedData?.everyWeekPembayaran) {
-      updateFormPengiriman(
-        'everyWeekPembayaran',
-        cachedData?.everyWeekPembayaran
-      );
-      setEveryWeekPembayaran(cachedData?.everyWeekPembayaran);
-    }
-    if (cachedData?.everyWeekdayPembayaran) {
-      updateFormPengiriman(
-        'everyWeekdayPembayaran',
-        cachedData?.everyWeekdayPembayaran
-      );
-      setEveryWeekdayPembayaran(cachedData?.everyWeekdayPembayaran);
-    }
-    if (cachedData?.tukarInvoicePembayaran) {
-      updateFormPengiriman(
-        'tukarInvoicePembayaran',
-        cachedData?.tukarInvoicePembayaran
-      );
-      setTukarInvoicePembayaran(cachedData?.tukarInvoicePembayaran);
-    }
-    validatePengiriman();
-  }, [
-    cachedData?.everyWeek,
-    cachedData?.everyWeekday,
-    cachedData?.tukarInvoice,
-    cachedData?.everyWeekdayPembayaran,
-    cachedData?.everyWeekPembayaran,
-    cachedData?.tukarInvoicePembayaran,
-  ]);
+  // const cachedData = getFromLocalStorage('Pengiriman');
+  // useEffect(() => {
+  //   if (cachedData) {
+  //     setValue('cityPengiriman', parseInt(cachedData?.cityPengiriman));
+  //     updateFormPengiriman('cityPengiriman', `${cachedData?.cityPengiriman}`);
+  //   }
+  //   if (cachedData?.statePengiriman) {
+  //     setValue('statePengiriman', parseInt(cachedData?.statePengiriman));
+  //   }
+  //   if (cachedData?.stateInvoice) {
+  //     setValue('stateInvoice', parseInt(cachedData?.stateInvoice));
+  //   }
+  //   if (cachedData?.cityInvoice) {
+  //     setValue('cityInvoice', parseInt(cachedData?.cityInvoice));
+  //   }
+  //   if (cachedData?.isSameAddrees) {
+  //     updateFormPengiriman('isSameAddrees', `${cachedData?.isSameAddrees}`);
+  //   }
+  //   validatePengiriman();
+  // }, [cachedData?.cityPengiriman]);
+  // useEffect(() => {
+  //   if (cachedData?.everyWeek) {
+  //     updateFormPengiriman('everyWeek', cachedData?.everyWeek);
+  //     setEveryWeek(cachedData?.everyWeek);
+  //   }
+  //   if (cachedData?.everyWeekday) {
+  //     updateFormPengiriman('everyWeekday', cachedData?.everyWeekday);
+  //     setEveryWeekday(cachedData?.everyWeekday);
+  //   }
+  //   if (cachedData?.tukarInvoice) {
+  //     updateFormPengiriman('tukarInvoice', cachedData?.tukarInvoice);
+  //     setTukarInvoice(cachedData?.tukarInvoice);
+  //   }
+  //   if (cachedData?.everyWeekPembayaran) {
+  //     updateFormPengiriman(
+  //       'everyWeekPembayaran',
+  //       cachedData?.everyWeekPembayaran
+  //     );
+  //     setEveryWeekPembayaran(cachedData?.everyWeekPembayaran);
+  //   }
+  //   if (cachedData?.everyWeekdayPembayaran) {
+  //     updateFormPengiriman(
+  //       'everyWeekdayPembayaran',
+  //       cachedData?.everyWeekdayPembayaran
+  //     );
+  //     setEveryWeekdayPembayaran(cachedData?.everyWeekdayPembayaran);
+  //   }
+  //   if (cachedData?.tukarInvoicePembayaran) {
+  //     updateFormPengiriman(
+  //       'tukarInvoicePembayaran',
+  //       cachedData?.tukarInvoicePembayaran
+  //     );
+  //     setTukarInvoicePembayaran(cachedData?.tukarInvoicePembayaran);
+  //   }
+  //   validatePengiriman();
+  // }, [
+  //   cachedData?.everyWeek,
+  //   cachedData?.everyWeekday,
+  //   cachedData?.tukarInvoice,
+  //   cachedData?.everyWeekdayPembayaran,
+  //   cachedData?.everyWeekPembayaran,
+  //   cachedData?.tukarInvoicePembayaran,
+  // ]);
   const handleChangeSameAddress = () => {
     setSameAddress(!sameAddress);
   };
   const handleChangeSameAddressStreet = () => {
     setSameAddressStreet(!sameAddressStreet);
   };
-  console.log('formPengiriman', formPengiriman);
-  console.log('errorsPengiriman', errorsPengiriman);
   return (
     <>
       {isDesktop && (
@@ -479,6 +486,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     className='form-input'
                     aria-invalid={errorsPengiriman.PICName}
                     ref={PICNameRef}
+                    aria-label='PICName'
                     onChange={handleInputChange}
                   />
                   {chekValid && (
@@ -516,6 +524,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           id='streetPengiriman'
                           name='streetPengiriman'
                           ref={streetPengirimanRef}
+                          aria-label='streetPengiriman'
                           placeholder='Masukkan alamat lengkap pengiriman barang'
                           type='text'
                           value={formPengiriman.streetPengiriman}
@@ -529,7 +538,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         )}
                       </div>
                       <div className='sub-alamat flex flex-row w-full gap-3'>
-                        <div className='w-2/5' ref={statePengirimanRef}>
+                        <div
+                          className='w-2/5'
+                          ref={statePengirimanRef}
+                          aria-label='statePengiriman'
+                        >
                           <Controller
                             name='statePengiriman'
                             control={control}
@@ -550,6 +563,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         <div className='w-1/3' ref={cityPengirimanRef}>
                           <Controller
                             name='cityPengiriman'
+                            aria-label='cityPengiriman'
                             control={control}
                             render={(props) => (
                               <HookFormSelect
@@ -569,6 +583,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         <div className='w-1/3'>
                           <input
                             id='zipPengiriman'
+                            aria-label='zipPengiriman'
                             name='zipPengiriman'
                             ref={zipRef}
                             placeholder='Kode Pos'
@@ -600,6 +615,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     value={formPengiriman.invoicePic}
                     id='invoicePic'
                     name='invoicePic'
+                    aria-label='invoicePic'
                     placeholder='Masukkan nama pic invoice disini'
                     type='text'
                     className='form-input'
@@ -643,6 +659,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         <input
                           id='streetInvoice'
                           name='streetInvoice'
+                          aria-label='streetInvoice'
                           ref={streetInvoiceRef}
                           placeholder='Masukkan alamat lengkap pengiriman invoice'
                           type='text'
@@ -657,7 +674,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         )}
                       </div>
                       <div className='sub-alamat flex flex-row w-full gap-3'>
-                        <div className='w-3/5' ref={stateInvoiceRef}>
+                        <div
+                          className='w-3/5'
+                          ref={stateInvoiceRef}
+                          aria-label='stateInvoice'
+                        >
                           <Controller
                             name='stateInvoice'
                             control={control}
@@ -675,7 +696,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                             </div>
                           )}
                         </div>
-                        <div className='w-2/5' ref={cityInvoiceRef}>
+                        <div
+                          className='w-2/5'
+                          ref={cityInvoiceRef}
+                          aria-label='cityInvoice'
+                        >
                           <Controller
                             name='cityInvoice'
                             control={control}
@@ -723,6 +748,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       </Radio>
                       <input
                         id='everyWeekdayInput'
+                        aria-label='everyWeekdayInput'
                         name='everyWeekdayInput'
                         ref={everyWeekdayInputRef}
                         placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
@@ -738,6 +764,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       </Radio>
                       <input
                         id='everyWeekInput'
+                        aria-label='everyWeekInput'
                         name='everyWeekInput'
                         ref={everyWeekInputRef}
                         placeholder='Format: Minggu 1 & Minggu 2'
@@ -754,6 +781,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       <textarea
                         id='tukarInvoiceInput'
                         name='tukarInvoiceInput'
+                        aria-label='tukarInvoiceInput'
                         placeholder='Isi manual dokumen yang anda mau'
                         value={formPengiriman.tukarInvoiceInput}
                         className='form-input'
@@ -844,6 +872,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div
                   className='w-3/5 flex gap-3 flex-col'
                   ref={dokumenPengirimanRef}
+                  aria-label='dokumenPengirimanInput'
                 >
                   <Checkbox
                     colorScheme='red'
@@ -890,6 +919,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <textarea
                       id='dokumenPengirimanInput'
                       name='dokumenPengirimanInput'
+                      aria-label='dokumenPengirimanInput'
                       placeholder='isi manual dokumen yang anda mau'
                       type='textarea'
                       ref={dokumenPengirimanInputRef}
@@ -920,6 +950,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div
                   className='w-3/5 flex gap-3 flex-col'
                   ref={dokumenPengirimanInvoiceRef}
+                  name='dokumenPengirimanInvoiceInput'
                 >
                   <Checkbox
                     colorScheme='red'
@@ -985,6 +1016,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     </Checkbox>
                     <textarea
                       id='dokumenPengirimanInvoiceInput'
+                      aria-label='dokumenPengirimanInvoiceInput'
                       name='dokumenPengirimanInvoiceInput'
                       placeholder='isi manual dokumen yang anda mau'
                       type='textarea'
@@ -1026,6 +1058,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   value={formPengiriman.PICName}
                   id='PICName'
                   name='PICName'
+                  aria-label='PICName'
                   placeholder='Masukkan nama pic pengiriman disini'
                   type='text'
                   className='form-input'
@@ -1048,6 +1081,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   <input
                     id='streetPengiriman'
                     name='streetPengiriman'
+                    aria-label='streetPengiriman'
                     ref={streetPengirimanRef}
                     placeholder='Masukkan alamat lengkap pengiriman barang'
                     type='text'
@@ -1062,7 +1096,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='sub-alamat flex flex-row w-full gap-2'>
-                  <div className='w-2/5' ref={statePengirimanRef}>
+                  <div
+                    className='w-2/5'
+                    ref={statePengirimanRef}
+                    aria-label='statePengiriman'
+                  >
                     <Controller
                       name='statePengiriman'
                       control={control}
@@ -1075,7 +1113,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       )}
                     />
                   </div>
-                  <div className='w-1/3' ref={cityPengirimanRef}>
+                  <div
+                    className='w-1/3'
+                    ref={cityPengirimanRef}
+                    aria-label='cityPengiriman'
+                  >
                     <Controller
                       name='cityPengiriman'
                       control={control}
@@ -1092,6 +1134,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   <div className='w-1/3'>
                     <input
                       id='zipPengiriman'
+                      aria-label='zipPengiriman'
                       name='zipPengiriman'
                       ref={zipRef}
                       placeholder='Kode Pos'
@@ -1126,6 +1169,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <input
                   value={formPengiriman.invoicePic}
                   id='invoicePic'
+                  aria-label='invoicePic'
                   name='invoicePic'
                   placeholder='Masukkan nama pic invoice disini'
                   type='text'
@@ -1160,6 +1204,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     <div className='w-full'>
                       <input
                         id='streetInvoice'
+                        aria-label='streetInvoice'
                         name='streetInvoice'
                         ref={streetInvoiceRef}
                         placeholder='Masukkan alamat lengkap pengiriman invoice'
@@ -1175,7 +1220,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       )}
                     </div>
                     <div className='sub-alamat flex flex-row w-full gap-3'>
-                      <div className='w-3/5' ref={stateInvoiceRef}>
+                      <div
+                        className='w-3/5'
+                        ref={stateInvoiceRef}
+                        aria-label='stateInvoice'
+                      >
                         <Controller
                           name='stateInvoice'
                           control={control}
@@ -1193,7 +1242,11 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           </div>
                         )}
                       </div>
-                      <div className='w-2/5' ref={cityInvoiceRef}>
+                      <div
+                        className='w-2/5'
+                        ref={cityInvoiceRef}
+                        aria-label='cityInvoice'
+                      >
                         <Controller
                           name='cityInvoice'
                           control={control}
@@ -1239,6 +1292,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     </Checkbox>
                     <input
                       id='everyWeekdayInput'
+                      aria-label='everyWeekdayInput'
                       name='everyWeekdayInput'
                       ref={everyWeekdayInputRef}
                       placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
@@ -1259,6 +1313,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     </Checkbox>
                     <input
                       id='everyWeekInput'
+                      aria-label='everyWeekInput'
                       name='everyWeekInput'
                       ref={everyWeekInputRef}
                       placeholder='Format: Minggu 1 & Minggu 2'
@@ -1378,6 +1433,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div
                   className='w-full flex gap-2 flex-col'
                   ref={dokumenPengirimanRef}
+                  aria-label='dokumenPengirimanInput'
                 >
                   <Checkbox
                     size='sm'
@@ -1428,6 +1484,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     </Checkbox>
                     <textarea
                       id='dokumenPengirimanInput'
+                      aria-label='dokumenPengirimanInput'
                       name='dokumenPengirimanInput'
                       placeholder='isi manual dokumen yang anda mau'
                       type='textarea'
@@ -1457,6 +1514,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <div
                   className='w-full flex gap-2 flex-col'
                   ref={dokumenPengirimanInvoiceRef}
+                  aria-label='dokumenPengirimanInvoiceInput'
                 >
                   <Checkbox
                     size='sm'
@@ -1528,6 +1586,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     </Checkbox>
                     <textarea
                       id='dokumenPengirimanInvoiceInput'
+                      aria-label='dokumenPengirimanInvoiceInput'
                       name='dokumenPengirimanInvoiceInput'
                       placeholder='isi manual dokumen yang anda mau'
                       type='textarea'
-- 
cgit v1.2.3


From e9cd13307f0095dc4edc5048752675d80c551564 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 6 Dec 2024 17:06:26 +0700
Subject: <iman> pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 1310 ++++++++++------------
 1 file changed, 601 insertions(+), 709 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 8b8961c5..0352b54f 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -9,7 +9,7 @@ import {
   usePengajuanTempoStorePengiriman,
   usePengajuanTempoStore,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
-
+import { toast } from 'react-hot-toast';
 import useDevice from '@/core/hooks/useDevice';
 const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const { control, watch, setValue } = useForm();
@@ -102,7 +102,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
   const watchState = watch('statePengiriman');
   useEffect(() => {
-    updateFormPengiriman('cityPengiriman', '');
+    // updateFormPengiriman('cityPengiriman', '');
     if (watchState) {
       updateFormPengiriman('statePengiriman', `${watchState}`);
       validatePengiriman();
@@ -352,35 +352,63 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     if (sameAddress) {
       updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
       updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
+      setValue('stateInvoice', parseInt(formPengiriman.statePengiriman));
       updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
+      setValue('cityInvoice', parseInt(formPengiriman.cityPengiriman));
+      updateFormPengiriman('isSameAddrees', `${sameAddress}`);
     } else {
-      updateFormPengiriman('streetInvoice', '');
-      updateFormPengiriman('stateInvoice', '');
-      updateFormPengiriman('cityInvoice', '');
-      setValue('streetInvoice', '');
-      setValue('stateInvoice', '');
-      setValue('cityInvoice', '');
+      // updateFormPengiriman('streetInvoice', '');
+      // updateFormPengiriman('stateInvoice', '');
+      // updateFormPengiriman('cityInvoice', '');
+      // setValue('streetInvoice', '');
+      // setValue('stateInvoice', '');
+      // setValue('cityInvoice', '');
     }
-    updateFormPengiriman('isSameAddrees', `${sameAddress}`);
     validatePengiriman();
-  }, [sameAddress]);
+  }, [
+    sameAddress,
+    formPengiriman.streetPengiriman,
+    formPengiriman.statePengiriman,
+    formPengiriman.cityPengiriman,
+  ]);
+  useEffect(() => {
+    if (formPengiriman.sameAddressStreet?.toLowerCase().includes('true')) {
+      setSameAddressStreet(true);
+    } else {
+      setSameAddressStreet(false);
+    }
+  }, [formPengiriman.sameAddressStreet]);
+  useEffect(() => {
+    if (formPengiriman.statePengiriman) {
+      setValue('statePengiriman', parseInt(formPengiriman.statePengiriman));
+    }
+  }, [formPengiriman.statePengiriman]);
+  useEffect(() => {
+    if (formPengiriman.cityPengiriman) {
+      setValue('cityPengiriman', parseInt(formPengiriman.cityPengiriman));
+    }
+  }, [formPengiriman.cityPengiriman]);
 
   useEffect(() => {
     if (sameAddressStreet) {
+      console.log('form.state', form);
       updateFormPengiriman('streetPengiriman', form.street);
       updateFormPengiriman('statePengiriman', form.state);
+      setValue('statePengiriman', parseInt(form.state));
       updateFormPengiriman('cityPengiriman', form.city);
+      setValue('cityPengiriman', parseInt(form.city));
       updateFormPengiriman('zipPengiriman', form.zip);
-    } else {
-      updateFormPengiriman('streetPengiriman', '');
-      updateFormPengiriman('statePengiriman', '');
-      updateFormPengiriman('cityPengiriman', '');
-      updateFormPengiriman('zipPengiriman', '');
-      setValue('streetPengiriman', '');
-      setValue('statePengiriman', '');
-      setValue('cityPengiriman', '');
+      updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
     }
-    updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
+    // else {
+    //   updateFormPengiriman('streetPengiriman', '');
+    //   updateFormPengiriman('statePengiriman', '');
+    //   updateFormPengiriman('cityPengiriman', '');
+    //   updateFormPengiriman('zipPengiriman', '');
+    //   setValue('streetPengiriman', '');
+    //   setValue('statePengiriman', '');
+    //   setValue('cityPengiriman', '');
+    // }
     validatePengiriman();
   }, [sameAddressStreet]);
 
@@ -459,8 +487,70 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     setSameAddress(!sameAddress);
   };
   const handleChangeSameAddressStreet = () => {
+    // updateFormPengiriman('sameAddressStreet', `${!sameAddressStreet}`);
     setSameAddressStreet(!sameAddressStreet);
+    if (sameAddressStreet == false) {
+      updateFormPengiriman('streetPengiriman', '');
+      updateFormPengiriman('statePengiriman', '');
+      updateFormPengiriman('cityPengiriman', '');
+      updateFormPengiriman('zipPengiriman', '');
+      setValue('streetPengiriman', '');
+      setValue('statePengiriman', '');
+      setValue('cityPengiriman', '');
+      updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
+      validate();
+    }
   };
+
+  useEffect(() => {
+    const options = {
+      behavior: 'smooth',
+      block: 'center',
+    };
+
+    const loadIndustries = async () => {
+      const watchZip = formPengiriman.zipPengiriman?.trim(); // Menghapus spasi berlebih
+
+      // Validasi: hanya eksekusi jika watchZip valid (contoh: minimal 5 karakter)
+      if (watchZip && watchZip.length >= 5) {
+        const loadZip = async () => {
+          try {
+            const response = await fetch(
+              `https://alamat.thecloudalert.com/api/cari/index/?keyword=${watchZip}`
+            );
+
+            const result = await response.json();
+
+            if (!result.result.length > 0) {
+              toast.error('Alamat pos salah');
+              updateFormPengiriman('zipPengiriman', ''); // Reset form.zip jika salah
+              validate(); // Memanggil validasi formulir
+              return false;
+            } else {
+              updateFormPengiriman('zipPengiriman', watchZip);
+              validate();
+              return true; // Jika valid
+            }
+          } catch (error) {
+            toast.error('Terjadi kesalahan saat memeriksa alamat pos.');
+            console.error('Error:', error);
+            return false;
+          }
+        };
+
+        const isValidZip = await loadZip();
+        if (!isValidZip) {
+          zipRef.current.scrollIntoView(options);
+        }
+      }
+    };
+
+    loadIndustries();
+  }, [formPengiriman.zipPengiriman]);
+
+  console.log('formPengiriman', formPengiriman);
+  console.log('errorsPengiriman', errorsPengiriman);
+
   return (
     <>
       {isDesktop && (
@@ -477,18 +567,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </label>
                 </div>
                 <div className='w-3/5'>
-                  <input
-                    value={formPengiriman.PICName}
-                    id='PICName'
-                    name='PICName'
-                    placeholder='Masukkan nama pic pengiriman disini'
-                    type='text'
-                    className='form-input'
-                    aria-invalid={errorsPengiriman.PICName}
-                    ref={PICNameRef}
-                    aria-label='PICName'
-                    onChange={handleInputChange}
-                  />
+                  <div className='flex items-center border border-gray-300 rounded-md'>
+                    <select
+                      value={formPengiriman.PICTittle || ''}
+                      id='PICTittle'
+                      name='PICTittle'
+                      className=' p-2   rounded-l-md'
+                      onChange={handleInputChange}
+                    >
+                      <option value='' disabled>
+                        Pilih
+                      </option>
+                      <option value='Bpk'>Bpk</option>
+                      <option value='Ibu'>Ibu</option>
+                    </select>
+                    <input
+                      value={formPengiriman.PICName}
+                      id='PICName'
+                      name='PICName'
+                      placeholder='Masukkan nama pic penerimaan barang disini'
+                      type='text'
+                      className='form-input border-l border-r-0 border-t-0 border-b-0 border-gray-300 p-2 ml-2 flex-grow rounded-none'
+                      aria-invalid={errorsPengiriman.PICName}
+                      ref={PICNameRef}
+                      aria-label='PICName'
+                      onChange={handleInputChange}
+                    />
+                  </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.PICName}
@@ -515,92 +620,95 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     isChecked={sameAddressStreet}
                     onChange={handleChangeSameAddressStreet}
                   >
-                    Alamat Pengiriman sama dengan alamat pengiriman
+                    Alamat Pengiriman sama dengan alamat bisnis
                   </Checkbox>
-                  {!sameAddressStreet && (
-                    <>
-                      <div>
+
+                  <>
+                    <div>
+                      <input
+                        id='streetPengiriman'
+                        name='streetPengiriman'
+                        ref={streetPengirimanRef}
+                        aria-label='streetPengiriman'
+                        placeholder='Masukkan alamat lengkap pengiriman barang'
+                        type='text'
+                        value={formPengiriman.streetPengiriman}
+                        className='form-input'
+                        onChange={handleInputChange}
+                        disabled={sameAddressStreet}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.streetPengiriman}
+                        </div>
+                      )}
+                    </div>
+                    <div className='sub-alamat flex flex-row w-full gap-3'>
+                      <div
+                        className='w-2/5'
+                        ref={statePengirimanRef}
+                        aria-label='statePengiriman'
+                      >
+                        <Controller
+                          name='statePengiriman'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              disabled={sameAddressStreet}
+                              options={states}
+                              placeholder='Provinsi'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.statePengiriman}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3' ref={cityPengirimanRef}>
+                        <Controller
+                          name='cityPengiriman'
+                          aria-label='cityPengiriman'
+                          disabled={sameAddressStreet}
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={cities}
+                              disabled={!watchState || sameAddressStreet}
+                              placeholder='Kota'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.cityPengiriman}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3'>
                         <input
-                          id='streetPengiriman'
-                          name='streetPengiriman'
-                          ref={streetPengirimanRef}
-                          aria-label='streetPengiriman'
-                          placeholder='Masukkan alamat lengkap pengiriman barang'
-                          type='text'
-                          value={formPengiriman.streetPengiriman}
+                          id='zipPengiriman'
+                          aria-label='zipPengiriman'
+                          disabled={sameAddressStreet}
+                          name='zipPengiriman'
+                          ref={zipRef}
+                          placeholder='Kode Pos'
+                          type='number'
+                          value={formPengiriman.zipPengiriman}
                           className='form-input'
                           onChange={handleInputChange}
                         />
                         {chekValid && (
                           <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.streetPengiriman}
+                            {errorsPengiriman.zipPengiriman}
                           </div>
                         )}
                       </div>
-                      <div className='sub-alamat flex flex-row w-full gap-3'>
-                        <div
-                          className='w-2/5'
-                          ref={statePengirimanRef}
-                          aria-label='statePengiriman'
-                        >
-                          <Controller
-                            name='statePengiriman'
-                            control={control}
-                            render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={states}
-                                placeholder='Provinsi'
-                              />
-                            )}
-                          />
-                          {chekValid && (
-                            <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errorsPengiriman.statePengiriman}
-                            </div>
-                          )}
-                        </div>
-                        <div className='w-1/3' ref={cityPengirimanRef}>
-                          <Controller
-                            name='cityPengiriman'
-                            aria-label='cityPengiriman'
-                            control={control}
-                            render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={cities}
-                                disabled={!watchState}
-                                placeholder='Kota'
-                              />
-                            )}
-                          />
-                          {chekValid && (
-                            <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errorsPengiriman.cityPengiriman}
-                            </div>
-                          )}
-                        </div>
-                        <div className='w-1/3'>
-                          <input
-                            id='zipPengiriman'
-                            aria-label='zipPengiriman'
-                            name='zipPengiriman'
-                            ref={zipRef}
-                            placeholder='Kode Pos'
-                            type='number'
-                            value={formPengiriman.zipPengiriman}
-                            className='form-input'
-                            onChange={handleInputChange}
-                          />
-                          {chekValid && (
-                            <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errorsPengiriman.zipPengiriman}
-                            </div>
-                          )}
-                        </div>
-                      </div>
-                    </>
-                  )}
+                    </div>
+                  </>
                 </div>
               </div>
 
@@ -611,18 +719,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </label>
                 </div>
                 <div className='w-3/5'>
-                  <input
-                    value={formPengiriman.invoicePic}
-                    id='invoicePic'
-                    name='invoicePic'
-                    aria-label='invoicePic'
-                    placeholder='Masukkan nama pic invoice disini'
-                    type='text'
-                    className='form-input'
-                    aria-invalid={errorsPengiriman.invoicePic}
-                    ref={invoicePicRef}
-                    onChange={handleInputChange}
-                  />
+                  <div className='flex items-center border border-gray-300 rounded-md'>
+                    <select
+                      value={formPengiriman.invoicePicTittle || ''}
+                      id='invoicePicTittle'
+                      name='invoicePicTittle'
+                      className=' p-2   rounded-l-md'
+                      onChange={handleInputChange}
+                    >
+                      <option value='' disabled>
+                        Pilih
+                      </option>
+                      <option value='Bpk'>Bpk</option>
+                      <option value='Ibu'>Ibu</option>
+                    </select>
+                    <input
+                      value={formPengiriman.invoicePic}
+                      id='invoicePic'
+                      name='invoicePic'
+                      aria-label='invoicePic'
+                      placeholder='Masukkan nama pic invoice disini'
+                      type='text'
+                      className='form-input border-l border-r-0 border-t-0 border-b-0 border-gray-300 p-2 ml-2 flex-grow rounded-none'
+                      aria-invalid={errorsPengiriman.invoicePic}
+                      ref={invoicePicRef}
+                      onChange={handleInputChange}
+                    />
+                  </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.invoicePic}
@@ -653,75 +776,76 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       Alamat invoice sama dengan alamat pengiriman
                     </Checkbox>
                   </div>
-                  {!sameAddress && (
-                    <>
-                      <div>
-                        <input
-                          id='streetInvoice'
-                          name='streetInvoice'
-                          aria-label='streetInvoice'
-                          ref={streetInvoiceRef}
-                          placeholder='Masukkan alamat lengkap pengiriman invoice'
-                          type='text'
-                          value={formPengiriman.streetInvoice}
-                          className='form-input'
-                          onChange={handleInputChange}
+
+                  <>
+                    <div>
+                      <input
+                        id='streetInvoice'
+                        name='streetInvoice'
+                        aria-label='streetInvoice'
+                        ref={streetInvoiceRef}
+                        disabled={sameAddress}
+                        placeholder='Masukkan alamat lengkap pengiriman invoice'
+                        type='text'
+                        value={formPengiriman.streetInvoice}
+                        className='form-input'
+                        onChange={handleInputChange}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.streetInvoice}
+                        </div>
+                      )}
+                    </div>
+                    <div className='sub-alamat flex flex-row w-full gap-3'>
+                      <div
+                        className='w-3/5'
+                        ref={stateInvoiceRef}
+                        aria-label='stateInvoice'
+                      >
+                        <Controller
+                          name='stateInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={states}
+                              disabled={sameAddress}
+                              placeholder='Provinsi'
+                            />
+                          )}
                         />
                         {chekValid && (
                           <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.streetInvoice}
+                            {errorsPengiriman.stateInvoice}
                           </div>
                         )}
                       </div>
-                      <div className='sub-alamat flex flex-row w-full gap-3'>
-                        <div
-                          className='w-3/5'
-                          ref={stateInvoiceRef}
-                          aria-label='stateInvoice'
-                        >
-                          <Controller
-                            name='stateInvoice'
-                            control={control}
-                            render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={states}
-                                placeholder='Provinsi'
-                              />
-                            )}
-                          />
-                          {chekValid && (
-                            <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errorsPengiriman.stateInvoice}
-                            </div>
-                          )}
-                        </div>
-                        <div
-                          className='w-2/5'
-                          ref={cityInvoiceRef}
-                          aria-label='cityInvoice'
-                        >
-                          <Controller
-                            name='cityInvoice'
-                            control={control}
-                            render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={cities}
-                                disabled={!watchState}
-                                placeholder='Kota'
-                              />
-                            )}
-                          />
-                          {chekValid && (
-                            <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errorsPengiriman.cityInvoice}
-                            </div>
+                      <div
+                        className='w-2/5'
+                        ref={cityInvoiceRef}
+                        aria-label='cityInvoice'
+                      >
+                        <Controller
+                          name='cityInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={cities}
+                              disabled={!watchState || sameAddress}
+                              placeholder='Kota'
+                            />
                           )}
-                        </div>
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errorsPengiriman.cityInvoice}
+                          </div>
+                        )}
                       </div>
-                    </>
-                  )}
+                    </div>
+                  </>
                 </div>
               </div>
 
@@ -738,59 +862,17 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='w-3/5 flex gap-3 flex-col'>
-                  <RadioGroup
-                    onChange={handleRadioChange}
-                    value={selectedRadio}
-                  >
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='everyWeekday' colorScheme='red'>
-                        Setiap Minggu di hari
-                      </Radio>
-                      <input
-                        id='everyWeekdayInput'
-                        aria-label='everyWeekdayInput'
-                        name='everyWeekdayInput'
-                        ref={everyWeekdayInputRef}
-                        placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                        type='text'
-                        value={formPengiriman.everyWeekdayInput}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='everyWeek' colorScheme='red'>
-                        Setiap Bulan di minggu ke
-                      </Radio>
-                      <input
-                        id='everyWeekInput'
-                        aria-label='everyWeekInput'
-                        name='everyWeekInput'
-                        ref={everyWeekInputRef}
-                        placeholder='Format: Minggu 1 & Minggu 2'
-                        type='text'
-                        value={formPengiriman.everyWeekInput}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='tukarInvoice' colorScheme='red'>
-                        Lainnya
-                      </Radio>
-                      <textarea
-                        id='tukarInvoiceInput'
-                        name='tukarInvoiceInput'
-                        aria-label='tukarInvoiceInput'
-                        placeholder='Isi manual dokumen yang anda mau'
-                        value={formPengiriman.tukarInvoiceInput}
-                        className='form-input'
-                        rows={4}
-                        cols={40}
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                  </RadioGroup>
+                  <textarea
+                    id='tukarInvoiceInput'
+                    name='tukarInvoiceInput'
+                    aria-label='tukarInvoiceInput'
+                    placeholder='Masukkan jadwal penukaran invoice'
+                    value={formPengiriman.tukarInvoiceInput}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                 </div>
               </div>
 
@@ -807,65 +889,29 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   )}
                 </div>
                 <div className='w-3/5 flex gap-3 flex-col'>
-                  <RadioGroup
-                    onChange={handleRadioChangeInvoice}
-                    value={selectedRadioInvoice}
-                  >
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='everyWeekdayPembayaran' colorScheme='red'>
-                        Setiap Minggu di hari
-                      </Radio>
-                      <input
-                        id='everyWeekdayInputPembayaran'
-                        name='everyWeekdayInputPembayaran'
-                        placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                        type='text'
-                        value={formPengiriman.everyWeekdayInputPembayaran}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='everyWeekPembayaran' colorScheme='red'>
-                        Setiap Bulan di minggu ke
-                      </Radio>
-                      <input
-                        id='everyWeekInputPembayaran'
-                        name='everyWeekInputPembayaran'
-                        placeholder='Format: Minggu 1 & Minggu 2'
-                        type='text'
-                        value={formPengiriman.everyWeekInputPembayaran}
-                        className='form-input'
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                    <div className='flex gap-3 flex-col'>
-                      <Radio value='tukarInvoicePembayaran' colorScheme='red'>
-                        Lainnya
-                      </Radio>
-                      <textarea
-                        id='tukarInvoiceInputPembayaran'
-                        name='tukarInvoiceInputPembayaran'
-                        placeholder='isi manual dokumen yang anda mau'
-                        value={formPengiriman.tukarInvoiceInputPembayaran}
-                        className='form-input'
-                        rows={4}
-                        cols={40}
-                        onChange={handleInputChange}
-                      />
-                    </div>
-                  </RadioGroup>
+                  <textarea
+                    id='tukarInvoiceInputPembayaran'
+                    name='tukarInvoiceInputPembayaran'
+                    placeholder='Masukkan jadwal pembayaran'
+                    value={formPengiriman.tukarInvoiceInputPembayaran}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                 </div>
               </div>
 
               <div className='flex flex-row  justify-between items-start'>
                 <div className='w-2/5'>
                   <label className='form-label   text-wrap'>
-                    Dokumen saat Pengiriman Barang
+                    Apakah ada dokumen tanda terima yang diberikan pada saat
+                    pengiriman barang?{' '}
+                    <span className=' opacity-60'>(Opsional)</span>
                   </label>
                   {!isKonfirmasi && (
                     <span className='text-xs opacity-60'>
-                      Pilih dokumen lampiran saat pengiriman barang
+                      Pilih dokumen tanda terima saat pengiriman barang jika ada
                     </span>
                   )}
                 </div>
@@ -907,7 +953,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
 
-                  <div className='flex gap-3 flex-col'>
+                  {/* <div className='flex gap-3 flex-col'>
                     <Checkbox
                       colorScheme='red'
                       key='4'
@@ -929,7 +975,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       cols={40}
                       onChange={handleInputChange}
                     />
-                  </div>
+                  </div> */}
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.dokumenPengiriman}
@@ -940,94 +986,62 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
               <div className='flex flex-row  justify-between items-start'>
                 <div className='w-2/5'>
-                  <label className='form-label  text-wrap'>
-                    Dokumen yang dilampirkan saat Pengiriman Invoice
+                  <label className='form-label   text-wrap'>
+                    Dokumen saat Pengiriman Barang{' '}
+                    <span className=' opacity-60'>(Opsional)</span>
                   </label>
-                  <span className='text-xs opacity-60'>
-                    Dokumen akan dikirimkan sesuai dengan yang anda pilih
-                  </span>
-                </div>
-                <div
-                  className='w-3/5 flex gap-3 flex-col'
-                  ref={dokumenPengirimanInvoiceRef}
-                  name='dokumenPengirimanInvoiceInput'
-                >
-                  <Checkbox
-                    colorScheme='red'
-                    key='0'
-                    isChecked={isCheckedInvoice(0)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(0)
-                    }
-                  >
-                    Invoice Pembelian
-                  </Checkbox>
-                  <Checkbox
-                    colorScheme='red'
-                    key='1'
-                    isChecked={isCheckedInvoice(1)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(1)
-                    }
-                  >
-                    Surat Jalan
-                  </Checkbox>
-                  <Checkbox
-                    colorScheme='red'
-                    key='2'
-                    isChecked={isCheckedInvoice(2)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(2)
-                    }
-                  >
-                    Berita Acara Serah Terima (BAST)
-                  </Checkbox>
-                  <Checkbox
-                    colorScheme='red'
-                    key='3'
-                    isChecked={isCheckedInvoice(3)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(3)
-                    }
-                  >
-                    Faktur Pajak
-                  </Checkbox>
-                  <Checkbox
-                    colorScheme='red'
-                    key='4'
-                    isChecked={isCheckedInvoice(4)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(4)
-                    }
-                  >
-                    Good Receipt (GR)
-                  </Checkbox>
+                  {!isKonfirmasi && (
+                    <span className='text-xs opacity-60'>
+                      Dokumen lampiran saat pengiriman barang
+                    </span>
+                  )}
+                </div>
+                <div className='flex gap-3 flex-col w-3/5 '>
+                  <textarea
+                    id='dokumenPengirimanInput'
+                    name='dokumenPengirimanInput'
+                    aria-label='dokumenPengirimanInput'
+                    placeholder='isi manual dokumen yang anda mau'
+                    type='textarea'
+                    ref={dokumenPengirimanInputRef}
+                    value={formPengiriman.dokumenPengirimanInput}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenPengiriman}
+                    </div>
+                  )}
+                </div>
+              </div>
 
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      colorScheme='red'
-                      key='5'
-                      isChecked={isCheckedInvoice(5)}
-                      onChange={() =>
-                        handleCheckboxChangeDokumenPengirimanInvoice(5)
-                      }
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='dokumenPengirimanInvoiceInput'
-                      aria-label='dokumenPengirimanInvoiceInput'
-                      name='dokumenPengirimanInvoiceInput'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      ref={dokumenPengirimanInvoiceInputRef}
-                      value={formPengiriman.dokumenPengirimanInvoiceInput}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+              <div className='flex flex-row  justify-between items-start'>
+                <div className='w-2/5'>
+                  <label className='form-label  text-wrap'>
+                    Dokumen yang dilampirkan saat Pengiriman Invoice{' '}
+                    <span className=' opacity-60'>(Opsional)</span>
+                  </label>
+                  <span className='text-xs opacity-60'>
+                    Dokumen lampiran saat pengiriman invoice
+                  </span>
+                </div>
+                <div className='flex gap-3 flex-col w-3/5'>
+                  <textarea
+                    id='dokumenPengirimanInvoice'
+                    aria-label='dokumenPengirimanInvoice'
+                    name='dokumenPengirimanInvoice'
+                    placeholder='isi manual dokumen yang anda mau'
+                    type='textarea'
+                    ref={dokumenPengirimanInvoiceRef}
+                    value={formPengiriman.dokumenPengirimanInvoice}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.dokumenPengirimanInvoice}
@@ -1054,18 +1068,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <label className='form-label  text-nowrap'>
                   Nama PIC Penerimaan Barang
                 </label>
-                <input
-                  value={formPengiriman.PICName}
-                  id='PICName'
-                  name='PICName'
-                  aria-label='PICName'
-                  placeholder='Masukkan nama pic pengiriman disini'
-                  type='text'
-                  className='form-input'
-                  aria-invalid={errorsPengiriman.PICName}
-                  ref={PICNameRef}
-                  onChange={handleInputChange}
-                />
+                <div className='flex items-center border border-gray-300 rounded-md w-full'>
+                  <select
+                    value={formPengiriman.PICTittle || ''}
+                    id='PICTittle'
+                    name='PICTittle'
+                    className=' p-2   rounded-l-md'
+                    onChange={handleInputChange}
+                  >
+                    <option value='' disabled>
+                      Pilih
+                    </option>
+                    <option value='Bpk'>Bpk</option>
+                    <option value='Ibu'>Ibu</option>
+                  </select>
+                  <input
+                    value={formPengiriman.PICName}
+                    id='PICName'
+                    name='PICName'
+                    aria-label='PICName'
+                    placeholder='Masukkan nama pic penerima barang disini'
+                    type='text'
+                    className='form-input border-l border-r-0 border-t-0 border-b-0 border-gray-300 p-2 ml-2 flex-grow rounded-none'
+                    aria-invalid={errorsPengiriman.PICName}
+                    ref={PICNameRef}
+                    onChange={handleInputChange}
+                  />
+                </div>
                 {chekValid && (
                   <div className='text-caption-2 text-danger-500 mt-1'>
                     {errorsPengiriman.PICName}
@@ -1077,12 +1106,21 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <label className='form-label   text-nowrap'>
                   Alamat Pengiriman Barang
                 </label>
+                <Checkbox
+                  colorScheme='red'
+                  isChecked={sameAddressStreet}
+                  onChange={handleChangeSameAddressStreet}
+                  size='sm'
+                >
+                  Alamat Pengiriman sama dengan alamat bisnis
+                </Checkbox>
                 <div className='w-full'>
                   <input
                     id='streetPengiriman'
                     name='streetPengiriman'
                     aria-label='streetPengiriman'
                     ref={streetPengirimanRef}
+                    disabled={sameAddressStreet}
                     placeholder='Masukkan alamat lengkap pengiriman barang'
                     type='text'
                     value={formPengiriman.streetPengiriman}
@@ -1107,11 +1145,17 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       render={(props) => (
                         <HookFormSelect
                           {...props}
+                          disabled={sameAddressStreet}
                           options={states}
                           placeholder='Provinsi'
                         />
                       )}
                     />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errorsPengiriman.statePengiriman}
+                      </div>
+                    )}
                   </div>
                   <div
                     className='w-1/3'
@@ -1125,11 +1169,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         <HookFormSelect
                           {...props}
                           options={cities}
-                          disabled={!watchState}
+                          disabled={!watchState || sameAddressStreet}
                           placeholder='Kota'
                         />
                       )}
                     />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errorsPengiriman.cityPengiriman}
+                      </div>
+                    )}
                   </div>
                   <div className='w-1/3'>
                     <input
@@ -1138,27 +1187,18 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       name='zipPengiriman'
                       ref={zipRef}
                       placeholder='Kode Pos'
+                      disabled={sameAddressStreet}
                       type='number'
                       value={formPengiriman.zipPengiriman}
                       className='form-input'
                       onChange={handleInputChange}
                     />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errorsPengiriman.zipPengiriman}
+                      </div>
+                    )}
                   </div>
-                  {chekValid && (
-                    <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.statePengiriman}
-                    </div>
-                  )}
-                  {chekValid && (
-                    <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.cityPengiriman}
-                    </div>
-                  )}
-                  {chekValid && (
-                    <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.zipPengiriman}
-                    </div>
-                  )}
                 </div>
               </div>
 
@@ -1166,18 +1206,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 <label className='form-label  text-nowrap'>
                   Nama PIC Penerimaan Invoice
                 </label>
-                <input
-                  value={formPengiriman.invoicePic}
-                  id='invoicePic'
-                  aria-label='invoicePic'
-                  name='invoicePic'
-                  placeholder='Masukkan nama pic invoice disini'
-                  type='text'
-                  className='form-input'
-                  aria-invalid={errorsPengiriman.invoicePic}
-                  ref={invoicePicRef}
-                  onChange={handleInputChange}
-                />
+                <div className='flex items-center border border-gray-300 rounded-md w-full'>
+                  <select
+                    value={formPengiriman.invoicePicTittle || ''}
+                    id='invoicePicTittle'
+                    name='invoicePicTittle'
+                    className=' p-2   rounded-l-md'
+                    onChange={handleInputChange}
+                  >
+                    <option value='' disabled>
+                      Pilih
+                    </option>
+                    <option value='Bpk'>Bpk</option>
+                    <option value='Ibu'>Ibu</option>
+                  </select>
+                  <input
+                    value={formPengiriman.invoicePic}
+                    id='invoicePic'
+                    aria-label='invoicePic'
+                    name='invoicePic'
+                    placeholder='Masukkan nama pic invoice disini'
+                    type='text'
+                    className='form-input border-l border-r-0 border-t-0 border-b-0 border-gray-300 p-2 ml-2 flex-grow rounded-none'
+                    aria-invalid={errorsPengiriman.invoicePic}
+                    ref={invoicePicRef}
+                    onChange={handleInputChange}
+                  />
+                </div>
                 {chekValid && (
                   <div className='text-caption-2 text-danger-500 mt-1'>
                     {errorsPengiriman.invoicePic}
@@ -1199,75 +1254,76 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     Alamat invoice sama dengan alamat pengiriman
                   </Checkbox>
                 </div>
-                {!sameAddress && (
-                  <>
-                    <div className='w-full'>
-                      <input
-                        id='streetInvoice'
-                        aria-label='streetInvoice'
-                        name='streetInvoice'
-                        ref={streetInvoiceRef}
-                        placeholder='Masukkan alamat lengkap pengiriman invoice'
-                        type='text'
-                        value={formPengiriman.streetInvoice}
-                        className='form-input'
-                        onChange={handleInputChange}
+
+                <>
+                  <div className='w-full'>
+                    <input
+                      id='streetInvoice'
+                      aria-label='streetInvoice'
+                      name='streetInvoice'
+                      ref={streetInvoiceRef}
+                      disabled={sameAddress}
+                      placeholder='Masukkan alamat lengkap pengiriman invoice'
+                      type='text'
+                      value={formPengiriman.streetInvoice}
+                      className='form-input'
+                      onChange={handleInputChange}
+                    />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errorsPengiriman.streetInvoice}
+                      </div>
+                    )}
+                  </div>
+                  <div className='sub-alamat flex flex-row w-full gap-3'>
+                    <div
+                      className='w-3/5'
+                      ref={stateInvoiceRef}
+                      aria-label='stateInvoice'
+                    >
+                      <Controller
+                        name='stateInvoice'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={states}
+                            disabled={sameAddress}
+                            placeholder='Provinsi'
+                          />
+                        )}
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errorsPengiriman.streetInvoice}
+                          {errorsPengiriman.stateInvoice}
                         </div>
                       )}
                     </div>
-                    <div className='sub-alamat flex flex-row w-full gap-3'>
-                      <div
-                        className='w-3/5'
-                        ref={stateInvoiceRef}
-                        aria-label='stateInvoice'
-                      >
-                        <Controller
-                          name='stateInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={states}
-                              placeholder='Provinsi'
-                            />
-                          )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.stateInvoice}
-                          </div>
-                        )}
-                      </div>
-                      <div
-                        className='w-2/5'
-                        ref={cityInvoiceRef}
-                        aria-label='cityInvoice'
-                      >
-                        <Controller
-                          name='cityInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={cities}
-                              disabled={!watchState}
-                              placeholder='Kota'
-                            />
-                          )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.cityInvoice}
-                          </div>
+                    <div
+                      className='w-2/5'
+                      ref={cityInvoiceRef}
+                      aria-label='cityInvoice'
+                    >
+                      <Controller
+                        name='cityInvoice'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={cities}
+                            disabled={!watchState || sameAddress}
+                            placeholder='Kota'
+                          />
                         )}
-                      </div>
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errorsPengiriman.cityInvoice}
+                        </div>
+                      )}
                     </div>
-                  </>
-                )}
+                  </div>
+                </>
               </div>
 
               <div className='flex flex-col gap-2  justify-between items-start'>
@@ -1277,73 +1333,21 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
-                    Pilih jika bisnis anda memiliki jadwal penukaran invoice
+                    Isi jika bisnis anda memiliki jadwal penukaran invoice
                   </span>
                 )}
                 <div className='w-full flex gap-2 flex-col'>
-                  <div className='flex gap-2 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={everyWeekday}
-                      onChange={handleEveryWeekday}
-                    >
-                      Setiap Minggu dihari
-                    </Checkbox>
-                    <input
-                      id='everyWeekdayInput'
-                      aria-label='everyWeekdayInput'
-                      name='everyWeekdayInput'
-                      ref={everyWeekdayInputRef}
-                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                      type='text'
-                      value={formPengiriman.everyWeekdayInput}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-2 w-full flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={everyWeek}
-                      onChange={handleEveryWeek}
-                    >
-                      Setiap Bulan di minggu ke
-                    </Checkbox>
-                    <input
-                      id='everyWeekInput'
-                      aria-label='everyWeekInput'
-                      name='everyWeekInput'
-                      ref={everyWeekInputRef}
-                      placeholder='Format: Minggu 1 & Minggu 2'
-                      type='text'
-                      value={formPengiriman.everyWeekInput}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-2 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={tukarInvoice}
-                      onChange={handleTukarInvoice}
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='tukarInvoiceInput'
-                      name='tukarInvoiceInput'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      value={formPengiriman.tukarInvoiceInput}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                  <textarea
+                    id='tukarInvoiceInput'
+                    name='tukarInvoiceInput'
+                    placeholder='Masukkan jadwal penukaran invoice'
+                    type='textarea'
+                    value={formPengiriman.tukarInvoiceInput}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                 </div>
                 <div className='w-2/5'></div>
               </div>
@@ -1355,75 +1359,29 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
-                    Pilih jika bisnis anda memiliki jadwal pembayaran
+                    Isi jika bisnis anda memiliki jadwal pembayaran
                   </span>
                 )}
                 <div className='w-full flex gap-2 flex-col'>
-                  <div className='flex gap-2 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={everyWeekdayPembayaran}
-                      onChange={handleEveryWeekdayPembayaran}
-                    >
-                      Setiap Minggu dihari
-                    </Checkbox>
-                    <input
-                      id='everyWeekdayInputPembayaran'
-                      name='everyWeekdayInputPembayaran'
-                      placeholder='Format: Senin, Selasa, Rabu, Kamis, Jumat, Sabtu, Minggu'
-                      type='text'
-                      value={formPengiriman.everyWeekdayInputPembayaran}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-2 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={everyWeekPembayaran}
-                      onChange={handleEveryWeekPembayaran}
-                    >
-                      Setiap Bulan di minggu ke
-                    </Checkbox>
-                    <input
-                      id='everyWeekInputPembayaran'
-                      name='everyWeekInputPembayaran'
-                      placeholder='Format: Minggu 1 & Minggu 2'
-                      type='text'
-                      value={formPengiriman.everyWeekInputPembayaran}
-                      className='form-input'
-                      onChange={handleInputChange}
-                    />
-                  </div>
-                  <div className='flex gap-2 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      isChecked={tukarInvoicePembayaran}
-                      onChange={handleTukarInvoicePembayaran}
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='tukarInvoiceInputPembayaran'
-                      name='tukarInvoiceInputPembayaran'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      value={formPengiriman.tukarInvoiceInputPembayaran}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                  <textarea
+                    id='tukarInvoiceInputPembayaran'
+                    name='tukarInvoiceInputPembayaran'
+                    placeholder='Masukkan jadwal pembayaran'
+                    type='textarea'
+                    value={formPengiriman.tukarInvoiceInputPembayaran}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                 </div>
               </div>
 
               <div className='flex flex-col gap-2  justify-between items-start'>
                 <label className='form-label   text-wrap'>
-                  Dokumen saat Pengiriman Barang
+                  Apakah ada dokumen tanda terima yang diberikan pada saat
+                  pengiriman barang?{' '}
+                  <span className=' opacity-60'>(Opsional)</span>
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
@@ -1472,30 +1430,36 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
 
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      key='4'
-                      isChecked={isChecked(4)}
-                      onChange={() => handleCheckboxChange(4)}
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='dokumenPengirimanInput'
-                      aria-label='dokumenPengirimanInput'
-                      name='dokumenPengirimanInput'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      ref={dokumenPengirimanInputRef}
-                      value={formPengiriman.dokumenPengirimanInput}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                  {chekValid && (
+                    <div className='text-caption-2 text-danger-500 mt-1'>
+                      {errorsPengiriman.dokumenPengiriman}
+                    </div>
+                  )}
+                </div>
+              </div>
+              <div className='flex flex-col gap-2  justify-between items-start'>
+                <label className='form-label   text-wrap'>
+                  Dokumen saat Pengiriman Barang
+                </label>
+                {!isKonfirmasi && (
+                  <span className='text-xs opacity-60'>
+                    Dokumen lampiran saat pengiriman barang
+                  </span>
+                )}
+                <div className='flex gap-3 flex-col w-full'>
+                  <textarea
+                    id='dokumenPengirimanInput'
+                    aria-label='dokumenPengirimanInput'
+                    name='dokumenPengirimanInput'
+                    placeholder='isi manual dokumen yang anda mau'
+                    type='textarea'
+                    ref={dokumenPengirimanInputRef}
+                    value={formPengiriman.dokumenPengirimanInput}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.dokumenPengiriman}
@@ -1507,97 +1471,25 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               <div className='flex flex-col gap-2  justify-between items-start'>
                 <label className='form-label  text-wrap'>
                   Dokumen yang dilampirkan saat Pengiriman Invoice
+                  <span className=' opacity-60'>(Opsional)</span>
                 </label>
                 <span className='text-xs opacity-60'>
-                  Pilih dokumen lampiran saat pengiriman invoice
+                  Dokumen lampiran saat pengiriman invoice
                 </span>
-                <div
-                  className='w-full flex gap-2 flex-col'
-                  ref={dokumenPengirimanInvoiceRef}
-                  aria-label='dokumenPengirimanInvoiceInput'
-                >
-                  <Checkbox
-                    size='sm'
-                    colorScheme='red'
-                    key='0'
-                    isChecked={isCheckedInvoice(0)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(0)
-                    }
-                  >
-                    Invoice Pembelian
-                  </Checkbox>
-                  <Checkbox
-                    size='sm'
-                    colorScheme='red'
-                    key='1'
-                    isChecked={isCheckedInvoice(1)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(1)
-                    }
-                  >
-                    Surat Jalan
-                  </Checkbox>
-                  <Checkbox
-                    size='sm'
-                    colorScheme='red'
-                    key='2'
-                    isChecked={isCheckedInvoice(2)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(2)
-                    }
-                  >
-                    Berita Acara Serah Terima (BAST)
-                  </Checkbox>
-                  <Checkbox
-                    size='sm'
-                    colorScheme='red'
-                    key='3'
-                    isChecked={isCheckedInvoice(3)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(3)
-                    }
-                  >
-                    Faktur Pajak
-                  </Checkbox>
-                  <Checkbox
-                    size='sm'
-                    colorScheme='red'
-                    key='4'
-                    isChecked={isCheckedInvoice(4)}
-                    onChange={() =>
-                      handleCheckboxChangeDokumenPengirimanInvoice(4)
-                    }
-                  >
-                    Good Receipt (GR)
-                  </Checkbox>
-
-                  <div className='flex gap-3 flex-col'>
-                    <Checkbox
-                      size='sm'
-                      colorScheme='red'
-                      key='5'
-                      isChecked={isCheckedInvoice(5)}
-                      onChange={() =>
-                        handleCheckboxChangeDokumenPengirimanInvoice(5)
-                      }
-                    >
-                      Lainnya
-                    </Checkbox>
-                    <textarea
-                      id='dokumenPengirimanInvoiceInput'
-                      aria-label='dokumenPengirimanInvoiceInput'
-                      name='dokumenPengirimanInvoiceInput'
-                      placeholder='isi manual dokumen yang anda mau'
-                      type='textarea'
-                      ref={dokumenPengirimanInvoiceInputRef}
-                      value={formPengiriman.dokumenPengirimanInvoiceInput}
-                      className='form-input'
-                      rows={4}
-                      cols={40}
-                      onChange={handleInputChange}
-                    />
-                  </div>
+                <div className='flex gap-3 flex-col w-full'>
+                  <textarea
+                    id='dokumenPengirimanInvoice'
+                    aria-label='dokumenPengirimanInvoice'
+                    name='dokumenPengirimanInvoice'
+                    placeholder='isi manual dokumen yang anda mau'
+                    type='textarea'
+                    ref={dokumenPengirimanInvoiceRef}
+                    value={formPengiriman.dokumenPengirimanInvoice}
+                    className='form-input'
+                    rows={4}
+                    cols={40}
+                    onChange={handleInputChange}
+                  />
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.dokumenInvoicePengiriman}
-- 
cgit v1.2.3


From f2451beed670dc697aa2026b2df6ad1ad1e90da2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 9 Dec 2024 15:00:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 3 ---
 1 file changed, 3 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 0352b54f..d32fa226 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -391,7 +391,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
   useEffect(() => {
     if (sameAddressStreet) {
-      console.log('form.state', form);
       updateFormPengiriman('streetPengiriman', form.street);
       updateFormPengiriman('statePengiriman', form.state);
       setValue('statePengiriman', parseInt(form.state));
@@ -548,8 +547,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     loadIndustries();
   }, [formPengiriman.zipPengiriman]);
 
-  console.log('formPengiriman', formPengiriman);
-  console.log('errorsPengiriman', errorsPengiriman);
 
   return (
     <>
-- 
cgit v1.2.3


From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Dec 2024 11:51:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 104 +++++++++++++++++------
 1 file changed, 78 insertions(+), 26 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index d32fa226..000f209c 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -23,6 +23,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const [states, setState] = useState([]);
   const [cities, setCities] = useState([]);
+  const [citiesInvoice, setCitiesInvoice] = useState([]);
   const [sameAddress, setSameAddress] = useState(false);
   const [sameAddressStreet, setSameAddressStreet] = useState(false);
   const [everyWeekday, setEveryWeekday] = useState(false);
@@ -90,7 +91,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
   useEffect(() => {
     const loadState = async () => {
-      let dataState = await stateApi();
+      let dataState = await stateApi({ tempo: true });
       dataState = dataState.map((state) => ({
         value: state.id,
         label: state.name,
@@ -125,6 +126,33 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       validatePengiriman();
     }
   }, [watchCity]);
+
+  const watchStateInvoice = watch('stateInvoice');
+  useEffect(() => {
+    // updateFormPengiriman('cityPengiriman', '');
+    if (watchStateInvoice) {
+      updateFormPengiriman('stateInvoice', `${watchStateInvoice}`);
+      validatePengiriman();
+      const loadCities = async () => {
+        let dataCities = await cityApi({ stateId: watchStateInvoice });
+        dataCities = dataCities.map((city) => ({
+          value: city.id,
+          label: city.name,
+        }));
+        setCitiesInvoice(dataCities);
+      };
+      loadCities();
+    }
+  }, [watchStateInvoice]);
+
+  const watchCityInvoice = watch('cityInvoice');
+  useEffect(() => {
+    if (watchCityInvoice) {
+      updateFormPengiriman('cityInvoice', `${watchCityInvoice}`);
+      validatePengiriman();
+    }
+  }, [watchCityInvoice]);
+
   const handleInputChange = (event) => {
     const { name, value } = event.target;
     updateFormPengiriman(name, value);
@@ -171,23 +199,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     setTukarInvoicePembayaran(!tukarInvoicePembayaran);
   };
 
-  // useEffect(() => {
-  //   updateFormPengiriman('everyWeekday', everyWeekday);
-  //   updateFormPengiriman('everyWeek', everyWeek);
-  //   updateFormPengiriman('tukarInvoice', tukarInvoice);
-  //   updateFormPengiriman('everyWeekdayPembayaran', everyWeekdayPembayaran);
-  //   updateFormPengiriman('everyWeekPembayaran', everyWeekPembayaran);
-  //   updateFormPengiriman('tukarInvoicePembayaran', tukarInvoicePembayaran);
-  //   validatePengiriman();
-  // }, [
-  //   everyWeekday,
-  //   everyWeek,
-  //   tukarInvoice,
-  //   everyWeekdayPembayaran,
-  //   everyWeekPembayaran,
-  //   tukarInvoicePembayaran,
-  // ]);
-
   const isFormValid = useMemo(
     () => Object.keys(errorsPengiriman).length === 0,
     [errorsPengiriman]
@@ -306,6 +317,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   useEffect(() => {
     if (formPengiriman.isSameAddrees == 'true') {
       setSameAddress(true);
+    } else {
+      setSameAddress(false);
     }
   }, [formPengiriman.isSameAddrees]);
 
@@ -371,6 +384,29 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     formPengiriman.statePengiriman,
     formPengiriman.cityPengiriman,
   ]);
+
+  useEffect(() => {
+    if (sameAddress) {
+      updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
+      updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
+      setValue('stateInvoice', parseInt(formPengiriman.statePengiriman));
+      updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
+      setValue('cityInvoice', parseInt(formPengiriman.cityPengiriman));
+      updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+    } else {
+      // updateFormPengiriman('stateInvoice', formPengiriman.stateInvoice);
+      // setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
+      // updateFormPengiriman('cityInvoice', formPengiriman.cityInvoice);
+      // setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
+    }
+    validatePengiriman();
+  }, [
+    sameAddress,
+    formPengiriman.streetPengiriman,
+    formPengiriman.statePengiriman,
+    formPengiriman.cityPengiriman,
+  ]);
+
   useEffect(() => {
     if (formPengiriman.sameAddressStreet?.toLowerCase().includes('true')) {
       setSameAddressStreet(true);
@@ -388,6 +424,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       setValue('cityPengiriman', parseInt(formPengiriman.cityPengiriman));
     }
   }, [formPengiriman.cityPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.stateInvoice) {
+      setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
+    }
+  }, [formPengiriman.stateInvoice]);
+  useEffect(() => {
+    if (formPengiriman.cityInvoice) {
+      setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
+    }
+  }, [formPengiriman.cityInvoice]);
 
   useEffect(() => {
     if (sameAddressStreet) {
@@ -483,11 +529,19 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   //   cachedData?.tukarInvoicePembayaran,
   // ]);
   const handleChangeSameAddress = () => {
-    setSameAddress(!sameAddress);
+    // setSameAddress(!sameAddress);
+    // if (sameAddress) {
+    //   console.log('sameAddress adalah', sameAddress);
+    //   updateFormPengiriman('sameAddress', `true`);
+    // } else {
+    //   console.log('sameAddress merupakan', sameAddress);
+    // }
+    updateFormPengiriman('isSameAddrees', `${!sameAddress}`);
+    validate();
   };
   const handleChangeSameAddressStreet = () => {
     // updateFormPengiriman('sameAddressStreet', `${!sameAddressStreet}`);
-    setSameAddressStreet(!sameAddressStreet);
+    // setSameAddressStreet(!sameAddressStreet);
     if (sameAddressStreet == false) {
       updateFormPengiriman('streetPengiriman', '');
       updateFormPengiriman('statePengiriman', '');
@@ -496,9 +550,9 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       setValue('streetPengiriman', '');
       setValue('statePengiriman', '');
       setValue('cityPengiriman', '');
-      updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
-      validate();
     }
+    updateFormPengiriman('isSameAddreesStreet', `${!sameAddressStreet}`);
+    validate();
   };
 
   useEffect(() => {
@@ -546,8 +600,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
 
     loadIndustries();
   }, [formPengiriman.zipPengiriman]);
-
-
   return (
     <>
       {isDesktop && (
@@ -829,8 +881,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           render={(props) => (
                             <HookFormSelect
                               {...props}
-                              options={cities}
-                              disabled={!watchState || sameAddress}
+                              options={citiesInvoice}
+                              disabled={!watchStateInvoice || sameAddress}
                               placeholder='Kota'
                             />
                           )}
-- 
cgit v1.2.3


From 915dc67e1ce31eab1f2415cc8df95cebb75a137d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 13 Dec 2024 14:18:03 +0700
Subject: <iman>update pengajuan tempo request

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 733 ++++++++++++++++++-----
 1 file changed, 591 insertions(+), 142 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 000f209c..cfc8aeb5 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -4,6 +4,8 @@ import HookFormSelect from '@/core/components/elements/Select/HookFormSelect';
 import odooApi from '~/libs/odooApi';
 import stateApi from '@/lib/address/api/stateApi.js';
 import cityApi from '@/lib/address/api/cityApi';
+import districtApi from '@/lib/address/api/districtApi';
+import subDistrictApi from '@/lib/address/api/subDistrictApi';
 import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react';
 import {
   usePengajuanTempoStorePengiriman,
@@ -20,10 +22,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman,
     updateFormPengiriman,
   } = usePengajuanTempoStorePengiriman();
-  const { form, errors, validate, updateForm } = usePengajuanTempoStore();
+  const { form } = usePengajuanTempoStore();
   const [states, setState] = useState([]);
   const [cities, setCities] = useState([]);
+  const [districts, setDistricts] = useState([]);
+  const [subDistricts, setSubDistricts] = useState([]);
+  const [zips, setZips] = useState([]);
   const [citiesInvoice, setCitiesInvoice] = useState([]);
+  const [districtsInvoice, setDistrictsInvoice] = useState([]);
+  const [subDistrictsInvoice, setSubDistrictsInvoice] = useState([]);
+  const [zipsInvoice, setZipsInvoice] = useState([]);
   const [sameAddress, setSameAddress] = useState(false);
   const [sameAddressStreet, setSameAddressStreet] = useState(false);
   const [everyWeekday, setEveryWeekday] = useState(false);
@@ -104,6 +112,10 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const watchState = watch('statePengiriman');
   useEffect(() => {
     // updateFormPengiriman('cityPengiriman', '');
+    // setValue('cityPengiriman', '');
+    // setValue('districtPengiriman', '');
+    // setValue('subDistrictPengiriman', '');
+    // setValue('zipPengiriman', '');
     if (watchState) {
       updateFormPengiriman('statePengiriman', `${watchState}`);
       validatePengiriman();
@@ -120,16 +132,86 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   }, [watchState]);
 
   const watchCity = watch('cityPengiriman');
+
   useEffect(() => {
     if (watchCity) {
       updateFormPengiriman('cityPengiriman', `${watchCity}`);
       validatePengiriman();
+      const loadDistricts = async () => {
+        let dataDistricts = await districtApi({ cityId: watchCity });
+        dataDistricts = dataDistricts.map((district) => ({
+          value: district.id,
+          label: district.name,
+        }));
+        setDistricts(dataDistricts);
+      };
+      loadDistricts();
+    }
+  }, [watchCity, setValue]);
+
+  const watchDistrict = watch('districtPengiriman');
+  useEffect(() => {
+    // setValue('subDistrictPengiriman', '');
+    if (watchDistrict) {
+      updateFormPengiriman('districtPengiriman', `${watchDistrict}`);
+      validatePengiriman();
+      const loadSubDistricts = async () => {
+        let dataSubDistricts = await subDistrictApi({
+          districtId: watchDistrict,
+        });
+        dataSubDistricts = dataSubDistricts.map((district) => ({
+          value: district.id,
+          label: district.name,
+        }));
+        setSubDistricts(dataSubDistricts);
+      };
+      loadSubDistricts();
+    }
+  }, [watchDistrict, setValue]);
+
+  const watchsubDistrict = watch('subDistrictPengiriman');
+
+  useEffect(() => {
+    let kelurahan = '';
+
+    if (watchsubDistrict) {
+      updateFormPengiriman('subDistrictPengiriman', `${watchsubDistrict}`);
+      validatePengiriman();
+      for (const data in subDistricts) {
+        if (subDistricts[data].value == watchsubDistrict) {
+          kelurahan = subDistricts[data].label.toLowerCase();
+        }
+      }
+      const loadZip = async () => {
+        const response = await fetch(
+          `https://alamat.thecloudalert.com/api/cari/index/?keyword=${kelurahan}`
+        );
+
+        const result = await response.json();
+        const dataZips = result.result.map((zip) => ({
+          value: parseInt(zip.kodepos),
+          label: zip.kodepos,
+        }));
+        setZips(dataZips);
+      };
+      loadZip();
     }
-  }, [watchCity]);
+  }, [watchsubDistrict, setValue, subDistricts]);
+
+  const watchZip = watch('zipPengiriman');
+  useEffect(() => {
+    if (watchZip) {
+      updateFormPengiriman('zipPengiriman', `${watchZip}`);
+      validatePengiriman();
+    }
+  }, [watchZip, setValue]);
 
   const watchStateInvoice = watch('stateInvoice');
   useEffect(() => {
-    // updateFormPengiriman('cityPengiriman', '');
+    // setValue('cityInvoice', '');
+    // setValue('districtInvoice', '');
+    // setValue('subDistrictInvoice', '');
+    // setValue('zipInvoice', '');
     if (watchStateInvoice) {
       updateFormPengiriman('stateInvoice', `${watchStateInvoice}`);
       validatePengiriman();
@@ -150,9 +232,75 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     if (watchCityInvoice) {
       updateFormPengiriman('cityInvoice', `${watchCityInvoice}`);
       validatePengiriman();
+      const loadDistricts = async () => {
+        let dataDistricts = await districtApi({ cityId: watchCityInvoice });
+        dataDistricts = dataDistricts.map((district) => ({
+          value: district.id,
+          label: district.name,
+        }));
+        setDistrictsInvoice(dataDistricts);
+      };
+      loadDistricts();
     }
   }, [watchCityInvoice]);
 
+  const watchDistrictInvoice = watch('districtInvoice');
+  useEffect(() => {
+    // setValue('subDistrictInvoice', '');
+    if (watchDistrictInvoice) {
+      updateFormPengiriman('districtInvoice', `${watchDistrictInvoice}`);
+      validatePengiriman();
+      const loadSubDistricts = async () => {
+        let dataSubDistricts = await subDistrictApi({
+          districtId: watchDistrictInvoice,
+        });
+        dataSubDistricts = dataSubDistricts.map((district) => ({
+          value: district.id,
+          label: district.name,
+        }));
+        setSubDistrictsInvoice(dataSubDistricts);
+      };
+      loadSubDistricts();
+    }
+  }, [watchDistrictInvoice, setValue]);
+
+  const watchsubDistrictInvoice = watch('subDistrictInvoice');
+
+  useEffect(() => {
+    let kelurahan = '';
+
+    if (watchsubDistrictInvoice) {
+      updateFormPengiriman('subDistrictInvoice', `${watchsubDistrictInvoice}`);
+      validatePengiriman();
+      for (const data in subDistrictsInvoice) {
+        if (subDistrictsInvoice[data].value == watchsubDistrictInvoice) {
+          kelurahan = subDistrictsInvoice[data].label.toLowerCase();
+        }
+      }
+      const loadZip = async () => {
+        const response = await fetch(
+          `https://alamat.thecloudalert.com/api/cari/index/?keyword=${kelurahan}`
+        );
+
+        const result = await response.json();
+        const dataZips = result.result.map((zip) => ({
+          value: parseInt(zip.kodepos),
+          label: zip.kodepos,
+        }));
+        setZipsInvoice(dataZips);
+      };
+      loadZip();
+    }
+  }, [watchsubDistrictInvoice, setValue, subDistrictsInvoice]);
+
+  const watchZipInvoice = watch('zipInvoice');
+  useEffect(() => {
+    if (watchZipInvoice) {
+      updateFormPengiriman('zipInvoice', `${watchZipInvoice}`);
+      validatePengiriman();
+    }
+  }, [watchZipInvoice, setValue]);
+
   const handleInputChange = (event) => {
     const { name, value } = event.target;
     updateFormPengiriman(name, value);
@@ -208,11 +356,16 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const streetPengirimanRef = useRef(null);
   const statePengirimanRef = useRef(null);
   const cityPengirimanRef = useRef(null);
+  const districtPengirimanRef = useRef(null);
+  const subDistrictPengirimanRef = useRef(null);
   const zipRef = useRef(null);
   const invoicePicRef = useRef(null);
   const streetInvoiceRef = useRef(null);
   const stateInvoiceRef = useRef(null);
   const cityInvoiceRef = useRef(null);
+  const districtInvoiceRef = useRef(null);
+  const subDistrictInvoiceRef = useRef(null);
+  const zipInvoiceRef = useRef(null);
   const everyWeekdayInputRef = useRef(null);
   const everyWeekInputRef = useRef(null);
   const dokumenPengirimanRef = useRef(null);
@@ -243,6 +396,20 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
           cityPengirimanRef.current.scrollIntoView(options);
           return;
         }
+        if (
+          errorsPengiriman.districtsPengiriman &&
+          districtPengirimanRef.current
+        ) {
+          districtPengirimanRef.current.scrollIntoView(options);
+          return;
+        }
+        if (
+          errorsPengiriman.subDistrictsPengiriman &&
+          subDistrictPengirimanRef.current
+        ) {
+          subDistrictPengirimanRef.current.scrollIntoView(options);
+          return;
+        }
         if (errorsPengiriman.zip && zipRef.current) {
           zipRef.current.scrollIntoView(options);
           return;
@@ -263,6 +430,21 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
           cityInvoiceRef.current.scrollIntoView(options);
           return;
         }
+        if (errorsPengiriman.districtsInvoice && districtInvoiceRef.current) {
+          districtInvoiceRef.current.scrollIntoView(options);
+          return;
+        }
+        if (
+          errorsPengiriman.subDistrictsInvoice &&
+          subDistrictInvoiceRef.current
+        ) {
+          subDistrictInvoiceRef.current.scrollIntoView(options);
+          return;
+        }
+        if (errorsPengiriman.zipInvoice && zipInvoiceRef.current) {
+          zipInvoiceRef.current.scrollIntoView(options);
+          return;
+        }
         if (
           errorsPengiriman.everyWeekdayInput &&
           everyWeekdayInputRef.current
@@ -312,6 +494,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   useEffect(() => {
     if (formPengiriman.isSameAddreesStreet == 'true') {
       setSameAddressStreet(true);
+    } else {
+      setSameAddressStreet(false);
     }
   }, [formPengiriman.isSameAddreesStreet]);
   useEffect(() => {
@@ -361,14 +545,53 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   //   }
   //   validatePengiriman();
   // }, [formPengiriman.isSameAddrees, formPengiriman.isSameAddreesStreet]);
+
+  useEffect(() => {
+    if (sameAddressStreet) {
+      updateFormPengiriman('streetPengiriman', form.street);
+      updateFormPengiriman('statePengiriman', form.state);
+      setValue('statePengiriman', parseInt(form.state));
+      updateFormPengiriman('cityPengiriman', form.city);
+      setValue('cityPengiriman', parseInt(form.city));
+      updateFormPengiriman('districtPengiriman', form.district);
+      setValue('districtPengiriman', parseInt(form.district));
+      updateFormPengiriman('subDistrictPengiriman', form.subDistrict);
+      setValue('subDistrictPengiriman', parseInt(form.subDistrict));
+      updateFormPengiriman('zipPengiriman', form.zip);
+      setValue('zipPengiriman', parseInt(form.zip));
+    }
+    // else {
+    //   updateFormPengiriman('streetPengiriman', '');
+    //   updateFormPengiriman('statePengiriman', '');
+    //   updateFormPengiriman('cityPengiriman', '');
+    //   updateFormPengiriman('zipPengiriman', '');
+    //   setValue('streetPengiriman', '');
+    //   setValue('statePengiriman', '');
+    //   setValue('cityPengiriman', '');
+    // }
+    validatePengiriman();
+  }, [
+    sameAddressStreet,
+    form.state,
+    form.city,
+    form.district,
+    form.subDistrict,
+    form.zip,
+  ]);
+
   useEffect(() => {
     if (sameAddress) {
-      updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
-      updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
-      setValue('stateInvoice', parseInt(formPengiriman.statePengiriman));
-      updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
-      setValue('cityInvoice', parseInt(formPengiriman.cityPengiriman));
-      updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+      updateFormPengiriman('streetInvoice', form.street);
+      updateFormPengiriman('stateInvoice', form.state);
+      setValue('stateInvoice', parseInt(form.state));
+      updateFormPengiriman('cityInvoice', form.city);
+      setValue('cityInvoice', parseInt(form.city));
+      updateFormPengiriman('districtInvoice', form.district);
+      setValue('districtInvoice', parseInt(form.district));
+      updateFormPengiriman('subDistrictInvoice', form.subDistrict);
+      setValue('subDistrictInvoice', parseInt(form.subDistrict));
+      updateFormPengiriman('zipInvoice', form.zip);
+      setValue('zipInvoice', parseInt(form.zip));
     } else {
       // updateFormPengiriman('streetInvoice', '');
       // updateFormPengiriman('stateInvoice', '');
@@ -380,40 +603,44 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     validatePengiriman();
   }, [
     sameAddress,
-    formPengiriman.streetPengiriman,
-    formPengiriman.statePengiriman,
-    formPengiriman.cityPengiriman,
+    form.street,
+    form.state,
+    form.city,
+    form.district,
+    form.subDistrict,
   ]);
 
-  useEffect(() => {
-    if (sameAddress) {
-      updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
-      updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
-      setValue('stateInvoice', parseInt(formPengiriman.statePengiriman));
-      updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
-      setValue('cityInvoice', parseInt(formPengiriman.cityPengiriman));
-      updateFormPengiriman('isSameAddrees', `${sameAddress}`);
-    } else {
-      // updateFormPengiriman('stateInvoice', formPengiriman.stateInvoice);
-      // setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
-      // updateFormPengiriman('cityInvoice', formPengiriman.cityInvoice);
-      // setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
-    }
-    validatePengiriman();
-  }, [
-    sameAddress,
-    formPengiriman.streetPengiriman,
-    formPengiriman.statePengiriman,
-    formPengiriman.cityPengiriman,
-  ]);
+  // useEffect(() => {
+  //   if (sameAddress) {
+  //     updateFormPengiriman('streetInvoice', formPengiriman.streetPengiriman);
+  //     updateFormPengiriman('stateInvoice', formPengiriman.statePengiriman);
+  //     setValue('stateInvoice', parseInt(formPengiriman.statePengiriman));
+  //     updateFormPengiriman('cityInvoice', formPengiriman.cityPengiriman);
+  //     setValue('cityInvoice', parseInt(formPengiriman.cityPengiriman));
+
+  //     updateFormPengiriman('isSameAddrees', `${sameAddress}`);
+  //   } else {
+  //     // updateFormPengiriman('stateInvoice', formPengiriman.stateInvoice);
+  //     // setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
+  //     // updateFormPengiriman('cityInvoice', formPengiriman.cityInvoice);
+  //     // setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
+  //   }
+  //   validatePengiriman();
+  // }, [
+  //   sameAddress,
+  //   formPengiriman.streetPengiriman,
+  //   formPengiriman.statePengiriman,
+  //   formPengiriman.cityPengiriman,
+  // ]);
+
+  // useEffect(() => {
+  //   if (formPengiriman.sameAddressStreet?.toLowerCase().includes('true')) {
+  //     setSameAddressStreet(true);
+  //   } else {
+  //     setSameAddressStreet(false);
+  //   }
+  // }, [formPengiriman.sameAddressStreet]);
 
-  useEffect(() => {
-    if (formPengiriman.sameAddressStreet?.toLowerCase().includes('true')) {
-      setSameAddressStreet(true);
-    } else {
-      setSameAddressStreet(false);
-    }
-  }, [formPengiriman.sameAddressStreet]);
   useEffect(() => {
     if (formPengiriman.statePengiriman) {
       setValue('statePengiriman', parseInt(formPengiriman.statePengiriman));
@@ -424,6 +651,27 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       setValue('cityPengiriman', parseInt(formPengiriman.cityPengiriman));
     }
   }, [formPengiriman.cityPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.districtPengiriman) {
+      setValue(
+        'districtPengiriman',
+        parseInt(formPengiriman.districtPengiriman)
+      );
+    }
+  }, [formPengiriman.districtPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.subDistrictPengiriman) {
+      setValue(
+        'subDistrictPengiriman',
+        parseInt(formPengiriman.subDistrictPengiriman)
+      );
+    }
+  }, [formPengiriman.subDistrictPengiriman]);
+  useEffect(() => {
+    if (formPengiriman.zipPengiriman) {
+      setValue('zipPengiriman', parseInt(formPengiriman.zipPengiriman));
+    }
+  }, [formPengiriman.zipPengiriman]);
   useEffect(() => {
     if (formPengiriman.stateInvoice) {
       setValue('stateInvoice', parseInt(formPengiriman.stateInvoice));
@@ -434,28 +682,24 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
       setValue('cityInvoice', parseInt(formPengiriman.cityInvoice));
     }
   }, [formPengiriman.cityInvoice]);
-
   useEffect(() => {
-    if (sameAddressStreet) {
-      updateFormPengiriman('streetPengiriman', form.street);
-      updateFormPengiriman('statePengiriman', form.state);
-      setValue('statePengiriman', parseInt(form.state));
-      updateFormPengiriman('cityPengiriman', form.city);
-      setValue('cityPengiriman', parseInt(form.city));
-      updateFormPengiriman('zipPengiriman', form.zip);
-      updateFormPengiriman('isSameAddreesStreet', `${sameAddressStreet}`);
+    if (formPengiriman.districtInvoice) {
+      setValue('districtInvoice', parseInt(formPengiriman.districtInvoice));
     }
-    // else {
-    //   updateFormPengiriman('streetPengiriman', '');
-    //   updateFormPengiriman('statePengiriman', '');
-    //   updateFormPengiriman('cityPengiriman', '');
-    //   updateFormPengiriman('zipPengiriman', '');
-    //   setValue('streetPengiriman', '');
-    //   setValue('statePengiriman', '');
-    //   setValue('cityPengiriman', '');
-    // }
-    validatePengiriman();
-  }, [sameAddressStreet]);
+  }, [formPengiriman.districtInvoice]);
+  useEffect(() => {
+    if (formPengiriman.subDistrictInvoice) {
+      setValue(
+        'subDistrictInvoice',
+        parseInt(formPengiriman.subDistrictInvoice)
+      );
+    }
+  }, [formPengiriman.subDistrictInvoice]);
+  useEffect(() => {
+    if (formPengiriman.zipInvoice) {
+      setValue('zipInvoice', parseInt(formPengiriman.zipInvoice));
+    }
+  }, [formPengiriman.zipInvoice]);
 
   const getFromLocalStorage = (key) => {
     const itemStr = localStorage.getItem(key);
@@ -531,75 +775,28 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const handleChangeSameAddress = () => {
     // setSameAddress(!sameAddress);
     // if (sameAddress) {
-    //   console.log('sameAddress adalah', sameAddress);
     //   updateFormPengiriman('sameAddress', `true`);
     // } else {
-    //   console.log('sameAddress merupakan', sameAddress);
     // }
     updateFormPengiriman('isSameAddrees', `${!sameAddress}`);
-    validate();
+    validatePengiriman();
   };
   const handleChangeSameAddressStreet = () => {
     // updateFormPengiriman('sameAddressStreet', `${!sameAddressStreet}`);
     // setSameAddressStreet(!sameAddressStreet);
-    if (sameAddressStreet == false) {
-      updateFormPengiriman('streetPengiriman', '');
-      updateFormPengiriman('statePengiriman', '');
-      updateFormPengiriman('cityPengiriman', '');
-      updateFormPengiriman('zipPengiriman', '');
-      setValue('streetPengiriman', '');
-      setValue('statePengiriman', '');
-      setValue('cityPengiriman', '');
-    }
+    // if (sameAddressStreet == false) {
+    //   updateFormPengiriman('streetPengiriman', '');
+    //   updateFormPengiriman('statePengiriman', '');
+    //   updateFormPengiriman('cityPengiriman', '');
+    //   updateFormPengiriman('zipPengiriman', '');
+    //   setValue('streetPengiriman', '');
+    //   setValue('statePengiriman', '');
+    //   setValue('cityPengiriman', '');
+    // }
     updateFormPengiriman('isSameAddreesStreet', `${!sameAddressStreet}`);
-    validate();
+    validatePengiriman();
   };
 
-  useEffect(() => {
-    const options = {
-      behavior: 'smooth',
-      block: 'center',
-    };
-
-    const loadIndustries = async () => {
-      const watchZip = formPengiriman.zipPengiriman?.trim(); // Menghapus spasi berlebih
-
-      // Validasi: hanya eksekusi jika watchZip valid (contoh: minimal 5 karakter)
-      if (watchZip && watchZip.length >= 5) {
-        const loadZip = async () => {
-          try {
-            const response = await fetch(
-              `https://alamat.thecloudalert.com/api/cari/index/?keyword=${watchZip}`
-            );
-
-            const result = await response.json();
-
-            if (!result.result.length > 0) {
-              toast.error('Alamat pos salah');
-              updateFormPengiriman('zipPengiriman', ''); // Reset form.zip jika salah
-              validate(); // Memanggil validasi formulir
-              return false;
-            } else {
-              updateFormPengiriman('zipPengiriman', watchZip);
-              validate();
-              return true; // Jika valid
-            }
-          } catch (error) {
-            toast.error('Terjadi kesalahan saat memeriksa alamat pos.');
-            console.error('Error:', error);
-            return false;
-          }
-        };
-
-        const isValidZip = await loadZip();
-        if (!isValidZip) {
-          zipRef.current.scrollIntoView(options);
-        }
-      }
-    };
-
-    loadIndustries();
-  }, [formPengiriman.zipPengiriman]);
   return (
     <>
       {isDesktop && (
@@ -737,22 +934,62 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           </div>
                         )}
                       </div>
-                      <div className='w-1/3'>
-                        <input
-                          id='zipPengiriman'
-                          aria-label='zipPengiriman'
-                          disabled={sameAddressStreet}
+                      <div className='w-1/3' ref={districtPengirimanRef}>
+                        <Controller
+                          name='districtPengiriman'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={districts}
+                              disabled={
+                                !watchState || !watchCity || sameAddressStreet
+                              }
+                              placeholder='Kelurahan'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errors.subDistrictPengiriman}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3' ref={subDistrictPengirimanRef}>
+                        <Controller
+                          name='subDistrictPengiriman'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={subDistricts}
+                              disabled={!watchDistrict || sameAddressStreet}
+                              placeholder='Kelurahan'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errors.subDistrictPengiriman}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3' ref={zipRef}>
+                        <Controller
                           name='zipPengiriman'
-                          ref={zipRef}
-                          placeholder='Kode Pos'
-                          type='number'
-                          value={formPengiriman.zipPengiriman}
-                          className='form-input'
-                          onChange={handleInputChange}
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={zips}
+                              disabled={!watchsubDistrict || sameAddressStreet}
+                              placeholder='Zip'
+                            />
+                          )}
                         />
                         {chekValid && (
                           <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.zipPengiriman}
+                            {errors.zipPengiriman}
                           </div>
                         )}
                       </div>
@@ -822,7 +1059,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       isChecked={sameAddress}
                       onChange={handleChangeSameAddress}
                     >
-                      Alamat invoice sama dengan alamat pengiriman
+                      Alamat invoice sama dengan alamat bisnis
                     </Checkbox>
                   </div>
 
@@ -893,6 +1130,67 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           </div>
                         )}
                       </div>
+                      <div className='w-1/3' ref={districtInvoiceRef}>
+                        <Controller
+                          name='districtInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={districtsInvoice}
+                              disabled={
+                                !watchStateInvoice ||
+                                !watchCityInvoice ||
+                                sameAddress
+                              }
+                              placeholder='Kecamatan'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errors.districtInvoice}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3' ref={subDistrictInvoiceRef}>
+                        <Controller
+                          name='subDistrictInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={subDistrictsInvoice}
+                              disabled={!watchDistrictInvoice || sameAddress}
+                              placeholder='Kelurahan'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errors.subDistrictsInvoice}
+                          </div>
+                        )}
+                      </div>
+                      <div className='w-1/3' ref={zipInvoiceRef}>
+                        <Controller
+                          name='zipInvoice'
+                          control={control}
+                          render={(props) => (
+                            <HookFormSelect
+                              {...props}
+                              options={zipsInvoice}
+                              disabled={!watchsubDistrictInvoice || sameAddress}
+                              placeholder='Zip'
+                            />
+                          )}
+                        />
+                        {chekValid && (
+                          <div className='text-caption-2 text-danger-500 mt-1'>
+                            {errors.zipInvoice}
+                          </div>
+                        )}
+                      </div>
                     </div>
                   </>
                 </div>
@@ -1002,29 +1300,31 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
 
-                  {/* <div className='flex gap-3 flex-col'>
+                  <div className='flex gap-3 flex-col'>
                     <Checkbox
                       colorScheme='red'
                       key='4'
-                      isChecked={isChecked(4)}
+                      isChecked={
+                        isChecked(4) || formPengiriman.dokumenKirimInput
+                      }
                       onChange={() => handleCheckboxChange(4)}
                     >
                       Lainnya
                     </Checkbox>
                     <textarea
-                      id='dokumenPengirimanInput'
-                      name='dokumenPengirimanInput'
-                      aria-label='dokumenPengirimanInput'
+                      id='dokumenKirimInput'
+                      name='dokumenKirimInput'
+                      aria-label='dokumenKirimInput'
                       placeholder='isi manual dokumen yang anda mau'
                       type='textarea'
                       ref={dokumenPengirimanInputRef}
-                      value={formPengiriman.dokumenPengirimanInput}
+                      value={formPengiriman.dokumenKirimInput}
                       className='form-input'
                       rows={4}
                       cols={40}
                       onChange={handleInputChange}
                     />
-                  </div> */}
+                  </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errorsPengiriman.dokumenPengiriman}
@@ -1036,12 +1336,12 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               <div className='flex flex-row  justify-between items-start'>
                 <div className='w-2/5'>
                   <label className='form-label   text-wrap'>
-                    Dokumen saat Pengiriman Barang{' '}
+                    Dokumen yang dibawa saat pengiriman barang
                     <span className=' opacity-60'>(Opsional)</span>
                   </label>
                   {!isKonfirmasi && (
                     <span className='text-xs opacity-60'>
-                      Dokumen lampiran saat pengiriman barang
+                      Dokumen lampiran yang dibawa saat pengiriman barang
                     </span>
                   )}
                 </div>
@@ -1207,7 +1507,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     )}
                   </div>
                   <div
-                    className='w-1/3'
+                    className='w-3/5'
                     ref={cityPengirimanRef}
                     aria-label='cityPengiriman'
                   >
@@ -1229,7 +1529,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       </div>
                     )}
                   </div>
-                  <div className='w-1/3'>
+                  {/* <div className='w-1/3'>
                     <input
                       id='zipPengiriman'
                       aria-label='zipPengiriman'
@@ -1247,6 +1547,67 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         {errorsPengiriman.zipPengiriman}
                       </div>
                     )}
+                  </div> */}
+                </div>
+                <div className='flex flex-row w-full gap-2'>
+                  <div className='w-1/3' ref={districtPengirimanRef}>
+                    <Controller
+                      name='districtPengiriman'
+                      control={control}
+                      render={(props) => (
+                        <HookFormSelect
+                          {...props}
+                          options={districts}
+                          disabled={
+                            !watchState || !watchCity || sameAddressStreet
+                          }
+                          placeholder='Kelurahan'
+                        />
+                      )}
+                    />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errors.subDistrictPengiriman}
+                      </div>
+                    )}
+                  </div>
+                  <div className='w-1/3' ref={subDistrictPengirimanRef}>
+                    <Controller
+                      name='subDistrictPengiriman'
+                      control={control}
+                      render={(props) => (
+                        <HookFormSelect
+                          {...props}
+                          options={subDistricts}
+                          disabled={!watchDistrict || sameAddressStreet}
+                          placeholder='Kelurahan'
+                        />
+                      )}
+                    />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errors.subDistrictPengiriman}
+                      </div>
+                    )}
+                  </div>
+                  <div className='w-1/3' ref={zipRef}>
+                    <Controller
+                      name='zipPengiriman'
+                      control={control}
+                      render={(props) => (
+                        <HookFormSelect
+                          {...props}
+                          options={zips}
+                          disabled={!watchsubDistrict || sameAddressStreet}
+                          placeholder='Zip'
+                        />
+                      )}
+                    />
+                    {chekValid && (
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                        {errors.zipPengiriman}
+                      </div>
+                    )}
                   </div>
                 </div>
               </div>
@@ -1372,6 +1733,69 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       )}
                     </div>
                   </div>
+                  <div className='sub-alamat flex flex-row w-full gap-3'>
+                    <div className='w-1/3' ref={districtInvoiceRef}>
+                      <Controller
+                        name='districtInvoice'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={districtsInvoice}
+                            disabled={
+                              !watchStateInvoice ||
+                              !watchCityInvoice ||
+                              sameAddress
+                            }
+                            placeholder='Kecamatan'
+                          />
+                        )}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errors.districtInvoice}
+                        </div>
+                      )}
+                    </div>
+                    <div className='w-1/3' ref={subDistrictInvoiceRef}>
+                      <Controller
+                        name='subDistrictInvoice'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={subDistrictsInvoice}
+                            disabled={!watchDistrictInvoice || sameAddress}
+                            placeholder='Kelurahan'
+                          />
+                        )}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errors.subDistrictsInvoice}
+                        </div>
+                      )}
+                    </div>
+                    <div className='w-1/3' ref={zipInvoiceRef}>
+                      <Controller
+                        name='zipInvoice'
+                        control={control}
+                        render={(props) => (
+                          <HookFormSelect
+                            {...props}
+                            options={zipsInvoice}
+                            disabled={!watchsubDistrictInvoice || sameAddress}
+                            placeholder='Zip'
+                          />
+                        )}
+                      />
+                      {chekValid && (
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errors.zipInvoice}
+                        </div>
+                      )}
+                    </div>
+                  </div>
                 </>
               </div>
 
@@ -1478,6 +1902,31 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   >
                     Lembar Penerimaan Barang (LPB)
                   </Checkbox>
+                  <div className='flex gap-3 flex-col'>
+                    <Checkbox
+                      colorScheme='red'
+                      key='4'
+                      isChecked={
+                        isChecked(4) || formPengiriman.dokumenKirimInput
+                      }
+                      onChange={() => handleCheckboxChange(4)}
+                    >
+                      Lainnya
+                    </Checkbox>
+                    <textarea
+                      id='dokumenKirimInput'
+                      name='dokumenKirimInput'
+                      aria-label='dokumenKirimInput'
+                      placeholder='isi manual dokumen yang anda mau'
+                      type='textarea'
+                      ref={dokumenPengirimanInputRef}
+                      value={formPengiriman.dokumenKirimInput}
+                      className='form-input'
+                      rows={4}
+                      cols={40}
+                      onChange={handleInputChange}
+                    />
+                  </div>
 
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-- 
cgit v1.2.3


From 0178a1f88d7d34824562e1413be073c0795a47cf Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 16 Dec 2024 17:42:31 +0700
Subject: <iman> update code

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index cfc8aeb5..497c86a9 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -1937,11 +1937,12 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
               </div>
               <div className='flex flex-col gap-2  justify-between items-start'>
                 <label className='form-label   text-wrap'>
-                  Dokumen saat Pengiriman Barang
+                  Dokumen yang dibawa saat pengiriman barang
+                  <span className=' opacity-60'>(Opsional)</span>
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
-                    Dokumen lampiran saat pengiriman barang
+                    Dokumen lampiran yang dibawa saat pengiriman barang
                   </span>
                 )}
                 <div className='flex gap-3 flex-col w-full'>
-- 
cgit v1.2.3


From aea914d21c16f53a1c28122b9b9a135439443ba6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Dec 2024 11:38:03 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 426 +++++++++++++----------
 1 file changed, 233 insertions(+), 193 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 497c86a9..068cf73c 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -889,109 +889,129 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         </div>
                       )}
                     </div>
-                    <div className='sub-alamat flex flex-row w-full gap-3'>
+                    <div
+                      className={` sub-alamat flex ${
+                        isKonfirmasi ? 'flex-col' : 'flex-row'
+                      } w-full gap-3`}
+                    >
                       <div
-                        className='w-2/5'
-                        ref={statePengirimanRef}
-                        aria-label='statePengiriman'
+                        className={`flex  ${
+                          isKonfirmasi
+                            ? ' flex-row gap-3 w-full'
+                            : 'flex-row gap-3 w-2/5'
+                        }`}
                       >
-                        <Controller
-                          name='statePengiriman'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              disabled={sameAddressStreet}
-                              options={states}
-                              placeholder='Provinsi'
-                            />
+                        <div
+                          className='w-full'
+                          ref={statePengirimanRef}
+                          aria-label='statePengiriman'
+                        >
+                          <Controller
+                            name='statePengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                disabled={sameAddressStreet}
+                                options={states}
+                                placeholder='Provinsi'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.statePengiriman}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.statePengiriman}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={cityPengirimanRef}>
-                        <Controller
-                          name='cityPengiriman'
-                          aria-label='cityPengiriman'
-                          disabled={sameAddressStreet}
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={cities}
-                              disabled={!watchState || sameAddressStreet}
-                              placeholder='Kota'
-                            />
+                        </div>
+                        <div className='w-full' ref={cityPengirimanRef}>
+                          <Controller
+                            name='cityPengiriman'
+                            aria-label='cityPengiriman'
+                            disabled={sameAddressStreet}
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={cities}
+                                disabled={!watchState || sameAddressStreet}
+                                placeholder='Kota'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.cityPengiriman}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.cityPengiriman}
-                          </div>
-                        )}
+                        </div>
                       </div>
-                      <div className='w-1/3' ref={districtPengirimanRef}>
-                        <Controller
-                          name='districtPengiriman'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={districts}
-                              disabled={
-                                !watchState || !watchCity || sameAddressStreet
-                              }
-                              placeholder='Kelurahan'
-                            />
+                      <div
+                        className={`flex-row flex gap-2 justify-between  ${
+                          isKonfirmasi ? 'w-full' : 'w-3/5'
+                        }`}
+                      >
+                        <div className='w-full' ref={districtPengirimanRef}>
+                          <Controller
+                            name='districtPengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={districts}
+                                disabled={
+                                  !watchState || !watchCity || sameAddressStreet
+                                }
+                                placeholder='Kelurahan'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.subDistrictPengiriman}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.subDistrictPengiriman}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={subDistrictPengirimanRef}>
-                        <Controller
-                          name='subDistrictPengiriman'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={subDistricts}
-                              disabled={!watchDistrict || sameAddressStreet}
-                              placeholder='Kelurahan'
-                            />
+                        </div>
+                        <div className='w-full' ref={subDistrictPengirimanRef}>
+                          <Controller
+                            name='subDistrictPengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={subDistricts}
+                                disabled={!watchDistrict || sameAddressStreet}
+                                placeholder='Kelurahan'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.subDistrictPengiriman}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.subDistrictPengiriman}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={zipRef}>
-                        <Controller
-                          name='zipPengiriman'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={zips}
-                              disabled={!watchsubDistrict || sameAddressStreet}
-                              placeholder='Zip'
-                            />
+                        </div>
+                        <div className='w-full' ref={zipRef}>
+                          <Controller
+                            name='zipPengiriman'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={zips}
+                                disabled={
+                                  !watchsubDistrict || sameAddressStreet
+                                }
+                                placeholder='Zip'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.zipPengiriman}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.zipPengiriman}
-                          </div>
-                        )}
+                        </div>
                       </div>
                     </div>
                   </>
@@ -1083,113 +1103,133 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         </div>
                       )}
                     </div>
-                    <div className='sub-alamat flex flex-row w-full gap-3'>
+                    <div
+                      className={` sub-alamat flex ${
+                        isKonfirmasi ? 'flex-col' : 'flex-row'
+                      } w-full gap-3`}
+                    >
                       <div
-                        className='w-3/5'
-                        ref={stateInvoiceRef}
-                        aria-label='stateInvoice'
+                        className={`flex  ${
+                          isKonfirmasi
+                            ? ' flex-row gap-3 w-full'
+                            : 'flex-row gap-3 w-2/5'
+                        }`}
                       >
-                        <Controller
-                          name='stateInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={states}
-                              disabled={sameAddress}
-                              placeholder='Provinsi'
-                            />
+                        <div
+                          className='w-full'
+                          ref={stateInvoiceRef}
+                          aria-label='stateInvoice'
+                        >
+                          <Controller
+                            name='stateInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={states}
+                                disabled={sameAddress}
+                                placeholder='Provinsi'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.stateInvoice}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.stateInvoice}
-                          </div>
-                        )}
+                        </div>
+                        <div
+                          className='w-full'
+                          ref={cityInvoiceRef}
+                          aria-label='cityInvoice'
+                        >
+                          <Controller
+                            name='cityInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={citiesInvoice}
+                                disabled={!watchStateInvoice || sameAddress}
+                                placeholder='Kota'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errorsPengiriman.cityInvoice}
+                            </div>
+                          )}
+                        </div>
                       </div>
                       <div
-                        className='w-2/5'
-                        ref={cityInvoiceRef}
-                        aria-label='cityInvoice'
+                        className={`flex-row flex gap-2 justify-between  ${
+                          isKonfirmasi ? 'w-full' : 'w-3/5'
+                        }`}
                       >
-                        <Controller
-                          name='cityInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={citiesInvoice}
-                              disabled={!watchStateInvoice || sameAddress}
-                              placeholder='Kota'
-                            />
-                          )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errorsPengiriman.cityInvoice}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={districtInvoiceRef}>
-                        <Controller
-                          name='districtInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={districtsInvoice}
-                              disabled={
-                                !watchStateInvoice ||
-                                !watchCityInvoice ||
-                                sameAddress
-                              }
-                              placeholder='Kecamatan'
-                            />
+                        <div className='w-full' ref={districtInvoiceRef}>
+                          <Controller
+                            name='districtInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={districtsInvoice}
+                                disabled={
+                                  !watchStateInvoice ||
+                                  !watchCityInvoice ||
+                                  sameAddress
+                                }
+                                placeholder='Kecamatan'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.districtInvoice}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.districtInvoice}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={subDistrictInvoiceRef}>
-                        <Controller
-                          name='subDistrictInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={subDistrictsInvoice}
-                              disabled={!watchDistrictInvoice || sameAddress}
-                              placeholder='Kelurahan'
-                            />
+                        </div>
+                        <div className='w-full' ref={subDistrictInvoiceRef}>
+                          <Controller
+                            name='subDistrictInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={subDistrictsInvoice}
+                                disabled={!watchDistrictInvoice || sameAddress}
+                                placeholder='Kelurahan'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.subDistrictsInvoice}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.subDistrictsInvoice}
-                          </div>
-                        )}
-                      </div>
-                      <div className='w-1/3' ref={zipInvoiceRef}>
-                        <Controller
-                          name='zipInvoice'
-                          control={control}
-                          render={(props) => (
-                            <HookFormSelect
-                              {...props}
-                              options={zipsInvoice}
-                              disabled={!watchsubDistrictInvoice || sameAddress}
-                              placeholder='Zip'
-                            />
+                        </div>
+                        <div className='w-full' ref={zipInvoiceRef}>
+                          <Controller
+                            name='zipInvoice'
+                            control={control}
+                            render={(props) => (
+                              <HookFormSelect
+                                {...props}
+                                options={zipsInvoice}
+                                disabled={
+                                  !watchsubDistrictInvoice || sameAddress
+                                }
+                                placeholder='Zip'
+                              />
+                            )}
+                          />
+                          {chekValid && (
+                            <div className='text-caption-2 text-danger-500 mt-1'>
+                              {errors.zipInvoice}
+                            </div>
                           )}
-                        />
-                        {chekValid && (
-                          <div className='text-caption-2 text-danger-500 mt-1'>
-                            {errors.zipInvoice}
-                          </div>
-                        )}
+                        </div>
                       </div>
                     </div>
                   </>
-- 
cgit v1.2.3


From dd8a56ad12d054e121965c41bcb077158690b208 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Dec 2024 17:07:44 +0700
Subject: <iman> update code

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 214 +++++++++++++----------
 1 file changed, 122 insertions(+), 92 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 068cf73c..11586267 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -34,14 +34,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
   const [zipsInvoice, setZipsInvoice] = useState([]);
   const [sameAddress, setSameAddress] = useState(false);
   const [sameAddressStreet, setSameAddressStreet] = useState(false);
-  const [everyWeekday, setEveryWeekday] = useState(false);
-  const [everyWeek, setEveryWeek] = useState(false);
-  const [tukarInvoice, setTukarInvoice] = useState(false);
-  const [everyWeekdayPembayaran, setEveryWeekdayPembayaran] = useState(false);
-  const [everyWeekPembayaran, setEveryWeekPembayaran] = useState(false);
-  const [tukarInvoicePembayaran, setTukarInvoicePembayaran] = useState(false);
-  const [selectedRadio, setSelectedRadio] = useState('');
-  const [selectedRadioInvoice, setSelectedRadioInvoice] = useState('');
 
   const [selectedIds, setSelectedIds] = useState(
     formPengiriman.dokumenPengiriman
@@ -306,46 +298,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
     updateFormPengiriman(name, value);
     validatePengiriman();
   };
-  const handleRadioChange = (value) => {
-    setSelectedRadio(value);
-    if (value == 'everyWeekday') {
-      setEveryWeekday(!everyWeekday);
-    } else if (value == 'everyWeek') {
-      setEveryWeek(!everyWeek);
-    } else {
-      setTukarInvoice(!tukarInvoice);
-    }
-    validatePengiriman();
-  };
-  const handleRadioChangeInvoice = (value) => {
-    setSelectedRadioInvoice(value);
-    if (value == 'everyWeekdayPembayaran') {
-      setEveryWeekdayPembayaran(!everyWeekdayPembayaran);
-    } else if (value == 'everyWeekPembayaran') {
-      setEveryWeekPembayaran(!everyWeekPembayaran);
-    } else {
-      setTukarInvoicePembayaran(!tukarInvoicePembayaran);
-    }
-    validatePengiriman();
-  };
-  const handleEveryWeekday = () => {
-    setEveryWeekday(!everyWeekday);
-  };
-  const handleEveryWeek = () => {
-    setEveryWeek(!everyWeek);
-  };
-  const handleTukarInvoice = () => {
-    setTukarInvoice(!tukarInvoice);
-  };
-  const handleEveryWeekdayPembayaran = () => {
-    setEveryWeekdayPembayaran(!everyWeekdayPembayaran);
-  };
-  const handleEveryWeekPembayaran = () => {
-    setEveryWeekPembayaran(!everyWeekPembayaran);
-  };
-  const handleTukarInvoicePembayaran = () => {
-    setTukarInvoicePembayaran(!tukarInvoicePembayaran);
-  };
 
   const isFormValid = useMemo(
     () => Object.keys(errorsPengiriman).length === 0,
@@ -842,7 +794,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.PICName}
+                      {errorsPengiriman.PICName} {errorsPengiriman.PICTittle}
                     </div>
                   )}
                 </div>
@@ -968,7 +920,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.subDistrictPengiriman}
+                              {errorsPengiriman.subDistrictPengiriman}
                             </div>
                           )}
                         </div>
@@ -987,7 +939,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.subDistrictPengiriman}
+                              {errorsPengiriman.subDistrictPengiriman}
                             </div>
                           )}
                         </div>
@@ -996,19 +948,39 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                             name='zipPengiriman'
                             control={control}
                             render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={zips}
-                                disabled={
-                                  !watchsubDistrict || sameAddressStreet
-                                }
-                                placeholder='Zip'
-                              />
+                              <>
+                                {/* Jika zips tidak kosong, tampilkan dropdown */}
+                                {zips.length > 0 ? (
+                                  <HookFormSelect
+                                    {...props}
+                                    options={zips}
+                                    disabled={
+                                      !watchsubDistrict || sameAddressStreet
+                                    }
+                                    placeholder='Zip'
+                                  />
+                                ) : (
+                                  // Jika zips kosong, tampilkan input manual
+                                  <input
+                                    id='zipPengiriman'
+                                    name='zipPengiriman'
+                                    ref={zipRef}
+                                    placeholder='Kode Pos'
+                                    type='number'
+                                    disabled={
+                                      !watchsubDistrict || sameAddressStreet
+                                    }
+                                    value={formPengiriman.zipPengiriman}
+                                    className='form-input'
+                                    onChange={handleInputChange}
+                                  />
+                                )}
+                              </>
                             )}
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.zipPengiriman}
+                              {errorsPengiriman.zipPengiriman}
                             </div>
                           )}
                         </div>
@@ -1054,7 +1026,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </div>
                   {chekValid && (
                     <div className='text-caption-2 text-danger-500 mt-1'>
-                      {errorsPengiriman.invoicePic}
+                      {errorsPengiriman.invoicePic}{' '}
+                      {errorsPengiriman.invoicePicTittle}
                     </div>
                   )}
                 </div>
@@ -1186,7 +1159,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.districtInvoice}
+                              {errorsPengiriman.districtInvoice}
                             </div>
                           )}
                         </div>
@@ -1205,7 +1178,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.subDistrictsInvoice}
+                              {errorsPengiriman.subDistrictsInvoice}
                             </div>
                           )}
                         </div>
@@ -1214,19 +1187,37 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                             name='zipInvoice'
                             control={control}
                             render={(props) => (
-                              <HookFormSelect
-                                {...props}
-                                options={zipsInvoice}
-                                disabled={
-                                  !watchsubDistrictInvoice || sameAddress
-                                }
-                                placeholder='Zip'
-                              />
+                              <>
+                                {zipsInvoice.length > 0 ? (
+                                  <HookFormSelect
+                                    {...props}
+                                    options={zipsInvoice}
+                                    disabled={
+                                      !watchsubDistrictInvoice || sameAddress
+                                    }
+                                    placeholder='Zip'
+                                  />
+                                ) : (
+                                  <input
+                                    id='zipInvoice'
+                                    name='zipInvoice'
+                                    ref={zipInvoiceRef}
+                                    placeholder='Kode Pos'
+                                    type='number'
+                                    disabled={
+                                      !watchsubDistrictInvoice || sameAddress
+                                    }
+                                    value={formPengiriman.zipInvoice}
+                                    className='form-input'
+                                    onChange={handleInputChange}
+                                  />
+                                )}
+                              </>
                             )}
                           />
                           {chekValid && (
                             <div className='text-caption-2 text-danger-500 mt-1'>
-                              {errors.zipInvoice}
+                              {errorsPengiriman.zipInvoice}
                             </div>
                           )}
                         </div>
@@ -1486,7 +1477,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </div>
                 {chekValid && (
                   <div className='text-caption-2 text-danger-500 mt-1'>
-                    {errorsPengiriman.PICName}
+                    {errorsPengiriman.PICName} {errorsPengiriman.PICTittle}
                   </div>
                 )}
               </div>
@@ -1607,7 +1598,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     />
                     {chekValid && (
                       <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errors.subDistrictPengiriman}
+                        {errorsPengiriman.subDistrictPengiriman}
                       </div>
                     )}
                   </div>
@@ -1626,7 +1617,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     />
                     {chekValid && (
                       <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errors.subDistrictPengiriman}
+                        {errorsPengiriman.subDistrictPengiriman}
                       </div>
                     )}
                   </div>
@@ -1635,17 +1626,35 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       name='zipPengiriman'
                       control={control}
                       render={(props) => (
-                        <HookFormSelect
-                          {...props}
-                          options={zips}
-                          disabled={!watchsubDistrict || sameAddressStreet}
-                          placeholder='Zip'
-                        />
+                        <>
+                          {/* Jika zips tidak kosong, tampilkan dropdown */}
+                          {zips.length > 0 ? (
+                            <HookFormSelect
+                              {...props}
+                              options={zips}
+                              disabled={!watchsubDistrict || sameAddressStreet}
+                              placeholder='Zip'
+                            />
+                          ) : (
+                            // Jika zips kosong, tampilkan input manual
+                            <input
+                              id='zipPengiriman'
+                              name='zipPengiriman'
+                              ref={zipRef}
+                              placeholder='Kode Pos'
+                              type='number'
+                              disabled={!watchsubDistrict || sameAddressStreet}
+                              value={formPengiriman.zipPengiriman}
+                              className='form-input'
+                              onChange={handleInputChange}
+                            />
+                          )}
+                        </>
                       )}
                     />
                     {chekValid && (
                       <div className='text-caption-2 text-danger-500 mt-1'>
-                        {errors.zipPengiriman}
+                        {errorsPengiriman.zipPengiriman}
                       </div>
                     )}
                   </div>
@@ -1685,7 +1694,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </div>
                 {chekValid && (
                   <div className='text-caption-2 text-danger-500 mt-1'>
-                    {errorsPengiriman.invoicePic}
+                    {errorsPengiriman.invoicePic}{' '}
+                    {errorsPengiriman.invoicePicTittle}
                   </div>
                 )}
               </div>
@@ -1793,7 +1803,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errors.districtInvoice}
+                          {errorsPengiriman.districtInvoice}
                         </div>
                       )}
                     </div>
@@ -1812,7 +1822,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errors.subDistrictsInvoice}
+                          {errorsPengiriman.subDistrictsInvoice}
                         </div>
                       )}
                     </div>
@@ -1821,17 +1831,37 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                         name='zipInvoice'
                         control={control}
                         render={(props) => (
-                          <HookFormSelect
-                            {...props}
-                            options={zipsInvoice}
-                            disabled={!watchsubDistrictInvoice || sameAddress}
-                            placeholder='Zip'
-                          />
+                          <>
+                            {zipsInvoice.length > 0 ? (
+                              <HookFormSelect
+                                {...props}
+                                options={zipsInvoice}
+                                disabled={
+                                  !watchsubDistrictInvoice || sameAddress
+                                }
+                                placeholder='Zip'
+                              />
+                            ) : (
+                              <input
+                                id='zipInvoice'
+                                name='zipInvoice'
+                                ref={zipInvoiceRef}
+                                placeholder='Kode Pos'
+                                type='number'
+                                disabled={
+                                  !watchsubDistrictInvoice || sameAddress
+                                }
+                                value={formPengiriman.zipInvoice}
+                                className='form-input'
+                                onChange={handleInputChange}
+                              />
+                            )}
+                          </>
                         )}
                       />
                       {chekValid && (
                         <div className='text-caption-2 text-danger-500 mt-1'>
-                          {errors.zipInvoice}
+                          {errorsPengiriman.zipInvoice}
                         </div>
                       )}
                     </div>
-- 
cgit v1.2.3


From 72a2c17094eca3d08c1a42c528f869befdb6131e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 7 Jan 2025 11:10:19 +0700
Subject: <iman> update perbaiki kata kata

---
 src/lib/pengajuan-tempo/component/Pengiriman.jsx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

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

diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
index 11586267..755cf45d 100644
--- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx
+++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx
@@ -818,7 +818,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                     isChecked={sameAddressStreet}
                     onChange={handleChangeSameAddressStreet}
                   >
-                    Alamat Pengiriman sama dengan alamat bisnis
+                    Alamat Pengiriman sama dengan alamat perusahaan
                   </Checkbox>
 
                   <>
@@ -1052,7 +1052,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                       isChecked={sameAddress}
                       onChange={handleChangeSameAddress}
                     >
-                      Alamat invoice sama dengan alamat bisnis
+                      Alamat invoice sama dengan alamat perusahaan
                     </Checkbox>
                   </div>
 
@@ -1235,7 +1235,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </label>
                   {!isKonfirmasi && (
                     <span className='text-xs opacity-60'>
-                      Pilih jika bisnis anda memiliki jadwal penukaran invoice
+                      isi jika perusahaan anda memiliki jadwal penukaran invoice
                     </span>
                   )}
                 </div>
@@ -1262,7 +1262,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   </label>
                   {!isKonfirmasi && (
                     <span className='text-xs opacity-60'>
-                      Pilih jika bisnis anda memiliki jadwal pembayaran
+                      isi jika perusahaan anda memiliki jadwal pembayaran
                     </span>
                   )}
                 </div>
@@ -1492,7 +1492,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                   onChange={handleChangeSameAddressStreet}
                   size='sm'
                 >
-                  Alamat Pengiriman sama dengan alamat bisnis
+                  Alamat Pengiriman sama dengan alamat perusahaan
                 </Checkbox>
                 <div className='w-full'>
                   <input
@@ -1876,7 +1876,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
-                    Isi jika bisnis anda memiliki jadwal penukaran invoice
+                    isi jika perusahaan anda memiliki jadwal penukaran invoice
                   </span>
                 )}
                 <div className='w-full flex gap-2 flex-col'>
@@ -1902,7 +1902,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
                 </label>
                 {!isKonfirmasi && (
                   <span className='text-xs opacity-60'>
-                    Isi jika bisnis anda memiliki jadwal pembayaran
+                    isi jika perusahaan anda memiliki jadwal pembayaran
                   </span>
                 )}
                 <div className='w-full flex gap-2 flex-col'>
-- 
cgit v1.2.3

