diff --git a/src/app/production/transfer-to-laying/detail/edit/page.tsx b/src/app/production/transfer-to-laying/detail/edit/page.tsx
index 9003dbba..20c7373f 100644
--- a/src/app/production/transfer-to-laying/detail/edit/page.tsx
+++ b/src/app/production/transfer-to-laying/detail/edit/page.tsx
@@ -27,6 +27,7 @@ const DUMMY_TRANSFER_TO_LAYING_EDIT: TransferToLaying = {
{
kandang: {
id: 1,
+ capacity: 1000,
name: 'Kandang test',
status: 'ACTIVE',
location: {
@@ -56,6 +57,7 @@ const DUMMY_TRANSFER_TO_LAYING_EDIT: TransferToLaying = {
kandang: {
id: 1,
name: 'Kandang test 2',
+ capacity: 3000,
status: 'ACTIVE',
location: {
id: 1,
diff --git a/src/app/production/transfer-to-laying/detail/page.tsx b/src/app/production/transfer-to-laying/detail/page.tsx
index de5426c8..3f7dbe56 100644
--- a/src/app/production/transfer-to-laying/detail/page.tsx
+++ b/src/app/production/transfer-to-laying/detail/page.tsx
@@ -27,6 +27,7 @@ const DUMMY_TRANSFER_TO_LAYING_DETAIL: TransferToLaying = {
{
kandang: {
id: 1,
+ capacity: 1000,
name: 'Kandang test',
status: 'ACTIVE',
location: {
@@ -55,6 +56,7 @@ const DUMMY_TRANSFER_TO_LAYING_DETAIL: TransferToLaying = {
{
kandang: {
id: 1,
+ capacity: 3000,
name: 'Kandang test 2',
status: 'ACTIVE',
location: {
diff --git a/src/components/pages/master-data/kandang/KandangsTable.tsx b/src/components/pages/master-data/kandang/KandangsTable.tsx
index c51eeb21..d2b585de 100644
--- a/src/components/pages/master-data/kandang/KandangsTable.tsx
+++ b/src/components/pages/master-data/kandang/KandangsTable.tsx
@@ -22,7 +22,7 @@ import RowCollapseOptions from '@/components/table/RowCollapseOptions';
import { Kandang } from '@/types/api/master-data/kandang';
import { KandangApi } from '@/services/api/master-data';
-import { cn } from '@/lib/helper';
+import { cn, formatNumber } from '@/lib/helper';
import { isResponseSuccess } from '@/lib/api-helper';
import { useTableFilter } from '@/services/hooks/useTableFilter';
import { ROWS_OPTIONS } from '@/config/constant';
@@ -93,12 +93,19 @@ const KandangsTable = () => {
setPageSize,
toQueryString: getTableFilterQueryString,
} = useTableFilter({
- initial: { search: '', nameSort: '', locationSort: '', picSort: '' },
+ initial: {
+ search: '',
+ nameSort: '',
+ locationSort: '',
+ capacitySort: '',
+ picSort: '',
+ },
paramMap: {
page: 'page',
pageSize: 'limit',
nameSort: 'sort_name',
locationSort: 'sort_location',
+ capacitySort: 'sort_capacity',
picSort: ' sort_pic',
},
});
@@ -138,6 +145,11 @@ const KandangsTable = () => {
header: 'Lokasi',
cell: (props) => props.row.original.location.name,
},
+ {
+ accessorKey: 'capacity',
+ header: 'Kapasitas',
+ cell: (props) => formatNumber(props.row.original.capacity ?? 0),
+ },
{
accessorKey: 'pic',
header: 'PIC',
diff --git a/src/components/pages/master-data/kandang/form/KandangForm.schema.ts b/src/components/pages/master-data/kandang/form/KandangForm.schema.ts
index 9a0e42a0..b0f816bd 100644
--- a/src/components/pages/master-data/kandang/form/KandangForm.schema.ts
+++ b/src/components/pages/master-data/kandang/form/KandangForm.schema.ts
@@ -11,6 +11,10 @@ export const KandangFormSchema = Yup.object({
label: Yup.string().required(),
}).nullable(),
+ capacity: Yup.number()
+ .min(1, 'Kapasitas wajib diisi!')
+ .required('Kapasitas wajib diisi!'),
+
picId: Yup.number().min(1, 'PIC wajib diisi!').required('PIC wajib diisi!'),
pic: Yup.object({
value: Yup.number().min(1).required(),
diff --git a/src/components/pages/master-data/kandang/form/KandangForm.tsx b/src/components/pages/master-data/kandang/form/KandangForm.tsx
index f0d68983..7753a507 100644
--- a/src/components/pages/master-data/kandang/form/KandangForm.tsx
+++ b/src/components/pages/master-data/kandang/form/KandangForm.tsx
@@ -27,6 +27,7 @@ import {
import { LocationApi, KandangApi } from '@/services/api/master-data';
import { cn } from '@/lib/helper';
import { UserApi } from '@/services/api/user';
+import NumberInput from '@/components/input/NumberInput';
interface KandangFormProps {
type?: 'add' | 'edit' | 'detail';
@@ -81,6 +82,7 @@ const KandangForm = ({ type = 'add', initialValues }: KandangFormProps) => {
label: initialValues.location.name,
}
: null,
+ capacity: initialValues?.capacity ?? 0,
picId: initialValues?.pic?.id ?? 0,
pic: initialValues?.pic
? {
@@ -101,6 +103,7 @@ const KandangForm = ({ type = 'add', initialValues }: KandangFormProps) => {
const kandangPayload: CreateKandangPayload = {
name: values.name,
location_id: values.locationId,
+ capacity: values.capacity,
pic_id: values.picId,
};
@@ -249,6 +252,20 @@ const KandangForm = ({ type = 'add', initialValues }: KandangFormProps) => {
isClearable
/>
+
+
= {
{
kandang: {
id: 3,
+ capacity: 1000,
name: 'Cikaum 1',
status: 'ACTIVE',
location: {
@@ -633,6 +649,7 @@ const FLOCK_SOURCE_DUMMY_DATA: BaseApiResponse = {
{
kandang: {
id: 4,
+ capacity: 1000,
name: 'Cikaum 2',
status: 'ACTIVE',
location: {
@@ -656,6 +673,7 @@ const FLOCK_SOURCE_DUMMY_DATA: BaseApiResponse = {
{
kandang: {
id: 5,
+ capacity: 1000,
name: 'Cikaum 3',
status: 'ACTIVE',
location: {
@@ -687,6 +705,7 @@ const FLOCK_SOURCE_DUMMY_DATA: BaseApiResponse = {
{
kandang: {
id: 3,
+ capacity: 1000,
name: 'Cikaum 1',
status: 'ACTIVE',
location: {
@@ -710,6 +729,7 @@ const FLOCK_SOURCE_DUMMY_DATA: BaseApiResponse = {
{
kandang: {
id: 4,
+ capacity: 1000,
name: 'Cikaum 2',
status: 'ACTIVE',
location: {
diff --git a/src/types/api/master-data/kandang.d.ts b/src/types/api/master-data/kandang.d.ts
index 17cbbee7..8ad20f15 100644
--- a/src/types/api/master-data/kandang.d.ts
+++ b/src/types/api/master-data/kandang.d.ts
@@ -7,6 +7,7 @@ export type BaseKandang = {
name: string;
status: string;
location: BaseLocation;
+ capacity: number;
pic: BaseUser;
};
@@ -15,6 +16,7 @@ export type Kandang = BaseMetadata & BaseKandang;
export type CreateKandangPayload = {
name: string;
location_id: number;
+ capacity: number;
pic_id: number;
};