diff --git a/cope2n-fe/src/locales/en/messages.json b/cope2n-fe/src/locales/en/messages.json index 14c51d8..47da522 100644 --- a/cope2n-fe/src/locales/en/messages.json +++ b/cope2n-fe/src/locales/en/messages.json @@ -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" } diff --git a/cope2n-fe/src/locales/vi/messages.json b/cope2n-fe/src/locales/vi/messages.json index 664a5da..924a65a 100644 --- a/cope2n-fe/src/locales/vi/messages.json +++ b/cope2n-fe/src/locales/vi/messages.json @@ -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": "" } diff --git a/cope2n-fe/src/pages/reviews2/api.ts b/cope2n-fe/src/pages/reviews2/api.ts index 3e08ee2..c008266 100644 --- a/cope2n-fe/src/pages/reviews2/api.ts +++ b/cope2n-fe/src/pages/reviews2/api.ts @@ -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', diff --git a/cope2n-fe/src/pages/reviews2/const.ts b/cope2n-fe/src/pages/reviews2/const.ts index 86592c7..7c883dc 100644 --- a/cope2n-fe/src/pages/reviews2/const.ts +++ b/cope2n-fe/src/pages/reviews2/const.ts @@ -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', diff --git a/cope2n-fe/src/pages/reviews2/index.tsx b/cope2n-fe/src/pages/reviews2/index.tsx index 2f73edb..f38b0d2 100644 --- a/cope2n-fe/src/pages/reviews2/index.tsx +++ b/cope2n-fe/src/pages/reviews2/index.tsx @@ -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, @@ -1025,6 +1042,73 @@ const ReviewPage = () => { /> + {/* add 4 more filter fields */} +
+ + setFilterFeedbackResult(e.target.value)} + /> + +
+
+ + setFilterPredictResult(e.target.value)} + /> + + + setFilterReviewedResult(e.target.value)} + /> + +