Compare commits
3 Commits
c6ec643a2f
...
e730e2c832
| Author | SHA1 | Date | |
|---|---|---|---|
| e730e2c832 | |||
| 084d807c95 | |||
| 8319d3d7b3 |
@ -9,6 +9,7 @@ import { AuthContext } from '../context/AuthContext'
|
||||
import merge from 'lodash/merge'
|
||||
import IdDisplay from './IdDisplay'
|
||||
import SpotlightTooltip from './SpotlightTooltip'
|
||||
import StateTag from './StateTag'
|
||||
|
||||
const { Text, Link } = Typography
|
||||
|
||||
@ -255,7 +256,7 @@ const ObjectDisplay = ({
|
||||
className='object-display-tag'
|
||||
>
|
||||
<Flex
|
||||
gap={objectData?.color ? 'small' : '5px'}
|
||||
gap={objectData?.color || objectData?.state ? 'small' : '5px'}
|
||||
align='center'
|
||||
style={{ minWidth: 0, height: '24px' }}
|
||||
>
|
||||
@ -267,6 +268,13 @@ const ObjectDisplay = ({
|
||||
style={{ marginBottom: '1.5px' }}
|
||||
/>
|
||||
) : null}
|
||||
{objectData?.state ? (
|
||||
<StateTag
|
||||
state={objectData?.state.type}
|
||||
showTag={false}
|
||||
style={{ marginBottom: '1.5px' }}
|
||||
/>
|
||||
) : null}
|
||||
<div style={{ minWidth: 0 }}>
|
||||
{renderNameDisplay()}
|
||||
|
||||
|
||||
@ -8,7 +8,10 @@ import ObjectProperty from './ObjectProperty'
|
||||
import InfoCircleIcon from '../../Icons/InfoCircleIcon'
|
||||
import { ApiServerContext } from '../context/ApiServerContext'
|
||||
import merge from 'lodash/merge'
|
||||
import { getModelByName } from '../../../database/ObjectModels'
|
||||
import {
|
||||
getModelByName,
|
||||
getModelProperty
|
||||
} from '../../../database/ObjectModels'
|
||||
|
||||
const { Text } = Typography
|
||||
|
||||
@ -128,7 +131,7 @@ const SpotlightTooltip = ({ query, type }) => {
|
||||
return (
|
||||
<Descriptions.Item key={prop.name} label={prop.label}>
|
||||
<ObjectProperty
|
||||
type={prop.type}
|
||||
{...getModelProperty(type, prop.name)}
|
||||
value={value}
|
||||
objectData={spotlightData}
|
||||
objectType={prop.objectType || type}
|
||||
|
||||
@ -2,7 +2,7 @@ import PropTypes from 'prop-types'
|
||||
import { Badge, Flex, Tag } from 'antd'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
const StateTag = ({ state, showBadge = true, style = {} }) => {
|
||||
const StateTag = ({ state, showBadge = true, showTag = true, style = {} }) => {
|
||||
const { badgeStatus, badgeText } = useMemo(() => {
|
||||
let status = 'default'
|
||||
let text = 'Unknown'
|
||||
@ -196,6 +196,10 @@ const StateTag = ({ state, showBadge = true, style = {} }) => {
|
||||
badgeProps = { color: badgeStatus }
|
||||
}
|
||||
|
||||
if (showTag == false) {
|
||||
return <Badge {...badgeProps} style={{ ...style }} />
|
||||
}
|
||||
|
||||
return (
|
||||
<Tag color={badgeStatus} style={{ marginRight: 0, ...style }}>
|
||||
<Flex gap={6}>
|
||||
@ -209,7 +213,8 @@ const StateTag = ({ state, showBadge = true, style = {} }) => {
|
||||
StateTag.propTypes = {
|
||||
state: PropTypes.string,
|
||||
showBadge: PropTypes.bool,
|
||||
style: PropTypes.object
|
||||
style: PropTypes.object,
|
||||
showTag: PropTypes.bool
|
||||
}
|
||||
|
||||
export default StateTag
|
||||
|
||||
@ -111,7 +111,7 @@ export const DocumentJob = {
|
||||
objectType: 'printer',
|
||||
showName: false,
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'objectType',
|
||||
|
||||
@ -113,7 +113,7 @@ export const DocumentPrinter = {
|
||||
objectType: 'printer',
|
||||
showName: false,
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'connectedAt',
|
||||
|
||||
@ -79,7 +79,7 @@ export const FilamentStock = {
|
||||
type: 'state',
|
||||
objectType: 'filamentStock',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'filament',
|
||||
|
||||
@ -132,7 +132,7 @@ export const Host = {
|
||||
objectType: 'host',
|
||||
showName: false,
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'online',
|
||||
|
||||
@ -191,7 +191,7 @@ export const Invoice = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'issuedAt',
|
||||
|
||||
@ -132,7 +132,7 @@ export const Job = {
|
||||
showProgress: true,
|
||||
showId: false,
|
||||
showQuantity: false,
|
||||
columnWidth: 250,
|
||||
columnWidth: 260,
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
|
||||
@ -248,7 +248,7 @@ export const Listing = {
|
||||
type: 'state',
|
||||
objectType: 'listing',
|
||||
readOnly: true,
|
||||
columnWidth: 130
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'price',
|
||||
|
||||
@ -185,7 +185,7 @@ export const ListingVarient = {
|
||||
type: 'state',
|
||||
objectType: 'listingVarient',
|
||||
readOnly: true,
|
||||
columnWidth: 130
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'price',
|
||||
|
||||
@ -234,7 +234,7 @@ export const Marketplace = {
|
||||
type: 'state',
|
||||
objectType: 'marketplace',
|
||||
readOnly: true,
|
||||
columnWidth: 130
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'active',
|
||||
|
||||
@ -165,7 +165,7 @@ export const OrderItem = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'receivedAt',
|
||||
@ -374,15 +374,11 @@ export const OrderItem = {
|
||||
if (!totalAmount) return 0
|
||||
if (objectData?.taxRate?.rateType == 'percentage') {
|
||||
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') {
|
||||
return (
|
||||
(totalAmount + objectData?.taxRate?.rate).toFixed(2) || 0
|
||||
)
|
||||
return (totalAmount + objectData?.taxRate?.rate).toFixed(2) || 0
|
||||
}
|
||||
return totalAmount
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ export const PartStock = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 120
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'updatedAt',
|
||||
|
||||
@ -184,7 +184,7 @@ export const Payment = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'postedAt',
|
||||
|
||||
@ -286,7 +286,7 @@ export const Printer = {
|
||||
objectType: 'printer',
|
||||
showName: false,
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'online',
|
||||
|
||||
@ -129,7 +129,7 @@ export const ProductStock = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 120
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'postedAt',
|
||||
|
||||
@ -248,7 +248,7 @@ export const PurchaseOrder = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'postedAt',
|
||||
|
||||
@ -230,7 +230,7 @@ export const SalesOrder = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'postedAt',
|
||||
|
||||
@ -184,7 +184,7 @@ export const Shipment = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 250
|
||||
columnWidth: 260
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ export const StockAudit = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 120
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'updatedAt',
|
||||
|
||||
@ -136,7 +136,7 @@ export const StockTransfer = {
|
||||
label: 'State',
|
||||
type: 'state',
|
||||
readOnly: true,
|
||||
columnWidth: 120
|
||||
columnWidth: 260
|
||||
},
|
||||
{
|
||||
name: 'postedAt',
|
||||
|
||||
@ -86,7 +86,7 @@ export const SubJob = {
|
||||
showProgress: true,
|
||||
showId: false,
|
||||
showQuantity: false,
|
||||
columnWidth: 250,
|
||||
columnWidth: 260,
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user