fix imei number space
This commit is contained in:
parent
04c1551204
commit
1f0027c4c5
@ -1,5 +1,5 @@
|
||||
import { DownloadOutlined } from "@ant-design/icons";
|
||||
import { Button } from "antd";
|
||||
import { DownloadOutlined } from '@ant-design/icons';
|
||||
import { Button } from 'antd';
|
||||
|
||||
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||
const fileName = file['File Name'];
|
||||
@ -10,10 +10,8 @@ const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||
border: '1px solid #ccc',
|
||||
backgroundColor: isSelected ? '#d4ecff' : '#fff',
|
||||
padding: '4px 8px',
|
||||
marginRight: '4px',
|
||||
position: 'relative',
|
||||
height: '100px',
|
||||
cursor: 'pointer'
|
||||
margin: '0 0 4px',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
onClick={onClick}
|
||||
>
|
||||
@ -23,8 +21,8 @@ const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||
fontSize: '12px',
|
||||
color: '#333',
|
||||
fontWeight: 'bold',
|
||||
padding: '4px 8px',
|
||||
cursor: 'default',
|
||||
margin: '4px',
|
||||
}}
|
||||
>
|
||||
{file['Doc Type'].toUpperCase()}
|
||||
@ -45,7 +43,9 @@ const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex'
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
|
@ -22,7 +22,7 @@ import {
|
||||
Spin,
|
||||
Tag,
|
||||
} from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import Lightbox from 'react-awesome-lightbox';
|
||||
import 'react-awesome-lightbox/build/style.css';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
@ -41,14 +41,6 @@ import {
|
||||
} from './const';
|
||||
import FileCard from './FileCard';
|
||||
|
||||
const siderStyle: React.CSSProperties = {
|
||||
backgroundColor: '#fafafa',
|
||||
padding: 10,
|
||||
flexBasis: 400,
|
||||
flexShrink: 0,
|
||||
};
|
||||
// type EditableTableProps = Parameters<typeof Table>[0];
|
||||
|
||||
const ReviewPage = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [fullscreen, setFullscreen] = useState(false);
|
||||
@ -78,6 +70,7 @@ const ReviewPage = () => {
|
||||
const [otherReason, setOtherReason] = useState('');
|
||||
const [solution, setSolution] = useState('');
|
||||
const [otherSolution, setOtherSolution] = useState('');
|
||||
const [imageLoading, setImageLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (reason) {
|
||||
@ -89,6 +82,7 @@ const ReviewPage = () => {
|
||||
setSelectedFileId(index);
|
||||
if (!requestData['Files'][index]) {
|
||||
setSelectedFileData('FAILED_TO_LOAD_FILE');
|
||||
setImageLoading(false);
|
||||
return;
|
||||
}
|
||||
const fileName = requestData['Files'][index]['File Name'];
|
||||
@ -101,12 +95,14 @@ const ReviewPage = () => {
|
||||
console.log('URL: ' + fileURL);
|
||||
} else {
|
||||
setSelectedFileData('FAILED_TO_LOAD_FILE');
|
||||
setImageLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
console.log(dataSource);
|
||||
const loadCurrentRequest = (requestIndex) => {
|
||||
setLoading(true);
|
||||
setImageLoading(true);
|
||||
fetchAllRequests(
|
||||
filterDateRange,
|
||||
filterSubsidiaries,
|
||||
@ -145,7 +141,6 @@ const ReviewPage = () => {
|
||||
tableRows.push(instance);
|
||||
}
|
||||
setDataSource(tableRows);
|
||||
setLoading(false);
|
||||
setAndLoadSelectedFile(data, 0);
|
||||
})
|
||||
.finally(() => {
|
||||
@ -411,14 +406,12 @@ const ReviewPage = () => {
|
||||
height: fullscreen ? 'calc(100% - 32px)' : 'calc(100% - 32px)',
|
||||
maxWidth: '100%',
|
||||
display: 'flex',
|
||||
background: '#efefef',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
color: '#fff',
|
||||
backgroundColor: '#efefef',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexBasis: '200px',
|
||||
@ -434,7 +427,7 @@ const ReviewPage = () => {
|
||||
flexDirection: 'column',
|
||||
alignItems: 'start',
|
||||
flexGrow: 0,
|
||||
padding: '0 4px',
|
||||
padding: '0',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
@ -459,6 +452,7 @@ const ReviewPage = () => {
|
||||
isSelected={index === selectedFileId}
|
||||
onClick={() => {
|
||||
setAndLoadSelectedFile(currentRequest, index);
|
||||
setImageLoading(true);
|
||||
}}
|
||||
setIsReasonModalOpen={setIsReasonModalOpen}
|
||||
/>
|
||||
@ -478,14 +472,14 @@ const ReviewPage = () => {
|
||||
<b>Request ID</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={currentRequest ? currentRequest.RequestID : ''}
|
||||
/>
|
||||
<b>Redemption</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={
|
||||
currentRequest?.RedemptionID
|
||||
@ -493,17 +487,17 @@ const ReviewPage = () => {
|
||||
: ''
|
||||
}
|
||||
/>
|
||||
<b>Uploaded date</b>
|
||||
<b>Created date</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={currentRequest ? currentRequest.created_at : ''}
|
||||
/>
|
||||
<b>Request time</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={
|
||||
currentRequest
|
||||
@ -514,7 +508,7 @@ const ReviewPage = () => {
|
||||
<b>Processing time</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={
|
||||
currentRequest
|
||||
@ -525,7 +519,7 @@ const ReviewPage = () => {
|
||||
<b>Raw accuracy</b>
|
||||
<Input
|
||||
size='small'
|
||||
style={{ margin: '4px 0px 6px' }}
|
||||
style={{ margin: '2px 0px 4px' }}
|
||||
readOnly
|
||||
value={currentRequest ? currentRequest['raw_accuracy'] : ''}
|
||||
/>
|
||||
@ -536,13 +530,14 @@ const ReviewPage = () => {
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
borderLeft: '1px solid #ccc',
|
||||
// borderLeft: '1px solid #ccc',
|
||||
height: '100%',
|
||||
// width: '300px',
|
||||
flexGrow: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
position: 'relative',
|
||||
padding: '0 16px',
|
||||
// overflow: 'auto'
|
||||
}}
|
||||
>
|
||||
@ -551,9 +546,9 @@ const ReviewPage = () => {
|
||||
flexGrow: 1,
|
||||
textAlign: 'center',
|
||||
overflow: 'auto',
|
||||
padding: '4px',
|
||||
}}
|
||||
>
|
||||
<Spin spinning={imageLoading}>
|
||||
{selectedFileData === 'FAILED_TO_LOAD_FILE' ? (
|
||||
<p style={{ color: '#333' }}>Failed to load file.</p>
|
||||
) : fileExtension === 'pdf' ? (
|
||||
@ -571,6 +566,9 @@ const ReviewPage = () => {
|
||||
src={selectedFileData}
|
||||
alt='file'
|
||||
onClick={() => setLightBox(true)}
|
||||
onLoad={() => {
|
||||
setImageLoading(false);
|
||||
}}
|
||||
/>
|
||||
|
||||
{lightBox && (
|
||||
@ -581,6 +579,7 @@ const ReviewPage = () => {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
@ -588,6 +587,7 @@ const ReviewPage = () => {
|
||||
flexGrow: 0,
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
margin: '8px 0 0',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
@ -596,7 +596,6 @@ const ReviewPage = () => {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
margin: '8px 0 4px',
|
||||
}}
|
||||
>
|
||||
<h3 style={{ margin: '0 8px ' }}>
|
||||
@ -688,18 +687,33 @@ const ReviewPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style={siderStyle}>
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
// backgroundColor: '#fafafa',
|
||||
padding: 8,
|
||||
flexBasis: 400,
|
||||
flexShrink: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
<div style={{ flexGrow: 1 }}>
|
||||
{dataSource?.map((data) => {
|
||||
return (
|
||||
<div style={{ margin: '0 0 8px' }}>
|
||||
<div style={{ display: 'flex', justifyContent: "space-between", alignItems: "center", margin: '0 0 4px' }}>
|
||||
<p style={{ fontWeight: 'bold', margin: 0 }}>
|
||||
{data.key}
|
||||
</p>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
margin: '0 0 4px',
|
||||
}}
|
||||
>
|
||||
<p style={{ fontWeight: 'bold', margin: 0 }}>{data.key}</p>
|
||||
<Button
|
||||
shape='round'
|
||||
type="primary" ghost
|
||||
type='primary'
|
||||
ghost
|
||||
icon={<CopyOutlined />}
|
||||
size='small'
|
||||
/>
|
||||
@ -725,6 +739,9 @@ const ReviewPage = () => {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Button type='primary' shape='round' size='middle' style={{width: '120px', alignSelf: 'flex-end'}}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Modal
|
||||
|
@ -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:9000/api' : '/api';
|
||||
// export const baseURL = '/api';
|
||||
|
||||
|
||||
|
@ -21,6 +21,9 @@ const normalizeData = (key, value) => {
|
||||
if (["imei_number", "purchase_date"].includes(key) && typeof(value) === "string") {
|
||||
value = value.split(",");
|
||||
}
|
||||
if(key === 'imei_number' && value === null){
|
||||
value = [null]
|
||||
}
|
||||
if (typeof (value) === "object" && value?.length > 0) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
value[i] = normalizeData("text", value[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user