Tom Butcher 8e393e229f
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
Implemented market places.
2026-03-13 23:32:23 +00:00

203 lines
4.2 KiB
JavaScript

import ClientIcon from '../../components/Icons/ClientIcon'
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 ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const Client = {
name: 'client',
label: 'Client',
prefix: 'CLI',
icon: ClientIcon,
actions: [
{
name: 'info',
label: 'Info',
default: true,
row: true,
icon: InfoCircleIcon,
url: (_id) => `/dashboard/sales/clients/info?clientId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/sales/clients/info?clientId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',
row: true,
icon: EditIcon,
url: (_id) => `/dashboard/sales/clients/info?clientId=${_id}&action=edit`,
visible: (objectData) => {
return !(objectData?._isEditing && objectData?._isEditing == true)
}
},
{
name: 'finishEdit',
label: 'Save Edits',
icon: CheckIcon,
url: (_id) =>
`/dashboard/sales/clients/info?clientId=${_id}&action=finishEdit`,
visible: (objectData) => {
return objectData?._isEditing && objectData?._isEditing == true
}
},
{
name: 'cancelEdit',
label: 'Cancel Edits',
icon: XMarkIcon,
url: (_id) =>
`/dashboard/sales/clients/info?clientId=${_id}&action=cancelEdit`,
visible: (objectData) => {
return objectData?._isEditing && objectData?._isEditing == true
}
},
{ type: 'divider' },
{
name: 'delete',
label: 'Delete',
icon: BinIcon,
danger: true,
url: (_id) =>
`/dashboard/sales/clients/info?clientId=${_id}&action=delete`
}
],
columns: [
'_reference',
'name',
'country',
'email',
'phone',
'active',
'createdAt',
'updatedAt'
],
filters: [
'name',
'_id',
'country',
'email',
'phone',
'active',
'marketplace',
'createdAt',
'updatedAt'
],
sorters: [
'name',
'country',
'email',
'phone',
'active',
'createdAt',
'updatedAt',
'_id'
],
group: [],
properties: [
{
name: '_id',
label: 'ID',
columnFixed: 'left',
type: 'id',
objectType: 'client',
showCopy: true,
columnWidth: 140
},
{
name: 'createdAt',
label: 'Created At',
type: 'dateTime',
readOnly: true,
columnWidth: 175
},
{
name: '_reference',
label: 'Reference',
type: 'reference',
columnFixed: 'left',
objectType: 'client',
showCopy: true,
readOnly: true
},
{
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',
type: 'bool',
readOnly: false,
required: true,
columnWidth: 125
},
{
name: 'country',
label: 'Country',
type: 'country',
readOnly: false,
required: false,
columnWidth: 150
},
{
name: 'email',
label: 'Email',
columnWidth: 300,
type: 'email',
readOnly: false,
required: false
},
{
name: 'phone',
label: 'Phone',
type: 'phone',
readOnly: false,
required: false,
columnWidth: 140
},
{
name: 'tags',
label: 'Tags',
type: 'tags',
readOnly: false,
required: false,
columnWidth: 200
},
{
name: 'address',
label: 'Address',
type: 'address',
readOnly: false,
required: false,
columnWidth: 250
},
{
name: 'marketplace',
label: 'Marketplace',
type: 'object',
objectType: 'marketplace',
showHyperlink: true,
readOnly: false,
required: false,
columnWidth: 200
}
]
}