The site offered a "personal practice" for a doctor who has no personal address at all — the schedule existed but its shifts pointed at the clinic's address, so there was nowhere to go. The backend now filters those out; this consumes the filtered contract and adds the per-day dimension. - getBookingLocations takes an optional date and the appointment page refetches on it, merging available_on_date into the existing list rather than replacing it, so browsing the calendar never resets the user's choice. - The browsed day had to be lifted out of the Date step: selectedDate is only set once a slot is confirmed, far too late to drive availability. - A location closed on the chosen day renders disabled with «در این روز نوبت ندارد», and when every location is closed the step says so instead of showing an empty slot list. If the already-selected location closes, a notice appears with a link back to the picker — silently showing nothing was the failure mode worth avoiding. - Doctor profile: workLocation in the Physician JSON-LD is limited to addresses that appear in booking_locations, since schema.org presents them as places a patient can attend. The address card still lists the others — they are real practice details — tagged «بدون نوبتدهی آنلاین». Verified end-to-end with a temporary unused address on the test doctor: the visible card listed both and tagged the unused one, while workLocation carried only the bookable one. The row was removed afterwards. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
166 lines
6.3 KiB
JavaScript
166 lines
6.3 KiB
JavaScript
import { removeTokenHead } from "@/helper";
|
|
import api from "./api";
|
|
|
|
/**
|
|
* محل نوبتدهی. نبودِ clinic_uuid یعنی «مطب شخصی» — نه «هر محلی که پیدا شد».
|
|
* پزشک میتواند همزمان برنامهٔ شخصی و برنامهٔ کلینیک داشته باشد و این دو دادهی
|
|
* جدا دارند.
|
|
*/
|
|
const clinicQuery = (clinicUuid, prefix = "&") =>
|
|
clinicUuid ? `${prefix}clinic_uuid=${encodeURIComponent(clinicUuid)}` : "";
|
|
|
|
export const request = {
|
|
sendCode: (mobile, altcha, domain) =>
|
|
api.post(
|
|
"api/v1/user/send-code",
|
|
{
|
|
mobile,
|
|
altcha,
|
|
...(domain ? { domain } : {}),
|
|
},
|
|
removeTokenHead
|
|
),
|
|
getUserProfile: (uuid) => api.get(`/api/v1/user-profile/${uuid}`, { requireAuth: true }),
|
|
postUserProfile: (data) => api.post("api/v1/user-profile", data, { requireAuth: true }),
|
|
patchUserProfile: (data, uuid) =>
|
|
api.patch(`api/v1/user-profile/${uuid}`, data, { requireAuth: true }),
|
|
uploadUserAvatar: (file) =>
|
|
api.post("api/v1/user-profile/avatar", file, {
|
|
requireAuth: true,
|
|
headers: {
|
|
"Content-Type": "application/octet-stream",
|
|
"Content-Disposition": `filename="${file?.name || "avatar.jpg"}"`,
|
|
},
|
|
}),
|
|
getUserInfo: (headers) => api.get("oauth/userinfo", { ...headers, requireAuth: true }),
|
|
getInsuranceType: () =>
|
|
api.get(`api/v1/insurances?type=basic`, { requireAuth: true }),
|
|
getSupplementaryInsurance: () =>
|
|
api.get(`api/v1/insurances?type=supplementary`, { requireAuth: true }),
|
|
getDoctors: (params) =>
|
|
api.get("api/v1/doctors", {
|
|
params,
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getSpecialtyDoctorCounts: (cityId) =>
|
|
api.get("api/v1/specialties/doctor-counts", {
|
|
params: cityId ? { city_id: cityId } : {},
|
|
headers: { Authorization: "" },
|
|
}),
|
|
getAppointmentWeeklySchedule: (uuid) =>
|
|
api.get(`api/v1/appointment-settings/weekly-schedule/${uuid}`),
|
|
postAppointmentWeeklySchedule: () =>
|
|
api.post("api/v1/appointment-settings/weekly-schedule/"),
|
|
patchAppointmentWeeklySchedule: (uuid) =>
|
|
api.patch(`api/v1/appointment-settings/weekly-schedule/${uuid}`),
|
|
deleteAppointmentWeeklySchedule: (uuid) =>
|
|
api.delete(`api/v1/appointment-settings/weekly-schedule/${uuid}`),
|
|
getBookingLocations: (doctor_uuid, date = null) =>
|
|
api.get(`api/v1/appointment-booking-locations/${doctor_uuid}`, {
|
|
params: date ? { date } : {},
|
|
...removeTokenHead,
|
|
}),
|
|
getAppointmentSlots: (doctor_uuid, date, clinic_uuid = null) =>
|
|
api.get(
|
|
`api/v1/appointment-slots?doctor_uuid=${doctor_uuid}&date=${date}` +
|
|
clinicQuery(clinic_uuid),
|
|
removeTokenHead
|
|
),
|
|
getMonthAvailability: (doctor_uuid, year, month, clinic_uuid = null) =>
|
|
api.get(`api/v1/appointment-settings/month-availability/${doctor_uuid}`, {
|
|
params: { year, month, ...(clinic_uuid ? { clinic_uuid } : {}) },
|
|
...removeTokenHead,
|
|
}),
|
|
getBookingServices: (doctor_uuid, clinic_uuid = null) =>
|
|
api.get(
|
|
`api/v1/appointment-booking-services/${doctor_uuid}${clinicQuery(clinic_uuid, "?")}`,
|
|
removeTokenHead
|
|
),
|
|
getServiceSlots: (doctor_uuid, date, serviceItemUuids = [], clinic_uuid = null) =>
|
|
api.get(
|
|
`api/v1/appointment-service-slots?doctor_uuid=${doctor_uuid}&date=${date}` +
|
|
serviceItemUuids
|
|
.map((u) => `&service_item_uuids[]=${encodeURIComponent(u)}`)
|
|
.join("") +
|
|
clinicQuery(clinic_uuid),
|
|
removeTokenHead
|
|
),
|
|
postAppointment: (data) => api.post(`api/v1/appointment`, data, { requireAuth: true }),
|
|
getMyAppointments: (params) => api.get(`api/v1/appointments/user`, { params, requireAuth: true }),
|
|
getPaymentConfig: () => api.get(`api/v1/payment/config`, { requireAuth: true }),
|
|
getPayment: (uuid) => api.get(`api/v1/payment/${uuid}`, { requireAuth: true }),
|
|
getMyPayments: (params) => api.get(`api/v1/my/payments`, { params, requireAuth: true }),
|
|
postDoctor: (data) => api.post("api/v1/doctor", data),
|
|
postImageUpload: (data) =>
|
|
api.post("file/upload/clinic_pro/doctor/field_image", data, {
|
|
headers: {
|
|
"Content-Type": "application/octet-stream",
|
|
"Content-Disposition": `file; filename="${data.name}"`,
|
|
"X-CSRF-Token": "",
|
|
},
|
|
}),
|
|
getDoctorServices: () =>
|
|
api.get("api/v1/categorys/doctor_services", removeTokenHead),
|
|
postDoctorComment: (data) => api.post("api/v1/comment", data, { requireAuth: true }),
|
|
getDoctorClaimInfo: (uuid) => api.get(`api/v1/doctor/${uuid}/claim-info`),
|
|
postDoctorClaim: (uuid, data) =>
|
|
api.post(`api/v1/doctor/${uuid}/claim`, data, { requireAuth: true }),
|
|
deleteDoctor: (uuid) => api.delete(`api/v1/doctor/${uuid}`, { requireAuth: true }),
|
|
getDoctorRate: (uuid) => api.get(`api/v1/rate/${uuid}`),
|
|
getRateEligibility: (uuid) =>
|
|
api.get(`api/v1/rate/${uuid}/eligibility`, { requireAuth: true }),
|
|
getDoctorComments: (uuid) => api.get(`api/v1/comments/${uuid}`),
|
|
postDoctorRate: (data) => api.post("api/v1/rate", data, { requireAuth: true }),
|
|
postCommentsLike: (commentUuid, value) =>
|
|
api.post(`api/v1/like/${commentUuid}`, { value }, { requireAuth: true }),
|
|
getClinicList: (params) =>
|
|
api.get("/api/v1/clinics", {
|
|
params,
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getDoctorAddress: (location_id) =>
|
|
api.get(`api/v1/clinic-pro/doctor-address/${location_id}`, removeTokenHead),
|
|
getBlogs: (params) =>
|
|
api.get("api/v1/blogs", {
|
|
params,
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getBlogTags: (params) =>
|
|
api.get("api/v1/tags", {
|
|
params,
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getTopBlogs: () =>
|
|
api.get("api/v1/blogs/top", {
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getSingleBlog: (uuid) =>
|
|
api.get(`api/v1/blog/${uuid}`, {
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
getRepresentationInfo: (uuid) =>
|
|
api.get(`api/v1/representation/${uuid}`, { requireAuth: true }),
|
|
getRepresentationDashboardMonthly: (uuid, year, month) =>
|
|
api.get(`api/v1/representation/${uuid}/dashboard/monthly`, {
|
|
params: { year, month },
|
|
requireAuth: true,
|
|
}),
|
|
getRepresentationDashboardYearly: (uuid, year) =>
|
|
api.get(`api/v1/representation/${uuid}/dashboard/yearly`, {
|
|
params: { year },
|
|
requireAuth: true,
|
|
}),
|
|
};
|