diff --git a/package-lock.json b/package-lock.json index 6b7c09e6..e1f28d3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "axios": "^1.12.2", "clsx": "^2.1.1", "formik": "^2.4.6", + "inputmask": "^5.0.9", "moment": "^2.30.1", "next": "15.5.3", "react": "19.1.0", @@ -30,6 +31,7 @@ "@eslint/eslintrc": "^3", "@iconify/react": "^6.0.2", "@tailwindcss/postcss": "^4", + "@types/inputmask": "^5.0.7", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", @@ -1636,6 +1638,13 @@ "@types/react": "*" } }, + "node_modules/@types/inputmask": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@types/inputmask/-/inputmask-5.0.7.tgz", + "integrity": "sha512-uojbVPWzBQ/n/0jc/d16fLqmGasFIptbrLD2WrCPWArlk+5PgblOqH4EDkI3AoobXLAlOK5yF01V8jMmvMG5qg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2793,9 +2802,9 @@ "license": "MIT" }, "node_modules/daisyui": { - "version": "5.3.9", - "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.3.9.tgz", - "integrity": "sha512-741x1pGGSGHcrBYtdE7iKbqW1OoiijYdAZ8oJPZR9MhSKLcMBlHjKfN3YlM2/K7t5jd7O0sg4SqkVNPylalRFw==", + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.3.10.tgz", + "integrity": "sha512-vmjyPmm0hvFhA95KB6uiGmWakziB2pBv6CUcs5Ka/3iMBMn9S+C3SZYx9G9l2JrgTZ1EFn61F/HrPcwaUm2kLQ==", "dev": true, "license": "MIT", "funding": { @@ -4193,6 +4202,12 @@ "node": ">=0.8.19" } }, + "node_modules/inputmask": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/inputmask/-/inputmask-5.0.9.tgz", + "integrity": "sha512-s0lUfqcEbel+EQXtehXqwCJGShutgieOaIImFKC/r4reYNvX3foyrChl6LOEvaEgxEbesePIrw1Zi2jhZaDZbQ==", + "license": "MIT" + }, "node_modules/internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", diff --git a/package.json b/package.json index 2e806ddd..b371e4e7 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "axios": "^1.12.2", "clsx": "^2.1.1", "formik": "^2.4.6", + "inputmask": "^5.0.9", "moment": "^2.30.1", "next": "15.5.3", "react": "19.1.0", @@ -32,6 +33,7 @@ "@eslint/eslintrc": "^3", "@iconify/react": "^6.0.2", "@tailwindcss/postcss": "^4", + "@types/inputmask": "^5.0.7", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", diff --git a/src/app/production/chickin/detail/page.tsx b/src/app/production/chickin/detail/page.tsx index aef7c4b7..96647c55 100644 --- a/src/app/production/chickin/detail/page.tsx +++ b/src/app/production/chickin/detail/page.tsx @@ -18,6 +18,11 @@ import { useState } from 'react'; import toast from 'react-hot-toast'; import useSWR from 'swr'; +/** + * TODO: Refactor code - pindahin detail ke reuseable component + * setelah implement approval and reject + */ + const DetailChickin = () => { const router = useRouter(); const searchParams = useSearchParams(); @@ -112,6 +117,7 @@ const DetailChickin = () => { if (isResponseError(deleteProjectFlockRes)) { toast.error(deleteProjectFlockRes?.message as string); } + deleteModal.closeModal(); setIsDeleteLoading(false); }; diff --git a/src/app/production/recording/add/page.tsx b/src/app/production/recording/add/page.tsx new file mode 100644 index 00000000..d41fc183 --- /dev/null +++ b/src/app/production/recording/add/page.tsx @@ -0,0 +1,11 @@ +import RecordingForm from '@/components/pages/production/recording/form/RecordingForm'; + +const AddRecording = () => { + return ( +
{bottomLabel}
+ )} + {isError && errorMessage && ( +{errorMessage}
+ )} +{bottomLabel}
diff --git a/src/components/pages/inventory/movement/form/MovementForm.schema.ts b/src/components/pages/inventory/movement/form/MovementForm.schema.ts index 5df66930..ed8fb479 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.schema.ts +++ b/src/components/pages/inventory/movement/form/MovementForm.schema.ts @@ -61,32 +61,24 @@ const DeliveryObjectSchema: Yup.ObjectSchema|
- 0
- }
- onChange={(e) => {
- if (e.target.checked) {
- setSelectedDeliveries(
- formik.values.deliveries?.map(
- (_, idx) => idx
- ) ?? []
- );
- } else {
- setSelectedDeliveries([]);
+
+
|
)}
- Produk | -Qty | -Supplier | -Plat Nomor | ++ Produk + + * + + | ++ Qty + + * + + | ++ Supplier + + * + + | ++ Plat Nomor + + * + + | Dokumen | -Biaya Pengiriman (Rp.) | -Biaya Per Item (Rp.) | -Nama Sopir | ++ Biaya Pengiriman (Rp.) + + * + + | ++ Biaya Per Item (Rp.) + + * + + | ++ Nama Sopir + + * + + | {type !== 'detail' &&Aksi | }
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
- {
- if (e.target.checked) {
- setSelectedDeliveries([
- ...selectedDeliveries,
- idx,
- ]);
- } else {
- setSelectedDeliveries(
- selectedDeliveries.filter((i) => i !== idx)
- );
- }
- }}
- />
+
+
|
)}
@@ -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' ? (
-
+ <>
+
+
+
+ >
) : (
|
- |
- |
@@ -1280,17 +1440,19 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
{type !== 'detail' && (
-
+
+
+
|
)}