Merge branch 'development' into fix/transfer-to-laying

This commit is contained in:
ValdiANS
2026-01-23 23:07:51 +07:00
17 changed files with 401 additions and 153 deletions
@@ -112,12 +112,16 @@ const SalesReportTable = ({
<div className='font-semibold text-gray-900'>Total Penjualan</div>
),
},
// {
// id: 'age',
// accessorKey: 'age',
// header: 'Umur',
// cell: (props) => props.getValue() || '-',
// },
{
id: 'age',
accessorKey: 'age',
header: 'Umur',
cell: (props) => {
const age = props.row.original.age;
const week = props.row.original.week;
return age && week ? `${age} hari (${week} minggu)` : '-';
},
},
{
id: 'do_number',
accessorKey: 'do_number',
@@ -8,7 +8,7 @@ import SelectInput, {
OptionType,
useSelect,
} from '@/components/input/SelectInput';
import { useState, useEffect, useRef } from 'react';
import { useState, useEffect, useRef, useCallback } from 'react';
import useSWR from 'swr';
import { DashboardApi } from '@/services/api/dashboard';
import { useFormik } from 'formik';
@@ -91,7 +91,6 @@ const DashboardProduction = () => {
isLoadingOptions: isLoadingFlockOptions,
loadMore: loadMoreFlock,
} = useSelect(ProjectFlockApi.basePath, 'id', 'flock_name', '', {
limit: 'limit',
location_id: selectedLocationIds ? selectedLocationIds.toString() : '',
});
const {
@@ -99,16 +98,13 @@ const DashboardProduction = () => {
options: locationOptions,
isLoadingOptions: isLoadingLocationOptions,
loadMore: loadMoreLocation,
} = useSelect(LocationApi.basePath, 'id', 'name', '', {
limit: 'limit',
});
} = useSelect(LocationApi.basePath, 'id', 'name');
const {
setInputValue: setInputValueKandang,
options: kandangOptions,
isLoadingOptions: isLoadingKandangOptions,
loadMore: loadMoreKandang,
} = useSelect(KandangApi.basePath, 'id', 'name', '', {
limit: 'limit',
location_id: selectedLocationIds ? selectedLocationIds.toString() : '',
});
const comparisonTypeOptions = [
@@ -120,17 +116,18 @@ const DashboardProduction = () => {
// ===== FORMIK =====
const formik = useFormik({
initialValues: {
startDate: filterValues.startDate || '',
endDate: filterValues.endDate || '',
flock: filterValues.flock || ([] as OptionType[]),
location: filterValues.location || ([] as OptionType[]),
kandang: filterValues.kandang || ([] as OptionType[]),
analysisMode: filterValues.analysisMode || analysisMode,
comparisonType: filterValues.comparisonType || '',
locationIds: filterValues.locationIds || [],
flockIds: filterValues.flockIds || [],
kandangIds: filterValues.kandangIds || [],
startDate: filterValues.startDate ?? '',
endDate: filterValues.endDate ?? '',
flock: filterValues.flock ?? ([] as OptionType[]),
location: filterValues.location ?? ([] as OptionType[]),
kandang: filterValues.kandang ?? ([] as OptionType[]),
analysisMode: filterValues.analysisMode ?? analysisMode,
comparisonType: filterValues.comparisonType ?? '',
locationIds: filterValues.locationIds ?? [],
flockIds: filterValues.flockIds ?? [],
kandangIds: filterValues.kandangIds ?? [],
} as DashboardFilterType,
enableReinitialize: true,
validationSchema: getDashboardFilterSchema(analysisMode),
onSubmit: (values) => {
// Save filter values to store
@@ -148,13 +145,13 @@ const DashboardProduction = () => {
},
});
const handleResetFilter = () => {
const handleResetFilter = useCallback(() => {
formik.resetForm();
resetFilterValues(); // Clear stored filter values
setAnalysisMode('OVERVIEW');
setEndpointUrl('/dashboards');
setSelectedLocationIds([]);
};
}, [resetFilterValues, filterValues, selectedLocationIds]);
const handleApplyFilter = (values: DashboardFilter) => {
// Build query params object, only include non-empty values
@@ -444,7 +441,13 @@ const DashboardProduction = () => {
)?.value === 'FARM' ? (
<SelectInputCheckbox
label='Farm'
value={formik.values.location}
value={
formik.values.location as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onInputChange={setInputValueLocation}
onMenuScrollToBottom={loadMoreLocation}
onChange={(selected) => {
@@ -466,7 +469,13 @@ const DashboardProduction = () => {
) : (
<SelectInputRadio
label='Farm'
value={formik.values.location as OptionType}
value={
formik.values.location as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onInputChange={setInputValueLocation}
onMenuScrollToBottom={loadMoreLocation}
onChange={(selected) => {
@@ -502,7 +511,13 @@ const DashboardProduction = () => {
)?.value === 'FLOCK' ? (
<SelectInputCheckbox
label='Flock'
value={formik.values.flock as OptionType[]}
value={
formik.values.flock as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onChange={(selected) =>
formik.setFieldValue('flock', selected)
}
@@ -519,7 +534,13 @@ const DashboardProduction = () => {
) : (
<SelectInputRadio
label='Flock'
value={formik.values.flock as OptionType}
value={
formik.values.flock as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onChange={(selected) =>
formik.setFieldValue('flock', selected)
}
@@ -548,7 +569,13 @@ const DashboardProduction = () => {
)?.value === 'KANDANG' ? (
<SelectInputCheckbox
label='Kandang'
value={formik.values.kandang as OptionType[]}
value={
formik.values.kandang as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onChange={(selected) =>
formik.setFieldValue('kandang', selected)
}
@@ -565,7 +592,13 @@ const DashboardProduction = () => {
) : (
<SelectInputRadio
label='Kandang'
value={formik.values.kandang as OptionType}
value={
formik.values.kandang as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined
}
onChange={(selected) =>
formik.setFieldValue('kandang', selected)
}
+35 -3
View File
@@ -1,4 +1,10 @@
import { ChangeEventHandler, useMemo, useState } from 'react';
import {
ChangeEventHandler,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { CellContext } from '@tanstack/react-table';
import { useSearchParams } from 'next/navigation';
import useSWR from 'swr';
@@ -33,6 +39,7 @@ import RequirePermission from '@/components/helper/RequirePermission';
import { Icon } from '@iconify/react';
import RowDropdownOptions from '@/components/table/RowDropdownOptions';
import RowCollapseOptions from '@/components/table/RowCollapseOptions';
import { useUiStore } from '@/stores/ui/ui.store';
const RowOptionsMenu = ({
type = 'dropdown',
@@ -133,6 +140,9 @@ const RowOptionsMenu = ({
};
const FinanceTable = () => {
const { searchValue, setSearchValue, resetSearchValue } = useUiStore();
const previousPathRef = useRef<string | null>(null);
const {
state: tableFilterState,
updateFilter,
@@ -141,7 +151,7 @@ const FinanceTable = () => {
toQueryString: getTableFilterQueryString,
} = useTableFilter({
initial: {
search: '',
search: searchValue,
transactionType: '',
bankId: '',
customerId: '',
@@ -167,7 +177,7 @@ const FinanceTable = () => {
const [searchParams, setSearchParams] = useSearchParams();
const deleteModal = useModal();
const [pendingFilters, setPendingFilters] = useState({
search: '',
search: searchValue,
transactionType: '',
bankId: '',
customerId: '',
@@ -296,6 +306,7 @@ const FinanceTable = () => {
};
const submitFilterHandler = () => {
updateFilter('search', pendingFilters.search);
setSearchValue(pendingFilters.search);
updateFilter('transactionType', pendingFilters.transactionType);
updateFilter('bankId', pendingFilters.bankId);
updateFilter('customerId', pendingFilters.customerId);
@@ -324,6 +335,7 @@ const FinanceTable = () => {
setPendingFilters(emptyFilters);
updateFilter('search', '');
resetSearchValue();
updateFilter('transactionType', '');
updateFilter('bankId', '');
updateFilter('customerId', '');
@@ -447,6 +459,26 @@ const FinanceTable = () => {
},
];
}, []);
useEffect(() => {
// Store current path on mount
previousPathRef.current = window.location.pathname;
return () => {
const currentPath = window.location.pathname;
// if both paths are within /finance module
const isCurrentPathFinance = currentPath.includes('/finance');
const isPreviousPathFinance =
previousPathRef.current?.includes('/finance');
// reset if we outside finance module entirely
if (isPreviousPathFinance && !isCurrentPathFinance) {
resetSearchValue();
}
};
}, [resetSearchValue]);
return (
<section className='size-full p-6 flex flex-col gap-6'>
<div className='flex justify-end gap-2'>
@@ -54,9 +54,6 @@ const FormFinanceAdd = ({
}: FormFinanceAddProps) => {
const router = useRouter();
const [serverErrorMessage, setServerErrorMessage] = useState('');
const [isSupplier, setIsSupplier] = useState(
initialValues?.party?.type === 'SUPPLIER'
);
// ===== Formik =====
const formikInitialValues = useMemo((): FinanceFormValues => {
@@ -215,7 +212,7 @@ const FormFinanceAdd = ({
? formik.errors.party_type_option
: ''
}
isDisabled={type === 'edit' || isSupplier}
isDisabled={type === 'edit'}
required
isClearable
/>
@@ -254,7 +251,11 @@ const FormFinanceAdd = ({
}
required
isClearable
isDisabled={!formik.values.party_type_option?.value || isSupplier}
isDisabled={
!formik.values.party_type_option?.value ||
(type === 'edit' &&
formik.values.party_type_option.value == 'SUPPLIER')
}
/>
<DateInput
label='Tanggal'
@@ -272,7 +273,6 @@ const FormFinanceAdd = ({
: ''
}
required
disabled={isSupplier}
/>
<SelectInput
label='Metode Pembayaran'
@@ -294,7 +294,6 @@ const FormFinanceAdd = ({
}
required
isClearable
isDisabled={isSupplier}
/>
<SelectInput
label='Bank'
@@ -335,7 +334,6 @@ const FormFinanceAdd = ({
}
required
isClearable
isDisabled={isSupplier}
/>
<TextInput
label={`Nomor Rekening ${formik.values.party_type_option?.value ? formatTitleCase(formik.values.party_type_option.value as string) : 'Pihak'}`}
@@ -356,7 +354,6 @@ const FormFinanceAdd = ({
}
required
readOnly
disabled={isSupplier}
/>
<TextInput
label='Nomor Referensi'
@@ -376,7 +373,6 @@ const FormFinanceAdd = ({
: ''
}
required
disabled={isSupplier}
/>
<NumberInput
label='Nominal'
@@ -392,7 +388,6 @@ const FormFinanceAdd = ({
: ''
}
required
disabled={isSupplier}
/>
<TextArea
label='Catatan'
@@ -408,7 +403,6 @@ const FormFinanceAdd = ({
: ''
}
required
disabled={isSupplier}
/>
<AlertErrorList formErrorList={formErrorList} onClose={close} />
{serverErrorMessage && (
@@ -433,7 +427,7 @@ const FormFinanceAdd = ({
<Button
type='submit'
className='w-min-24'
disabled={formik.isSubmitting || !formik.isValid}
disabled={formik.isSubmitting}
>
Submit
</Button>
@@ -396,7 +396,7 @@ const FormFinanceAddInitialBalance = ({
<Button
type='submit'
className='w-min-24'
disabled={formik.isSubmitting || !formik.isValid}
disabled={formik.isSubmitting}
>
Submit
</Button>
@@ -257,7 +257,7 @@ const FormFinanceInjection = ({
<Button
type='submit'
className='w-min-24'
disabled={formik.isSubmitting || !formik.isValid}
disabled={formik.isSubmitting}
>
Submit
</Button>
@@ -143,11 +143,13 @@ const DeliveryOrderProductForm = ({
// ===== SOURCE FIELDS =====
case 'qty': {
if (avgWeight > 0) {
formik.setFieldValue('total_weight', roundWeight(qty * avgWeight));
}
const tw = roundWeight(qty * avgWeight);
formik.setFieldValue('total_weight', tw);
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
// Hitung total_price berdasarkan unit_price × total_weight
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(unitPrice * tw));
}
}
break;
}
@@ -157,16 +159,21 @@ const DeliveryOrderProductForm = ({
const tw = roundWeight(qty * avgWeight);
formik.setFieldValue('total_weight', tw);
// Hitung total_price berdasarkan unit_price × total_weight
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
formik.setFieldValue('total_price', roundPrice(unitPrice * tw));
}
}
break;
}
case 'unit_price': {
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
if (unitPrice > 0 && totalWeight > 0) {
// Hitung total_price berdasarkan unit_price × total_weight
formik.setFieldValue(
'total_price',
roundPrice(unitPrice * totalWeight)
);
}
break;
}
@@ -175,13 +182,25 @@ const DeliveryOrderProductForm = ({
case 'total_weight': {
if (totalWeight > 0) {
formik.setFieldValue('avg_weight', roundWeight(totalWeight / qty));
// Hitung ulang total_price berdasarkan unit_price × total_weight
if (unitPrice > 0) {
formik.setFieldValue(
'total_price',
roundPrice(unitPrice * totalWeight)
);
}
}
break;
}
case 'total_price': {
if (totalPrice > 0) {
formik.setFieldValue('unit_price', roundPrice(totalPrice / qty));
if (totalPrice > 0 && totalWeight > 0) {
// Hitung unit_price berdasarkan total_price / total_weight
formik.setFieldValue(
'unit_price',
roundPrice(totalPrice / totalWeight)
);
}
break;
}
@@ -382,7 +401,7 @@ const DeliveryOrderProductForm = ({
/>
<NumberInput
required
label='Harga Satuan (Rp)'
label={`Harga / ${isResponseSuccess(productData) ? productData?.data?.uom?.name : 'Produk'} (Rp)`}
name='unit_price'
value={formik.values.unit_price}
onChange={(e) => {
@@ -49,17 +49,6 @@ const SalesOrderProductForm = ({
const [selectedProductWarehouse, setSelectedProductWarehouse] =
useState<ProductWarehouse | null>(null);
// ============ Fetch Data ============
const { data: productData } = useSWR(
selectedProductWarehouse?.product_id
? ProductApi.basePath + '/' + selectedProductWarehouse?.product_id
: null,
() =>
selectedProductWarehouse?.product_id
? ProductApi.getSingle(selectedProductWarehouse?.product_id)
: undefined
);
// ============ Formik ============
const formik = useFormik<SalesOrderProductFormValues>({
enableReinitialize: true,
@@ -174,15 +163,28 @@ const SalesOrderProductForm = ({
if (qty <= 0) return;
// Cek apakah produk memiliki flag OVK atau PAKAN
const productFlags = selectedProductWarehouse?.product?.flags || [];
const isOvkOrPakan =
productFlags.includes('OVK') || productFlags.includes('PAKAN');
switch (field) {
// ===== SOURCE FIELDS =====
case 'qty': {
if (avgWeight > 0) {
formik.setFieldValue('total_weight', roundWeight(qty * avgWeight));
}
const tw = roundWeight(qty * avgWeight);
formik.setFieldValue('total_weight', tw);
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
// Hitung total_price berdasarkan flag produk
if (unitPrice > 0) {
if (isOvkOrPakan) {
// Untuk OVK/PAKAN: total_price = qty × unit_price
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
} else {
// Untuk produk lain: total_price = unit_price × total_weight
formik.setFieldValue('total_price', roundPrice(unitPrice * tw));
}
}
}
break;
}
@@ -192,8 +194,15 @@ const SalesOrderProductForm = ({
const tw = roundWeight(qty * avgWeight);
formik.setFieldValue('total_weight', tw);
// Hitung total_price berdasarkan flag produk
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
if (isOvkOrPakan) {
// Untuk OVK/PAKAN: total_price = qty × unit_price
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
} else {
// Untuk produk lain: total_price = unit_price × total_weight
formik.setFieldValue('total_price', roundPrice(unitPrice * tw));
}
}
}
break;
@@ -201,7 +210,16 @@ const SalesOrderProductForm = ({
case 'unit_price': {
if (unitPrice > 0) {
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
if (isOvkOrPakan) {
// Untuk OVK/PAKAN: total_price = qty × unit_price
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
} else if (totalWeight > 0) {
// Untuk produk lain: total_price = unit_price × total_weight
formik.setFieldValue(
'total_price',
roundPrice(unitPrice * totalWeight)
);
}
}
break;
}
@@ -210,13 +228,36 @@ const SalesOrderProductForm = ({
case 'total_weight': {
if (totalWeight > 0) {
formik.setFieldValue('avg_weight', roundWeight(totalWeight / qty));
// Hitung ulang total_price berdasarkan flag produk
if (unitPrice > 0) {
if (isOvkOrPakan) {
// Untuk OVK/PAKAN: total_price = qty × unit_price
formik.setFieldValue('total_price', roundPrice(qty * unitPrice));
} else {
// Untuk produk lain: total_price = unit_price × total_weight
formik.setFieldValue(
'total_price',
roundPrice(unitPrice * totalWeight)
);
}
}
}
break;
}
case 'total_price': {
if (totalPrice > 0) {
formik.setFieldValue('unit_price', roundPrice(totalPrice / qty));
if (isOvkOrPakan && qty > 0) {
// Untuk OVK/PAKAN: unit_price = total_price / qty
formik.setFieldValue('unit_price', roundPrice(totalPrice / qty));
} else if (totalWeight > 0) {
// Untuk produk lain: unit_price = total_price / total_weight
formik.setFieldValue(
'unit_price',
roundPrice(totalPrice / totalWeight)
);
}
}
break;
}
@@ -232,7 +273,7 @@ const SalesOrderProductForm = ({
handleBlurField(currentInput);
formik.setFieldValue(
'uom',
isResponseSuccess(productData) ? productData?.data?.uom.name : ''
selectedProductWarehouse?.product?.uom?.name
);
},
}
@@ -330,9 +371,7 @@ const SalesOrderProductForm = ({
endAdornment={
<div className='flex items-center gap-2'>
<span className='text-sm text-gray-500'>
{isResponseSuccess(productData)
? productData?.data?.uom.name
: ''}
{selectedProductWarehouse?.product?.uom?.name}
</span>
</div>
}
@@ -343,17 +382,13 @@ const SalesOrderProductForm = ({
warehouseSourceRawData?.data?.find(
(item) => item.id === formik.values.product_warehouse_id
)?.quantity ?? 0
)} ${
isResponseSuccess(productData)
? productData?.data?.uom.name
: ''
}`
)} ${selectedProductWarehouse?.product?.uom?.name}`
: ''
}
/>
<NumberInput
required
label='Harga Satuan (Rp)'
label={`Harga / ${selectedProductWarehouse?.product?.uom?.name ?? 'Produk'} (Rp)`}
name='unit_price'
value={formik.values.unit_price}
onChange={(e) => {
@@ -1,6 +1,12 @@
'use client';
import React, { useCallback, useState, useMemo, useEffect } from 'react';
import React, {
useCallback,
useState,
useMemo,
useEffect,
useRef,
} from 'react';
import { RefObject } from 'react';
import useSWR from 'swr';
import { Icon } from '@iconify/react';
@@ -28,6 +34,7 @@ import { useTableFilter } from '@/services/hooks/useTableFilter';
import toast from 'react-hot-toast';
import Badge from '@/components/Badge';
import CheckboxInput from '@/components/input/CheckboxInput';
import { useUiStore } from '@/stores/ui/ui.store';
import { BaseApproval, BaseApiResponse } from '@/types/api/api-general';
const RowOptionsMenu = ({
@@ -344,6 +351,9 @@ const ApprovalHistoryModal = ({
};
const RecordingTable = () => {
const { searchValue, setSearchValue, resetSearchValue } = useUiStore();
const previousPathRef = useRef<string | null>(null);
const {
state: tableFilterState,
updateFilter,
@@ -352,7 +362,7 @@ const RecordingTable = () => {
toQueryString: getTableFilterQueryString,
} = useTableFilter({
initial: {
search: '',
search: searchValue,
areaFilter: '',
locationFilter: '',
kandangFilter: '',
@@ -403,12 +413,35 @@ const RecordingTable = () => {
);
}, []);
useEffect(() => {
// Store current path on mount
previousPathRef.current = window.location.pathname;
return () => {
const currentPath = window.location.pathname;
// if both paths are within /production/recording module
const isCurrentPathRecording = currentPath.includes(
'/production/recording'
);
const isPreviousPathRecording = previousPathRef.current?.includes(
'/production/recording'
);
// reset if we outside recording module entirely
if (isPreviousPathRecording && !isCurrentPathRecording) {
resetSearchValue();
}
};
}, [resetSearchValue]);
const searchChangeHandler = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
updateFilter('search', e.target.value);
setSearchValue(e.target.value);
setPage(1);
},
[updateFilter, setPage]
[updateFilter, setSearchValue, setPage]
);
const pageSizeChangeHandler = useCallback(
@@ -23,6 +23,7 @@ import ConfirmationModalWithNotes from '@/components/modal/ConfirmationModalWith
import Modal, { useModal } from '@/components/Modal';
import AlertErrorList from '@/components/helper/form/FormErrors';
import Table from '@/components/Table';
import Tooltip from '@/components/Tooltip';
import { type ColumnDef } from '@tanstack/react-table';
import {
@@ -197,6 +198,11 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
const router = useRouter();
// ===== STATE MANAGEMENT =====
const [selectedRecordDate, setSelectedRecordDate] = useState<string>(
initialValues?.record_datetime
? new Date(initialValues.record_datetime).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
);
const [selectedStocks, setSelectedStocks] = useState<number[]>([]);
const [selectedDepletions, setSelectedDepletions] = useState<number[]>([]);
const [selectedEggs, setSelectedEggs] = useState<number[]>([]);
@@ -911,6 +917,8 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
baseValues = getRecordingGrowingFormInitialValues(initialValues);
}
baseValues.record_date = selectedRecordDate;
if (type === 'add') {
baseValues.location = selectedLocation
? {
@@ -967,13 +975,22 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}
return baseValues;
}, [initialValues, isLayingCategory, projectFlockKandangDetail, type]);
}, [
initialValues,
isLayingCategory,
projectFlockKandangDetail,
type,
selectedRecordDate,
selectedLocation,
selectedProjectFlock,
selectedKandang,
]);
const formik = useFormik<
RecordingGrowingFormValues | RecordingLayingFormValues
>({
initialValues: formikInitialValues,
enableReinitialize: true,
enableReinitialize: false,
validationSchema: (() => {
let schema;
if (isLayingCategory) {
@@ -1333,6 +1350,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
(e: React.ChangeEvent<HTMLInputElement>) => {
const newDate = e.target.value;
formik.setFieldValue('record_date', newDate);
setSelectedRecordDate(newDate);
setCurrentRecordDate(newDate);
if (duplicateErrorShown) {
toast.dismiss();
@@ -2799,7 +2817,23 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
)}
<th>Kondisi Telur</th>
<th>Jumlah</th>
<th>Total Berat (Kilogram)</th>
<th className='flex items-center gap-1'>
Total Berat (Kilogram)
<Tooltip
className={{
wrapper: 'cursor-pointer',
}}
position='bottom'
content='Untuk menggunakan koma bisa menekan tombol titik (.) pada keyboard, Misal 0.123'
>
<Icon
icon='heroicons:information-circle'
width={20}
height={20}
className='text-gray-400 hover:text-gray-600 shrink-0'
/>
</Tooltip>
</th>
{(type as 'add' | 'edit' | 'detail') !== 'detail' && (
<th>Action</th>
)}
@@ -2905,7 +2939,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
value={egg.weight ?? ''}
onChange={handleEggWeightChangeWrapper(idx)}
onBlur={formik.handleBlur}
decimalScale={0}
decimalScale={3}
allowNegative={false}
thousandSeparator=','
decimalSeparator='.'
@@ -678,7 +678,13 @@ const DebtSupplierTab = () => {
placeholder='Pilih Supplier'
isMulti
options={supplierOptions}
value={formik.values.supplierIds || []}
value={
(formik.values.supplierIds as
| { value: number; label: string }
| { value: number; label: string }[]
| null
| undefined) || []
}
onChange={(val) => {
formik.setFieldValue(
'supplierIds',
@@ -702,7 +708,13 @@ const DebtSupplierTab = () => {
label='Filter Berdasarkan'
placeholder='Pilih Filter Berdasarkan'
options={dataTypeOptions}
value={formik.values.filterBy || null}
value={
(formik.values.filterBy as
| { value: string; label: string }
| { value: string; label: string }[]
| null
| undefined) || null
}
onChange={(val) => {
formik.setFieldValue(
'filterBy',