mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix(FE): fixing sapronak calculation get kandangId state
This commit is contained in:
@@ -22,7 +22,6 @@ import HppExpeditionReportTable from './hpp-ekspedisi/HppExpeditionReportTable';
|
||||
import ClosingKandangList from '@/components/pages/closing/ClosingKandangList';
|
||||
import { ProjectFlock } from '@/types/api/production/project-flock';
|
||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||
|
||||
interface ClosingDetailProps {
|
||||
id: number;
|
||||
initialValue?: ClosingGeneralInformation;
|
||||
@@ -56,7 +55,6 @@ const ClosingDetail: React.FC<ClosingDetailProps> = ({
|
||||
<ClosingSapronakCalculationTabContent
|
||||
closingGeneralInformation={initialValue}
|
||||
projectFlockId={id}
|
||||
projectKandangId={kandangData?.id}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -5,13 +5,11 @@ import { ClosingGeneralInformation } from '@/types/api/closing';
|
||||
|
||||
interface ClosingSapronakCalculationTabContentProps {
|
||||
projectFlockId?: number;
|
||||
projectKandangId?: number;
|
||||
closingGeneralInformation?: ClosingGeneralInformation;
|
||||
}
|
||||
|
||||
const ClosingSapronakCalculationTabContent = ({
|
||||
projectFlockId,
|
||||
projectKandangId,
|
||||
closingGeneralInformation,
|
||||
}: ClosingSapronakCalculationTabContentProps) => {
|
||||
return (
|
||||
@@ -21,7 +19,6 @@ const ClosingSapronakCalculationTabContent = ({
|
||||
<ClosingSapronakCalculationTable
|
||||
closingGeneralInformation={closingGeneralInformation}
|
||||
projectFlockId={projectFlockId}
|
||||
projectKandangId={projectKandangId}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -14,21 +14,23 @@ import useSWR from 'swr';
|
||||
import { ClosingApi } from '@/services/api/closing';
|
||||
import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { ClosingGeneralInformation } from '@/types/api/closing';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
|
||||
interface ClosingSapronakCalculationTableProps {
|
||||
projectFlockId: number;
|
||||
projectKandangId?: number;
|
||||
closingGeneralInformation?: ClosingGeneralInformation;
|
||||
}
|
||||
|
||||
const ClosingSapronakCalculationTable = ({
|
||||
projectFlockId,
|
||||
closingGeneralInformation,
|
||||
projectKandangId,
|
||||
}: ClosingSapronakCalculationTableProps) => {
|
||||
const searchParams = useSearchParams();
|
||||
const kandangId = searchParams.get('kandangId');
|
||||
|
||||
const { data: sapronakCalculation, isLoading } = useSWR(
|
||||
`/closing/sapronak-calculation/${projectFlockId}${projectKandangId ? `/${projectKandangId}` : ''}`,
|
||||
() => ClosingApi.getPerhitunganSapronak(projectFlockId, projectKandangId),
|
||||
`/closing/sapronak-calculation/${projectFlockId}${kandangId ? `/${kandangId}` : ''}`,
|
||||
() => ClosingApi.getPerhitunganSapronak(projectFlockId, Number(kandangId)),
|
||||
{
|
||||
keepPreviousData: true,
|
||||
}
|
||||
@@ -180,7 +182,7 @@ const ClosingSapronakCalculationTable = ({
|
||||
{/* Table DOC jika kategori Project Flock Growing */}
|
||||
<Card
|
||||
title={
|
||||
closingGeneralInformation?.project_category === 'GROWING'
|
||||
closingGeneralInformation?.project_type == 'GROWING'
|
||||
? 'DOC'
|
||||
: 'Pullet'
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -63,6 +63,7 @@ export type BaseClosing = {
|
||||
location_id: number;
|
||||
location_name: string;
|
||||
project_category: 'GROWING' | 'LAYING';
|
||||
project_type?: 'GROWING' | 'LAYING'; // berubah dari BE?
|
||||
period: number;
|
||||
closing_date?: string;
|
||||
shed_label: string;
|
||||
|
||||
Reference in New Issue
Block a user