fix(resolve): fix resolve merge

This commit is contained in:
rstubryan
2025-11-24 08:34:50 +07:00
parent 274322606d
commit 824eed910a
5 changed files with 42 additions and 34 deletions
+3
View File
@@ -0,0 +1,3 @@
npm run format
npm run lint
npm run build
+5 -4
View File
@@ -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();
@@ -177,7 +177,9 @@ export const MovementFormSchema: Yup.ObjectSchema<MovementFormSchemaType> =
'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()
@@ -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,
},
],
});
@@ -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
)}`
: ''
}