Commit Graph
86 Commits
Author SHA1 Message Date
hamed f5e06cfc13 fix: correct spelling of 'canceled' in payment status across components 2026-07-03 10:56:04 +03:30
hamed 90d4a871f5 feat: enhance payment flow with automatic redirection to appointment history after successful payment 2026-07-03 10:45:35 +03:30
hamed 5bec4848a2 feat: unify currency display to toman across the application 2026-07-03 10:31:16 +03:30
hamed 537f3e47d5 fix(payment): update currency display from تومان to ریال and adjust amount formatting 2026-06-24 20:39:34 +03:30
hamed e0d729dcf1 fix(api): ensure token is refreshed if not available during request 2026-06-21 13:47:07 +03:30
hamed 194ffd889c feat: enhance security by implementing HttpOnly refresh tokens and in-memory access token management
- Added isomorphic-dompurify for improved XSS protection
- Refactored token storage to use in-memory management for access tokens
- Implemented server-side route handlers for OAuth token management
- Introduced security headers in next.config.js
- Removed client-side exposure of client_secret and sensitive tokens
- Updated API interceptors to handle token refresh logic
- Cleaned up cookie management for refresh tokens
2026-06-20 13:10:17 +03:30
hamed a19058d9a2 feat(userAccount): add validation for Iranian national code and update input handling 2026-06-19 11:23:01 +03:30
hamed da05a4e13c feat(userAccount): improve user profile handling with avatar upload and dynamic display name 2026-06-19 11:05:43 +03:30
hamed ea2c0c29ec feat(userAccount): enhance user profile handling with avatar upload and additional user data 2026-06-19 10:19:52 +03:30
hamedandClaude Opus 4.8 69e591f03e fix(dashboard): appointment detail fields + sidebar hydration
- Appointment detail (DetailLg/DetailSm) read the real response shape:
  date/time from slot_start, specialty from doctor.specialties[0].name,
  phone from address.telephone.
- Sidebar Head reads userInfo (cookie) after mount to avoid an SSR/client
  hydration mismatch on the user's name.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 12:01:43 +03:30
hamedandClaude Opus 4.8 bdf453a3ab feat(dashboard): stepwise Jalali birthday picker + correct send direction
- JalaliDatePicker gains an opt-in `stepwise` mode (year → month → day): the
  year step is a scrollable list from the current Jalali year down to 1332,
  used by the birthday field. Default-off so appointment/panel pickers keep
  the month-grid behavior. Parse incoming Jalali string values safely
  (fixes NaN keys).
- Birthday create path now converts Jalali→Unix on send (changeDateType true),
  matching the update path and the Unix-based backend contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:42:45 +03:30
hamedandClaude Opus 4.8 7949da9ba9 fix(appointment): real status filter + required account fields
- My-appointments tabs sent invalid status values (reserved/waiting_for_payment/
  ...) that don't exist in the backend, so every tab but "all" returned empty.
  Map tabs to real statuses (pending/confirmed/completed/cancelled_by_user/
  expired) so booked appointments show up.
- Booking form now validates required account fields before proceeding to
  payment (national_code 10 digits, name, family, gender, basic_insurance),
  in both self and other-person modes, surfacing per-field errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 10:45:41 +03:30
