refactor(resource): drop the branch domain from resources
Resources never needed a branch: devices and rooms belong to the clinic itself, and the picker always had exactly one option — a mandatory click that decided nothing. - `address_uuid` is now optional on resource and pool creation; when it is missing the environment's own address is used. Clients still sending it keep working. - The panel no longer asks for or displays a branch anywhere: resource form, list column and filter, pool form and column, detail row, and the resource-first booking page. - Availability no longer gates on `doctor_addresses.active`. That gate shut down every device of a clinic whose address row happened to be inactive, with a message no page in the panel could act on — no endpoint writes that column at all. `address_id` stays on the resource: the timezone and the tenant pair are derived from it. It is simply no longer the user's decision. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,8 +47,8 @@ export interface HoldResult {
|
||||
}
|
||||
|
||||
export const REASON_LABELS: Record<string, string> = {
|
||||
no_capacity_in_range: 'در این بازه هیچ ظرفیتی نیست — بازه را بزرگتر کنید یا شعبهٔ دیگری را امتحان کنید.',
|
||||
no_working_hours: 'شعبه در این بازه ساعت کاری ندارد.',
|
||||
no_capacity_in_range: 'در این بازه هیچ ظرفیتی نیست — بازه را بزرگتر کنید یا سرویس دیگری را امتحان کنید.',
|
||||
no_working_hours: 'در این بازه ساعت کاری تعریف نشده است.',
|
||||
no_eligible_resource: 'هیچ منبعی شرایط بخشهای این خدمت را ندارد.',
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
} from '../types';
|
||||
|
||||
/**
|
||||
* منابع: هر چیزی که ممکن است اشغال باشد. هر منبع مال یک شعبه است، و شعبه همان
|
||||
* منابع: هر چیزی که ممکن است اشغال باشد. هر منبع مال محیط جاری است؛ لنگرش همان
|
||||
* آدرس محل نوبتدهی است — پس فیلترها با `address_uuid` کار میکنند نه `branch_id`.
|
||||
*/
|
||||
const RESOURCES_KEY = 'resources';
|
||||
@@ -203,7 +203,8 @@ export function useResourcePools() {
|
||||
});
|
||||
|
||||
const create = useMutation({
|
||||
mutationFn: (d: { address_uuid: string; type_uuid: string; name: string }) =>
|
||||
// آدرس فرستاده نمیشود: منابع دامنهٔ شعبه ندارند و سرور آدرسِ خودِ محیط را برمیدارد.
|
||||
mutationFn: (d: { type_uuid: string; name: string }) =>
|
||||
api.post<ApiResponse<ResourcePool>>('/api/v1/resource-pools', d),
|
||||
onSuccess: () => { toast.success('استخر افزوده شد'); invalidate(); },
|
||||
onError: (e) => fail(e, 'افزودن استخر ناموفق بود'),
|
||||
|
||||
Reference in New Issue
Block a user