Refactor FilamentSku, PartSku, and ProductSku Models for Improved Readability and Structure
- Updated lazy loading syntax for component imports to enhance code clarity. - Reformatted content return statements in SKU components for better readability. - Added 'overrideCost' and 'overridePrice' fields to SKU models for expanded functionality. - Adjusted column widths for 'Override Cost' and 'Override Price' fields to improve layout consistency.
This commit is contained in:
parent
8c4911809c
commit
da8fe8de2d
@ -1,10 +1,12 @@
|
||||
import { createElement, lazy } from 'react'
|
||||
|
||||
const FilamentSkuInfo = lazy(
|
||||
() => import('../../components/Dashboard/Management/FilamentSkus/FilamentSkuInfo')
|
||||
() =>
|
||||
import('../../components/Dashboard/Management/FilamentSkus/FilamentSkuInfo')
|
||||
)
|
||||
const NewFilamentSku = lazy(
|
||||
() => import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
||||
() =>
|
||||
import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
||||
)
|
||||
const DeleteObject = lazy(
|
||||
() => import('../../components/Dashboard/common/DeleteObject')
|
||||
@ -34,7 +36,11 @@ export const FilamentSku = {
|
||||
label: 'New Filament SKU',
|
||||
icon: PlusIcon,
|
||||
content: (objectData, { onOk } = {}) => {
|
||||
return createElement(NewFilamentSku, { defaultValues: objectData, onOk, reset: true })
|
||||
return createElement(NewFilamentSku, {
|
||||
defaultValues: objectData,
|
||||
onOk,
|
||||
reset: true
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -123,6 +129,7 @@ export const FilamentSku = {
|
||||
'name',
|
||||
'color',
|
||||
'cost',
|
||||
'overrideCost',
|
||||
'costWithTax',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
@ -135,6 +142,7 @@ export const FilamentSku = {
|
||||
'color',
|
||||
'cost',
|
||||
'costWithTax',
|
||||
'overrideCost',
|
||||
'createdAt',
|
||||
'updatedAt'
|
||||
],
|
||||
@ -216,7 +224,7 @@ export const FilamentSku = {
|
||||
label: 'Override Cost',
|
||||
required: true,
|
||||
type: 'bool',
|
||||
columnWidth: 150
|
||||
columnWidth: 162
|
||||
},
|
||||
{
|
||||
name: 'cost',
|
||||
|
||||
@ -34,7 +34,11 @@ export const PartSku = {
|
||||
label: 'New Part SKU',
|
||||
icon: PlusIcon,
|
||||
content: (objectData, { onOk } = {}) => {
|
||||
return createElement(NewPartSku, { defaultValues: objectData, onOk, reset: true })
|
||||
return createElement(NewPartSku, {
|
||||
defaultValues: objectData,
|
||||
onOk,
|
||||
reset: true
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -126,6 +130,8 @@ export const PartSku = {
|
||||
'cost',
|
||||
'costWithTax',
|
||||
'price',
|
||||
'overridePrice',
|
||||
'overrideCost',
|
||||
'priceWithTax',
|
||||
'margin',
|
||||
'createdAt',
|
||||
@ -137,8 +143,10 @@ export const PartSku = {
|
||||
'part',
|
||||
'name',
|
||||
'cost',
|
||||
'overrideCost',
|
||||
'costWithTax',
|
||||
'price',
|
||||
'overridePrice',
|
||||
'priceWithTax',
|
||||
'margin',
|
||||
'createdAt',
|
||||
@ -214,7 +222,7 @@ export const PartSku = {
|
||||
label: 'Override Cost',
|
||||
required: true,
|
||||
type: 'bool',
|
||||
columnWidth: 150
|
||||
columnWidth: 162
|
||||
},
|
||||
|
||||
{
|
||||
@ -295,7 +303,7 @@ export const PartSku = {
|
||||
: objectData?.part?.priceMode
|
||||
},
|
||||
type: 'priceMode',
|
||||
columnWidth: 150
|
||||
columnWidth: 165
|
||||
},
|
||||
{
|
||||
name: 'price',
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import { createElement, lazy } from 'react'
|
||||
|
||||
const ProductSkuInfo = lazy(
|
||||
() => import('../../components/Dashboard/Management/ProductSkus/ProductSkuInfo')
|
||||
() =>
|
||||
import('../../components/Dashboard/Management/ProductSkus/ProductSkuInfo')
|
||||
)
|
||||
const NewProductSku = lazy(
|
||||
() => import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
||||
() =>
|
||||
import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
||||
)
|
||||
const DeleteObject = lazy(
|
||||
() => import('../../components/Dashboard/common/DeleteObject')
|
||||
@ -34,7 +36,11 @@ export const ProductSku = {
|
||||
label: 'New Product SKU',
|
||||
icon: PlusIcon,
|
||||
content: (objectData, { onOk } = {}) => {
|
||||
return createElement(NewProductSku, { defaultValues: objectData, onOk, reset: true })
|
||||
return createElement(NewProductSku, {
|
||||
defaultValues: objectData,
|
||||
onOk,
|
||||
reset: true
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -126,6 +132,8 @@ export const ProductSku = {
|
||||
'cost',
|
||||
'costWithTax',
|
||||
'price',
|
||||
'overridePrice',
|
||||
'overrideCost',
|
||||
'priceWithTax',
|
||||
'margin',
|
||||
'createdAt',
|
||||
@ -140,6 +148,8 @@ export const ProductSku = {
|
||||
'costWithTax',
|
||||
'price',
|
||||
'priceWithTax',
|
||||
'overridePrice',
|
||||
'overrideCost',
|
||||
'margin',
|
||||
'createdAt',
|
||||
'updatedAt'
|
||||
@ -215,7 +225,7 @@ export const ProductSku = {
|
||||
label: 'Override Cost',
|
||||
required: true,
|
||||
type: 'bool',
|
||||
columnWidth: 150
|
||||
columnWidth: 162
|
||||
},
|
||||
{
|
||||
name: 'cost',
|
||||
@ -229,9 +239,7 @@ export const ProductSku = {
|
||||
return objectData?.overrideCost
|
||||
},
|
||||
value: (objectData) =>
|
||||
objectData?.overrideCost
|
||||
? objectData?.cost
|
||||
: objectData?.product?.cost,
|
||||
objectData?.overrideCost ? objectData?.cost : objectData?.product?.cost,
|
||||
columnWidth: 100
|
||||
},
|
||||
{
|
||||
@ -282,7 +290,7 @@ export const ProductSku = {
|
||||
label: 'Override Price',
|
||||
required: true,
|
||||
type: 'bool',
|
||||
columnWidth: 150
|
||||
columnWidth: 165
|
||||
},
|
||||
{
|
||||
name: 'priceMode',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user