Show data fields
This commit is contained in:
parent
15a550ae36
commit
efd2da3a82
@ -40,49 +40,6 @@ const StyledEditOutlined = styled(EditOutlined)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const dataSource = [
|
|
||||||
{
|
|
||||||
key: 'retailer_name',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '2',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '3',
|
|
||||||
value: 'Mike',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: 'Key',
|
title: 'Key',
|
||||||
@ -101,18 +58,18 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Predicted',
|
title: 'Predicted',
|
||||||
dataIndex: 'value',
|
dataIndex: 'predicted',
|
||||||
key: 'value',
|
key: 'predicted',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Submitted',
|
title: 'Submitted',
|
||||||
dataIndex: 'value',
|
dataIndex: 'submitted',
|
||||||
key: 'value',
|
key: 'submitted',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Revised',
|
title: 'Revised',
|
||||||
dataIndex: 'value',
|
dataIndex: 'revised',
|
||||||
key: 'value',
|
key: 'revised',
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
@ -120,11 +77,16 @@ const columns = [
|
|||||||
lineHeight: '2',
|
lineHeight: '2',
|
||||||
}}>
|
}}>
|
||||||
{text}
|
{text}
|
||||||
<StyledEditOutlined />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Action',
|
||||||
|
key: 'operation',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 100,
|
||||||
|
render: () => <a><StyledEditOutlined /></a>,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -161,7 +123,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
}}>
|
}}>
|
||||||
{fileName? fileName.substring(0, 10) : fileName }
|
{fileName ? fileName.substring(0, 25).replace("temp_", "") : fileName}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
@ -177,6 +139,9 @@ const FileCard = ({ file, isSelected, onClick }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button style={{
|
<Button style={{
|
||||||
margin: '4px 2px',
|
margin: '4px 2px',
|
||||||
|
}} onClick={() => {
|
||||||
|
const downloadUrl = file["File URL"];
|
||||||
|
window.open(downloadUrl, '_blank');
|
||||||
}}>
|
}}>
|
||||||
<DownloadOutlined />
|
<DownloadOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
@ -186,9 +151,9 @@ const FileCard = ({ file, isSelected, onClick }) => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAllRequests = async (filterDateRange, filterSubsidiaries, filterReviewState, filterIncludeTests, page=1, page_size=20) => {
|
const fetchAllRequests = async (filterDateRange, filterSubsidiaries, filterReviewState, filterIncludeTests, page = 1, page_size = 20) => {
|
||||||
const startDate = (filterDateRange && filterDateRange[0]) ? filterDateRange[0].format('YYYY-MM-DD'): '';
|
const startDate = (filterDateRange && filterDateRange[0]) ? filterDateRange[0].format('YYYY-MM-DD') : '';
|
||||||
const endDate = (filterDateRange && filterDateRange[1]) ? filterDateRange[1].format('YYYY-MM-DD'): '';
|
const endDate = (filterDateRange && filterDateRange[1]) ? filterDateRange[1].format('YYYY-MM-DD') : '';
|
||||||
let filterStr = "";
|
let filterStr = "";
|
||||||
filterStr += `page=${page}&page_size=${page_size}&`;
|
filterStr += `page=${page}&page_size=${page_size}&`;
|
||||||
if (filterSubsidiaries) {
|
if (filterSubsidiaries) {
|
||||||
@ -238,7 +203,7 @@ const ReviewPage = () => {
|
|||||||
|
|
||||||
// Default date range: 1 month ago to today
|
// Default date range: 1 month ago to today
|
||||||
const [filterDateRange, setFilterDateRange] = useState([
|
const [filterDateRange, setFilterDateRange] = useState([
|
||||||
moment().subtract(1,'month'),
|
moment().subtract(1, 'month'),
|
||||||
moment(),
|
moment(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -251,6 +216,31 @@ const ReviewPage = () => {
|
|||||||
const [hasNextRequest, setHasNextRequest] = useState(true);
|
const [hasNextRequest, setHasNextRequest] = useState(true);
|
||||||
const [totalPages, setTotalPages] = useState(0);
|
const [totalPages, setTotalPages] = useState(0);
|
||||||
|
|
||||||
|
// purchase_date: "2024-01-20",
|
||||||
|
// retailername: "Test Retailer",
|
||||||
|
// sold_to_party: "Test Party",
|
||||||
|
const dataSource = [
|
||||||
|
// {
|
||||||
|
// key: "imei_number",
|
||||||
|
// predicted: "352271450941944",
|
||||||
|
// submitted: "352271450941944",
|
||||||
|
// revised: "352271450941944",
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
const predicted = (currentRequest && currentRequest["Reviewed Result"]) ? currentRequest["Reviewed Result"] : {};
|
||||||
|
const submitted = (currentRequest && currentRequest["Feedback Result"]) ? currentRequest["Feedback Result"] : {};
|
||||||
|
const revised = (currentRequest && currentRequest["Reviewed Result"]) ? currentRequest["Reviewed Result"] : {};
|
||||||
|
const keys = Object.keys(predicted);
|
||||||
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
let instance = {};
|
||||||
|
instance["key"] = keys[i];
|
||||||
|
instance["predicted"] = predicted[keys[i]];
|
||||||
|
instance["submitted"] = submitted[keys[i]];
|
||||||
|
instance["revised"] = revised[keys[i]];
|
||||||
|
dataSource.push(instance);
|
||||||
|
}
|
||||||
|
|
||||||
const gotoNextRequest = () => {
|
const gotoNextRequest = () => {
|
||||||
const nextRequestIndex = currentRequestIndex + 1;
|
const nextRequestIndex = currentRequestIndex + 1;
|
||||||
setCurrentRequestIndex(nextRequestIndex);
|
setCurrentRequestIndex(nextRequestIndex);
|
||||||
@ -328,12 +318,15 @@ const ReviewPage = () => {
|
|||||||
} : {
|
} : {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
}}>
|
}}>
|
||||||
<Button onClick={() => {
|
<div>
|
||||||
setFullscreen(!fullscreen);
|
<Button onClick={() => {
|
||||||
}}>
|
setFullscreen(!fullscreen);
|
||||||
{fullscreen ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
}}>
|
||||||
{fullscreen ? 'Exit Fullscreen' : 'Enter Fullscreen'}
|
{fullscreen ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
||||||
</Button>
|
{fullscreen ? 'Exit Fullscreen' : 'Enter Fullscreen'}
|
||||||
|
</Button>
|
||||||
|
<b>Request ID:</b> {currentRequest?.RequestID}
|
||||||
|
</div>
|
||||||
<Layout style={{
|
<Layout style={{
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@ -409,7 +402,7 @@ const ReviewPage = () => {
|
|||||||
</Space.Compact>
|
</Space.Compact>
|
||||||
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: 8 }}>
|
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: 8 }}>
|
||||||
<div>
|
<div>
|
||||||
<Button type="default"
|
<Button type="default" style={{height: 38}}
|
||||||
disabled={currentRequestIndex === 1}
|
disabled={currentRequestIndex === 1}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
gotoPreviousRequest();
|
gotoPreviousRequest();
|
||||||
@ -418,7 +411,7 @@ const ReviewPage = () => {
|
|||||||
<ArrowLeftOutlined />
|
<ArrowLeftOutlined />
|
||||||
Previous
|
Previous
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default"
|
<Button type="default" style={{height: 38}}
|
||||||
disabled={!hasNextRequest}
|
disabled={!hasNextRequest}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!hasNextRequest) {
|
if (!hasNextRequest) {
|
||||||
@ -430,14 +423,16 @@ const ReviewPage = () => {
|
|||||||
Next
|
Next
|
||||||
<ArrowRightOutlined />
|
<ArrowRightOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default">
|
<Input size='middle' addonBefore="To" style={{ marginBottom: "4px", marginLeft: "4px", width: 180 }} defaultValue={currentRequestIndex} addonAfter={
|
||||||
Go to
|
<Button type="default">
|
||||||
</Button>
|
Go to
|
||||||
|
</Button>
|
||||||
|
} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 style={{ margin: "20px 0 10px 0" }}>{totalPages ? ("Request: " + currentRequestIndex + "/" + totalPages) : "No Request. Adjust your search criteria to see more results."}</h2>
|
<h2 style={{ margin: "20px 0 10px 0" }}>{totalPages ? ("Request: " + currentRequestIndex + "/" + totalPages) : "No Request. Adjust your search criteria to see more results."}</h2>
|
||||||
<Input size='small' addonBefore="Request ID" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest.RequestID : ""} />
|
<Input size='small' addonBefore="Request ID" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest.RequestID : ""} />
|
||||||
<Input size='small' addonBefore="Redemption" style={{ marginBottom: "4px" }} readOnly value={currentRequest?.RedemptionID ? currentRequest.RedemptionID : "<Unknown>"} />
|
<Input size='small' addonBefore="Redemption" style={{ marginBottom: "4px" }} readOnly value={currentRequest?.RedemptionID ? currentRequest.RedemptionID : ""} />
|
||||||
<Input size='small' addonBefore="Uploaded date" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest.created_at : ""} />
|
<Input size='small' addonBefore="Uploaded date" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest.created_at : ""} />
|
||||||
<Input size='small' addonBefore="Request time" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest["Client Request Time (ms)"] : ""} />
|
<Input size='small' addonBefore="Request time" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest["Client Request Time (ms)"] : ""} />
|
||||||
<Input size='small' addonBefore="Processing time" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest["Server Processing Time (ms)"] : ""} />
|
<Input size='small' addonBefore="Processing time" style={{ marginBottom: "4px" }} readOnly value={currentRequest ? currentRequest["Server Processing Time (ms)"] : ""} />
|
||||||
|
Loading…
Reference in New Issue
Block a user