save state selected in modal filter, filter list with location selected, save data sort, filter list with sort point, real all url from .env file, change name of value category and specialties to persian and change functional find data with field
This commit is contained in:
@@ -5,7 +5,7 @@ function SearchField({ fields, setFields }) {
|
||||
return (
|
||||
<TextField
|
||||
variant="standard"
|
||||
value={fields}
|
||||
value={fields.search}
|
||||
onChange={(e) => setFields({ ...fields, search: e.target.value })}
|
||||
InputProps={{
|
||||
disableUnderline: true,
|
||||
|
||||
@@ -3,6 +3,10 @@ import SearchD from "@/components/icons/SearchD";
|
||||
import { useState } from "react";
|
||||
import { request } from "@/services/response";
|
||||
|
||||
// Data
|
||||
import cities from "@/data/city.json";
|
||||
import states from "@/data/state.json";
|
||||
|
||||
function SendReq({ fields, setDoctors, matchedCity, matchedState }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
@@ -13,15 +17,27 @@ function SendReq({ fields, setDoctors, matchedCity, matchedState }) {
|
||||
const specialty = params.get("specialty");
|
||||
const gender = params.get("gender");
|
||||
const degree = params.get("degree");
|
||||
const turn = params.get("turn");
|
||||
const active = params.get("turn");
|
||||
const province = params.get("province");
|
||||
const sort = fields.stars;
|
||||
|
||||
let city = matchedCity?.id || null;
|
||||
let state = matchedState?.id || null;
|
||||
if (province) {
|
||||
const findCity = cities.find((item) => item.id === province);
|
||||
const findState = states.find((item) => item.id === findCity.province_id);
|
||||
if (findCity) city = findCity.id;
|
||||
if (findState) state = findState.id;
|
||||
}
|
||||
|
||||
const requestData = {
|
||||
specialty: specialty === "null" ? null : specialty,
|
||||
gender,
|
||||
degree,
|
||||
turn,
|
||||
city: matchedCity?.id || null,
|
||||
state: matchedState?.id || null,
|
||||
active,
|
||||
city,
|
||||
state,
|
||||
sort,
|
||||
name: fields.search,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import SettingD from "@/components/icons/SettingD";
|
||||
import ArrowBottomD from "@/components/icons/ArrowBottomD";
|
||||
import FilterModal from "../modal/FilterModal";
|
||||
import SendReq from "./SendReq";
|
||||
import { useState } from "react";
|
||||
import SearchField from "./SearchField";
|
||||
|
||||
function SearchBar({
|
||||
|
||||
Reference in New Issue
Block a user