admin page
This commit is contained in:
1
src/widgets/legal-entities-table/index.ts
Normal file
1
src/widgets/legal-entities-table/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { LegalEntitiesTable } from './ui/LegalEntitiesTable'
|
||||
@@ -0,0 +1,89 @@
|
||||
.tableWrap {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-radius: 24px;
|
||||
padding: 24px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table th {
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1.5px;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
padding: 0 16px 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table td {
|
||||
padding: 16px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
vertical-align: middle;
|
||||
transition: background 0.2s ease;
|
||||
font-size: 14px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.table tr:hover td {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.name {
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.subname {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: var(--font-mono, monospace);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background: rgba(74, 109, 255, 0.12);
|
||||
color: #7c95ff;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.kyc {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.kycOk {
|
||||
background: rgba(0, 196, 140, 0.14);
|
||||
color: #00c48c;
|
||||
}
|
||||
|
||||
.kycNo {
|
||||
background: rgba(255, 90, 90, 0.14);
|
||||
color: #ff5a5a;
|
||||
}
|
||||
|
||||
.state {
|
||||
padding: 40px 16px;
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
81
src/widgets/legal-entities-table/ui/LegalEntitiesTable.tsx
Normal file
81
src/widgets/legal-entities-table/ui/LegalEntitiesTable.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
import { useOrganizations } from '@features/admin'
|
||||
import styles from './LegalEntitiesTable.module.css'
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
active: 'Активно',
|
||||
blocked: 'Заблокировано',
|
||||
inactive: 'Неактивно',
|
||||
}
|
||||
|
||||
function formatDate(value: string | null): string {
|
||||
if (!value) return '—'
|
||||
const d = new Date(value)
|
||||
if (Number.isNaN(d.getTime())) return '—'
|
||||
return d.toLocaleDateString('ru-RU')
|
||||
}
|
||||
|
||||
export function LegalEntitiesTable() {
|
||||
const { data, isLoading, isError } = useOrganizations()
|
||||
|
||||
if (isLoading) {
|
||||
return <div className={styles.tableWrap}><div className={styles.state}>Загрузка...</div></div>
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
return (
|
||||
<div className={styles.tableWrap}>
|
||||
<div className={styles.state}>Не удалось загрузить список юридических лиц</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (!data || data.items.length === 0) {
|
||||
return (
|
||||
<div className={styles.tableWrap}>
|
||||
<div className={styles.state}>Юридические лица ещё не добавлены</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.tableWrap}>
|
||||
<table className={styles.table}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>ИНН</th>
|
||||
<th>КПП</th>
|
||||
<th>Контактное лицо</th>
|
||||
<th>Телефон</th>
|
||||
<th>Статус</th>
|
||||
<th>KYC</th>
|
||||
<th>Создано</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.items.map((org) => (
|
||||
<tr key={org.id}>
|
||||
<td>
|
||||
<span className={styles.name}>{org.name}</span>
|
||||
{org.short_name && <span className={styles.subname}>{org.short_name}</span>}
|
||||
</td>
|
||||
<td className={styles.mono}>{org.inn}</td>
|
||||
<td className={styles.mono}>{org.kpp ?? '—'}</td>
|
||||
<td>{org.contact_person ?? '—'}</td>
|
||||
<td className={styles.mono}>{org.contact_phone ?? '—'}</td>
|
||||
<td>
|
||||
<span className={styles.status}>{STATUS_LABELS[org.status] ?? org.status}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span className={`${styles.kyc} ${org.kyc_verified ? styles.kycOk : styles.kycNo}`}>
|
||||
{org.kyc_verified ? 'Да' : 'Нет'}
|
||||
</span>
|
||||
</td>
|
||||
<td>{formatDate(org.created_at)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user