summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx13
-rw-r--r--src/lib/pengajuan-tempo/component/KontakPerusahaan.jsx14
-rw-r--r--src/lib/pengajuan-tempo/component/PengajuanTempo.jsx95
-rw-r--r--src/lib/pengajuan-tempo/component/Pengiriman.jsx5
-rw-r--r--src/lib/pengajuan-tempo/component/Referensi.jsx6
-rw-r--r--src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx310
-rw-r--r--src/lib/tempo/components/Tempo.jsx134
-rw-r--r--src/pages/my/menu.jsx4
-rw-r--r--src/pages/my/tempo/index.jsx21
9 files changed, 375 insertions, 227 deletions
diff --git a/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx b/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
index ca571167..a6f25d5e 100644
--- a/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
+++ b/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
@@ -32,7 +32,7 @@ const KonfirmasiDokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
setFormat(`application/${format}`);
} else if (format == undefined) {
setFormat(null);
- setUrl(`http://192.168.23.244:8069` + base64);
+ setUrl(`${process.env.NEXT_PUBLIC_ODOO_API_HOST}` + base64);
} else {
setFormat(`image/${format}`);
}
@@ -1562,7 +1562,7 @@ const KonfirmasiDokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
close={() => setIsExample(false)}
>
<div className='flex justify-center items-center p-2'>
- <iframe
+ {/* <iframe
src={`${
format == null ? url : `data:${format};base64,${base64}`
}`}
@@ -1571,7 +1571,14 @@ const KonfirmasiDokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
width='800px'
height='600px'
title='Document'
- ></iframe>
+ ></iframe> */}
+ <embed
+ src={`${
+ format == null ? url : `data:${format};base64,${base64}`
+ }`}
+ width='100%'
+ height='600px'
+ />
</div>
</BottomPopup>
)}
diff --git a/src/lib/pengajuan-tempo/component/KontakPerusahaan.jsx b/src/lib/pengajuan-tempo/component/KontakPerusahaan.jsx
index 1ea2223e..b3d5bce7 100644
--- a/src/lib/pengajuan-tempo/component/KontakPerusahaan.jsx
+++ b/src/lib/pengajuan-tempo/component/KontakPerusahaan.jsx
@@ -143,11 +143,6 @@ const KontakPerusahaan = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
No. HP Direktur{' '}
<span className=' opacity-60'>(Opsional)</span>
</label>
- {!isKonfirmasi && (
- <span className='text-xs opacity-60'>
- isi nomor telpon direktur di perusahaan kamu
- </span>
- )}
</div>
<div className='w-3/5'>
<input
@@ -174,11 +169,6 @@ const KontakPerusahaan = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
<label className='form-label text-nowrap'>
Email Direktur
</label>
- {!isKonfirmasi && (
- <span className='text-xs opacity-60'>
- isi email Direktur yang sesuai
- </span>
- )}
</div>
<div className='w-3/5'>
<input
@@ -254,7 +244,7 @@ const KontakPerusahaan = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
</label>
{!isKonfirmasi && (
<span className='text-xs opacity-60'>
- isi nomor purchasing yang bertanggung jawab di perusahaan
+ isi email purchasing yang bertanggung jawab diperusahaan
anda
</span>
)}
@@ -394,7 +384,7 @@ const KontakPerusahaan = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
</label>
{!isKonfirmasi && (
<span className='text-xs opacity-60'>
- isi email finance dengan benar
+ isi email finance yang bertanggung jawab diperusahaan anda
</span>
)}
</div>
diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index b4f4ac9b..f5cad812 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -253,6 +253,29 @@ const PengajuanTempo = () => {
setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
};
+ const goPrevStep = () => {
+ // if (!isFormValid) {
+ // setNotValid(true);
+ // setButtonSubmitClick(!buttonSubmitClick);
+ // return;
+ // } else {
+ // // saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+ // if (currentStep == 3) {
+ // handleDaftarTempoSupplier();
+ // } else if (currentStep == 4) {
+ // handleDaftarTempoDokumen();
+ // } else {
+ // handleDaftarTempoPerPage(
+ // stepLabels[currentStep],
+ // stepDivsForm[currentStep]
+ // );
+ // }
+ // setButtonSubmitClick(!buttonSubmitClick);
+ // setNotValid(false);
+ // }
+ setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev - 1));
+ };
+
const handleDaftarTempoPerPage = async (
label,
formData,
@@ -558,30 +581,57 @@ const PengajuanTempo = () => {
<span className='text-xs opacity-60'>
*Pastikan data yang anda masukan sudah benar dan sesuai
</span>
- {currentStep < 5 && (
- <>
- <Tooltip
- label={clsxm({
- 'Klik simpan data terlebih dahulu':
- currentStep === 3 && !hasSavedata,
- })}
+ <div
+ className={` flex flex-row ${
+ currentStep > 0 && currentStep < 5
+ ? 'justify-between'
+ : 'justify-end'
+ } items-center w-full ${isMobile ? 'gap-x-4 ' : ''}`}
+ >
+ {currentStep < 5 && currentStep > 0 && (
+ <Button
+ colorScheme='yellow'
+ w={`${isMobile ? 'full' : 'fit'}`}
+ onClick={goPrevStep}
>
- <Button
- colorScheme='red'
- w={`${isMobile ? 'full' : 'fit'}`}
- isDisabled={
- (currentStep === 3 && !hasSavedata) ||
- currentStep === NUMBER_OF_STEPS - 1
- }
- onClick={goToNextStep}
+ {<ChevronLeftIcon className='w-5' />}
+ <span className={`${isMobile ? 'text-xs' : ''} `}>
+ Langkah Sebelumnya
+ </span>
+ </Button>
+ )}
+ {currentStep < 5 && (
+ <>
+ <Tooltip
+ label={clsxm({
+ 'Klik simpan data terlebih dahulu':
+ currentStep === 3 && !hasSavedata,
+ })}
>
- Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
- </Button>
- </Tooltip>
- </>
- )}
+ <Button
+ colorScheme='red'
+ w={`${isMobile ? 'full' : 'fit'}`}
+ isDisabled={
+ (currentStep === 3 && !hasSavedata) ||
+ currentStep === NUMBER_OF_STEPS - 1
+ }
+ onClick={goToNextStep}
+ >
+ <span className={`${isMobile ? 'text-xs' : ''} `}>
+ Langkah Selanjutnya
+ </span>
+ {<ChevronRightIcon className='w-5' />}
+ </Button>
+ </Tooltip>
+ </>
+ )}
+ </div>
{currentStep == 5 && (
- <div className='flex flex-col items-end justify-start gap-4'>
+ <div
+ className={`flex flex-col ${
+ isMobile ? 'items-start' : 'items-end'
+ } w-full justify-start gap-4`}
+ >
<TempoTermCondition onCheckChange={handleCheckChange} />
<Button
colorScheme='red'
@@ -601,6 +651,7 @@ const PengajuanTempo = () => {
const TempoTermCondition = ({ onCheckChange }) => {
const [isCheckedTNC, SetIsCheckedTNC] = useState(false);
const [openTNC, SetOpenTNC] = useState(false);
+ const { isDesktop, isMobile } = useDevice();
const openTNCHandle = () => {
SetOpenTNC(!openTNC);
@@ -623,7 +674,7 @@ const TempoTermCondition = ({ onCheckChange }) => {
isChecked={isCheckedTNC}
onChange={toggleCheckTNC}
/>
- <div>
+ <div className={`text-center ${isMobile ? 'text-sm' : ''}`}>
<label htmlFor='tnc' className='cursor-pointer'>
Dengan ini saya menyetujui
</label>{' '}
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'>
diff --git a/src/lib/pengajuan-tempo/component/Referensi.jsx b/src/lib/pengajuan-tempo/component/Referensi.jsx
index 9e154166..38693d18 100644
--- a/src/lib/pengajuan-tempo/component/Referensi.jsx
+++ b/src/lib/pengajuan-tempo/component/Referensi.jsx
@@ -501,11 +501,11 @@ const Referensi = ({ chekValid, buttonSubmitClick, data }) => {
</div>
))}
</div>
- <div className='h-[2px] bg-gray-300 w-[120%] inset-0 relative transform -translate-x-5'></div>
- <h2 className='py-2 font-semibold text-base text-red-500 flex flex-row'>
+ {/* <div className='h-[2px] bg-gray-300 w-[120%] inset-0 relative transform -translate-x-5'></div> */}
+ {/* <h2 className='py-2 font-semibold text-base text-red-500 flex flex-row'>
<PlusCircleIcon className='w-5 mr-2' />
Tambah Data Baru
- </h2>
+ </h2> */}
<div className='h-[2px] bg-gray-300 w-[120%] inset-0 relative transform -translate-x-5'></div>
<form className='flex flex-col w-full'>
<div className='w-full grid grid-row-2 gap-2'>
diff --git a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
index f8a0bc55..9850e927 100644
--- a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
+++ b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
@@ -640,100 +640,124 @@ const InformasiPerusahaan = ({
</div>
)}
</div>
- <div className='sub-alamat flex flex-row w-full gap-3'>
- <div className='w-2/5' ref={stateRef}>
- <Controller
- name='state'
- control={control}
- render={(props) => (
- <HookFormSelect
- {...props}
- options={states}
- placeholder='Provinsi'
- />
+ <div
+ className={` sub-alamat flex ${
+ isKonfirmasi ? 'flex-col' : 'flex-row'
+ } w-full gap-3`}
+ >
+ <div
+ className={`flex ${
+ isKonfirmasi
+ ? ' flex-row gap-3 w-full'
+ : 'flex-row gap-3 w-2/5'
+ }`}
+ >
+ <div
+ className={`${isKonfirmasi ? 'w-full' : 'w-full'}`}
+ ref={stateRef}
+ >
+ <Controller
+ name='state'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={states}
+ placeholder='Provinsi'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.state}
+ </div>
)}
- />
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.state}
- </div>
- )}
- </div>
- <div className='w-1/3' ref={cityRef}>
- <Controller
- name='city'
- control={control}
- render={(props) => (
- <HookFormSelect
- {...props}
- options={cities}
- disabled={!watchState}
- placeholder='Kota'
- />
+ </div>
+ <div
+ className={`${isKonfirmasi ? 'w-full' : 'w-full'}`}
+ ref={cityRef}
+ >
+ <Controller
+ name='city'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={cities}
+ disabled={!watchState}
+ placeholder='Kota'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.city}
+ </div>
)}
- />
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.city}
- </div>
- )}
+ </div>
</div>
- <div className='w-1/3' ref={districtRef}>
- <Controller
- name='district'
- control={control}
- render={(props) => (
- <HookFormSelect
- {...props}
- options={districts}
- disabled={!watchState || !watchCity}
- placeholder='Kecamatan'
- />
+ <div
+ className={`flex-row flex gap-2 justify-between ${
+ isKonfirmasi ? 'w-full' : 'w-3/5'
+ }`}
+ >
+ <div className='w-full' ref={districtRef}>
+ <Controller
+ name='district'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={districts}
+ disabled={!watchState || !watchCity}
+ placeholder='Kecamatan'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.district}
+ </div>
)}
- />
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.district}
- </div>
- )}
- </div>
- <div className='w-1/3' ref={subDistrictRef}>
- <Controller
- name='subDistrict'
- control={control}
- render={(props) => (
- <HookFormSelect
- {...props}
- options={subDistricts}
- disabled={!watchDistrict}
- placeholder='Kelurahan'
- />
+ </div>
+ <div className='w-full' ref={subDistrictRef}>
+ <Controller
+ name='subDistrict'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={subDistricts}
+ disabled={!watchDistrict}
+ placeholder='Kelurahan'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.district}
+ </div>
)}
- />
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.district}
- </div>
- )}
- </div>
- <div className='w-1/3' ref={zipRef}>
- <Controller
- name='zip'
- control={control}
- render={(props) => (
- <HookFormSelect
- {...props}
- options={zips}
- disabled={!watchsubDistrict}
- placeholder='Zip'
- />
+ </div>
+ <div className='w-full' ref={zipRef}>
+ <Controller
+ name='zip'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={zips}
+ disabled={!watchsubDistrict}
+ placeholder='Zip'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.zip}
+ </div>
)}
- />
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.district}
- </div>
- )}
+ </div>
</div>
{/* <div className='w-1/3'>
<input
@@ -1163,9 +1187,14 @@ const InformasiPerusahaan = ({
className='form-input'
onChange={handleInputChange}
/>
- <div className='w-full text-nowrap'>
- <div className='sub-alamat flex flex-row w-full gap-3'>
- <div className='w-2/5' ref={stateRef}>
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.street}
+ </div>
+ )}
+ <div className='w-full text-warp gap-3 flex flex-col'>
+ <div className='sub-alamat flex flex-row w-full gap-3 '>
+ <div className='w-full' ref={stateRef}>
<Controller
name='state'
control={control}
@@ -1183,7 +1212,7 @@ const InformasiPerusahaan = ({
</div>
)}
</div>
- <div className='w-1/3' ref={cityRef}>
+ <div className='w-full' ref={cityRef}>
<Controller
name='city'
control={control}
@@ -1202,7 +1231,9 @@ const InformasiPerusahaan = ({
</div>
)}
</div>
- <div className='w-1/3' ref={districtRef}>
+ </div>
+ <div className='flex flex-row gap-3'>
+ <div className='w-full' ref={districtRef}>
<Controller
name='district'
control={control}
@@ -1221,16 +1252,37 @@ const InformasiPerusahaan = ({
</div>
)}
</div>
- <div className='w-1/3'>
- <input
- id='zip'
+ <div className='w-full' ref={subDistrictRef}>
+ <Controller
+ name='subDistrict'
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={subDistricts}
+ disabled={!watchDistrict}
+ placeholder='Kelurahan'
+ />
+ )}
+ />
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.district}
+ </div>
+ )}
+ </div>
+ <div className='w-full'>
+ <Controller
name='zip'
- ref={zipRef}
- placeholder='Kode Pos'
- type='number'
- value={form.zip}
- className='form-input'
- onChange={handleInputChange}
+ control={control}
+ render={(props) => (
+ <HookFormSelect
+ {...props}
+ options={zips}
+ disabled={!watchsubDistrict}
+ placeholder='Zip'
+ />
+ )}
/>
{chekValid && (
<div className='text-caption-2 text-danger-500 mt-1'>
@@ -1245,11 +1297,6 @@ const InformasiPerusahaan = ({
Isi detail alamat sesuai dengan yang terdaftar
</span>
)}
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.street}
- </div>
- )}
</div>
<div className='flex flex-col gap-2 justify-between items-start'>
@@ -1279,6 +1326,11 @@ const InformasiPerusahaan = ({
<div className='flex flex-col gap-2 justify-between items-start'>
<label className='form-label'>Data Bank</label>
+ {!isKonfirmasi && (
+ <span className='text-xs opacity-60'>
+ Isi data bank perusahaan sesuai dengan yang terdaftar
+ </span>
+ )}
<div className='flex gap-3 flex-row'>
<div>
<input
@@ -1291,6 +1343,11 @@ const InformasiPerusahaan = ({
className='form-input'
onChange={handleInputChange}
/>
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.bankName}
+ </div>
+ )}
</div>
<div>
<input
@@ -1327,16 +1384,6 @@ const InformasiPerusahaan = ({
)}
</div>
</div>
- {!isKonfirmasi && (
- <span className='text-xs opacity-60'>
- Isi data bank perusahaan sesuai dengan yang terdaftar
- </span>
- )}
- {chekValid && (
- <div className='text-caption-2 text-danger-500 mt-1'>
- {errors.bankName}
- </div>
- )}
</div>
<div className='flex flex-col gap-2 justify-between items-start'>
@@ -1406,6 +1453,33 @@ const InformasiPerusahaan = ({
indoteknik.com
</div>
<div className='h-[2px] bg-gray-300 w-[120%] inset-0 relative transform -translate-x-5'></div>
+
+ <div className='flex flex-col gap justify-between items-start'>
+ <label className='form-label text-wrap '>
+ Apakah terdapat vendor portal pada perusahaan anda?
+ </label>
+ <div className='flex gap-x-4' ref={bersediaRef}>
+ <RadioGroup
+ size='sm'
+ onChange={handleCheckboxPortalChange}
+ value={form.portal}
+ >
+ <Stack direction='col'>
+ <Radio colorScheme='red' value='ada'>
+ Ya, ada
+ </Radio>
+ <Radio colorScheme='red' value='tidak'>
+ Tidak ada
+ </Radio>
+ </Stack>
+ </RadioGroup>
+ </div>
+ {chekValid && (
+ <div className='text-caption-2 text-danger-500 mt-1'>
+ {errors.portal}
+ </div>
+ )}
+ </div>
<div className='flex flex-col gap justify-between items-start'>
<label className='form-label text-wrap '>
Apakah bersedia transaksi via website?
@@ -1428,7 +1502,7 @@ const InformasiPerusahaan = ({
</div>
{chekValid && (
<div className='text-caption-2 text-danger-500 mt-1'>
- {errors.estimasi}
+ {errors.bersedia}
</div>
)}
</div>
diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx
index 8a7f4f71..97b21454 100644
--- a/src/lib/tempo/components/Tempo.jsx
+++ b/src/lib/tempo/components/Tempo.jsx
@@ -113,7 +113,9 @@ const Tempo = () => {
isLoaded={!isLoading}
h='fit'
w={32}
- className='badge-solid-green px-1 text-sm flex items-center justify-center font-thin'
+ className={`${
+ tempo.paymentTerm ? 'badge-solid-green' : 'badge-yellow'
+ } px-1 text-sm flex items-center justify-center font-thin`}
>
{tempo.paymentTerm ? tempo.paymentTerm : 'Review'}
</Skeleton>
@@ -175,7 +177,7 @@ const Tempo = () => {
{getLabel()}
</span>
</div>
- {auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
+ {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
<div className='flex justify-center'>
<Image
src='/images/ICON-DOKUMEN-VERIFIKASI.png'
@@ -313,7 +315,9 @@ const Tempo = () => {
isLoaded={!isLoading}
h='fit'
w={24}
- className='badge-solid-green px-1 text-xs flex items-center justify-center font-thin'
+ className={`${
+ tempo.paymentTerm ? 'badge-solid-green' : 'badge-yellow'
+ } px-1 text-xs flex items-center justify-center font-thin`}
>
{tempo.paymentTerm ? tempo.paymentTerm : 'Review'}
</Skeleton>
@@ -377,7 +381,7 @@ const Tempo = () => {
</div>
</div>
<div className='p-4 flex flex-col gap-y-4'>
- {!invoices.isLoading && invoices.data?.invoices?.length != 0 && (
+ {auth && !auth?.tempoProgres == 'review' && tempo.paymentTerm && (
<form className='flex gap-x-3' onSubmit={handleSubmit}>
<input
type='text'
@@ -398,7 +402,7 @@ const Tempo = () => {
</div>
)}
- {!invoices.isLoading && invoices.data?.invoices?.length === 0 && (
+ {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
// <Alert type='info' className='text-center'>
// Tidak ada invoice
// </Alert>
@@ -408,72 +412,73 @@ const Tempo = () => {
width={isMobile ? 300 : 600}
height={isMobile ? 300 : 550}
/>
- )}
-
- {invoices.data?.invoices?.map((invoice, index) => (
- <div
- className='p-4 shadow border border-gray_r-3 rounded-md'
- key={index}
- >
- <div className='grid grid-cols-2'>
- <Link href={`/my/quotations/${invoice.salesOrderId}`}>
- <span className='text-caption-2 text-gray_r-11'>
- No. Transaksi
- </span>
- <h2 className='font-semibold text-black mt-1'>
- {invoice.salesOrder}
- </h2>
- </Link>
- <div className='flex gap-x-1 justify-end items-end '>
- {invoice.amountResidual > 0 ? (
- new Date() > getDueDate(invoice.invoiceDateDue) ? (
- <div className='inline-flex items-end rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/20'>
- Jatuh Tempo
- </div>
+ ) : (
+ invoices.data?.invoices?.map((invoice, index) => (
+ <div
+ className='p-4 shadow border border-gray_r-3 rounded-md'
+ key={index}
+ >
+ <div className='grid grid-cols-2'>
+ <Link href={`/my/quotations/${invoice.salesOrderId}`}>
+ <span className='text-caption-2 text-gray_r-11'>
+ No. Transaksi
+ </span>
+ <h2 className='font-semibold text-black mt-1'>
+ {invoice.salesOrder}
+ </h2>
+ </Link>
+ <div className='flex gap-x-1 justify-end items-end '>
+ {invoice.amountResidual > 0 ? (
+ new Date() > getDueDate(invoice.invoiceDateDue) ? (
+ <div className='inline-flex items-end rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/20'>
+ Jatuh Tempo
+ </div>
+ ) : (
+ <div className='badge-solid-red h-fit ml-auto'>
+ Belum Lunas
+ </div>
+ )
) : (
- <div className='badge-solid-red h-fit ml-auto'>
- Belum Lunas
+ <div className='badge-solid-green h-fit ml-auto'>
+ Lunas
</div>
- )
- ) : (
- <div className='badge-solid-green h-fit ml-auto'>Lunas</div>
- )}
- {/* <EllipsisVerticalIcon
+ )}
+ {/* <EllipsisVerticalIcon
className='w-5 h-5'
onClick={() => setToOthers(invoice)}
/> */}
+ </div>
</div>
- </div>
- <Link href={`/my/invoices/${invoice.id}`}>
- <div className='grid grid-cols-2 text-caption-2 text-gray_r-11 mt-2 font-normal'>
- <p className='opacity-70'>
- {formatTanggal(invoice.invoiceDate)}
- </p>
- <p className='text-right text-xs text-red-500'>
- Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)}
- </p>
- </div>
- <hr className='my-3' />
- <div className='grid grid-cols-2'>
- <div>
- <span className='text-caption-2 text-gray_r-11'>
- No. Invoice
- </span>
- <p className='mt-1 font-semibold text-gray_r-12'>
- {invoice.name || '-'}
+ <Link href={`/my/invoices/${invoice.id}`}>
+ <div className='grid grid-cols-2 text-caption-2 text-gray_r-11 mt-2 font-normal'>
+ <p className='opacity-70'>
+ {formatTanggal(invoice.invoiceDate)}
</p>
- </div>
- <div className='text-right'>
- <span className='opacity-65 text-caption-2 text-gray_r-11'>
- Total Belanja
- </span>
- <p className='mt-1 font-semibold text-red-500 '>
- {currencyFormat(invoice.amountTotal)}
+ <p className='text-right text-xs text-red-500'>
+ Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)}
</p>
</div>
- </div>
- </Link>
- {/* {invoice.efaktur ? (
+ <hr className='my-3' />
+ <div className='grid grid-cols-2'>
+ <div>
+ <span className='text-caption-2 text-gray_r-11'>
+ No. Invoice
+ </span>
+ <p className='mt-1 font-semibold text-gray_r-12'>
+ {invoice.name || '-'}
+ </p>
+ </div>
+ <div className='text-right'>
+ <span className='opacity-65 text-caption-2 text-gray_r-11'>
+ Total Belanja
+ </span>
+ <p className='mt-1 font-semibold text-red-500 '>
+ {currencyFormat(invoice.amountTotal)}
+ </p>
+ </div>
+ </div>
+ </Link>
+ {/* {invoice.efaktur ? (
<div className='badge-green h-fit mt-3 ml-auto flex items-center gap-x-0.5'>
<CheckIcon className='w-4 stroke-2' />
Faktur Pajak
@@ -484,8 +489,9 @@ const Tempo = () => {
Faktur Pajak
</div>
)} */}
- </div>
- ))}
+ </div>
+ ))
+ )}
<Pagination
pageCount={pageCount}
diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx
index 4099a935..b626be30 100644
--- a/src/pages/my/menu.jsx
+++ b/src/pages/my/menu.jsx
@@ -90,8 +90,8 @@ export default function Menu() {
<p>Invoice & Faktur Pajak</p>
</div>
</LinkItem>
- {(atuh?.partnerTempo.toLowerCase().includes('tempo') ||
- atuh.tempoProgres == 'review') && (
+ {(auth?.partnerTempo?.toLowerCase().includes('tempo') ||
+ auth?.tempoProgres == 'review') && (
<LinkItem href='/my/tempo'>
{' '}
<div className='flex gap-x-3 items-center'>
diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx
index 365986f4..f52fe960 100644
--- a/src/pages/my/tempo/index.jsx
+++ b/src/pages/my/tempo/index.jsx
@@ -5,8 +5,27 @@ import DesktopView from '@/core/components/views/DesktopView';
import MobileView from '@/core/components/views/MobileView';
import IsAuth from '@/lib/auth/components/IsAuth';
import InvoicesComponent from '@/lib/tempo/components/Tempo';
-
+import { getAuth } from '~/libs/auth';
+import { useRouter } from 'next/router';
+import { useEffect, useState } from 'react';
export default function MyTempo() {
+ const auth = getAuth();
+ const router = useRouter();
+ const [isLoading, setIsLoading] = useState(true);
+ useEffect(() => {
+ if (!auth) {
+ const nextUrl = encodeURIComponent(router.asPath);
+ router.push(`/login?next=${nextUrl}`);
+ } else if (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') {
+ router.push('/pengajuan-tempo');
+ } else {
+ setIsLoading(false);
+ }
+ }, [auth]);
+
+ if (isLoading || !auth) {
+ return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia
+ }
return (
<IsAuth>
<Seo title='Tempo - Indoteknik.com' />