From 2f078eba3c2c7a6a3e38df050a80219f47af506f Mon Sep 17 00:00:00 2001 From: ehsan Date: Thu, 18 Sep 2025 14:30:49 +0330 Subject: [PATCH] add first open time for appo item and change component data, remove work time in location, add loading on links in page doctor list, fix bug search city and state in clinics page --- app/component/ItemDoctor.js | 20 +++++- app/component/modalSearchCity/Content.js | 8 +-- app/component/openLocation/Content.js | 70 +++++++++++++------ app/component/openLocation/index.js | 6 +- components/clinics/head/SearchBar.js | 4 +- components/clinics/index.js | 2 +- .../doctor/appointmentList/ItemAppointment.js | 16 +++-- components/doctor/appointmentList/index.js | 4 +- .../cards/comments/chart/ProgressAll.js | 4 +- .../cards/comments/chart/index.js | 11 +-- .../detailDoctor/cards/comments/index.js | 2 +- .../detailDoctor/cards/locations/Item.js | 9 ++- .../detailDoctor/cards/locations/index.js | 2 +- components/doctor/index.js | 2 - components/doctors/head/index.js | 1 - components/doctors/index.js | 2 +- components/doctors/listDoctors/index.js | 17 +++-- 17 files changed, 115 insertions(+), 65 deletions(-) diff --git a/app/component/ItemDoctor.js b/app/component/ItemDoctor.js index 81c3434..13be1fb 100644 --- a/app/component/ItemDoctor.js +++ b/app/component/ItemDoctor.js @@ -11,10 +11,22 @@ import CustomLoading from "./loading/Custom"; import TextLoading from "./loading/Text"; import CircularLoading from "./loading/Circular"; import moment from "moment-jalaali"; +import { useState } from "react"; moment.loadPersian({ dialect: "persian-modern" }); -function ItemDoctor({ doctor }) { +function ItemDoctor({ doctor, doctors, setDoctors }) { + const [loading, setLoading] = useState(false); + const handleLoading = () => { + setDoctors((prevDoctors) => + prevDoctors.map((item) => + item.id === doctor.id + ? { ...item, loading: true } + : { ...item, loading: false } + ) + ); + }; + return (
  • {/* Detail Doctor */} @@ -93,9 +105,13 @@ function ItemDoctor({ doctor }) {
  • diff --git a/app/component/modalSearchCity/Content.js b/app/component/modalSearchCity/Content.js index 99e4dc2..ed853c7 100644 --- a/app/component/modalSearchCity/Content.js +++ b/app/component/modalSearchCity/Content.js @@ -60,16 +60,16 @@ function Content({ list={states} label="استان" disabled={matchedState} - value={filter.state} + value={filter?.state} updateData={updateData} />
    @@ -79,7 +79,7 @@ function Content({ onClick={handleClick} variant="contained" color="primary" - disabled={!filter.city || !filter.state} + disabled={!filter?.city || !filter?.state} > تایید و ادامه diff --git a/app/component/openLocation/Content.js b/app/component/openLocation/Content.js index 14b9370..67494ac 100644 --- a/app/component/openLocation/Content.js +++ b/app/component/openLocation/Content.js @@ -1,22 +1,44 @@ import CloseModalD from "@/components/icons/CloseModalD"; import Image from "next/image"; -const maps = [ - { src: "/assets/images/snapp.png", name: "snapp" }, - { src: "/assets/images/tapsi.png", name: "tapsi" }, - { src: "/assets/images/maps.png", name: "maps" }, - { src: "/assets/images/balad.png", name: "balad" }, - { src: "/assets/images/waze.png", name: "waze" }, -]; +function Content({ data, onClose }) { + const { latitude, longitude } = data && data.map; + + const maps = [ + { + src: "/assets/images/snapp.png", + name: "snapp", + url: `https://snapp.ir/route?lat=${latitude}&lng=${longitude}`, + }, + { + src: "/assets/images/tapsi.png", + name: "tapsi", + url: `https://tapsi.ir/route?lat=${latitude}&lng=${longitude}`, + }, + { + src: "/assets/images/maps.png", + name: "maps", + url: `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`, + }, + { + src: "/assets/images/balad.png", + name: "balad", + url: `https://balad.ir/map?lat=${latitude}&lng=${longitude}`, + }, + { + src: "/assets/images/waze.png", + name: "waze", + url: `https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes`, + }, + ]; -function Content({ handleClose }) { return ( <>

    باز شدن با

    -
    +
    @@ -27,20 +49,22 @@ function Content({ handleClose }) { key={idx} className="flex items-center flex-col justify-center gap-1" > - icon app -

    - {item.name} -

    + + icon app +

    + {item.name} +

    +
    ))} diff --git a/app/component/openLocation/index.js b/app/component/openLocation/index.js index e386806..90fe8c8 100644 --- a/app/component/openLocation/index.js +++ b/app/component/openLocation/index.js @@ -4,7 +4,7 @@ import { Drawer, Modal } from "@mui/material"; import { styleDefault } from "@/mui"; import Content from "./Content"; -function ModalOpenLocation({ open, setOpen, handleClose, children }) { +function ModalOpenLocation({ open, data, setOpen, handleClose, children }) { const toggleDrawer = (newOpen) => () => { setOpen(newOpen); }; @@ -19,7 +19,7 @@ function ModalOpenLocation({ open, setOpen, handleClose, children }) { style={styleDefault} className="!pt-[12px] !pb-[28px] !px-[24px] !bg-[#FAFAFA] !rounded-[8px] !overflow-hidden" > - +
    - +
    diff --git a/components/clinics/head/SearchBar.js b/components/clinics/head/SearchBar.js index 8ae2b4c..93d513a 100644 --- a/components/clinics/head/SearchBar.js +++ b/components/clinics/head/SearchBar.js @@ -1,9 +1,9 @@ import { Button, ButtonGroup, TextField } from "@mui/material"; import SearchD from "@/components/icons/SearchD"; -import ModalSearchCity from "@/app/component/modalSearchCity"; import { useState } from "react"; import ButtonFilter from "@/app/component/modalSearchCity/ButtonFilter"; import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch"; +import ModalSearchCity from "@/components/home/search/modal"; function SearchBar({ selected, @@ -28,7 +28,7 @@ function SearchBar({ setOpen={setOpen} selected={selected} setSelected={setSelected} - handleSearch={handleSearch} + // handleSearch={handleSearch} > diff --git a/components/clinics/index.js b/components/clinics/index.js index 04e9e8e..7342e2d 100644 --- a/components/clinics/index.js +++ b/components/clinics/index.js @@ -32,8 +32,8 @@ function ClinicsPage({ clinics, matchedCity, matchedState }) { > diff --git a/components/doctor/appointmentList/ItemAppointment.js b/components/doctor/appointmentList/ItemAppointment.js index b97d1eb..f760f79 100644 --- a/components/doctor/appointmentList/ItemAppointment.js +++ b/components/doctor/appointmentList/ItemAppointment.js @@ -5,7 +5,9 @@ import GreenCalendarTurn from "@/components/icons/GreenCalendarTurn"; import { Button } from "@mui/material"; import Image from "next/image"; import Link from "next/link"; -import React from "react"; +import moment from "moment-jalaali"; + +moment.loadPersian({ dialect: "persian-modern" }); function ItemAppointment({ turn, loading }) { return ( @@ -17,7 +19,7 @@ function ItemAppointment({ turn, loading }) {
    - doctor + doctor
    @@ -26,9 +28,9 @@ function ItemAppointment({ turn, loading }) {

    تخصص: - {turn?.expertise?.map( + {turn?.specialties?.map( (item, idx) => - `${item.name} ${turn.expertise.length === idx + 1 ? "" : "|"} ` + `${item.name} ${turn.specialties.length === idx + 1 ? "" : "|"} ` )}

    @@ -39,7 +41,11 @@ function ItemAppointment({ turn, loading }) {

    - اولین نوبت آزاد: {turn.first_free_turn || "یکشنبه 24 اردیبهشت"} + {Number(turn?.active) + ? `اولین نوبت آزاد: ${moment(turn?.free_turn * 1000).format( + "dddd jD jMMMM [ساعت] HH:mm" + )}` + : "نوبت ندارد"}

    diff --git a/components/doctor/appointmentList/index.js b/components/doctor/appointmentList/index.js index 1ae2ec4..8f4a19f 100644 --- a/components/doctor/appointmentList/index.js +++ b/components/doctor/appointmentList/index.js @@ -22,9 +22,9 @@ function AppointmentList({ doctors, loading }) { border-solid bottom-0 right-0 w-full p-4 flex items-center justify-between" >

    - اولین نوبت آزاد: {doctors[0]?.free_turn} + اولین نوبت آزاد: {doctors && doctors[0]?.free_turn}

    - +
    diff --git a/components/doctor/detailDoctor/cards/comments/chart/index.js b/components/doctor/detailDoctor/cards/comments/chart/index.js index 71ca835..e9b0b74 100644 --- a/components/doctor/detailDoctor/cards/comments/chart/index.js +++ b/components/doctor/detailDoctor/cards/comments/chart/index.js @@ -6,7 +6,10 @@ import ProgressDetail from "@/app/component/ProfressDetail"; import TextLoading from "@/app/component/loading/Text"; import CustomLoading from "@/app/component/loading/Custom"; -function Chart({ doctor }) { +function Chart({ comments, doctor }) { + console.log(doctor); + console.log(comments); + return (

    - امتیاز کلی کاربران: {doctor?.overall_score} از 5 + امتیاز کلی کاربران: {doctor?.point} از 5

    - (از مجموع {doctor?.comments?.length} نظر) + (از مجموع {comments?.length} نظر)

    @@ -28,7 +31,7 @@ function Chart({ doctor }) {
    - + ); diff --git a/components/doctor/detailDoctor/cards/locations/Item.js b/components/doctor/detailDoctor/cards/locations/Item.js index 2951cce..d19a7f5 100644 --- a/components/doctor/detailDoctor/cards/locations/Item.js +++ b/components/doctor/detailDoctor/cards/locations/Item.js @@ -7,7 +7,7 @@ import ModalOpenLocation from "@/app/component/openLocation"; import RoutingWhiteC from "@/components/icons/RoutingWhiteC"; import RoutingC from "@/components/icons/RoutingC"; -function Item({ doctor, data }) { +function Item({ data }) { const [isOpen, setIsOpen] = useState(false); const [open, setOpen] = useState(false); @@ -45,15 +45,13 @@ function Item({ doctor, data }) {

    آدرس: {data.address}

    -

    - تلفن: {data.telephone} -

    - روزهای کاری: {doctor.hours_of_work} + تلفن: {data.telephone}

    @@ -79,6 +77,7 @@ function Item({ doctor, data }) { diff --git a/components/doctor/detailDoctor/cards/locations/index.js b/components/doctor/detailDoctor/cards/locations/index.js index 46c2bf7..26c0077 100644 --- a/components/doctor/detailDoctor/cards/locations/index.js +++ b/components/doctor/detailDoctor/cards/locations/index.js @@ -11,7 +11,7 @@ function Locations({ doctor }) { {doctor?.address?.map((item, idx) => (
  • - + {doctor?.address.length > idx + 1 && ( )} diff --git a/components/doctor/index.js b/components/doctor/index.js index 9915109..f0def92 100644 --- a/components/doctor/index.js +++ b/components/doctor/index.js @@ -4,8 +4,6 @@ import Share from "./detailDoctor/Share"; import CustomLoading from "@/app/component/loading/Custom"; function DoctorPage({ doctor, doctors, comments }) { - comments; - return (
    diff --git a/components/doctors/head/index.js b/components/doctors/head/index.js index 246c133..ff8702a 100644 --- a/components/doctors/head/index.js +++ b/components/doctors/head/index.js @@ -67,7 +67,6 @@ function Head({ matchedCity, matchedState, setDoctors }) { throw err; }); }; - console.log(filter); return (
    diff --git a/components/doctors/index.js b/components/doctors/index.js index 7b6303c..aaeb56b 100644 --- a/components/doctors/index.js +++ b/components/doctors/index.js @@ -16,7 +16,7 @@ function DoctorsPage({ matchedCity, matchedState, list }) { matchedCity={matchedCity} matchedState={matchedState} /> - +
    ); } diff --git a/components/doctors/listDoctors/index.js b/components/doctors/listDoctors/index.js index 8f4add0..bbc50ca 100644 --- a/components/doctors/listDoctors/index.js +++ b/components/doctors/listDoctors/index.js @@ -1,15 +1,20 @@ -import doctors from "@/data/doctors.json"; +import doctorList from "@/data/doctors.json"; import Pagination from "@/app/component/Pagination"; import ItemDoctor from "@/app/component/ItemDoctor"; -function ListDoctors({ list }) { +function ListDoctors({ doctors, setDoctors }) { return ( <>
    - {list && list.length ? ( + {doctors && doctors.length ? (
      - {list?.map((doctor) => ( - + {doctors?.map((doctor) => ( + ))}
    ) : ( @@ -19,7 +24,7 @@ function ListDoctors({ list }) { )}
    - +
    );