hamedandClaude Opus 4.8 a79a6c0629 fix(dashboard): controlled Switch for disease status
The disease status Switch used defaultChecked, but row.status loads
async and changes via changeData, triggering MUI's uncontrolled→
controlled warning. Drive it with checked from row.status instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 22:22:43 +03:30
hamedandClaude Opus 4.8 e7db7c705b feat(dashboard): loading spinner and success toast on profile save
The ثبت اطلاعات button gave no feedback. Show a spinner while saving
(both POST and PATCH) and a 'اطلاعات با موفقیت ثبت شد' toast on success,
for the info tab and the medical-history sub-tabs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 22:21:09 +03:30
hamedandClaude Opus 4.8 caca3fda97 fix(dashboard): show name from profile label field
The backend stores the first name in the profile's label field, but the
account form binds the نام input to information.name, so a saved name
never displayed on reload. Map label→name when loading the profile (and
drop the raw label) so the field populates; saving still sends name,
which the backend hydrates back into label.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 22:17:25 +03:30
hamedandClaude Opus 4.8 21676857b4 fix(dashboard): account selects store option id, not label match
DefaultSelect's onChange passes the whole option object {label,id}, but
the gender/blood_type/marital/education/job handlers compared it as a
string (education/blood via find(g=>g.label===value), others via ===),
so the value never stored — education in particular always saved empty.
Read option?.id uniformly across all five selects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 22:13:37 +03:30
hamedandClaude Opus 4.8 41f950985b fix(dashboard): guard select .find().id crashes in account form
Clearing the blood type / education / insurance selects made
.find(...).id (and val.id) read .id on undefined, crashing the account
form. Use optional chaining with empty-string/empty-array fallbacks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:53:39 +03:30
hamedandClaude Opus 4.8 95cbee48ab fix(dashboard): empty state for comments and messages tabs
These tabs have no backend endpoint yet (only per-doctor comments and
admin exist; user messages don't), so they read the always-empty
user.comments/user.messages. Guard against null and show a clear empty
state instead of a blank list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:49:25 +03:30
hamedandClaude Opus 4.8 c80f002670 fix(dashboard): transactions tab uses real payment fields + empty state
The transactions list/card read mock fields (appointment_details,
row.amount, status 'received') and iterated user.turns.done. Pass the
real payments array and read order_id/type/created_at/amount_rials/status
from Payment.toArray(); map status to Persian labels, show rials→toman,
and render an empty state when there are no transactions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:48:06 +03:30
hamedandClaude Opus 4.8 8a87d9cf92 fix(dashboard): turns tab uses real appointment fields + empty state
The turns list/card read start_time, slot.time and doctor.specialty,
none of which exist on Appointment.toArray() (slot_start, doctor.name,
status). Use slot_start for the Jalali date/time, replace the specialty
column with a Persian status label, and show an empty state when there
are no appointments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:39:12 +03:30
hamedandClaude Opus 4.8 224c51069c fix(dashboard): map insurance and medical history correctly in account tab
The account tab read basic_insurance.id (object) but the profile returns
basic_insurance_id (number), yielding [NaN], and never loaded the medical
history (other). Map basic_insurance_id/supplementary_insurance_id and
merge profile.other on load, and keep the profile uuid even for an empty
profile so PATCH saves work. Verified round-trip (name→label, insurance,
other) against the live API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:36:34 +03:30
hamedandClaude Opus 4.8 0a95e99efa fix(dashboard): wire turns/transactions to real endpoints + fix uuid cookie
- Login now overwrites the uuid cookie with the real user uuid (was the
  OTP uuid), so server-side profile/dashboard fetches resolve.
- getMyAppointments → /api/v1/appointments/user (patient's own bookings;
  /my/appointments is role-scoped and empty for plain users), read from
  the double-nested data.data.
- getMyPayments → /api/v1/my/payments (new endpoint), read paginated
  data + meta.totalPages.
- Drop the userId path param (both endpoints derive the user from token).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:27:18 +03:30
hamedandClaude Opus 4.8 96b1684b82 fix(dashboard): guard null userInfo in Head to stop 500 crash
getParsedUserInfo() can return null (cookie missing/unparseable), so
reading userInfo.realName crashed the dashboard with a 500. Default to
an empty object and fall back to the user prop's name or 'کاربر'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:15:25 +03:30
hamedandClaude Opus 4.8 fbb2279b49 fix(user-profile): consume profile from double-nested 200 response
With the backend now returning 200 (lazy-created profile) instead of
404, align the consumers: the profile lives at res.data.data (the
endpoint double-nests), so the booking detail and dashboard read that
instead of res.data / the raw envelope. Drop the obsolete 404 special
handling (empty editable form now comes from the 200 payload), seed the
dashboard empty state when the profile has no real data yet, and make
the profile POST fall back to PATCH on 409 (already lazy-created).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:06:38 +03:30
hamedandClaude Opus 4.8 969e915815 fix(appointment): extract insurance list from double-nested response
GET /api/v1/insurances returns success(['data' => items]) → the body is
{ data: { data: [...] } }, so after the interceptor unwraps once the
array lives at res.data.data, not res.data. The callers set the list to
the wrapper object, so insurance.find threw 'not a function'. Read
res.data.data and guard with Array.isArray in both the booking detail
form and the dashboard insurance loader.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 16:54:11 +03:30
hamedandClaude Opus 4.8 e13d1c2eeb fix(location): correct directions deep links
The routing modal shipped broken deep links: snapp.ir/route and
tapsi.ir/route paths don't exist (404), and balad used the wrong path
and params. Keep only apps with verified destination deep links and
fix their formats:

- Remove Snapp and Tapsi (no valid web destination route).
- Balad: balad.ir/location?latitude=&longitude= (was /map?lat=&lng=).
- Google Maps and Waze kept (already correct).
- Guard data.map destructuring against null.
- Dashboard turn detail: use maps/dir directions URL instead of a
  plain q= pin to match the مسیریابی label.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 15:26:10 +03:30
hamedandClaude Opus 4.8 8255283ec0 fix(ui): remove invalid MUI v5 Button loading prop project-wide
prop loading روی Button فقط در MUI v6+ پشتیبانی می‌شود؛ این پروژه v5 است
و هشدار "Received false for a non-boolean attribute loading" می‌داد.
- دکمه‌های login/verify: disabled + CircularProgress شرطی (بازخورد بصری حفظ شد)
- بقیه دکمه‌ها: loading → disabled (ادغام با disabled موجود در صورت وجود)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 00:30:55 +03:30
hamedandClaude Opus 4.8 dc1c6d25be feat(dashboard): connect patient dashboard to real user profile
- buildPatientUser: ساخت آبجکت user از user-profile واقعی با کلیدهای
  مورد انتظار کامپوننت‌ها؛ comments/messages خالی و اعداد هدر صفر
  (بدون داده ساختگی، چون endpoint ندارند)
- app/dashboard/page.js پروفایل را server-side از user-profile/{uuid} می‌گیرد
- حذف import userData.json mock از Content داشبورد
- نوبت/تراکنش/تب اطلاعات از قبل به API واقعی وصل بودند (بدون تغییر)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 00:10:40 +03:30
hamedandClaude Sonnet 4.6 59e0a0fe4f fix: resolve critical bugs and security issues across the project
Security:
- Disable SSL verification only in development (lib/req.js)
- Wrap all JSON.parse(cookie) calls in try-catch via safeJsonParse utility
- Sanitize dangerouslySetInnerHTML in blog/clinic with sanitizeHtml utility
- Fix open redirect in payment page — validate URL origin before redirect
- Fix cookie cleanup on 401 — use js-cookie with correct domain scope

Performance:
- Wrap ItemDoctor with React.memo to prevent unnecessary re-renders
- Replace <img> with Next.js <Image> in blog Caption component

Functionality:
- Fix memory leak in Recode.js — store intervals in refs, cleanup on unmount
- Add null guard on retryIcon.current before classList manipulation
- Fix getParsedUserInfo in helper to handle malformed cookie gracefully

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 09:19:20 +03:30
hamedandClaude Sonnet 4.6 1aa9f82d2a fix: resolve critical bugs and security issues across the project
- Fix GPS map links always sending literal "latitude"/"longitude" strings
  instead of actual coordinates in openLocation/Content.js
- Add api.clinic-pro.ir to next.config.js remotePatterns so production
  images load correctly
- Fix appointment page: await params and getStateInfo (Next.js 15 pattern)
- Enable 401 handling in api.js: clear cookies and redirect to /login
- Move OAuth client_secret to server-side API routes (/api/auth/token,
  /api/auth/refresh) so it is never bundled into client-side JavaScript
- Update SendReq, SubmitData, ButtonSendData to call API routes instead
  of directly sending client_secret from the browser
- Update docker-compose.yml to use server-only CLIENT_SECRET env var
- Remove debug console.log from clinic doctors list component

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 22:18:11 +03:30
hamed db2f9aef60 Replace jalaali-react-date-picker with custom MUI-based Jalali date picker - fixes all 10 security vulnerabilities 2025-12-17 10:09:37 +03:30
hamed 4651ae534d refactor: implement PDF download functionality for appointment details in DetailLg and DetailSm components 2025-11-19 10:34:02 +03:30
hamed aef10e7764 refactor: update map button functionality to use latitude and longitude for Google Maps links 2025-11-19 10:24:07 +03:30
hamed e7cff90516 refactor: integrate IsTurnsDetails component for enhanced appointment display 2025-11-19 09:42:59 +03:30
hamed b2f968480c refactor: update appointment handling to improve data flow and display, including status management and detail views 2025-11-19 09:16:41 +03:30
hamed e7c8501680 refactor: enhance transaction and appointment handling with pagination, status filtering, and improved data display 2025-11-18 22:21:47 +03:30
Ehsan 1e70d88a84 fix bug save and set data just with one key, remove page login from appo page, disable not avalaible data in calendar, change steps for pages in appo, get data user, edit and set in page user-info 2025-08-31 01:21:59 +03:30
Ehsan 278602372d change component folders && add multipleselector && send img of doctor page && send skills to create doctor item 2025-07-17 15:50:23 +03:30
Ehsan 88f25cdd2e in page add doctor change data state & component & save data & request to send data & change component folder 2025-07-14 04:30:50 +03:30
Ehsan c6e2657e45 change design and data list in doctor-item & handle component appointment in doctor-item & handle functionality date-picker & fix bug appointment page & add req get appointment list 2025-07-09 03:05:48 +03:30
Ehsan f951128074 change date type for req & design and fields & add requests & fix bug appointment and dashboard 2025-07-04 23:44:29 +03:30
Ehsan 597fa1931d change fields component & handle edit, delete, add data and save & change functional page doctor 2025-07-02 02:12:47 +03:30
Ehsan 04d3e38859 change fields component & handle edit, delete, add data and save & change functional page doctor 2025-07-02 01:58:44 +03:30
hamed 5b90f7dfad change functionality req from ssr to csr
set dockerfile

reset dockerfile

fix dockerfile

fix dockerfile

use node 22

fix dockerfile

fix dockerfile
2025-06-29 20:13:42 +03:30
Ehsan 43eb9c2b78 change functionality req from ssr to csr 2025-06-18 01:32:25 +03:30
Ehsan debd6b0eb5 update dashboard data and design and change req from ssr to csr & change design and data doctor and clinic item 2025-06-17 00:26:16 +03:30
Ehsan 891b0e8273 fix bug dashboard bugs & handle request update data in user profile & change design button in home page 2025-06-13 22:12:58 +03:30
Ehsan eea8737778 Fix dashboard data requests, update dashboard data handling, change login field type, and redesign home button 2025-06-12 21:46:27 +03:30
Ehsan bf64271d14 handle change data and update data in dashboard page for all tabs 2025-06-11 16:52:01 +03:30
Ehsan 72ed07071c handle update data in tab dashboard 2025-06-10 14:27:06 +03:30