feat(web-admin): plan form package UI keyed by product and package spec
Contract-bound stop products use package options from the contract, arrange-qty cache/API include packageSpec, and save validates required package selections. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ded6aeaa85
commit
39161e43e4
9 files changed
+342
-37
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
isPlDibangOptionalVehiclePlate,
|
||||
isPlInternalCustomerName
|
||||
} from '@/utils/pl-internal-customer'
|
||||
import { normalizePackageSpec } from '@/utils/pl-plan-contract-product'
|
||||
|
||||
export interface PlanStopProductFormRow {
|
||||
id?: string
|
||||
@@ -214,6 +215,17 @@ function matchPrevStopProduct(
|
||||
return stopProducts[byPlanProductId]
|
||||
}
|
||||
}
|
||||
const targetPkg = normalizePackageSpec(planRow.packageSpec)
|
||||
const byProductAndPkg = stopProducts.findIndex(
|
||||
(row, index) =>
|
||||
!used.has(index) &&
|
||||
String(row.productId) === String(planRow.productId) &&
|
||||
normalizePackageSpec(row.packageSpec) === targetPkg
|
||||
)
|
||||
if (byProductAndPkg >= 0) {
|
||||
used.add(byProductAndPkg)
|
||||
return stopProducts[byProductAndPkg]
|
||||
}
|
||||
const byProductId = stopProducts.findIndex(
|
||||
(row, index) => !used.has(index) && String(row.productId) === String(planRow.productId)
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user