refactor(FE): Add record_date to recording payloads

This commit is contained in:
rstubryan
2026-01-14 00:02:44 +07:00
parent a205e57d39
commit 4560073f6a
2 changed files with 5 additions and 0 deletions
@@ -117,8 +117,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
// ===== PAYLOAD CREATION HELPERS ===== // ===== PAYLOAD CREATION HELPERS =====
const createGrowingPayload = useCallback( const createGrowingPayload = useCallback(
(values: RecordingGrowingFormValues) => { (values: RecordingGrowingFormValues) => {
const today = new Date().toISOString().split('T')[0];
return { return {
project_flock_kandang_id: values.project_flock_kandang_id, project_flock_kandang_id: values.project_flock_kandang_id,
record_date: today,
stocks: (values.stocks ?? []).map((stock) => ({ stocks: (values.stocks ?? []).map((stock) => ({
product_warehouse_id: stock.product_warehouse_id, product_warehouse_id: stock.product_warehouse_id,
qty: Number(stock.qty) || 0, qty: Number(stock.qty) || 0,
@@ -134,8 +136,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
const createLayingPayload = useCallback( const createLayingPayload = useCallback(
(values: RecordingLayingFormValues) => { (values: RecordingLayingFormValues) => {
const today = new Date().toISOString().split('T')[0];
return { return {
project_flock_kandang_id: values.project_flock_kandang_id, project_flock_kandang_id: values.project_flock_kandang_id,
record_date: today,
stocks: (values.stocks ?? []).map((stock) => ({ stocks: (values.stocks ?? []).map((stock) => ({
product_warehouse_id: stock.product_warehouse_id, product_warehouse_id: stock.product_warehouse_id,
qty: Number(stock.qty) || 0, qty: Number(stock.qty) || 0,
+1
View File
@@ -101,6 +101,7 @@ export type NextDayRecording = {
export type CreateGrowingRecordingPayload = { export type CreateGrowingRecordingPayload = {
project_flock_kandang_id: number; project_flock_kandang_id: number;
record_date: string;
stocks?: { stocks?: {
product_warehouse_id: number; product_warehouse_id: number;
qty: number; qty: number;