remove quantities from product
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-07-03 16:56:02 +03:30
parent 1e8579bbfb
commit afc2701580
9 changed files with 41 additions and 115 deletions
+1 -20
View File
@@ -1,7 +1,6 @@
import { useState, type ChangeEvent, type FC } from 'react'
import Button from '@/components/Button'
import Input from '@/components/Input'
import Select from '@/components/Select'
import UploadBox from '@/components/UploadBox'
import VoiceRecorder from '@/components/VoiceRecorder'
import { COLORS } from '@/constants/colors'
@@ -95,9 +94,6 @@ const Order: FC<Props> = ({ addNewItem }) => {
const productId = e.target.value
const product = data?.data?.find(o => Number(o.id) === Number(productId))
if (product) {
if (product.quantities[0] !== 0) {
product.quantities.unshift(0)
}
setProductSelected(product)
formik.setFieldValue('productId', productId)
}
@@ -123,26 +119,11 @@ const Order: FC<Props> = ({ addNewItem }) => {
</div>
<div className='mt-6 rowTwoInput'>
<Select
items={productSelected?.quantities?.map((item) => {
return {
label: item === 0 ? 'انتخاب دلخواه' : item + '',
value: item + ''
}
}) || []}
label='تعداد'
placeholder='انتخاب'
{...formik.getFieldProps('quantity')}
error_text={formik.touched.quantity && formik.errors.quantity ? formik.errors.quantity : ''}
/>
<Input
label='تعداد دلخواه'
readOnly={Number(formik.values.quantity) !== 0}
label='تعداد'
{...formik.getFieldProps('quantity')}
type='number'
error_text={formik.touched.quantity && formik.errors.quantity ? formik.errors.quantity : ''}
/>
</div>
+1 -20
View File
@@ -1,7 +1,6 @@
import { useEffect, useState, type FC } from 'react'
import Button from '@/components/Button'
import Input from '@/components/Input'
import Select from '@/components/Select'
import UploadBox from '@/components/UploadBox'
import VoiceRecorder from '@/components/VoiceRecorder'
import { COLORS } from '@/constants/colors'
@@ -99,9 +98,6 @@ const EditOrder: FC<Props> = ({ addNewItem, initialValues }) => {
const productId = id
const product = data?.data?.find(o => Number(o.id) === Number(productId))
if (product) {
if (product.quantities[0] !== 0) {
product.quantities.unshift(0)
}
setProductSelected(product)
formik.setFieldValue('productId', productId)
}
@@ -147,26 +143,11 @@ const EditOrder: FC<Props> = ({ addNewItem, initialValues }) => {
</div>
<div className='mt-6 rowTwoInput'>
<Select
items={productSelected?.quantities?.map((item) => {
return {
label: item === 0 ? 'انتخاب دلخواه' : item + '',
value: item
}
}) || []}
label='تعداد'
placeholder='انتخاب'
{...formik.getFieldProps('quantity')}
error_text={formik.touched.quantity && formik.errors.quantity ? formik.errors.quantity : ''}
/>
<Input
label='تعداد دلخواه'
readOnly={Number(formik.values.quantity) !== 0}
label='تعداد'
{...formik.getFieldProps('quantity')}
type='number'
error_text={formik.touched.quantity && formik.errors.quantity ? formik.errors.quantity : ''}
/>
</div>