Allow editing orders in the order card
Cashiers can edit recipient, TTN, notes, goods and total in the order
modal and save via PATCH /orders/{id}. Edited orders get edited_at and
are no longer overwritten by CRM sync. Editing is blocked once a receipt
exists; changing the TTN resets Nova Poshta tracking fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { apiFetch } from '@/api/client'
|
||||
import type { Order } from '@/features/orders/types'
|
||||
import type { Order, OrderUpdate } from '@/features/orders/types'
|
||||
|
||||
export function getOrders(hasReceipt: boolean): Promise<Order[]> {
|
||||
return apiFetch<Order[]>(`/orders?has_receipt=${hasReceipt}`)
|
||||
@@ -8,3 +8,7 @@ export function getOrders(hasReceipt: boolean): Promise<Order[]> {
|
||||
export function deleteOrder(orderId: string): Promise<void> {
|
||||
return apiFetch<void>(`/orders/${orderId}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
export function updateOrder(orderId: string, data: OrderUpdate): Promise<Order> {
|
||||
return apiFetch<Order>(`/orders/${orderId}`, { method: 'PATCH', body: data })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user