197 lines
4.3 KiB
JavaScript
197 lines
4.3 KiB
JavaScript
import TaxRateIcon from '../../components/Icons/TaxRateIcon'
|
|
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 TaxRate = {
|
|
name: 'taxRate',
|
|
label: 'Tax Rate',
|
|
labelPlural: 'Tax Rates',
|
|
url: '/dashboard/management/taxrates',
|
|
prefix: 'TXR',
|
|
icon: TaxRateIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/taxrates/info?taxRateId=${_id}`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrates/info?taxRateId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrates/info?taxRateId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/taxrates/info?taxRateId=${_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/taxrates/info?taxRateId=${_id}&action=delete`
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'name',
|
|
'rate',
|
|
'rateType',
|
|
'active',
|
|
'country',
|
|
'createdAt'
|
|
],
|
|
filters: ['name', '_id', 'rate', 'rateType', 'active', 'country'],
|
|
sorters: [
|
|
'name',
|
|
'rate',
|
|
'rateType',
|
|
'active',
|
|
'country',
|
|
'createdAt',
|
|
'_id'
|
|
],
|
|
group: ['country', 'rateType'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'taxRate',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'taxRate',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
columnFixed: 'left',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
required: true,
|
|
type: 'bool',
|
|
default: true,
|
|
columnWidth: 125
|
|
},
|
|
{
|
|
name: 'effectiveFrom',
|
|
label: 'Effective From',
|
|
type: 'date',
|
|
readOnly: false,
|
|
required: false,
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'rate',
|
|
label: 'Rate',
|
|
required: true,
|
|
type: 'number',
|
|
min: 0,
|
|
step: 0.01,
|
|
prefix: (objectData) => {
|
|
return objectData?.rateType == 'amount' ? '£' : undefined
|
|
},
|
|
suffix: (objectData) => {
|
|
return objectData?.rateType == 'percentage' ? '%' : undefined
|
|
},
|
|
columnWidth: 100
|
|
},
|
|
|
|
{
|
|
name: 'effectiveTo',
|
|
label: 'Effective To',
|
|
type: 'date',
|
|
readOnly: false,
|
|
required: false,
|
|
columnWidth: 150
|
|
},
|
|
|
|
{
|
|
name: 'rateType',
|
|
label: 'Rate Type',
|
|
required: true,
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'Percentage', value: 'percentage' },
|
|
{ label: 'Amount', value: 'amount' }
|
|
],
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'country',
|
|
label: 'Country',
|
|
type: 'country',
|
|
readOnly: false,
|
|
required: false,
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'description',
|
|
label: 'Description',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false,
|
|
columnWidth: 200
|
|
}
|
|
]
|
|
}
|