fix purchase request
This commit is contained in:
parent
e8609a0ab9
commit
c78b32d7b8
@ -22,15 +22,15 @@ export const usePurchaseOrdersMutation = () => {
|
|||||||
|
|
||||||
const sendPaymentPurchaseOrder = useMutation({
|
const sendPaymentPurchaseOrder = useMutation({
|
||||||
mutationFn: async ({ id, payload }: { id: string; payload: SendPaymentPurchaseOrderRequest }) => {
|
mutationFn: async ({ id, payload }: { id: string; payload: SendPaymentPurchaseOrderRequest }) => {
|
||||||
const response = await api.put(`/purchase-orders/${id}`, payload)
|
const response = await api.put(`/purchase-orders/${id}/status/received`, payload)
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('Purchase Order created successfully!')
|
toast.success('Send Payment Order successfully!')
|
||||||
queryClient.invalidateQueries({ queryKey: ['purchase-orders'] })
|
queryClient.invalidateQueries({ queryKey: ['purchase-orders'] })
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
onError: (error: any) => {
|
||||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
toast.error(error.response?.data?.errors?.[0]?.cause || 'Send Payment Order failed')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -407,7 +407,7 @@ const PurchaseAddForm: React.FC = () => {
|
|||||||
description: item.description || undefined,
|
description: item.description || undefined,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
unit_id: item.unit!.value,
|
unit_id: item.unit!.value,
|
||||||
amount: item.amount
|
amount: item.total
|
||||||
})),
|
})),
|
||||||
attachment_file_ids: formData.attachment_file_ids.length > 0 ? formData.attachment_file_ids : undefined
|
attachment_file_ids: formData.attachment_file_ids.length > 0 ? formData.attachment_file_ids : undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user