All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
169 lines
4.0 KiB
JavaScript
169 lines
4.0 KiB
JavaScript
import TaxRecordIcon from '../../components/Icons/TaxRecordIcon'
|
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
import BinIcon from '../../components/Icons/BinIcon'
|
|
|
|
export const TaxRecord = {
|
|
name: 'taxRecord',
|
|
label: 'Tax Record',
|
|
prefix: 'TXR',
|
|
icon: TaxRecordIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/taxrecords/info?taxRecordId=${_id}`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrecords/info?taxRecordId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrecords/info?taxRecordId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrecords/info?taxRecordId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{ type: 'divider' },
|
|
{
|
|
name: 'delete',
|
|
label: 'Delete',
|
|
icon: BinIcon,
|
|
danger: true,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrecords/info?taxRecordId=${_id}&action=delete`
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'taxRate',
|
|
'transactionType',
|
|
'transaction',
|
|
'amount',
|
|
'taxAmount',
|
|
'transactionDate',
|
|
'createdAt'
|
|
],
|
|
filters: ['taxRate', 'transactionType', 'transaction', 'transactionDate'],
|
|
sorters: ['transactionDate', 'amount', 'taxAmount', 'createdAt', '_id'],
|
|
group: ['transactionType'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'taxRecord',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'taxRecord',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'taxRate',
|
|
label: 'Tax Rate',
|
|
required: true,
|
|
type: 'object',
|
|
objectType: 'taxRate',
|
|
showHyperlink: true,
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'transactionType',
|
|
label: 'Transaction Type',
|
|
required: true,
|
|
type: 'select',
|
|
columnWidth: 175,
|
|
options: [
|
|
{ label: 'Purchase Order', value: 'purchaseOrder' },
|
|
{ label: 'Sales Order', value: 'salesOrder' },
|
|
{ label: 'Other', value: 'other' }
|
|
]
|
|
},
|
|
{
|
|
name: 'transaction',
|
|
label: 'Transaction',
|
|
required: true,
|
|
type: 'object',
|
|
objectType: (objectData) => {
|
|
return objectData?.transactionType || 'purchaseOrder'
|
|
},
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'amount',
|
|
label: 'Amount',
|
|
required: true,
|
|
type: 'currency',
|
|
min: 0,
|
|
step: 0.01,
|
|
columnWidth: 125
|
|
},
|
|
{
|
|
name: 'taxAmount',
|
|
label: 'Tax Amount',
|
|
required: true,
|
|
type: 'currency',
|
|
min: 0,
|
|
step: 0.01,
|
|
columnWidth: 125
|
|
},
|
|
{
|
|
name: 'transactionDate',
|
|
label: 'Transaction Date',
|
|
required: true,
|
|
type: 'date',
|
|
columnWidth: 175,
|
|
default: () => new Date()
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
}
|
|
]
|
|
}
|