Merge branch 'main' of https://code.sdsdev.co.kr/SDSRV-IDP/sbt-idp into main
This commit is contained in:
commit
997de835dc
@ -44,6 +44,7 @@
|
|||||||
"pdfjs-dist": "^3.11.174",
|
"pdfjs-dist": "^3.11.174",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
"react-awesome-lightbox": "^1.8.1",
|
||||||
"react-chartjs-2": "^5.2.0",
|
"react-chartjs-2": "^5.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hotkeys-hook": "^4.5.0",
|
"react-hotkeys-hook": "^4.5.0",
|
||||||
@ -51,6 +52,7 @@
|
|||||||
"react-office-viewer": "^1.0.4",
|
"react-office-viewer": "^1.0.4",
|
||||||
"react-router-dom": "^6.6.1",
|
"react-router-dom": "^6.6.1",
|
||||||
"styled-components": "^5.3.6",
|
"styled-components": "^5.3.6",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -119,7 +119,7 @@ export const MainLayout = ({ children }: { children: React.ReactNode }) => {
|
|||||||
style={{
|
style={{
|
||||||
height: '100%',
|
height: '100%',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
padding: 32,
|
padding: 16,
|
||||||
background: colorBgContainer,
|
background: colorBgContainer,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -31,6 +31,7 @@ const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
|||||||
>
|
>
|
||||||
{file['Doc Type'].toUpperCase()}
|
{file['Doc Type'].toUpperCase()}
|
||||||
</span>
|
</span>
|
||||||
|
<br/>
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
|
77
cope2n-fe/src/pages/reviews2/FileCard.tsx
Normal file
77
cope2n-fe/src/pages/reviews2/FileCard.tsx
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import { DownloadOutlined } from '@ant-design/icons';
|
||||||
|
import { Button } from 'antd';
|
||||||
|
|
||||||
|
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||||
|
const fileName = file['File Name'];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
backgroundColor: isSelected ? '#d4ecff' : '#fff',
|
||||||
|
padding: '4px 8px',
|
||||||
|
margin: '0 0 4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
}}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
fontSize: '12px',
|
||||||
|
color: '#333',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
cursor: 'default',
|
||||||
|
margin: '4px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{file['Doc Type'].toUpperCase()}
|
||||||
|
</p>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
fontSize: '12px',
|
||||||
|
color: '#aaa',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
cursor: 'default',
|
||||||
|
maxWidth: '40px',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{fileName ? fileName.substring(0, 25).replace('temp_', '') : fileName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
margin: '4px 2px',
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
setIsReasonModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Review
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
margin: '4px 2px',
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
const downloadUrl = file['File URL'];
|
||||||
|
window.open(downloadUrl, '_blank');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DownloadOutlined />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FileCard;
|
79
cope2n-fe/src/pages/reviews2/api.ts
Normal file
79
cope2n-fe/src/pages/reviews2/api.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { baseURL } from 'request/api';
|
||||||
|
|
||||||
|
export const fetchAllRequests = async (
|
||||||
|
filterDateRange,
|
||||||
|
filterSubsidiaries,
|
||||||
|
filterReviewState,
|
||||||
|
filterIncludeTests,
|
||||||
|
page = 1,
|
||||||
|
page_size = 20,
|
||||||
|
max_accuracy = 100
|
||||||
|
) => {
|
||||||
|
const startDate =
|
||||||
|
filterDateRange && filterDateRange[0] ? filterDateRange[0] : '';
|
||||||
|
const endDate =
|
||||||
|
filterDateRange && filterDateRange[1] ? filterDateRange[1] : '';
|
||||||
|
let filterStr = '';
|
||||||
|
filterStr += `page=${page}&page_size=${page_size}&`;
|
||||||
|
if (filterSubsidiaries) {
|
||||||
|
filterStr += `subsidiary=${filterSubsidiaries}&`;
|
||||||
|
}
|
||||||
|
if (filterReviewState) {
|
||||||
|
filterStr += `is_reviewed=${filterReviewState}&`;
|
||||||
|
}
|
||||||
|
if (filterIncludeTests) {
|
||||||
|
filterStr += `includes_test=${filterIncludeTests}&`;
|
||||||
|
}
|
||||||
|
if (startDate && endDate) {
|
||||||
|
filterStr += `start_date=${startDate}&end_date=${endDate}&`;
|
||||||
|
}
|
||||||
|
filterStr += `max_accuracy=${max_accuracy}`
|
||||||
|
const token = localStorage.getItem('sbt-token') || '';
|
||||||
|
const data = await fetch(`${baseURL}/ctel/request_list/?${filterStr}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Authorization: `${JSON.parse(token)}`,
|
||||||
|
},
|
||||||
|
}).then(async (res) => {
|
||||||
|
const data = await res.json();
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateRevisedData = async (
|
||||||
|
requestID: any,
|
||||||
|
newRevisedData: any,
|
||||||
|
) => {
|
||||||
|
// const requestID = ;
|
||||||
|
const token = localStorage.getItem('sbt-token') || '';
|
||||||
|
const result = await fetch(`${baseURL}/ctel/request/${requestID}/`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization: `${JSON.parse(token)}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
reviewed_result: newRevisedData,
|
||||||
|
}),
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
if (result.status != 200) {
|
||||||
|
throw new Error('Could not update revised data');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchRequest = async (id) => {
|
||||||
|
const token = localStorage.getItem('sbt-token') || '';
|
||||||
|
const response = await fetch(`${baseURL}/ctel/request/${id}/`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Authorization: `${JSON.parse(token)}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return await (
|
||||||
|
await response.json()
|
||||||
|
).subscription_requests[0];
|
||||||
|
};
|
49
cope2n-fe/src/pages/reviews2/const.ts
Normal file
49
cope2n-fe/src/pages/reviews2/const.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { t } from "@lingui/macro";
|
||||||
|
|
||||||
|
export const counter_measure_map = {
|
||||||
|
invalid_image: 'Remove this image from the evaluation report',
|
||||||
|
missing_information: 'Remove this image from the evaluation report',
|
||||||
|
too_blurry_text: 'Remove this image from the evaluation report',
|
||||||
|
too_small_text: 'Remove this image from the evaluation report',
|
||||||
|
ocr_cannot_extract: 'Improve OCR',
|
||||||
|
wrong_feedback: 'Update revised result and re-calculate accuracy',
|
||||||
|
handwritten: 'Remove this image from the evaluation report',
|
||||||
|
other: 'other',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const REASON_BAD_QUALITY = [
|
||||||
|
{ value: 'invalid_image', label: t`Invalid image` },
|
||||||
|
{
|
||||||
|
value: 'missing_information',
|
||||||
|
label: t`Missing information`,
|
||||||
|
},
|
||||||
|
{ value: 'too_blurry_text', label: t`Too blurry text` },
|
||||||
|
{ value: 'too_small_text', label: t`Too small text` },
|
||||||
|
{ value: 'handwritten', label: t`Handwritten` },
|
||||||
|
{ value: 'wrong_feedback', label: t`Wrong Feedback` },
|
||||||
|
{ value: 'ocr_cannot_extract', label: t`Ocr cannot extract` },
|
||||||
|
{ value: 'other', label: t`Other` },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const SOLUTION_BAD_QUALITY =[
|
||||||
|
{
|
||||||
|
value: 'Remove this image from the evaluation report',
|
||||||
|
label: t`Remove this image from the evaluation report`,
|
||||||
|
},
|
||||||
|
{ value: 'Improve OCR', label: t`Improve OCR` },
|
||||||
|
{
|
||||||
|
value: 'Update revised result and re-calculate accuracy',
|
||||||
|
label: t`Update revised result and re-calculate accuracy`,
|
||||||
|
},
|
||||||
|
{ value: 'other', label: t`Other` },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const SUBSIDIARIES = [
|
||||||
|
{ value: 'SEAO', label: 'SEAO' },
|
||||||
|
{ value: 'SEAU', label: 'SEAU' },
|
||||||
|
{ value: 'SESP', label: 'SESP' },
|
||||||
|
{ value: 'SME', label: 'SME' },
|
||||||
|
{ value: 'SEPCO', label: 'SEPCO' },
|
||||||
|
{ value: 'TSE', label: 'TSE' },
|
||||||
|
{ value: 'SEIN', label: 'SEIN' },
|
||||||
|
]
|
1009
cope2n-fe/src/pages/reviews2/index.tsx
Normal file
1009
cope2n-fe/src/pages/reviews2/index.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ const environment = process.env.NODE_ENV;
|
|||||||
const AXIOS_TIMEOUT_MS = 30 * 60 * 1000; // This config sastified long-live upload file request
|
const AXIOS_TIMEOUT_MS = 30 * 60 * 1000; // This config sastified long-live upload file request
|
||||||
const EXPIRED_PASSWORD_SIGNAL = 'expired_password';
|
const EXPIRED_PASSWORD_SIGNAL = 'expired_password';
|
||||||
|
|
||||||
export const baseURL = environment === 'development' ? 'http://107.120.133.27:9881/api' : '/api';
|
export const baseURL = environment === 'development' ? 'http://107.120.133.27:9000/api' : '/api';
|
||||||
// export const baseURL = '/api';
|
// export const baseURL = '/api';
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ const DashboardPage = React.lazy(() => import('pages/dashboard'));
|
|||||||
const InferencePage = React.lazy(() => import('pages/inference/index'));
|
const InferencePage = React.lazy(() => import('pages/inference/index'));
|
||||||
|
|
||||||
const ReviewsPage = React.lazy(() => import('pages/reviews'));
|
const ReviewsPage = React.lazy(() => import('pages/reviews'));
|
||||||
|
const ReviewsPage2 = React.lazy(() => import('pages/reviews2'));
|
||||||
const ReportsPage = React.lazy(() => import('pages/reports'));
|
const ReportsPage = React.lazy(() => import('pages/reports'));
|
||||||
const ReportDetailPage = React.lazy(
|
const ReportDetailPage = React.lazy(
|
||||||
() => import('pages/reports/report_detail'),
|
() => import('pages/reports/report_detail'),
|
||||||
@ -65,6 +66,11 @@ export function useAppRouter() {
|
|||||||
path: '/reviews',
|
path: '/reviews',
|
||||||
element: <PrivateRoute element={<ReviewsPage />} />,
|
element: <PrivateRoute element={<ReviewsPage />} />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/reviews2',
|
||||||
|
element: <PrivateRoute element={<ReviewsPage2 />} />,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/users',
|
path: '/users',
|
||||||
element: <PrivateRoute element={<UsersPage />} />,
|
element: <PrivateRoute element={<UsersPage />} />,
|
||||||
|
@ -21,6 +21,9 @@ const normalizeData = (key, value) => {
|
|||||||
if (["imei_number", "purchase_date"].includes(key) && typeof(value) === "string") {
|
if (["imei_number", "purchase_date"].includes(key) && typeof(value) === "string") {
|
||||||
value = value.split(",");
|
value = value.split(",");
|
||||||
}
|
}
|
||||||
|
if(key === 'imei_number' && value === null){
|
||||||
|
value = [null]
|
||||||
|
}
|
||||||
if (typeof (value) === "object" && value?.length > 0) {
|
if (typeof (value) === "object" && value?.length > 0) {
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
value[i] = normalizeData("text", value[i]);
|
value[i] = normalizeData("text", value[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user