Feature/gasht rahdari cartable

This commit is contained in:
2024-12-28 13:54:05 +00:00
committed by AmirHossein Mahmoodi
parent 7b09b61151
commit e2d092346e
49 changed files with 1202 additions and 301 deletions

View File

@@ -5,7 +5,7 @@ import useRequest from "@/lib/hooks/useRequest";
import { debounce } from "@mui/material/utils";
import { GET_RAHDARANS_LIST_SEARCH } from "@/core/utils/routes";
const RahdarCode = ({ rahdarsCode, setRahdarsCode, error }) => {
const RahdarCode = ({ rahdarsCode, setRahdarsCode, error, multiple = true }) => {
const [inputValue, setInputValue] = useState(""); // مدیریت مقدار تایپ‌شده
const [options, setOptions] = useState([]);
const [loading, setLoading] = useState(false);
@@ -42,11 +42,11 @@ const RahdarCode = ({ rahdarsCode, setRahdarsCode, error }) => {
return (
<Autocomplete
multiple // قابلیت انتخاب چندگانه
multiple={multiple} // قابلیت انتخاب چندگانه داینامیک
value={rahdarsCode} // آرایه موارد انتخاب‌شده
size="small"
onChange={(event, newValue) => {
setRahdarsCode(newValue || []); // به‌روزرسانی موارد انتخاب‌شده
setRahdarsCode(multiple ? newValue || [] : newValue || null); // مدیریت حالت چندگانه و تک‌گانه
}}
inputValue={inputValue} // مقدار تایپ‌شده
onInputChange={(event, newInputValue) => {
@@ -86,5 +86,4 @@ const RahdarCode = ({ rahdarsCode, setRahdarsCode, error }) => {
/>
);
};
export default RahdarCode;