223 lines
4.5 KiB
JavaScript
223 lines
4.5 KiB
JavaScript
import VendorIcon from '../../components/Icons/VendorIcon'
|
|
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 Vendor = {
|
|
name: 'vendor',
|
|
label: 'Vendor',
|
|
prefix: 'VEN',
|
|
icon: VendorIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/vendors/info?vendorId=${_id}`
|
|
},
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/vendors/info?vendorId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/vendors/info?vendorId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/vendors/info?vendorId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/vendors/info?vendorId=${_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/vendors/info?vendorId=${_id}&action=delete`
|
|
}
|
|
],
|
|
columns: [
|
|
'name',
|
|
'_id',
|
|
'country',
|
|
'email',
|
|
'website',
|
|
'active',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: [
|
|
'name',
|
|
'_id',
|
|
'country',
|
|
'email',
|
|
'active',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
sorters: [
|
|
'name',
|
|
'country',
|
|
'email',
|
|
'active',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_id'
|
|
],
|
|
group: ['country'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'vendor',
|
|
showCopy: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
columnFixed: 'left',
|
|
required: true,
|
|
type: 'text'
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'contact',
|
|
label: 'Contact',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
type: 'bool',
|
|
readOnly: false,
|
|
required: true
|
|
},
|
|
{
|
|
name: 'country',
|
|
label: 'Country',
|
|
type: 'country',
|
|
readOnly: false,
|
|
required: true
|
|
},
|
|
{
|
|
name: 'email',
|
|
label: 'Email',
|
|
columnWidth: 300,
|
|
type: 'email',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'phone',
|
|
label: 'Phone',
|
|
type: 'phone',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'website',
|
|
label: 'Website',
|
|
columnWidth: 300,
|
|
type: 'url',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.building',
|
|
label: 'Building',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.addressLine1',
|
|
label: 'Address Line 1',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.addressLine2',
|
|
label: 'Address Line 2',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.city',
|
|
label: 'City',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.state',
|
|
label: 'State',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.postcode',
|
|
label: 'Postcode',
|
|
type: 'text',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'address.country',
|
|
label: 'Country',
|
|
type: 'country',
|
|
readOnly: false,
|
|
required: false
|
|
}
|
|
]
|
|
}
|