Skip to content

Commit

Permalink
Order tabs following logical order
Browse files Browse the repository at this point in the history
  • Loading branch information
melinoix committed Dec 16, 2024
1 parent 814b092 commit 944b1f5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion frontend/src/lib/components/DetailView/DetailView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@
!data.data.builtin
);
};
export let orderRelatedModels = [''];
if (data.urlModel === 'projects') {
orderRelatedModels = ['risk-assessments', 'entity-assessments', 'compliance-assessments'];
}
if (data.urlModel === 'entities') {
orderRelatedModels = ['solutions', 'representatives', 'entity-assessments'];
}
</script>

<div class="flex flex-col space-y-2">
Expand Down Expand Up @@ -398,7 +406,9 @@
{#if Object.keys(data.relatedModels).length > 0}
<div class="card shadow-lg mt-8 bg-white">
<TabGroup justify="justify-center">
{#each Object.entries(data.relatedModels) as [urlmodel, model], index}
{#each Object.entries(data.relatedModels).sort((a, b) => {
return orderRelatedModels.indexOf(a[0]) - orderRelatedModels.indexOf(b[0]);
}) as [urlmodel, model], index}
<Tab bind:group={tabSet} value={index} name={`${urlmodel}_tab`}>
{safeTranslate(model.info.localNamePlural)}
{#if model.table.body.length > 0}
Expand Down

0 comments on commit 944b1f5

Please sign in to comment.