This commit is contained in:
hamid zarghami
2026-02-23 14:31:50 +03:30
parent 3c92e55927
commit 3a9c241d45
3 changed files with 9 additions and 12 deletions
@@ -15,13 +15,10 @@ type Props = {
formik: FormikProps<RequestType>
}
const SERVICE_LINKS_LABEL = 'لینک سرویس ها'
const ManageAttribute: FC<Props> = (props) => {
const { attributes, formik } = props
const getAttributeLabel = (name: string) => name === SERVICE_LINKS_LABEL ? name : 'request'
const handleChange = (attributeId: string, value: string) => {
const attribute = formik.values.attributes
@@ -46,7 +43,7 @@ const ManageAttribute: FC<Props> = (props) => {
<div className='mt-6' key={item.id}>
<Select
placeholder={`انتخاب ${item.isRequired ? '(اجباری)' : '(اختاری)'}`}
label={getAttributeLabel(item.name)}
label={item.name}
items={item.options?.map((value) => {
return {
label: value.value,
@@ -60,7 +57,7 @@ const ManageAttribute: FC<Props> = (props) => {
else if (item.type === FieldTypeEnum.checkbox)
return (
<div key={item.id} className='mt-6'>
<div className='text-sm mb-3'>{getAttributeLabel(item.name)}</div>
<div className='text-sm mb-3'>{item.name}</div>
<div className='flex gap-5 flex-wrap'>
{
item.options?.map((value) => {
@@ -84,7 +81,7 @@ const ManageAttribute: FC<Props> = (props) => {
const object = formik.values.attributes.find(o => o.attributeId === item.id)
return (
<div key={item.id} className='mt-6'>
<div className='text-sm mb-3'>{getAttributeLabel(item.name)}</div>
<div className='text-sm mb-3'>{item.name}</div>
<RadioGroup
items={item.options?.map((value) => {
return {
@@ -105,7 +102,7 @@ const ManageAttribute: FC<Props> = (props) => {
<DatePickerComponent
onChange={(date) => handleChange(item.id, date)}
placeholder=''
label={getAttributeLabel(item.name)}
label={item.name}
/>
</div>
)
@@ -113,7 +110,7 @@ const ManageAttribute: FC<Props> = (props) => {
return (
<div key={item.id} className='mt-6'>
<Input
label={getAttributeLabel(item.name)}
label={item.name}
type={item.type}
onChange={(e) => handleChange(item.id, e.target.value)}
/>
@@ -123,7 +120,7 @@ const ManageAttribute: FC<Props> = (props) => {
return (
<div key={item.id} className='mt-6'>
<Textarea
label={getAttributeLabel(item.name)}
label={item.name}
onChange={(e) => handleChange(item.id, e.target.value)}
/>
</div>