mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
fix(FE): fixing closing project flock and fetching data in closing report
This commit is contained in:
@@ -49,9 +49,6 @@ const ClosingDetailPage = () => {
|
|||||||
{!isLoadingClosing && isResponseSuccess(closing) && (
|
{!isLoadingClosing && isResponseSuccess(closing) && (
|
||||||
<ClosingDetail id={Number(closingId)} initialValue={closing.data} />
|
<ClosingDetail id={Number(closingId)} initialValue={closing.data} />
|
||||||
)}
|
)}
|
||||||
{!isLoadingSalesReport && isResponseSuccess(salesReport) && (
|
|
||||||
<SalesReportTable type='detail' initialValues={salesReport.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ const ClosingOverheadTable = ({
|
|||||||
}: ClosingOverheadTableProps) => {
|
}: ClosingOverheadTableProps) => {
|
||||||
const { data: overhead, isLoading: isLoadingOverhead } = useSWR(
|
const { data: overhead, isLoading: isLoadingOverhead } = useSWR(
|
||||||
`${ClosingApi.basePath}/${projectFlockId}/overhead`,
|
`${ClosingApi.basePath}/${projectFlockId}/overhead`,
|
||||||
() => ClosingApi.getOverhead(projectFlockId)
|
() => ClosingApi.getOverhead(projectFlockId),
|
||||||
|
{
|
||||||
|
keepPreviousData: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Helper function to create columns with footer support
|
// Helper function to create columns with footer support
|
||||||
@@ -66,7 +69,7 @@ const ClosingOverheadTable = ({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: 'Realisai',
|
header: 'Realisasi',
|
||||||
footer: '',
|
footer: '',
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ const ClosingSapronakCalculationTable = ({
|
|||||||
}: ClosingSapronakCalculationTableProps) => {
|
}: ClosingSapronakCalculationTableProps) => {
|
||||||
const { data: sapronakCalculation, isLoading } = useSWR(
|
const { data: sapronakCalculation, isLoading } = useSWR(
|
||||||
`/closing/sapronak-calculation/${projectFlockId}`,
|
`/closing/sapronak-calculation/${projectFlockId}`,
|
||||||
() => ClosingApi.getPerhitunganSapronak(projectFlockId)
|
() => ClosingApi.getPerhitunganSapronak(projectFlockId),
|
||||||
|
{
|
||||||
|
keepPreviousData: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Helper function to create columns with footer support
|
// Helper function to create columns with footer support
|
||||||
|
|||||||
@@ -62,13 +62,13 @@ const ProjectFlockClosingForm = ({
|
|||||||
const errorStock = useMemo(() => {
|
const errorStock = useMemo(() => {
|
||||||
return isResponseSuccess(closingData)
|
return isResponseSuccess(closingData)
|
||||||
? closingData?.data?.stock_remaining.every((stock) => stock.quantity > 0)
|
? closingData?.data?.stock_remaining.every((stock) => stock.quantity > 0)
|
||||||
: false;
|
: true;
|
||||||
}, [closingData]);
|
}, [closingData]);
|
||||||
|
|
||||||
const errorExpense = useMemo(() => {
|
const errorExpense = useMemo(() => {
|
||||||
return isResponseSuccess(closingData)
|
return isResponseSuccess(closingData)
|
||||||
? closingData?.data?.expenses.every((expense) => expense.step < 5)
|
? closingData?.data?.expenses.every((expense) => expense.step < 5)
|
||||||
: false;
|
: true;
|
||||||
}, [closingData]);
|
}, [closingData]);
|
||||||
|
|
||||||
const isCanCloseValid = !errorStock && !errorExpense;
|
const isCanCloseValid = !errorStock && !errorExpense;
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ const ProjectFlockDetail = ({
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href={`/production/project-flock/closing?projectFlockId=${projectFlock.id}&projectFlockKandangId=${selectedKandangId}`}
|
href={`/production/project-flock/closing?projectFlockId=${projectFlock.id}&projectFlockKandangId=${selectedKandang?.project_flock_kandang_id}`}
|
||||||
className='m-0 p-0'
|
className='m-0 p-0'
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user