diff --git a/src/pages/orders/components/CreateOrderCustomerSection.tsx b/src/pages/orders/components/CreateOrderCustomerSection.tsx index d6f9049..5410871 100644 --- a/src/pages/orders/components/CreateOrderCustomerSection.tsx +++ b/src/pages/orders/components/CreateOrderCustomerSection.tsx @@ -3,6 +3,8 @@ import { Profile, SearchNormal, TickCircle, UserAdd } from 'iconsax-react' import type { FormikProps } from 'formik' import { toast } from 'react-toastify' import { clx } from '@/helpers/utils' +import Button from '@/components/Button' +import DefaulModal from '@/components/DefaulModal' import Input from '@/components/Input' import { useSearchUserByPhone } from '@/pages/customers/hooks/useUsersData' import type { UserWithAddresses } from '@/pages/customers/types/Types' @@ -28,6 +30,7 @@ const CreateOrderCustomerSection: FC = ({ }) => { const { mutate: searchUser, isPending: isSearching } = useSearchUserByPhone() const [searchState, setSearchState] = useState('idle') + const [isCustomerModalOpen, setIsCustomerModalOpen] = useState(false) const handleSearch = () => { const phone = formik.values.userPhone.trim() @@ -87,131 +90,159 @@ const CreateOrderCustomerSection: FC = ({ : '' return ( -
-
-
-
- {searchState === 'found' ? ( - - ) : searchState === 'not_found' ? ( - - ) : ( - - )} -
-
-
اطلاعات مشتری
- {searchState === 'found' && customerName && ( -
- {customerName} -
- )} - {searchState === 'not_found' && ( -
- مشتری جدید -
- )} -
-
- - {searchState === 'found' && ( - - مشتری یافت شد - - )} - {searchState === 'idle' && ( - - ابتدا شماره را جستجو کنید - - )} -
- -
-
- -
- { - if (e.key === 'Enter') { - e.preventDefault() - handleSearch() - } - }} + <> +
+
+
+
- +
+
+
+ اطلاعات مشتری + + اختیاری + +
+ {searchState === 'found' && customerName && ( +
+ {customerName} +
+ )} + {searchState === 'not_found' && ( +
+ مشتری جدید +
+ )} + {searchState === 'idle' && ( +
+ برای این سفارش وارد کردن اطلاعات مشتری الزامی نیست +
+ )} +
- {phoneError && ( -

{phoneError}

- )} +
- - - -
-
+ + setIsCustomerModalOpen(false)} + isHeader={true} + title_header='اطلاعات مشتری' + width={700} + > +
+
+ اطلاعات مشتری اختیاری است و در صورت نیاز می‌توانید ثبت کنید. +
+ +
+
+ +
+ { + if (e.key === 'Enter') { + e.preventDefault() + handleSearch() + } + }} + className={clx( + 'flex-1 min-w-0 h-10 text-xs px-4 border border-border bg-white', + 'rounded-r-xl border-l-0 focus:outline-none', + phoneError && 'border-red-400', + )} + /> + +
+ {phoneError && ( +

{phoneError}

+ )} +
+ + + + +
+ +
+ +
+
+
+ ) }