[yagin] add 4 more filter for review2

This commit is contained in:
yagin 2024-12-03 16:18:20 +07:00
parent 3b6b7f9a30
commit 87634b3d3f
6 changed files with 125 additions and 9 deletions

View File

@ -70,5 +70,9 @@
"You are only allowed to upload {0} file.": "You are only allowed to upload {0} file.", "You are only allowed to upload {0} file.": "You are only allowed to upload {0} file.",
"You have unsaved changes!": "You have unsaved changes!", "You have unsaved changes!": "You have unsaved changes!",
"Your current password has expired. Please change your password to continue.": "Your current password has expired. Please change your password to continue.", "Your current password has expired. Please change your password to continue.": "Your current password has expired. Please change your password to continue.",
"max_accuracy": "Max accuracy" "max_accuracy": "Max accuracy",
"docType": "Only type",
"Feedback Result": "Feedback Result",
"Predict Result": "Predict Result",
"Reviewed Result": "Reviewed Result"
} }

View File

@ -70,5 +70,9 @@
"You are only allowed to upload {0} file.": "Bạn chỉ được phép tải lên {0}.", "You are only allowed to upload {0} file.": "Bạn chỉ được phép tải lên {0}.",
"You have unsaved changes!": "Bạn có những thay đổi chưa được lưu!", "You have unsaved changes!": "Bạn có những thay đổi chưa được lưu!",
"Your current password has expired. Please change your password to continue.": "", "Your current password has expired. Please change your password to continue.": "",
"max_accuracy": "Độ chính xác tối đa" "max_accuracy": "Độ chính xác tối đa",
"DocType": "Kiểu tài liệu",
"Feedback Result": "",
"Predict Result": "",
"Reviewed Result": ""
} }

View File

