feat(web-admin): submit stable load/delivery/product ids on plan save.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2e5b05f477
commit
c90ff7c419
3 files changed
+24
-5
No files matched your search
@@ -84,6 +84,7 @@ export function formatStopArchiveAmount(
|
||||
}
|
||||
|
||||
export interface PlanLoadForm {
|
||||
id?: string
|
||||
customerId: string
|
||||
customerName: string
|
||||
address: string
|
||||
@@ -99,6 +100,7 @@ export interface PlanLoadForm {
|
||||
}
|
||||
|
||||
export interface PlanDeliveryForm {
|
||||
id?: string
|
||||
seq: number
|
||||
customerId: string
|
||||
customerName: string
|
||||
@@ -440,6 +442,7 @@ export function mapLoadFromApi(
|
||||
vehiclePlate
|
||||
)
|
||||
return {
|
||||
id: load.id || undefined,
|
||||
customerId: load.customerId || '',
|
||||
customerName: load.customerName || '',
|
||||
address: load.address || '',
|
||||
@@ -472,6 +475,7 @@ export function mapDeliveriesFromApi(
|
||||
vehiclePlate
|
||||
)
|
||||
return {
|
||||
id: row.id || undefined,
|
||||
seq: row.seq ?? index + 1,
|
||||
customerId: row.customerId || '',
|
||||
customerName: row.customerName || '',
|
||||
@@ -721,6 +725,7 @@ export function buildStopProductPayload(row: PlanStopProductFormRow) {
|
||||
|
||||
export function buildLoadPayload(load: PlanLoadForm) {
|
||||
return {
|
||||
...(load.id ? { id: load.id } : {}),
|
||||
customerId: load.customerId,
|
||||
customerName: load.customerName,
|
||||
address: load.address || undefined,
|
||||
@@ -738,6 +743,7 @@ export function buildLoadPayload(load: PlanLoadForm) {
|
||||
|
||||
export function buildDeliveriesPayload(deliveries: PlanDeliveryForm[]) {
|
||||
return deliveries.map((row, index) => ({
|
||||
...(row.id ? { id: row.id } : {}),
|
||||
seq: row.seq || index + 1,
|
||||
customerId: row.customerId,
|
||||
customerName: row.customerName,
|
||||
|
||||
Reference in new issue
Block a user