feat(appointments): resources share the doctors' timeline
Three views become two. The resource lanes were a separate tab, which meant reading a doctor's free hour on one screen and the laser's on another and matching them by eye — while in the resource-first model it is the device and the room that decide whether that hour is really free. They now sit under the same "زمانبندی" view, below the doctor's slots. Each lane says how much of its shift is still free, and that number respects capacity: a minute counts as busy only once the overlapping bookings reach the resource's capacity, so a three-bed room with two appointments is still open. Treating it otherwise would silently turn every multi-capacity resource into a single-capacity one. ResourceFreeTimeCalculator does the sweep and carries nine cases of its own. only_bookable=1 keeps resources with no service offering out of the view; they could only ever render an empty lane. On the seeded clinic that is five resources down to two. Two ruler defects the screenshot caught: hours rendered in Latin digits, and the last label was half-clipped by the container so 21 read as 2. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,33 @@ class ResourceServiceOfferingRepository extends ServiceEntityRepository
|
||||
}
|
||||
|
||||
/** @return int[] شناسهٔ منابعی که این سرویس را فعال ارائه میدهند */
|
||||
/**
|
||||
* کدامیک از این منابع دستکم یک سرویسِ فعال ارائه میدهند — یعنی «قابل رزرو»اند.
|
||||
*
|
||||
* عکسِ `activeResourceIdsFor()`: آن از سرویس به منبع میرود، این از منبع به سرویس.
|
||||
* تایملاین نوبتها با همین فیلتر میکند تا دستگاهی که هنوز به هیچ سرویسی وصل نشده،
|
||||
* ردیفِ همیشهخالی نسازد.
|
||||
*
|
||||
* @param int[] $resourceIds
|
||||
* @return int[]
|
||||
*/
|
||||
public function bookableResourceIds(array $resourceIds): array
|
||||
{
|
||||
if ($resourceIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$rows = $this->createQueryBuilder('o')
|
||||
->select('DISTINCT IDENTITY(o.resource) AS resource_id')
|
||||
->where('o.resource IN (:ids)')
|
||||
->andWhere('o.active = true')
|
||||
->setParameter('ids', $resourceIds)
|
||||
->getQuery()
|
||||
->getArrayResult();
|
||||
|
||||
return array_map(static fn (array $r): int => (int) $r['resource_id'], $rows);
|
||||
}
|
||||
|
||||
public function activeResourceIdsFor(ServiceItem $item, ?ResourceType $type = null): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('o')
|
||||
|
||||
Reference in New Issue
Block a user