change matched table styles

This commit is contained in:
smanylov
2026-04-15 13:30:19 +07:00
parent 9b4fb796f9
commit 4d957ea271
6 changed files with 273 additions and 284 deletions
@@ -7,7 +7,7 @@ import { createComplaint, fetchComplainInfo } from '@/app/actions/violationActio
import { toast } from 'sonner';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { MatchStatus } from '@/app/actions/violationActions';
import {formatDate, formatDateTime} from '@/app/lib/formatDate';
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
interface complaintInfo {
id: number,
@@ -255,81 +255,53 @@ export default function CaseComplaint({ selectedViolation, updateStatusHandler }
return (
<div className="violation-info-case">
{complainInfo?.body.content ? (
<div>
<>
{complainInfo.body.content.map((item: complaintInfo) => {
return (
<div key={item.id}>
<div className="complaint-details">
<div
className="complaint-details-item"
>
<strong>ID:</strong> {item.id}
<div className="complaint-details-item">
<div className="complaint-details-header">
<h5>ID: {item.id}</h5>
</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('status')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.status}
</span>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('status')}:</span>
</div>
<div className="complaint-details-content">{item.status}</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('date-of-creation')}:
</span>
<br />
<span
className="complaint-details-text"
>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-creation')}:</span>
</div>
<div className="complaint-details-content">
{item.created_at ? `${formatDate(item.created_at)}: ${formatDateTime(item.created_at)}` : '---'}
</span>
</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('date-of-update')}:
</span>
<br />
<span
className="complaint-details-text"
>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-update')}:</span>
</div>
<div className="complaint-details-content">
{item.updated_at ? `${formatDate(item.updated_at)}: ${formatDateTime(item.updated_at)}` : '---'}
</span>
</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('text-of-the-complaint')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.complaint_text}
</span>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('text-of-the-complaint')}:</span>
</div>
<div className="complaint-details-content">{item.complaint_text}</div>
</div>
</div>
</div>
);
})}
</div>
</>
) : (
<div>
{t('no-information-about-the-complaint')}
@@ -207,132 +207,67 @@ export default function CaseViolation({ selectedViolation, updateStatusHandler }
return (
<div className="violation-info-case">
{caseInfo?.body?.content ? (
<div>
<>
{caseInfo.body.content.map((item: CaseInfo) => {
return (
<div key={item.id}>
{/* <div className="complaint-details">
<div><strong>ID:</strong> {item.id}</div>
<div><strong>{t('name')}:</strong>
<br />
{item.name}
</div>
<div><strong>{t('description')}:</strong> {item.description}</div>
<div><strong>{t('amount')}:</strong> {item.amount}</div>
<div><strong>{t('priority')}:</strong> {item.priority}</div>
<div><strong>{t('type')}:</strong> {item.type}</div>
<div><strong>{t('lawyer')}:</strong> {item.lawyer || t('not-assigned')}</div>
<div><strong>{t('violation-id')}:</strong> {item.violationId}</div>
<div><strong>{t('date-of-creation')}:</strong> {item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}</div>
<div><strong>{t('date-of-update')}:</strong> {item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}</div>
{item.content && <p><strong>{t('content')}:</strong> {item.content}</p>}
</div> */}
<div className="complaint-details">
<div
className="complaint-details-item"
>
<h5>{item.name}</h5>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('status')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.type}
</span>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('date-of-creation')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}
</span>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('date-of-update')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.updatedAt ? `${formatDate(item.updatedAt)}: ${formatDateTime(item.updatedAt)}` : '---'}
</span>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('description')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.description}
</span>
<div className="complaint-details-item">
<div className="complaint-details-header">
<h5>{item.name}</h5>
</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('amount-of-damage')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.amount}
</span>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('status')}:</span>
</div>
<div className="complaint-details-content">{item.type}</div>
</div>
<div
className="complaint-details-item"
>
<span
className="complaint-details-title"
>
{t('lawyer')}:
</span>
<br />
<span
className="complaint-details-text"
>
{item.lawyer}
</span>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-creation')}:</span>
</div>
<div className="complaint-details-content">
{item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-update')}:</span>
</div>
<div className="complaint-details-content">
{item.updatedAt ? `${formatDate(item.updatedAt)}: ${formatDateTime(item.updatedAt)}` : '---'}
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('description')}:</span>
</div>
<div className="complaint-details-content">{item.description}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('amount-of-damage')}:</span>
</div>
<div className="complaint-details-content">{item.amount}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('lawyer')}:</span>
</div>
<div className="complaint-details-content">{item.lawyer}</div>
</div>
</div>
</div>
);
})}
</div>
</>
) : (
<div>
{t('no-information-about-the-complaint')}
@@ -1,7 +1,7 @@
'use client'
import Link from 'next/link';
import { formatDate } from '@/app/lib/formatDate';
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
import { useTranslations } from 'next-intl';
import { ViolationFileDetail } from '@/app/hooks/react-query/useFileViolations';
import CaseComplaint from '@/app/ui/file-page/violation-table/case-complaint';
@@ -111,105 +111,131 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
<div
className="violation-info-content"
>
<h3
className="violation-info-title"
>
{selectedViolation?.page_title}
</h3>
<div
className="violation-info-header"
>
<div className="violation-info-image-wrapper">
<div
className="violation-info-image"
>
<Image
src={selectedViolation?.url}
alt={selectedViolation?.page_title}
unoptimized
fill
sizes="100px"
onError={(e) => {
const target = e.target as HTMLImageElement;
target.src = '/images/no-image.png';
}}
/>
<div
className="violation-info-header-grid"
>
<div className="violation-info-image-wrapper">
<div
className="violation-info-image"
>
<Image
src={selectedViolation?.url}
alt={selectedViolation?.page_title}
unoptimized
fill
sizes="100px"
onError={(e) => {
const target = e.target as HTMLImageElement;
target.src = '/images/no-image.png';
}}
/>
</div>
<div className="violation-info-image-buttons">
<button
className="image-btn image-btn-view"
onClick={() => setIsModalOpen(true)}
title="Увеличить"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
</button>
<button
className="image-btn image-btn-open"
onClick={openInNewTab}
title="Открыть в новой вкладке"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
<polyline points="15 3 21 3 21 9" />
<line x1="10" y1="14" x2="21" y2="3" />
</svg>
</button>
</div>
</div>
<div className="violation-info-image-buttons">
<button
className="image-btn image-btn-view"
onClick={() => setIsModalOpen(true)}
title="Увеличить"
<div
className="violation-info-right-side"
>
<h3
className="violation-info-title"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
</button>
<button
className="image-btn image-btn-open"
onClick={openInNewTab}
title="Открыть в новой вкладке"
{selectedViolation?.page_title}
</h3>
<div
className="violation-info-source"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
<polyline points="15 3 21 3 21 9" />
<line x1="10" y1="14" x2="21" y2="3" />
</svg>
</button>
<span>
{t('source')}:
</span>
<br />
<Link
href={selectedViolation?.page_url ? selectedViolation?.page_url : '#'}
className="source"
target="_blank"
scroll={false}
>
{selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : selectedViolation?.page_url}
</Link>
</div>
<div
className="violation-info-status"
>
{/* COMPLAINT_IN_WORK COMPLAINT_AND_LEGAL_IN_WORK*/}
{localViolation?.status === "COMPLAINT_AND_LEGAL_IN_WORK" ? (
<>
<span className="source-status legal_in_work">
{tStatus('LEGAL_IN_WORK')}
</span>
<span className="source-status complaint_in_work">
{tStatus('COMPLAINT_IN_WORK')}
</span>
</>
) : (
localViolation?.status && (
<span className={`source-status ${localViolation?.status.toLowerCase()}`}>
{tStatus(localViolation?.status)}
</span>
)
)}
</div>
</div>
</div>
<div
className="violation-info-right-side"
className="violation-info-header-bottom"
>
<div
className="violation-info-source"
className="violation-info-date"
>
<span>
{t('source')}:
{t('date-of-creation')}:
</span>
<Link
href={selectedViolation?.page_url ? selectedViolation?.page_url : '#'}
className="source"
target="_blank"
scroll={false}
<div
className="violation-info-date-value"
>
{selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : selectedViolation?.page_url}
</Link>
</div>
<div
className="violation-info-date-status"
>
<span>
{t('date')} {selectedViolation?.created_date ? formatDate(selectedViolation?.created_date) : '#'}
</span>
{/* COMPLAINT_IN_WORK COMPLAINT_AND_LEGAL_IN_WORK*/}
{localViolation?.status === "COMPLAINT_AND_LEGAL_IN_WORK" ? (
<>
<span className="source-status legal_in_work">
{tStatus('LEGAL_IN_WORK')}
</span>
<span className="source-status complaint_in_work">
{tStatus('COMPLAINT_IN_WORK')}
</span>
</>
) : (
localViolation?.status && (
<span className={`source-status ${localViolation?.status.toLowerCase()}`}>
{tStatus(localViolation?.status)}
</span>
)
)}
<div>
{selectedViolation?.created_date ? `${formatDate(selectedViolation?.created_date)}` : '#'}
</div>
<div>
{selectedViolation?.created_date ? `${formatDateTime(selectedViolation?.created_date)}` : '#'}
</div>
</div>
</div>
<div
className="violation-info-action"
>
<button
className="btn-action btn-success"
className="btn-action btn-resolve"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'AUTHORIZED_USE');
@@ -217,7 +243,7 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
}}
disabled={isUpdating}
>
{t('mark-as-solved')}
{t('allow-use')}
</button>
</div>
</div>