21 lines
531 B
TypeScript
21 lines
531 B
TypeScript
export type MockWorkOrderShop = {
|
||
sellerId: string
|
||
shopId: string
|
||
shopName: string
|
||
enabled: boolean
|
||
}
|
||
|
||
export function buildMockWorkOrderShopOptions(shops: MockWorkOrderShop[]) {
|
||
return shops
|
||
.filter((shop) => shop.enabled)
|
||
.map((shop) => {
|
||
const value = String(shop.sellerId || shop.shopId || '').trim()
|
||
const name = String(shop.shopName || shop.shopId || value).trim()
|
||
return {
|
||
value,
|
||
label: `${name}(${value})`,
|
||
}
|
||
})
|
||
.filter((shop) => Boolean(shop.value))
|
||
}
|