From 6414293d1c371a343c435e98d3e67664a0ed0e16 Mon Sep 17 00:00:00 2001 From: Ehsan Date: Fri, 12 Sep 2025 20:51:50 +0330 Subject: [PATCH] handle request in modal filters, selector sort, search city with one function and field-search & handle change all data in doctors filter with one function & change modal search location in home page & set data with diffrent key in url of page doctors --- app/component/modalSearchCity/Content.js | 46 +++--- app/component/modalSearchCity/index.js | 19 +-- app/doctors/page.js | 18 ++- components/doctors/head/index.js | 80 ++++++----- components/doctors/modal/ButtonApply.js | 93 +------------ components/doctors/modal/Content.js | 3 +- components/doctors/modal/FilterModal.js | 39 ++---- components/doctors/search/SendReq.js | 47 +------ components/doctors/search/index.js | 26 +--- components/doctors/sortlist/SelectSort.js | 34 +---- components/doctors/sortlist/index.js | 23 +-- components/home/search/Fields.js | 4 +- components/home/search/RedirectLink.js | 9 +- components/home/search/modal/ButtonFilter.js | 34 +++++ components/home/search/modal/Content.js | 83 +++++++++++ components/home/search/modal/index.js | 131 +++++------------- .../searchHead/smSearch/AutoCompleteSearch.js | 5 + helper/index.js | 79 +++++++++++ lib/getStateInfoClient.js | 21 +++ 19 files changed, 385 insertions(+), 409 deletions(-) create mode 100644 components/home/search/modal/ButtonFilter.js create mode 100644 components/home/search/modal/Content.js create mode 100644 lib/getStateInfoClient.js diff --git a/app/component/modalSearchCity/Content.js b/app/component/modalSearchCity/Content.js index 4c2d5c1..b92a954 100644 --- a/app/component/modalSearchCity/Content.js +++ b/app/component/modalSearchCity/Content.js @@ -5,32 +5,44 @@ import CloseModalD from "@/components/icons/CloseModalD"; import ArrowLeftM from "@/components/icons/ArrowLeftM"; import { useState } from "react"; import AddressSelector from "./AddressSelector"; +import { getStateInfoClient } from "@/lib/getStateInfoClient"; function Content({ - state, states, filter, + sendReq, setFilter, handleClose, - modalLocate, + setDataInURL, filteredCities, }) { const [loading, setLoading] = useState(false); + const { matchedState } = getStateInfoClient(); + const handleClick = () => { + setLoading(true); + sendReq().finally(() => { + console.log("asd"); + + setLoading(false); + handleClose(); + }); + }; const updateData = (name, value) => { - setFilter((prev) => { - if (name === "state") { - return { - ...prev, - state: value, - city: null, - }; - } - return { - ...prev, - [name]: value, - }; - }); + const newFilter = + name === "state" + ? { + ...filter, + state: value, + city: null, + } + : { + ...filter, + [name]: value, + }; + + setDataInURL(newFilter); + setFilter(newFilter); }; return ( @@ -49,7 +61,7 @@ function Content({ name="state" list={states} label="استان" - disabled={state} + disabled={matchedState} value={filter.state} updateData={updateData} /> @@ -66,7 +78,7 @@ function Content({