mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
refactor(FE-316): Use real data and formatting in uniformity results
This commit is contained in:
@@ -15,6 +15,7 @@ import toast from 'react-hot-toast';
|
|||||||
import { UniformityApi } from '@/services/api/uniformity';
|
import { UniformityApi } from '@/services/api/uniformity';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
import Badge from '@/components/Badge';
|
import Badge from '@/components/Badge';
|
||||||
|
import { formatNumber } from '@/lib/helper';
|
||||||
|
|
||||||
const weightStatusColorMap: Record<string, string> = {
|
const weightStatusColorMap: Record<string, string> = {
|
||||||
ideal: 'bg-[#00D39033]',
|
ideal: 'bg-[#00D39033]',
|
||||||
@@ -126,26 +127,28 @@ const UniformityResultForm = () => {
|
|||||||
const samplingTableData: SamplingData[] = useMemo(() => {
|
const samplingTableData: SamplingData[] = useMemo(() => {
|
||||||
if (!verifyUniformityResult) return [];
|
if (!verifyUniformityResult) return [];
|
||||||
|
|
||||||
|
const { sampling } = verifyUniformityResult;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: 'sampling-size',
|
id: 'sampling-size',
|
||||||
label: 'Sampling size',
|
label: 'Sampling size',
|
||||||
value: `1,150 of Birds`,
|
value: `${formatNumber(sampling.chick_qty_of_weight)} of Birds`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'mean-weight',
|
id: 'mean-weight',
|
||||||
label: 'Mean Weight',
|
label: 'Mean Weight',
|
||||||
value: `121 g`,
|
value: `${sampling.mean_weight} g`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'min-limit',
|
id: 'min-limit',
|
||||||
label: 'Min Limit (-10%)',
|
label: 'Min Limit (-10%)',
|
||||||
value: `109 g`,
|
value: `${sampling.mean_down} g`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'max-limit',
|
id: 'max-limit',
|
||||||
label: 'Max Limit (+10%)',
|
label: 'Max Limit (+10%)',
|
||||||
value: `133 g`,
|
value: `${sampling.mean_up} g`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, [verifyUniformityResult]);
|
}, [verifyUniformityResult]);
|
||||||
@@ -169,21 +172,23 @@ const UniformityResultForm = () => {
|
|||||||
const resultTableData: ResultData[] = useMemo(() => {
|
const resultTableData: ResultData[] = useMemo(() => {
|
||||||
if (!verifyUniformityResult) return [];
|
if (!verifyUniformityResult) return [];
|
||||||
|
|
||||||
|
const { result } = verifyUniformityResult;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: 'ideal-birds',
|
id: 'ideal-birds',
|
||||||
label: 'Ideal Birds',
|
label: 'Ideal Birds',
|
||||||
value: `851 of Birds`,
|
value: `${formatNumber(result.uniform_qty)} of Birds`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'outside-range',
|
id: 'outside-range',
|
||||||
label: 'Outside Range',
|
label: 'Outside Range',
|
||||||
value: `299 of Birds`,
|
value: `${formatNumber(result.outside_qty)} of Birds`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'uniformity',
|
id: 'uniformity',
|
||||||
label: 'Uniformity',
|
label: 'Uniformity',
|
||||||
value: `74 %`,
|
value: `${result.uniformity} %`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, [verifyUniformityResult]);
|
}, [verifyUniformityResult]);
|
||||||
@@ -250,11 +255,12 @@ const UniformityResultForm = () => {
|
|||||||
statusIndicator={true}
|
statusIndicator={true}
|
||||||
variant='soft'
|
variant='soft'
|
||||||
className={{
|
className={{
|
||||||
badge: `rounded-xl w-full justify-start border border-gray-200 text-black bg-[#00D39033]`,
|
badge:
|
||||||
status: 'bg-[#008000]',
|
'rounded-xl w-full justify-start border border-gray-200 text-black bg-info/10',
|
||||||
|
status: 'bg-info',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Ideal
|
Unknown
|
||||||
</Badge>
|
</Badge>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user