{type !== 'detail' && (
|
- {
- if (e.target.checked) {
- setSelectedDeliveries([
- ...selectedDeliveries,
- idx,
- ]);
- } else {
- setSelectedDeliveries(
- selectedDeliveries.filter((i) => i !== idx)
- );
- }
- }}
- />
+
+
+ ) => {
+ if (e.target.checked) {
+ setSelectedDeliveries([
+ ...selectedDeliveries,
+ idx,
+ ]);
+ } else {
+ setSelectedDeliveries(
+ selectedDeliveries.filter(
+ (i) => i !== idx
+ )
+ );
+ }
+ }}
+ classNames={{
+ wrapper: 'flex justify-center',
+ checkbox: 'checkbox checkbox-sm',
+ }}
+ />
+
|
)}
@@ -1075,10 +1195,18 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
required
value={delivery.products[0]?.product ?? undefined}
onChange={(val) => {
+ formik.setFieldTouched(
+ `deliveries.${idx}.products.0.product`,
+ true
+ );
formik.setFieldValue(
`deliveries.${idx}.products.0.product`,
val
);
+ formik.setFieldTouched(
+ `deliveries.${idx}.products.0.product_id`,
+ true
+ );
formik.setFieldValue(
`deliveries.${idx}.products.0.product_id`,
(val as OptionType)?.value
@@ -1087,6 +1215,14 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
options={getFilteredProductWarehouseOptions()}
isDisabled={type === 'detail'}
isClearable
+ isError={
+ isDeliveryProductInputError(idx, 0, 'product_id')
+ .isError
+ }
+ errorMessage={
+ isDeliveryProductInputError(idx, 0, 'product_id')
+ .errorMessage
+ }
className={{
wrapper:
'w-full min-w-52 md:min-w-72 lg:min-w-80',
@@ -1122,10 +1258,18 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
required
value={delivery.supplier}
onChange={(val) => {
+ formik.setFieldTouched(
+ `deliveries.${idx}.supplier`,
+ true
+ );
formik.setFieldValue(
`deliveries.${idx}.supplier`,
val
);
+ formik.setFieldTouched(
+ `deliveries.${idx}.supplier_id`,
+ true
+ );
formik.setFieldValue(
`deliveries.${idx}.supplier_id`,
(val as OptionType)?.value
@@ -1136,6 +1280,11 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
isLoading={isLoadingSuppliers}
isDisabled={type === 'detail'}
isClearable
+ {...isRepeaterInputError(
+ 'deliveries',
+ 'supplier_id',
+ idx
+ )}
className={{
wrapper:
'w-full min-w-52 md:min-w-72 lg:min-w-80',
@@ -1163,27 +1312,31 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
{type === 'detail' ? (
-
+ <>
+
+
+
+ >
) : (
{
toast.error(
'Ukuran dokumen maksimal 2 MB!'
);
+ e.target.value = '';
return;
}
formik.setFieldValue(
@@ -1215,15 +1369,17 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
)}
|
-
handleDeliveryCostChange(idx, e.target.value)
}
onBlur={formik.handleBlur}
+ maskType='currency'
+ decimals={0}
+ min={0}
{...isRepeaterInputError(
'deliveries',
'delivery_cost',
@@ -1231,14 +1387,14 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
)}
readOnly={type === 'detail'}
className={{
- wrapper: 'w-full min-w-48',
+ wrapper:
+ 'w-full min-w-52 md:min-w-72 lg:min-w-80',
}}
/>
|
-
@@ -1248,6 +1404,9 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
)
}
onBlur={formik.handleBlur}
+ maskType='currency'
+ decimals={0}
+ min={0}
{...isRepeaterInputError(
'deliveries',
'delivery_cost_per_item',
@@ -1255,7 +1414,8 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
)}
readOnly={type === 'detail'}
className={{
- wrapper: 'w-full min-w-48',
+ wrapper:
+ 'w-full min-w-52 md:min-w-72 lg:min-w-80',
}}
/>
|
@@ -1280,17 +1440,19 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
{type !== 'detail' && (
-
+
+
+
|
)}
diff --git a/src/components/pages/production/chickin/ChickinTable.tsx b/src/components/pages/production/chickin/ChickinTable.tsx
new file mode 100644
index 00000000..e2b527d3
--- /dev/null
+++ b/src/components/pages/production/chickin/ChickinTable.tsx
@@ -0,0 +1,325 @@
+'use client';
+
+import Button from '@/components/Button';
+import DebouncedTextInput from '@/components/input/DebouncedTextInput';
+import { OptionType } from '@/components/input/SelectInput';
+import Modal, { useModal } from '@/components/Modal';
+import ConfirmationModal from '@/components/modal/ConfirmationModal';
+import Table from '@/components/Table';
+import RowCollapseOptions from '@/components/table/RowCollapseOptions';
+import RowDropdownOptions from '@/components/table/RowDropdownOptions';
+import { TableRowSizeSelector } from '@/components/table/TableRowSizeSelector';
+import { ROWS_OPTIONS } from '@/config/constant';
+import { isResponseSuccess } from '@/lib/api-helper';
+import { cn } from '@/lib/helper';
+import { ChickinApi, ProjectFlockApi } from '@/services/api/production';
+import { useTableFilter } from '@/services/hooks/useTableFilter';
+import { Chickin } from '@/types/api/production/chickin';
+import { Icon } from '@iconify/react';
+import { CellContext, SortingState } from '@tanstack/react-table';
+import { useState } from 'react';
+import useSWR from 'swr';
+import ChickinForm from './form/ChickinForm';
+
+const ChickinTable = () => {
+ const {
+ state: tableFilterState,
+ updateFilter,
+ setPage,
+ setPageSize,
+ toQueryString: getTableFilterQueryString,
+ } = useTableFilter({
+ initial: {
+ search: '',
+ },
+ paramMap: {
+ page: 'page',
+ pageSize: 'limit',
+ search: 'search',
+ },
+ });
+
+ const [sorting, setSorting] = useState