Merge pull request #161 from SDSRV-IDP/feature/add_filter_review2

Feature/add filter review2
This commit is contained in:
Đỗ Xuân Tân 2024-12-03 16:54:56 +07:00 committed by GitHub Enterprise
commit bd703c6eb5
6 changed files with 126 additions and 10 deletions

View File

@ -70,5 +70,9 @@
"You are only allowed to upload {0} file.": "You are only allowed to upload {0} file.",
"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.",
"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 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.": "",
"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';
export const fetchAllRequests = async (
filterDateRange,
filterSubsidiaries,
filterReviewState,
filterIncludeTests,
filterDateRange: any[],
filterSubsidiaries: string,
filterReviewState: string,
filterIncludeTests: string,
filterDoctype: string,
filterFeedbackResult: string,
filterPredictResult: string,
filterReviewedResult: string,
page = 1,
page_size = 20,
max_accuracy = 100,
@ -25,6 +29,20 @@ export const fetchAllRequests = async (
if (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) {
filterStr += `start_date=${startDate}&end_date=${endDate}&`;
}
@ -54,7 +72,7 @@ export const confirmRequest = async (requestID: any) => {
body: JSON.stringify({ request_file_results: [] }),
})
};
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 response = await fetch(`${baseURL}/ctel/request/${id}/`, {
method: 'GET',

View File

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

View File

@ -41,6 +41,7 @@ import {
} from './api';
import {
counter_measure_map,
DOCTYPE,
FEEDBACK_ACCURACY,
FEEDBACK_RESULT,
PREDICTED_RESULT,
@ -71,6 +72,10 @@ const ReviewPage = () => {
const [filterAccuracy, setFilterAccuracy] = useState(100);
const [filterReviewState, setFilterReviewState] = useState('all');
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 [currentRequest, setCurrentRequest] = useState(null);
const [currentRequestIndex, setCurrentRequestIndex] = useState(1);
@ -109,6 +114,10 @@ const ReviewPage = () => {
filterSubsidiaries,
filterReviewState,
filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
1,
1,
filterAccuracy,
@ -218,6 +227,10 @@ const ReviewPage = () => {
filterSubsidiaries,
filterReviewState,
filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
requestIndex,
1,
filterAccuracy,
@ -273,6 +286,10 @@ const ReviewPage = () => {
filterSubsidiaries,
filterReviewState,
filterIncludeTests,
filterDoctype,
filterFeedbackResult,
filterPredictResult,
filterReviewedResult,
1,
1,
filterAccuracy,
@ -771,7 +788,7 @@ const ReviewPage = () => {
}
} catch (error) {}
return (
<div style={{ margin: '0 0 8px' }} className='file-input-group'>
<div style={{ margin: '0 0 8px' }} className='file-input-group' key={data}>
<div
style={{
display: 'flex',
@ -1025,6 +1042,73 @@ const ReviewPage = () => {
/>
</Form.Item>
</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>
</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 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';