JetUp iMac 3
3 years ago
2 changed files with 112 additions and 92 deletions
@ -1,180 +1,200 @@
@@ -1,180 +1,200 @@
|
||||
import React from "react"; |
||||
import { EUserStatus } from "@/shared"; |
||||
import moment from "moment"; |
||||
import '../styles.scss' |
||||
import { voidColumn, VOID_COLUMN_KEY } from "@/components/TableGrid/configs/void-row.config"; |
||||
import "../styles.scss"; |
||||
import { |
||||
voidColumn, |
||||
VOID_COLUMN_KEY, |
||||
} from "@/components/TableGrid/configs/void-row.config"; |
||||
|
||||
export const columnsConfig: any = [ |
||||
voidColumn, |
||||
{ |
||||
name: 'ПІБ', |
||||
key: 'name', |
||||
name: "ПІБ", |
||||
key: "name", |
||||
width: 260, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => ( |
||||
<div className="column-name" > |
||||
{row.avatarUrl |
||||
? <img src={row.avatarUrl} /> |
||||
: <img src={`${process.env.PUBLIC_URL}/img/default-avatar.jpg`} /> |
||||
} |
||||
<div className="column-name"> |
||||
{row.avatarUrl ? ( |
||||
<img src={row.avatarUrl} /> |
||||
) : ( |
||||
<img src={`${process.env.PUBLIC_URL}/img/default-avatar.jpg`} /> |
||||
)} |
||||
|
||||
<div className="info" > |
||||
<span className="full-name" >{row.firstName || ''} {row.lastName || ''}</span> |
||||
<div className="info"> |
||||
<span className="full-name"> |
||||
{row.firstName || ""} {row.lastName || ""} |
||||
</span> |
||||
|
||||
<span className="position" >{row.position}</span> |
||||
<span className="position">{row.position}</span> |
||||
</div> |
||||
</div> |
||||
) |
||||
), |
||||
}, |
||||
{ |
||||
name: 'Підрозділ', |
||||
key: 'subdivision', |
||||
name: "Підрозділ", |
||||
key: "subdivision", |
||||
width: 135, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
return <span className="column-with-secondary-txt "> |
||||
Subdivision |
||||
{row?.subdivision || ''} |
||||
</span> |
||||
} |
||||
return ( |
||||
<span className="column-with-secondary-txt "> |
||||
Subdivision |
||||
{row?.subdivision || ""} |
||||
</span> |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Посада', |
||||
key: 'position', |
||||
name: "Посада", |
||||
key: "position", |
||||
width: 165, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
return <span className="column-with-secondary-txt "> |
||||
{row?.position || ''} |
||||
</span> |
||||
} |
||||
return ( |
||||
<span className="column-with-secondary-txt "> |
||||
{row?.position || ""} |
||||
</span> |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Тел. робочий', |
||||
key: 'phoneNumber', |
||||
name: "Тел. робочий", |
||||
key: "phoneNumber", |
||||
width: 160, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
console.log({ row }) |
||||
return <span className="column-with-secondary-txt "> |
||||
{row?.phoneNumber || ''} |
||||
</span> |
||||
} |
||||
console.log({ row }); |
||||
return ( |
||||
<span className="column-with-secondary-txt "> |
||||
{row?.phoneNumber || ""} |
||||
</span> |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Тел. внутрішній', |
||||
key: 'innerPhoneNumber', |
||||
name: "Тел. внутрішній", |
||||
key: "innerPhoneNumber", |
||||
width: 160, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
return <span className="column-with-secondary-txt "> |
||||
{row?.innerPhoneNumber || ''} |
||||
</span> |
||||
} |
||||
return ( |
||||
<span className="column-with-secondary-txt "> |
||||
{row?.innerPhoneNumber || ""} |
||||
</span> |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Email', |
||||
dataIndex: 'email', |
||||
key: 'email', |
||||
name: "Email", |
||||
dataIndex: "email", |
||||
key: "email", |
||||
width: 165, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search' |
||||
filterType: "search", |
||||
}, |
||||
{ |
||||
name: 'Дата народження', |
||||
dataIndex: 'dateOfBirth', |
||||
key: 'dateOfBirth', |
||||
name: "Дата народження", |
||||
dataIndex: "dateOfBirth", |
||||
key: "dateOfBirth", |
||||
width: 185, |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
return <span className="column-with-secondary-txt "> |
||||
{row?.dateOfBirth ? moment(row?.dateOfBirth).format('DD-MM-YY') : ''} |
||||
</span> |
||||
} |
||||
return ( |
||||
<span className="column-with-secondary-txt "> |
||||
{row?.dateOfBirth ? moment(row?.dateOfBirth).format("DD MMMM") : ""} |
||||
</span> |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Статус', |
||||
key: 'status', |
||||
name: "Статус", |
||||
key: "status", |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'userStatus', |
||||
filterType: "userStatus", |
||||
formatter: ({ row }) => { |
||||
return row.status === EUserStatus.Active ? 'Активний' : 'Не Активний' |
||||
} |
||||
return row.status === EUserStatus.Active ? "Активний" : "Не Активний"; |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Підприємство', |
||||
dataIndex: 'factories', |
||||
key: 'factories', |
||||
name: "Підприємство", |
||||
dataIndex: "factories", |
||||
key: "factories", |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'search', |
||||
filterType: "search", |
||||
formatter: ({ row }) => { |
||||
if (!row.factoriesRelation) return '' |
||||
return row?.factoriesRelation?.map((item) => { |
||||
return item.factory.name |
||||
}).join(', ') |
||||
} |
||||
if (!row.factoriesRelation) return ""; |
||||
return row?.factoriesRelation |
||||
?.map((item) => { |
||||
return item.factory.name; |
||||
}) |
||||
.join(", "); |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Вхід на десктоп', |
||||
dataIndex: 'loginOnDesktopDate', |
||||
key: 'loginOnDesktopDate', |
||||
name: "Вхід на десктоп", |
||||
dataIndex: "loginOnDesktopDate", |
||||
key: "loginOnDesktopDate", |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'datePicker', |
||||
filterType: "datePicker", |
||||
formatter: ({ row }) => { |
||||
return row.loginOnDesktopDate ? moment(row.loginOnDesktopDate).format('DD-MM-YYYY HH:mm:ss') : 'Ніколи' |
||||
} |
||||
|
||||
return row.loginOnDesktopDate |
||||
? moment(row.loginOnDesktopDate).format("DD-MM-YYYY HH:mm:ss") |
||||
: "Ніколи"; |
||||
}, |
||||
}, |
||||
{ |
||||
name: 'Вхід в додаток', |
||||
dataIndex: 'loginOnMobileDate', |
||||
key: 'loginOnMobileDate', |
||||
name: "Вхід в додаток", |
||||
dataIndex: "loginOnMobileDate", |
||||
key: "loginOnMobileDate", |
||||
resizable: true, |
||||
sortable: true, |
||||
filter: true, |
||||
filterType: 'datePicker', |
||||
filterType: "datePicker", |
||||
formatter: ({ row }) => { |
||||
return row.loginOnMobileDate ? moment(row.loginOnMobileDate).format('DD-MM-YYYY HH:mm:ss') : 'Ніколи' |
||||
} |
||||
|
||||
return row.loginOnMobileDate |
||||
? moment(row.loginOnMobileDate).format("DD-MM-YYYY HH:mm:ss") |
||||
: "Ніколи"; |
||||
}, |
||||
}, |
||||
] |
||||
]; |
||||
|
||||
export const defaultActiveColumnsConfig = [ |
||||
"select-row", |
||||
"avatarUrl", |
||||
'subdivision', |
||||
'position', |
||||
'phoneNumber', |
||||
'innerPhoneNumber', |
||||
"subdivision", |
||||
"position", |
||||
"phoneNumber", |
||||
"innerPhoneNumber", |
||||
"name", |
||||
"login", |
||||
"email", |
||||
'dateOfBirth' |
||||
]; |
||||
"dateOfBirth", |
||||
]; |
||||
|
Loading…
Reference in new issue