Compare commits

32 Commits
Author SHA1 Message Date
hamedandClaude Opus 5 5fdc232e65 chore(graph): update knowledge graph after insurance logo fix
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:33:48 +03:30
hamedandClaude Opus 5 b33f38072d fix(clinic): send each contracted insurer's logo to the public page
The clinic payload carried only uuid/id/name for list_bime, so the public
page fell back to the same placeholder for every insurer and the section
read as broken. The logo has been on the insurance record all along.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:33:34 +03:30
hamedandClaude Opus 5 e4bd37b3bd chore(graph): update knowledge graph after agent panel fix
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:25:02 +03:30
hamedandClaude Opus 5 f863b39a74 fix(representation): count only online bookings in the agent panel
The agent's own dashboard (dashboard/summary and doctors/performance) counted
every appointment belonging to their doctors, so the bookings a secretary types
into the panel — which earn the agent nothing — sat next to a commission column
that ignored them. Both now count only bookings that came from the agent's own
site, matching the monthly/yearly report. The per-doctor income column is also
scoped to this agent, since a doctor may have been under another one before.

Adds a backfill for the bookings paid before city domains resolved to an agent:
they carry neither booking_representation_id nor a FinancialBreakdown, and
neither can be recovered by replaying the request. Both are derived from
payments.frontend_address, the address the payment was started from. The
recovered breakdown is dated to the payment, not to the run, or a year of
commission would land in "today". Dry-run by default; re-running is a no-op,
and a payment whose domain does not match the doctor's owner is reported and
skipped rather than retried forever.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:24:48 +03:30
hamedandClaude Opus 5 be12502873 chore(graph): update knowledge graph after representation commission fix
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:14:36 +03:30
hamedandClaude Opus 5 15dfbe61fd fix(representation): pay commission on online bookings from city sites
Three things kept a city-site booking from ever reaching its representative.

The domain never resolved. City sites carry their own domain on cities.domain
while a representative's coverage is a set of cities, and representations.domain
is normally only filled for a global agent. The resolver looked at that column
alone, so bookingRepId was always null and the commission guard rejected every
booking made through a city site. It now falls back to the active representative
covering that city, and stays null when two of them cover it — an ambiguous
money assignment has to be resolved in the data, not guessed.

Commission waited for confirmation. The money has already arrived when the
gateway callback succeeds; confirming the appointment is the doctor's or
secretary's job and may happen days later or never. It is now recorded on
payment, with the appointment still pending. Recording is idempotent, so the
confirmation path stays and creates nothing twice.

The dashboard counted every appointment of the representative's doctors,
including the ones a secretary typed into the panel. It now counts only
bookings that came from the representative's own site.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:14:22 +03:30
hamedandClaude Opus 5 73a9351f14 chore(graph): update knowledge graph after payment origin
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:38:43 +03:30
hamedandClaude Opus 5 bb09316a75 feat(admin): show which domain a payment came from
Several storefronts share one gateway — the city booking sites and the
ClinicPro panel itself — so the payments report could not say where a
transaction originated. The payment already stores the return address it was
started with; the domain is derived from it.

Lowercased and stripped of "www." so one domain is one value in the report,
null when a payment has no return address. Exposed on both the list and the
detail (which also carries the full address), and the list search now matches
it, so filtering to a single site needs no new parameter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:38:27 +03:30
hamedandClaude Opus 5 60c2eaa35e chore(graph): update knowledge graph after context cache fix
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:16:11 +03:30
hamedandClaude Opus 5 1ce9957538 fix(admin): drop cached environment data when switching context
A doctor who also owns a clinic runs two environments, and a subscription
belongs to an environment, not to the user. The panel treated it as the
user's: the subscription query was keyed ['subscription-my'] with no
context, and switching environments never touched the react-query cache. So
upgrading the clinic left the personal practice showing the clinic's plan
with its feature-gated menu items unlocked, and vice versa.

The query key now carries the active dbUuid, and the context switch clears
the whole cache — every cached response belongs to the environment it was
fetched in, not just this one.

The API was already correct: DualEnvironmentSubscriptionTest pins that
granting one environment leaves the other on free.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:15:56 +03:30
hamedandClaude Opus 5 5548d6248c chore(graph): update knowledge graph after owned-entity fix
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:08:11 +03:30
hamedandClaude Opus 5 32044c8fa9 fix(subscription): read the subscription of the environment the user owns
A user who is both a doctor and a clinic owner always resolved to the
doctor: SubscriptionController had its own role-first resolveEntity, and
ownedEntity() returned the doctor whenever one existed. So a subscription
granted to that user's clinic was stored correctly but never surfaced —
/subscription/my kept reporting the free plan and the panel kept the
feature-gated menu items locked.

ownedEntity() now disambiguates with the active context when the user owns
both environments, and the controller delegates to it instead of re-deriving
the pair from roles. Payment already used ownedEntity(), so display, purchase
and admin grant now agree on one environment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 22:07:56 +03:30
hamedandClaude Opus 5 b81cb8a90e chore(graph): update knowledge graph after subscription revoke
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 21:59:36 +03:30
hamedandClaude Opus 5 a1584c3296 feat(subscription): allow admin to delete a granted subscription
Granting stacks a new row and extends the existing expiry, so a mistaken
grant had no way back: the report tab was read-only and no endpoint deleted
a subscription (only DELETE .../subscription/period/{uuid}, a different
resource).

Adds DELETE /api/v1/admin/subscription/{uuid}. Payment-backed subscriptions
are refused with 409 — deleting one would leave the sales report with a
payment that owns nothing; refunds are the correct path there.

The report tab gets a per-row delete with a confirm dialog, plus a button
that jumps to the grant tab so add and remove live in the same place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 21:59:12 +03:30
hamedandClaude Opus 5 5eb3bd586f chore(graph): update knowledge graph after copy tone pass
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 15:13:40 +03:30
hamedandClaude Opus 5 30b999872c refactor(public): unify site copy with the About page voice
The About page addresses the reader formally and speaks as "we"; the
landing pages used informal second-person singular ("تعریف می‌کنی") and
the home hero was a slogan. Both now match the About tone.

Landing copy: all informal verb forms and possessives converted to the
formal plural. Home: hero headline and lead rewritten as a plain
statement of what we built, plus small wording passes on the devices,
specialties and stats blocks.

The home-page smoke assertion follows the new headline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 15:13:24 +03:30
hamedandClaude Opus 5 a2ff69ebad chore(graph): update knowledge graph after about page
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 14:54:28 +03:30
hamedandClaude Opus 5 1ca20b6f53 feat(public): add About Us page
Adds a public "درباره ما" page at /درباره-ما reusing the landing theme
(same webpack entry, header, footer, registration modal). Section ids
match the header anchors so the nav works on this page too.

The explicit route takes precedence over LandingController's catch-all
/{slug}, which is registered with priority -10.

Also links it from the header nav and footer quick links, and lists it
in sitemap.xml.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 14:54:06 +03:30
hamedandClaude Opus 5 40b1da64be fix(seo): shorten the footer and center the related-solutions cards
Every landing page was listed in the footer, so adding keyword clusters made
that one column taller than the rest of the footer put together. It now lists
six — the head terms and the two biggest specialties — and the rest stay
reachable through the "other solutions" block each page already renders.

That trade only holds if nothing falls out of the link graph, so the old test
asserting "the footer links to every page" is replaced by one that walks the
related-page graph from the footer links and fails when any page is not
reachable. Physiotherapy was the one page that would have been orphaned; the
polyclinic page now links to it.

The related-solutions heading said "for your trade", which reads oddly for the
clinics it is addressing, and its cards were left-aligned in a centered
section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 18:26:59 +03:30
hamedandClaude Opus 5 8e4bb3ca7b feat(seo): add eight landing pages for the clusters we had nothing for
Keyword research put the head demand on four phrases — clinic management
software, doctor's office software, online booking, and the price/comparison
questions that precede a purchase — and we only had a page for one of them.
The new pages cover the head terms (clinic management, online booking), the
buying intent (price, how to choose, download), the positioning that separates
a hosted product from the installed ones that dominate these results (web
based, no install), and two long-tails where competition is thin (clinic
accounting, psychology practice).

The download page deliberately answers the intent rather than the wording:
someone searching for an installer wants to try something without paying, and
the page gives them that while explaining why there is nothing to install.

Copy is written per page rather than templated — eight pages saying the same
thing in different words is duplicate content, and every claim on them maps to
something the product actually does. Internal links from the older pages were
repointed at the new head-term pages, and the registry tests no longer hardcode
the page count: they now assert that every declared slug has a page, and that
titles, headings and descriptions stay unique.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 18:16:58 +03:30
hamedandClaude Opus 5 6e3d574e38 fix(session): show and keep the doctor's insurance when editing an encounter
The encounter edit form asked for contracts in the panel's own environment, so
inside a clinic it got an empty list: no insurance to choose, and the one
already recorded on the encounter had no matching option to display. It now
scopes the request by the encounter's doctor, the same way the confirm modal
does, which is why the session payload's existing doctor_uuid is threaded
through.

Saving the form had the matching defect on the server. Recalculating the totals
looked up the coverage percentage against the record's tenant rather than the
contract's, so a single save on a correctly-billed encounter zeroed the
insurance share and moved the whole amount back onto the patient.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 17:56:57 +03:30
hamedandClaude Opus 5 4f76cff503 fix(billing): bill the insurance share on clinic appointments
The invoice and the encounter belong to the clinic, but the contract sits on
the doctor, so every coverage lookup asked the clinic, got nothing, and
resolved to zero percent. Three failures followed from that one wrong tenant:
the encounter charged the patient the full amount, the payment page showed a
balance the insurer owed, and — because no line carried an insurance share —
no claim was ever built, leaving the claims page empty.

Coverage now resolves through the same doctor-first-then-clinic rule the rest
of the insurance settings use, both when the encounter is created and when its
invoice lines are built.

