diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ee8a79a5..935cac46 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -165,8 +165,6 @@ deploy:staging:
environment:
name: staging
url: https://stg-lti-erp.mbugroup.id
-
-
# ====== PRODUCTION ======
# build:production:
# <<: *build_template
diff --git a/src/components/pages/closing/ClosingDetail.tsx b/src/components/pages/closing/ClosingDetail.tsx
index dc06eb22..b814986b 100644
--- a/src/components/pages/closing/ClosingDetail.tsx
+++ b/src/components/pages/closing/ClosingDetail.tsx
@@ -15,7 +15,7 @@ import {
} from '@/types/api/closing';
import ClosingSapronakCalculationTabContent from '@/components/pages/closing/ClosingSapronakCalculationTabContent';
import ClosingOverheadTabContent from '@/components/pages/closing/ClosingOverheadTabContent';
-import SalesReportTable from './sale/SalesReportTable';
+import SalesReportTable from '@/components/pages/closing/sale/SalesReportTable';
interface ClosingDetailProps {
id: number;
diff --git a/src/components/pages/closing/ClosingProductionDataTabContent.tsx b/src/components/pages/closing/ClosingProductionDataTabContent.tsx
index ba8a12ed..bffe1707 100644
--- a/src/components/pages/closing/ClosingProductionDataTabContent.tsx
+++ b/src/components/pages/closing/ClosingProductionDataTabContent.tsx
@@ -33,7 +33,7 @@ const ClosingProductionDataTabContent = ({
);
}
- const { purchase, sales, performance, variance } = productionData.data;
+ const { purchase, sales, performance } = productionData.data;
// Helper for consistent row styling
const DataRow = ({
@@ -58,39 +58,6 @@ const ClosingProductionDataTabContent = ({
);
- // Helper for rows with two values (e.g., Deplesi: Ekor & %)
- const DoubleDataRow = ({
- label,
- value1,
- unit1,
- value2,
- unit2,
- value1ClassName = 'font-bold text-gray-800',
- value2ClassName = 'font-bold text-blue-500',
- }: {
- label: string;
- value1: string | number;
- unit1: string;
- value2: string | number;
- unit2: string;
- value1ClassName?: string;
- value2ClassName?: string;
- }) => (
-
-
{label}
-
-
- {value1}
- {unit1}
-
-
- {value2}
- {unit2}
-
-
-
- );
-
return (
Data Produksi
@@ -121,17 +88,17 @@ const ClosingProductionDataTabContent = ({
/>
@@ -142,27 +109,61 @@ const ClosingProductionDataTabContent = ({
Penjualan
-
-
-
-
-
+
+ {/* Chicken Sales */}
+
+
+
+
+
+
+
+ {/* Egg Sales (if available) */}
+ {sales.egg && (
+ <>
+
+
+
+
+
+
+
+ >
+ )}
@@ -178,24 +179,20 @@ const ClosingProductionDataTabContent = ({
Performance
-
-
-
-
-
- {/* Variance Section (Pushed to bottom) */}
-
diff --git a/src/dummy/closing.dummy.ts b/src/dummy/closing.dummy.ts
index 3a20cdaf..3b9a9a7b 100644
--- a/src/dummy/closing.dummy.ts
+++ b/src/dummy/closing.dummy.ts
@@ -83,6 +83,7 @@ import {
ClosingIncomingSapronak,
ClosingOutgoingSapronak,
ClosingOverhead,
+ ClosingProductionData,
ClosingSapronakCalculation,
} from '@/types/api/closing';
import { CreatedUser, BaseApiResponse } from '@/types/api/api-general';
@@ -1134,3 +1135,41 @@ export const dummyGetOverhead = async (
data: dummyOverhead,
};
};
+
+export const dummyClosingProductionData: ClosingProductionData = {
+ purchase: {
+ initial_population: 12000,
+ claim_culling: 150,
+ final_population: 11850,
+ feed_in: 24000,
+ feed_used: 22500,
+ feed_used_per_head: 1.9,
+ },
+
+ sales: {
+ chicken: {
+ sales_population: 10500,
+ sales_weight: 21000,
+ average_weight: 2.0,
+ chicken_average_selling_price: 28500,
+ },
+ egg: {
+ egg_pieces: 185000,
+ egg_mass_kg: 9250,
+ average_egg_weight_kg: 0.05,
+ egg_average_selling_price: 1800,
+ },
+ },
+
+ performance: {
+ depletion: 150,
+ age_day: 35,
+ mortality_std: 3.5,
+ mortality_act: 4.2,
+ deff_mortality: 0.7,
+ fcr_std: 1.6,
+ fcr_act: 1.72,
+ deff_fcr: 0.12,
+ awg: 60,
+ },
+};
diff --git a/src/services/api/closing.ts b/src/services/api/closing.ts
index 279cdd7c..21ae1cf8 100644
--- a/src/services/api/closing.ts
+++ b/src/services/api/closing.ts
@@ -6,11 +6,13 @@ import {
ClosingGeneralInformation,
ClosingIncomingSapronak,
ClosingOutgoingSapronak,
- ClosingProductionData,
ClosingOverhead,
ClosingSapronakCalculation,
+ ClosingProductionData,
} from '@/types/api/closing';
import { BaseApiResponse } from '@/types/api/api-general';
+
+// TODO: delete these dummy data later
import {
dummyGetAllFetcher,
dummyGetSingle,
@@ -19,55 +21,12 @@ import {
dummyGetGeneralInfo,
dummyGetPerhitunganSapronak,
dummyGetOverhead,
+ dummyClosingProductionData,
} from '@/dummy/closing.dummy';
import { httpClient, httpClientFetcher } from '@/services/http/client';
import { ClosingSales } from '@/types/api/closing';
import { sleep } from '@/lib/helper';
-export const dummyClosingProductionResponse: BaseApiResponse =
- {
- code: 200,
- status: 'success',
- message: 'Closing production data fetched successfully',
- data: {
- purchase: {
- initial_population: 10_000,
- claim_culling: 150,
- final_population: 9_850,
- feed_in_kg: 18_000,
- feed_used_kg: 17_200,
- feed_used_per_head_kg: 1.75,
- },
-
- sales: {
- sales_kg: 18_500,
- sales_head: 9_600,
- average_weight_kg: 1.93,
- average_price_per_kg: 20_500,
- },
-
- performance: {
- depletion_head: 400,
- depletion_percentage: 4,
- age_days: 35,
- mortality_std: 3.5,
- mortality_act: 4,
- deff_mortality: 0.5,
- fcr_std: 1.6,
- fcr_act: 1.72,
- deff_fcr: 0.12,
- adg: 55,
- ip: 320,
- },
-
- variance: {
- variance_head: -250,
- variance_head_percentage: -2.5,
- variance_feed_kg: -800,
- },
- },
- };
-
export class ClosingApiService extends BaseApiService {
constructor(basePath: string) {
super(basePath);
@@ -180,17 +139,16 @@ export class ClosingApiService extends BaseApiService {
}
}
- async getProductionData(id: number) {
+ async getProductionData(
+ id: number
+ ): Promise | undefined> {
try {
- // const getProductionDataPath = `${this.basePath}/${id}/production-data`;
- // const getProductionDataRes = await httpClient<
- // BaseApiResponse
- // >(getProductionDataPath);
+ const getProductionDataPath = `${this.basePath}/${id}/production-data`;
+ const getProductionDataRes = await httpClient<
+ BaseApiResponse
+ >(getProductionDataPath);
- // return getProductionDataRes;
-
- await sleep(1000);
- return dummyClosingProductionResponse;
+ return getProductionDataRes;
} catch (error) {
if (axios.isAxiosError>(error)) {
return error.response?.data;
diff --git a/src/types/api/closing.d.ts b/src/types/api/closing.d.ts
index 44819613..6fc8ac71 100644
--- a/src/types/api/closing.d.ts
+++ b/src/types/api/closing.d.ts
@@ -23,6 +23,33 @@ export type BaseSales = {
payment_status: string;
};
+export type BaseClosingSales = {
+ project_type: string;
+ flock_id: number;
+ period: number;
+ sales: BaseSales[];
+};
+import { Kandang } from '@/types/api/master-data/kandang';
+import { Product } from '@type/api/master-data/product';
+import { Customer } from '@type/api/master-data/customer';
+import { BaseMetadata } from '@/types/api/api-general';
+
+export type BaseSales = {
+ id: number;
+ realization_date: string;
+ age: number;
+ do_number: string;
+ product: Product;
+ customer: Customer;
+ qty: number;
+ weight: number;
+ avg_weight: number;
+ price: number;
+ total_price: number;
+ kandang: Kandang;
+ payment_status: string;
+};
+
export type BaseClosingSales = {
project_type: string;
flock_id: number;
@@ -84,33 +111,36 @@ export type ClosingProductionData = {
initial_population: number;
claim_culling: number;
final_population: number;
- feed_in_kg: number;
- feed_used_kg: number;
- feed_used_per_head_kg: number;
+ feed_in: number;
+ feed_used: number;
+ feed_used_per_head: number;
};
+
sales: {
- sales_kg: number;
- sales_head: number;
- average_weight_kg: number;
- average_price_per_kg: number;
+ chicken: {
+ sales_population: number;
+ sales_weight: number;
+ average_weight: number;
+ chicken_average_selling_price: number;
+ };
+ egg?: {
+ egg_pieces: number;
+ egg_mass_kg: number;
+ average_egg_weight_kg: number;
+ egg_average_selling_price: number;
+ };
};
+
performance: {
- depletion_head: number;
- depletion_percentage: number;
- age_days: number;
+ depletion: number;
+ age_day: number;
mortality_std: number;
mortality_act: number;
deff_mortality: number;
fcr_std: number;
fcr_act: number;
deff_fcr: number;
- adg: number;
- ip: number;
- };
- variance: {
- variance_head: number;
- variance_head_percentage: number;
- variance_feed_kg: number;
+ awg: number;
};
};
@@ -176,4 +206,5 @@ export type OverheadTotal = {
actual_total_amount: number;
cost_per_bird: number;
};
+
export type ClosingSales = BaseMetadata & BaseClosingSales;