Update Part model to enforce required fields for cost, costWithTax, priceMode, price, margin, priceWithTax, and priceTaxRate. Remove fileName property and improve filter and sorter organization for better clarity and maintainability.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-06-21 23:13:25 +01:00
parent 8677691da3
commit 156d2a8baf

View File

@ -74,8 +74,26 @@ export const Part = {
'createdAt',
'updatedAt'
],
filters: ['name', '_id', 'priceMode', 'cost', 'costWithTax', 'price', 'priceWithTax'],
sorters: ['name', 'priceMode', 'cost', 'costWithTax', 'price', 'priceWithTax', 'createdAt', 'updatedAt', '_id'],
filters: [
'name',
'_id',
'priceMode',
'cost',
'costWithTax',
'price',
'priceWithTax'
],
sorters: [
'name',
'priceMode',
'cost',
'costWithTax',
'price',
'priceWithTax',
'createdAt',
'updatedAt',
'_id'
],
properties: [
{
name: '_id',
@ -119,13 +137,6 @@ export const Part = {
readOnly: true,
columnWidth: 175
},
{
name: 'fileName',
label: 'File Name',
required: false,
type: 'text',
columnWidth: 200
},
{
name: 'file',
label: 'File',
@ -137,7 +148,7 @@ export const Part = {
{
name: 'cost',
label: 'Cost',
required: false,
required: true,
type: 'number',
prefix: '£',
min: 0,
@ -147,7 +158,7 @@ export const Part = {
{
name: 'costWithTax',
label: 'Cost w/ Tax',
required: false,
required: true,
readOnly: true,
type: 'number',
prefix: '£',
@ -170,7 +181,7 @@ export const Part = {
{
name: 'costTaxRate',
label: 'Cost Tax Rate',
required: false,
required: true,
type: 'object',
objectType: 'taxRate',
showHyperlink: true,
@ -179,14 +190,14 @@ export const Part = {
{
name: 'priceMode',
label: 'Price Mode',
required: false,
required: true,
columnWidth: 150,
type: 'priceMode'
},
{
name: 'price',
label: 'Price',
required: false,
required: true,
type: 'number',
prefix: '£',
min: 0,
@ -211,7 +222,7 @@ export const Part = {
{
name: 'margin',
label: 'Margin',
required: false,
required: true,
type: 'number',
disabled: (objectData) => objectData?.priceMode == 'amount',
suffix: '%',
@ -223,7 +234,7 @@ export const Part = {
{
name: 'priceWithTax',
label: 'Price w/ Tax',
required: false,
required: true,
readOnly: true,
type: 'number',
prefix: '£',
@ -255,7 +266,7 @@ export const Part = {
{
name: 'priceTaxRate',
label: 'Price Tax Rate',
required: false,
required: true,
type: 'object',
objectType: 'taxRate',
showHyperlink: true,