mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 23:35:45 +00:00
refactor(FE): Refactor component and file names for consistency
This commit is contained in:
@@ -6,19 +6,19 @@ import { Icon } from '@iconify/react';
|
|||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import Tabs from '@/components/Tabs';
|
import Tabs from '@/components/Tabs';
|
||||||
import ClosingGeneralInformationTable from '@/components/pages/closing/ClosingGeneralInformationTable';
|
import ClosingGeneralInformationTable from '@/components/pages/closing/ClosingGeneralInformationTable';
|
||||||
import ClosingSapronakTabContent from '@/components/pages/closing/tab/ClosingSapronakTabContent';
|
import SapronakClosingTab from '@/components/pages/closing/tab/SapronakClosingTab';
|
||||||
import ClosingProductionDataTabContent from '@/components/pages/closing/tab/ClosingProductionDataTabContent';
|
import ProductionDataClosingTab from '@/components/pages/closing/tab/ProductionDataClosingTab';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ClosingGeneralInformation,
|
ClosingGeneralInformation,
|
||||||
BaseClosingSales,
|
BaseClosingSales,
|
||||||
ClosingHppExpedition,
|
ClosingHppExpedition,
|
||||||
} from '@/types/api/closing';
|
} from '@/types/api/closing';
|
||||||
import ClosingSapronakCalculationTabContent from '@/components/pages/closing/tab/ClosingSapronakCalculationTabContent';
|
import SapronakCalculationClosingTab from '@/components/pages/closing/tab/SapronakCalculationClosingTab';
|
||||||
import ClosingOverheadTabContent from '@/components/pages/closing/tab/ClosingOverheadTabContent';
|
import OverheadClosingTab from '@/components/pages/closing/tab/OverheadClosingTab';
|
||||||
import ClosingFinanceTabContent from '@/components/pages/closing/tab/ClosingFinanceTabContent';
|
import FinanceClosingTab from '@/components/pages/closing/tab/FinanceClosingTab';
|
||||||
import SalesReportTable from '@/components/pages/closing/table/SalesReportTable';
|
import SalesClosingTable from '@/components/pages/closing/table/SalesClosingTable';
|
||||||
import HppExpeditionReportTable from './table/HppExpeditionReportTable';
|
import HppExpeditionClosingTable from './table/HppExpeditionClosingTable';
|
||||||
import ClosingKandangList from '@/components/pages/closing/ClosingKandangList';
|
import ClosingKandangList from '@/components/pages/closing/ClosingKandangList';
|
||||||
import { ProjectFlock } from '@/types/api/production/project-flock';
|
import { ProjectFlock } from '@/types/api/production/project-flock';
|
||||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||||
@@ -46,13 +46,13 @@ const ClosingDetail: React.FC<ClosingDetailProps> = ({
|
|||||||
{
|
{
|
||||||
id: 'sapronak',
|
id: 'sapronak',
|
||||||
label: 'Sapronak',
|
label: 'Sapronak',
|
||||||
content: <ClosingSapronakTabContent projectFlockId={id} />,
|
content: <SapronakClosingTab projectFlockId={id} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'perhitunganSapronak',
|
id: 'perhitunganSapronak',
|
||||||
label: 'Perhitungan Sapronak',
|
label: 'Perhitungan Sapronak',
|
||||||
content: (
|
content: (
|
||||||
<ClosingSapronakCalculationTabContent
|
<SapronakCalculationClosingTab
|
||||||
closingGeneralInformation={initialValue}
|
closingGeneralInformation={initialValue}
|
||||||
projectFlockId={id}
|
projectFlockId={id}
|
||||||
/>
|
/>
|
||||||
@@ -61,13 +61,13 @@ const ClosingDetail: React.FC<ClosingDetailProps> = ({
|
|||||||
{
|
{
|
||||||
id: 'penjualan',
|
id: 'penjualan',
|
||||||
label: 'Penjualan',
|
label: 'Penjualan',
|
||||||
content: <SalesReportTable initialValues={salesData} />,
|
content: <SalesClosingTable initialValues={salesData} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'overhead',
|
id: 'overhead',
|
||||||
label: 'Overhead',
|
label: 'Overhead',
|
||||||
content: (
|
content: (
|
||||||
<ClosingOverheadTabContent
|
<OverheadClosingTab
|
||||||
projectFlockId={id}
|
projectFlockId={id}
|
||||||
generalInformation={initialValue}
|
generalInformation={initialValue}
|
||||||
kandangData={kandangData}
|
kandangData={kandangData}
|
||||||
@@ -77,17 +77,19 @@ const ClosingDetail: React.FC<ClosingDetailProps> = ({
|
|||||||
{
|
{
|
||||||
id: 'hppEkspedisi',
|
id: 'hppEkspedisi',
|
||||||
label: 'HPP Ekspedisi',
|
label: 'HPP Ekspedisi',
|
||||||
content: <HppExpeditionReportTable initialValues={hppExpeditionData} />,
|
content: (
|
||||||
|
<HppExpeditionClosingTable initialValues={hppExpeditionData} />
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'dataProduksi',
|
id: 'dataProduksi',
|
||||||
label: 'Data Produksi',
|
label: 'Data Produksi',
|
||||||
content: <ClosingProductionDataTabContent projectFlockId={id} />,
|
content: <ProductionDataClosingTab projectFlockId={id} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'keuangan',
|
id: 'keuangan',
|
||||||
label: 'Keuangan',
|
label: 'Keuangan',
|
||||||
content: <ClosingFinanceTabContent projectFlockId={id} />,
|
content: <FinanceClosingTab projectFlockId={id} />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import ClosingFinanceTable from '@/components/pages/closing/table/ClosingFinanceTable';
|
|
||||||
|
|
||||||
const ClosingFinanceTabContent = ({
|
|
||||||
projectFlockId,
|
|
||||||
}: {
|
|
||||||
projectFlockId: number;
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<div className='flex flex-col gap-4'>
|
|
||||||
{projectFlockId && (
|
|
||||||
<ClosingFinanceTable projectFlockId={projectFlockId} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ClosingFinanceTabContent;
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import ClosingIncomingSapronaksTable from '@/components/pages/closing/table/ClosingIncomingSapronaksTable';
|
|
||||||
import ClosingOutgoingSapronaksTable from '@/components/pages/closing/table/ClosingOutgoingSapronaksTable';
|
|
||||||
import ClosingIncomingSapronaksSummaryTable from '@/components/pages/closing/table/ClosingIncomingSapronaksSummaryTable';
|
|
||||||
import ClosingOutgoingSapronaksSummaryTable from '../table/ClosingOutgoingSapronaksSummaryTable';
|
|
||||||
|
|
||||||
interface ClosingSapronakTableProps {
|
|
||||||
projectFlockId?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ClosingSapronakTabContent = ({
|
|
||||||
projectFlockId,
|
|
||||||
}: ClosingSapronakTableProps) => {
|
|
||||||
return (
|
|
||||||
<div className='flex flex-col gap-4'>
|
|
||||||
{projectFlockId && (
|
|
||||||
<>
|
|
||||||
<ClosingIncomingSapronaksTable projectFlockId={projectFlockId} />
|
|
||||||
|
|
||||||
<ClosingIncomingSapronaksSummaryTable
|
|
||||||
projectFlockId={projectFlockId}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ClosingOutgoingSapronaksTable projectFlockId={projectFlockId} />
|
|
||||||
|
|
||||||
<ClosingOutgoingSapronaksSummaryTable
|
|
||||||
projectFlockId={projectFlockId}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ClosingSapronakTabContent;
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import FinanceClosingTable from '@/components/pages/closing/table/FinanceClosingTable';
|
||||||
|
|
||||||
|
const FinanceClosingTab = ({ projectFlockId }: { projectFlockId: number }) => {
|
||||||
|
return (
|
||||||
|
<div className='flex flex-col gap-4'>
|
||||||
|
{projectFlockId && (
|
||||||
|
<FinanceClosingTable projectFlockId={projectFlockId} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FinanceClosingTab;
|
||||||
+6
-6
@@ -1,22 +1,22 @@
|
|||||||
import ClosingOverheadTable from '@/components/pages/closing/table/ClosingOverheadTable';
|
import OverheadClosingTable from '@/components/pages/closing/table/OverheadClosingTable';
|
||||||
import { ClosingGeneralInformation } from '@/types/api/closing';
|
import { ClosingGeneralInformation } from '@/types/api/closing';
|
||||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||||
|
|
||||||
interface ClosingOverheadTabContentProps {
|
interface OverheadClosingTabProps {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
generalInformation?: ClosingGeneralInformation;
|
generalInformation?: ClosingGeneralInformation;
|
||||||
kandangData?: ProjectFlockKandang;
|
kandangData?: ProjectFlockKandang;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClosingOverheadTabContent = ({
|
const OverheadClosingTab = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
generalInformation,
|
generalInformation,
|
||||||
kandangData,
|
kandangData,
|
||||||
}: ClosingOverheadTabContentProps) => {
|
}: OverheadClosingTabProps) => {
|
||||||
return (
|
return (
|
||||||
<div className='flex flex-col gap-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{projectFlockId && (
|
{projectFlockId && (
|
||||||
<ClosingOverheadTable
|
<OverheadClosingTable
|
||||||
projectFlockId={projectFlockId}
|
projectFlockId={projectFlockId}
|
||||||
generalInformation={generalInformation}
|
generalInformation={generalInformation}
|
||||||
kandangData={kandangData}
|
kandangData={kandangData}
|
||||||
@@ -26,4 +26,4 @@ const ClosingOverheadTabContent = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingOverheadTabContent;
|
export default OverheadClosingTab;
|
||||||
+4
-4
@@ -6,13 +6,13 @@ import { ClosingApi } from '@/services/api/closing';
|
|||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseSuccess } from '@/lib/api-helper';
|
||||||
import { formatNumber } from '@/lib/helper';
|
import { formatNumber } from '@/lib/helper';
|
||||||
|
|
||||||
interface ClosingProductionDataTabContentProps {
|
interface ProductionDataClosingTabProps {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClosingProductionDataTabContent = ({
|
const ProductionDataClosingTab = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
}: ClosingProductionDataTabContentProps) => {
|
}: ProductionDataClosingTabProps) => {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const kandangId = searchParams.get('kandangId');
|
const kandangId = searchParams.get('kandangId');
|
||||||
|
|
||||||
@@ -305,4 +305,4 @@ const ClosingProductionDataTabContent = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingProductionDataTabContent;
|
export default ProductionDataClosingTab;
|
||||||
+6
-6
@@ -1,22 +1,22 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import ClosingSapronakCalculationTable from '@/components/pages/closing/table/ClosingSapronakCalculationTable';
|
import SapronakCalculationClosingTable from '@/components/pages/closing/table/SapronakCalculationClosingTable';
|
||||||
import { ClosingGeneralInformation } from '@/types/api/closing';
|
import { ClosingGeneralInformation } from '@/types/api/closing';
|
||||||
|
|
||||||
interface ClosingSapronakCalculationTabContentProps {
|
interface SapronakCalculationClosingTabProps {
|
||||||
projectFlockId?: number;
|
projectFlockId?: number;
|
||||||
closingGeneralInformation?: ClosingGeneralInformation;
|
closingGeneralInformation?: ClosingGeneralInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClosingSapronakCalculationTabContent = ({
|
const SapronakCalculationClosingTab = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
closingGeneralInformation,
|
closingGeneralInformation,
|
||||||
}: ClosingSapronakCalculationTabContentProps) => {
|
}: SapronakCalculationClosingTabProps) => {
|
||||||
return (
|
return (
|
||||||
<div className='flex flex-col gap-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{projectFlockId && (
|
{projectFlockId && (
|
||||||
<>
|
<>
|
||||||
<ClosingSapronakCalculationTable
|
<SapronakCalculationClosingTable
|
||||||
closingGeneralInformation={closingGeneralInformation}
|
closingGeneralInformation={closingGeneralInformation}
|
||||||
projectFlockId={projectFlockId}
|
projectFlockId={projectFlockId}
|
||||||
/>
|
/>
|
||||||
@@ -26,4 +26,4 @@ const ClosingSapronakCalculationTabContent = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingSapronakCalculationTabContent;
|
export default SapronakCalculationClosingTab;
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import IncomingSapronaksTable from '@/components/pages/closing/table/IncomingSapronaksTable';
|
||||||
|
import OutgoingSapronaksTable from '@/components/pages/closing/table/OutgoingSapronaksTable';
|
||||||
|
import IncomingSapronaksSummaryTable from '@/components/pages/closing/table/IncomingSapronaksSummaryTable';
|
||||||
|
import ClosingOutgoingSapronaksSummaryTable from '../table/OutgoingSapronaksSummaryTable';
|
||||||
|
|
||||||
|
interface SapronakClosingTabProps {
|
||||||
|
projectFlockId?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SapronakClosingTab = ({ projectFlockId }: SapronakClosingTabProps) => {
|
||||||
|
return (
|
||||||
|
<div className='flex flex-col gap-4'>
|
||||||
|
{projectFlockId && (
|
||||||
|
<>
|
||||||
|
<IncomingSapronaksTable projectFlockId={projectFlockId} />
|
||||||
|
|
||||||
|
<IncomingSapronaksSummaryTable projectFlockId={projectFlockId} />
|
||||||
|
|
||||||
|
<OutgoingSapronaksTable projectFlockId={projectFlockId} />
|
||||||
|
|
||||||
|
<ClosingOutgoingSapronaksSummaryTable
|
||||||
|
projectFlockId={projectFlockId}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SapronakClosingTab;
|
||||||
+2
-2
@@ -8,7 +8,7 @@ import { useSearchParams } from 'next/navigation';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
const ClosingFinanceTable = ({
|
const FinanceClosingTable = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
}: {
|
}: {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
@@ -396,4 +396,4 @@ const ClosingFinanceTable = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingFinanceTable;
|
export default FinanceClosingTable;
|
||||||
+4
-4
@@ -7,14 +7,14 @@ import Card from '@/components/Card';
|
|||||||
import { formatCurrency } from '@/lib/helper';
|
import { formatCurrency } from '@/lib/helper';
|
||||||
import { BaseHppExpedition, BaseExpeditionCost } from '@/types/api/closing';
|
import { BaseHppExpedition, BaseExpeditionCost } from '@/types/api/closing';
|
||||||
|
|
||||||
interface HppExpeditionReportTableProps {
|
interface HppExpeditionClosingTableProps {
|
||||||
type?: 'detail';
|
type?: 'detail';
|
||||||
initialValues?: BaseHppExpedition;
|
initialValues?: BaseHppExpedition;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HppExpeditionReportTable = ({
|
const HppExpeditionClosingTable = ({
|
||||||
initialValues,
|
initialValues,
|
||||||
}: HppExpeditionReportTableProps) => {
|
}: HppExpeditionClosingTableProps) => {
|
||||||
const costOfRevenueExpeditionData: BaseExpeditionCost[] = useMemo(() => {
|
const costOfRevenueExpeditionData: BaseExpeditionCost[] = useMemo(() => {
|
||||||
return initialValues?.expedition_costs || [];
|
return initialValues?.expedition_costs || [];
|
||||||
}, [initialValues]);
|
}, [initialValues]);
|
||||||
@@ -106,4 +106,4 @@ const HppExpeditionReportTable = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default HppExpeditionReportTable;
|
export default HppExpeditionClosingTable;
|
||||||
+4
-4
@@ -15,17 +15,17 @@ import { useSearchParams } from 'next/navigation';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
interface ClosingOverheadTableProps {
|
interface OverheadClosingTableProps {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
generalInformation?: ClosingGeneralInformation;
|
generalInformation?: ClosingGeneralInformation;
|
||||||
kandangData?: ProjectFlockKandang;
|
kandangData?: ProjectFlockKandang;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClosingOverheadTable = ({
|
const OverheadClosingTable = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
generalInformation,
|
generalInformation,
|
||||||
kandangData,
|
kandangData,
|
||||||
}: ClosingOverheadTableProps) => {
|
}: OverheadClosingTableProps) => {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const kandangId = searchParams.get('kandangId');
|
const kandangId = searchParams.get('kandangId');
|
||||||
|
|
||||||
@@ -302,4 +302,4 @@ const ClosingOverheadTable = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingOverheadTable;
|
export default OverheadClosingTable;
|
||||||
+3
-3
@@ -14,12 +14,12 @@ import { Product } from '@/types/api/master-data/product';
|
|||||||
import { Customer } from '@/types/api/master-data/customer';
|
import { Customer } from '@/types/api/master-data/customer';
|
||||||
import { Kandang } from '@/types/api/master-data/kandang';
|
import { Kandang } from '@/types/api/master-data/kandang';
|
||||||
|
|
||||||
interface SalesReportTableProps {
|
interface SalesClosingTableProps {
|
||||||
type?: 'detail';
|
type?: 'detail';
|
||||||
initialValues?: BaseClosingSales;
|
initialValues?: BaseClosingSales;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SalesReportTable = ({ initialValues }: SalesReportTableProps) => {
|
const SalesClosingTable = ({ initialValues }: SalesClosingTableProps) => {
|
||||||
const salesData: BaseSales[] = useMemo(() => {
|
const salesData: BaseSales[] = useMemo(() => {
|
||||||
return initialValues?.sales || [];
|
return initialValues?.sales || [];
|
||||||
}, [initialValues]);
|
}, [initialValues]);
|
||||||
@@ -330,4 +330,4 @@ const SalesReportTable = ({ initialValues }: SalesReportTableProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SalesReportTable;
|
export default SalesClosingTable;
|
||||||
+4
-4
@@ -16,15 +16,15 @@ import { isResponseSuccess } from '@/lib/api-helper';
|
|||||||
import { ClosingGeneralInformation } from '@/types/api/closing';
|
import { ClosingGeneralInformation } from '@/types/api/closing';
|
||||||
import { useSearchParams } from 'next/navigation';
|
import { useSearchParams } from 'next/navigation';
|
||||||
|
|
||||||
interface ClosingSapronakCalculationTableProps {
|
interface SapronakCalculationClosingTableProps {
|
||||||
projectFlockId: number;
|
projectFlockId: number;
|
||||||
closingGeneralInformation?: ClosingGeneralInformation;
|
closingGeneralInformation?: ClosingGeneralInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClosingSapronakCalculationTable = ({
|
const SapronakCalculationClosingTable = ({
|
||||||
projectFlockId,
|
projectFlockId,
|
||||||
closingGeneralInformation,
|
closingGeneralInformation,
|
||||||
}: ClosingSapronakCalculationTableProps) => {
|
}: SapronakCalculationClosingTableProps) => {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const kandangId = searchParams.get('kandangId');
|
const kandangId = searchParams.get('kandangId');
|
||||||
|
|
||||||
@@ -265,4 +265,4 @@ const ClosingSapronakCalculationTable = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ClosingSapronakCalculationTable;
|
export default SapronakCalculationClosingTable;
|
||||||
Reference in New Issue
Block a user