mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'feat/closing-finance-kandang' into 'development'
[FEAT/FE] Closing Finance Kandang See merge request mbugroup/lti-web-client!176
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
HppPurchaseData,
|
||||
ProfitLossDataAmount,
|
||||
} from '@/types/api/closing';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
|
||||
type HppTableRow =
|
||||
@@ -55,9 +56,16 @@ const ClosingFinanceTable = ({
|
||||
}: {
|
||||
projectFlockId: number;
|
||||
}) => {
|
||||
const searchParams = useSearchParams();
|
||||
const kandangId = searchParams.get('kandangId');
|
||||
|
||||
const { data: finance, isLoading } = useSWR(
|
||||
`/closing/finance/${projectFlockId}`,
|
||||
() => ClosingApi.getFinance(projectFlockId)
|
||||
`/closing/finance/${projectFlockId}${kandangId ? `/${kandangId}` : ''}`,
|
||||
() =>
|
||||
ClosingApi.getFinance(
|
||||
projectFlockId,
|
||||
kandangId ? Number(kandangId) : undefined
|
||||
)
|
||||
);
|
||||
|
||||
const staticHppRows: Array<{
|
||||
@@ -283,6 +291,7 @@ const ClosingFinanceTable = ({
|
||||
<div className='mt-6 p-0 mb-0'>
|
||||
<Table<HppTableRow>
|
||||
data={hppTableData}
|
||||
isLoading={isLoading}
|
||||
columns={[
|
||||
{
|
||||
header: 'No.',
|
||||
@@ -455,6 +464,7 @@ const ClosingFinanceTable = ({
|
||||
<div className='mt-6 p-0 mb-0'>
|
||||
<Table<ProfitLossTableRow>
|
||||
data={profitLossTableData}
|
||||
isLoading={isLoading}
|
||||
columns={[
|
||||
{
|
||||
header: 'Jenis',
|
||||
|
||||
@@ -148,10 +148,11 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
}
|
||||
|
||||
async getFinance(
|
||||
id: number
|
||||
id: number,
|
||||
kandangId?: number
|
||||
): Promise<BaseApiResponse<ClosingFinance> | undefined> {
|
||||
try {
|
||||
const path = `${this.basePath}/${id}/keuangan`;
|
||||
const path = `${this.basePath}/${id}${kandangId ? `/${kandangId}` : ''}/keuangan`;
|
||||
return await httpClient<BaseApiResponse<ClosingFinance>>(path, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user