143 lines
3.4 KiB
JavaScript
143 lines
3.4 KiB
JavaScript
import CourierIcon from '../../components/Icons/CourierIcon'
|
|
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 Courier = {
|
|
name: 'courier',
|
|
label: 'Courier',
|
|
prefix: 'COR',
|
|
icon: CourierIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/couriers/info?courierId=${_id}`
|
|
},
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/couriers/info?courierId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/couriers/info?courierId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/couriers/info?courierId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/couriers/info?courierId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
console.log(objectData?._isEditing)
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{ type: 'divider' },
|
|
{
|
|
name: 'delete',
|
|
label: 'Delete',
|
|
icon: BinIcon,
|
|
danger: true,
|
|
url: (_id) =>
|
|
`/dashboard/management/couriers/info?courierId=${_id}&action=delete`
|
|
}
|
|
],
|
|
columns: ['name', '_id', 'country', 'email', 'website', 'createdAt'],
|
|
filters: ['name', '_id', 'country', 'email'],
|
|
sorters: ['name', 'country', 'email', 'createdAt', '_id'],
|
|
group: ['country'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'courier',
|
|
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: 'country',
|
|
label: 'Country',
|
|
type: 'country',
|
|
readOnly: false,
|
|
required: false
|
|
},
|
|
{
|
|
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
|
|
}
|
|
]
|
|
}
|