|
@ -1,6 +1,7 @@ |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import type Project from "../models/project"; |
|
|
import type Project from "../models/project"; |
|
|
import projectStore from "../stores/project"; |
|
|
import projectStore from "../stores/project"; |
|
|
|
|
|
import projectGroupStore from "../stores/projectGroup"; |
|
|
interface OptGroup { |
|
|
interface OptGroup { |
|
|
status: string |
|
|
status: string |
|
|
projects: Project[] |
|
|
projects: Project[] |
|
@ -8,44 +9,55 @@ |
|
|
|
|
|
|
|
|
export let value = ""; |
|
|
export let value = ""; |
|
|
export let name = ""; |
|
|
export let name = ""; |
|
|
|
|
|
export let groupId = ""; |
|
|
export let disabled = false; |
|
|
export let disabled = false; |
|
|
export let optional = false; |
|
|
export let optional = false; |
|
|
|
|
|
|
|
|
let optGroups: OptGroup[] |
|
|
let optGroups: OptGroup[] |
|
|
|
|
|
|
|
|
$: { |
|
|
$: { |
|
|
|
|
|
let projects = $projectStore.projects; |
|
|
|
|
|
let labels = {}; |
|
|
|
|
|
if (groupId != "") { |
|
|
|
|
|
const group = $projectGroupStore.groups.find(g => g.id === groupId); |
|
|
|
|
|
if (group != null) { |
|
|
|
|
|
projects = group.projects; |
|
|
|
|
|
labels = group.categoryNames; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
optGroups = [ |
|
|
optGroups = [ |
|
|
{ |
|
|
{ |
|
|
status: "Deadlines", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => p.active && p.endTime) |
|
|
|
|
|
|
|
|
status: labels["deadlines"] || "Deadlines", |
|
|
|
|
|
projects: projects.filter(p => p.active && p.endTime) |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "Active", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => p.active && !p.endTime) |
|
|
|
|
|
|
|
|
status: labels["active"] || "Active", |
|
|
|
|
|
projects: projects.filter(p => p.active && !p.endTime) |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "To Do", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "to do") |
|
|
|
|
|
|
|
|
status: labels["progress"] || "Progress", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "progress") |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "On Hold", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "on hold") |
|
|
|
|
|
|
|
|
status: labels["background"] || "Background", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "background") |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "Completed", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "completed") |
|
|
|
|
|
|
|
|
status: labels["to do"] || "To Do", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "to do") |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "Background", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "background") |
|
|
|
|
|
|
|
|
status: labels["on hold"] || "On Hold", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "on hold") |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "Progress", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "progress") |
|
|
|
|
|
|
|
|
status: labels["completed"] || "Completed", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "completed") |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
status: "Failed", |
|
|
|
|
|
projects: $projectStore.projects.filter(p => !p.active && p.statusTag === "failed") |
|
|
|
|
|
|
|
|
status: labels["failed"] || "Failed", |
|
|
|
|
|
projects: projects.filter(p => !p.active && p.statusTag === "failed") |
|
|
}, |
|
|
}, |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
@ -72,7 +84,7 @@ |
|
|
{#if group.projects.length > 0} |
|
|
{#if group.projects.length > 0} |
|
|
<optgroup label={group.status}> |
|
|
<optgroup label={group.status}> |
|
|
{#each group.projects as project (project.id)} |
|
|
{#each group.projects as project (project.id)} |
|
|
<option value={project.id} selected={project.id === value}>{project.name}</option> |
|
|
|
|
|
|
|
|
<option value={project.id} selected={project.id === value}>{project.tags.length ? `${project.tags[0]}: ${project.name}` : project.name}</option> |
|
|
{/each} |
|
|
{/each} |
|
|
</optgroup> |
|
|
</optgroup> |
|
|
{/if} |
|
|
{/if} |
|
|