diff --git a/src/lib/ProfileView.svelte b/src/lib/ProfileView.svelte index ce57e1c..ea32d76 100644 --- a/src/lib/ProfileView.svelte +++ b/src/lib/ProfileView.svelte @@ -53,11 +53,11 @@
Roles
-Roles and duties this person has. +Roles and recurring processes this person is accountable or responsible for. {#if roles.length > 0} {#each roles as role} - + {/each} {:else} This person has no roles in this organization. diff --git a/src/lib/RoleProcesses.svelte b/src/lib/RoleProcesses.svelte index 6f67676..dfe14fb 100644 --- a/src/lib/RoleProcesses.svelte +++ b/src/lib/RoleProcesses.svelte @@ -4,28 +4,26 @@ import ProcessLink from './ProcessLink.svelte'; import type { HowRow, ProcessRow, RoleRow } from '$database/OrganizationsDB'; import { getOrg } from './contexts'; - import { - formatNextDate, - getNextPeriodDate, - getNextProcessDate, - sortProcessesByNextDate - } from '$database/Period'; - import Note from './Note.svelte'; + import { sortProcessesByNextDate } from '$database/Period'; import ProcessDate from './ProcessDate.svelte'; export let role: RoleRow; export let processes: ProcessRow[]; + export let onlyPeriodic = false; $: sorted = sortProcessesByNextDate(processes); const org = getOrg(); - $: hows = sorted - .map((process) => $org.getHow(process.id)) - .filter((how): how is HowRow => how !== undefined); - $: accountable = sorted.filter((process) => role.id === process.accountable); + $: accountable = sorted.filter( + (process) => role.id === process.accountable && (!onlyPeriodic || process.repeat.length > 0) + ); $: responsible = sorted.filter((process) => - $org.getProcessHows(process.id).some((how) => how.responsible.includes(role.id)) + $org + .getProcessHows(process.id) + .some( + (how) => how.responsible.includes(role.id) && (!onlyPeriodic || process.repeat.length > 0) + ) ); $: consulted = sorted.filter((process) => $org.getProcessHows(process.id).some((how) => how.consulted.includes(role.id)) @@ -53,21 +51,23 @@ {/each} {/if} -{#if consulted.length > 0} - Consulted - {#each consulted as process} - - - - - {/each} -{/if} -{#if informed.length > 0} - Informed - {#each informed as process} - - - - - {/each} +{#if !onlyPeriodic} + {#if consulted.length > 0} + Consulted + {#each consulted as process} + + + + + {/each} + {/if} + {#if informed.length > 0} + Informed + {#each informed as process} + + + + + {/each} + {/if} {/if}