Merge pull request #94 from SDSRV-IDP/fe/reviews
fix dashboard & submit bad reason review
This commit is contained in:
commit
8e18b69e0c
@ -1,7 +1,12 @@
|
|||||||
import type { TableColumnsType } from 'antd';
|
import type { TableColumnsType } from 'antd';
|
||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ensureMax, ensureMin, formatPercent, formatNumber } from 'utils/metric-format';
|
import {
|
||||||
|
ensureMax,
|
||||||
|
ensureMin,
|
||||||
|
formatNumber,
|
||||||
|
formatPercent,
|
||||||
|
} from 'utils/metric-format';
|
||||||
|
|
||||||
interface DataType {
|
interface DataType {
|
||||||
key: React.Key;
|
key: React.Key;
|
||||||
@ -18,8 +23,7 @@ interface DataType {
|
|||||||
purchaseDateAAR: number;
|
purchaseDateAAR: number;
|
||||||
retailerNameAAR: number;
|
retailerNameAAR: number;
|
||||||
invoiceNumberAAR: number;
|
invoiceNumberAAR: number;
|
||||||
snImeiAPT: number; // APT: Average Processing Time
|
avgAPT: number; // APT: Average Processing Time
|
||||||
invoiceAPT: number;
|
|
||||||
snImeiTC: number; // TC: transaction count
|
snImeiTC: number; // TC: transaction count
|
||||||
invoiceTC: number;
|
invoiceTC: number;
|
||||||
reviewProgress: number;
|
reviewProgress: number;
|
||||||
@ -230,35 +234,17 @@ const columns: TableColumnsType<DataType> = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Average Processing Time Per Image (Seconds)',
|
title: 'Average Processing Time Per Image (Seconds)',
|
||||||
children: [
|
dataIndex: 'avgAPT',
|
||||||
{
|
key: 'avgAPT',
|
||||||
title: 'SN/IMEI',
|
|
||||||
dataIndex: 'snImeiAPT',
|
|
||||||
key: 'snImeiAPT',
|
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
const isAbnormal = ensureMax(record.snImeiAPT, 2);
|
const isAbnormal = ensureMax(record.avgAPT, 2);
|
||||||
return (
|
return (
|
||||||
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
||||||
{formatNumber(record?.snImeiAPT)}
|
{formatNumber(record?.avgAPT)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Invoice',
|
|
||||||
dataIndex: 'invoiceAPT',
|
|
||||||
key: 'invoiceAPT',
|
|
||||||
render: (_, record) => {
|
|
||||||
const isAbnormal = ensureMax(record.invoiceAPT, 2);
|
|
||||||
return (
|
|
||||||
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
|
||||||
{formatNumber(record?.invoiceAPT)}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Review Progress',
|
title: 'Review Progress',
|
||||||
dataIndex: 'review_progress',
|
dataIndex: 'review_progress',
|
||||||
@ -267,7 +253,9 @@ const columns: TableColumnsType<DataType> = [
|
|||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{formatPercent(record.reviewProgress) === '-' ? 0 : formatPercent(record.reviewProgress)}
|
{formatPercent(record.reviewProgress) === '-'
|
||||||
|
? 0
|
||||||
|
: formatPercent(record.reviewProgress)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -301,11 +289,10 @@ const ReportOverViewTable: React.FC<ReportOverViewTableProps> = ({
|
|||||||
purchaseDateAAR: item.average_accuracy_rate.purchase_date,
|
purchaseDateAAR: item.average_accuracy_rate.purchase_date,
|
||||||
retailerNameAAR: item.average_accuracy_rate.retailername,
|
retailerNameAAR: item.average_accuracy_rate.retailername,
|
||||||
invoiceNumberAAR: item.average_accuracy_rate.invoice_no,
|
invoiceNumberAAR: item.average_accuracy_rate.invoice_no,
|
||||||
snImeiAPT: item.average_processing_time.imei,
|
avgAPT: item.average_processing_time.avg,
|
||||||
invoiceAPT: item.average_processing_time.invoice,
|
|
||||||
snImeiTC: item.usage.imei,
|
snImeiTC: item.usage.imei,
|
||||||
invoiceTC: item.usage.invoice,
|
invoiceTC: item.usage.invoice,
|
||||||
reviewProgress:item.review_progress,
|
reviewProgress: item.review_progress,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1 +1,2 @@
|
|||||||
|
export * from './reviews';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
|
32
cope2n-fe/src/request/reviews.ts
Normal file
32
cope2n-fe/src/request/reviews.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { notification } from 'antd';
|
||||||
|
import { API } from './api';
|
||||||
|
|
||||||
|
type badQualityReasonSubmitParams = {
|
||||||
|
request_id: string;
|
||||||
|
request_image_id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function badQualityReasonSubmit(
|
||||||
|
params: badQualityReasonSubmitParams,
|
||||||
|
reason: string,
|
||||||
|
) {
|
||||||
|
const data = { reason };
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await API.post<{ message: string }>(
|
||||||
|
`/ctel/request_image/${params.request_id}/${params.request_image_id}/`,
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
notification.error({
|
||||||
|
message: `${error?.message}`,
|
||||||
|
});
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user