diff --git a/packages/frontend/src/components/dashboard/TemplateTable/Container.vue b/packages/frontend/src/components/dashboard/TemplateTable/Container.vue index f6ec244..7a61f82 100644 --- a/packages/frontend/src/components/dashboard/TemplateTable/Container.vue +++ b/packages/frontend/src/components/dashboard/TemplateTable/Container.vue @@ -12,8 +12,8 @@ import Column from "primevue/column"; import DataTable from "primevue/datatable"; import InputText from "primevue/inputtext"; import SelectButton from "primevue/selectbutton"; -import type { RoleDTO, TemplateDTO, UserDTO } from "shared"; -import { computed } from "vue"; +import type { RoleDTO, RuleStatusDTO, TemplateDTO, UserDTO } from "shared"; +import { computed, ref } from "vue"; import RuleStatus from "./RuleStatus.vue"; const props = defineProps<{ @@ -23,6 +23,20 @@ const props = defineProps<{ settingsState: SettingsState & { type: "Success" }; }>(); +const selectedStatusFilter = ref("All"); + +const filteredTemplates = computed(() => { + if (selectedStatusFilter.value === "All") return props.state.templates; + + return props.state.templates.filter(template => + template.rules.some(rule => rule.status === selectedStatusFilter.value) + ); +}); + +const handleStatusFilterChange = (status: RuleStatusDTO | "All") => { + selectedStatusFilter.value = status; +}; + const getRoleValue = (template: TemplateDTO, role: RoleDTO) => { const rule = template.rules.find( (rule) => rule.type === "RoleRule" && rule.roleId === role.id, @@ -171,6 +185,17 @@ const onTemplateUpdate = ( @update:model-value="setAutoCaptureRequests" /> +
+ + +