123 lines
2.7 KiB
JavaScript

import PersonIcon from '../../components/Icons/PersonIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import PlusIcon from '../../components/Icons/PlusIcon'
export const User = {
name: 'user',
label: 'User',
labelPlural: 'Users',
url: '/dashboard/management/users',
prefix: 'USR',
icon: PersonIcon,
actions: [
{
name: 'info',
label: 'Info',
default: true,
row: true,
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/users/info?userId=${_id}`
},
{
name: 'edit',
label: 'Edit',
row: true,
icon: EditIcon,
url: (_id) => `/dashboard/management/users/info?userId=${_id}&action=edit`
},
{
name: 'newAppPassword',
label: 'New App Password',
type: 'button',
icon: PlusIcon,
url: (_id) =>
`/dashboard/management/users/info?userId=${_id}&action=newAppPassword`,
disabled: (objectData) => {
return objectData?._user?._id != objectData?._id
}
}
],
columns: ['_reference', 'name', 'username', 'email', 'role', 'createdAt'],
filters: ['name', '_id', 'email', 'role'],
sorters: ['name', 'email', 'role', 'createdAt', '_id'],
properties: [
{
name: '_id',
label: 'ID',
columnFixed: 'left',
type: 'id',
objectType: 'user',
showCopy: true,
columnWidth: 140
},
{
name: 'createdAt',
label: 'Created At',
type: 'dateTime',
readOnly: true,
columnWidth: 175
},
{
name: '_reference',
label: 'Reference',
type: 'reference',
columnFixed: 'left',
objectType: 'user',
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: 'firstName',
label: 'First Name',
type: 'text',
columnWidth: 130
},
{
name: 'username',
label: 'Username',
required: true,
type: 'text',
columnWidth: 150
},
{
name: 'lastName',
label: 'Last Name',
type: 'text',
columnWidth: 130
},
{
name: 'email',
label: 'Email',
columnWidth: 300,
type: 'email'
},
{
name: 'profileImage',
label: 'Profile Image',
type: 'file',
fileType: 'image',
previewOpen: true,
showPreview: false,
columnWidth: 150
}
]
}