Compare commits

..

No commits in common. "e730e2c83224b8762f650b017add999579316152" and "c6ec643a2fe86d2b3500d14e6e0dc8ae30b299c5" have entirely different histories.

23 changed files with 32 additions and 44 deletions

View File

@ -9,7 +9,6 @@ import { AuthContext } from '../context/AuthContext'
import merge from 'lodash/merge' import merge from 'lodash/merge'
import IdDisplay from './IdDisplay' import IdDisplay from './IdDisplay'
import SpotlightTooltip from './SpotlightTooltip' import SpotlightTooltip from './SpotlightTooltip'
import StateTag from './StateTag'
const { Text, Link } = Typography const { Text, Link } = Typography
@ -256,7 +255,7 @@ const ObjectDisplay = ({
className='object-display-tag' className='object-display-tag'
> >
<Flex <Flex
gap={objectData?.color || objectData?.state ? 'small' : '5px'} gap={objectData?.color ? 'small' : '5px'}
align='center' align='center'
style={{ minWidth: 0, height: '24px' }} style={{ minWidth: 0, height: '24px' }}
> >
@ -268,13 +267,6 @@ const ObjectDisplay = ({
style={{ marginBottom: '1.5px' }} style={{ marginBottom: '1.5px' }}
/> />
) : null} ) : null}
{objectData?.state ? (
<StateTag
state={objectData?.state.type}
showTag={false}
style={{ marginBottom: '1.5px' }}
/>
) : null}
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
{renderNameDisplay()} {renderNameDisplay()}

View File

