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,
|
HppPurchaseData,
|
||||||
ProfitLossDataAmount,
|
ProfitLossDataAmount,
|
||||||
} from '@/types/api/closing';
|
} from '@/types/api/closing';
|
||||||
|
import { useSearchParams } from 'next/navigation';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
type HppTableRow =
|
type HppTableRow =
|
||||||
@@ -55,9 +56,16 @@ const ClosingFinanceTable = ({
|
|||||||
}: {
|
}: {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
}) => {
|
}) => {
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const kandangId = searchParams.get('kandangId');
|
||||||
|
|
||||||
const { data: finance, isLoading } = useSWR(
|
const { data: finance, isLoading } = useSWR(
|
||||||
`/closing/finance/${projectFlockId}`,
|
`/closing/finance/${projectFlockId}${kandangId ? `/${kandangId}` : ''}`,
|
||||||
() => ClosingApi.getFinance(projectFlockId)
|
() =>
|
||||||
|
ClosingApi.getFinance(
|
||||||
|
projectFlockId,
|
||||||
|
kandangId ? Number(kandangId) : undefined
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const staticHppRows: Array<{
|
const staticHppRows: Array<{
|
||||||
@@ -283,6 +291,7 @@ const ClosingFinanceTable = ({
|
|||||||
<div className='mt-6 p-0 mb-0'>
|
<div className='mt-6 p-0 mb-0'>
|
||||||
<Table<HppTableRow>
|
<Table<HppTableRow>
|
||||||
data={hppTableData}
|
data={hppTableData}
|
||||||
|
isLoading={isLoading}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
header: 'No.',
|
header: 'No.',
|
||||||
@@ -455,6 +464,7 @@ const ClosingFinanceTable = ({
|
|||||||
<div className='mt-6 p-0 mb-0'>
|
<div className='mt-6 p-0 mb-0'>
|
||||||
<Table<ProfitLossTableRow>
|
<Table<ProfitLossTableRow>
|
||||||
data={profitLossTableData}
|
data={profitLossTableData}
|
||||||
|
isLoading={isLoading}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
header: 'Jenis',
|
header: 'Jenis',
|
||||||
|
|||||||
@@ -148,10 +148,11 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getFinance(
|
async getFinance(
|
||||||
id: number
|
id: number,
|
||||||
|
kandangId?: number
|
||||||
): Promise<BaseApiResponse<ClosingFinance> | undefined> {
|
): Promise<BaseApiResponse<ClosingFinance> | undefined> {
|
||||||
try {
|
try {
|
||||||
const path = `${this.basePath}/${id}/keuangan`;
|
const path = `${this.basePath}/${id}${kandangId ? `/${kandangId}` : ''}/keuangan`;
|
||||||
return await httpClient<BaseApiResponse<ClosingFinance>>(path, {
|
return await httpClient<BaseApiResponse<ClosingFinance>>(path, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user