From 24700c2f3555da3df4537a28e7145e6bd25dafb0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 11 Feb 2025 11:39:57 +0700
Subject: <iman> update if no parent using partnerId

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

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

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 5bef5134..9a554e42 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -173,11 +173,11 @@ const PengajuanTempo = () => {
         }
         return data; // Jika bukan object atau array, kembalikan nilai aslinya
       };
-
+      const payment = auth.parentId ? auth.parentId : auth.partnerId
       try {
         const dataPaymentTerm = await odooApi(
           'GET',
-          `/api/v1/partner/detail-tempo/${auth.parentId}`
+          `/api/v1/partner/detail-tempo/${payment}`
         );
         const transformedData = transformKeysToCamelCase(dataPaymentTerm);
         setBigData(transformedData);
@@ -293,7 +293,7 @@ const PengajuanTempo = () => {
     try {
       const address = await createPengajuanTempoApi({
         id: idTempo,
-        user_id: auth.parentId,
+        user_id: auth.parentId ? auth.parentId : auth.partnerId,
         partner_id: auth.partnerId,
         section: label,
         tempo_request: tempoRequest,
@@ -341,7 +341,7 @@ const PengajuanTempo = () => {
     try {
       const address = await createPengajuanTempoApi({
         id: idTempo,
-        user_id: auth.parentId,
+        user_id: auth.parentId ? auth.parentId : auth.partnerId,
         partner_id: auth.partnerId,
         formDocs: JSON.stringify(formattedDokumen),
       });
@@ -402,7 +402,7 @@ const PengajuanTempo = () => {
     try {
       const address = await createPengajuanTempoApi({
         id: idTempo,
-        user_id: auth.parentId,
+        user_id: auth.parentId ? auth.parentId : auth.partnerId,
         partner_id: auth.partnerId,
         formSupplier: JSON.stringify(productOrder),
       });
@@ -447,7 +447,7 @@ const PengajuanTempo = () => {
       const address = await createPengajuanTempoApi({
         id: 0,
         partner_id: auth.partnerId,
-        user_id: auth.parentId,
+        user_id: auth.parentId ? auth.parentId : auth.partnerId,
         tempo_request: false,
         ...form,
       });
-- 
cgit v1.2.3

