attributeId to FieldId

This commit is contained in:
hamid zarghami
2026-02-24 11:20:59 +03:30
parent 4e07362e3a
commit a3c06964e2
2 changed files with 5 additions and 5 deletions
@@ -22,11 +22,11 @@ const ManageAttribute: FC<Props> = (props) => {
const handleChange = (attributeId: string, value: string) => { const handleChange = (attributeId: string, value: string) => {
const attribute = formik.values.attributes const attribute = formik.values.attributes
const index: number = attribute.findIndex(o => o.attributeId === attributeId) const index: number = attribute.findIndex(o => o.fieldId === attributeId)
if (index > -1) { if (index > -1) {
attribute[index].value = value attribute[index].value = value
} else { } else {
attribute.push({ attributeId: attributeId, value: value }) attribute.push({ fieldId: attributeId, value: value })
} }
formik.setFieldValue('attributes', attribute) formik.setFieldValue('attributes', attribute)
} }
@@ -61,7 +61,7 @@ const ManageAttribute: FC<Props> = (props) => {
<div className='flex gap-5 flex-wrap'> <div className='flex gap-5 flex-wrap'>
{ {
item.options?.map((value) => { item.options?.map((value) => {
const object = formik.values.attributes.find(o => o.attributeId === item.id) const object = formik.values.attributes.find(o => o.fieldId === item.id)
return ( return (
<div key={value.id} className='flex gap-2 items-center'> <div key={value.id} className='flex gap-2 items-center'>
<div>{value.value}</div> <div>{value.value}</div>
@@ -78,7 +78,7 @@ const ManageAttribute: FC<Props> = (props) => {
</div> </div>
) )
else if (item.type === FieldTypeEnum.radio) { else if (item.type === FieldTypeEnum.radio) {
const object = formik.values.attributes.find(o => o.attributeId === item.id) const object = formik.values.attributes.find(o => o.fieldId === item.id)
return ( return (
<div key={item.id} className='mt-6'> <div key={item.id} className='mt-6'>
<div className='text-sm mb-3'>{item.name}</div> <div className='text-sm mb-3'>{item.name}</div>
+1 -1
View File
@@ -21,7 +21,7 @@ export type RequestType = {
productId?: string; productId?: string;
quantity?: number; quantity?: number;
attributes: { attributes: {
attributeId: string; fieldId: string;
value: string | number; value: string | number;
}[]; }[];
attachments: AttachmentsType[]; attachments: AttachmentsType[];