feat(admin): allow late container number entry

This commit is contained in:
2026-09-01 15:24:37 +08:00
parent b4c29e2226
commit 0b676ddb74
23 changed files with 155 additions and 71 deletions
+8 -3
View File
@@ -5,6 +5,7 @@ import type {
TruckAppointmentPage,
TruckAppointmentQuery,
TruckAppointmentResource,
TruckAppointmentActionRequest,
TruckAppointmentStatusHistory,
TruckAttachmentReference,
TruckAttachmentType,
@@ -110,13 +111,17 @@ export type TruckAppointmentAction = 'SUBMIT' | 'DISPATCH' | 'PICKUP' | 'ARRIVE'
export async function performTruckAppointmentAction(
id: string | number,
action: TruckAppointmentAction,
expectedVersion: number,
reason?: string,
payload: TruckAppointmentActionRequest,
idempotencyKey?: string,
requestHash?: string,
) {
const operationKey = idempotencyKey || operationId(action, id)
const response = await http.post<ApiEnvelope<TruckAppointmentResource>, ApiEnvelope<TruckAppointmentResource>>(`${basePath}/${id}/${action.toLowerCase()}`, { expectedVersion, reason: reason || null }, {
const body = {
expectedVersion: payload.expectedVersion,
reason: payload.reason || null,
...(payload.containerNo ? { containerNo: payload.containerNo } : {}),
}
const response = await http.post<ApiEnvelope<TruckAppointmentResource>, ApiEnvelope<TruckAppointmentResource>>(`${basePath}/${id}/${action.toLowerCase()}`, body, {
headers: { 'Idempotency-Key': operationKey, ...(requestHash ? { 'X-Request-Hash': requestHash } : {}) },
})
return unwrapApiResponse(response)