feat: refactor resource management by removing modal components and integrating functionality into tabs; add ResourceBlocksPanel for temporary deactivation of resources

This commit is contained in:
hamed
2026-08-03 10:12:01 +03:30
parent b2b36e3eec
commit 00c275d618
10 changed files with 391 additions and 362 deletions
+4 -1
View File
@@ -49,8 +49,11 @@ export function useResources(filters: ResourceFilters = {}) {
onError: (e) => fail(e, 'افزودن منبع ناموفق بود'),
});
// PATCH است و سرور هم واقعاً جزئی رفتار می‌کند (`array_key_exists` روی هر فیلد)،
// پس `Partial`: تغییر فقط `active` نباید کلاینت را مجبور کند `name` را هم بفرستد
// — فرستادنِ نامِ کهنه، تغییرِ هم‌زمانِ نام را بازمی‌گرداند.
const update = useMutation({
mutationFn: ({ uuid, d }: { uuid: string; d: ResourcePayload }) =>
mutationFn: ({ uuid, d }: { uuid: string; d: Partial<ResourcePayload> }) =>
api.patch<ApiResponse<ClinicResource>>(`/api/v1/resource/${uuid}`, d),
onSuccess: () => { toast.success('منبع به‌روزرسانی شد'); invalidate(); },
onError: (e) => fail(e, 'به‌روزرسانی منبع ناموفق بود'),