refactor(FE): Nest project_flock in Recording and update UI

This commit is contained in:
rstubryan
2026-01-13 16:01:30 +07:00
parent 34d7310cc9
commit e77a43300a
3 changed files with 98 additions and 46 deletions
+32 -12
View File
@@ -1,34 +1,52 @@
import { BaseApproval, BaseMetadata, User } from '@/types/api/api-general';
import { ProductWarehouse } from '@/types/api/inventory/product-warehouse';
import { Warehouse } from '@/types/api/master-data/warehouse';
export type ProductionStandard = {
id: number;
week: number;
name: string;
hen_day_std: number;
hen_house_std: number;
feed_intake_std: number;
max_depletion_std: number;
egg_mass_std: number;
egg_weight_std: number;
};
export type FCR = {
id: number;
name: string;
fcr_std: number;
};
export type ProjectFlock = {
project_flock_kandang_id: number;
flock_name: string;
project_flock_category: 'GROWING' | 'LAYING';
period: number;
production_standart: ProductionStandard;
fcr: FCR;
total_chick_qty: number;
};
export type ProductionMetrics = {
total_depletion_qty: number;
cum_depletion_rate: number;
cum_intake: number;
fcr_value: number;
fcr_std?: number;
total_chick_qty: number;
hen_day?: number;
hen_house?: number;
feed_intake?: number;
feed_intake_std?: number;
egg_mass?: number;
egg_weight?: number;
hen_day_std?: number;
hen_house_std?: number;
egg_mass_std?: number;
egg_weight_std?: number;
daily_gain?: number;
avg_daily_gain?: number;
cum_depletion?: number;
};
export type BaseRecording = {
id: number;
project_flock_kandang_id: number;
project_flock: ProjectFlock;
record_datetime: string;
day: number;
project_flock_category?: 'GROWING' | 'LAYING';
} & ProductionMetrics;
export type RecordingDepletion = {
@@ -68,6 +86,8 @@ export type Recording = BaseMetadata &
BaseRecording & {
approval?: BaseApproval;
created_user: User;
warehouse?: Warehouse;
product_category?: 'GROWING' | 'LAYING';
depletions?: RecordingDepletion[];
stocks?: RecordingStock[];
eggs?: RecordingEgg[];