@ -8,10 +8,7 @@ import ObjectProperty from './ObjectProperty'
import InfoCircleIcon from '../../Icons/InfoCircleIcon' import InfoCircleIcon from '../../Icons/InfoCircleIcon'
import { ApiServerContext } from '../context/ApiServerContext' import { ApiServerContext } from '../context/ApiServerContext'
import merge from 'lodash/merge' import merge from 'lodash/merge'
import { import { getModelByName } from '../../../database/ObjectModels'
getModelByName,
getModelProperty
} from '../../../database/ObjectModels'
const { Text } = Typography const { Text } = Typography
@ -131,7 +128,7 @@ const SpotlightTooltip = ({ query, type }) => {
return ( return (
<Descriptions.Item key={prop.name} label={prop.label}> <Descriptions.Item key={prop.name} label={prop.label}>
<ObjectProperty <ObjectProperty
{...getModelProperty(type, prop.name)} type={prop.type}
value={value} value={value}
objectData={spotlightData} objectData={spotlightData}
objectType={prop.objectType || type} objectType={prop.objectType || type}

View File

@ -2,7 +2,7 @@ import PropTypes from 'prop-types'
import { Badge, Flex, Tag } from 'antd' import { Badge, Flex, Tag } from 'antd'
import { useMemo } from 'react' import { useMemo } from 'react'
const StateTag = ({ state, showBadge = true, showTag = true, style = {} }) => { const StateTag = ({ state, showBadge = true, style = {} }) => {
const { badgeStatus, badgeText } = useMemo(() => { const { badgeStatus, badgeText } = useMemo(() => {
let status = 'default' let status = 'default'
let text = 'Unknown' let text = 'Unknown'
@ -196,10 +196,6 @@ const StateTag = ({ state, showBadge = true, showTag = true, style = {} }) => {
badgeProps = { color: badgeStatus } badgeProps = { color: badgeStatus }
} }
if (showTag == false) {
return <Badge {...badgeProps} style={{ ...style }} />
}
return ( return (
<Tag color={badgeStatus} style={{ marginRight: 0, ...style }}> <Tag color={badgeStatus} style={{ marginRight: 0, ...style }}>
<Flex gap={6}> <Flex gap={6}>
@ -213,8 +209,7 @@ const StateTag = ({ state, showBadge = true, showTag = true, style = {} }) => {
StateTag.propTypes = { StateTag.propTypes = {
state: PropTypes.string, state: PropTypes.string,
showBadge: PropTypes.bool, showBadge: PropTypes.bool,
style: PropTypes.object, style: PropTypes.object
showTag: PropTypes.bool
} }
export default StateTag export default StateTag

View File

@ -111,7 +111,7 @@ export const DocumentJob = {
objectType: 'printer', objectType: 'printer',
showName: false, showName: false,
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'objectType', name: 'objectType',

View File

@ -113,7 +113,7 @@ export const DocumentPrinter = {
objectType: 'printer', objectType: 'printer',
showName: false, showName: false,
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'connectedAt', name: 'connectedAt',

View File

@ -79,7 +79,7 @@ export const FilamentStock = {
type: 'state', type: 'state',
objectType: 'filamentStock', objectType: 'filamentStock',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'filament', name: 'filament',

View File

@ -132,7 +132,7 @@ export const Host = {
objectType: 'host', objectType: 'host',
showName: false, showName: false,
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'online', name: 'online',

View File

@ -191,7 +191,7 @@ export const Invoice = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'issuedAt', name: 'issuedAt',

View File

@ -132,7 +132,7 @@ export const Job = {
showProgress: true, showProgress: true,
showId: false, showId: false,
showQuantity: false, showQuantity: false,
columnWidth: 260, columnWidth: 250,
readOnly: true readOnly: true
}, },
{ {

View File

@ -248,7 +248,7 @@ export const Listing = {
type: 'state', type: 'state',
objectType: 'listing', objectType: 'listing',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 130
}, },
{ {
name: 'price', name: 'price',

View File

@ -185,7 +185,7 @@ export const ListingVarient = {
type: 'state', type: 'state',
objectType: 'listingVarient', objectType: 'listingVarient',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 130
}, },
{ {
name: 'price', name: 'price',

View File

@ -234,7 +234,7 @@ export const Marketplace = {
type: 'state', type: 'state',
objectType: 'marketplace', objectType: 'marketplace',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 130
}, },
{ {
name: 'active', name: 'active',

View File

@ -165,7 +165,7 @@ export const OrderItem = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'receivedAt', name: 'receivedAt',
@ -374,11 +374,15 @@ export const OrderItem = {
if (!totalAmount) return 0 if (!totalAmount) return 0
if (objectData?.taxRate?.rateType == 'percentage') { if (objectData?.taxRate?.rateType == 'percentage') {
return ( return (
(totalAmount * (1 + objectData?.taxRate?.rate / 100)).toFixed(2) || (
0 totalAmount *
(1 + objectData?.taxRate?.rate / 100)
).toFixed(2) || 0
) )
} else if (objectData?.taxRate?.rateType == 'amount') { } else if (objectData?.taxRate?.rateType == 'amount') {
return (totalAmount + objectData?.taxRate?.rate).toFixed(2) || 0 return (
(totalAmount + objectData?.taxRate?.rate).toFixed(2) || 0
)
} }
return totalAmount return totalAmount
} }

View File

@ -62,7 +62,7 @@ export const PartStock = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 120
}, },
{ {
name: 'updatedAt', name: 'updatedAt',

View File

@ -184,7 +184,7 @@ export const Payment = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'postedAt', name: 'postedAt',

View File

@ -286,7 +286,7 @@ export const Printer = {
objectType: 'printer', objectType: 'printer',
showName: false, showName: false,
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'online', name: 'online',

View File

@ -129,7 +129,7 @@ export const ProductStock = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 120
}, },
{ {
name: 'postedAt', name: 'postedAt',

View File

@ -248,7 +248,7 @@ export const PurchaseOrder = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'postedAt', name: 'postedAt',

View File

@ -230,7 +230,7 @@ export const SalesOrder = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {
name: 'postedAt', name: 'postedAt',

View File

@ -184,7 +184,7 @@ export const Shipment = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 250
}, },
{ {

View File

@ -54,7 +54,7 @@ export const StockAudit = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 120
}, },
{ {
name: 'updatedAt', name: 'updatedAt',

View File

@ -136,7 +136,7 @@ export const StockTransfer = {
label: 'State', label: 'State',
type: 'state', type: 'state',
readOnly: true, readOnly: true,
columnWidth: 260 columnWidth: 120
}, },
{ {
name: 'postedAt', name: 'postedAt',

View File

@ -86,7 +86,7 @@ export const SubJob = {
showProgress: true, showProgress: true,
showId: false, showId: false,
showQuantity: false, showQuantity: false,
columnWidth: 260, columnWidth: 250,
readOnly: true readOnly: true
}, },
{ {