fix: points not updating while editing estimate (#935)

This commit is contained in:
Aaryan Khandelwal 2023-04-23 00:00:46 +05:30 committed by GitHub
parent 169a60723b
commit 8eddc4b304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 26 deletions

View File

@ -184,32 +184,65 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
name: formData.name,
description: formData.description,
},
estimate_points: [
{
key: 0,
value: formData.value1,
},
{
key: 1,
value: formData.value2,
},
{
key: 2,
value: formData.value3,
},
{
key: 3,
value: formData.value4,
},
{
key: 4,
value: formData.value5,
},
{
key: 5,
value: formData.value6,
},
],
estimate_points: data
? [
{
id: data.points[0].id,
key: 0,
value: formData.value1,
},
{
id: data.points[1].id,
key: 1,
value: formData.value2,
},
{
id: data.points[2].id,
key: 2,
value: formData.value3,
},
{
id: data.points[3].id,
key: 3,
value: formData.value4,
},
{
id: data.points[4].id,
key: 4,
value: formData.value5,
},
{
id: data.points[5].id,
key: 5,
value: formData.value6,
},
]
: [
{
key: 0,
value: formData.value1,
},
{
key: 1,
value: formData.value2,
},
{
key: 2,
value: formData.value3,
},
{
key: 3,
value: formData.value4,
},
{
key: 4,
value: formData.value5,
},
{
key: 5,
value: formData.value6,
},
],
};
if (data) await updateEstimate(payload);

View File

@ -31,6 +31,7 @@ export interface IEstimateFormData {
description: string;
};
estimate_points: {
id?: string;
key: number;
value: string;
}[];