Enhance OrderItem model and components with new invoicing fields

- Added new fields for invoicing, including invoicedAmount, invoicedAmountWithTax, invoicedQuantity, and their remaining counterparts in the OrderItem model.
- Updated NewOrderItem and OrderItemInfo components to include visibility settings for the new invoicing fields.
- Adjusted label widths in OrderItemInfo for better layout consistency.
This commit is contained in:
Tom Butcher 2025-12-28 01:09:57 +00:00
parent bace57b436
commit de74fb0668
3 changed files with 128 additions and 4 deletions

View File

@ -33,7 +33,15 @@ const NewOrderItem = ({ onOk, reset, defaultValues }) => {
itemAmount: false,
totalAmount: false,
totalAmountWithTax: false,
quantity: false
quantity: false,
invoicedAmount: false,
invoicedAmountWithTax: false,
invoicedQuantity: false,
invoicedAmountRemaining: false,
invoicedAmountWithTaxRemaining: false,
invoicedQuantityRemaining: false,
orderedAt: false,
receivedAt: false
}}
/>
)
@ -71,7 +79,16 @@ const NewOrderItem = ({ onOk, reset, defaultValues }) => {
required={false}
objectData={objectData}
visibleProperties={{
shipment: true
shipment: true,
invoicedAmount: false,
invoicedAmountWithTax: false,
invoicedQuantity: false,
invoicedAmountRemaining: false,
invoicedAmountWithTaxRemaining: false,
invoicedQuantityRemaining: false,
orderedAt: false,
receivedAt: false,
syncAmount: false
}}
/>
)
@ -88,7 +105,15 @@ const NewOrderItem = ({ onOk, reset, defaultValues }) => {
_id: false,
createdAt: false,
updatedAt: false,
_reference: false
_reference: false,
invoicedAmount: false,
invoicedAmountWithTax: false,
invoicedQuantity: false,
invoicedAmountRemaining: false,
invoicedAmountWithTaxRemaining: false,
invoicedQuantityRemaining: false,
orderedAt: false,
receivedAt: false
}}
isEditing={false}
objectData={objectData}

View File

@ -155,7 +155,7 @@ const OrderItemInfo = () => {
isEditing={isEditing}
type='orderItem'
objectData={objectData}
labelWidth='200px'
labelWidth='275px'
/>
</InfoCollapse>
</Flex>

View File

@ -82,6 +82,7 @@ export const OrderItem = {
sorters: ['createdAt', 'updatedAt', 'itemAmount', 'quantity'],
columns: [
'_reference',
'name',
'state',
'itemType',
'item',
@ -92,6 +93,14 @@ export const OrderItem = {
'totalAmountWithTax',
'order',
'shipment',
'invoicedAmount',
'invoicedAmountWithTax',
'invoicedQuantity',
'invoicedAmountRemaining',
'invoicedAmountWithTaxRemaining',
'invoicedQuantityRemaining',
'orderedAt',
'receivedAt',
'createdAt',
'updatedAt'
],
@ -126,7 +135,30 @@ export const OrderItem = {
type: 'dateTime',
readOnly: true
},
{
name: 'name',
label: 'Name',
type: 'text',
readOnly: true,
value: (objectData) => {
return objectData?.item?.name
}
},
{
name: 'orderedAt',
label: 'Ordered At',
type: 'dateTime',
required: false,
readOnly: true
},
{ name: 'state', label: 'State', type: 'state', readOnly: true },
{
name: 'receivedAt',
label: 'Received At',
type: 'dateTime',
required: false,
readOnly: true
},
{
name: 'orderType',
label: 'Order Type',
@ -201,6 +233,7 @@ export const OrderItem = {
prefix: '£',
min: 0,
step: 0.01,
fixedNumber: 2,
readOnly: (objectData) => {
return objectData?.syncAmount != null
},
@ -231,6 +264,7 @@ export const OrderItem = {
min: 0,
step: 0.01,
columnWidth: 150,
fixedNumber: 2,
readOnly: true,
value: (objectData) => {
if (objectData?.itemAmount && objectData?.quantity) {
@ -272,6 +306,7 @@ export const OrderItem = {
label: 'Total Amount w/ Tax',
type: 'number',
required: true,
fixedNumber: 2,
readOnly: true,
prefix: '£',
min: 0,
@ -298,6 +333,70 @@ export const OrderItem = {
return totalAmount || 0
}
}
},
{
name: 'invoicedAmount',
label: 'Invoiced Amount',
type: 'number',
required: false,
readOnly: true,
prefix: '£',
fixedNumber: 2,
min: 0,
step: 0.01,
columnWidth: 150
},
{
name: 'invoicedAmountWithTax',
label: 'Invoiced Amount w/ Tax',
type: 'number',
required: false,
readOnly: true,
prefix: '£',
fixedNumber: 2,
min: 0,
step: 0.01,
columnWidth: 200
},
{
name: 'invoicedQuantity',
label: 'Invoiced Quantity',
type: 'number',
required: false,
readOnly: true,
columnWidth: 150
},
{
name: 'invoicedAmountRemaining',
label: 'Remaining Invoiced Amount',
type: 'number',
required: false,
readOnly: true,
prefix: '£',
min: 0,
step: 0.01,
columnWidth: 225,
fixedNumber: 2
},
{
name: 'invoicedAmountWithTaxRemaining',
label: 'Remaining Invoiced Amount w/ Tax',
type: 'number',
required: false,
readOnly: true,
prefix: '£',
min: 0,
fixedNumber: 2,
step: 0.01,
columnWidth: 275
},
{
name: 'invoicedQuantityRemaining',
label: 'Remaining Invoiced Quantity',
type: 'number',
required: false,
readOnly: true,
columnWidth: 225
}
]
}