diff --git a/.husky/pre-commit b/.husky/pre-commit index e69de29b..3782914b 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +npm run format +npm run lint +npm run build \ No newline at end of file diff --git a/src/app/purchase/detail/page.tsx b/src/app/purchase/detail/page.tsx index 955055a6..df0de97b 100644 --- a/src/app/purchase/detail/page.tsx +++ b/src/app/purchase/detail/page.tsx @@ -12,10 +12,11 @@ const PurchaseDetail = () => { const purchaseId = searchParams.get('purchaseId'); - const { data: purchase, isLoading: isLoadingPurchase, mutate: mutatePurchase } = useSWR( - purchaseId, - (id: number) => PurchaseApi.getSingle(id) - ); + const { + data: purchase, + isLoading: isLoadingPurchase, + mutate: mutatePurchase, + } = useSWR(purchaseId, (id: number) => PurchaseApi.getSingle(id)); if (!purchaseId) { router.back(); diff --git a/src/components/pages/inventory/movement/form/MovementForm.schema.ts b/src/components/pages/inventory/movement/form/MovementForm.schema.ts index 0d9b3277..5ea844ab 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.schema.ts +++ b/src/components/pages/inventory/movement/form/MovementForm.schema.ts @@ -177,7 +177,9 @@ export const MovementFormSchema: Yup.ObjectSchema = 'Gudang tujuan tidak boleh sama dengan gudang asal!', function (value) { const { source_warehouse_id } = this.parent; - return !value || !source_warehouse_id || value !== source_warehouse_id; + return ( + !value || !source_warehouse_id || value !== source_warehouse_id + ); } ), products: Yup.array() diff --git a/src/components/pages/purchase/form/request/PurchaseRequestForm.schema.ts b/src/components/pages/purchase/form/request/PurchaseRequestForm.schema.ts index af84c68b..414371c3 100644 --- a/src/components/pages/purchase/form/request/PurchaseRequestForm.schema.ts +++ b/src/components/pages/purchase/form/request/PurchaseRequestForm.schema.ts @@ -140,29 +140,31 @@ export const getPurchaseRequestFormInitialValues = ( : null, location_id: initialValues?.location?.id ?? undefined, notes: initialValues?.notes ?? null, - items: initialValues?.items?.length ? initialValues.items.map((item) => ({ - warehouse: item.warehouse - ? { - value: item.warehouse.id, - label: item.warehouse.name, - } - : null, - warehouse_id: item.warehouse?.id ?? 0, - product: item.product - ? { - value: item.product.id, - label: item.product.name, - } - : null, - product_id: item.product?.id ?? 0, - qty: item.qty ?? 0, - })) : [ - { - warehouse: null, - warehouse_id: 0, - product: null, - product_id: 0, - qty: 0, - }, - ], + items: initialValues?.items?.length + ? initialValues.items.map((item) => ({ + warehouse: item.warehouse + ? { + value: item.warehouse.id, + label: item.warehouse.name, + } + : null, + warehouse_id: item.warehouse?.id ?? 0, + product: item.product + ? { + value: item.product.id, + label: item.product.name, + } + : null, + product_id: item.product?.id ?? 0, + qty: item.qty ?? 0, + })) + : [ + { + warehouse: null, + warehouse_id: 0, + product: null, + product_id: 0, + qty: 0, + }, + ], }); diff --git a/src/components/pages/purchase/form/request/PurchaseRequestForm.tsx b/src/components/pages/purchase/form/request/PurchaseRequestForm.tsx index 41732013..7100b134 100644 --- a/src/components/pages/purchase/form/request/PurchaseRequestForm.tsx +++ b/src/components/pages/purchase/form/request/PurchaseRequestForm.tsx @@ -781,7 +781,8 @@ const PurchaseRequestForm = ({ ? formatNumber( supplierProductData[item.product_id] .ProductPrice * - (parseFloat(item.qty?.toString() || '0') || 0) + (parseFloat(item.qty?.toString() || '0') || + 0) ) : '' } @@ -803,9 +804,8 @@ const PurchaseRequestForm = ({ item.product_id && supplierProductData[item.product_id] ? `Harga per unit: Rp ${formatNumber( - supplierProductData[ - item.product_id - ].ProductPrice + supplierProductData[item.product_id] + .ProductPrice )}` : '' }