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'
|
import { createElement, lazy } from 'react'
|
||||||
|
|
||||||
const FilamentSkuInfo = lazy(
|
const FilamentSkuInfo = lazy(
|
||||||
() => import('../../components/Dashboard/Management/FilamentSkus/FilamentSkuInfo')
|
() =>
|
||||||
|
import('../../components/Dashboard/Management/FilamentSkus/FilamentSkuInfo')
|
||||||
)
|
)
|
||||||
const NewFilamentSku = lazy(
|
const NewFilamentSku = lazy(
|
||||||
() => import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
() =>
|
||||||
|
import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
||||||
)
|
)
|
||||||
const DeleteObject = lazy(
|
const DeleteObject = lazy(
|
||||||
() => import('../../components/Dashboard/common/DeleteObject')
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
@ -34,7 +36,11 @@ export const FilamentSku = {
|
|||||||
label: 'New Filament SKU',
|
label: 'New Filament SKU',
|
||||||
icon: PlusIcon,
|
icon: PlusIcon,
|
||||||
content: (objectData, { onOk } = {}) => {
|
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',
|
'name',
|
||||||
'color',
|
'color',
|
||||||
'cost',
|
'cost',
|
||||||
|
'overrideCost',
|
||||||
'costWithTax',
|
'costWithTax',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
@ -135,6 +142,7 @@ export const FilamentSku = {
|
|||||||
'color',
|
'color',
|
||||||
'cost',
|
'cost',
|
||||||
'costWithTax',
|
'costWithTax',
|
||||||
|
'overrideCost',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt'
|
'updatedAt'
|
||||||
],
|
],
|
||||||
@ -216,7 +224,7 @@ export const FilamentSku = {
|
|||||||
label: 'Override Cost',
|
label: 'Override Cost',
|
||||||
required: true,
|
required: true,
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
columnWidth: 150
|
columnWidth: 162
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cost',
|
name: 'cost',
|
||||||
|
|||||||
@ -34,7 +34,11 @@ export const PartSku = {
|
|||||||
label: 'New Part SKU',
|
label: 'New Part SKU',
|
||||||
icon: PlusIcon,
|
icon: PlusIcon,
|
||||||
content: (objectData, { onOk } = {}) => {
|
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',
|
'cost',
|
||||||
'costWithTax',
|
'costWithTax',
|
||||||
'price',
|
'price',
|
||||||
|
'overridePrice',
|
||||||
|
'overrideCost',
|
||||||
'priceWithTax',
|
'priceWithTax',
|
||||||
'margin',
|
'margin',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@ -137,8 +143,10 @@ export const PartSku = {
|
|||||||
'part',
|
'part',
|
||||||
'name',
|
'name',
|
||||||
'cost',
|
'cost',
|
||||||
|
'overrideCost',
|
||||||
'costWithTax',
|
'costWithTax',
|
||||||
'price',
|
'price',
|
||||||
|
'overridePrice',
|
||||||
'priceWithTax',
|
'priceWithTax',
|
||||||
'margin',
|
'margin',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@ -214,7 +222,7 @@ export const PartSku = {
|
|||||||
label: 'Override Cost',
|
label: 'Override Cost',
|
||||||
required: true,
|
required: true,
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
columnWidth: 150
|
columnWidth: 162
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -295,7 +303,7 @@ export const PartSku = {
|
|||||||
: objectData?.part?.priceMode
|
: objectData?.part?.priceMode
|
||||||
},
|
},
|
||||||
type: 'priceMode',
|
type: 'priceMode',
|
||||||
columnWidth: 150
|
columnWidth: 165
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'price',
|
name: 'price',
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { createElement, lazy } from 'react'
|
import { createElement, lazy } from 'react'
|
||||||
|
|
||||||
const ProductSkuInfo = lazy(
|
const ProductSkuInfo = lazy(
|
||||||
() => import('../../components/Dashboard/Management/ProductSkus/ProductSkuInfo')
|
() =>
|
||||||
|
import('../../components/Dashboard/Management/ProductSkus/ProductSkuInfo')
|
||||||
)
|
)
|
||||||
const NewProductSku = lazy(
|
const NewProductSku = lazy(
|
||||||
() => import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
() =>
|
||||||
|
import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
||||||
)
|
)
|
||||||
const DeleteObject = lazy(
|
const DeleteObject = lazy(
|
||||||
() => import('../../components/Dashboard/common/DeleteObject')
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
@ -34,7 +36,11 @@ export const ProductSku = {
|
|||||||
label: 'New Product SKU',
|
label: 'New Product SKU',
|
||||||
icon: PlusIcon,
|
icon: PlusIcon,
|
||||||
content: (objectData, { onOk } = {}) => {
|
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',
|
'cost',
|
||||||
'costWithTax',
|
'costWithTax',
|
||||||
'price',
|
'price',
|
||||||
|
'overridePrice',
|
||||||
|
'overrideCost',
|
||||||
'priceWithTax',
|
'priceWithTax',
|
||||||
'margin',
|
'margin',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@ -140,6 +148,8 @@ export const ProductSku = {
|
|||||||
'costWithTax',
|
'costWithTax',
|
||||||
'price',
|
'price',
|
||||||
'priceWithTax',
|
'priceWithTax',
|
||||||
|
'overridePrice',
|
||||||
|
'overrideCost',
|
||||||
'margin',
|
'margin',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt'
|
'updatedAt'
|
||||||
@ -215,7 +225,7 @@ export const ProductSku = {
|
|||||||
label: 'Override Cost',
|
label: 'Override Cost',
|
||||||
required: true,
|
required: true,
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
columnWidth: 150
|
columnWidth: 162
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cost',
|
name: 'cost',
|
||||||
@ -229,9 +239,7 @@ export const ProductSku = {
|
|||||||
return objectData?.overrideCost
|
return objectData?.overrideCost
|
||||||
},
|
},
|
||||||
value: (objectData) =>
|
value: (objectData) =>
|
||||||
objectData?.overrideCost
|
objectData?.overrideCost ? objectData?.cost : objectData?.product?.cost,
|
||||||
? objectData?.cost
|
|
||||||
: objectData?.product?.cost,
|
|
||||||
columnWidth: 100
|
columnWidth: 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -282,7 +290,7 @@ export const ProductSku = {
|
|||||||
label: 'Override Price',
|
label: 'Override Price',
|
||||||
required: true,
|
required: true,
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
columnWidth: 150
|
columnWidth: 165
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'priceMode',
|
name: 'priceMode',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user