feat(resource): expose each offering's service section

The resource booking modal groups services under their section, the way the
doctor's service booking does. The offering list had no section, so the list
could only be flat.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-03 13:47:39 +03:30
co-authored by Claude Opus 5
parent dc728acaaf
commit 1543eddd9e
3 changed files with 45 additions and 0 deletions
@@ -159,4 +159,26 @@ class ResourceServiceOfferingTest extends ResourceTestCase
self::assertSame([], $repo->activeResourceIdsFor($service));
self::assertSame(25, $repo->findOneFor($resource, $service)?->getDurationMinutes());
}
/** مودال رزرو منبع سرویس‌ها را زیر بخششان گروه می‌کند، پس فهرست باید بخش را بدهد. */
public function testOfferingListCarriesTheServiceSection(): void
{
[$user, , $address] = $this->clinicWithAddress();
$resource = $this->resource($address, $this->resourceType($address), 'لیزر الکساندرایت');
$service = $this->service($address, 'لیزر زیربغل');
$this->authJson('PUT', "/api/v1/resource/{$resource->getUuid()}/services", $user, [
'services' => [['service_uuid' => $service->getUuid()]],
]);
self::assertSame(200, $this->responseCode());
$body = $this->authJson('GET', "/api/v1/resource/{$resource->getUuid()}/services", $user);
self::assertSame(200, $this->responseCode());
self::assertSame(
$service->getSection()->getUuid(),
$body['data'][0]['service_section']['uuid'],
);
self::assertSame('بخش لیزر زیربغل', $body['data'][0]['service_section']['name']);
}
}