Compare commits
21
Commits
aeeee04166
...
NCBACK-168
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
587d7ceead | ||
|
|
ac8ef8caa2 | ||
|
|
7d0fb265d4 | ||
|
|
743db57bb3 | ||
|
|
d7d2e36573 | ||
|
|
8b157b8e87 | ||
|
|
0935e8cbc7 | ||
|
|
f04ce348ae | ||
|
|
508e0d182c | ||
|
|
dbd5d43d65 | ||
|
|
7d8a725e34 | ||
|
|
491adb4090 | ||
|
|
1a3f5277d9 | ||
|
|
ffcd5fc535 | ||
|
|
65e0c2ed62 | ||
|
|
36b4a3b481 | ||
|
|
e0455b200a | ||
|
|
348a5398d0 | ||
|
|
af87bfc7b6 | ||
|
|
beefe86ffd | ||
|
|
3a7c609588 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "no-copy-frontend",
|
"name": "no-copy-frontend",
|
||||||
"version": "0.114.0",
|
"version": "0.120.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 2999",
|
"dev": "next dev -p 2999",
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export interface FileDetails {
|
|||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
params: Promise<{ id: string }>;
|
params: Promise<{ id: string }>;
|
||||||
searchParams: Promise<{ page?: string, status?: string , violationId?: string, caseType?: 'complaint' | 'claim'}>;
|
searchParams: Promise<{ page?: string, status?: string, violationId?: string, caseType?: 'complaint' | 'claim', startDate: string, endDate: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({
|
export default async function Page({
|
||||||
@@ -56,7 +56,7 @@ export default async function Page({
|
|||||||
searchParams
|
searchParams
|
||||||
}: PageProps) {
|
}: PageProps) {
|
||||||
const { id } = await params;
|
const { id } = await params;
|
||||||
const { page, status, violationId, caseType } = await searchParams;
|
const { page, status, violationId, caseType, startDate, endDate } = await searchParams;
|
||||||
const currentPage = Number(page) || 1;
|
const currentPage = Number(page) || 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -71,7 +71,7 @@ export default async function Page({
|
|||||||
>
|
>
|
||||||
<FilePageFileInfo fileInfo={fileInfo} />
|
<FilePageFileInfo fileInfo={fileInfo} />
|
||||||
{/* <FilePageActions /> */}
|
{/* <FilePageActions /> */}
|
||||||
<ViolationPpageFileStatistic />
|
<ViolationPpageFileStatistic id={id} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<FilePageViolationsList
|
<FilePageViolationsList
|
||||||
@@ -80,6 +80,8 @@ export default async function Page({
|
|||||||
fileId={id}
|
fileId={id}
|
||||||
violationId={violationId}
|
violationId={violationId}
|
||||||
caseType={caseType}
|
caseType={caseType}
|
||||||
|
startDate={startDate}
|
||||||
|
endDate={endDate}
|
||||||
/>
|
/>
|
||||||
{/* <FilePageNote /> */}
|
{/* <FilePageNote /> */}
|
||||||
{/* <FilePageViolationInfo /> */}
|
{/* <FilePageViolationInfo /> */}
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ export async function getUserFilesInfo() {
|
|||||||
msg_id: 20005,
|
msg_id: 20005,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'user_files_info',
|
action: 'user_files_info',
|
||||||
token: token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -81,13 +81,13 @@ export async function fetchTariffs(tariffTerm: 'MONTHLY' | 'YEAR') {
|
|||||||
msg_id: 30001,
|
msg_id: 30001,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'get',
|
action: 'get',
|
||||||
user_token: token,
|
|
||||||
tariff_term: tariffTerm
|
tariff_term: tariffTerm
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,6 +108,7 @@ export async function fetchTariffs(tariffTerm: 'MONTHLY' | 'YEAR') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchTokensBundle() {
|
export async function fetchTokensBundle() {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
@@ -122,7 +123,8 @@ export async function fetchTokensBundle() {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -143,6 +145,7 @@ export async function fetchTokensBundle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getBuildData() {
|
export async function getBuildData() {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/check/api/build`, {
|
const response = await fetch(`${API_BASE_URL}/check/api/build`, {
|
||||||
@@ -150,6 +153,7 @@ export async function getBuildData() {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -165,7 +169,7 @@ export async function getBuildData() {
|
|||||||
|
|
||||||
export async function fetchINN(inn: string) {
|
export async function fetchINN(inn: string) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/auth`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
|
|||||||
+9
-12
@@ -72,7 +72,7 @@ export async function authorization(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { email, password } = validatedFields.data;
|
const { email, password } = validatedFields.data;
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/auth`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
@@ -89,6 +89,7 @@ export async function authorization(
|
|||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
|
|
||||||
if (parsed.message_code === 0) {
|
if (parsed.message_code === 0) {
|
||||||
await createSession(parsed.message_body.token, email);
|
await createSession(parsed.message_body.token, email);
|
||||||
} else {
|
} else {
|
||||||
@@ -234,7 +235,7 @@ export async function registration(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { fullName, email, password, phone } = validatedFields.data;
|
const { fullName, email, password, phone } = validatedFields.data;
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/auth`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
@@ -400,13 +401,11 @@ export async function tokenLifeExtension() {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 20008,
|
msg_id: 20008
|
||||||
message_body: {
|
|
||||||
token: token
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -431,14 +430,14 @@ export async function confirmEmail(userId: number, verifyToken: string) {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
|
'Authorization': `Bearer ${verifyToken}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 20009,
|
msg_id: 20009,
|
||||||
message_body: {
|
message_body: {
|
||||||
resend: 0,
|
resend: 0,
|
||||||
user_id: userId,
|
user_id: userId
|
||||||
verify_token: verifyToken
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -474,7 +473,6 @@ export async function confirmEmail(userId: number, verifyToken: string) {
|
|||||||
export async function resendConfirmEmail(userId: number) {
|
export async function resendConfirmEmail(userId: number) {
|
||||||
console.log('resendConfirmEmail');
|
console.log('resendConfirmEmail');
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -524,10 +522,9 @@ export async function resetPassword(
|
|||||||
formData: FormData,
|
formData: FormData,
|
||||||
) {
|
) {
|
||||||
const email = formData.get('email');
|
const email = formData.get('email');
|
||||||
console.log('resetPassword');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/auth`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -611,6 +608,7 @@ export async function confirmPassword(
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${verifyToken}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
@@ -618,7 +616,6 @@ export async function confirmPassword(
|
|||||||
message_body: {
|
message_body: {
|
||||||
email: email,
|
email: email,
|
||||||
password: password,
|
password: password,
|
||||||
verifyToken: verifyToken,
|
|
||||||
action: "confirmVerification"
|
action: "confirmVerification"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ export async function companyUserRegistration(
|
|||||||
phone: phone,
|
phone: phone,
|
||||||
password,
|
password,
|
||||||
accountType: 'b2b',
|
accountType: 'b2b',
|
||||||
authToken: token,
|
|
||||||
mail_verified: false,
|
mail_verified: false,
|
||||||
ip: ip,
|
ip: ip,
|
||||||
user_agent: userAgent,
|
user_agent: userAgent,
|
||||||
@@ -103,7 +102,8 @@ export async function companyUserRegistration(
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -113,14 +113,6 @@ export async function companyUserRegistration(
|
|||||||
message_body: { token: string },
|
message_body: { token: string },
|
||||||
message_code: number
|
message_code: number
|
||||||
};
|
};
|
||||||
console.log({
|
|
||||||
fullName: fullName,
|
|
||||||
email,
|
|
||||||
phone: phone,
|
|
||||||
password,
|
|
||||||
accountType: 'b2b',
|
|
||||||
authToken: token
|
|
||||||
});
|
|
||||||
|
|
||||||
if (parsed.message_code === 0) {
|
if (parsed.message_code === 0) {
|
||||||
console.log(`registration - ${email}`);
|
console.log(`registration - ${email}`);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export async function getUserFilesData({
|
|||||||
msg_id: 20005,
|
msg_id: 20005,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'search_files',
|
action: 'search_files',
|
||||||
token: token,
|
|
||||||
page: page,
|
page: page,
|
||||||
page_size: pageSize,
|
page_size: pageSize,
|
||||||
query: query,
|
query: query,
|
||||||
@@ -43,7 +42,8 @@ export async function getUserFilesData({
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -77,12 +77,12 @@ export async function removeUserFile(fileId: string, fullDelete: number) {
|
|||||||
action: 'delete_file',
|
action: 'delete_file',
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
full_delete: fullDelete,
|
full_delete: fullDelete,
|
||||||
token: token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -114,13 +114,13 @@ export async function viewFileInfo(fileId: string) {
|
|||||||
msg_id: 20005,
|
msg_id: 20005,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'file_info',
|
action: 'file_info',
|
||||||
file_id: fileId,
|
file_id: fileId
|
||||||
token: token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -163,3 +163,43 @@ export async function downloadFile(fileId: string, fileName: string) {
|
|||||||
fileName: fileName
|
fileName: fileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function FileAnAppeal(fileId: string, appealReason: string, additionalInfo: string) {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
version: 1,
|
||||||
|
msg_id: 20005,
|
||||||
|
message_body: {
|
||||||
|
action: 'submit_appeal',
|
||||||
|
file_id: fileId,
|
||||||
|
appeal_reason: appealReason,
|
||||||
|
additional_info: additionalInfo
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
let parsed = await response.json();
|
||||||
|
|
||||||
|
if (parsed.message_code === 0) {
|
||||||
|
return parsed;
|
||||||
|
} else {
|
||||||
|
throw parsed;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw (`${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import { API_BASE_URL } from '@/app/actions/definitions';
|
import { API_BASE_URL } from '@/app/actions/definitions';
|
||||||
import { getSessionData } from '@/app/actions/session';
|
import { getSessionData } from '@/app/actions/session';
|
||||||
import { FormState } from '@/app/actions/auth';
|
|
||||||
import { unknown } from 'zod';
|
|
||||||
|
|
||||||
interface initMessageBody {
|
interface initMessageBody {
|
||||||
file_name: string,
|
file_name: string,
|
||||||
@@ -22,7 +20,6 @@ export async function fileUpload(messageBody: initMessageBody, convertTo?: strin
|
|||||||
}
|
}
|
||||||
const message = messageBody;
|
const message = messageBody;
|
||||||
message.action = 'init';
|
message.action = 'init';
|
||||||
message.token = token;
|
|
||||||
|
|
||||||
if (convertTo && convertTo !== 'reject') {
|
if (convertTo && convertTo !== 'reject') {
|
||||||
message.convertTo = convertTo;
|
message.convertTo = convertTo;
|
||||||
@@ -38,7 +35,8 @@ export async function fileUpload(messageBody: initMessageBody, convertTo?: strin
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,6 +66,8 @@ export async function fileUpload(messageBody: initMessageBody, convertTo?: strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function cancelUpload(udloadId: string) {
|
export async function cancelUpload(udloadId: string) {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -81,7 +81,8 @@ export async function cancelUpload(udloadId: string) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -114,7 +115,6 @@ export type ChunkResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function chunkUpload(formData: FormData, itPrivate?: boolean): Promise<ChunkResponse> {
|
export async function chunkUpload(formData: FormData, itPrivate?: boolean): Promise<ChunkResponse> {
|
||||||
console.log('chunkUpload');
|
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -123,19 +123,21 @@ export async function chunkUpload(formData: FormData, itPrivate?: boolean): Prom
|
|||||||
: `${API_BASE_URL}/api/v1/files/chunk`;
|
: `${API_BASE_URL}/api/v1/files/chunk`;
|
||||||
|
|
||||||
|
|
||||||
if (token && itPrivate) {
|
/* if (token && itPrivate) {
|
||||||
formData.append('token', token);
|
formData.append('token', token);
|
||||||
}
|
} */
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData,
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
/* ...(token && itPrivate && { 'Authorization': `Bearer ${token}` }) возможно нужно будет условно отправлять токен*/
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
console.log(formData);
|
|
||||||
console.log(parsed);
|
|
||||||
|
|
||||||
if (parsed.message_code === 0) {
|
if (parsed.message_code === 0) {
|
||||||
return {
|
return {
|
||||||
@@ -171,6 +173,8 @@ export async function chunkUpload(formData: FormData, itPrivate?: boolean): Prom
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function checkChunkStatus(upload_id: string) {
|
export async function checkChunkStatus(upload_id: string) {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -184,7 +188,8 @@ export async function checkChunkStatus(upload_id: string) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -206,6 +211,8 @@ export async function checkChunkStatus(upload_id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getAllowedFilesExtensions(type: string) {
|
export async function getAllowedFilesExtensions(type: string) {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -219,7 +226,8 @@ export async function getAllowedFilesExtensions(type: string) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -250,7 +258,6 @@ export async function checkOperationPrice(action: string, filesCount: number, fi
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30008,
|
msg_id: 30008,
|
||||||
message_body: {
|
message_body: {
|
||||||
auth_token: token,
|
|
||||||
action: action,
|
action: action,
|
||||||
file_type: fileType,
|
file_type: fileType,
|
||||||
count_files: filesCount
|
count_files: filesCount
|
||||||
@@ -258,7 +265,8 @@ export async function checkOperationPrice(action: string, filesCount: number, fi
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ export async function setMonitoring(fileId: string, monitoringType: string) {
|
|||||||
msg_id: 30007,
|
msg_id: 30007,
|
||||||
message_body: {
|
message_body: {
|
||||||
monitoring_type: monitoringType,
|
monitoring_type: monitoringType,
|
||||||
file_id: fileId,
|
file_id: fileId
|
||||||
auth_token: token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -65,14 +65,12 @@ export async function fetchMonitoringStats(): Promise<MonitoringStats | null> {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30011,
|
msg_id: 30011
|
||||||
message_body: {
|
|
||||||
token: token
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,13 +97,13 @@ export async function fetchLastMonitoringCheck() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30011,
|
msg_id: 30011,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
|
||||||
limit: 1
|
limit: 1
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -131,14 +129,12 @@ export async function fetchMonitoringInfo() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30027,
|
msg_id: 30027
|
||||||
message_body: {
|
|
||||||
authToken: token
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ export async function fetchActiveNotifications() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30015,
|
msg_id: 30015,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'active',
|
action: 'active'
|
||||||
authToken: token,
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@ export async function fetchAllNotifications(page: number = 0, size: number = 10)
|
|||||||
msg_id: 30015,
|
msg_id: 30015,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'list',
|
action: 'list',
|
||||||
authToken: token,
|
|
||||||
page: page,
|
page: page,
|
||||||
size: size,
|
size: size,
|
||||||
sortBy: "createdAt",
|
sortBy: "createdAt",
|
||||||
@@ -70,7 +69,8 @@ export async function fetchAllNotifications(page: number = 0, size: number = 10)
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -101,13 +101,13 @@ export async function notificationsMarkAsRead(ids: number[]) {
|
|||||||
msg_id: 30015,
|
msg_id: 30015,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'markRead',
|
action: 'markRead',
|
||||||
authToken: token,
|
|
||||||
notificationIds: ids
|
notificationIds: ids
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -132,7 +132,6 @@ export async function notificationsMarkAsRead(ids: number[]) {
|
|||||||
|
|
||||||
export async function notificationsDelete(ids: number[]) {
|
export async function notificationsDelete(ids: number[]) {
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
console.log('notificationsDelete');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
@@ -142,13 +141,13 @@ export async function notificationsDelete(ids: number[]) {
|
|||||||
msg_id: 30015,
|
msg_id: 30015,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'delete',
|
action: 'delete',
|
||||||
authToken: token,
|
|
||||||
notificationIds: ids
|
notificationIds: ids
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ export async function fetchReferralsLevels() {
|
|||||||
msg_id: 30003,
|
msg_id: 30003,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'levels',
|
action: 'levels',
|
||||||
token: token,
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -57,12 +57,12 @@ export async function fetchReferralUserStats() {
|
|||||||
msg_id: 30003,
|
msg_id: 30003,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'userStats',
|
action: 'userStats',
|
||||||
token: token,
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,14 +96,14 @@ export async function fetchReferralInvitees() {
|
|||||||
msg_id: 30003,
|
msg_id: 30003,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'invitees',
|
action: 'invitees',
|
||||||
token: token,
|
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNumber: 0
|
pageNumber: 0
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -137,25 +137,18 @@ export async function referralRefill() {
|
|||||||
msg_id: 30003,
|
msg_id: 30003,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'refill',
|
action: 'refill',
|
||||||
token: token,
|
|
||||||
amount: 2000,
|
amount: 2000,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log('referralRefill');
|
|
||||||
console.log({
|
|
||||||
action: 'refill',
|
|
||||||
token: token,
|
|
||||||
amount: 2000,
|
|
||||||
})
|
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
console.log(parsed);
|
|
||||||
|
|
||||||
if (parsed.message_code === 0) {
|
if (parsed.message_code === 0) {
|
||||||
return parsed.message_body;
|
return parsed.message_body;
|
||||||
@@ -366,8 +359,8 @@ export async function createPayoutRequest(
|
|||||||
const response = await fetch(`${API_BASE_URL}/api/payouts/create-request`, {
|
const response = await fetch(`${API_BASE_URL}/api/payouts/create-request`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"amount": amount,
|
'amount': amount,
|
||||||
"payoutMethodId": payoutMethodId
|
'payoutMethodId': payoutMethodId
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ export async function searchUserFiles(fileId: string) {
|
|||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/files/${fileId}/similar?similarityLevels=DUPLICATE,SIMILARITY&auth_token=${token}`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/files/${fileId}/similar?similarityLevels=DUPLICATE,SIMILARITY`, {
|
||||||
method: 'GET'
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
@@ -40,8 +43,6 @@ export async function searchUserFiles(fileId: string) {
|
|||||||
export async function searchGlobalFiles(fileId: string, currentPage: number) {
|
export async function searchGlobalFiles(fileId: string, currentPage: number) {
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
//удалить когда поиск будет нормально работать
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -56,7 +57,8 @@ export async function searchGlobalFiles(fileId: string, currentPage: number) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -112,6 +114,7 @@ export async function getSearchStats() {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ export async function requestFileWithTracking(fileId: string) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
token: token,
|
|
||||||
ip: ip,
|
ip: ip,
|
||||||
user_agent: userAgent
|
user_agent: userAgent
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -57,12 +57,12 @@ export async function requestFileAsBuffer(fileId: string): Promise<ArrayBuffer |
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
token: token,
|
|
||||||
ip: ip,
|
ip: ip,
|
||||||
user_agent: userAgent
|
user_agent: userAgent
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,12 +100,12 @@ export async function fetchDocumentInfo(fileId: string) {
|
|||||||
msg_id: 20005,
|
msg_id: 20005,
|
||||||
message_body: {
|
message_body: {
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
token: token,
|
|
||||||
action: 'file_info'
|
action: 'file_info'
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -137,7 +137,6 @@ export async function filePermisionChange(fileId: string, permissions: boolean)
|
|||||||
msg_id: 20005,
|
msg_id: 20005,
|
||||||
message_body: {
|
message_body: {
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
token: token,
|
|
||||||
action: 'change_permission',
|
action: 'change_permission',
|
||||||
permissions: {
|
permissions: {
|
||||||
DOWNLOAD: permissions
|
DOWNLOAD: permissions
|
||||||
@@ -145,7 +144,8 @@ export async function filePermisionChange(fileId: string, permissions: boolean)
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -182,7 +182,6 @@ export async function fetchHistoryView(
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30028,
|
msg_id: 30028,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
|
||||||
action: 'history_view',
|
action: 'history_view',
|
||||||
page: page,
|
page: page,
|
||||||
size: size,
|
size: size,
|
||||||
@@ -192,7 +191,8 @@ export async function fetchHistoryView(
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -223,12 +223,12 @@ export async function fetchTrackingStats() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30028,
|
msg_id: 30028,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
|
||||||
action: 'view_stats'
|
action: 'view_stats'
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -250,9 +250,14 @@ export async function fetchTrackingStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadTrackingFile(fileId: string, fileName?: string) {
|
export async function downloadTrackingFile(fileId: string, fileName?: string) {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/files/public-download/${fileId}`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/files/public-download/${fileId}`, {
|
||||||
method: 'GET'
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -91,9 +91,7 @@ export async function getViolationFilesArray(props: {
|
|||||||
const { page, size, start_date, end_date, file_name } = props;
|
const { page, size, start_date, end_date, file_name } = props;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const body: Record<string, any> = {
|
const body: Record<string, any> = {};
|
||||||
token: token
|
|
||||||
};
|
|
||||||
|
|
||||||
if (page !== undefined) body.page = page;
|
if (page !== undefined) body.page = page;
|
||||||
if (size !== undefined) body.size = size;
|
if (size !== undefined) body.size = size;
|
||||||
@@ -106,6 +104,7 @@ export async function getViolationFilesArray(props: {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
@@ -127,42 +126,7 @@ export async function getViolationFilesArray(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* статистика нурешений */
|
export async function getFileMatches(fileId: string, page: number, status?: string, violationId?: string, startDate?: string, endDate?: string) {
|
||||||
export async function fetchViolationStats() {
|
|
||||||
const token = await getSessionData('token');
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({
|
|
||||||
version: 1,
|
|
||||||
msg_id: 30010,
|
|
||||||
message_body: {
|
|
||||||
token: token
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
let parsed = await response.json();
|
|
||||||
if (parsed) {
|
|
||||||
return parsed;
|
|
||||||
} else {
|
|
||||||
throw null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw (`${response.status}`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getFileMatches(fileId: string, page: number, status?: string, violationId?: string) {
|
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -173,18 +137,19 @@ export async function getFileMatches(fileId: string, page: number, status?: stri
|
|||||||
msg_id: 30009,
|
msg_id: 30009,
|
||||||
message_body: {
|
message_body: {
|
||||||
file_id: fileId,
|
file_id: fileId,
|
||||||
page: page,
|
page: (page > 0 ? page - 1 : 0),
|
||||||
size: 5,
|
size: 5,
|
||||||
sort_direction: 'desc',
|
sort_direction: 'desc',
|
||||||
token: token,
|
|
||||||
status: status,
|
status: status,
|
||||||
...(violationId && { action: 'getByViolationId' }),
|
...(violationId && { action: 'getByViolationId' }),
|
||||||
...(violationId && { violation_id: violationId })
|
...(violationId && { violation_id: violationId }),
|
||||||
|
...((startDate && endDate) && { start_date: startDate, end_date: endDate })
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -217,13 +182,13 @@ export async function fetchViolationAnalyticStatistic(group: 'domain' | 'tld') {
|
|||||||
message_body: {
|
message_body: {
|
||||||
group_by: group,
|
group_by: group,
|
||||||
action: "group",
|
action: "group",
|
||||||
token: token,
|
|
||||||
sort_direction: 'desc'
|
sort_direction: 'desc'
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -243,7 +208,7 @@ export async function fetchViolationAnalyticStatistic(group: 'domain' | 'tld') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchViolationStatistic() {
|
export async function fetchViolationStatistic(id?: string) {
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -253,12 +218,13 @@ export async function fetchViolationStatistic() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30010,
|
msg_id: 30010,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
...(id && { file_id: id })
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -286,14 +252,12 @@ export async function fetchViolationFinalSummaryStatistic() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30023,
|
msg_id: 30023
|
||||||
message_body: {
|
|
||||||
token: token,
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -361,7 +325,6 @@ export async function createComplaint(
|
|||||||
version: 1,
|
version: 1,
|
||||||
msg_id: 30013,
|
msg_id: 30013,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
|
||||||
action: 'create',
|
action: 'create',
|
||||||
violation_id: violationId,
|
violation_id: violationId,
|
||||||
text: textArea,
|
text: textArea,
|
||||||
@@ -370,7 +333,8 @@ export async function createComplaint(
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -427,13 +391,13 @@ export async function fetchComplainInfo(id: number) {
|
|||||||
msg_id: 30013,
|
msg_id: 30013,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'get_by_violation',
|
action: 'get_by_violation',
|
||||||
violation_id: id,
|
violation_id: id
|
||||||
token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -471,13 +435,13 @@ export async function updateMatchStatus(id: number, status: MatchStatus) {
|
|||||||
message_body: {
|
message_body: {
|
||||||
action: 'updateStatus',
|
action: 'updateStatus',
|
||||||
violation_id: id,
|
violation_id: id,
|
||||||
status: status,
|
status: status
|
||||||
token: token
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -508,7 +472,6 @@ export async function fetchClaimInfo(id: number) {
|
|||||||
msg_id: 30017,
|
msg_id: 30017,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: 'get_all',
|
action: 'get_all',
|
||||||
token: token,
|
|
||||||
pageSize: 1,
|
pageSize: 1,
|
||||||
pageNumber: 0,
|
pageNumber: 0,
|
||||||
sortBy: "createdAt",
|
sortBy: "createdAt",
|
||||||
@@ -518,7 +481,8 @@ export async function fetchClaimInfo(id: number) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -605,7 +569,6 @@ export async function createClaim(
|
|||||||
violation_id: violationId,
|
violation_id: violationId,
|
||||||
description: textArea,
|
description: textArea,
|
||||||
email: email,
|
email: email,
|
||||||
token: token,
|
|
||||||
name: caseTitle,
|
name: caseTitle,
|
||||||
priority: 'HIGH',
|
priority: 'HIGH',
|
||||||
amount: Number(amount)
|
amount: Number(amount)
|
||||||
@@ -613,7 +576,8 @@ export async function createClaim(
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -684,7 +648,6 @@ export async function fetchLastClaims(params: ComplaintsCaseQueryParams) {
|
|||||||
msg_id: 30017,
|
msg_id: 30017,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: "get_all",
|
action: "get_all",
|
||||||
token: token,
|
|
||||||
pageNumber: page,
|
pageNumber: page,
|
||||||
size,
|
size,
|
||||||
sort_by,
|
sort_by,
|
||||||
@@ -693,7 +656,8 @@ export async function fetchLastClaims(params: ComplaintsCaseQueryParams) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -725,7 +689,6 @@ export async function fetchLastComplaint(params: ComplaintsCaseQueryParams) {
|
|||||||
msg_id: 30013,
|
msg_id: 30013,
|
||||||
message_body: {
|
message_body: {
|
||||||
action: "get_all",
|
action: "get_all",
|
||||||
token: token,
|
|
||||||
page,
|
page,
|
||||||
size,
|
size,
|
||||||
sort_by,
|
sort_by,
|
||||||
@@ -734,7 +697,8 @@ export async function fetchLastComplaint(params: ComplaintsCaseQueryParams) {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const checkout = new YooCheckout({ shopId: '1276731', secretKey: 'test_0Yns_0NHV
|
|||||||
|
|
||||||
export async function makePaymentOperation(email: string, tariffId: number, operationUuid: string, operationType: 'TARIFF' | 'TOKEN') {
|
export async function makePaymentOperation(email: string, tariffId: number, operationUuid: string, operationType: 'TARIFF' | 'TOKEN') {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
formData.append('email', email);
|
formData.append('email', email);
|
||||||
formData.append('tariffId', tariffId.toString());
|
formData.append('tariffId', tariffId.toString());
|
||||||
@@ -17,7 +18,10 @@ export async function makePaymentOperation(email: string, tariffId: number, oper
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/payments/create`, {
|
const response = await fetch(`${API_BASE_URL}/api/payments/create`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData,
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
@@ -79,6 +83,7 @@ export async function yooKasaCreatePayment(amount: number, tariff: number, opera
|
|||||||
|
|
||||||
export async function fetchPaymentsHistory() {
|
export async function fetchPaymentsHistory() {
|
||||||
const email = await getSessionData('email');
|
const email = await getSessionData('email');
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
@@ -93,7 +98,8 @@ export async function fetchPaymentsHistory() {
|
|||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import Link from 'next/link';
|
|||||||
import { SelectedFilesAction } from '@/app/components/tanstak-table/SelectedFilesActions';
|
import { SelectedFilesAction } from '@/app/components/tanstak-table/SelectedFilesActions';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { filePermisionChange } from '@/app/actions/trackingActions';
|
import { filePermisionChange } from '@/app/actions/trackingActions';
|
||||||
|
import {FileAppealModalWindow} from '@/app/ui/modal-windows/file-appeal-modal-window';
|
||||||
|
|
||||||
export type FileItem = {
|
export type FileItem = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -41,7 +42,7 @@ export type FileItem = {
|
|||||||
violations?: number | undefined;
|
violations?: number | undefined;
|
||||||
size?: number | undefined;
|
size?: number | undefined;
|
||||||
uploadDate?: number;
|
uploadDate?: number;
|
||||||
status?: string;
|
status: string;
|
||||||
monitoring: string;
|
monitoring: string;
|
||||||
protectStatus: string;
|
protectStatus: string;
|
||||||
_original?: ApiFile;
|
_original?: ApiFile;
|
||||||
@@ -295,6 +296,32 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
});
|
});
|
||||||
}, [apiResponse]);
|
}, [apiResponse]);
|
||||||
|
|
||||||
|
const StatusBadge = ({ status, protectStatus }: { status: string, protectStatus: string }) => {
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 'ACTIVE':
|
||||||
|
return <span className="table-item-status-badge protected">
|
||||||
|
{protectStatus ? t(protectStatus) : t('error')}
|
||||||
|
</span>;
|
||||||
|
case 'MODERATION':
|
||||||
|
return <span className="table-item-status-badge moderation">
|
||||||
|
{t('pending-moderation')}
|
||||||
|
</span>;
|
||||||
|
case 'BLOCKED':
|
||||||
|
return <span className="table-item-status-badge blocked">
|
||||||
|
{t('blocked')}
|
||||||
|
</span>;
|
||||||
|
case 'REMOVED':
|
||||||
|
return <span className="table-item-status-badge blocked">
|
||||||
|
{t('file-has-been-deleted')}
|
||||||
|
</span>;
|
||||||
|
default:
|
||||||
|
return <span className="table-item-status-badge protected">
|
||||||
|
{protectStatus ? t(protectStatus) : t('error')}
|
||||||
|
</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const isAllSelected = useMemo(() => {
|
const isAllSelected = useMemo(() => {
|
||||||
if (!apiResponse?.items?.length) return false;
|
if (!apiResponse?.items?.length) return false;
|
||||||
const allIds = new Set(apiResponse.items.map(item => item.id));
|
const allIds = new Set(apiResponse.items.map(item => item.id));
|
||||||
@@ -431,9 +458,7 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
{cutFileName(row.original.fileName)}
|
{cutFileName(row.original.fileName)}
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<span className="table-item-extension">{cutFileExtension(row.original.fileName)}</span> <span className="table-item-protected">
|
<span className="table-item-extension">{cutFileExtension(row.original.fileName)}</span> <StatusBadge status={row.original.status} protectStatus={row.original.protectStatus} />
|
||||||
{row.original?.protectStatus ? t(row.original?.protectStatus) : t('error')}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -613,6 +638,9 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
<>
|
||||||
|
{/* "BLOCKED" "REMOVED" */}
|
||||||
|
{(row.original.status !== 'BLOCKED' && row.original.status !== 'REMOVED') ? (
|
||||||
<>
|
<>
|
||||||
<div className="actions-group">
|
<div className="actions-group">
|
||||||
<Link
|
<Link
|
||||||
@@ -645,6 +673,20 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="actions-group">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
handleAppeal(row.original)
|
||||||
|
}}
|
||||||
|
className="table-action-appeal"
|
||||||
|
title={t('file-an-appeal')}
|
||||||
|
>
|
||||||
|
<IconInfo />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@@ -666,6 +708,17 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
setOpenWindow(true);
|
setOpenWindow(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleAppeal = async (file: FileItem) => {
|
||||||
|
console.log(file);
|
||||||
|
|
||||||
|
setOpenWindowChildren(() => {
|
||||||
|
return (
|
||||||
|
<FileAppealModalWindow fileId={file.id} setWindowClose={setOpenWindow} setWindowChildren={setOpenWindowChildren} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
setOpenWindow(true);
|
||||||
|
};
|
||||||
|
|
||||||
const handleDownload = async (file: FileItem) => {
|
const handleDownload = async (file: FileItem) => {
|
||||||
setIsFileLoading(true)
|
setIsFileLoading(true)
|
||||||
|
|
||||||
@@ -1014,10 +1067,7 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
{t('page')}{' '}
|
{t('page')}{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
||||||
</strong>
|
</strong> | {t('total-files')}: {totalItems}
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {tableData.length} {t('out-of')} {totalItems} {pluralizeFiles(totalItems)}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ interface ViolationFile {
|
|||||||
has_previous: boolean;
|
has_previous: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useFileViolations = (id: string, page: number, status?: string, violationId?: string) => {
|
export const useFileViolations = (id: string, page: number, status?: string, violationId?: string, startDate?: string, endDate?: string,) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['fileViolations', id, page, status, violationId],
|
queryKey: ['fileViolations', id, page, status, violationId, startDate, endDate],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return getFileMatches(id, page, status, violationId)
|
return getFileMatches(id, page, status, violationId, startDate, endDate)
|
||||||
},
|
},
|
||||||
select: (data: ViolationFile | null) => {
|
select: (data: ViolationFile | null) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ export interface UseViolationStatistic {
|
|||||||
total_violations: number,
|
total_violations: number,
|
||||||
new_violations: number,
|
new_violations: number,
|
||||||
in_progress_violations: number,
|
in_progress_violations: number,
|
||||||
resolved_violations: number
|
resolved_violations: number,
|
||||||
|
total_complaints: number,
|
||||||
|
total_law_cases: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useViolationStatistic = () => {
|
export const useViolationStatistic = (id?: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['violationStatistic'],
|
queryKey: ['violationStatistic', id],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchViolationStatistic()
|
return fetchViolationStatistic(id)
|
||||||
},
|
},
|
||||||
select: (data: UseViolationStatistic | null) => {
|
select: (data: UseViolationStatistic | null) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
.btn,
|
.btn,
|
||||||
.btn-s,
|
.btn-s,
|
||||||
.btn-m {
|
.btn-l {
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@@ -197,7 +197,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background: linear-gradient(135deg, v.$p-color, v.$s-color);
|
/* background: linear-gradient(135deg, v.$p-color, v.$s-color); */
|
||||||
|
background: #6366f1;
|
||||||
color: v.$white;
|
color: v.$white;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
|
|
||||||
@@ -222,6 +223,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background: v.$bg-hover;
|
||||||
|
color: v.$text-p;
|
||||||
|
border: 2px solid v.$border-color-1;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn-outline {
|
.btn-outline {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: 2px solid v.$p-color;
|
border: 2px solid v.$p-color;
|
||||||
|
|||||||
@@ -270,16 +270,16 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: -5px;
|
right: -5px;
|
||||||
bottom: -5px;
|
bottom: -5px;
|
||||||
width: 20px;
|
/* width: 22px;
|
||||||
height: 20px;
|
height: 22px; */
|
||||||
border-radius: 50%;
|
border-radius: 15px;
|
||||||
background: v.$red;
|
background: v.$red;
|
||||||
color: v.$white;
|
color: v.$white;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding-top: 1px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -930,13 +930,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-item-protected {
|
.table-item-status-badge {
|
||||||
color: #10b981;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
|
|
||||||
|
&.protected {
|
||||||
|
color: #10b981;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.moderation {
|
||||||
|
color: v.$color-warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.blocked {
|
||||||
|
color: v.$red;
|
||||||
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '•';
|
content: '•';
|
||||||
color: v.$text-s;
|
color: v.$text-s;
|
||||||
@@ -1016,11 +1027,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-action-delete {
|
.table-action-appeal {
|
||||||
background-color: #e80a14;
|
background-color: #9f0712;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #9f0712;
|
background-color: v.$red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3799,7 +3810,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.info-header {
|
.info-header {
|
||||||
background: linear-gradient(0deg, #6366f1 50%, #8b5cf6 130%);
|
background: #6366f1;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
border-bottom: 1px solid v.$border-color-1;
|
border-bottom: 1px solid v.$border-color-1;
|
||||||
@@ -3847,6 +3858,84 @@
|
|||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
border-bottom: 1px solid #f1f5f9;
|
border-bottom: 1px solid #f1f5f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appeal-form {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #6366f1;
|
||||||
|
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-textarea:disabled {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.required {
|
||||||
|
color: #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-submit-btn {
|
||||||
|
padding: 8px 20px;
|
||||||
|
background-color: #6366f1;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-submit-btn:hover:not(:disabled) {
|
||||||
|
background-color: #4f46e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-submit-btn:disabled {
|
||||||
|
background-color: #9ca3af;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-cancel-btn {
|
||||||
|
padding: 8px 20px;
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
color: #374151;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-cancel-btn:hover:not(:disabled) {
|
||||||
|
background-color: #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appeal-cancel-btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
export default function FilePpageFileStatistic() {
|
'use client'
|
||||||
|
|
||||||
|
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
||||||
|
|
||||||
|
export default function FilePageFileStatistic({ id }: { id: string }) {
|
||||||
|
const { data: violationStatistic } = useViolationStatistic(id);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="block-wrapper"
|
className="block-wrapper"
|
||||||
@@ -13,36 +19,36 @@ export default function FilePpageFileStatistic() {
|
|||||||
<div className="stat-mini-card">
|
<div className="stat-mini-card">
|
||||||
<div
|
<div
|
||||||
className="stat-mini-value"
|
className="stat-mini-value"
|
||||||
style={{'color': '#dc2626'}}
|
style={{ 'color': '#dc2626' }}
|
||||||
>
|
>
|
||||||
0
|
{violationStatistic?.new_violations ? violationStatistic?.new_violations : 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-label">Новых</div>
|
<div className="stat-mini-label">Новых</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-card">
|
<div className="stat-mini-card">
|
||||||
<div
|
<div
|
||||||
className="stat-mini-value"
|
className="stat-mini-value"
|
||||||
style={{'color': '#d97706'}}
|
style={{ 'color': '#d97706' }}
|
||||||
>
|
>
|
||||||
0
|
{violationStatistic?.in_progress_violations ? violationStatistic?.in_progress_violations : 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-label">В работе</div>
|
<div className="stat-mini-label">В работе</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-card">
|
<div className="stat-mini-card">
|
||||||
<div
|
<div
|
||||||
className="stat-mini-value"
|
className="stat-mini-value"
|
||||||
style={{'color': '#059669'}}
|
style={{ 'color': '#059669' }}
|
||||||
>
|
>
|
||||||
0
|
{violationStatistic?.resolved_violations ? violationStatistic?.resolved_violations : 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-label">Решено</div>
|
<div className="stat-mini-label">Решено</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-card">
|
<div className="stat-mini-card">
|
||||||
<div
|
<div
|
||||||
className="stat-mini-value"
|
className="stat-mini-value"
|
||||||
style={{'color': '#6366f1'}}
|
style={{ 'color': '#6366f1' }}
|
||||||
>
|
>
|
||||||
0
|
{violationStatistic?.total_violations ? violationStatistic?.total_violations : 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-label">Всего</div>
|
<div className="stat-mini-label">Всего</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,13 +17,17 @@ export default function FilePageViolationsList({
|
|||||||
fileId,
|
fileId,
|
||||||
status,
|
status,
|
||||||
violationId,
|
violationId,
|
||||||
caseType
|
caseType,
|
||||||
|
startDate,
|
||||||
|
endDate
|
||||||
}: {
|
}: {
|
||||||
currentPage: number,
|
currentPage: number,
|
||||||
fileId: string,
|
fileId: string,
|
||||||
status: string | undefined,
|
status: string | undefined,
|
||||||
violationId?: string | undefined
|
violationId?: string | undefined,
|
||||||
caseType?: 'claim' | 'complaint'
|
caseType?: 'claim' | 'complaint',
|
||||||
|
startDate?: string,
|
||||||
|
endDate?: string
|
||||||
}) {
|
}) {
|
||||||
const t = useTranslations('Global');
|
const t = useTranslations('Global');
|
||||||
const tStatus = useTranslations('Match-status');
|
const tStatus = useTranslations('Match-status');
|
||||||
@@ -38,7 +42,7 @@ export default function FilePageViolationsList({
|
|||||||
current_page: number;
|
current_page: number;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
const { data: fileViolations, error, isPending } = useFileViolations(fileId, currentPage, status, violationId);
|
const { data: fileViolations, error, isPending } = useFileViolations(fileId, currentPage, status, violationId, startDate, endDate);
|
||||||
|
|
||||||
function selectHandler(violation: ViolationFileDetail) {
|
function selectHandler(violation: ViolationFileDetail) {
|
||||||
setSelectedViolation(violation);
|
setSelectedViolation(violation);
|
||||||
@@ -228,7 +232,7 @@ export default function FilePageViolationsList({
|
|||||||
className="sources-list-pagination"
|
className="sources-list-pagination"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{t('total-violations')}: {fileViolations?.total_elements} | {t('page')} {fileViolations?.current_page} {t('out-of')} {fileViolations?.total_pages}
|
{t('page')} <strong>{fileViolations?.current_page + 1} {t('out-of')} {fileViolations?.total_pages}</strong> | {t('total-violations')}: {fileViolations?.total_elements}
|
||||||
</span>
|
</span>
|
||||||
{fileViolations?.total_pages > 1 && (
|
{fileViolations?.total_pages > 1 && (
|
||||||
<div className="pagination-controls">
|
<div className="pagination-controls">
|
||||||
|
|||||||
@@ -256,9 +256,12 @@ export default function RegisterForm() {
|
|||||||
<ConfirmMailModalWindow userId={state?.userId} email={formState?.previousState?.email} onClose={() => { setShowMailConfirmWindow(false) }} />
|
<ConfirmMailModalWindow userId={state?.userId} email={formState?.previousState?.email} onClose={() => { setShowMailConfirmWindow(false) }} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<form action={(e) => {
|
<form
|
||||||
|
action={(e) => {
|
||||||
formAction(e);
|
formAction(e);
|
||||||
}}>
|
}}
|
||||||
|
autoComplete="off"
|
||||||
|
>
|
||||||
<div className={`${styles['form-switcher']}`}>
|
<div className={`${styles['form-switcher']}`}>
|
||||||
<button
|
<button
|
||||||
className={`${styles['form-switcher-button']} ${accountType === 'b2c' ? styles['active'] : ''}`}
|
className={`${styles['form-switcher-button']} ${accountType === 'b2c' ? styles['active'] : ''}`}
|
||||||
@@ -432,6 +435,7 @@ export default function RegisterForm() {
|
|||||||
e.target.value = e.target.value.toLocaleLowerCase();
|
e.target.value = e.target.value.toLocaleLowerCase();
|
||||||
onChangeHandler(e)
|
onChangeHandler(e)
|
||||||
}}
|
}}
|
||||||
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
{formState?.error?.email && (
|
{formState?.error?.email && (
|
||||||
<p className="text-sm text-red-500">
|
<p className="text-sm text-red-500">
|
||||||
@@ -486,6 +490,7 @@ export default function RegisterForm() {
|
|||||||
placeholder={t('password-placeholder')}
|
placeholder={t('password-placeholder')}
|
||||||
defaultValue={formState?.previousState?.password ? formState?.previousState?.password : ''}
|
defaultValue={formState?.previousState?.password ? formState?.previousState?.password : ''}
|
||||||
onChange={onChangeHandler}
|
onChange={onChangeHandler}
|
||||||
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { logout } from '@/app/actions/auth';
|
|||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { useUserProfile } from '@/app/hooks/react-query/useUserDataInfo';
|
import { useUserProfile } from '@/app/hooks/react-query/useUserDataInfo';
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
|
import {formatDate} from '@/app/lib/formatDate';
|
||||||
|
|
||||||
export default function UserMenuButton() {
|
export default function UserMenuButton() {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
@@ -62,14 +63,16 @@ export default function UserMenuButton() {
|
|||||||
<div className="user-email">
|
<div className="user-email">
|
||||||
{userData?.email ?? ''}
|
{userData?.email ?? ''}
|
||||||
</div>
|
</div>
|
||||||
|
{userData?.tariffInfo?.tariffName && (
|
||||||
<div className="user-subscription">
|
<div className="user-subscription">
|
||||||
<span className="text-[14px]">{t('rate')}: </span>
|
<span className="text-[14px]">{t('rate')}: </span>
|
||||||
<span className="subscription-badge">
|
<span className="subscription-badge">
|
||||||
{userData?.tariffInfo?.tariffName ? userData?.tariffInfo?.tariffName : '---'}
|
{userData?.tariffInfo?.tariffName ? userData?.tariffInfo?.tariffName : '---'}
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<span className="user-subscription-expire">{t('expires')}: 00.00.00</span>
|
<span className="user-subscription-expire">{t('expires')}: {formatDate(userData?.tariffInfo.endTariff)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { convertBytes } from '@/app/lib/convertBytes';
|
||||||
|
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
||||||
|
import { useTranslations } from 'next-intl';
|
||||||
|
import { FileDetails } from '@/app/[locale]/pages/file/[id]/page';
|
||||||
|
import { FileAnAppeal } from '@/app/actions/fileEntity';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { toast } from 'sonner';
|
||||||
|
|
||||||
|
export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildren }: {
|
||||||
|
fileId: string,
|
||||||
|
setWindowClose: any,
|
||||||
|
setWindowChildren: any
|
||||||
|
}) {
|
||||||
|
const t = useTranslations('Global');
|
||||||
|
const [appealReason, setAppealReason] = useState('');
|
||||||
|
const [additionalInfo, setAdditionalInfo] = useState('');
|
||||||
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
|
const handleSubmitAppeal = async () => {
|
||||||
|
if (!appealReason.trim()) {
|
||||||
|
toast.error(t('please-enter-appeal-reason'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsSubmitting(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await FileAnAppeal(fileId, appealReason, additionalInfo);
|
||||||
|
|
||||||
|
if (result?.message_desc === 'Appeal submitted successfully') {
|
||||||
|
toast.success(t('appeal-submitted-successfully'));
|
||||||
|
setWindowClose(false);
|
||||||
|
} else if (result?.message_desc === 'Active appeal already exists for this file') {
|
||||||
|
toast.error(t('active-appeal-already-exists-for-this-file'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toast.error(result?.message_desc || t('appeal-submission-failed'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Appeal submission error:', error);
|
||||||
|
toast.error(t('appeal-submission-failed'));
|
||||||
|
} finally {
|
||||||
|
setIsSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="modal-window-view-file">
|
||||||
|
<div className="modal-window-view-file-content">
|
||||||
|
{/* Форма подачи апелляции */}
|
||||||
|
<div className="file-info-card appeal-form">
|
||||||
|
<div className="info-header">
|
||||||
|
<h4>{t('file-an-appeal')}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">
|
||||||
|
{t('appeal-reason')} <span className="required">*</span>
|
||||||
|
</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<textarea
|
||||||
|
className="appeal-textarea"
|
||||||
|
value={appealReason}
|
||||||
|
onChange={(e) => setAppealReason(e.target.value)}
|
||||||
|
placeholder={t('enter-appeal-reason')}
|
||||||
|
rows={4}
|
||||||
|
disabled={isSubmitting}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('additional-info')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<textarea
|
||||||
|
className="appeal-textarea"
|
||||||
|
value={additionalInfo}
|
||||||
|
onChange={(e) => setAdditionalInfo(e.target.value)}
|
||||||
|
placeholder={t('enter-additional-info')}
|
||||||
|
rows={3}
|
||||||
|
disabled={isSubmitting}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="appeal-actions">
|
||||||
|
<button
|
||||||
|
className="btn btn-cancel"
|
||||||
|
onClick={() => setWindowClose(false)}
|
||||||
|
disabled={isSubmitting}
|
||||||
|
>
|
||||||
|
{t('cancel')}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="btn btn-primary"
|
||||||
|
onClick={handleSubmitAppeal}
|
||||||
|
disabled={isSubmitting}
|
||||||
|
>
|
||||||
|
{isSubmitting ? t('submitting') : t('submit-appeal')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -429,9 +429,6 @@ export default function PaymentTabTransactionHistory() {
|
|||||||
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {table.getRowModel().rows.length} {t('out-of')} {filteredData.length}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pagination-controls">
|
<div className="pagination-controls">
|
||||||
|
|||||||
@@ -402,9 +402,6 @@ export default function InvitationsTable() {
|
|||||||
<strong>
|
<strong>
|
||||||
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {table.getRowModel().rows.length} {t('out-of')} {filteredData.length} {pluralizeFiles(filteredData.length || 0)}
|
|
||||||
</span> */}
|
</span> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -425,9 +425,6 @@ export default function PaymentsHistory() {
|
|||||||
<strong>
|
<strong>
|
||||||
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
{table.getState().pagination.pageIndex + 1} {t('out-of')} {table.getPageCount() ? table.getPageCount() : 1}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {table.getRowModel().rows.length} {t('out-of')} {filteredData.length} {pluralizeFiles(filteredData.length || 0)}
|
|
||||||
</span> */}
|
</span> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import { useUserFilesInfo } from '@/app/hooks/react-query/useUserFilesInfo';
|
import { useUserFilesInfo } from '@/app/hooks/react-query/useUserFilesInfo';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { useMonitoringStats } from '@/app/hooks/react-query/useMonitoringStats';
|
import { useMonitoringStats } from '@/app/hooks/react-query/useMonitoringStats';
|
||||||
import { useViolationFinalSummaryStatistic } from '@/app/hooks/react-query/useViolationFinalSummaryStatistic';
|
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
||||||
|
|
||||||
export default function FinalSummary() {
|
export default function FinalSummary() {
|
||||||
const t = useTranslations('Global');
|
const t = useTranslations('Global');
|
||||||
const { data: filesInfo, isLoading, isError, error } = useUserFilesInfo();
|
const { data: filesInfo, isLoading, isError, error } = useUserFilesInfo();
|
||||||
const { data: violationStatistic } = useViolationFinalSummaryStatistic();
|
|
||||||
const { data: monitoringStats } = useMonitoringStats();
|
const { data: monitoringStats } = useMonitoringStats();
|
||||||
|
const { data: violationStatistic } = useViolationStatistic();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="final-summary">
|
<div className="final-summary">
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ export function TrackingHistoryView() {
|
|||||||
refetch
|
refetch
|
||||||
} = useHistoryView(pagination.pageIndex, pagination.pageSize, locale, getSortParams.sortOrder, getSortParams.sortBy);
|
} = useHistoryView(pagination.pageIndex, pagination.pageSize, locale, getSortParams.sortOrder, getSortParams.sortBy);
|
||||||
|
|
||||||
|
const totalElements = apiResponse?.totalElements || 0
|
||||||
const tableData = apiResponse?.history || [];
|
const tableData = apiResponse?.history || [];
|
||||||
const totalItems = apiResponse?.history.length || 0;
|
|
||||||
const totalPages = apiResponse?.totalPages || 0;
|
const totalPages = apiResponse?.totalPages || 0;
|
||||||
|
|
||||||
const viewport = useViewport();
|
const viewport = useViewport();
|
||||||
@@ -84,15 +84,23 @@ export function TrackingHistoryView() {
|
|||||||
return nameWithoutExtension.substring(0, maxNameLength) + '...';
|
return nameWithoutExtension.substring(0, maxNameLength) + '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
const editLocationName = (location: string | undefined | null) => {
|
function EditLocationName({ location }: { location: string | undefined | null }) {
|
||||||
if (!location) return '';
|
if (!location) return (
|
||||||
|
<div></div>
|
||||||
|
);
|
||||||
|
|
||||||
const [city, country] = location.split('/');
|
const [city, country] = location.split('/');
|
||||||
|
|
||||||
const translatedCity = city === 'unknow' ? t('not-defined-city') : city;
|
const translatedCity = city === 'unknow' ? t('not-defined-city') : city;
|
||||||
const translatedCountry = country === 'unknow' ? t('not-defined-country') : country;
|
const translatedCountry = country === 'unknow' ? t('not-defined-country') : country;
|
||||||
|
|
||||||
return `${translatedCity}/${translatedCountry}`;
|
return (
|
||||||
|
<div>
|
||||||
|
{t('city')}: <strong>{translatedCity}</strong>
|
||||||
|
<br />
|
||||||
|
{t('country')}: <strong>{translatedCountry}</strong>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = useMemo<ColumnDef<HistoryViewItem>[]>(
|
const columns = useMemo<ColumnDef<HistoryViewItem>[]>(
|
||||||
@@ -213,7 +221,7 @@ export function TrackingHistoryView() {
|
|||||||
{
|
{
|
||||||
accessorKey: 'location',
|
accessorKey: 'location',
|
||||||
header: ({ column }) => (
|
header: ({ column }) => (
|
||||||
<div className="column">
|
<div className="column column-location">
|
||||||
<span>
|
<span>
|
||||||
{t('location')}
|
{t('location')}
|
||||||
</span>
|
</span>
|
||||||
@@ -243,7 +251,7 @@ export function TrackingHistoryView() {
|
|||||||
{row.original.country === 'unknow/unknow' ? (
|
{row.original.country === 'unknow/unknow' ? (
|
||||||
t('not-defined')
|
t('not-defined')
|
||||||
) : (
|
) : (
|
||||||
`${editLocationName(row.original.country)}`
|
<EditLocationName location={row.original.country} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -252,7 +260,7 @@ export function TrackingHistoryView() {
|
|||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
/* `${editLocationName(row.original.country)}` */
|
||||||
// Создание таблицы
|
// Создание таблицы
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: tableData,
|
data: tableData,
|
||||||
@@ -287,13 +295,14 @@ export function TrackingHistoryView() {
|
|||||||
className="block-wrapper"
|
className="block-wrapper"
|
||||||
>
|
>
|
||||||
<div className="tanstak-table-wrapper">
|
<div className="tanstak-table-wrapper">
|
||||||
|
|
||||||
|
{/* Фильтры */}
|
||||||
|
<div className="tanstak-table-filtres">
|
||||||
<h3
|
<h3
|
||||||
className="tanstak-table-title"
|
className="tanstak-table-title"
|
||||||
>
|
>
|
||||||
{t('history-of-opened')}
|
{t('history-of-opened')}
|
||||||
</h3>
|
</h3>
|
||||||
{/* Фильтры */}
|
|
||||||
<div className="tanstak-table-filtres">
|
|
||||||
<div className="table-filtres-wrapper text-filter-search end">
|
<div className="table-filtres-wrapper text-filter-search end">
|
||||||
<div className="table-filtres-item">
|
<div className="table-filtres-item">
|
||||||
<div className="table-filtres-label">{t('items-per-page')}:</div>
|
<div className="table-filtres-label">{t('items-per-page')}:</div>
|
||||||
@@ -382,10 +391,7 @@ export function TrackingHistoryView() {
|
|||||||
{t('page')}{' '}
|
{t('page')}{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
||||||
</strong>
|
</strong> | {t('total-document-openings')}: {totalElements}
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {tableData.length} {t('out-of')} {totalItems}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -270,10 +270,7 @@ export function ViolationsMyClaimsTable() {
|
|||||||
{t('page')}{' '}
|
{t('page')}{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
||||||
</strong>
|
</strong> | {t('total-claims')}: {totalItems}
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {tableData.length} {t('out-of')} {totalItems}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -270,10 +270,7 @@ export function ViolationsMyComplaintsTable() {
|
|||||||
{t('page')}{' '}
|
{t('page')}{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
{pagination.pageIndex + 1} {t('out-of')} {totalPages || 1}
|
||||||
</strong>
|
</strong> | {t('total-complaints')}: {totalItems}
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {tableData.length} {t('out-of')} {totalItems}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ export default function ViolationsTable() {
|
|||||||
return nameWithoutExtension.substring(0, maxNameLength) + '...';
|
return nameWithoutExtension.substring(0, maxNameLength) + '...';
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = useMemo<ColumnDef<FileViolation>[]>(
|
const baseColumns = useMemo<ColumnDef<FileViolation>[]>(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: 'supportId',
|
accessorKey: 'supportId',
|
||||||
@@ -276,8 +276,13 @@ export default function ViolationsTable() {
|
|||||||
{row.original.countLawCase}
|
{row.original.countLawCase}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
|
[t, viewport]
|
||||||
|
);
|
||||||
|
|
||||||
|
const actionsColumn = useMemo<ColumnDef<FileViolation>>(
|
||||||
|
() => ({
|
||||||
accessorKey: 'actions',
|
accessorKey: 'actions',
|
||||||
header: () => (
|
header: () => (
|
||||||
<div className="column">
|
<div className="column">
|
||||||
@@ -288,7 +293,7 @@ export default function ViolationsTable() {
|
|||||||
<div className="actions">
|
<div className="actions">
|
||||||
<div className="actions-group">
|
<div className="actions-group">
|
||||||
<Link
|
<Link
|
||||||
href={`/pages/file/${row.original.fileId}`}
|
href={`/pages/file/${row.original.fileId}?startDate=${dateRange.start_date || ''}&endDate=${dateRange.end_date || ''}`}
|
||||||
className="bg-violet-500 hover:bg-violet-600"
|
className="bg-violet-500 hover:bg-violet-600"
|
||||||
title={t('view')}
|
title={t('view')}
|
||||||
>
|
>
|
||||||
@@ -297,11 +302,12 @@ export default function ViolationsTable() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
}),
|
||||||
],
|
[t, dateRange.start_date, dateRange.end_date]
|
||||||
[t, viewport]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const columns = useMemo(() => [...baseColumns, actionsColumn], [baseColumns, actionsColumn]);
|
||||||
|
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: violationData?.content || [],
|
data: violationData?.content || [],
|
||||||
columns,
|
columns,
|
||||||
@@ -471,10 +477,7 @@ export default function ViolationsTable() {
|
|||||||
{t('page')}{' '}
|
{t('page')}{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{table.getState().pagination.pageIndex + 1} {t('out-of')} {violationData?.totalPages || 1}
|
{table.getState().pagination.pageIndex + 1} {t('out-of')} {violationData?.totalPages || 1}
|
||||||
</strong>
|
</strong> | {t('total-matches')}: {violationData?.totalElements}
|
||||||
</span>
|
|
||||||
<span className="pagination-info-files">
|
|
||||||
| {t('shown')} {violationData?.content?.length || 0} {t('out-of')} {violationData?.totalElements || 0}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -473,8 +473,27 @@
|
|||||||
"location": "Location",
|
"location": "Location",
|
||||||
"history-of-opened": "History of opened",
|
"history-of-opened": "History of opened",
|
||||||
"not-defined": "Not defined",
|
"not-defined": "Not defined",
|
||||||
"not-defined-city": "The city is not defined",
|
"not-defined-city": "Not defined",
|
||||||
"not-defined-country": "Country not defined"
|
"not-defined-country": "Not defined",
|
||||||
|
"total-document-openings": "Total document openings",
|
||||||
|
"total-matches": "Total matches",
|
||||||
|
"total-complaints": "Total complaints",
|
||||||
|
"total-claims": "Total claims",
|
||||||
|
"city": "City",
|
||||||
|
"closed": "Closed",
|
||||||
|
"blocked": "Blocked",
|
||||||
|
"pending-moderation": "Pending moderation",
|
||||||
|
"file-an-appeal": "File an appeal",
|
||||||
|
"please-enter-appeal-reason": "Please enter the reason for appeal",
|
||||||
|
"appeal-submitted-successfully": "Appeal submitted successfully",
|
||||||
|
"appeal-submission-failed": "Failed to submit appeal",
|
||||||
|
"appeal-reason": "Reason for appeal",
|
||||||
|
"enter-appeal-reason": "Describe the reason for your appeal...",
|
||||||
|
"additional-info": "Additional information",
|
||||||
|
"enter-additional-info": "Any additional information that may help...",
|
||||||
|
"submit-appeal": "Submit appeal",
|
||||||
|
"submitting": "Submitting...",
|
||||||
|
"active-appeal-already-exists-for-this-file": "Active appeal already exists for this file"
|
||||||
},
|
},
|
||||||
"Login-register-form": {
|
"Login-register-form": {
|
||||||
"and": "and",
|
"and": "and",
|
||||||
|
|||||||
@@ -204,8 +204,8 @@
|
|||||||
"document-occupy": "Занимают документы",
|
"document-occupy": "Занимают документы",
|
||||||
"violations-found": "Найдено нарушений",
|
"violations-found": "Найдено нарушений",
|
||||||
"total-violations": "Всего нарушений",
|
"total-violations": "Всего нарушений",
|
||||||
"violations-registered": "Жалоб зарегистрированно",
|
"violations-registered": "Жалоб зарегистрировано",
|
||||||
"claims-registered": "Претензий зарегистрированно",
|
"claims-registered": "Претензий зарегистрировано",
|
||||||
"new": "Новые",
|
"new": "Новые",
|
||||||
"in-progress": "В работе",
|
"in-progress": "В работе",
|
||||||
"it-decided": "Решено",
|
"it-decided": "Решено",
|
||||||
@@ -473,8 +473,27 @@
|
|||||||
"location": "Местоположение",
|
"location": "Местоположение",
|
||||||
"history-of-opened": "История открытий",
|
"history-of-opened": "История открытий",
|
||||||
"not-defined": "Не определено",
|
"not-defined": "Не определено",
|
||||||
"not-defined-city": "Город не определен",
|
"not-defined-city": "Не определен",
|
||||||
"not-defined-country": "Страна не определена"
|
"not-defined-country": "Не определена",
|
||||||
|
"total-document-openings": "Всего открытий документов",
|
||||||
|
"total-matches": "Всего совпадений",
|
||||||
|
"total-complaints": "Всего нарушений",
|
||||||
|
"total-claims": "Всего претензий",
|
||||||
|
"city": "Город",
|
||||||
|
"closed": "Закрыта",
|
||||||
|
"blocked": "Заблокирован",
|
||||||
|
"pending-moderation": "На модерации",
|
||||||
|
"file-an-appeal": "Подать апелляцию",
|
||||||
|
"please-enter-appeal-reason": "Пожалуйста, укажите причину апелляции",
|
||||||
|
"appeal-submitted-successfully": "Апелляция успешно отправлена",
|
||||||
|
"appeal-submission-failed": "Не удалось отправить апелляцию",
|
||||||
|
"appeal-reason": "Причина апелляции",
|
||||||
|
"enter-appeal-reason": "Опишите причину вашей апелляции...",
|
||||||
|
"additional-info": "Дополнительная информация",
|
||||||
|
"enter-additional-info": "Любая дополнительная информация, которая может помочь...",
|
||||||
|
"submit-appeal": "Отправить апелляцию",
|
||||||
|
"submitting": "Отправка...",
|
||||||
|
"active-appeal-already-exists-for-this-file": "По данному делу уже подана активная апелляция"
|
||||||
},
|
},
|
||||||
"Login-register-form": {
|
"Login-register-form": {
|
||||||
"and": "и",
|
"and": "и",
|
||||||
|
|||||||
Reference in New Issue
Block a user