@ -2,10 +2,14 @@ import { baseURL } from 'request/api';
import { RecentRequest } from './const'; import { RecentRequest } from './const';
export const fetchAllRequests = async ( export const fetchAllRequests = async (
filterDateRange, filterDateRange: any[],
filterSubsidiaries, filterSubsidiaries: string,
filterReviewState, filterReviewState: string,
filterIncludeTests, filterIncludeTests: string,
filterDoctype: string,
filterFeedbackResult: string,
filterPredictResult: string,
filterReviewedResult: string,
page = 1, page = 1,
page_size = 20, page_size = 20,
max_accuracy = 100, max_accuracy = 100,
@ -25,6 +29,20 @@ export const fetchAllRequests = async (
if (filterIncludeTests) { if (filterIncludeTests) {
filterStr += `includes_test=${filterIncludeTests}&`; filterStr += `includes_test=${filterIncludeTests}&`;
} }
// add 4 more field
if (filterDoctype) {
filterStr += `doc_type=${filterDoctype}&`;
}
if (filterFeedbackResult) {
filterStr += `feedback_result=${filterFeedbackResult}&`;
}
if (filterPredictResult) {
filterStr += `predict_result=${filterPredictResult}&`;
}
if (filterReviewedResult) {
filterStr += `reviewed_result=${filterReviewedResult}&`;
}
//
if (startDate && endDate) { if (startDate && endDate) {
filterStr += `start_date=${startDate}&end_date=${endDate}&`; filterStr += `start_date=${startDate}&end_date=${endDate}&`;
} }
@ -54,7 +72,7 @@ export const confirmRequest = async (requestID: any) => {
body: JSON.stringify({ request_file_results: [] }), body: JSON.stringify({ request_file_results: [] }),
}) })
}; };
export const updateRevisedDataByFile = async ( export const updateRevisedDataByFile = async (
@ -77,7 +95,7 @@ export const updateRevisedDataByFile = async (
) )
}; };
export const fetchRequest = async (id) => { export const fetchRequest = async (id: string) => {
const token = localStorage.getItem('sbt-token') || ''; const token = localStorage.getItem('sbt-token') || '';
const response = await fetch(`${baseURL}/ctel/request/${id}/`, { const response = await fetch(`${baseURL}/ctel/request/${id}/`, {
method: 'GET', method: 'GET',

View File

@ -48,6 +48,12 @@ export const SUBSIDIARIES = [
{ value: 'SEIN', label: 'SEIN' }, { value: 'SEIN', label: 'SEIN' },
]; ];
export const DOCTYPE = [
{ value: null, label: '--' },
{ value: 'imei', label: 'imei' },
{ value: 'invoice', label: 'invoice' },
];
export const SOURCE_KEYS = [ export const SOURCE_KEYS = [
'retailername', 'retailername',
'sold_to_party', 'sold_to_party',

View File

@ -41,6 +41,7 @@ import {
} from './api'; } from './api';
import { import {
counter_measure_map, counter_measure_map,
DOCTYPE,
FEEDBACK_ACCURACY, FEEDBACK_ACCURACY,
FEEDBACK_RESULT, FEEDBACK_RESULT,
PREDICTED_RESULT, PREDICTED_RESULT,
@ -71,6 +72,10 @@ const ReviewPage = () => {
const [filterAccuracy, setFilterAccuracy] = useState(100); const [filterAccuracy, setFilterAccuracy] = useState(100);
const [filterReviewState, setFilterReviewState] = useState('all'); const [filterReviewState, setFilterReviewState] = useState('all');
const [filterIncludeTests, setFilterIncludesTests] = useState('true'); const [filterIncludeTests, setFilterIncludesTests] = useState('true');
const [filterDoctype, setFilterDoctype] = useState(null);
const [filterFeedbackResult, setFilterFeedbackResult] = useState('');
const [filterPredictResult, setFilterPredictResult] = useState('');
const [filterReviewedResult, setFilterReviewedResult] = useState('');
// const [requests, setRequests] = useState([]); // const [requests, setRequests] = useState([]);
const [currentRequest, setCurrentRequest] = useState(null); const [currentRequest, setCurrentRequest] = useState(null);
const [currentRequestIndex, setCurrentRequestIndex] = useState(1); const [currentRequestIndex, setCurrentRequestIndex] = useState(1);
@ -109,6 +114,10 @@ const ReviewPage = () => {
filterSubsidiaries, filterSubsidiaries,
filterReviewState, filterReviewState,
filterIncludeTests, filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
1, 1,
1, 1,
filterAccuracy, filterAccuracy,
@ -218,6 +227,10 @@ const ReviewPage = () => {
filterSubsidiaries, filterSubsidiaries,
filterReviewState, filterReviewState,
filterIncludeTests, filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
requestIndex, requestIndex,
1, 1,
filterAccuracy, filterAccuracy,
@ -273,6 +286,10 @@ const ReviewPage = () => {
filterSubsidiaries, filterSubsidiaries,
filterReviewState, filterReviewState,
filterIncludeTests, filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
1, 1,
1, 1,
filterAccuracy, filterAccuracy,
@ -1025,6 +1042,73 @@ const ReviewPage = () => {
/> />
</Form.Item> </Form.Item>
</div> </div>
{/* add 4 more filter fields */}
<div
style={{
marginTop: 10,
display: 'flex',
justifyContent: 'space-between',
marginLeft: 0,
padding: 0,
}}
>
<Form.Item
name='doc_type'
label={t`Only type`}
rules={[
{
required: true,
message: 'Please select a document type',
},
]}
>
<Select
placeholder='Select a document type'
style={{ width: 200 }}
options={DOCTYPE}
value={filterDoctype}
defaultValue={filterDoctype}
onChange={setFilterDoctype}
/>
</Form.Item>
<Form.Item
name='feedback_result'
label={t`Feedback includes`}
>
<Input
defaultValue={filterFeedbackResult}
onChange={(e) => setFilterFeedbackResult(e.target.value)}
/>
</Form.Item>
</div>
<div
style={{
marginTop: 10,
display: 'flex',
justifyContent: 'space-between',
marginLeft: 0,
padding: 0,
}}
>
<Form.Item
name='predict_result'
label={t`Predict includes`}
>
<Input
defaultValue={filterPredictResult}
onChange={(e) => setFilterPredictResult(e.target.value)}
/>
</Form.Item>
<Form.Item
name='reviewed_result'
label={t`Review inculdes`}
>
<Input
defaultValue={filterReviewedResult}
onChange={(e) => setFilterReviewedResult(e.target.value)}
/>
</Form.Item>
</div>
</Form> </Form>
</Modal> </Modal>
<Modal <Modal

View File

@ -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:19001/api' : '/api';
// export const baseURL = '/api'; // export const baseURL = '/api';