Changing the insurance on an appointment also re-runs the encounter's shares.
Reception routinely confirms first and corrects the insurance afterwards, and
until now those shares stayed frozen at whatever the first calculation said.
Recorded payments are untouched; only the payable amount moves, so an
overpayment simply clamps the remainder at zero. The PATCH response also
returns the appointment's real venue now, matching GET.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 17:37:44 +03:30
hamedandClaude Opus 5 b24f45cc83 fix(insurance): read a doctor's own settings first, then their clinic's
A clinic owner configures insurance on the doctor (`doctor_uuid`), but an
appointment booked at the clinic belongs to the clinic — so at confirm time
the engine looked for contracts under the clinic, found none, and the operator
had no insurance to pick and no way to save one ("this insurance has no active
contract"). The two sides were writing and reading different tenants.

Contracts, service kinds and the visit price now resolve doctor-first with the
appointment's clinic as fallback, each judged separately: a doctor who holds
their own contracts but leaves the visit price to the clinic gets each from the
right place. The confirm modal asks the same question the engine answers, via
`inherit=1` on the two read endpoints; the settings pages deliberately do not
send it, since editing must target the doctor's own row.

Two further things came out of the same sweep. The service-kind settings
repository had the tenant-filter blindness already fixed for contracts and
pricing — reads pinned to the caller's environment while the target is another
tenant — so it is now exempted the same way. And a coverage percentage of zero
is accepted as a real choice meaning "this contract does not cover that service
kind"; what is still rejected is leaving an enabled kind with no percentage at
all, inheriting a central default of zero included.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 17:18:35 +03:30
hamedandClaude Opus 5 1f64b516d2 fix(insurance): let a clinic owner save the visit price of a member doctor
The pricing rows are keyed by the *target* tenant, but the tenant filter pins
every read to the environment of whoever is asking. A clinic owner setting the
free-visit price for one of their doctors was therefore blind to the row that
already existed: each save inserted another one — the unique key does not stop
it, because insurance_id is NULL for the free-visit row and MySQL does not treat
NULLs as equal — and the following read was blind in the same way, so the panel
kept showing the old value. From the outside it simply looked like the field
would not save.

Reads now run outside the filter, the same exception the tenant-insurance
repository already makes for the same reason, with authorization still coming
from resolveTargetEntity(). findOneForInsurance() takes the newest row so a
tenant that already accumulated duplicates converges on the last value the user
entered, and a migration collapses those leftovers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 16:52:04 +03:30
hamedandClaude Opus 5 5d2594ff87 feat(privacy): keep venue phone numbers out of every public response
A doctor's office number sat next to the address on the public profile and in
the anonymous API payload, so harvesting the phone number of every practice in
the country was one unauthenticated request away. Street address and map
coordinates stay public — a patient needs those to find the place — but the
phone is now opt-in per caller: DoctorAddress::toArray() and the clinic
serializers only emit it when told to, and the public doctor/clinic endpoints
tell them to only when the caller may edit that profile (the same can_edit they
already compute). Owner-facing address CRUD keeps returning it unchanged.

The patient still gets the number where it is actually useful — their own
appointment. That payload also stops guessing: it used to serialise the
doctor's *first* address, so a booking made at the clinic or at a second office
showed the wrong street entirely. It now resolves the address recorded on the
appointment itself, which works the same for a personal office and a clinic
branch, and falls back to the clinic's own number when the address has none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 16:31:52 +03:30
hamedandClaude Opus 5 8a43297e24 test: remove the two real sources of full-run flakiness, and the mock notices
createUser() drew a random mobile and recovered from a collision by catching
the unique-constraint violation and calling resetManager(). That hands back a
brand-new EntityManager, which detaches every entity the running test had
built so far; its next flush died with "Multiple non-persisted new entities
were found", always in a different test and never reproducible in isolation.
The number is now checked before the insert, so the collision never reaches
the database and the manager stays open.

testParentIdAddsNoQueryPerSpecialty counted queries on the first request of
each size, so one-shot per-process caches — site config, subscription plan,
Doctrine metadata — landed inside the count or not depending on which tests
had run before it. Both requests are now warmed first; the assertion measures
steady-state growth, which is what it was always about.

The 23 PHPUnit notices were all one complaint: doubles created with
createMock() that never had an expectation. The ones that only stub return
values became createStub(); in SmsServiceLookupOnlyTest the provider and the
bus got the expectations they were missing, since "dispatch does not touch
the provider" and "sendNow does not enqueue" are exactly what that suite is
there to prove.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 09:57:29 +03:30
hamedandClaude Opus 5 ed2d2ec74a fix(blog): order every blog list by id as well as created_at
created_at is a second-resolution integer, so dozens of posts routinely share
one value and MySQL is free to return tied rows in any order. Two consecutive
pages of the same list could hand back one post twice and never show another,
and the admin-list tests failed at random on whichever post got shuffled past
the page boundary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 08:43:11 +03:30
hamedandClaude Opus 5 5986fad5a1 fix(logs): resolve the five real defects surfaced by app_log
TenantInsurance reads ran through the tenant filter, which pins every query
to the *requesting* user's environment. A clinic owner managing a doctor's
contracts therefore read an empty set, recomputed version 1, and hit
`uniq_tenant_insurance_version` on insert. The reads now bypass the filter —
authorization is already established by resolveTargetEntity(), and the
uuid-based paths re-assert ownership after loading.

UserActiveContext::upsert() raced with itself: the panel fires several
/oauth/userinfo requests at once, all saw no row, all inserted, and the
losers died on a duplicate PRIMARY (closing the EntityManager with them).
Replaced with INSERT ... ON DUPLICATE KEY UPDATE.

A service that carries a treatment protocol but no catalog category is bad
catalog data, not a system failure; it was logged at error level on every
confirm and buried the real errors. Now a warning carrying the service id.

Kavenegar's HTTP 431 says only "malformed request". The provider's own
message and the token slot names are now logged so the template can actually
be fixed in the panel; token values stay out of the log.

Redis DSNs gained timeout/retry_interval/tcp_keepalive so a brief connection
loss reconnects quietly instead of logging a warning each time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 08:31:15 +03:30
hamed 57ea7b8c59 Refactor code structure for improved readability and maintainability 2026-08-18 08:03:40 +03:30
hamed 1d13212d47 Add AST cache for ApiLeastPrivilegeTest.php with nodes and edges 2026-08-11 09:40:37 +03:30
hamed 2459625c41 feat(tenant): implement tenant filter scope to manage cross-tenant data visibility 2026-08-10 16:22:00 +03:30
hamed ee2682e222 feat(landing): update meta titles for landing pages and enhance FAQ section layout 2026-08-10 15:01:40 +03:30
244 changed files with 37083 additions and 7682 deletions
+3 -1
View File
@@ -17,7 +17,9 @@
# Replace mariadb-XXXXXXXX / redis-XXXXXXXX with the real hostname shown on each # Replace mariadb-XXXXXXXX / redis-XXXXXXXX with the real hostname shown on each
# resource's page (Internal URL). serverVersion MUST match the MariaDB resource (11.8). # resource's page (Internal URL). serverVersion MUST match the MariaDB resource (11.8).
DATABASE_URL="mysql://clinic:DB_PASSWORD@mariadb-XXXXXXXX:3306/clinic_pro?serverVersion=mariadb-11.8.0&charset=utf8mb4" DATABASE_URL="mysql://clinic:DB_PASSWORD@mariadb-XXXXXXXX:3306/clinic_pro?serverVersion=mariadb-11.8.0&charset=utf8mb4"
REDIS_URL="redis://redis-XXXXXXXX:6379" # retry_interval/tcp_keepalive: قطع کوتاه اتصال به redis بی‌سروصدا دوباره برقرار می‌شود
# و «Connection lost» به‌صورت warning در app_log نمی‌نشیند.
REDIS_URL="redis://redis-XXXXXXXX:6379?timeout=5&read_timeout=5&retry_interval=100&tcp_keepalive=60"
# stream_max_entries caps the Redis stream so the queue cannot grow without bound # stream_max_entries caps the Redis stream so the queue cannot grow without bound
MESSENGER_TRANSPORT_DSN="redis://redis-XXXXXXXX:6379/messages?stream_max_entries=20000" MESSENGER_TRANSPORT_DSN="redis://redis-XXXXXXXX:6379/messages?stream_max_entries=20000"
# If the Redis resource has a password: redis://:PASSWORD@redis-XXXXXXXX:6379 # If the Redis resource has a password: redis://:PASSWORD@redis-XXXXXXXX:6379
+3 -1
View File
@@ -31,7 +31,9 @@ MESSENGER_TRANSPORT_DSN=redis://redis:6379/messages
###< symfony/messenger ### ###< symfony/messenger ###
###> Redis ### ###> Redis ###
REDIS_URL=redis://redis:6379 # retry_interval/tcp_keepalive: قطع کوتاه اتصال به redis بی‌سروصدا دوباره برقرار می‌شود
# و «Connection lost» به‌صورت warning در app_log نمی‌نشیند.
REDIS_URL=redis://redis:6379?timeout=5&read_timeout=5&retry_interval=100&tcp_keepalive=60
###< Redis ### ###< Redis ###
###> Auth ### ###> Auth ###
+3 -1
View File
@@ -22,7 +22,9 @@ JWT_PASSPHRASE= # openssl rand -hex 32 (JWT keypair is generated with i
# put both + this app on the SAME private network, then copy their private hosts here. # put both + this app on the SAME private network, then copy their private hosts here.
# serverVersion MUST match the MariaDB service (11.8). # serverVersion MUST match the MariaDB service (11.8).
DATABASE_URL="mysql://<user>:<pass>@<db-private-host>:3306/<db>?serverVersion=mariadb-11.8.0&charset=utf8mb4" DATABASE_URL="mysql://<user>:<pass>@<db-private-host>:3306/<db>?serverVersion=mariadb-11.8.0&charset=utf8mb4"
REDIS_URL="redis://<redis-private-host>:6379" # retry_interval/tcp_keepalive: قطع کوتاه اتصال به redis بی‌سروصدا دوباره برقرار می‌شود
# و «Connection lost» به‌صورت warning در app_log نمی‌نشیند.
REDIS_URL="redis://<redis-private-host>:6379?timeout=5&read_timeout=5&retry_interval=100&tcp_keepalive=60"
MESSENGER_TRANSPORT_DSN="redis://<redis-private-host>:6379/messages" MESSENGER_TRANSPORT_DSN="redis://<redis-private-host>:6379/messages"
# If the Redis service has a password: redis://:<pass>@<redis-private-host>:6379 # If the Redis service has a password: redis://:<pass>@<redis-private-host>:6379
+7 -2
View File
@@ -74,10 +74,15 @@ function percentsToStrings(map?: Record<string, number>): Record<string, string>
return Object.fromEntries(Object.entries(map ?? {}).map(([k, v]) => [k, String(v)])); return Object.fromEntries(Object.entries(map ?? {}).map(([k, v]) => [k, String(v)]));
} }
/** درصد پوششِ قابل ثبت: عددی بین ۱ تا ۱۰۰ — صفر یعنی قرارداد آن نوع خدمت را پوشش نمی‌دهد. */ /**
* درصد پوششِ قابل ثبت: عددی بین ۰ تا ۱۰۰.
*
* صفر مقدار معتبری است و یعنی «این قرارداد آن نوع خدمت را پوشش نمی‌دهد» — سهم بیمار
* صددرصد. آنچه رد می‌شود خالی‌ماندنِ فیلد است، نه صفر بودنش.
*/
export function isValidPercent(raw?: string): boolean { export function isValidPercent(raw?: string): boolean {
const n = Number(raw); const n = Number(raw);
return raw !== undefined && raw !== '' && Number.isFinite(n) && n > 0 && n <= 100; return raw !== undefined && raw !== '' && Number.isFinite(n) && n >= 0 && n <= 100;
} }
/** /**
@@ -28,6 +28,8 @@ export interface SessionCardData {
base_insurance_discount_percent?: number; base_insurance_discount_percent?: number;
supplementary_discount_percent?: number; supplementary_discount_percent?: number;
doctor_name?: string | null; doctor_name?: string | null;
/** پزشکِ نوبتِ این مراجعه — محدودهٔ قرارداد بیمه از روی او حل می‌شود. */
doctor_uuid?: string | null;
final_price_rials?: number; final_price_rials?: number;
// تفکیک بیمه — سرور محاسبه می‌کند (PatientSession::applyShares) // تفکیک بیمه — سرور محاسبه می‌کند (PatientSession::applyShares)
gross_total_rials?: number; gross_total_rials?: number;
@@ -41,6 +41,7 @@ interface AppointmentLike {
insurance_service_category?: string | null; insurance_service_category?: string | null;
insurance_base_id?: number | null; insurance_base_id?: number | null;
insurance_supplementary_id?: number | null; insurance_supplementary_id?: number | null;
doctor?: { uuid?: string | null } | null;
} }
interface Props { interface Props {
@@ -159,7 +160,7 @@ export default function ConfirmAppointmentModal({
const appt: AppointmentLike | null = detail ?? appointment ?? null; const appt: AppointmentLike | null = detail ?? appointment ?? null;
// ── بیمه: نوع خدمت + بیمهٔ پایهٔ نوبت ────────────────────────────────────── // ── بیمه: نوع خدمت + بیمهٔ پایهٔ نوبت ──────────────────────────────────────
const insurance = useAppointmentInsurance(open); const insurance = useAppointmentInsurance(open, appt?.doctor?.uuid ?? null);
// نوبتِ بدون هزینهٔ ویزیت، سرِ ساختِ مراجعه «قیمت ویزیت آزاد» تنظیمات را می‌گیرد؛ // نوبتِ بدون هزینهٔ ویزیت، سرِ ساختِ مراجعه «قیمت ویزیت آزاد» تنظیمات را می‌گیرد؛
// مودال هم باید همان را نشان دهد، وگرنه صفر نشان می‌دهد و مبلغ ثبت‌شده فرق می‌کند. // مودال هم باید همان را نشان دهد، وگرنه صفر نشان می‌دهد و مبلغ ثبت‌شده فرق می‌کند.
@@ -72,7 +72,8 @@ describe('TurnsTimeline', () => {
it('نوبتِ دارای بیمه، چیپ «نوع خدمت · بیمه» نشان می‌دهد', async () => { it('نوبتِ دارای بیمه، چیپ «نوع خدمت · بیمه» نشان می‌دهد', async () => {
(api.get as ReturnType<typeof vi.fn>).mockImplementation((url: string) => (api.get as ReturnType<typeof vi.fn>).mockImplementation((url: string) =>
url === '/api/v1/billing/tenant-insurances' // با پزشکِ نوبت، آدرس `?doctor_uuid=…&inherit=1` هم می‌گیرد.
url.startsWith('/api/v1/billing/tenant-insurances')
? Promise.resolve({ success: true, data: { data: [{ ? Promise.resolve({ success: true, data: { data: [{
insurance_id: 3, insurance_name: 'بیمه ایران', insurance_kind: 'basic', is_active: true, insurance_id: 3, insurance_name: 'بیمه ایران', insurance_kind: 'basic', is_active: true,
coverage_percent: 70, franchise_percent: 0, annual_ceiling_rials: null, coverage_percent: 70, franchise_percent: 0, annual_ceiling_rials: null,
@@ -108,7 +108,7 @@ function OccupiedCard({
const [confirmOpen, setConfirmOpen] = useState(false); const [confirmOpen, setConfirmOpen] = useState(false);
// نام بیمه فقط با نگاشت از قراردادهای کش‌شده به دست می‌آید؛ payload نوبت نامی ندارد // نام بیمه فقط با نگاشت از قراردادهای کش‌شده به دست می‌آید؛ payload نوبت نامی ندارد
// تا لیست‌های نوبت به N+1 نیفتند. // تا لیست‌های نوبت به N+1 نیفتند.
const insurance = useAppointmentInsurance(!!a.insurance_base_id); const insurance = useAppointmentInsurance(!!a.insurance_base_id, a.doctor_uuid ?? null);
const insuranceChip = [ const insuranceChip = [
a.insurance_service_category_label, a.insurance_service_category_label,
insurance.insuranceNameOf(a.insurance_base_id), insurance.insuranceNameOf(a.insurance_base_id),
+11 -2
View File
@@ -105,11 +105,20 @@ export default function CreateStep({ recordUuid, profile, onCreated, onCancel, e
const { data: packagesData } = useQuery<ApiResponse<PackageRow[]>>({ const { data: packagesData } = useQuery<ApiResponse<PackageRow[]>>({
queryKey: ['inventory-packages'], queryFn: () => api.get('/api/v1/inventory-packages'), queryKey: ['inventory-packages'], queryFn: () => api.get('/api/v1/inventory-packages'),
}); });
// مراجعهٔ برخاسته از نوبت، قراردادِ پزشکِ همان نوبت را دارد نه قراردادِ محیط پنل:
// در کلینیک، قرارداد روی خودِ پزشک ثبت می‌شود و بدون این محدوده، فهرست بیمه‌ها
// خالی می‌آمد و بیمهٔ ثبت‌شدهٔ همان مراجعه هم در فرم پیدا نمی‌شد.
const insuranceScope = editSession?.doctor_uuid
? `?doctor_uuid=${encodeURIComponent(editSession.doctor_uuid)}&inherit=1`
: '';
const { data: contractsData } = useQuery<{ data: { data: Contract[] } }>({ const { data: contractsData } = useQuery<{ data: { data: Contract[] } }>({
queryKey: ['tenant-insurances'], queryFn: () => api.get('/api/v1/billing/tenant-insurances'), queryKey: ['tenant-insurances', editSession?.doctor_uuid ?? null],
queryFn: () => api.get(`/api/v1/billing/tenant-insurances${insuranceScope}`),
}); });
const { data: pricingData } = useQuery<{ data: { free_visit_price_rials: number; require_visit_price: boolean } }>({ const { data: pricingData } = useQuery<{ data: { free_visit_price_rials: number; require_visit_price: boolean } }>({
queryKey: ['insurance-pricing'], queryFn: () => api.get('/api/v1/insurance-pricing'), queryKey: ['insurance-pricing', editSession?.doctor_uuid ?? null],
queryFn: () => api.get(`/api/v1/insurance-pricing${insuranceScope}`),
}); });
const freeVisit = (pricingData as any)?.data?.free_visit_price_rials ?? 0; const freeVisit = (pricingData as any)?.data?.free_visit_price_rials ?? 0;
const requireVisit = (pricingData as any)?.data?.require_visit_price ?? false; const requireVisit = (pricingData as any)?.data?.require_visit_price ?? false;
+12 -5
View File
@@ -22,16 +22,23 @@ interface PricingPayload {
* به‌همراه محاسبهٔ سهم — مشترک بین مودال «قطعی کردن نوبت» و صفحهٔ ویرایش نوبت تا * به‌همراه محاسبهٔ سهم — مشترک بین مودال «قطعی کردن نوبت» و صفحهٔ ویرایش نوبت تا
* هر دو یک قاعده را نشان دهند. * هر دو یک قاعده را نشان دهند.
*/ */
export function useAppointmentInsurance(enabled: boolean) { export function useAppointmentInsurance(enabled: boolean, doctorUuid?: string | null) {
// بدون پزشک، محیطِ خودِ کاربر پرسیده می‌شود — همان رفتار قبلی برای مطب شخصی.
//
// با پزشک، `inherit=1` هم می‌رود: نوبتِ ثبت‌شده در کلینیک محیطش «کلینیک» است ولی
// قرارداد بیمه معمولاً روی خودِ پزشک ذخیره شده. سرور اول تنظیم پزشک را می‌دهد و
// در نبودش تنظیم کلینیک را — دقیقاً همان چیزی که سرِ قطعی‌کردن اعمال می‌شود.
const scopeQuery = doctorUuid ? `?doctor_uuid=${encodeURIComponent(doctorUuid)}&inherit=1` : '';
const pricingQuery = useQuery<ApiResponse<PricingPayload>>({ const pricingQuery = useQuery<ApiResponse<PricingPayload>>({
queryKey: ['insurance-pricing'], queryKey: ['insurance-pricing', doctorUuid ?? null],
queryFn: () => api.get('/api/v1/insurance-pricing'), queryFn: () => api.get(`/api/v1/insurance-pricing${scopeQuery}`),
enabled, enabled,
}); });
const contractsQuery = useQuery<ApiResponse<{ data: TenantContract[] }>>({ const contractsQuery = useQuery<ApiResponse<{ data: TenantContract[] }>>({
queryKey: ['tenant-insurances'], queryKey: ['tenant-insurances', doctorUuid ?? null],
queryFn: () => api.get('/api/v1/billing/tenant-insurances'), queryFn: () => api.get(`/api/v1/billing/tenant-insurances${scopeQuery}`),
enabled, enabled,
}); });
@@ -0,0 +1,74 @@
import React from 'react';
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { renderHook, waitFor } from '@testing-library/react';
import { QueryClientProvider } from '@tanstack/react-query';
import { makeClient } from '../test/utils';
import { useAuthStore } from '../stores/authStore';
vi.mock('../lib/api', () => ({
api: { get: vi.fn() },
}));
import { api } from '../lib/api';
import { useSubscription } from './useSubscription';
const get = api.get as ReturnType<typeof vi.fn>;
const initial = useAuthStore.getInitialState();
function planResponse(name: string) {
return {
success: true,
data: {
subscription: null,
used_trial: false,
effective_plan: { name, features: { patient_records: name !== 'free' }, max_secretaries: 1, max_resources: 1 },
},
};
}
beforeEach(() => {
localStorage.clear();
useAuthStore.setState(initial, true);
get.mockReset();
});
describe('useSubscription', () => {
/**
* پزشکی که هم مطب شخصی دارد و هم کلینیک، دو محیط دارد و اشتراک روی محیط می‌نشیند.
* با کلیدِ بدون محیط، پاسخِ cache شدهٔ محیط قبلی در محیط تازه سرو می‌شد و هر دو
* محیط ارتقایافته به‌نظر می‌رسیدند.
*/
it('پاسخِ cache شدهٔ محیط دیگر را سرو نمی‌کند', async () => {
const client = makeClient();
const wrapper = ({ children }: { children: React.ReactNode }) => (
<QueryClientProvider client={client}>{children}</QueryClientProvider>
);
// محیط کلینیک از قبل در cache نشسته است.
client.setQueryData(['subscription-my', 'clinic-1'], planResponse('professional'));
useAuthStore.setState({ primaryRole: 'doctor', dbUuid: 'doctor-1' });
get.mockResolvedValue(planResponse('free'));
const { result } = renderHook(() => useSubscription(), { wrapper });
await waitFor(() => expect(result.current.planLoaded).toBe(true));
expect(result.current.hasFeature('patient_records')).toBe(false);
expect(get).toHaveBeenCalledWith('/api/v1/subscription/my');
});
it('در همان محیط، پاسخِ cache شده دوباره درخواست نمی‌شود', async () => {
const client = makeClient();
const wrapper = ({ children }: { children: React.ReactNode }) => (
<QueryClientProvider client={client}>{children}</QueryClientProvider>
);
client.setQueryData(['subscription-my', 'clinic-1'], planResponse('professional'));
useAuthStore.setState({ primaryRole: 'clinic', dbUuid: 'clinic-1' });
const { result } = renderHook(() => useSubscription(), { wrapper });
await waitFor(() => expect(result.current.hasFeature('patient_records')).toBe(true));
expect(get).not.toHaveBeenCalled();
});
});
+5 -1
View File
@@ -6,10 +6,14 @@ import type { MySubscriptionData } from '../types';
export function useSubscription() { export function useSubscription() {
const primaryRole = useAuthStore((s) => s.primaryRole); const primaryRole = useAuthStore((s) => s.primaryRole);
const dbUuid = useAuthStore((s) => s.dbUuid);
const enabled = primaryRole === 'doctor' || primaryRole === 'clinic' || primaryRole === 'secretary'; const enabled = primaryRole === 'doctor' || primaryRole === 'clinic' || primaryRole === 'secretary';
// کلید شامل محیط فعال است: اشتراک روی محیط می‌نشیند، نه روی کاربر. پزشکی که هم
// مطب شخصی دارد و هم کلینیک، با کلیدِ بدون محیط پلنِ محیط قبلی را می‌دید و هر دو
// محیط ارتقایافته به‌نظر می‌رسیدند.
const { data } = useQuery<ApiResponse<MySubscriptionData>>({ const { data } = useQuery<ApiResponse<MySubscriptionData>>({
queryKey: ['subscription-my'], queryKey: ['subscription-my', dbUuid],
queryFn: () => api.get('/api/v1/subscription/my'), queryFn: () => api.get('/api/v1/subscription/my'),
enabled, enabled,
staleTime: 2 * 60 * 1000, staleTime: 2 * 60 * 1000,
@@ -14,6 +14,7 @@ import AdminSubscriptionPage from './AdminSubscriptionPage';
const get = api.get as ReturnType<typeof vi.fn>; const get = api.get as ReturnType<typeof vi.fn>;
const patch = api.patch as ReturnType<typeof vi.fn>; const patch = api.patch as ReturnType<typeof vi.fn>;
const post = api.post as ReturnType<typeof vi.fn>; const post = api.post as ReturnType<typeof vi.fn>;
const del = api.delete as ReturnType<typeof vi.fn>;
const PLANS = [ const PLANS = [
{ {
@@ -213,7 +214,27 @@ describe('AdminSubscriptionPage — اعطای اشتراک', () => {
}); });
describe('AdminSubscriptionPage — گزارش', () => { describe('AdminSubscriptionPage — گزارش', () => {
beforeEach(() => { get.mockReset(); post.mockReset(); }); beforeEach(() => { get.mockReset(); post.mockReset(); del.mockReset(); });
/** یک ردیف گزارشِ اعطایی — تست‌های حذف و ناوبری از همین استفاده می‌کنند. */
function mockReportRow() {
get.mockImplementation((url: string) => {
if (url.includes('/admin/subscription/plans')) return Promise.resolve({ success: true, data: PLANS });
if (url.includes('/admin/subscription/report')) {
return Promise.resolve({
success: true,
meta: { totalRecords: 1 },
data: [{
uuid: 's-1', entityType: 'clinic', entityId: 11, entityName: 'کلینیک نمونه',
isTrial: false, isGranted: true, grantedBy: 'ادمین',
startsAt: 1700000000, expiresAt: 1800000000, createdAt: 1700000000,
plan_name: 'professional', plan_level: 2,
}],
});
}
return Promise.resolve({ success: true, data: [], meta: { totalRecords: 0 } });
});
}
it('اشتراک اعطایی را «اعطایی» نشان می‌دهد، نه «پولی»', async () => { it('اشتراک اعطایی را «اعطایی» نشان می‌دهد، نه «پولی»', async () => {
get.mockImplementation((url: string) => { get.mockImplementation((url: string) => {
@@ -241,4 +262,27 @@ describe('AdminSubscriptionPage — گزارش', () => {
expect(screen.getByText('ادمین')).toBeInTheDocument(); expect(screen.getByText('ادمین')).toBeInTheDocument();
expect(screen.queryByText('پولی')).not.toBeInTheDocument(); expect(screen.queryByText('پولی')).not.toBeInTheDocument();
}); });
it('حذف اشتراک پس از تأیید، DELETE می‌فرستد', async () => {
mockReportRow();
del.mockResolvedValue({ success: true, data: null });
renderWithProviders(<AdminSubscriptionPage />, { route: '/admin/admin-subscription' });
fireEvent.click(await screen.findByText('گزارش فروش'));
fireEvent.click(await screen.findByLabelText('حذف اشتراک کلینیک نمونه'));
fireEvent.click(await screen.findByRole('button', { name: 'حذف' }));
await waitFor(() => expect(del).toHaveBeenCalledWith('/api/v1/admin/subscription/s-1'));
});
it('دکمهٔ اعطای اشتراک از گزارش به تب اعطا می‌برد', async () => {
mockReportRow();
renderWithProviders(<AdminSubscriptionPage />, { route: '/admin/admin-subscription' });
fireEvent.click(await screen.findByText('گزارش فروش'));
fireEvent.click(await screen.findByRole('button', { name: /اعطای اشتراک جدید/ }));
expect(await screen.findByText(/پلن و دوره/)).toBeInTheDocument();
});
}); });
+43 -2
View File
@@ -626,8 +626,10 @@ function GrantTab() {
// ── Report tab ──────────────────────────────────────────────────────────── // ── Report tab ────────────────────────────────────────────────────────────
function ReportTab() { function ReportTab({ onAdd }: { onAdd: () => void }) {
const qc = useQueryClient();
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [deleteRow, setDeleteRow] = useState<ReportRow | null>(null);
const limit = 20; const limit = 20;
const { data, isLoading } = useQuery({ const { data, isLoading } = useQuery({
@@ -635,11 +637,27 @@ function ReportTab() {
queryFn: () => api.get<PaginatedResponse<ReportRow>>(`/api/v1/admin/subscription/report?page=${page}&limit=${limit}`), queryFn: () => api.get<PaginatedResponse<ReportRow>>(`/api/v1/admin/subscription/report?page=${page}&limit=${limit}`),
}); });
const deleteMut = useMutation({
mutationFn: (uuid: string) => api.delete(`/api/v1/admin/subscription/${uuid}`),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['admin-subscription-report'] });
qc.invalidateQueries({ queryKey: ['admin-grant-active'] });
setDeleteRow(null);
toast.success('اشتراک حذف شد');
},
onError: (e: any) => { setDeleteRow(null); toast.error(e.message); },
});
const rows: ReportRow[] = data?.data ?? []; const rows: ReportRow[] = data?.data ?? [];
const total = data?.meta?.totalRecords ?? 0; const total = data?.meta?.totalRecords ?? 0;
return ( return (
<div className="card"> <div className="card">
<div className="card-pad" style={{ display: 'flex', justifyContent: 'flex-end', borderBottom: '1px solid var(--border)' }}>
<button type="button" className="btn primary" onClick={onAdd}>
<PlusIcon style={{ width: 15 }} /> اعطای اشتراک جدید
</button>
</div>
{isLoading ? ( {isLoading ? (
<div className="card-pad" style={{ color: 'var(--text-3)' }}>در حال بارگذاری...</div> <div className="card-pad" style={{ color: 'var(--text-3)' }}>در حال بارگذاری...</div>
) : rows.length === 0 ? ( ) : rows.length === 0 ? (
@@ -655,6 +673,7 @@ function ReportTab() {
<th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>شروع</th> <th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>شروع</th>
<th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>انقضا</th> <th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>انقضا</th>
<th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>تاریخ ثبت</th> <th style={{ textAlign: 'right', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>تاریخ ثبت</th>
<th style={{ textAlign: 'left', padding: '10px 16px', color: 'var(--text-3)', fontWeight: 500 }}>عملیات</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -689,6 +708,17 @@ function ReportTab() {
{row.expiresAt ? formatDate(row.expiresAt) : <span className="muted">بینهایت</span>} {row.expiresAt ? formatDate(row.expiresAt) : <span className="muted">بینهایت</span>}
</td> </td>
<td style={{ padding: '10px 16px', color: 'var(--text-3)' }}>{formatDate(row.createdAt)}</td> <td style={{ padding: '10px 16px', color: 'var(--text-3)' }}>{formatDate(row.createdAt)}</td>
<td style={{ padding: '10px 16px', textAlign: 'left' }}>
<button
type="button"
className="btn sm"
title="حذف اشتراک"
aria-label={`حذف اشتراک ${row.entityName ?? row.entityId}`}
onClick={() => setDeleteRow(row)}
>
<TrashIcon style={{ width: 13 }} />
</button>
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
@@ -698,6 +728,17 @@ function ReportTab() {
</div> </div>
</> </>
)} )}
<ConfirmDialog
open={!!deleteRow}
title="حذف اشتراک"
message={`آیا مطمئن هستید که می‌خواهید اشتراک «${deleteRow?.entityName ?? ''}» را حذف کنید؟ دسترسی این محیط به قابلیت‌های پلن قطع می‌شود.`}
confirmLabel="حذف"
danger
loading={deleteMut.isPending}
onConfirm={() => deleteRow && deleteMut.mutate(deleteRow.uuid)}
onCancel={() => setDeleteRow(null)}
/>
</div> </div>
); );
} }
@@ -722,7 +763,7 @@ export default function AdminSubscriptionPage() {
{tab === 'plans' && <PlansTab />} {tab === 'plans' && <PlansTab />}
{tab === 'grant' && <GrantTab />} {tab === 'grant' && <GrantTab />}
{tab === 'report' && <ReportTab />} {tab === 'report' && <ReportTab onAdd={() => setTab('grant')} />}
</> </>
); );
} }
+6
View File
@@ -92,6 +92,12 @@ export default function PaymentDetailPage() {
<InfoRow label="مبلغ" value={formatRial(payment.amount)} /> <InfoRow label="مبلغ" value={formatRial(payment.amount)} />
<InfoRow label="وضعیت" value={<StatusBadge type="payment" value={payment.status} />} /> <InfoRow label="وضعیت" value={<StatusBadge type="payment" value={payment.status} />} />
<InfoRow label="درگاه" value={<span className="uppercase">{payment.gateway}</span>} /> <InfoRow label="درگاه" value={<span className="uppercase">{payment.gateway}</span>} />
<InfoRow
label="مبدأ"
value={payment.origin
? <span dir="ltr" title={payment.frontend_address ?? undefined}>{payment.origin}</span>
: null}
/>
<InfoRow label="شماره مرجع" value={payment.ref_id ? <span dir="ltr" className="font-mono text-xs">{payment.ref_id}</span> : null} /> <InfoRow label="شماره مرجع" value={payment.ref_id ? <span dir="ltr" className="font-mono text-xs">{payment.ref_id}</span> : null} />
<InfoRow label="شماره کارت" value={payment.card_pan ? <span dir="ltr" className="font-mono text-xs">{payment.card_pan}</span> : null} /> <InfoRow label="شماره کارت" value={payment.card_pan ? <span dir="ltr" className="font-mono text-xs">{payment.card_pan}</span> : null} />
<InfoRow label="تاریخ پرداخت" value={formatDateTime(payment.paid_at)} /> <InfoRow label="تاریخ پرداخت" value={formatDateTime(payment.paid_at)} />
+48
View File
@@ -0,0 +1,48 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { screen, waitFor } from '@testing-library/react';
import { renderWithProviders } from '../test/utils';
const navigate = vi.fn();
vi.mock('react-router', async (orig) => ({
...(await orig<typeof import('react-router')>()),
useNavigate: () => navigate,
}));
vi.mock('../lib/api', () => ({ api: { get: vi.fn() }, ApiError: class extends Error {} }));
import { api } from '../lib/api';
import PaymentsPage from './PaymentsPage';
const get = api.get as ReturnType<typeof vi.fn>;
const ROWS = [
{ uuid: 'pay-1', amount: 1500000, status: 'success', gateway: 'mellat', ref_id: '99123',
origin: 'nobat724.com', patient_mobile: '09120000001', appointment_uuid: null,
paid_at: '2026-08-19T10:00:00+00:00', created_at: '2026-08-19T09:55:00+00:00' },
// پرداخت‌های قدیمی آدرس بازگشت ندارند و مبدأشان ناشناخته است.
{ uuid: 'pay-2', amount: 900000, status: 'failed', gateway: 'mellat', ref_id: null,
origin: null, patient_mobile: '09120000002', appointment_uuid: null,
paid_at: null, created_at: '2026-08-18T09:00:00+00:00' },
];
beforeEach(() => {
navigate.mockReset();
get.mockReset();
get.mockResolvedValue({ success: true, data: ROWS, meta: { totalRecords: 2, totalPages: 1, currentPage: 1 } });
});
describe('PaymentsPage (پرداخت‌های ادمین)', () => {
it('دامنهٔ مبدأ هر پرداخت را نشان می‌دهد', async () => {
renderWithProviders(<PaymentsPage />, { route: '/admin/payments' });
expect(await screen.findByText('nobat724.com')).toBeInTheDocument();
expect(screen.getByText('مبدأ')).toBeInTheDocument();
});
it('جستجو دامنه را هم به سرور می‌فرستد', async () => {
renderWithProviders(<PaymentsPage />, { route: '/admin/payments?search=nobat724.com' });
await waitFor(() =>
expect(get).toHaveBeenCalledWith(expect.stringContaining('search=nobat724.com')),
);
});
});
+8 -1
View File
@@ -75,6 +75,13 @@ export default function PaymentsPage() {
header: 'درگاه', header: 'درگاه',
render: (p) => <span className="chip" style={{ fontSize: 12 }}>{p.gateway}</span>, render: (p) => <span className="chip" style={{ fontSize: 12 }}>{p.gateway}</span>,
}, },
{
key: 'origin',
header: 'مبدأ',
render: (p) => p.origin
? <span className="chip" dir="ltr" style={{ fontSize: 12 }}>{p.origin}</span>
: <span className="muted"></span>,
},
{ {
key: 'ref_id', key: 'ref_id',
header: 'شماره مرجع', header: 'شماره مرجع',
@@ -142,7 +149,7 @@ export default function PaymentsPage() {
<div className="field" style={{ minWidth: 240 }}> <div className="field" style={{ minWidth: 240 }}>
<MagnifyingGlassIcon style={{ width: 17, height: 17 }} /> <MagnifyingGlassIcon style={{ width: 17, height: 17 }} />
<input <input
placeholder="جستجو بر اساس موبایل یا شماره مرجع..." placeholder="جستجو بر اساس موبایل، شماره مرجع یا دامنه..."
value={search} value={search}
onChange={(e) => { setSearch(e.target.value); setPage(1); }} onChange={(e) => { setSearch(e.target.value); setPage(1); }}
/> />
@@ -0,0 +1,48 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { QueryClientProvider } from '@tanstack/react-query';
import { MemoryRouter } from 'react-router';
import { makeClient } from '../test/utils';
import { useAuthStore } from '../stores/authStore';
import SelectContextPage from './SelectContextPage';
vi.mock('react-router', async () => {
const actual = await vi.importActual<typeof import('react-router')>('react-router');
return { ...actual, useNavigate: () => vi.fn() };
});
const initial = useAuthStore.getInitialState();
const CONTEXTS = [
{ db_uuid: 'doc-1', db_key: 'k1', type: 'doctor', role: 'doctor', name: 'مطب شخصی' },
{ db_uuid: 'clinic-1', db_key: 'k2', type: 'clinic', role: 'clinic', name: 'کلینیک تست' },
];
beforeEach(() => {
localStorage.clear();
useAuthStore.setState(initial, true);
useAuthStore.setState({ availableContexts: CONTEXTS as any, switchContext: vi.fn() as any });
});
describe('SelectContextPage', () => {
/**
* هر پاسخِ cache شده متعلق به محیط قبلی است. اشتراک روی محیط می‌نشیند، پس بدون
* پاک کردن cache، مطب شخصی پلن کلینیک را نشان می‌داد و برعکس.
*/
it('بعد از تعویض محیط، cache کوئری‌ها را پاک می‌کند', async () => {
const client = makeClient();
client.setQueryData(['subscription-my', 'doc-1'], { stale: true });
render(<SelectContextPage />, {
wrapper: ({ children }) => (
<QueryClientProvider client={client}>
<MemoryRouter>{children}</MemoryRouter>
</QueryClientProvider>
),
});
fireEvent.click(screen.getByText('کلینیک تست'));
await waitFor(() => expect(client.getQueryData(['subscription-my', 'doc-1'])).toBeUndefined());
});
});
+5
View File
@@ -1,5 +1,6 @@
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import { useState } from 'react'; import { useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import { useAuthStore, ContextItem } from '../stores/authStore'; import { useAuthStore, ContextItem } from '../stores/authStore';
const ROLE_LABELS: Record<string, string> = { const ROLE_LABELS: Record<string, string> = {
@@ -18,11 +19,15 @@ const TYPE_ICONS: Record<string, string> = {
export default function SelectContextPage() { export default function SelectContextPage() {
const { availableContexts, switchContext } = useAuthStore(); const { availableContexts, switchContext } = useAuthStore();
const navigate = useNavigate(); const navigate = useNavigate();
const qc = useQueryClient();
const [loading, setLoading] = useState<string | null>(null); const [loading, setLoading] = useState<string | null>(null);
const handleSelect = async (ctx: ContextItem) => { const handleSelect = async (ctx: ContextItem) => {
setLoading(ctx.db_uuid); setLoading(ctx.db_uuid);
await switchContext(ctx.db_uuid); await switchContext(ctx.db_uuid);
// هر پاسخِ cache‌شده متعلق به محیط قبلی است — از اشتراک و پلن گرفته تا بیماران و
// نوبت‌ها. بدون پاک کردن، محیط تازه داده و دسترسی‌های محیط قبلی را نشان می‌دهد.
qc.clear();
navigate('/admin/dashboard', { replace: true }); navigate('/admin/dashboard', { replace: true });
}; };
+4
View File
@@ -203,6 +203,10 @@ export interface Payment {
status: PaymentStatus; status: PaymentStatus;
gateway: PaymentGateway; gateway: PaymentGateway;
ref_id: string | null; ref_id: string | null;
/** دامنهٔ مبدأ پرداخت (سایت نوبت‌دهی یا پنل)، از آدرس بازگشت استخراج می‌شود. */
origin: string | null;
/** آدرس بازگشتِ کامل؛ فقط در جزئیات می‌آید. */
frontend_address?: string | null;
card_pan?: string | null; card_pan?: string | null;
refunds?: { amount: number; ref: string; at: number }[]; refunds?: { amount: number; ref: string; at: number }[];
patient_mobile: string; patient_mobile: string;
+7 -7
View File
@@ -10,12 +10,12 @@
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"ext-soap": "*", "ext-soap": "*",
"altcha-org/altcha": "^2.0", "altcha-org/altcha": "^2.1",
"doctrine/doctrine-bundle": ">=2.18.3", "doctrine/doctrine-bundle": ">=2.19.0",
"doctrine/doctrine-migrations-bundle": "*", "doctrine/doctrine-migrations-bundle": "*",
"doctrine/orm": "^3.6", "doctrine/orm": "^3.6.8",
"lexik/jwt-authentication-bundle": "*", "lexik/jwt-authentication-bundle": "*",
"nelmio/api-doc-bundle": "*", "nelmio/api-doc-bundle": ">=5.11.1",
"nelmio/cors-bundle": "*", "nelmio/cors-bundle": "*",
"symfony/asset": "7.4.*", "symfony/asset": "7.4.*",
"symfony/cache": "7.4.*", "symfony/cache": "7.4.*",
@@ -42,7 +42,7 @@
"symfony/webpack-encore-bundle": "^2.4.1", "symfony/webpack-encore-bundle": "^2.4.1",
"symfony/yaml": "7.4.*", "symfony/yaml": "7.4.*",
"twig/twig": ">=3.28", "twig/twig": ">=3.28",
"zircote/swagger-php": ">=6.4" "zircote/swagger-php": ">=6.6"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {
@@ -98,10 +98,10 @@
} }
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^2.2.5", "phpstan/phpstan": "^2.2.8",
"phpstan/phpstan-doctrine": "^2.0.28", "phpstan/phpstan-doctrine": "^2.0.28",
"phpstan/phpstan-symfony": "^2.0.20", "phpstan/phpstan-symfony": "^2.0.20",
"phpunit/phpunit": "^12.5.31", "phpunit/phpunit": "^12.5.33",
"symfony/browser-kit": "7.4.*", "symfony/browser-kit": "7.4.*",
"symfony/css-selector": "7.4.*", "symfony/css-selector": "7.4.*",
"symfony/debug-bundle": "7.4.*", "symfony/debug-bundle": "7.4.*",
Generated
+283 -283
View File
File diff suppressed because it is too large Load Diff
+9 -1
View File
@@ -654,7 +654,7 @@ List all payments.
### Query Parameters (تکمیل) ### Query Parameters (تکمیل)
| Param | Type | Required | Description | | Param | Type | Required | Description |
|-------|------|----------|-------------| |-------|------|----------|-------------|
| `search` | string | ❌ | جستجو در موبایل کاربر، `reference_id` یا `order_id` | | `search` | string | ❌ | جستجو در موبایل کاربر، `reference_id`، `order_id` یا دامنهٔ مبدأ |
### Response `200` ### Response `200`
```json ```json
@@ -667,6 +667,7 @@ List all payments.
"status": "success", "status": "success",
"gateway": "mellat", "gateway": "mellat",
"ref_id": "1234567", "ref_id": "1234567",
"origin": "nobat724.com",
"patient_mobile": "0912...", "patient_mobile": "0912...",
"paid_at": "2026-07-02T09:00:00+03:30", "paid_at": "2026-07-02T09:00:00+03:30",
"created_at": "2026-07-02T08:55:00+03:30" "created_at": "2026-07-02T08:55:00+03:30"
@@ -678,6 +679,11 @@ List all payments.
> `amount` بر حسب ریال، `ref_id` همان `reference_id` درگاه، `paid_at` فقط برای پرداخت `success` (بر اساس `updated_at`) و در غیر این‌صورت `null`. تاریخ‌ها ISO-8601. > `amount` بر حسب ریال، `ref_id` همان `reference_id` درگاه، `paid_at` فقط برای پرداخت `success` (بر اساس `updated_at`) و در غیر این‌صورت `null`. تاریخ‌ها ISO-8601.
> `origin` دامنهٔ مبدأ پرداخت است — از `frontend_address` (آدرس بازگشت) استخراج
> می‌شود، با حروف کوچک و بدون `www.`، تا یک دامنه در گزارش یک مقدار باشد. چند مبدأ
> به یک درگاه می‌روند: سایت‌های نوبت‌دهی شهری و پنل خودِ کلینیک‌پرو. پرداخت بدون آدرس
> بازگشت `null` می‌گیرد.
--- ---
### GET `/api/v1/admin/payments/{uuid}` ### GET `/api/v1/admin/payments/{uuid}`
@@ -698,6 +704,8 @@ List all payments.
"gateway": "mellat", "gateway": "mellat",
"type": "appointment", "type": "appointment",
"ref_id": "1234567", "ref_id": "1234567",
"origin": "nobat724.com",
"frontend_address": "https://nobat724.com/payment/result",
"card_pan": "502229******2928", "card_pan": "502229******2928",
"patient_mobile": "0912...", "patient_mobile": "0912...",
"patient_name": "علی احمدی", "patient_name": "علی احمدی",
+15 -1
View File
@@ -459,7 +459,15 @@ Get appointment detail.
} }
} }
``` ```
> `doctor.specialties` آرایه (ممکن است خالی)؛ `address` اولین آدرس پزشک است (ممکن است `null` اگر پزشک آدرسی ندارد). `address.map.latitude/longitude` رشته یا `null`. تاریخ‌ها Unix.
> ℹ️ تغییر بیمهٔ نوبت با `PATCH` سهم‌های مراجعهٔ همان نوبت را هم دوباره حساب می‌کند: پذیرش گاهی اول نوبت را قطعی می‌کند و بعد بیمه را اصلاح می‌کند، و بدون این، مراجعه روی محاسبهٔ اول می‌ماند و صفحهٔ پرداخت سهمِ بیمه را از بیمار می‌خواهد. پرداخت‌های ثبت‌شده دست نمی‌خورند؛ فقط مبلغ قابل‌پرداخت اصلاح می‌شود. پاسخ `PATCH` هم مثل `GET` نشانیِ واقعیِ نوبت را برمی‌گرداند.
> ️ `address` is the venue recorded on this appointment (`address_id`) — the doctor's own
> office or the clinic branch, whichever the booking was made at — and it is the only place
> `telephone` is returned. When that record carries no number, the clinic's own number takes
> its place. Public doctor and clinic responses never carry a phone number.
> `doctor.specialties` آرایه (ممکن است خالی)؛ `address` آدرسِ ثبت‌شدهٔ همین نوبت است و برای نوبت‌های قدیمیِ بدون `address_id` ممکن است `null` باشد. `address.map.latitude/longitude` رشته یا `null`. تاریخ‌ها Unix.
### انتخاب بیمهٔ نوبت ### انتخاب بیمهٔ نوبت
@@ -547,6 +555,12 @@ Get all appointments for the authenticated user.
**Permission:** `AUTH` — عمداً بدون مجوزِ رجیستری. **Permission:** `AUTH` — عمداً بدون مجوزِ رجیستری.
> **فیلتر محیط اینجا اعمال نمی‌شود.** رکورد در محیطِ پزشکِ مقصد ثبت می‌شود، ولی
> مالکش از راه `user_id` تعیین می‌شود. کاربری که خودش صاحب محیط دیگری است — پزشک،
> منشی، مالک کلینیک — با فیلترِ محیطِ خودش رکورد خودش را نمی‌دید و ۴۰۴ می‌گرفت.
> دورزدن فیلتر فقط از راه `App\Shared\Tenant\TenantFilterScope` انجام می‌شود و
> مجوز دست‌نخورده باقی می‌ماند.
> این اندپوینت `a.user = خودِ کاربر` را می‌دهد، یعنی نوبت‌های خودِ فرد **به‌عنوان > این اندپوینت `a.user = خودِ کاربر` را می‌دهد، یعنی نوبت‌های خودِ فرد **به‌عنوان
> بیمار**، نه دادهٔ محیط. مصرف‌کننده‌اش داشبورد بیمار در `nobat724_front` است. > بیمار**، نه دادهٔ محیط. مصرف‌کننده‌اش داشبورد بیمار در `nobat724_front` است.
> آدیت ۲۰۲۶-۰۸-۰۷ آن را در فهرست گَپ‌ها آورده بود؛ در ۲۰۲۶-۰۸-۰۸ مثبت کاذب تشخیص > آدیت ۲۰۲۶-۰۸-۰۷ آن را در فهرست گَپ‌ها آورده بود؛ در ۲۰۲۶-۰۸-۰۸ مثبت کاذب تشخیص
+7 -2
View File
@@ -150,7 +150,7 @@ limited to the whitelist under `PATCH /api/v1/clinic/{uuid}`.
"linkedin": null "linkedin": null
}, },
"caption": "توضیحات کلینیک", "caption": "توضیحات کلینیک",
"list_bime": [], "list_bime": [{ "uuid": "...", "id": "176", "name": "تامین اجتماعی", "logo_url": "/uploads/insurances/logo/2026-08/tamin.png" }],
"specialties": [{ "uuid": "...", "id": "1", "name": "قلب", "parent": null }], "specialties": [{ "uuid": "...", "id": "1", "name": "قلب", "parent": null }],
"services": [], "services": [],
"clinic_specialty": [{ "uuid": "...", "id": "1", "name": "قلب", "parent": null }], "clinic_specialty": [{ "uuid": "...", "id": "1", "name": "قلب", "parent": null }],
@@ -167,6 +167,11 @@ limited to the whitelist under `PATCH /api/v1/clinic/{uuid}`.
} }
``` ```
> `list_bime[].logo_url` مسیر نسبی روی همین API است (`/uploads/...`) و کلاینت باید آن را با دامنهٔ API کامل کند. بیمهٔ بدون لوگو `null` می‌گیرد، نه کلید غایب.
> 🔒 `phone`/`phone_number` are `null` unless the caller may edit the clinic (`can_edit: true`). The number is not public data; the patient sees the venue phone on their own appointment instead.
>
> `city`/`state`/`map`/`location`/`phone`/`phone_number` are all resolved from the clinic's **address** (`DoctorAddress` linked by `clinic_id`), not from columns on the clinic. `location` and `phone`/`phone_number` fall back to the deprecated `clinics.address` / `clinics.telephone` columns only when the address record has no value — reading them from different rows made one response describe two different places. Each is an array with a single object (or empty `[]` if the clinic has no address). `doctors` is a **count**; the actual doctor list comes from `GET /api/v1/clinic/doctor-list/{clinicUuid}` (`doctor_list` here is always `null`). > `city`/`state`/`map`/`location`/`phone`/`phone_number` are all resolved from the clinic's **address** (`DoctorAddress` linked by `clinic_id`), not from columns on the clinic. `location` and `phone`/`phone_number` fall back to the deprecated `clinics.address` / `clinics.telephone` columns only when the address record has no value — reading them from different rows made one response describe two different places. Each is an array with a single object (or empty `[]` if the clinic has no address). `doctors` is a **count**; the actual doctor list comes from `GET /api/v1/clinic/doctor-list/{clinicUuid}` (`doctor_list` here is always `null`).
### معنای `is_active` ### معنای `is_active`
@@ -330,7 +335,7 @@ List clinics with pagination.
| `doctors_count` | integer | Number of doctors linked to the clinic | | `doctors_count` | integer | Number of doctors linked to the clinic |
| `city` | string\|null | City name, resolved from the clinic's address (`DoctorAddress`) | | `city` | string\|null | City name, resolved from the clinic's address (`DoctorAddress`) |
| `state` | string\|null | Province name, resolved from the clinic's address (`DoctorAddress`) | | `state` | string\|null | Province name, resolved from the clinic's address (`DoctorAddress`) |
| `phone` / `phone_number` | string\|null | Contact number from the clinic's address (`DoctorAddress`), falling back to the deprecated `clinics.telephone` column | | `phone` / `phone_number` | string\|null | Contact number from the clinic's address (`DoctorAddress`), falling back to the deprecated `clinics.telephone` column. `null` for anyone who cannot edit the clinic, and always `null` in the public list. |
| `24_7` | boolean | Open 24/7 flag | | `24_7` | boolean | Open 24/7 flag |
| `field_working_days` | string\|null | Working days/hours description | | `field_working_days` | string\|null | Working days/hours description |
+9 -2
View File
@@ -133,7 +133,7 @@ limited to the whitelist under `PATCH /api/v1/doctor/{uuid}`.
"address": [], "address": [],
"state": [], "state": [],
"city": [], "city": [],
"clinics": [{ "uuid": "...", "name": "کلینیک الوند", "address": "...", "telephone": "..." }], "clinics": [{ "uuid": "...", "name": "کلینیک الوند", "address": "...", "telephone": null }],
"representation": { "id": 12, "uuid": "9c1...", "full_name": "علی محمدی" } "representation": { "id": 12, "uuid": "9c1...", "full_name": "علی محمدی" }
} }
} }
@@ -143,6 +143,13 @@ limited to the whitelist under `PATCH /api/v1/doctor/{uuid}`.
> ⚠️ **Double-nested:** Frontend extracts with `data?.data?.data` > ⚠️ **Double-nested:** Frontend extracts with `data?.data?.data`
> >
> `representation` نماینده‌ی مالکِ پزشک است؛ برای پزشکِ بدون نماینده `null`. > `representation` نماینده‌ی مالکِ پزشک است؛ برای پزشکِ بدون نماینده `null`.
>
> 🔒 **Phone numbers are not public.** `address[].telephone` and `clinics[].telephone`
> are `null` for anonymous callers and only carry a value when `can_edit` is `true`
> (the profile owner, its representative, or an admin). Street address and map
> coordinates stay public — a patient needs them to find the place. The venue phone
> reaches the patient through their own appointment (`GET /api/v1/appointments/user`),
> not through the public profile.
### Errors ### Errors
| Code | HTTP | Description | | Code | HTTP | Description |
@@ -171,7 +178,7 @@ Get doctor detail for clinic owner — only doctors who are members of the authe
"uuid": "...", "uuid": "...",
"title": "علی احمدی", "title": "علی احمدی",
"specialties": [...], "specialties": [...],
"clinics": [{ "uuid": "...", "name": "کلینیک نور", "address": "...", "telephone": "..." }] "clinics": [{ "uuid": "...", "name": "کلینیک نور", "address": "...", "telephone": "021..." }]
} }
} }
} }
+14
View File
@@ -407,9 +407,16 @@ entity جاری از `#[CurrentUser]` resolve می‌شود: نقش `ROLE_DOCTOR
| Param | Type | Required | Description | | Param | Type | Required | Description |
|-------|------|----------|-------------| |-------|------|----------|-------------|
| `doctor_uuid` | string (UUID) | ❌ | قیمت‌گذاری همان پزشک را برمی‌گرداند به‌جای موجودیت کاربر جاری. برای تب‌های نوبت‌دهی پنل کلینیک. | | `doctor_uuid` | string (UUID) | ❌ | قیمت‌گذاری همان پزشک را برمی‌گرداند به‌جای موجودیت کاربر جاری. برای تب‌های نوبت‌دهی پنل کلینیک. |
| `inherit` | bool | ❌ | «برای نوبتِ این پزشک واقعاً چه قیمتی اعمال می‌شود؟» — اول قیمت خودِ پزشک، در نبودش قیمت کلینیکی که کاربر در آن ایستاده. مودال قطعی‌کردن نوبت آن را می‌فرستد؛ صفحهٔ تنظیمات نه، چون آنجا باید ردیفِ خودِ پزشک ویرایش شود. |
با `doctor_uuid`، دسترسی این‌گونه بررسی می‌شود: `ROLE_ADMIN`، خودِ پزشک، مالک کلینیکی که پزشک عضو آن است، یا پزشکِ عضو همان کلینیک با مجوز `services.view` (برای `PUT`: `services.update`). در غیر این صورت `403 ERR_ACCESS_DENIED`؛ پزشکِ ناموجود `404 ERR_NOT_FOUND_001`. بدون این پارامتر رفتار قبلی (موجودیت کاربر جاری) دست‌نخورده است. با `doctor_uuid`، دسترسی این‌گونه بررسی می‌شود: `ROLE_ADMIN`، خودِ پزشک، مالک کلینیکی که پزشک عضو آن است، یا پزشکِ عضو همان کلینیک با مجوز `services.view` (برای `PUT`: `services.update`). در غیر این صورت `403 ERR_ACCESS_DENIED`؛ پزشکِ ناموجود `404 ERR_NOT_FOUND_001`. بدون این پارامتر رفتار قبلی (موجودیت کاربر جاری) دست‌نخورده است.
> ℹ️ ردیف‌های قیمت‌گذاری با `doctor_uuid` بیرون از TenantFilter خوانده می‌شوند: مقصدِ این
> تنظیم پزشک است در حالی که محیط فعالِ مالکِ کلینیک، خودِ کلینیک است. مجوزش همان بررسی
> بالاست. تا پیش از این، خواندن به محیط کاربر محدود می‌شد و ردیف موجود دیده نمی‌شد —
> هر ذخیره یک ردیف تازه می‌ساخت (قیدِ یکتا ردیفِ ویزیت آزاد را نمی‌گیرد چون `insurance_id`
> آنجا `NULL` است) و مقدار ذخیره‌شده هرگز به پنل برنمی‌گشت.
### Response `200` ### Response `200`
```json ```json
{ {
@@ -513,11 +520,18 @@ entity جاری از `#[CurrentUser]` resolve می‌شود: نقش `ROLE_DOCTOR
tenant از `#[CurrentUser]` با `App\Patient\Security\PatientRecordScopeResolver` resolve می‌شود — همان رزولور پرونده‌ها و صورتحساب‌ها، تا قرارداد بیمه و صورتحسابی که از آن ساخته می‌شود هرگز به دو محیط متفاوت نیفتند. محیط فعال (`UserActiveContext`) تعیین‌کننده است، نه صرفاً ترتیب نقش‌ها؛ مالک کلینیکی که خودش پزشک هم هست، قراردادهای **کلینیک** خود را می‌بیند. tenant از `#[CurrentUser]` با `App\Patient\Security\PatientRecordScopeResolver` resolve می‌شود — همان رزولور پرونده‌ها و صورتحساب‌ها، تا قرارداد بیمه و صورتحسابی که از آن ساخته می‌شود هرگز به دو محیط متفاوت نیفتند. محیط فعال (`UserActiveContext`) تعیین‌کننده است، نه صرفاً ترتیب نقش‌ها؛ مالک کلینیکی که خودش پزشک هم هست، قراردادهای **کلینیک** خود را می‌بیند.
**محدودهٔ تنظیم — اول پزشک، بعد کلینیک:** نوبتی که در کلینیک ثبت می‌شود محیطش «کلینیک» است، ولی تنظیمات بیمه معمولاً روی خودِ پزشک ذخیره شده‌اند. هنگام محاسبه — انتخاب بیمهٔ نوبت، نوع خدمت، و قیمت ویزیت — اول تنظیمِ خودِ پزشک خوانده می‌شود و فقط در نبودِ آن تنظیمِ کلینیک. هر سه مورد جدا سنجیده می‌شوند: پزشکی که قرارداد بیمهٔ خودش را دارد ولی قیمت ویزیت را به کلینیک سپرده، هرکدام را از جای درست می‌گیرد. مرجع: `App\Insurance\Service\InsuranceScopeResolver`.
**درصد صفر:** `0` مقدار معتبری است و یعنی «این قرارداد آن نوع خدمت را پوشش نمی‌دهد» (سهم بیمار صددرصد). آنچه رد می‌شود، خالی‌ماندنِ درصدِ یک نوع خدمتِ فعال است؛ پیش‌فرض مرکزیِ صفر هم «تعیین‌نشده» حساب می‌شود، نه انتخابِ صفر.
**تنظیمات per-doctor در کلینیک چندپزشکه:** درصد و شرایط هر بیمه می‌تواند برای هر پزشک متفاوت باشد. همهٔ اندپوینت‌های زیر یک پارامتر اختیاری `doctor_uuid` می‌پذیرند (در `GET`/`DELETE` از query، در `POST`/`PATCH`/`PUT` از بدنه). با آن، قرارداد به‌جای موجودیتِ tenantِ کاربر جاری، به‌ازای پزشک هدف (`entity_type='doctor'`) خوانده/نوشته می‌شود — دقیقاً مثل `insurance-pricing`. **بدون** آن، رفتار قبلی (tenant کاربر جاری) دست‌نخورده می‌ماند (سازگاری عقب‌رو). دسترسی با `doctor_uuid` هم مثل `insurance-pricing` بررسی می‌شود: `ROLE_ADMIN`، خودِ پزشک، یا کاربرِ عضو/مالکِ کلینیکِ آن پزشک با مجوز `services.view` (برای نوشتن `services.update`)؛ در غیر این صورت `403 ERR_ACCESS_DENIED`، و پزشکِ ناموجود `404 ERR_NOT_FOUND_001`. **تنظیمات per-doctor در کلینیک چندپزشکه:** درصد و شرایط هر بیمه می‌تواند برای هر پزشک متفاوت باشد. همهٔ اندپوینت‌های زیر یک پارامتر اختیاری `doctor_uuid` می‌پذیرند (در `GET`/`DELETE` از query، در `POST`/`PATCH`/`PUT` از بدنه). با آن، قرارداد به‌جای موجودیتِ tenantِ کاربر جاری، به‌ازای پزشک هدف (`entity_type='doctor'`) خوانده/نوشته می‌شود — دقیقاً مثل `insurance-pricing`. **بدون** آن، رفتار قبلی (tenant کاربر جاری) دست‌نخورده می‌ماند (سازگاری عقب‌رو). دسترسی با `doctor_uuid` هم مثل `insurance-pricing` بررسی می‌شود: `ROLE_ADMIN`، خودِ پزشک، یا کاربرِ عضو/مالکِ کلینیکِ آن پزشک با مجوز `services.view` (برای نوشتن `services.update`)؛ در غیر این صورت `403 ERR_ACCESS_DENIED`، و پزشکِ ناموجود `404 ERR_NOT_FOUND_001`.
### GET `/api/v1/billing/tenant-insurances` ### GET `/api/v1/billing/tenant-insurances`
لیست قراردادهای tenant جاری — **آخرین نسخهٔ هر بیمه، فعال یا غیرفعال** (برای toggle فعال/غیرفعال در UI مدیریت بیمه). `insurance_kind` = `kind` قرارداد در صورت تعیین، وگرنه نوع بیمه از کاتالوگ. لیست قراردادهای tenant جاری — **آخرین نسخهٔ هر بیمه، فعال یا غیرفعال** (برای toggle فعال/غیرفعال در UI مدیریت بیمه). `insurance_kind` = `kind` قرارداد در صورت تعیین، وگرنه نوع بیمه از کاتالوگ.
> پارامتر `inherit=1` همان قاعدهٔ محدودهٔ بیمه را اعمال می‌کند: اول قراردادهای خودِ پزشک، و اگر پزشک هیچ قراردادی نداشته باشد قراردادهای کلینیکی که کاربر در آن ایستاده. بدون این پارامتر، پاسخ دقیقاً همان محیطِ هدف است — چیزی که صفحهٔ تنظیمات برای ویرایش لازم دارد.
**Query:** `doctor_uuid` (اختیاری) — قراردادهای همان پزشک را برمی‌گرداند (نگاه کنید به «تنظیمات per-doctor» بالا). **Query:** `doctor_uuid` (اختیاری) — قراردادهای همان پزشک را برمی‌گرداند (نگاه کنید به «تنظیمات per-doctor» بالا).
**Permission:** `AUTH` (doctor/clinic) **Permission:** `AUTH` (doctor/clinic)
+12
View File
@@ -131,6 +131,12 @@ List the **authenticated user's own** payments (derived from the token — there
**Permission:** `IS_AUTHENTICATED_FULLY` **Permission:** `IS_AUTHENTICATED_FULLY`
> **فیلتر محیط اینجا اعمال نمی‌شود.** رکورد در محیطِ پزشکِ مقصد ثبت می‌شود، ولی
> مالکش از راه `user_id` تعیین می‌شود. کاربری که خودش صاحب محیط دیگری است — پزشک،
> منشی، مالک کلینیک — با فیلترِ محیطِ خودش رکورد خودش را نمی‌دید و ۴۰۴ می‌گرفت.
> دورزدن فیلتر فقط از راه `App\Shared\Tenant\TenantFilterScope` انجام می‌شود و
> مجوز دست‌نخورده باقی می‌ماند.
### Query Parameters ### Query Parameters
| Param | Type | Default | Description | | Param | Type | Default | Description |
|-------|------|---------|-------------| |-------|------|---------|-------------|
@@ -405,6 +411,12 @@ Get payment status and details.
**Permission:** `AUTH` — must be the payment owner or `ROLE_ADMIN` **Permission:** `AUTH` — must be the payment owner or `ROLE_ADMIN`
> **فیلتر محیط اینجا اعمال نمی‌شود.** رکورد در محیطِ پزشکِ مقصد ثبت می‌شود، ولی
> مالکش از راه `user_id` تعیین می‌شود. کاربری که خودش صاحب محیط دیگری است — پزشک،
> منشی، مالک کلینیک — با فیلترِ محیطِ خودش رکورد خودش را نمی‌دید و ۴۰۴ می‌گرفت.
> دورزدن فیلتر فقط از راه `App\Shared\Tenant\TenantFilterScope` انجام می‌شود و
> مجوز دست‌نخورده باقی می‌ماند.
### Path Parameters ### Path Parameters
| Param | Type | Description | | Param | Type | Description |
|-------|------|-------------| |-------|------|-------------|
+21 -1
View File
@@ -165,6 +165,8 @@ Delete a representation.
Get monthly earnings dashboard for a representation. Get monthly earnings dashboard for a representation.
`total_appointments` فقط نوبت‌های **آنلاین** را می‌شمارد — یعنی نوبت‌هایی که از سایتِ همین نماینده رزرو شده‌اند (`appointments.booking_representation_id` برابر همین نماینده). نوبتی که منشی در پنل ثبت می‌کند از سایت نیامده و در آمار نماینده نمی‌آید.
**Permission:** `AUTH` — must be the representation's user or `ROLE_ADMIN` **Permission:** `AUTH` — must be the representation's user or `ROLE_ADMIN`
### Path Parameters ### Path Parameters
@@ -264,15 +266,33 @@ Get yearly earnings dashboard for a representation.
## قانون کمیسیون دامنه‌محور ## قانون کمیسیون دامنه‌محور
کمیسیون (نوبت **و** اشتراک) فقط وقتی ثبت می‌شود که **هر دو** شرط برقرار باشد: کمیسیون (نوبت **و** اشتراک) فقط وقتی ثبت می‌شود که **هر دو** شرط برقرار باشد:
1. دامنه‌ی مبدأ خرید (`payment.frontend_address`) متعلق به یک نماینده‌ی فعال باشد (`representations.domain`). 1. دامنه‌ی مبدأ خرید (`payment.frontend_address`) به یک نماینده‌ی فعال برسد.
2. پزشک/کلینیکِ موضوع خرید، `representation_id` همان نماینده را داشته باشد. 2. پزشک/کلینیکِ موضوع خرید، `representation_id` همان نماینده را داشته باشد.
دامنه به نماینده به این ترتیب می‌رسد:
- نماینده‌ای که همان دامنه را در `representations.domain` ثبت کرده (نماینده‌ی سراسری).
- وگرنه اگر دامنه، دامنه‌ی یک شهر باشد (`cities.domain`)، نماینده‌ی فعالِ همان شهر از `representation_cities`.
اگر دو نماینده‌ی فعال یک شهر را پوشش دهند، نماینده‌ای انتخاب نمی‌شود: انتساب پول مبهم است و باید در داده صریح شود.
در غیر این صورت هیچ کمیسیونی برای هیچ نماینده‌ای ثبت نمی‌شود (پرداخت بدون `frontend_address` هم کمیسیون ندارد). درصد: نوبت = `commission_percent` نماینده؛ اشتراک = تنظیم سراسری `upgrade_commission_percent`. نگاشت دامنه فقط از طریق `DomainContextResolver` انجام می‌شود. در غیر این صورت هیچ کمیسیونی برای هیچ نماینده‌ای ثبت نمی‌شود (پرداخت بدون `frontend_address` هم کمیسیون ندارد). درصد: نوبت = `commission_percent` نماینده؛ اشتراک = تنظیم سراسری `upgrade_commission_percent`. نگاشت دامنه فقط از طریق `DomainContextResolver` انجام می‌شود.
**زمان ثبت:** کمیسیون نوبت در لحظه‌ی **پرداخت موفق** ثبت می‌شود، نه در لحظه‌ی تأیید نوبت. نوبتِ `pending` هم کمیسیون دارد؛ تأیید کارِ پزشک/منشی است و ممکن است هرگز انجام نشود. ثبت idempotent است و مسیر تأیید دوباره چیزی نمی‌سازد.
--- ---
## پنل نماینده (ROLE_REPRESENTATION) ## پنل نماینده (ROLE_REPRESENTATION)
> **شمارش نوبت:** `dashboard/summary` و `doctors/performance` هم فقط نوبت‌های آنلاینِ همین نماینده را می‌شمارند (`appointments.booking_representation_id`). نوبتی که منشی در پنل ثبت می‌کند شمرده نمی‌شود. ستون درآمدِ هر پزشک هم فقط سهم همین نماینده است، نه سهم نمایندگان قبلیِ آن پزشک.
>
> **بازسازی گذشته:** نوبت‌های آنلاینی که پیش از نگاشت دامنه‌ی شهری پرداخت شده‌اند نه `booking_representation_id` دارند و نه ردیف `FinancialBreakdown`. دستور زیر هر دو را از روی `payments.frontend_address` می‌سازد؛ بدون `--force` فقط گزارش می‌دهد و تاریخ ردیف مالی روی لحظه‌ی پرداخت می‌نشیند، نه لحظه‌ی اجرا:
>
> ```
> php bin/console app:representation:backfill-online-commission [--force]
> ```
این endpointها برای کاربرِ دارای نقش `ROLE_REPRESENTATION` در پنل ادمین (`/admin`) هستند. مالکیت همیشه از کاربر جاری (`#[CurrentUser]` + `findByUser`) تعیین می‌شود؛ هیچ uuid/id ورودی برای تعیین مالکیت پذیرفته نمی‌شود. این endpointها برای کاربرِ دارای نقش `ROLE_REPRESENTATION` در پنل ادمین (`/admin`) هستند. مالکیت همیشه از کاربر جاری (`#[CurrentUser]` + `findByUser`) تعیین می‌شود؛ هیچ uuid/id ورودی برای تعیین مالکیت پذیرفته نمی‌شود.
> **Permission (همه‌ی این بخش):** `ROLE_REPRESENTATION` > **Permission (همه‌ی این بخش):** `ROLE_REPRESENTATION`
+36 -1
View File
@@ -82,7 +82,13 @@
**Permission:** `IS_AUTHENTICATED_FULLY` **Permission:** `IS_AUTHENTICATED_FULLY`
**نکته:** از نسخه فعلی، این endpoint برای `ROLE_SECRETARY` نیز کار می‌کند. منشی از طریق `UserActiveContextRepository` به `db_uuid` entity مربوطه (doctor یا clinic) دسترسی پیدا می‌کند و اشتراک همان entity برگردانده می‌شود. **محیط اشتراک:** همان محیطی که کاربر **صاحبش** است، از `EntityContextResolver::ownedEntity()` — همان مرجعی که خرید اشتراک هم استفاده می‌کند، تا نمایش و پرداخت و اعطای ادمین روی یک محیط بنشینند.
کاربری که هم پزشک است و هم مالک کلینیک، دو محیط صاحب‌شده دارد. آنجا محیط فعال
(`UserActiveContext`) تعیین می‌کند اشتراک کدام‌یک خوانده شود. بدون محیط فعال، مطب
شخصی پیش‌فرض است.
**نکته:** این endpoint برای `ROLE_SECRETARY` هم کار می‌کند. منشی محیط صاحب‌شده ندارد، پس محیط فعالش خوانده می‌شود و اشتراک همان entity برمی‌گردد.
**Response 200:** **Response 200:**
```json ```json
@@ -340,6 +346,35 @@ callback مشترک همهٔ درگاه‌ها و همهٔ نوع‌های پر
> پلن. پس اعطای پلنی پایین‌تر از پلن فعال، عملاً پلن مؤثر مقصد را کاهش می‌دهد. پنل > پلن. پس اعطای پلنی پایین‌تر از پلن فعال، عملاً پلن مؤثر مقصد را کاهش می‌دهد. پنل
> ادمین قبل از ثبت این حالت تأیید می‌گیرد؛ خودِ endpoint جلوی آن را نمی‌گیرد. > ادمین قبل از ثبت این حالت تأیید می‌گیرد؛ خودِ endpoint جلوی آن را نمی‌گیرد.
### DELETE /api/v1/admin/subscription/{uuid}
**Permission:** `ROLE_ADMIN` — حذف اشتراک، برای برگرداندن اعطای اشتباه
`uuid` همان `uuid` ردیف گزارش است. حذف سخت است، نه soft delete: رکورد از
`clinic_subscriptions` پاک می‌شود و پلن مؤثر مقصد به اشتراک فعال بعدی یا به `free`
برمی‌گردد.
اشتراکِ متصل به پرداخت حذف نمی‌شود. سند مالی‌اش باید بماند و مسیر درست آن استرداد
وجه است.
**Response 200**
```json
{
"success": true,
"data": null
}
```
| وضعیت | کد | حالت |
|-------|----|------|
| 404 | ERR_SUBSCRIPTION_NOT_FOUND | uuid یافت نشد |
| 409 | ERR_CONFLICT_001 | اشتراک به پرداخت متصل است |
| 401 | ERR_AUTH_001 | بدون توکن |
| 403 | — | توکن معتبر ولی بدون `ROLE_ADMIN` |
> مسیر `DELETE /api/v1/admin/subscription/period/{uuid}` جداست و دورهٔ پلن را
> غیرفعال می‌کند، نه اشتراکِ یک مقصد را.
### GET /api/v1/admin/subscription/active/{entityType}/{entityUuid} ### GET /api/v1/admin/subscription/active/{entityType}/{entityUuid}
**Permission:** `ROLE_ADMIN` — اشتراک فعالِ یک مقصد، برای نمایش پیش از اعطا **Permission:** `ROLE_ADMIN` — اشتراک فعالِ یک مقصد، برای نمایش پیش از اعطا
+24
View File
@@ -76,6 +76,30 @@ clinic_uuid صریحِ درخواست > UserActiveContext ذخیره‌شده
| SQL خام DBAL | ❌ | | SQL خام DBAL | ❌ |
| فرزندان aggregate | ❌ — همیشه از ریشه JOIN کن | | فرزندان aggregate | ❌ — همیشه از ریشه JOIN کن |
### استثنای مجاز: دادهٔ «مالِ خودِ کاربر»
چند رکورد در محیطِ یک مطب ثبت می‌شوند ولی مالکشان بیمار است، نه آن مطب: پرداختِ نوبت و
خودِ نوبتِ بیمار. مجوزشان با `user_id` بررسی می‌شود، نه با محیط.
اینجا فیلتر چیزی به امنیت اضافه نمی‌کند و فقط ضرر می‌زند: کاربری که خودش صاحب محیط
دیگری است — پزشکی که از مطب دیگری نوبت می‌گیرد، منشی‌ای که جایی بیمار است — رکورد
خودش را نمی‌دید و صفحهٔ نتیجهٔ پرداخت ۴۰۴ می‌شد.
تنها راه مجاز دورزدن، `App\Shared\Tenant\TenantFilterScope::withoutFilter()` است.
عمداً یک کلاس جداست تا جاهای دورزدن قابل شمردن بمانند، و فیلتر را در `finally`
برمی‌گرداند تا بقیهٔ همان درخواست دوباره محدود شود.
مصرف‌کنندگان فعلی — هر سه کاربرمحور، نه محیط‌محور:
| اندپوینت | چرا |
|---|---|
| `GET /api/v1/payment/{uuid}` | پرداخت‌کننده باید پرداخت خودش را ببیند |
| `GET /api/v1/my/payments` | همان، به شکل فهرست |
| `GET /api/v1/appointments/user` | نوبت‌های خودِ فرد به‌عنوان بیمار |
`PayerSeesOwnPaymentTest` هر سه را می‌بندد و هم‌زمان تأیید می‌کند که پرداختِ کاربر
دیگر همچنان ۴۰۳ می‌گیرد.
**فیلتر جایگزین authorization نیست.** `AppointmentAccessChecker`، `ClinicDoctorAccessChecker`، `SecretaryAccessChecker` و `PatientRecordScopeResolver` سر جایشان می‌مانند: آن‌ها «چه کاری مجاز است» را جواب می‌دهند، فیلتر فقط «کدام ردیف‌ها». **فیلتر جایگزین authorization نیست.** `AppointmentAccessChecker`، `ClinicDoctorAccessChecker`، `SecretaryAccessChecker` و `PatientRecordScopeResolver` سر جایشان می‌مانند: آن‌ها «چه کاری مجاز است» را جواب می‌دهند، فیلتر فقط «کدام ردیف‌ها».
### تغییر رفتار: ۴۰۴ به‌جای ۴۰۳ ### تغییر رفتار: ۴۰۴ به‌جای ۴۰۳
+38 -1
View File
@@ -1535,5 +1535,42 @@
"1533": "Community 1533", "1533": "Community 1533",
"1534": "Community 1534", "1534": "Community 1534",
"1535": "Community 1535", "1535": "Community 1535",
"1536": "Community 1536" "1536": "Community 1536",
"1537": "Community 1537",
"1538": "Community 1538",
"1539": "Community 1539",
"1540": "Community 1540",
"1541": "Community 1541",
"1542": "Community 1542",
"1543": "Community 1543",
"1544": "Community 1544",
"1545": "Community 1545",
"1546": "Community 1546",
"1547": "Community 1547",
"1548": "Community 1548",
"1549": "Community 1549",
"1550": "Community 1550",
"1551": "Community 1551",
"1552": "Community 1552",
"1553": "Community 1553",
"1554": "Community 1554",
"1555": "Community 1555",
"1556": "Community 1556",
"1557": "Community 1557",
"1558": "Community 1558",
"1559": "Community 1559",
"1560": "Community 1560",
"1561": "Community 1561",
"1562": "Community 1562",
"1563": "Community 1563",
"1564": "Community 1564",
"1565": "Community 1565",
"1566": "Community 1566",
"1567": "Community 1567",
"1568": "Community 1568",
"1569": "Community 1569",
"1570": "Community 1570",
"1571": "Community 1571",
"1572": "Community 1572",
"1573": "Community 1573"
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "users_hamed_pj_my_pj_clinic_pro_clinicpro_config_reference_php", "label": "reference.php", "file_type": "code", "source_file": "config/reference.php", "source_location": "L1"}, {"id": "config_reference_app", "label": "App", "file_type": "code", "source_file": "config/reference.php", "source_location": "L1571"}, {"id": "config_reference_app_config", "label": ".config()", "file_type": "code", "source_file": "config/reference.php", "source_location": "L1578"}, {"id": "config_reference_routes", "label": "Routes", "file_type": "code", "source_file": "config/reference.php", "source_location": "L1651"}, {"id": "config_reference_routes_config", "label": ".config()", "file_type": "code", "source_file": "config/reference.php", "source_location": "L1658"}], "edges": [{"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_config_reference_php", "target": "paramconfigurator", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "config/reference.php", "source_location": "L7", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_config_reference_php", "target": "config_reference_app", "relation": "contains", "confidence": "EXTRACTED", "source_file": "config/reference.php", "source_location": "L1571", "weight": 1.0}, {"source": "config_reference_app", "target": "config_reference_app_config", "relation": "method", "confidence": "EXTRACTED", "source_file": "config/reference.php", "source_location": "L1578", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_config_reference_php", "target": "config_reference_routes", "relation": "contains", "confidence": "EXTRACTED", "source_file": "config/reference.php", "source_location": "L1651", "weight": 1.0}, {"source": "config_reference_routes", "target": "config_reference_routes_config", "relation": "method", "confidence": "EXTRACTED", "source_file": "config/reference.php", "source_location": "L1658", "weight": 1.0}], "raw_calls": [{"caller_nid": "config_reference_app_config", "callee": "AppReference", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/config/reference.php", "source_location": "L1581", "receiver": null}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_landing_landingregistry_php", "label": "LandingRegistry.php", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L1"}, {"id": "landing_landingregistry_landingregistry", "label": "LandingRegistry", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L11"}, {"id": "landing_landingregistry_landingregistry_all", "label": ".all()", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L45"}, {"id": "landing_landingregistry_landingregistry_featured", "label": ".featured()", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L51"}, {"id": "landing_landingregistry_landingregistry_find", "label": ".find()", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L59"}, {"id": "landingpage", "label": "LandingPage", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L59"}, {"id": "landing_landingregistry_landingregistry_build", "label": ".build()", "file_type": "code", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L65"}], "edges": [{"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_landing_landingregistry_php", "target": "landing_landingregistry_landingregistry", "relation": "contains", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L11", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry", "target": "landing_landingregistry_landingregistry_all", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L45", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry", "target": "landing_landingregistry_landingregistry_featured", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L51", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry", "target": "landing_landingregistry_landingregistry_find", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L59", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry_find", "target": "landingpage", "relation": "references", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L59", "weight": 1.0, "context": "return_type"}, {"source": "landing_landingregistry_landingregistry", "target": "landing_landingregistry_landingregistry_build", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L65", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry_all", "target": "landing_landingregistry_landingregistry_build", "relation": "calls", "context": "call", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L47", "weight": 1.0}, {"source": "landing_landingregistry_landingregistry_featured", "target": "landing_landingregistry_landingregistry_find", "relation": "calls", "context": "call", "confidence": "EXTRACTED", "source_file": "src/Shared/Landing/LandingRegistry.php", "source_location": "L54", "weight": 1.0}], "raw_calls": [{"caller_nid": "landing_landingregistry_landingregistry_featured", "callee": "array_values", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Landing/LandingRegistry.php", "source_location": "L53", "receiver": null}, {"caller_nid": "landing_landingregistry_landingregistry_featured", "callee": "array_filter", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Landing/LandingRegistry.php", "source_location": "L53", "receiver": null}, {"caller_nid": "landing_landingregistry_landingregistry_featured", "callee": "array_map", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Landing/LandingRegistry.php", "source_location": "L53", "receiver": null}, {"caller_nid": "landing_landingregistry_landingregistry_build", "callee": "array_column", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Landing/LandingRegistry.php", "source_location": "L415", "receiver": null}, {"caller_nid": "landing_landingregistry_landingregistry_build", "callee": "array_map", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Landing/LandingRegistry.php", "source_location": "L416", "receiver": null}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More