feature: Tasks tab added for lab organizations. tasks now can be assigned and their status can be updated by the assignee.

This commit is contained in:
2026-06-28 22:56:56 +03:30
parent feb0b26ad0
commit 2a48946a51
29 changed files with 851 additions and 43 deletions

View File

@@ -16,6 +16,7 @@ export const DASHBOARD_ROUTES: DashboardRouteConfig[] = [
{ prefix: '/appointments', permission: 'TAB_APPOINTMENTS_READ', orgTypes: ['CLINIC'] },
{ prefix: '/treatment', permission: 'TAB_TREATMENT_READ', orgTypes: ['CLINIC'] },
{ prefix: '/cases', permission: 'TAB_CASES_READ', orgTypes: ['LAB'] },
{ prefix: '/tasks', permission: 'TAB_TASKS_READ', orgTypes: ['LAB'] },
{ prefix: '/billing', permission: 'TAB_BILLING_READ', orgTypes: ['CLINIC', 'LAB'] },
{ prefix: '/reports', permission: 'TAB_REPORTS_READ', orgTypes: ['CLINIC', 'LAB'] },
];
@@ -71,6 +72,14 @@ export function canAccessDashboardRoute(org: Organization | null, pathname: stri
return canAccessAppointmentsSection(org);
}
if (route.prefix === '/cases') {
return canViewCases(org);
}
if (route.prefix === '/tasks') {
return canViewTasks(org);
}
return hasPermission(org, route.permission);
}
@@ -84,6 +93,14 @@ export function firstAccessibleDashboardPath(org: Organization | null): string {
if (canAccessAppointmentsSection(org)) return route.prefix;
continue;
}
if (route.prefix === '/cases') {
if (canViewCases(org)) return route.prefix;
continue;
}
if (route.prefix === '/tasks') {
if (canViewTasks(org)) return route.prefix;
continue;
}
if (hasPermission(org, route.permission)) return route.prefix;
}
@@ -175,3 +192,21 @@ export function canEditCases(org: Organization | null): boolean {
if (org.isOwner) return true;
return hasPermission(org, 'TAB_CASES_EDIT');
}
/** Lab task inbox */
export function canViewTasks(org: Organization | null): boolean {
if (!org) return false;
if (org.type !== 'LAB') return false;
if (org.isOwner) return true;
return (
hasPermission(org, 'TAB_TASKS_READ') ||
hasPermission(org, 'TAB_TASKS_EDIT')
);
}
export function canEditTasks(org: Organization | null): boolean {
if (!org) return false;
if (org.type !== 'LAB') return false;
if (org.isOwner) return true;
return hasPermission(org, 'TAB_TASKS_EDIT');
}